]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Values defined and used by the Opal UEFI Driver.\r | |
3 | \r | |
4 | Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _OPAL_DRIVER_H_\r | |
16 | #define _OPAL_DRIVER_H_\r | |
17 | \r | |
18 | #include <PiDxe.h>\r | |
19 | \r | |
20 | #include <IndustryStandard/Pci.h>\r | |
21 | \r | |
22 | #include <Protocol/PciIo.h>\r | |
23 | #include <Protocol/SmmCommunication.h>\r | |
24 | #include <Protocol/BlockIo.h>\r | |
25 | #include <Protocol/LoadedImage.h>\r | |
26 | #include <Protocol/DevicePath.h>\r | |
27 | #include <Protocol/DevicePathToText.h>\r | |
28 | #include <Protocol/StorageSecurityCommand.h>\r | |
29 | \r | |
30 | #include <Guid/EventGroup.h>\r | |
31 | #include <Guid/S3StorageDeviceInitList.h>\r | |
32 | \r | |
33 | #include <Library/UefiLib.h>\r | |
34 | #include <Library/UefiBootServicesTableLib.h>\r | |
35 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
36 | #include <Library/DxeServicesTableLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
38 | #include <Library/MemoryAllocationLib.h>\r | |
39 | #include <Library/BaseLib.h>\r | |
40 | #include <Library/PrintLib.h>\r | |
41 | #include <Library/DebugLib.h>\r | |
42 | #include <Library/DevicePathLib.h>\r | |
43 | #include <Library/HiiLib.h>\r | |
44 | #include <Library/UefiHiiServicesLib.h>\r | |
45 | #include <Library/PciLib.h>\r | |
46 | #include <Library/LockBoxLib.h>\r | |
47 | #include <Library/TcgStorageOpalLib.h>\r | |
48 | #include <Library/Tcg2PhysicalPresenceLib.h>\r | |
49 | \r | |
50 | #include "OpalPasswordCommon.h"\r | |
51 | #include "OpalHiiFormValues.h"\r | |
52 | \r | |
53 | #define EFI_DRIVER_NAME_UNICODE L"1.0 UEFI Opal Driver"\r | |
54 | \r | |
55 | // UEFI 2.1\r | |
56 | #define LANGUAGE_RFC_3066_ENGLISH ((CHAR8*)"en")\r | |
57 | \r | |
58 | // UEFI/EFI < 2.1\r | |
59 | #define LANGUAGE_ISO_639_2_ENGLISH ((CHAR8*)"eng")\r | |
60 | \r | |
61 | #define CONCAT_(x, y) x ## y\r | |
62 | #define CONCAT(x, y) CONCAT_(x, y)\r | |
63 | \r | |
64 | #define UNICODE_STR(x) CONCAT( L, x )\r | |
65 | \r | |
66 | extern EFI_DRIVER_BINDING_PROTOCOL gOpalDriverBinding;\r | |
67 | extern EFI_COMPONENT_NAME_PROTOCOL gOpalComponentName;\r | |
68 | extern EFI_COMPONENT_NAME2_PROTOCOL gOpalComponentName2;\r | |
69 | \r | |
70 | #define OPAL_MSID_LENGHT 128\r | |
71 | \r | |
72 | #define MAX_PASSWORD_TRY_COUNT 5\r | |
73 | \r | |
74 | // PSID Length\r | |
75 | #define PSID_CHARACTER_LENGTH 0x20\r | |
76 | #define MAX_PSID_TRY_COUNT 5\r | |
77 | \r | |
78 | //\r | |
79 | // The max timeout value assume the user can wait for the revert action. The unit of this macro is second.\r | |
80 | // If the revert time value bigger than this one, driver needs to popup a dialog to let user confirm the\r | |
81 | // revert action.\r | |
82 | //\r | |
83 | #define MAX_ACCEPTABLE_REVERTING_TIME 10\r | |
84 | \r | |
85 | #pragma pack(1)\r | |
86 | \r | |
87 | //\r | |
88 | // Structure that is used to represent the available actions for an OpalDisk.\r | |
89 | // The data can then be utilized to expose/hide certain actions available to an end user\r | |
90 | // by the consumer of this library.\r | |
91 | //\r | |
92 | typedef struct {\r | |
93 | //\r | |
94 | // Indicates if the disk can support PSID Revert action. should verify disk supports PSID authority\r | |
95 | //\r | |
96 | UINT16 PsidRevert : 1;\r | |
97 | \r | |
98 | //\r | |
99 | // Indicates if the disk can support Revert action\r | |
100 | //\r | |
101 | UINT16 Revert : 1;\r | |
102 | \r | |
103 | //\r | |
104 | // Indicates if the user must keep data for revert action. It is true if no media encryption is supported.\r | |
105 | //\r | |
106 | UINT16 RevertKeepDataForced : 1;\r | |
107 | \r | |
108 | //\r | |
109 | // Indicates if the disk can support set Admin password\r | |
110 | //\r | |
111 | UINT16 AdminPass : 1;\r | |
112 | \r | |
113 | //\r | |
114 | // Indicates if the disk can support set User password. This action requires that a user\r | |
115 | // password is first enabled.\r | |
116 | //\r | |
117 | UINT16 UserPass : 1;\r | |
118 | \r | |
119 | //\r | |
120 | // Indicates if unlock action is available. Requires disk to be currently locked.\r | |
121 | //\r | |
122 | UINT16 Unlock : 1;\r | |
123 | \r | |
124 | //\r | |
125 | // Indicates if Secure Erase action is available. Action requires admin credentials and media encryption support.\r | |
126 | //\r | |
127 | UINT16 SecureErase : 1;\r | |
128 | \r | |
129 | //\r | |
130 | // Indicates if Disable User action is available. Action requires admin credentials.\r | |
131 | //\r | |
132 | UINT16 DisableUser : 1;\r | |
133 | } OPAL_DISK_ACTIONS;\r | |
134 | \r | |
135 | //\r | |
136 | // Structure that is used to represent an OPAL_DISK.\r | |
137 | //\r | |
138 | typedef struct {\r | |
139 | UINT32 MsidLength; // Byte length of MSID Pin for device\r | |
140 | UINT8 Msid[OPAL_MSID_LENGHT]; // MSID Pin for device\r | |
141 | EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Sscp;\r | |
142 | UINT32 MediaId; // MediaId is used by Ssc Protocol.\r | |
143 | EFI_DEVICE_PATH_PROTOCOL *OpalDevicePath;\r | |
144 | UINT16 OpalBaseComId; // Opal SSC 1 base com id.\r | |
145 | OPAL_OWNER_SHIP Owner;\r | |
146 | OPAL_DISK_SUPPORT_ATTRIBUTE SupportedAttributes;\r | |
147 | TCG_LOCKING_FEATURE_DESCRIPTOR LockingFeature; // Locking Feature Descriptor retrieved from performing a Level 0 Discovery\r | |
148 | UINT8 PasswordLength;\r | |
149 | UINT8 Password[OPAL_MAX_PASSWORD_SIZE];\r | |
150 | \r | |
151 | UINT32 EstimateTimeCost;\r | |
152 | } OPAL_DISK;\r | |
153 | \r | |
154 | //\r | |
155 | // Device with block IO protocol\r | |
156 | //\r | |
157 | typedef struct _OPAL_DRIVER_DEVICE OPAL_DRIVER_DEVICE;\r | |
158 | \r | |
159 | struct _OPAL_DRIVER_DEVICE {\r | |
160 | OPAL_DRIVER_DEVICE *Next; ///< Linked list pointer\r | |
161 | EFI_HANDLE Handle; ///< Device handle\r | |
162 | OPAL_DISK OpalDisk; ///< User context\r | |
163 | CHAR16 *Name16; ///< Allocated/freed by UEFI Filter Driver at device creation/removal\r | |
164 | CHAR8 *NameZ; ///< Allocated/freed by UEFI Filter Driver at device creation/removal\r | |
165 | UINT32 MediaId; ///< Required parameter for EFI_STORAGE_SECURITY_COMMAND_PROTOCOL, from BLOCK_IO_MEDIA\r | |
166 | \r | |
167 | EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Sscp; /// Device protocols consumed\r | |
168 | EFI_DEVICE_PATH_PROTOCOL *OpalDevicePath;\r | |
169 | };\r | |
170 | \r | |
171 | //\r | |
172 | // Opal Driver UEFI Driver Model\r | |
173 | //\r | |
174 | typedef struct {\r | |
175 | EFI_HANDLE Handle; ///< Driver image handle\r | |
176 | OPAL_DRIVER_DEVICE *DeviceList; ///< Linked list of controllers owned by this Driver\r | |
177 | } OPAL_DRIVER;\r | |
178 | \r | |
179 | #pragma pack()\r | |
180 | \r | |
181 | //\r | |
182 | // Retrieves a OPAL_DRIVER_DEVICE based on the pointer to its StorageSecurity protocol.\r | |
183 | //\r | |
184 | #define DRIVER_DEVICE_FROM_OPALDISK(OpalDiskPointer) (OPAL_DRIVER_DEVICE*)(BASE_CR(OpalDiskPointer, OPAL_DRIVER_DEVICE, OpalDisk))\r | |
185 | \r | |
186 | /**\r | |
187 | Get devcie list info.\r | |
188 | \r | |
189 | @retval return the device list pointer.\r | |
190 | **/\r | |
191 | OPAL_DRIVER_DEVICE*\r | |
192 | OpalDriverGetDeviceList(\r | |
193 | VOID\r | |
194 | );\r | |
195 | \r | |
196 | /**\r | |
197 | Get devcie name through the component name protocol.\r | |
198 | \r | |
199 | @param[in] Dev The device which need to get name.\r | |
200 | \r | |
201 | @retval TRUE Find the name for this device.\r | |
202 | @retval FALSE Not found the name for this device.\r | |
203 | **/\r | |
204 | BOOLEAN\r | |
205 | OpalDriverGetDriverDeviceName(\r | |
206 | OPAL_DRIVER_DEVICE *Dev\r | |
207 | );\r | |
208 | \r | |
209 | /**\r | |
210 | Get current device count.\r | |
211 | \r | |
212 | @retval return the current created device count.\r | |
213 | \r | |
214 | **/\r | |
215 | UINT8\r | |
216 | GetDeviceCount (\r | |
217 | VOID\r | |
218 | );\r | |
219 | \r | |
220 | /**\r | |
221 | Update password for the Opal disk.\r | |
222 | \r | |
223 | @param[in, out] OpalDisk The disk to update password.\r | |
224 | @param[in] Password The input password.\r | |
225 | @param[in] PasswordLength The input password length.\r | |
226 | \r | |
227 | **/\r | |
228 | VOID\r | |
229 | OpalSupportUpdatePassword (\r | |
230 | IN OUT OPAL_DISK *OpalDisk,\r | |
231 | IN VOID *Password,\r | |
232 | IN UINT32 PasswordLength\r | |
233 | );\r | |
234 | \r | |
235 | /**\r | |
236 | \r | |
237 | The function performs determines the available actions for the OPAL_DISK provided.\r | |
238 | \r | |
239 | @param[in] SupportedAttributes The support attribute for the device.\r | |
240 | @param[in] LockingFeature The locking status for the device.\r | |
241 | @param[in] OwnerShip The ownership for the device.\r | |
242 | @param[out] AvalDiskActions Pointer to fill-out with appropriate disk actions.\r | |
243 | \r | |
244 | **/\r | |
245 | TCG_RESULT\r | |
246 | EFIAPI\r | |
247 | OpalSupportGetAvailableActions(\r | |
248 | IN OPAL_DISK_SUPPORT_ATTRIBUTE *SupportedAttributes,\r | |
249 | IN TCG_LOCKING_FEATURE_DESCRIPTOR *LockingFeature,\r | |
250 | IN UINT16 OwnerShip,\r | |
251 | OUT OPAL_DISK_ACTIONS *AvalDiskActions\r | |
252 | );\r | |
253 | \r | |
254 | /**\r | |
255 | Enable Opal Feature for the input device.\r | |
256 | \r | |
257 | @param[in] Session The opal session for the opal device.\r | |
258 | @param[in] Msid Msid\r | |
259 | @param[in] MsidLength Msid Length\r | |
260 | @param[in] Password Admin password\r | |
261 | @param[in] PassLength Length of password in bytes\r | |
262 | \r | |
263 | **/\r | |
264 | TCG_RESULT\r | |
265 | EFIAPI\r | |
266 | OpalSupportEnableOpalFeature (\r | |
267 | IN OPAL_SESSION *Session,\r | |
268 | IN VOID *Msid,\r | |
269 | IN UINT32 MsidLength,\r | |
270 | IN VOID *Password,\r | |
271 | IN UINT32 PassLength\r | |
272 | );\r | |
273 | \r | |
274 | /**\r | |
275 | Unloads UEFI Driver. Very useful for debugging and testing.\r | |
276 | \r | |
277 | @param ImageHandle Image handle this driver.\r | |
278 | \r | |
279 | @retval EFI_SUCCESS This function always complete successfully.\r | |
280 | @retval EFI_INVALID_PARAMETER The input ImageHandle is not valid.\r | |
281 | **/\r | |
282 | EFI_STATUS\r | |
283 | EFIAPI\r | |
284 | EfiDriverUnload(\r | |
285 | EFI_HANDLE ImageHandle\r | |
286 | );\r | |
287 | \r | |
288 | \r | |
289 | /**\r | |
290 | Test to see if this driver supports Controller.\r | |
291 | \r | |
292 | @param This Protocol instance pointer.\r | |
293 | @param ControllerHandle Handle of device to test\r | |
294 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
295 | device to start.\r | |
296 | \r | |
297 | @retval EFI_SUCCESS This driver supports this device.\r | |
298 | @retval EFI_ALREADY_STARTED This driver is already running on this device.\r | |
299 | @retval other This driver does not support this device.\r | |
300 | \r | |
301 | **/\r | |
302 | EFI_STATUS\r | |
303 | EFIAPI\r | |
304 | OpalEfiDriverBindingSupported(\r | |
305 | EFI_DRIVER_BINDING_PROTOCOL* This,\r | |
306 | EFI_HANDLE Controller,\r | |
307 | EFI_DEVICE_PATH_PROTOCOL* RemainingDevicePath\r | |
308 | );\r | |
309 | \r | |
310 | /**\r | |
311 | Enables Opal Management on a supported device if available.\r | |
312 | \r | |
313 | The start function is designed to be called after the Opal UEFI Driver has confirmed the\r | |
314 | "controller", which is a child handle, contains the EF_STORAGE_SECURITY_COMMAND protocols.\r | |
315 | This function will complete the other necessary checks, such as verifying the device supports\r | |
316 | the correct version of Opal. Upon verification, it will add the device to the\r | |
317 | Opal HII list in order to expose Opal managmeent options.\r | |
318 | \r | |
319 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
320 | @param[in] ControllerHandle The handle of the controller to start. This handle\r | |
321 | must support a protocol interface that supplies\r | |
322 | an I/O abstraction to the driver.\r | |
323 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r | |
324 | parameter is ignored by device drivers, and is optional for bus\r | |
325 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
326 | for all the children of Controller are created by this driver.\r | |
327 | If this parameter is not NULL and the first Device Path Node is\r | |
328 | not the End of Device Path Node, then only the handle for the\r | |
329 | child device specified by the first Device Path Node of\r | |
330 | RemainingDevicePath is created by this driver.\r | |
331 | If the first Device Path Node of RemainingDevicePath is\r | |
332 | the End of Device Path Node, no child handle is created by this\r | |
333 | driver.\r | |
334 | \r | |
335 | @retval EFI_SUCCESS Opal management was enabled.\r | |
336 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
337 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
338 | @retval Others The driver failed to start the device.\r | |
339 | \r | |
340 | **/\r | |
341 | EFI_STATUS\r | |
342 | EFIAPI\r | |
343 | OpalEfiDriverBindingStart(\r | |
344 | EFI_DRIVER_BINDING_PROTOCOL* This,\r | |
345 | EFI_HANDLE Controller,\r | |
346 | EFI_DEVICE_PATH_PROTOCOL* RemainingDevicePath\r | |
347 | );\r | |
348 | \r | |
349 | /**\r | |
350 | Stop this driver on Controller.\r | |
351 | \r | |
352 | @param This Protocol instance pointer.\r | |
353 | @param Controller Handle of device to stop driver on\r | |
354 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
355 | children is zero stop the entire bus driver.\r | |
356 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
357 | \r | |
358 | @retval EFI_SUCCESS This driver is removed Controller.\r | |
359 | @retval other This driver could not be removed from this device.\r | |
360 | \r | |
361 | **/\r | |
362 | EFI_STATUS\r | |
363 | EFIAPI\r | |
364 | OpalEfiDriverBindingStop(\r | |
365 | EFI_DRIVER_BINDING_PROTOCOL* This,\r | |
366 | EFI_HANDLE Controller,\r | |
367 | UINTN NumberOfChildren,\r | |
368 | EFI_HANDLE* ChildHandleBuffer\r | |
369 | );\r | |
370 | \r | |
371 | /**\r | |
372 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
373 | \r | |
374 | This function retrieves the user readable name of a driver in the form of a\r | |
375 | Unicode string. If the driver specified by This has a user readable name in\r | |
376 | the language specified by Language, then a pointer to the driver name is\r | |
377 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
378 | by This does not support the language specified by Language,\r | |
379 | then EFI_UNSUPPORTED is returned.\r | |
380 | \r | |
381 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
382 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
383 | \r | |
384 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
385 | array indicating the language. This is the\r | |
386 | language of the driver name that the caller is\r | |
387 | requesting, and it must match one of the\r | |
388 | languages specified in SupportedLanguages. The\r | |
389 | number of languages supported by a driver is up\r | |
390 | to the driver writer. Language is specified\r | |
391 | in RFC 4646 or ISO 639-2 language code format.\r | |
392 | \r | |
393 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
394 | This Unicode string is the name of the\r | |
395 | driver specified by This in the language\r | |
396 | specified by Language.\r | |
397 | \r | |
398 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
399 | This and the language specified by Language was\r | |
400 | returned in DriverName.\r | |
401 | \r | |
402 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
403 | \r | |
404 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
405 | \r | |
406 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
407 | the language specified by Language.\r | |
408 | \r | |
409 | **/\r | |
410 | EFI_STATUS\r | |
411 | EFIAPI\r | |
412 | OpalEfiDriverComponentNameGetDriverName(\r | |
413 | EFI_COMPONENT_NAME_PROTOCOL* This,\r | |
414 | CHAR8* Language,\r | |
415 | CHAR16** DriverName\r | |
416 | );\r | |
417 | \r | |
418 | /**\r | |
419 | Retrieves a Unicode string that is the user readable name of the controller\r | |
420 | that is being managed by a driver.\r | |
421 | \r | |
422 | This function retrieves the user readable name of the controller specified by\r | |
423 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
424 | driver specified by This has a user readable name in the language specified by\r | |
425 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
426 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
427 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
428 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
429 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
430 | \r | |
431 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
432 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
433 | \r | |
434 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
435 | specified by This is managing. This handle\r | |
436 | specifies the controller whose name is to be\r | |
437 | returned.\r | |
438 | \r | |
439 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
440 | the name of. This is an optional parameter that\r | |
441 | may be NULL. It will be NULL for device\r | |
442 | drivers. It will also be NULL for a bus drivers\r | |
443 | that wish to retrieve the name of the bus\r | |
444 | controller. It will not be NULL for a bus\r | |
445 | driver that wishes to retrieve the name of a\r | |
446 | child controller.\r | |
447 | \r | |
448 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
449 | array indicating the language. This is the\r | |
450 | language of the driver name that the caller is\r | |
451 | requesting, and it must match one of the\r | |
452 | languages specified in SupportedLanguages. The\r | |
453 | number of languages supported by a driver is up\r | |
454 | to the driver writer. Language is specified in\r | |
455 | RFC 4646 or ISO 639-2 language code format.\r | |
456 | \r | |
457 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
458 | This Unicode string is the name of the\r | |
459 | controller specified by ControllerHandle and\r | |
460 | ChildHandle in the language specified by\r | |
461 | Language from the point of view of the driver\r | |
462 | specified by This.\r | |
463 | \r | |
464 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
465 | the language specified by Language for the\r | |
466 | driver specified by This was returned in\r | |
467 | DriverName.\r | |
468 | \r | |
469 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
470 | \r | |
471 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
472 | EFI_HANDLE.\r | |
473 | \r | |
474 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
475 | \r | |
476 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
477 | \r | |
478 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
479 | managing the controller specified by\r | |
480 | ControllerHandle and ChildHandle.\r | |
481 | \r | |
482 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
483 | the language specified by Language.\r | |
484 | \r | |
485 | **/\r | |
486 | EFI_STATUS\r | |
487 | EFIAPI\r | |
488 | OpalEfiDriverComponentNameGetControllerName(\r | |
489 | EFI_COMPONENT_NAME_PROTOCOL* This,\r | |
490 | EFI_HANDLE ControllerHandle,\r | |
491 | EFI_HANDLE ChildHandle,\r | |
492 | CHAR8* Language,\r | |
493 | CHAR16** ControllerName\r | |
494 | );\r | |
495 | \r | |
496 | /**\r | |
497 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
498 | \r | |
499 | This function retrieves the user readable name of a driver in the form of a\r | |
500 | Unicode string. If the driver specified by This has a user readable name in\r | |
501 | the language specified by Language, then a pointer to the driver name is\r | |
502 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
503 | by This does not support the language specified by Language,\r | |
504 | then EFI_UNSUPPORTED is returned.\r | |
505 | \r | |
506 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
507 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
508 | \r | |
509 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
510 | array indicating the language. This is the\r | |
511 | language of the driver name that the caller is\r | |
512 | requesting, and it must match one of the\r | |
513 | languages specified in SupportedLanguages. The\r | |
514 | number of languages supported by a driver is up\r | |
515 | to the driver writer. Language is specified\r | |
516 | in RFC 4646 or ISO 639-2 language code format.\r | |
517 | \r | |
518 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
519 | This Unicode string is the name of the\r | |
520 | driver specified by This in the language\r | |
521 | specified by Language.\r | |
522 | \r | |
523 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
524 | This and the language specified by Language was\r | |
525 | returned in DriverName.\r | |
526 | \r | |
527 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
528 | \r | |
529 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
530 | \r | |
531 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
532 | the language specified by Language.\r | |
533 | \r | |
534 | **/\r | |
535 | EFI_STATUS\r | |
536 | EFIAPI\r | |
537 | OpalEfiDriverComponentName2GetDriverName(\r | |
538 | EFI_COMPONENT_NAME2_PROTOCOL* This,\r | |
539 | CHAR8* Language,\r | |
540 | CHAR16** DriverName\r | |
541 | );\r | |
542 | \r | |
543 | /**\r | |
544 | Retrieves a Unicode string that is the user readable name of the controller\r | |
545 | that is being managed by a driver.\r | |
546 | \r | |
547 | This function retrieves the user readable name of the controller specified by\r | |
548 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
549 | driver specified by This has a user readable name in the language specified by\r | |
550 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
551 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
552 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
553 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
554 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
555 | \r | |
556 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
557 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
558 | \r | |
559 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
560 | specified by This is managing. This handle\r | |
561 | specifies the controller whose name is to be\r | |
562 | returned.\r | |
563 | \r | |
564 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
565 | the name of. This is an optional parameter that\r | |
566 | may be NULL. It will be NULL for device\r | |
567 | drivers. It will also be NULL for a bus drivers\r | |
568 | that wish to retrieve the name of the bus\r | |
569 | controller. It will not be NULL for a bus\r | |
570 | driver that wishes to retrieve the name of a\r | |
571 | child controller.\r | |
572 | \r | |
573 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
574 | array indicating the language. This is the\r | |
575 | language of the driver name that the caller is\r | |
576 | requesting, and it must match one of the\r | |
577 | languages specified in SupportedLanguages. The\r | |
578 | number of languages supported by a driver is up\r | |
579 | to the driver writer. Language is specified in\r | |
580 | RFC 4646 or ISO 639-2 language code format.\r | |
581 | \r | |
582 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
583 | This Unicode string is the name of the\r | |
584 | controller specified by ControllerHandle and\r | |
585 | ChildHandle in the language specified by\r | |
586 | Language from the point of view of the driver\r | |
587 | specified by This.\r | |
588 | \r | |
589 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
590 | the language specified by Language for the\r | |
591 | driver specified by This was returned in\r | |
592 | DriverName.\r | |
593 | \r | |
594 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
595 | \r | |
596 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
597 | EFI_HANDLE.\r | |
598 | \r | |
599 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
600 | \r | |
601 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
602 | \r | |
603 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
604 | managing the controller specified by\r | |
605 | ControllerHandle and ChildHandle.\r | |
606 | \r | |
607 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
608 | the language specified by Language.\r | |
609 | \r | |
610 | **/\r | |
611 | EFI_STATUS\r | |
612 | EFIAPI\r | |
613 | OpalEfiDriverComponentName2GetControllerName(\r | |
614 | EFI_COMPONENT_NAME2_PROTOCOL* This,\r | |
615 | EFI_HANDLE ControllerHandle,\r | |
616 | EFI_HANDLE ChildHandle,\r | |
617 | CHAR8* Language,\r | |
618 | CHAR16** ControllerName\r | |
619 | );\r | |
620 | \r | |
621 | #endif //_OPAL_DRIVER_H_\r |