]>
Commit | Line | Data |
---|---|---|
110dfcd9 HW |
1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
9d510e61 | 4 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
110dfcd9 HW |
5 | \r |
6 | **/\r | |
7 | \r | |
8 | #ifndef _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_\r | |
9 | #define _EDKII_STORAGE_SECURITY_COMMAND_PPI_H_\r | |
10 | \r | |
11 | #include <Protocol/DevicePath.h>\r | |
12 | \r | |
13 | ///\r | |
14 | /// Global ID for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI.\r | |
15 | ///\r | |
16 | #define EDKII_PEI_STORAGE_SECURITY_CMD_PPI_GUID \\r | |
17 | { \\r | |
18 | 0x35de0b4e, 0x30fb, 0x46c3, { 0xbd, 0x84, 0x1f, 0xdb, 0xa1, 0x58, 0xbb, 0x56 } \\r | |
19 | }\r | |
20 | \r | |
21 | //\r | |
22 | // Forward declaration for the EDKII_PEI_STORAGE_SECURITY_CMD_PPI.\r | |
23 | //\r | |
24 | typedef struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI EDKII_PEI_STORAGE_SECURITY_CMD_PPI;\r | |
25 | \r | |
26 | //\r | |
27 | // Revision The revision to which the Storage Security Command interface adheres.\r | |
28 | // All future revisions must be backwards compatible.\r | |
29 | // If a future version is not back wards compatible it is not the same GUID.\r | |
30 | //\r | |
31 | #define EDKII_STORAGE_SECURITY_PPI_REVISION 0x00010000\r | |
32 | \r | |
33 | \r | |
34 | /**\r | |
35 | Gets the count of storage security devices that one specific driver detects.\r | |
36 | \r | |
37 | @param[in] This The PPI instance pointer.\r | |
38 | @param[out] NumberofDevices The number of storage security devices discovered.\r | |
39 | \r | |
40 | @retval EFI_SUCCESS The operation performed successfully.\r | |
41 | @retval EFI_INVALID_PARAMETER The parameters are invalid.\r | |
42 | \r | |
43 | **/\r | |
44 | typedef\r | |
45 | EFI_STATUS\r | |
46 | (EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES) (\r | |
47 | IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,\r | |
48 | OUT UINTN *NumberofDevices\r | |
49 | );\r | |
50 | \r | |
51 | /**\r | |
52 | Gets the device path of a specific storage security device.\r | |
53 | \r | |
54 | @param[in] This The PPI instance pointer.\r | |
55 | @param[in] DeviceIndex Specifies the storage security device to which\r | |
56 | the function wants to talk. Because the driver\r | |
57 | that implements Storage Security Command PPIs\r | |
58 | will manage multiple storage devices, the PPIs\r | |
59 | that want to talk to a single device must specify\r | |
60 | the device index that was assigned during the\r | |
61 | enumeration process. This index is a number from\r | |
62 | one to NumberofDevices.\r | |
63 | @param[out] DevicePathLength The length of the device path in bytes specified\r | |
64 | by DevicePath.\r | |
65 | @param[out] DevicePath The device path of storage security device.\r | |
66 | This field re-uses EFI Device Path Protocol as\r | |
67 | defined by Section 10.2 EFI Device Path Protocol\r | |
68 | of UEFI 2.7 Specification.\r | |
69 | \r | |
70 | @retval EFI_SUCCESS The operation succeeds.\r | |
71 | @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.\r | |
72 | @retval EFI_NOT_FOUND The specified storage security device not found.\r | |
73 | @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of resources.\r | |
74 | \r | |
75 | **/\r | |
76 | typedef\r | |
77 | EFI_STATUS\r | |
78 | (EFIAPI *EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH) (\r | |
79 | IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,\r | |
80 | IN UINTN DeviceIndex,\r | |
81 | OUT UINTN *DevicePathLength,\r | |
82 | OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r | |
83 | );\r | |
84 | \r | |
85 | /**\r | |
86 | Send a security protocol command to a device that receives data and/or the result\r | |
87 | of one or more commands sent by SendData.\r | |
88 | \r | |
89 | The ReceiveData function sends a security protocol command to the given DeviceIndex.\r | |
90 | The security protocol command sent is defined by SecurityProtocolId and contains\r | |
91 | the security protocol specific data SecurityProtocolSpecificData. The function\r | |
92 | returns the data from the security protocol command in PayloadBuffer.\r | |
93 | \r | |
94 | For devices supporting the SCSI command set, the security protocol command is sent\r | |
95 | using the SECURITY PROTOCOL IN command defined in SPC-4.\r | |
96 | \r | |
97 | For devices supporting the ATA command set, the security protocol command is sent\r | |
98 | using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize\r | |
99 | is non-zero.\r | |
100 | \r | |
101 | If the PayloadBufferSize is zero, the security protocol command is sent using the\r | |
102 | Trusted Non-Data command defined in ATA8-ACS.\r | |
103 | \r | |
104 | If PayloadBufferSize is too small to store the available data from the security\r | |
105 | protocol command, the function shall copy PayloadBufferSize bytes into the\r | |
106 | PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r | |
107 | \r | |
108 | If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r | |
109 | the function shall return EFI_INVALID_PARAMETER.\r | |
110 | \r | |
111 | If the given DeviceIndex does not support security protocol commands, the function\r | |
112 | shall return EFI_UNSUPPORTED.\r | |
113 | \r | |
114 | If the security protocol fails to complete within the Timeout period, the function\r | |
115 | shall return EFI_TIMEOUT.\r | |
116 | \r | |
117 | If the security protocol command completes without an error, the function shall\r | |
118 | return EFI_SUCCESS. If the security protocol command completes with an error, the\r | |
119 | function shall return EFI_DEVICE_ERROR.\r | |
120 | \r | |
121 | @param[in] This The PPI instance pointer.\r | |
122 | @param[in] DeviceIndex Specifies the storage security device to which the\r | |
123 | function wants to talk. Because the driver that\r | |
124 | implements Storage Security Command PPIs will manage\r | |
125 | multiple storage devices, the PPIs that want to talk\r | |
126 | to a single device must specify the device index\r | |
127 | that was assigned during the enumeration process.\r | |
128 | This index is a number from one to NumberofDevices.\r | |
129 | @param[in] Timeout The timeout, in 100ns units, to use for the execution\r | |
130 | of the security protocol command. A Timeout value\r | |
131 | of 0 means that this function will wait indefinitely\r | |
132 | for the security protocol command to execute. If\r | |
133 | Timeout is greater than zero, then this function\r | |
134 | will return EFI_TIMEOUT if the time required to\r | |
135 | execute the receive data command is greater than\r | |
136 | Timeout.\r | |
137 | @param[in] SecurityProtocolId\r | |
138 | The value of the "Security Protocol" parameter of\r | |
139 | the security protocol command to be sent.\r | |
140 | @param[in] SecurityProtocolSpecificData\r | |
141 | The value of the "Security Protocol Specific"\r | |
142 | parameter of the security protocol command to be\r | |
143 | sent.\r | |
144 | @param[in] PayloadBufferSize\r | |
145 | Size in bytes of the payload data buffer.\r | |
146 | @param[out] PayloadBuffer A pointer to a destination buffer to store the\r | |
147 | security protocol command specific payload data\r | |
148 | for the security protocol command. The caller is\r | |
149 | responsible for having either implicit or explicit\r | |
150 | ownership of the buffer.\r | |
151 | @param[out] PayloadTransferSize\r | |
152 | A pointer to a buffer to store the size in bytes\r | |
153 | of the data written to the payload data buffer.\r | |
154 | \r | |
155 | @retval EFI_SUCCESS The security protocol command completed\r | |
156 | successfully.\r | |
157 | @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to\r | |
158 | store the available data from the device.\r | |
159 | The PayloadBuffer contains the truncated\r | |
160 | data.\r | |
161 | @retval EFI_UNSUPPORTED The given DeviceIndex does not support\r | |
162 | security protocol commands.\r | |
163 | @retval EFI_DEVICE_ERROR The security protocol command completed\r | |
164 | with an error.\r | |
165 | @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize\r | |
166 | is NULL and PayloadBufferSize is non-zero.\r | |
167 | @retval EFI_TIMEOUT A timeout occurred while waiting for the\r | |
168 | security protocol command to execute.\r | |
169 | \r | |
170 | **/\r | |
171 | typedef\r | |
172 | EFI_STATUS\r | |
173 | (EFIAPI *EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA) (\r | |
174 | IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,\r | |
175 | IN UINTN DeviceIndex,\r | |
176 | IN UINT64 Timeout,\r | |
177 | IN UINT8 SecurityProtocolId,\r | |
178 | IN UINT16 SecurityProtocolSpecificData,\r | |
179 | IN UINTN PayloadBufferSize,\r | |
180 | OUT VOID *PayloadBuffer,\r | |
181 | OUT UINTN *PayloadTransferSize\r | |
182 | );\r | |
183 | \r | |
184 | /**\r | |
185 | Send a security protocol command to a device.\r | |
186 | \r | |
187 | The SendData function sends a security protocol command containing the payload\r | |
188 | PayloadBuffer to the given DeviceIndex. The security protocol command sent is\r | |
189 | defined by SecurityProtocolId and contains the security protocol specific data\r | |
190 | SecurityProtocolSpecificData. If the underlying protocol command requires a\r | |
191 | specific padding for the command payload, the SendData function shall add padding\r | |
192 | bytes to the command payload to satisfy the padding requirements.\r | |
193 | \r | |
194 | For devices supporting the SCSI command set, the security protocol command is\r | |
195 | sent using the SECURITY PROTOCOL OUT command defined in SPC-4.\r | |
196 | \r | |
197 | For devices supporting the ATA command set, the security protocol command is\r | |
198 | sent using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize\r | |
199 | is non-zero. If the PayloadBufferSize is zero, the security protocol command\r | |
200 | is sent using the Trusted Non-Data command defined in ATA8-ACS.\r | |
201 | \r | |
202 | If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r | |
203 | return EFI_INVALID_PARAMETER.\r | |
204 | \r | |
205 | If the given DeviceIndex does not support security protocol commands, the function\r | |
206 | shall return EFI_UNSUPPORTED.\r | |
207 | \r | |
208 | If the security protocol fails to complete within the Timeout period, the function\r | |
209 | shall return EFI_TIMEOUT.\r | |
210 | \r | |
211 | If the security protocol command completes without an error, the function shall\r | |
212 | return EFI_SUCCESS. If the security protocol command completes with an error,\r | |
213 | the functio shall return EFI_DEVICE_ERROR.\r | |
214 | \r | |
215 | @param[in] This The PPI instance pointer.\r | |
216 | @param[in] DeviceIndex The ID of the device.\r | |
217 | @param[in] Timeout The timeout, in 100ns units, to use for the execution\r | |
218 | of the security protocol command. A Timeout value\r | |
219 | of 0 means that this function will wait indefinitely\r | |
220 | for the security protocol command to execute. If\r | |
221 | Timeout is greater than zero, then this function\r | |
222 | will return EFI_TIMEOUT if the time required to\r | |
223 | execute the receive data command is greater than\r | |
224 | Timeout.\r | |
225 | @param[in] SecurityProtocolId\r | |
226 | The value of the "Security Protocol" parameter of\r | |
227 | the security protocol command to be sent.\r | |
228 | @param[in] SecurityProtocolSpecificData\r | |
229 | The value of the "Security Protocol Specific"\r | |
230 | parameter of the security protocol command to be\r | |
231 | sent.\r | |
232 | @param[in] PayloadBufferSize Size in bytes of the payload data buffer.\r | |
233 | @param[in] PayloadBuffer A pointer to a destination buffer to store the\r | |
234 | security protocol command specific payload data\r | |
235 | for the security protocol command.\r | |
236 | \r | |
237 | @retval EFI_SUCCESS The security protocol command completed successfully.\r | |
238 | @retval EFI_UNSUPPORTED The given DeviceIndex does not support security\r | |
239 | protocol commands.\r | |
240 | @retval EFI_DEVICE_ERROR The security protocol command completed with\r | |
241 | an error.\r | |
242 | @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize\r | |
243 | is non-zero.\r | |
244 | @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r | |
245 | protocol command to execute.\r | |
246 | \r | |
247 | **/\r | |
248 | typedef\r | |
249 | EFI_STATUS\r | |
250 | (EFIAPI *EDKII_PEI_STORAGE_SECURITY_SEND_DATA) (\r | |
251 | IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This,\r | |
252 | IN UINTN DeviceIndex,\r | |
253 | IN UINT64 Timeout,\r | |
254 | IN UINT8 SecurityProtocolId,\r | |
255 | IN UINT16 SecurityProtocolSpecificData,\r | |
256 | IN UINTN PayloadBufferSize,\r | |
257 | IN VOID *PayloadBuffer\r | |
258 | );\r | |
259 | \r | |
260 | //\r | |
261 | // EDKII_PEI_STORAGE_SECURITY_CMD_PPI contains a set of services to send security\r | |
262 | // protocol commands to a mass storage device. Two types of security protocol\r | |
263 | // commands are supported. SendData sends a command with data to a device.\r | |
264 | // ReceiveData sends a command that receives data and/or the result of one or\r | |
265 | // more commands sent by SendData.\r | |
266 | //\r | |
267 | struct _EDKII_PEI_STORAGE_SECURITY_CMD_PPI {\r | |
268 | UINT64 Revision;\r | |
269 | EDKII_PEI_STORAGE_SECURITY_GET_NUMBER_DEVICES GetNumberofDevices;\r | |
270 | EDKII_PEI_STORAGE_SECURITY_GET_DEVICE_PATH GetDevicePath;\r | |
271 | EDKII_PEI_STORAGE_SECURITY_RECEIVE_DATA ReceiveData;\r | |
272 | EDKII_PEI_STORAGE_SECURITY_SEND_DATA SendData;\r | |
273 | };\r | |
274 | \r | |
275 | extern EFI_GUID gEdkiiPeiStorageSecurityCommandPpiGuid;\r | |
276 | \r | |
277 | #endif\r |