]> git.proxmox.com Git - mirror_edk2.git/blob - PcAtChipsetPkg/IsaAcpiDxe/ComponentName.c
PcAtChipsetPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / ComponentName.c
1 /** @file
2 UEFI Component Name(2) protocol implementation for IsaAcpi driver.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 **/
7
8 #include "PcatIsaAcpi.h"
9
10 //
11 // EFI Component Name Functions
12 //
13 /**
14 Retrieves a Unicode string that is the user readable name of the driver.
15
16 This function retrieves the user readable name of a driver in the form of a
17 Unicode string. If the driver specified by This has a user readable name in
18 the language specified by Language, then a pointer to the driver name is
19 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
20 by This does not support the language specified by Language,
21 then EFI_UNSUPPORTED is returned.
22
23 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
24 EFI_COMPONENT_NAME_PROTOCOL instance.
25
26 @param Language[in] A pointer to a Null-terminated ASCII string
27 array indicating the language. This is the
28 language of the driver name that the caller is
29 requesting, and it must match one of the
30 languages specified in SupportedLanguages. The
31 number of languages supported by a driver is up
32 to the driver writer. Language is specified
33 in RFC 4646 or ISO 639-2 language code format.
34
35 @param DriverName[out] A pointer to the Unicode string to return.
36 This Unicode string is the name of the
37 driver specified by This in the language
38 specified by Language.
39
40 @retval EFI_SUCCESS The Unicode string for the Driver specified by
41 This and the language specified by Language was
42 returned in DriverName.
43
44 @retval EFI_INVALID_PARAMETER Language is NULL.
45
46 @retval EFI_INVALID_PARAMETER DriverName is NULL.
47
48 @retval EFI_UNSUPPORTED The driver specified by This does not support
49 the language specified by Language.
50
51 **/
52 EFI_STATUS
53 EFIAPI
54 PcatIsaAcpiComponentNameGetDriverName (
55 IN EFI_COMPONENT_NAME_PROTOCOL *This,
56 IN CHAR8 *Language,
57 OUT CHAR16 **DriverName
58 );
59
60 /**
61 Retrieves a Unicode string that is the user readable name of the controller
62 that is being managed by a driver.
63
64 This function retrieves the user readable name of the controller specified by
65 ControllerHandle and ChildHandle in the form of a Unicode string. If the
66 driver specified by This has a user readable name in the language specified by
67 Language, then a pointer to the controller name is returned in ControllerName,
68 and EFI_SUCCESS is returned. If the driver specified by This is not currently
69 managing the controller specified by ControllerHandle and ChildHandle,
70 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
71 support the language specified by Language, then EFI_UNSUPPORTED is returned.
72
73 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
74 EFI_COMPONENT_NAME_PROTOCOL instance.
75
76 @param ControllerHandle[in] The handle of a controller that the driver
77 specified by This is managing. This handle
78 specifies the controller whose name is to be
79 returned.
80
81 @param ChildHandle[in] The handle of the child controller to retrieve
82 the name of. This is an optional parameter that
83 may be NULL. It will be NULL for device
84 drivers. It will also be NULL for a bus drivers
85 that wish to retrieve the name of the bus
86 controller. It will not be NULL for a bus
87 driver that wishes to retrieve the name of a
88 child controller.
89
90 @param Language[in] A pointer to a Null-terminated ASCII string
91 array indicating the language. This is the
92 language of the driver name that the caller is
93 requesting, and it must match one of the
94 languages specified in SupportedLanguages. The
95 number of languages supported by a driver is up
96 to the driver writer. Language is specified in
97 RFC 4646 or ISO 639-2 language code format.
98
99 @param ControllerName[out] A pointer to the Unicode string to return.
100 This Unicode string is the name of the
101 controller specified by ControllerHandle and
102 ChildHandle in the language specified by
103 Language from the point of view of the driver
104 specified by This.
105
106 @retval EFI_SUCCESS The Unicode string for the user readable name in
107 the language specified by Language for the
108 driver specified by This was returned in
109 DriverName.
110
111 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
112
113 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
114 EFI_HANDLE.
115
116 @retval EFI_INVALID_PARAMETER Language is NULL.
117
118 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
119
120 @retval EFI_UNSUPPORTED The driver specified by This is not currently
121 managing the controller specified by
122 ControllerHandle and ChildHandle.
123
124 @retval EFI_UNSUPPORTED The driver specified by This does not support
125 the language specified by Language.
126
127 **/
128 EFI_STATUS
129 EFIAPI
130 PcatIsaAcpiComponentNameGetControllerName (
131 IN EFI_COMPONENT_NAME_PROTOCOL *This,
132 IN EFI_HANDLE ControllerHandle,
133 IN EFI_HANDLE ChildHandle OPTIONAL,
134 IN CHAR8 *Language,
135 OUT CHAR16 **ControllerName
136 );
137
138 //
139 // EFI Component Name Protocol
140 //
141
142 EFI_COMPONENT_NAME2_PROTOCOL gPcatIsaAcpiComponentName2 = {
143 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PcatIsaAcpiComponentNameGetDriverName,
144 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PcatIsaAcpiComponentNameGetControllerName,
145 "en"
146 };
147
148 EFI_COMPONENT_NAME_PROTOCOL gPcatIsaAcpiComponentName = {
149 PcatIsaAcpiComponentNameGetDriverName,
150 PcatIsaAcpiComponentNameGetControllerName,
151 "eng"
152 };
153
154
155 EFI_UNICODE_STRING_TABLE mPcatIsaAcpiDriverNameTable[] = {
156 {
157 "eng;en",
158 L"PC-AT ISA Device Enumeration Driver"
159 },
160 {
161 NULL,
162 NULL
163 }
164 };
165
166 /**
167 Retrieves a Unicode string that is the user readable name of the driver.
168
169 This function retrieves the user readable name of a driver in the form of a
170 Unicode string. If the driver specified by This has a user readable name in
171 the language specified by Language, then a pointer to the driver name is
172 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
173 by This does not support the language specified by Language,
174 then EFI_UNSUPPORTED is returned.
175
176 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
177 EFI_COMPONENT_NAME_PROTOCOL instance.
178
179 @param Language[in] A pointer to a Null-terminated ASCII string
180 array indicating the language. This is the
181 language of the driver name that the caller is
182 requesting, and it must match one of the
183 languages specified in SupportedLanguages. The
184 number of languages supported by a driver is up
185 to the driver writer. Language is specified
186 in RFC 4646 or ISO 639-2 language code format.
187
188 @param DriverName[out] A pointer to the Unicode string to return.
189 This Unicode string is the name of the
190 driver specified by This in the language
191 specified by Language.
192
193 @retval EFI_SUCCESS The Unicode string for the Driver specified by
194 This and the language specified by Language was
195 returned in DriverName.
196
197 @retval EFI_INVALID_PARAMETER Language is NULL.
198
199 @retval EFI_INVALID_PARAMETER DriverName is NULL.
200
201 @retval EFI_UNSUPPORTED The driver specified by This does not support
202 the language specified by Language.
203
204 **/
205 EFI_STATUS
206 EFIAPI
207 PcatIsaAcpiComponentNameGetDriverName (
208 IN EFI_COMPONENT_NAME_PROTOCOL *This,
209 IN CHAR8 *Language,
210 OUT CHAR16 **DriverName
211 )
212 {
213 return LookupUnicodeString2 (
214 Language,
215 This->SupportedLanguages,
216 mPcatIsaAcpiDriverNameTable,
217 DriverName,
218 (BOOLEAN)(This == &gPcatIsaAcpiComponentName)
219 );
220 }
221
222 /**
223 Retrieves a Unicode string that is the user readable name of the controller
224 that is being managed by a driver.
225
226 This function retrieves the user readable name of the controller specified by
227 ControllerHandle and ChildHandle in the form of a Unicode string. If the
228 driver specified by This has a user readable name in the language specified by
229 Language, then a pointer to the controller name is returned in ControllerName,
230 and EFI_SUCCESS is returned. If the driver specified by This is not currently
231 managing the controller specified by ControllerHandle and ChildHandle,
232 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
233 support the language specified by Language, then EFI_UNSUPPORTED is returned.
234
235 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
236 EFI_COMPONENT_NAME_PROTOCOL instance.
237
238 @param ControllerHandle[in] The handle of a controller that the driver
239 specified by This is managing. This handle
240 specifies the controller whose name is to be
241 returned.
242
243 @param ChildHandle[in] The handle of the child controller to retrieve
244 the name of. This is an optional parameter that
245 may be NULL. It will be NULL for device
246 drivers. It will also be NULL for a bus drivers
247 that wish to retrieve the name of the bus
248 controller. It will not be NULL for a bus
249 driver that wishes to retrieve the name of a
250 child controller.
251
252 @param Language[in] A pointer to a Null-terminated ASCII string
253 array indicating the language. This is the
254 language of the driver name that the caller is
255 requesting, and it must match one of the
256 languages specified in SupportedLanguages. The
257 number of languages supported by a driver is up
258 to the driver writer. Language is specified in
259 RFC 4646 or ISO 639-2 language code format.
260
261 @param ControllerName[out] A pointer to the Unicode string to return.
262 This Unicode string is the name of the
263 controller specified by ControllerHandle and
264 ChildHandle in the language specified by
265 Language from the point of view of the driver
266 specified by This.
267
268 @retval EFI_SUCCESS The Unicode string for the user readable name in
269 the language specified by Language for the
270 driver specified by This was returned in
271 DriverName.
272
273 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
274
275 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
276 EFI_HANDLE.
277
278 @retval EFI_INVALID_PARAMETER Language is NULL.
279
280 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
281
282 @retval EFI_UNSUPPORTED The driver specified by This is not currently
283 managing the controller specified by
284 ControllerHandle and ChildHandle.
285
286 @retval EFI_UNSUPPORTED The driver specified by This does not support
287 the language specified by Language.
288
289 **/
290 EFI_STATUS
291 EFIAPI
292 PcatIsaAcpiComponentNameGetControllerName (
293 IN EFI_COMPONENT_NAME_PROTOCOL *This,
294 IN EFI_HANDLE ControllerHandle,
295 IN EFI_HANDLE ChildHandle OPTIONAL,
296 IN CHAR8 *Language,
297 OUT CHAR16 **ControllerName
298 )
299 {
300 return EFI_UNSUPPORTED;
301 }