]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Isa/IsaBusDxe/ComponentName.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Isa / IsaBusDxe / ComponentName.c
1 /** @file
2 UEFI Component Name(2) protocol implementation for IsaBusDxe driver.
3
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "ComponentName.h"
10 #include <Library/UefiLib.h>
11
12 //
13 // Driver name table
14 //
15 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIsaBusDriverNameTable[] = {
16 { "eng;en", L"PI ISA BUS Driver" },
17 { NULL , NULL }
18 };
19
20 //
21 // EFI Component Name Protocol
22 //
23 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = {
24 IsaBusComponentNameGetDriverName,
25 IsaBusComponentNameGetControllerName,
26 "eng"
27 };
28
29 //
30 // EFI Component Name 2 Protocol
31 //
32 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIsaBusComponentName2 = {
33 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IsaBusComponentNameGetDriverName,
34 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IsaBusComponentNameGetControllerName,
35 "en"
36 };
37
38 /**
39 Retrieves a Unicode string that is the user readable name of the driver.
40
41 This function retrieves the user readable name of a driver in the form of a
42 Unicode string. If the driver specified by This has a user readable name in
43 the language specified by Language, then a pointer to the driver name is
44 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
45 by This does not support the language specified by Language,
46 then EFI_UNSUPPORTED is returned.
47
48 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
49 EFI_COMPONENT_NAME_PROTOCOL instance.
50
51 @param Language[in] A pointer to a Null-terminated ASCII string
52 array indicating the language. This is the
53 language of the driver name that the caller is
54 requesting, and it must match one of the
55 languages specified in SupportedLanguages. The
56 number of languages supported by a driver is up
57 to the driver writer. Language is specified
58 in RFC 4646 or ISO 639-2 language code format.
59
60 @param DriverName[out] A pointer to the Unicode string to return.
61 This Unicode string is the name of the
62 driver specified by This in the language
63 specified by Language.
64
65 @retval EFI_SUCCESS The Unicode string for the Driver specified by
66 This and the language specified by Language was
67 returned in DriverName.
68
69 @retval EFI_INVALID_PARAMETER Language is NULL.
70
71 @retval EFI_INVALID_PARAMETER DriverName is NULL.
72
73 @retval EFI_UNSUPPORTED The driver specified by This does not support
74 the language specified by Language.
75
76 **/
77 EFI_STATUS
78 EFIAPI
79 IsaBusComponentNameGetDriverName (
80 IN EFI_COMPONENT_NAME_PROTOCOL *This,
81 IN CHAR8 *Language,
82 OUT CHAR16 **DriverName
83 )
84 {
85 return LookupUnicodeString2 (
86 Language,
87 This->SupportedLanguages,
88 mIsaBusDriverNameTable,
89 DriverName,
90 (BOOLEAN)(This == &gIsaBusComponentName)
91 );
92 }
93
94
95 /**
96 Retrieves a Unicode string that is the user readable name of the controller
97 that is being managed by a driver.
98
99 This function retrieves the user readable name of the controller specified by
100 ControllerHandle and ChildHandle in the form of a Unicode string. If the
101 driver specified by This has a user readable name in the language specified by
102 Language, then a pointer to the controller name is returned in ControllerName,
103 and EFI_SUCCESS is returned. If the driver specified by This is not currently
104 managing the controller specified by ControllerHandle and ChildHandle,
105 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
106 support the language specified by Language, then EFI_UNSUPPORTED is returned.
107
108 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
109 EFI_COMPONENT_NAME_PROTOCOL instance.
110
111 @param ControllerHandle[in] The handle of a controller that the driver
112 specified by This is managing. This handle
113 specifies the controller whose name is to be
114 returned.
115
116 @param ChildHandle[in] The handle of the child controller to retrieve
117 the name of. This is an optional parameter that
118 may be NULL. It will be NULL for device
119 drivers. It will also be NULL for a bus drivers
120 that wish to retrieve the name of the bus
121 controller. It will not be NULL for a bus
122 driver that wishes to retrieve the name of a
123 child controller.
124
125 @param Language[in] A pointer to a Null-terminated ASCII string
126 array indicating the language. This is the
127 language of the driver name that the caller is
128 requesting, and it must match one of the
129 languages specified in SupportedLanguages. The
130 number of languages supported by a driver is up
131 to the driver writer. Language is specified in
132 RFC 4646 or ISO 639-2 language code format.
133
134 @param ControllerName[out] A pointer to the Unicode string to return.
135 This Unicode string is the name of the
136 controller specified by ControllerHandle and
137 ChildHandle in the language specified by
138 Language from the point of view of the driver
139 specified by This.
140
141 @retval EFI_SUCCESS The Unicode string for the user readable name in
142 the language specified by Language for the
143 driver specified by This was returned in
144 DriverName.
145
146 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
147
148 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
149 EFI_HANDLE.
150
151 @retval EFI_INVALID_PARAMETER Language is NULL.
152
153 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
154
155 @retval EFI_UNSUPPORTED The driver specified by This is not currently
156 managing the controller specified by
157 ControllerHandle and ChildHandle.
158
159 @retval EFI_UNSUPPORTED The driver specified by This does not support
160 the language specified by Language.
161
162 **/
163 EFI_STATUS
164 EFIAPI
165 IsaBusComponentNameGetControllerName (
166 IN EFI_COMPONENT_NAME_PROTOCOL *This,
167 IN EFI_HANDLE ControllerHandle,
168 IN EFI_HANDLE ChildHandle OPTIONAL,
169 IN CHAR8 *Language,
170 OUT CHAR16 **ControllerName
171 )
172 {
173 return EFI_UNSUPPORTED;
174 }