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