]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriverPrivate.h
SecurityPkg OpalPassword: Add solution without SMM device code
[mirror_edk2.git] / SecurityPkg / Tcg / Opal / OpalPasswordDxe / OpalDriverPrivate.h
CommitLineData
a06875e1
ED
1/** @file\r
2 Private structures and functions used within OPAL_DRIVER\r
3\r
4Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _OPAL_DRIVER_PRIVATE_H_\r
16#define _OPAL_DRIVER_PRIVATE_H_\r
17#include "OpalDriver.h"\r
18\r
19#define OPAL_MSID_LENGHT 128\r
20\r
21#pragma pack(1)\r
22//\r
23// Structure that is used to represent an OPAL_DISK.\r
24//\r
25typedef struct {\r
26 UINT32 MsidLength; // Byte length of MSID Pin for device\r
27 UINT8 Msid[OPAL_MSID_LENGHT]; // MSID Pin for device\r
28 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Sscp;\r
29 UINT32 MediaId; // MediaId is used by Ssc Protocol.\r
30 EFI_DEVICE_PATH_PROTOCOL *OpalDevicePath;\r
31 UINT16 OpalBaseComId; // Opal SSC 1 base com id.\r
32 OPAL_OWNER_SHIP Owner;\r
33 OPAL_DISK_SUPPORT_ATTRIBUTE SupportedAttributes;\r
34 TCG_LOCKING_FEATURE_DESCRIPTOR LockingFeature; // Locking Feature Descriptor retrieved from performing a Level 0 Discovery\r
35} OPAL_DISK;\r
36\r
37//\r
38// Device with block IO protocol\r
39//\r
40typedef struct _OPAL_DRIVER_DEVICE OPAL_DRIVER_DEVICE;\r
41\r
42struct _OPAL_DRIVER_DEVICE {\r
43 OPAL_DRIVER_DEVICE *Next; ///< Linked list pointer\r
44 EFI_HANDLE Handle; ///< Device handle\r
45 OPAL_DISK OpalDisk; ///< User context\r
46 CHAR16 *Name16; ///< Allocated/freed by UEFI Filter Driver at device creation/removal\r
47 CHAR8 *NameZ; ///< Allocated/freed by UEFI Filter Driver at device creation/removal\r
48 UINT32 MediaId; ///< Required parameter for EFI_STORAGE_SECURITY_COMMAND_PROTOCOL, from BLOCK_IO_MEDIA\r
49\r
50 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Sscp; /// Device protocols consumed\r
51 EFI_DEVICE_PATH_PROTOCOL *OpalDevicePath;\r
52};\r
53\r
54//\r
55// Opal Driver UEFI Driver Model\r
56//\r
57typedef struct {\r
58 EFI_HANDLE Handle; ///< Driver image handle\r
59 OPAL_DRIVER_DEVICE *DeviceList; ///< Linked list of controllers owned by this Driver\r
60} OPAL_DRIVER;\r
61#pragma pack()\r
62\r
63//\r
64// Retrieves a OPAL_DRIVER_DEVICE based on the pointer to its StorageSecurity protocol.\r
65//\r
66#define DRIVER_DEVICE_FROM_OPALDISK(OpalDiskPointer) (OPAL_DRIVER_DEVICE*)(BASE_CR(OpalDiskPointer, OPAL_DRIVER_DEVICE, OpalDisk))\r
67\r
68/**\r
69 Get devcie list info.\r
70\r
71 @retval return the device list pointer.\r
72**/\r
73OPAL_DRIVER_DEVICE*\r
74OpalDriverGetDeviceList(\r
75 VOID\r
76 );\r
77\r
78/**\r
79 Get devcie name through the component name protocol.\r
80\r
81 @param[in] Dev The device which need to get name.\r
82\r
83 @retval TRUE Find the name for this device.\r
84 @retval FALSE Not found the name for this device.\r
85**/\r
86BOOLEAN\r
87OpalDriverGetDriverDeviceName(\r
88 OPAL_DRIVER_DEVICE *Dev\r
89 );\r
90\r
91/**\r
92 Get current device count.\r
93\r
94 @retval return the current created device count.\r
95\r
96**/\r
97UINT8\r
98GetDeviceCount (\r
99 VOID\r
100 );\r
101\r
102#endif // _OPAL_DRIVER_P_H_\r