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