OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
HdaCodecComponentName.c
Go to the documentation of this file.
1/*
2 * File: HdaCodecComponentName.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 gHdaCodecDriverNameTable[] = {
29 { "eng;en", L"HDA Codec Driver" },
30 { NULL, NULL }
31};
32
33GLOBAL_REMOVE_IF_UNREFERENCED
39
40GLOBAL_REMOVE_IF_UNREFERENCED
41EFI_COMPONENT_NAME2_PROTOCOL gHdaCodecComponentName2 = {
42 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)HdaCodecComponentNameGetDriverName,
43 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)HdaCodecComponentNameGetControllerName,
44 "en"
45};
46
47EFI_STATUS
48EFIAPI
50 IN EFI_COMPONENT_NAME_PROTOCOL *This,
51 IN CHAR8 *Language,
52 OUT CHAR16 **DriverName
53 )
54{
55 return LookupUnicodeString2 (
56 Language,
57 This->SupportedLanguages,
59 DriverName,
60 (BOOLEAN)(This == &gHdaCodecComponentName)
61 );
62}
63
64EFI_STATUS
65EFIAPI
67 IN EFI_COMPONENT_NAME_PROTOCOL *This,
68 IN EFI_HANDLE ControllerHandle,
69 IN EFI_HANDLE ChildHandle OPTIONAL,
70 IN CHAR8 *Language,
71 OUT CHAR16 **ControllerName
72 )
73{
74 // Create variables.
75 EFI_STATUS Status;
76 EFI_HDA_CODEC_INFO_PROTOCOL *HdaCodecInfo;
77
78 // Ensure there is no child handle.
79 if (ChildHandle != NULL) {
80 return EFI_UNSUPPORTED;
81 }
82
83 // Get info protocol.
84 Status = gBS->OpenProtocol (
85 ControllerHandle,
87 (VOID **)&HdaCodecInfo,
88 gHdaCodecDriverBinding.DriverBindingHandle,
89 ControllerHandle,
90 EFI_OPEN_PROTOCOL_GET_PROTOCOL
91 );
92 if (EFI_ERROR (Status)) {
93 return Status;
94 }
95
96 // Get codec name.
97 return HdaCodecInfo->GetName (HdaCodecInfo, (CONST CHAR16 **)ControllerName);
98}
EFI_DRIVER_BINDING_PROTOCOL gHdaCodecDriverBinding
Definition AudioDxe.c:52
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gHdaCodecComponentName
EFI_STATUS EFIAPI HdaCodecComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE gHdaCodecDriverNameTable[]
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gHdaCodecComponentName2
EFI_STATUS EFIAPI HdaCodecComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_GUID gEfiHdaCodecInfoProtocolGuid
EFI_BOOT_SERVICES * gBS
EFI_HDA_CODEC_INFO_GET_NAME GetName