OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
HdaControllerComponentName.c
Go to the documentation of this file.
1/*
2 * File: HdaControllerComponentName.c
3 *
4 * Copyright (c) 2018 John Davis
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
26
27GLOBAL_REMOVE_IF_UNREFERENCED
28EFI_UNICODE_STRING_TABLE gHdaDriverNameTable[] = {
29 {
30 "eng;en",
31 L"HDA Controller Driver"
32 },
33 {
34 NULL,
35 NULL
36 }
37};
38
39GLOBAL_REMOVE_IF_UNREFERENCED
45
46GLOBAL_REMOVE_IF_UNREFERENCED
47EFI_COMPONENT_NAME2_PROTOCOL gHdaControllerComponentName2 = {
48 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)HdaControllerComponentNameGetDriverName,
49 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)HdaControllerComponentNameGetControllerName,
50 "en"
51};
52
53EFI_STATUS
54EFIAPI
56 IN EFI_COMPONENT_NAME_PROTOCOL *This,
57 IN CHAR8 *Language,
58 OUT CHAR16 **DriverName
59 )
60{
61 return LookupUnicodeString2 (
62 Language,
63 This->SupportedLanguages,
65 DriverName,
66 (BOOLEAN)(This == &gHdaControllerComponentName)
67 );
68}
69
70EFI_STATUS
71EFIAPI
73 IN EFI_COMPONENT_NAME_PROTOCOL *This,
74 IN EFI_HANDLE ControllerHandle,
75 IN EFI_HANDLE ChildHandle OPTIONAL,
76 IN CHAR8 *Language,
77 OUT CHAR16 **ControllerName
78 )
79{
80 // Create variables.
81 EFI_STATUS Status;
82 EFI_HDA_CONTROLLER_INFO_PROTOCOL *HdaControllerInfo;
83
84 // Ensure there is no child handle.
85 if (ChildHandle != NULL) {
86 return EFI_UNSUPPORTED;
87 }
88
89 // Get info protocol.
90 Status = gBS->OpenProtocol (
91 ControllerHandle,
93 (VOID **)&HdaControllerInfo,
94 gHdaControllerDriverBinding.DriverBindingHandle,
95 ControllerHandle,
96 EFI_OPEN_PROTOCOL_GET_PROTOCOL
97 );
98 if (EFI_ERROR (Status)) {
99 return Status;
100 }
101
102 // Get controller name.
103 return HdaControllerInfo->GetName (HdaControllerInfo, (CONST CHAR16 **)ControllerName);
104}
EFI_DRIVER_BINDING_PROTOCOL gHdaControllerDriverBinding
Definition AudioDxe.c:39
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gHdaControllerComponentName2
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE gHdaDriverNameTable[]
EFI_STATUS EFIAPI HdaControllerComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gHdaControllerComponentName
EFI_STATUS EFIAPI HdaControllerComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_GUID gEfiHdaControllerInfoProtocolGuid
EFI_BOOT_SERVICES * gBS
EFI_HDA_CONTROLLER_INFO_GET_NAME GetName