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