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