]>
Commit | Line | Data |
---|---|---|
112e584b SZ |
1 | /** @file\r |
2 | UEFI Component Name(2) protocol implementation for Opal driver.\r | |
3 | \r | |
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
289b714b | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
112e584b SZ |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #include "OpalDriver.h"\r | |
10 | \r | |
11 | //\r | |
12 | // EFI Component Name Protocol\r | |
13 | //\r | |
14 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gOpalComponentName = {\r | |
15 | OpalEfiDriverComponentNameGetDriverName,\r | |
16 | OpalEfiDriverComponentNameGetControllerName,\r | |
17 | "eng"\r | |
18 | };\r | |
19 | \r | |
20 | //\r | |
21 | // EFI Component Name 2 Protocol\r | |
22 | //\r | |
23 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gOpalComponentName2 = {\r | |
24 | OpalEfiDriverComponentName2GetDriverName,\r | |
25 | OpalEfiDriverComponentName2GetControllerName,\r | |
26 | "en"\r | |
27 | };\r | |
28 | \r | |
29 | \r | |
30 | /// The name of the driver in all the languages we support.\r | |
31 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mOpalDriverNameTable[] = {\r | |
32 | { LANGUAGE_RFC_3066_ENGLISH, (CHAR16*)EFI_DRIVER_NAME_UNICODE },\r | |
33 | { LANGUAGE_ISO_639_2_ENGLISH, (CHAR16*)EFI_DRIVER_NAME_UNICODE },\r | |
34 | { 0, 0 }\r | |
35 | };\r | |
36 | \r | |
37 | /**\r | |
38 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
39 | \r | |
40 | This function retrieves the user readable name of a driver in the form of a\r | |
41 | Unicode string. If the driver specified by This has a user readable name in\r | |
42 | the language specified by Language, then a pointer to the driver name is\r | |
43 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
44 | by This does not support the language specified by Language,\r | |
45 | then EFI_UNSUPPORTED is returned.\r | |
46 | \r | |
47 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
48 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
49 | \r | |
50 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
51 | array indicating the language. This is the\r | |
52 | language of the driver name that the caller is\r | |
53 | requesting, and it must match one of the\r | |
54 | languages specified in SupportedLanguages. The\r | |
55 | number of languages supported by a driver is up\r | |
56 | to the driver writer. Language is specified\r | |
57 | in RFC 4646 or ISO 639-2 language code format.\r | |
58 | \r | |
59 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
60 | This Unicode string is the name of the\r | |
61 | driver specified by This in the language\r | |
62 | specified by Language.\r | |
63 | \r | |
64 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
65 | This and the language specified by Language was\r | |
66 | returned in DriverName.\r | |
67 | \r | |
68 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
69 | \r | |
70 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
71 | \r | |
72 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
73 | the language specified by Language.\r | |
74 | \r | |
75 | **/\r | |
76 | EFI_STATUS\r | |
77 | EFIAPI\r | |
78 | OpalEfiDriverComponentNameGetDriverName(\r | |
79 | EFI_COMPONENT_NAME_PROTOCOL* This,\r | |
80 | CHAR8* Language,\r | |
81 | CHAR16** DriverName\r | |
82 | )\r | |
83 | {\r | |
84 | return LookupUnicodeString2(\r | |
85 | Language,\r | |
86 | This->SupportedLanguages,\r | |
87 | mOpalDriverNameTable,\r | |
88 | DriverName,\r | |
89 | TRUE\r | |
90 | );\r | |
91 | }\r | |
92 | \r | |
93 | /**\r | |
94 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
95 | \r | |
96 | This function retrieves the user readable name of a driver in the form of a\r | |
97 | Unicode string. If the driver specified by This has a user readable name in\r | |
98 | the language specified by Language, then a pointer to the driver name is\r | |
99 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
100 | by This does not support the language specified by Language,\r | |
101 | then EFI_UNSUPPORTED is returned.\r | |
102 | \r | |
103 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
104 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
105 | \r | |
106 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
107 | array indicating the language. This is the\r | |
108 | language of the driver name that the caller is\r | |
109 | requesting, and it must match one of the\r | |
110 | languages specified in SupportedLanguages. The\r | |
111 | number of languages supported by a driver is up\r | |
112 | to the driver writer. Language is specified\r | |
113 | in RFC 4646 or ISO 639-2 language code format.\r | |
114 | \r | |
115 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
116 | This Unicode string is the name of the\r | |
117 | driver specified by This in the language\r | |
118 | specified by Language.\r | |
119 | \r | |
120 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
121 | This and the language specified by Language was\r | |
122 | returned in DriverName.\r | |
123 | \r | |
124 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
125 | \r | |
126 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
127 | \r | |
128 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
129 | the language specified by Language.\r | |
130 | \r | |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | EFIAPI\r | |
134 | OpalEfiDriverComponentName2GetDriverName(\r | |
135 | EFI_COMPONENT_NAME2_PROTOCOL* This,\r | |
136 | CHAR8* Language,\r | |
137 | CHAR16** DriverName\r | |
138 | )\r | |
139 | {\r | |
140 | return LookupUnicodeString2(\r | |
141 | Language,\r | |
142 | This->SupportedLanguages,\r | |
143 | mOpalDriverNameTable,\r | |
144 | DriverName,\r | |
145 | FALSE\r | |
146 | );\r | |
147 | }\r | |
148 | \r | |
149 | /**\r | |
150 | Retrieves a Unicode string that is the user readable name of the controller\r | |
151 | that is being managed by a driver.\r | |
152 | \r | |
153 | This function retrieves the user readable name of the controller specified by\r | |
154 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
155 | driver specified by This has a user readable name in the language specified by\r | |
156 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
157 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
158 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
159 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
160 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
161 | \r | |
162 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
163 | specified by This is managing. This handle\r | |
164 | specifies the controller whose name is to be\r | |
165 | returned.\r | |
166 | \r | |
167 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
168 | the name of. This is an optional parameter that\r | |
169 | may be NULL. It will be NULL for device\r | |
170 | drivers. It will also be NULL for a bus drivers\r | |
171 | that wish to retrieve the name of the bus\r | |
172 | controller. It will not be NULL for a bus\r | |
173 | driver that wishes to retrieve the name of a\r | |
174 | child controller.\r | |
175 | \r | |
176 | \r | |
177 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
178 | array indicating the language. This is the\r | |
179 | language of the driver name that the caller is\r | |
180 | requesting, and it must match one of the\r | |
181 | languages specified in SupportedLanguages. The\r | |
182 | number of languages supported by a driver is up\r | |
183 | to the driver writer. Language is specified in\r | |
184 | RFC 4646 or ISO 639-2 language code format.\r | |
185 | \r | |
186 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
187 | This Unicode string is the name of the\r | |
188 | controller specified by ControllerHandle and\r | |
189 | ChildHandle in the language specified by\r | |
190 | Language from the point of view of the driver\r | |
191 | specified by This.\r | |
192 | \r | |
193 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
194 | the language specified by Language for the\r | |
195 | driver specified by This was returned in\r | |
196 | DriverName.\r | |
197 | \r | |
198 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
199 | \r | |
200 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
201 | EFI_HANDLE.\r | |
202 | \r | |
203 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
204 | \r | |
205 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
206 | \r | |
207 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
208 | managing the controller specified by\r | |
209 | ControllerHandle and ChildHandle.\r | |
210 | \r | |
211 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
212 | the language specified by Language.\r | |
213 | \r | |
214 | **/\r | |
215 | EFI_STATUS\r | |
216 | GetControllerName(\r | |
217 | EFI_HANDLE ControllerHandle,\r | |
218 | EFI_HANDLE ChildHandle,\r | |
219 | CHAR8* Language,\r | |
220 | CHAR16** ControllerName\r | |
221 | )\r | |
222 | {\r | |
223 | if (Language == NULL || ControllerName == NULL || ControllerHandle == NULL) {\r | |
224 | return EFI_INVALID_PARAMETER;\r | |
225 | }\r | |
226 | \r | |
227 | // don't support any controller or children names\r | |
228 | return EFI_UNSUPPORTED;\r | |
229 | }\r | |
230 | \r | |
231 | /**\r | |
232 | Retrieves a Unicode string that is the user readable name of the controller\r | |
233 | that is being managed by a driver.\r | |
234 | \r | |
235 | This function retrieves the user readable name of the controller specified by\r | |
236 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
237 | driver specified by This has a user readable name in the language specified by\r | |
238 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
239 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
240 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
241 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
242 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
243 | \r | |
244 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
245 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
246 | \r | |
247 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
248 | specified by This is managing. This handle\r | |
249 | specifies the controller whose name is to be\r | |
250 | returned.\r | |
251 | \r | |
252 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
253 | the name of. This is an optional parameter that\r | |
254 | may be NULL. It will be NULL for device\r | |
255 | drivers. It will also be NULL for a bus drivers\r | |
256 | that wish to retrieve the name of the bus\r | |
257 | controller. It will not be NULL for a bus\r | |
258 | driver that wishes to retrieve the name of a\r | |
259 | child controller.\r | |
260 | \r | |
261 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
262 | array indicating the language. This is the\r | |
263 | language of the driver name that the caller is\r | |
264 | requesting, and it must match one of the\r | |
265 | languages specified in SupportedLanguages. The\r | |
266 | number of languages supported by a driver is up\r | |
267 | to the driver writer. Language is specified in\r | |
268 | RFC 4646 or ISO 639-2 language code format.\r | |
269 | \r | |
270 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
271 | This Unicode string is the name of the\r | |
272 | controller specified by ControllerHandle and\r | |
273 | ChildHandle in the language specified by\r | |
274 | Language from the point of view of the driver\r | |
275 | specified by This.\r | |
276 | \r | |
277 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
278 | the language specified by Language for the\r | |
279 | driver specified by This was returned in\r | |
280 | DriverName.\r | |
281 | \r | |
282 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
283 | \r | |
284 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
285 | EFI_HANDLE.\r | |
286 | \r | |
287 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
288 | \r | |
289 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
290 | \r | |
291 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
292 | managing the controller specified by\r | |
293 | ControllerHandle and ChildHandle.\r | |
294 | \r | |
295 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
296 | the language specified by Language.\r | |
297 | \r | |
298 | **/\r | |
299 | EFI_STATUS\r | |
300 | EFIAPI\r | |
301 | OpalEfiDriverComponentNameGetControllerName(\r | |
302 | EFI_COMPONENT_NAME_PROTOCOL* This,\r | |
303 | EFI_HANDLE ControllerHandle,\r | |
304 | EFI_HANDLE ChildHandle,\r | |
305 | CHAR8* Language,\r | |
306 | CHAR16** ControllerName\r | |
307 | )\r | |
308 | {\r | |
309 | return (GetControllerName( ControllerHandle, ChildHandle, Language, ControllerName));\r | |
310 | }\r | |
311 | \r | |
312 | /**\r | |
313 | Retrieves a Unicode string that is the user readable name of the controller\r | |
314 | that is being managed by a driver.\r | |
315 | \r | |
316 | This function retrieves the user readable name of the controller specified by\r | |
317 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
318 | driver specified by This has a user readable name in the language specified by\r | |
319 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
320 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
321 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
322 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
323 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
324 | \r | |
325 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
326 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
327 | \r | |
328 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
329 | specified by This is managing. This handle\r | |
330 | specifies the controller whose name is to be\r | |
331 | returned.\r | |
332 | \r | |
333 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
334 | the name of. This is an optional parameter that\r | |
335 | may be NULL. It will be NULL for device\r | |
336 | drivers. It will also be NULL for a bus drivers\r | |
337 | that wish to retrieve the name of the bus\r | |
338 | controller. It will not be NULL for a bus\r | |
339 | driver that wishes to retrieve the name of a\r | |
340 | child controller.\r | |
341 | \r | |
342 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
343 | array indicating the language. This is the\r | |
344 | language of the driver name that the caller is\r | |
345 | requesting, and it must match one of the\r | |
346 | languages specified in SupportedLanguages. The\r | |
347 | number of languages supported by a driver is up\r | |
348 | to the driver writer. Language is specified in\r | |
349 | RFC 4646 or ISO 639-2 language code format.\r | |
350 | \r | |
351 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
352 | This Unicode string is the name of the\r | |
353 | controller specified by ControllerHandle and\r | |
354 | ChildHandle in the language specified by\r | |
355 | Language from the point of view of the driver\r | |
356 | specified by This.\r | |
357 | \r | |
358 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
359 | the language specified by Language for the\r | |
360 | driver specified by This was returned in\r | |
361 | DriverName.\r | |
362 | \r | |
363 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
364 | \r | |
365 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
366 | EFI_HANDLE.\r | |
367 | \r | |
368 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
369 | \r | |
370 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
371 | \r | |
372 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
373 | managing the controller specified by\r | |
374 | ControllerHandle and ChildHandle.\r | |
375 | \r | |
376 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
377 | the language specified by Language.\r | |
378 | \r | |
379 | **/\r | |
380 | EFI_STATUS\r | |
381 | EFIAPI\r | |
382 | OpalEfiDriverComponentName2GetControllerName(\r | |
383 | EFI_COMPONENT_NAME2_PROTOCOL* This,\r | |
384 | EFI_HANDLE ControllerHandle,\r | |
385 | EFI_HANDLE ChildHandle,\r | |
386 | CHAR8* Language,\r | |
387 | CHAR16** ControllerName\r | |
388 | )\r | |
389 | {\r | |
390 | return (GetControllerName(ControllerHandle, ChildHandle, Language, ControllerName));\r | |
391 | }\r | |
392 | \r |