]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
MdeModulePkg/AtaBus&AtaAtapiPassThru: Update ATA drivers to follow UEFI2.4 new reques...
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaBusDxe / AtaBus.h
CommitLineData
ad86a50a 1/** @file\r
2 Master header file for ATA Bus Driver.\r
3\r
4 This file defines common data structures, macro definitions and some module\r
5 internal function header files.\r
6\r
71fd9fae 7 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 8 This program and the accompanying materials\r
ad86a50a 9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _ATA_BUS_H_\r
19#define _ATA_BUS_H_\r
20\r
09ba0c46 21#include <Uefi.h>\r
ad86a50a 22\r
90398d55 23#include <Guid/MemoryOverwriteControl.h>\r
ad86a50a 24#include <Protocol/AtaPassThru.h>\r
25#include <Protocol/BlockIo.h>\r
490b5ea1 26#include <Protocol/BlockIo2.h>\r
ad86a50a 27#include <Protocol/DiskInfo.h>\r
28#include <Protocol/DevicePath.h>\r
c24097a5 29#include <Protocol/StorageSecurityCommand.h>\r
ad86a50a 30\r
31#include <Library/DebugLib.h>\r
32#include <Library/UefiDriverEntryPoint.h>\r
33#include <Library/BaseLib.h>\r
34#include <Library/UefiLib.h>\r
35#include <Library/BaseMemoryLib.h>\r
36#include <Library/MemoryAllocationLib.h>\r
37#include <Library/UefiBootServicesTableLib.h>\r
38#include <Library/DevicePathLib.h>\r
90398d55 39#include <Library/UefiRuntimeServicesTableLib.h>\r
58727f29 40#include <Library/TimerLib.h>\r
37623a5c 41#include <Library/ReportStatusCodeLib.h>\r
ad86a50a 42\r
43#include <IndustryStandard/Atapi.h>\r
44\r
45//\r
46// Time out value for ATA pass through protocol\r
47//\r
e519983a 48#define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)\r
ad86a50a 49\r
50//\r
51// Maximum number of times to retry ATA command\r
52//\r
53#define MAX_RETRY_TIMES 3\r
54\r
55//\r
56// The maximum total sectors count in 28 bit addressing mode\r
57//\r
58#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff\r
59\r
60//\r
58727f29 61// The maximum ATA transaction sector count in 28 bit addressing mode.\r
ad86a50a 62//\r
63#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100\r
64\r
65//\r
58727f29 66// The maximum ATA transaction sector count in 48 bit addressing mode.\r
ad86a50a 67//\r
490b5ea1 68//#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000\r
69\r
70//\r
71// BugBug: if the TransferLength is equal with 0x10000 (the 48bit max length),\r
72// there is a bug that even the register interrupt bit has been sit, the buffer\r
73// seems not ready. Change the Maximum Sector Numbers to 0xFFFF to work round\r
74// this issue.\r
75//\r
76#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF\r
ad86a50a 77\r
78//\r
58727f29 79// The maximum model name in ATA identify data\r
ad86a50a 80//\r
81#define MAX_MODEL_NAME_LEN 40\r
82\r
c24097a5 83#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')\r
84#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')\r
58727f29 85#define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')\r
c24097a5 86#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r
490b5ea1 87\r
90398d55 88#define ROUNDUP512(x) (((x) % 512 == 0) ? (x) : ((x) / 512 + 1) * 512)\r
89\r
90#define SECURITY_PROTOCOL_TCG 0x02\r
91#define SECURITY_PROTOCOL_IEEE1667 0xEE\r
92\r
93//\r
94// ATA Supported Security Protocols List Description.\r
95// Refer to ATA8-ACS Spec 7.57.6.2 Table 69.\r
96//\r
97typedef struct {\r
98 UINT8 Reserved1[6];\r
99 UINT8 SupportedSecurityListLength[2];\r
100 UINT8 SupportedSecurityProtocol[1];\r
101} SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA;\r
102\r
ad86a50a 103//\r
104// ATA bus data structure for ATA controller\r
105//\r
106typedef struct {\r
107 EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;\r
108 EFI_HANDLE Controller;\r
109 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
110 EFI_HANDLE DriverBindingHandle;\r
111} ATA_BUS_DRIVER_DATA;\r
112\r
ad86a50a 113//\r
114// ATA device data structure for each child device\r
115//\r
116typedef struct {\r
490b5ea1 117 UINT32 Signature;\r
ad86a50a 118\r
490b5ea1 119 EFI_HANDLE Handle;\r
120 EFI_BLOCK_IO_PROTOCOL BlockIo;\r
121 EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r
122 EFI_BLOCK_IO_MEDIA BlockMedia;\r
123 EFI_DISK_INFO_PROTOCOL DiskInfo;\r
124 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
c24097a5 125 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;\r
ad86a50a 126\r
490b5ea1 127 ATA_BUS_DRIVER_DATA *AtaBusDriverData;\r
128 UINT16 Port;\r
129 UINT16 PortMultiplierPort;\r
ad86a50a 130\r
131 //\r
132 // Buffer for the execution of ATA pass through protocol\r
133 //\r
490b5ea1 134 EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r
135 EFI_ATA_COMMAND_BLOCK Acb;\r
136 EFI_ATA_STATUS_BLOCK *Asb;\r
ad86a50a 137\r
490b5ea1 138 BOOLEAN UdmaValid;\r
139 BOOLEAN Lba48Bit;\r
ad86a50a 140\r
141 //\r
142 // Cached data for ATA identify data\r
143 //\r
490b5ea1 144 ATA_IDENTIFY_DATA *IdentifyData;\r
ad86a50a 145\r
490b5ea1 146 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
147 CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];\r
ad86a50a 148\r
c24097a5 149 LIST_ENTRY AtaTaskList;\r
58727f29 150 LIST_ENTRY AtaSubTaskList;\r
71fd9fae 151 BOOLEAN Abort;\r
ad86a50a 152} ATA_DEVICE;\r
153\r
58727f29 154//\r
155// Sub-Task for the non blocking I/O\r
156//\r
157typedef struct {\r
158 UINT32 Signature;\r
159 ATA_DEVICE *AtaDevice;\r
160 EFI_BLOCK_IO2_TOKEN *Token;\r
161 UINTN *UnsignalledEventCount;\r
162 EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r
163 BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.\r
164 LIST_ENTRY TaskEntry;\r
165} ATA_BUS_ASYN_SUB_TASK;\r
166\r
167//\r
168// Task for the non blocking I/O\r
169//\r
170typedef struct {\r
171 UINT32 Signature;\r
172 EFI_BLOCK_IO2_TOKEN *Token;\r
173 ATA_DEVICE *AtaDevice;\r
174 UINT8 *Buffer;\r
175 EFI_LBA StartLba;\r
176 UINTN NumberOfBlocks;\r
177 BOOLEAN IsWrite;\r
178 LIST_ENTRY TaskEntry;\r
179} ATA_BUS_ASYN_TASK;\r
180\r
490b5ea1 181#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)\r
182#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)\r
183#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r
c24097a5 184#define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)\r
71fd9fae
TF
185#define ATA_ASYN_SUB_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)\r
186#define ATA_ASYN_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
ad86a50a 187\r
188//\r
189// Global Variables\r
190//\r
191extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;\r
192extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;\r
193extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;\r
194\r
490b5ea1 195/**\r
196 Allocates an aligned buffer for ATA device.\r
197\r
198 This function allocates an aligned buffer for the ATA device to perform\r
199 ATA pass through operations. The alignment requirement is from ATA pass\r
200 through interface.\r
201\r
202 @param AtaDevice The ATA child device involved for the operation.\r
203 @param BufferSize The request buffer size.\r
204\r
205 @return A pointer to the aligned buffer or NULL if the allocation fails.\r
206\r
207**/\r
208VOID *\r
209AllocateAlignedBuffer (\r
210 IN ATA_DEVICE *AtaDevice,\r
211 IN UINTN BufferSize\r
212 );\r
213\r
214/**\r
215 Frees an aligned buffer for ATA device.\r
216\r
217 This function frees an aligned buffer for the ATA device to perform\r
218 ATA pass through operations.\r
219\r
220 @param Buffer The aligned buffer to be freed.\r
221 @param BufferSize The request buffer size.\r
222\r
223**/\r
224VOID\r
225FreeAlignedBuffer (\r
226 IN VOID *Buffer,\r
227 IN UINTN BufferSize\r
228 );\r
229\r
230/**\r
58727f29 231 Free SubTask.\r
490b5ea1 232\r
233 @param[in, out] Task Pointer to task to be freed.\r
58727f29 234\r
490b5ea1 235**/\r
236VOID\r
58727f29 237EFIAPI\r
490b5ea1 238FreeAtaSubTask (\r
58727f29 239 IN OUT ATA_BUS_ASYN_SUB_TASK *Task\r
490b5ea1 240 );\r
ad86a50a 241\r
242/**\r
243 Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().\r
244\r
245 This function wraps the ResetDevice() invocation for ATA pass through function\r
58727f29 246 for an ATA device.\r
ad86a50a 247\r
248 @param AtaDevice The ATA child device involved for the operation.\r
249\r
250 @return The return status from EFI_ATA_PASS_THRU_PROTOCOL.PassThru().\r
251\r
252**/\r
253EFI_STATUS\r
254ResetAtaDevice (\r
255 IN ATA_DEVICE *AtaDevice\r
256 );\r
257\r
258\r
259/**\r
260 Discovers whether it is a valid ATA device.\r
261\r
262 This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it.\r
263 If the command is executed successfully, it then identifies it and initializes\r
264 the Media information in Block IO protocol interface.\r
265\r
266 @param AtaDevice The ATA child device involved for the operation.\r
267\r
268 @retval EFI_SUCCESS The device is successfully identified and Media information\r
269 is correctly initialized.\r
58727f29 270 @return others Some error occurs when discovering the ATA device.\r
ad86a50a 271\r
272**/\r
273EFI_STATUS\r
274DiscoverAtaDevice (\r
275 IN OUT ATA_DEVICE *AtaDevice\r
276 );\r
277\r
ad86a50a 278/**\r
279 Read or write a number of blocks from ATA device.\r
280\r
281 This function performs ATA pass through transactions to read/write data from/to\r
282 ATA device. It may separate the read/write request into several ATA pass through\r
283 transactions.\r
284\r
490b5ea1 285 @param[in, out] AtaDevice The ATA child device involved for the operation.\r
286 @param[in, out] Buffer The pointer to the current transaction buffer.\r
287 @param[in] StartLba The starting logical block address to be accessed.\r
288 @param[in] NumberOfBlocks The block number or sector count of the transfer.\r
289 @param[in] IsWrite Indicates whether it is a write operation.\r
290 @param[in, out] Token A pointer to the token associated with the transaction.\r
ad86a50a 291\r
292 @retval EFI_SUCCESS The data transfer is complete successfully.\r
58727f29 293 @return others Some error occurs when transferring data.\r
ad86a50a 294\r
295**/\r
58727f29 296EFI_STATUS\r
ad86a50a 297AccessAtaDevice(\r
298 IN OUT ATA_DEVICE *AtaDevice,\r
299 IN OUT UINT8 *Buffer,\r
300 IN EFI_LBA StartLba,\r
301 IN UINTN NumberOfBlocks,\r
490b5ea1 302 IN BOOLEAN IsWrite,\r
303 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
ad86a50a 304 );\r
71fd9fae 305\r
c24097a5 306/**\r
307 Trust transfer data from/to ATA device.\r
308\r
309 This function performs one ATA pass through transaction to do a trust transfer from/to\r
310 ATA device. It chooses the appropriate ATA command and protocol to invoke PassThru\r
311 interface of ATA pass through.\r
312\r
313 @param AtaDevice The ATA child device involved for the operation.\r
314 @param Buffer The pointer to the current transaction buffer.\r
315 @param SecurityProtocolId The value of the "Security Protocol" parameter of\r
316 the security protocol command to be sent.\r
317 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
318 of the security protocol command to be sent.\r
319 @param TransferLength The block number or sector count of the transfer.\r
320 @param IsTrustSend Indicates whether it is a trust send operation or not.\r
321 @param Timeout The timeout, in 100ns units, to use for the execution\r
322 of the security protocol command. A Timeout value of 0\r
323 means that this function will wait indefinitely for the\r
324 security protocol command to execute. If Timeout is greater\r
325 than zero, then this function will return EFI_TIMEOUT\r
326 if the time required to execute the receive data command\r
327 is greater than Timeout.\r
86d8e199 328 @param TransferLengthOut A pointer to a buffer to store the size in bytes of the data\r
329 written to the buffer. Ignore it when IsTrustSend is TRUE.\r
c24097a5 330\r
331 @retval EFI_SUCCESS The data transfer is complete successfully.\r
58727f29 332 @return others Some error occurs when transferring data.\r
c24097a5 333\r
334**/\r
335EFI_STATUS\r
336EFIAPI\r
337TrustTransferAtaDevice (\r
338 IN OUT ATA_DEVICE *AtaDevice,\r
339 IN OUT VOID *Buffer,\r
340 IN UINT8 SecurityProtocolId,\r
341 IN UINT16 SecurityProtocolSpecificData,\r
342 IN UINTN TransferLength,\r
343 IN BOOLEAN IsTrustSend,\r
344 IN UINT64 Timeout,\r
345 OUT UINTN *TransferLengthOut\r
346 );\r
ad86a50a 347\r
348//\r
349// Protocol interface prototypes\r
350//\r
351/**\r
58727f29 352 Tests to see if this driver supports a given controller. If a child device is provided,\r
ad86a50a 353 it further tests to see if this driver supports creating a handle for the specified child device.\r
354\r
58727f29 355 This function checks to see if the driver specified by This supports the device specified by\r
356 ControllerHandle. Drivers will typically use the device path attached to\r
357 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
358 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
359 may be called many times during platform initialization. In order to reduce boot times, the tests\r
360 performed by this function must be very small, and take as little time as possible to execute. This\r
361 function must not change the state of any hardware devices, and this function must be aware that the\r
362 device specified by ControllerHandle may already be managed by the same driver or a\r
363 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
364 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
365 Since ControllerHandle may have been previously started by the same driver, if a protocol is\r
366 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
ad86a50a 367 to guarantee the state of ControllerHandle is not modified by this function.\r
368\r
369 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
58727f29 370 @param[in] ControllerHandle The handle of the controller to test. This handle\r
371 must support a protocol interface that supplies\r
ad86a50a 372 an I/O abstraction to the driver.\r
58727f29 373 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
374 parameter is ignored by device drivers, and is optional for bus\r
375 drivers. For bus drivers, if this parameter is not NULL, then\r
376 the bus driver must determine if the bus controller specified\r
377 by ControllerHandle and the child controller specified\r
378 by RemainingDevicePath are both supported by this\r
ad86a50a 379 bus driver.\r
380\r
381 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
382 RemainingDevicePath is supported by the driver specified by This.\r
383 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
384 RemainingDevicePath is already being managed by the driver\r
385 specified by This.\r
386 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
387 RemainingDevicePath is already being managed by a different\r
388 driver or an application that requires exclusive access.\r
389 Currently not implemented.\r
390 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
391 RemainingDevicePath is not supported by the driver specified by This.\r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395AtaBusDriverBindingSupported (\r
396 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
397 IN EFI_HANDLE Controller,\r
398 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
399 );\r
400\r
401/**\r
402 Starts a device controller or a bus controller.\r
403\r
404 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
58727f29 405 As a result, much of the error checking on the parameters to Start() has been moved into this\r
406 common boot service. It is legal to call Start() from other locations,\r
ad86a50a 407 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
408 1. ControllerHandle must be a valid EFI_HANDLE.\r
409 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
410 EFI_DEVICE_PATH_PROTOCOL.\r
411 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
58727f29 412 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
ad86a50a 413\r
414 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
58727f29 415 @param[in] ControllerHandle The handle of the controller to start. This handle\r
416 must support a protocol interface that supplies\r
ad86a50a 417 an I/O abstraction to the driver.\r
58727f29 418 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
419 parameter is ignored by device drivers, and is optional for bus\r
420 drivers. For a bus driver, if this parameter is NULL, then handles\r
421 for all the children of Controller are created by this driver.\r
422 If this parameter is not NULL and the first Device Path Node is\r
423 not the End of Device Path Node, then only the handle for the\r
424 child device specified by the first Device Path Node of\r
ad86a50a 425 RemainingDevicePath is created by this driver.\r
58727f29 426 If the first Device Path Node of RemainingDevicePath is\r
ad86a50a 427 the End of Device Path Node, no child handle is created by this\r
428 driver.\r
429\r
430 @retval EFI_SUCCESS The device was started.\r
431 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
432 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
433 @retval Others The driver failded to start the device.\r
434\r
435**/\r
436EFI_STATUS\r
437EFIAPI\r
438AtaBusDriverBindingStart (\r
439 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
440 IN EFI_HANDLE Controller,\r
441 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
442 );\r
443\r
444/**\r
445 Stops a device controller or a bus controller.\r
58727f29 446\r
447 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
448 As a result, much of the error checking on the parameters to Stop() has been moved\r
449 into this common boot service. It is legal to call Stop() from other locations,\r
ad86a50a 450 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
451 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
452 same driver's Start() function.\r
453 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
454 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
455 Start() function, and the Start() function must have called OpenProtocol() on\r
456 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
58727f29 457\r
ad86a50a 458 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
58727f29 459 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
460 support a bus specific I/O protocol for the driver\r
ad86a50a 461 to use to stop the device.\r
462 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
58727f29 463 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
ad86a50a 464 if NumberOfChildren is 0.\r
465\r
466 @retval EFI_SUCCESS The device was stopped.\r
467 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
468\r
469**/\r
470EFI_STATUS\r
471EFIAPI\r
472AtaBusDriverBindingStop (\r
473 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
474 IN EFI_HANDLE Controller,\r
475 IN UINTN NumberOfChildren,\r
476 IN EFI_HANDLE *ChildHandleBuffer\r
477 );\r
478\r
479\r
480/**\r
481 Retrieves a Unicode string that is the user readable name of the driver.\r
482\r
483 This function retrieves the user readable name of a driver in the form of a\r
484 Unicode string. If the driver specified by This has a user readable name in\r
485 the language specified by Language, then a pointer to the driver name is\r
486 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
487 by This does not support the language specified by Language,\r
488 then EFI_UNSUPPORTED is returned.\r
489\r
490 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
491 EFI_COMPONENT_NAME_PROTOCOL instance.\r
492\r
493 @param Language[in] A pointer to a Null-terminated ASCII string\r
494 array indicating the language. This is the\r
495 language of the driver name that the caller is\r
496 requesting, and it must match one of the\r
497 languages specified in SupportedLanguages. The\r
498 number of languages supported by a driver is up\r
499 to the driver writer. Language is specified\r
500 in RFC 4646 or ISO 639-2 language code format.\r
501\r
502 @param DriverName[out] A pointer to the Unicode string to return.\r
503 This Unicode string is the name of the\r
504 driver specified by This in the language\r
505 specified by Language.\r
506\r
507 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
508 This and the language specified by Language was\r
509 returned in DriverName.\r
510\r
511 @retval EFI_INVALID_PARAMETER Language is NULL.\r
512\r
513 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
514\r
515 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
516 the language specified by Language.\r
517\r
518**/\r
519EFI_STATUS\r
520EFIAPI\r
521AtaBusComponentNameGetDriverName (\r
522 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
523 IN CHAR8 *Language,\r
524 OUT CHAR16 **DriverName\r
525 );\r
526\r
527\r
528/**\r
529 Retrieves a Unicode string that is the user readable name of the controller\r
530 that is being managed by a driver.\r
531\r
532 This function retrieves the user readable name of the controller specified by\r
533 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
534 driver specified by This has a user readable name in the language specified by\r
535 Language, then a pointer to the controller name is returned in ControllerName,\r
536 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
537 managing the controller specified by ControllerHandle and ChildHandle,\r
538 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
539 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
540\r
541 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
542 EFI_COMPONENT_NAME_PROTOCOL instance.\r
543\r
544 @param ControllerHandle[in] The handle of a controller that the driver\r
545 specified by This is managing. This handle\r
546 specifies the controller whose name is to be\r
547 returned.\r
548\r
549 @param ChildHandle[in] The handle of the child controller to retrieve\r
550 the name of. This is an optional parameter that\r
551 may be NULL. It will be NULL for device\r
552 drivers. It will also be NULL for a bus drivers\r
553 that wish to retrieve the name of the bus\r
554 controller. It will not be NULL for a bus\r
555 driver that wishes to retrieve the name of a\r
556 child controller.\r
557\r
558 @param Language[in] A pointer to a Null-terminated ASCII string\r
559 array indicating the language. This is the\r
560 language of the driver name that the caller is\r
561 requesting, and it must match one of the\r
562 languages specified in SupportedLanguages. The\r
563 number of languages supported by a driver is up\r
564 to the driver writer. Language is specified in\r
565 RFC 4646 or ISO 639-2 language code format.\r
566\r
567 @param ControllerName[out] A pointer to the Unicode string to return.\r
568 This Unicode string is the name of the\r
569 controller specified by ControllerHandle and\r
570 ChildHandle in the language specified by\r
571 Language from the point of view of the driver\r
572 specified by This.\r
573\r
574 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
575 the language specified by Language for the\r
576 driver specified by This was returned in\r
577 DriverName.\r
578\r
284ee2e8 579 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
ad86a50a 580\r
581 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
582 EFI_HANDLE.\r
583\r
584 @retval EFI_INVALID_PARAMETER Language is NULL.\r
585\r
586 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
587\r
588 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
589 managing the controller specified by\r
590 ControllerHandle and ChildHandle.\r
591\r
592 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
593 the language specified by Language.\r
594\r
595**/\r
596EFI_STATUS\r
597EFIAPI\r
598AtaBusComponentNameGetControllerName (\r
599 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
600 IN EFI_HANDLE ControllerHandle,\r
601 IN EFI_HANDLE ChildHandle OPTIONAL,\r
602 IN CHAR8 *Language,\r
603 OUT CHAR16 **ControllerName\r
604 );\r
605\r
606\r
607/**\r
608 Reset the Block Device.\r
609\r
610 @param This Indicates a pointer to the calling context.\r
611 @param ExtendedVerification Driver may perform diagnostics on reset.\r
612\r
613 @retval EFI_SUCCESS The device was reset.\r
614 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
615 not be reset.\r
616\r
617**/\r
618EFI_STATUS\r
619EFIAPI\r
620AtaBlockIoReset (\r
621 IN EFI_BLOCK_IO_PROTOCOL *This,\r
622 IN BOOLEAN ExtendedVerification\r
623 );\r
624\r
625\r
626/**\r
627 Read BufferSize bytes from Lba into Buffer.\r
628\r
629 @param This Indicates a pointer to the calling context.\r
630 @param MediaId Id of the media, changes every time the media is replaced.\r
631 @param Lba The starting Logical Block Address to read from\r
632 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
633 @param Buffer A pointer to the destination buffer for the data. The caller is\r
634 responsible for either having implicit or explicit ownership of the buffer.\r
635\r
636 @retval EFI_SUCCESS The data was read correctly from the device.\r
637 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
638 @retval EFI_NO_MEDIA There is no media in the device.\r
639 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r
640 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
58727f29 641 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
ad86a50a 642 or the buffer is not on proper alignment.\r
643\r
644**/\r
645EFI_STATUS\r
646EFIAPI\r
647AtaBlockIoReadBlocks (\r
648 IN EFI_BLOCK_IO_PROTOCOL *This,\r
649 IN UINT32 MediaId,\r
650 IN EFI_LBA Lba,\r
651 IN UINTN BufferSize,\r
652 OUT VOID *Buffer\r
653 );\r
654\r
655\r
656/**\r
657 Write BufferSize bytes from Lba into Buffer.\r
658\r
659 @param This Indicates a pointer to the calling context.\r
660 @param MediaId The media ID that the write request is for.\r
661 @param Lba The starting logical block address to be written. The caller is\r
662 responsible for writing to only legitimate locations.\r
663 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
664 @param Buffer A pointer to the source buffer for the data.\r
665\r
666 @retval EFI_SUCCESS The data was written correctly to the device.\r
667 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
668 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
669 @retval EFI_NO_MEDIA There is no media in the device.\r
670 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
671 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
58727f29 672 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
ad86a50a 673 or the buffer is not on proper alignment.\r
674\r
675**/\r
676EFI_STATUS\r
677EFIAPI\r
678AtaBlockIoWriteBlocks (\r
679 IN EFI_BLOCK_IO_PROTOCOL *This,\r
680 IN UINT32 MediaId,\r
681 IN EFI_LBA Lba,\r
682 IN UINTN BufferSize,\r
683 IN VOID *Buffer\r
684 );\r
685\r
686\r
687/**\r
688 Flush the Block Device.\r
689\r
690 @param This Indicates a pointer to the calling context.\r
691\r
692 @retval EFI_SUCCESS All outstanding data was written to the device\r
693 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
694 @retval EFI_NO_MEDIA There is no media in the device.\r
695\r
696**/\r
697EFI_STATUS\r
698EFIAPI\r
699AtaBlockIoFlushBlocks (\r
700 IN EFI_BLOCK_IO_PROTOCOL *This\r
701 );\r
702\r
490b5ea1 703/**\r
704 Reset the Block Device throught Block I/O2 protocol.\r
705\r
706 @param[in] This Indicates a pointer to the calling context.\r
707 @param[in] ExtendedVerification Driver may perform diagnostics on reset.\r
708\r
709 @retval EFI_SUCCESS The device was reset.\r
710 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
711 not be reset.\r
712\r
713**/\r
714EFI_STATUS\r
715EFIAPI\r
716AtaBlockIoResetEx (\r
717 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
718 IN BOOLEAN ExtendedVerification\r
719 );\r
720\r
721/**\r
722 Read BufferSize bytes from Lba into Buffer.\r
723\r
724 @param[in] This Indicates a pointer to the calling context.\r
725 @param[in] MediaId Id of the media, changes every time the media is replaced.\r
726 @param[in] Lba The starting Logical Block Address to read from.\r
727 @param[in, out] Token A pointer to the token associated with the transaction.\r
728 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
729 @param[out] Buffer A pointer to the destination buffer for the data. The caller is\r
730 responsible for either having implicit or explicit ownership of the buffer.\r
731\r
732 @retval EFI_SUCCESS The read request was queued if Event is not NULL.\r
733 The data was read correctly from the device if\r
734 the Event is NULL.\r
735 @retval EFI_DEVICE_ERROR The device reported an error while performing\r
736 the read.\r
737 @retval EFI_NO_MEDIA There is no media in the device.\r
738 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
739 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
740 intrinsic block size of the device.\r
58727f29 741 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
490b5ea1 742 or the buffer is not on proper alignment.\r
743 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
744 of resources.\r
745\r
746**/\r
747EFI_STATUS\r
748EFIAPI\r
749AtaBlockIoReadBlocksEx (\r
750 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
751 IN UINT32 MediaId,\r
752 IN EFI_LBA Lba,\r
753 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
754 IN UINTN BufferSize,\r
755 OUT VOID *Buffer\r
756 );\r
757\r
758/**\r
759 Write BufferSize bytes from Lba into Buffer.\r
760\r
761 @param[in] This Indicates a pointer to the calling context.\r
762 @param[in] MediaId The media ID that the write request is for.\r
763 @param[in] Lba The starting logical block address to be written. The\r
764 caller is responsible for writing to only legitimate\r
765 locations.\r
766 @param[in, out] Token A pointer to the token associated with the transaction.\r
767 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
768 @param[in] Buffer A pointer to the source buffer for the data.\r
769\r
770 @retval EFI_SUCCESS The data was written correctly to the device.\r
771 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
772 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
773 @retval EFI_NO_MEDIA There is no media in the device.\r
774 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
775 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
58727f29 776 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
490b5ea1 777 or the buffer is not on proper alignment.\r
778\r
779**/\r
780EFI_STATUS\r
781EFIAPI\r
782AtaBlockIoWriteBlocksEx (\r
783 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
784 IN UINT32 MediaId,\r
785 IN EFI_LBA Lba,\r
786 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
787 IN UINTN BufferSize,\r
788 IN VOID *Buffer\r
789 );\r
790\r
791/**\r
792 Flush the Block Device.\r
793\r
794 @param[in] This Indicates a pointer to the calling context.\r
795 @param[in, out] Token A pointer to the token associated with the transaction.\r
796\r
797 @retval EFI_SUCCESS All outstanding data was written to the device\r
798 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
799 @retval EFI_NO_MEDIA There is no media in the device.\r
800\r
801**/\r
802EFI_STATUS\r
803EFIAPI\r
804AtaBlockIoFlushBlocksEx (\r
805 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
806 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
807 );\r
ad86a50a 808\r
71fd9fae
TF
809/**\r
810 Terminate any in-flight non-blocking I/O requests by signaling an EFI_ABORTED\r
811 in the TransactionStatus member of the EFI_BLOCK_IO2_TOKEN for the non-blocking\r
812 I/O. After that it is safe to free any Token or Buffer data structures that\r
813 were allocated to initiate the non-blockingI/O requests that were in-flight for\r
814 this device.\r
815\r
816 @param[in] AtaDevice The ATA child device involved for the operation.\r
817\r
818**/\r
819VOID\r
820EFIAPI\r
821AtaTerminateNonBlockingTask (\r
822 IN ATA_DEVICE *AtaDevice\r
823 );\r
824\r
ad86a50a 825/**\r
826 Provides inquiry information for the controller type.\r
58727f29 827\r
ad86a50a 828 This function is used by the IDE bus driver to get inquiry data. Data format\r
829 of Identify data is defined by the Interface GUID.\r
830\r
05a44e91 831 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
832 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r
833 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r
ad86a50a 834\r
835 @retval EFI_SUCCESS The command was accepted without any errors.\r
58727f29 836 @retval EFI_NOT_FOUND Device does not support this data class\r
837 @retval EFI_DEVICE_ERROR Error reading InquiryData from device\r
838 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough\r
ad86a50a 839\r
840**/\r
841EFI_STATUS\r
842EFIAPI\r
843AtaDiskInfoInquiry (\r
844 IN EFI_DISK_INFO_PROTOCOL *This,\r
845 IN OUT VOID *InquiryData,\r
846 IN OUT UINT32 *InquiryDataSize\r
847 );\r
848\r
849\r
850/**\r
851 Provides identify information for the controller type.\r
852\r
853 This function is used by the IDE bus driver to get identify data. Data format\r
854 of Identify data is defined by the Interface GUID.\r
855\r
58727f29 856 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r
ad86a50a 857 instance.\r
05a44e91 858 @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r
859 @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r
ad86a50a 860 size.\r
861\r
862 @retval EFI_SUCCESS The command was accepted without any errors.\r
58727f29 863 @retval EFI_NOT_FOUND Device does not support this data class\r
864 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device\r
865 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough\r
ad86a50a 866\r
867**/\r
868EFI_STATUS\r
869EFIAPI\r
870AtaDiskInfoIdentify (\r
871 IN EFI_DISK_INFO_PROTOCOL *This,\r
872 IN OUT VOID *IdentifyData,\r
873 IN OUT UINT32 *IdentifyDataSize\r
874 );\r
875\r
876\r
877/**\r
878 Provides sense data information for the controller type.\r
58727f29 879\r
880 This function is used by the IDE bus driver to get sense data.\r
ad86a50a 881 Data format of Sense data is defined by the Interface GUID.\r
882\r
05a44e91 883 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
884 @param[in, out] SenseData Pointer to the SenseData.\r
885 @param[in, out] SenseDataSize Size of SenseData in bytes.\r
886 @param[out] SenseDataNumber Pointer to the value for the sense data size.\r
ad86a50a 887\r
888 @retval EFI_SUCCESS The command was accepted without any errors.\r
889 @retval EFI_NOT_FOUND Device does not support this data class.\r
890 @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r
891 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r
892\r
893**/\r
894EFI_STATUS\r
895EFIAPI\r
896AtaDiskInfoSenseData (\r
897 IN EFI_DISK_INFO_PROTOCOL *This,\r
898 IN OUT VOID *SenseData,\r
899 IN OUT UINT32 *SenseDataSize,\r
900 OUT UINT8 *SenseDataNumber\r
901 );\r
902\r
903\r
904/**\r
905 This function is used by the IDE bus driver to get controller information.\r
906\r
58727f29 907 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
ad86a50a 908 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r
909 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r
910\r
911 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r
912 @retval EFI_UNSUPPORTED This is not an IDE device.\r
913\r
914**/\r
915EFI_STATUS\r
916EFIAPI\r
917AtaDiskInfoWhichIde (\r
918 IN EFI_DISK_INFO_PROTOCOL *This,\r
919 OUT UINT32 *IdeChannel,\r
920 OUT UINT32 *IdeDevice\r
921 );\r
922\r
c24097a5 923/**\r
924 Send a security protocol command to a device that receives data and/or the result\r
925 of one or more commands sent by SendData.\r
926\r
927 The ReceiveData function sends a security protocol command to the given MediaId.\r
928 The security protocol command sent is defined by SecurityProtocolId and contains\r
929 the security protocol specific data SecurityProtocolSpecificData. The function\r
930 returns the data from the security protocol command in PayloadBuffer.\r
931\r
932 For devices supporting the SCSI command set, the security protocol command is sent\r
933 using the SECURITY PROTOCOL IN command defined in SPC-4.\r
934\r
935 For devices supporting the ATA command set, the security protocol command is sent\r
936 using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize\r
937 is non-zero.\r
938\r
939 If the PayloadBufferSize is zero, the security protocol command is sent using the\r
940 Trusted Non-Data command defined in ATA8-ACS.\r
941\r
942 If PayloadBufferSize is too small to store the available data from the security\r
943 protocol command, the function shall copy PayloadBufferSize bytes into the\r
944 PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r
945\r
946 If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r
947 the function shall return EFI_INVALID_PARAMETER.\r
948\r
949 If the given MediaId does not support security protocol commands, the function shall\r
950 return EFI_UNSUPPORTED. If there is no media in the device, the function returns\r
951 EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,\r
952 the function returns EFI_MEDIA_CHANGED.\r
953\r
954 If the security protocol fails to complete within the Timeout period, the function\r
955 shall return EFI_TIMEOUT.\r
956\r
957 If the security protocol command completes without an error, the function shall\r
958 return EFI_SUCCESS. If the security protocol command completes with an error, the\r
959 function shall return EFI_DEVICE_ERROR.\r
960\r
71fd9fae
TF
961 @param This Indicates a pointer to the calling context.\r
962 @param MediaId ID of the medium to receive data from.\r
963 @param Timeout The timeout, in 100ns units, to use for the execution\r
c24097a5 964 of the security protocol command. A Timeout value of 0\r
965 means that this function will wait indefinitely for the\r
966 security protocol command to execute. If Timeout is greater\r
967 than zero, then this function will return EFI_TIMEOUT\r
71fd9fae
TF
968 if the time required to execute the receive data command\r
969 is greater than Timeout.\r
c24097a5 970 @param SecurityProtocolId The value of the "Security Protocol" parameter of\r
971 the security protocol command to be sent.\r
972 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
973 of the security protocol command to be sent.\r
71fd9fae 974 @param PayloadBufferSize Size in bytes of the payload data buffer.\r
c24097a5 975 @param PayloadBuffer A pointer to a destination buffer to store the security\r
976 protocol command specific payload data for the security\r
977 protocol command. The caller is responsible for having\r
978 either implicit or explicit ownership of the buffer.\r
979 @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the\r
980 data written to the payload data buffer.\r
981\r
982 @retval EFI_SUCCESS The security protocol command completed successfully.\r
983 @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available\r
984 data from the device. The PayloadBuffer contains the truncated data.\r
985 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r
986 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r
987 @retval EFI_NO_MEDIA There is no media in the device.\r
988 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
989 @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and\r
990 PayloadBufferSize is non-zero.\r
991 @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r
992 protocol command to execute.\r
993\r
994**/\r
995EFI_STATUS\r
996EFIAPI\r
997AtaStorageSecurityReceiveData (\r
998 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r
999 IN UINT32 MediaId,\r
1000 IN UINT64 Timeout,\r
1001 IN UINT8 SecurityProtocolId,\r
1002 IN UINT16 SecurityProtocolSpecificData,\r
1003 IN UINTN PayloadBufferSize,\r
1004 OUT VOID *PayloadBuffer,\r
1005 OUT UINTN *PayloadTransferSize\r
86d8e199 1006 );\r
c24097a5 1007\r
1008/**\r
1009 Send a security protocol command to a device.\r
1010\r
1011 The SendData function sends a security protocol command containing the payload\r
1012 PayloadBuffer to the given MediaId. The security protocol command sent is\r
1013 defined by SecurityProtocolId and contains the security protocol specific data\r
1014 SecurityProtocolSpecificData. If the underlying protocol command requires a\r
1015 specific padding for the command payload, the SendData function shall add padding\r
1016 bytes to the command payload to satisfy the padding requirements.\r
1017\r
1018 For devices supporting the SCSI command set, the security protocol command is sent\r
1019 using the SECURITY PROTOCOL OUT command defined in SPC-4.\r
1020\r
1021 For devices supporting the ATA command set, the security protocol command is sent\r
1022 using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize\r
1023 is non-zero. If the PayloadBufferSize is zero, the security protocol command is\r
1024 sent using the Trusted Non-Data command defined in ATA8-ACS.\r
1025\r
1026 If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r
1027 return EFI_INVALID_PARAMETER.\r
1028\r
1029 If the given MediaId does not support security protocol commands, the function\r
1030 shall return EFI_UNSUPPORTED. If there is no media in the device, the function\r
1031 returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the\r
1032 device, the function returns EFI_MEDIA_CHANGED.\r
1033\r
1034 If the security protocol fails to complete within the Timeout period, the function\r
1035 shall return EFI_TIMEOUT.\r
1036\r
1037 If the security protocol command completes without an error, the function shall return\r
1038 EFI_SUCCESS. If the security protocol command completes with an error, the function\r
1039 shall return EFI_DEVICE_ERROR.\r
1040\r
71fd9fae
TF
1041 @param This Indicates a pointer to the calling context.\r
1042 @param MediaId ID of the medium to receive data from.\r
1043 @param Timeout The timeout, in 100ns units, to use for the execution\r
c24097a5 1044 of the security protocol command. A Timeout value of 0\r
1045 means that this function will wait indefinitely for the\r
1046 security protocol command to execute. If Timeout is greater\r
1047 than zero, then this function will return EFI_TIMEOUT\r
71fd9fae
TF
1048 if the time required to execute the receive data command\r
1049 is greater than Timeout.\r
c24097a5 1050 @param SecurityProtocolId The value of the "Security Protocol" parameter of\r
1051 the security protocol command to be sent.\r
1052 @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
1053 of the security protocol command to be sent.\r
71fd9fae 1054 @param PayloadBufferSize Size in bytes of the payload data buffer.\r
c24097a5 1055 @param PayloadBuffer A pointer to a destination buffer to store the security\r
1056 protocol command specific payload data for the security\r
1057 protocol command.\r
1058\r
1059 @retval EFI_SUCCESS The security protocol command completed successfully.\r
1060 @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r
1061 @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r
1062 @retval EFI_NO_MEDIA There is no media in the device.\r
1063 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
1064 @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.\r
1065 @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r
1066 protocol command to execute.\r
1067\r
1068**/\r
1069EFI_STATUS\r
1070EFIAPI\r
1071AtaStorageSecuritySendData (\r
1072 IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r
1073 IN UINT32 MediaId,\r
1074 IN UINT64 Timeout,\r
1075 IN UINT8 SecurityProtocolId,\r
1076 IN UINT16 SecurityProtocolSpecificData,\r
1077 IN UINTN PayloadBufferSize,\r
1078 IN VOID *PayloadBuffer\r
86d8e199 1079 );\r
c24097a5 1080\r
90398d55 1081/**\r
1082 Send TPer Reset command to reset eDrive to lock all protected bands.\r
1083 Typically, there are 2 mechanism for resetting eDrive. They are:\r
1084 1. TPer Reset through IEEE 1667 protocol.\r
1085 2. TPer Reset through native TCG protocol.\r
1086 This routine will detect what protocol the attached eDrive comform to, TCG or\r
1087 IEEE 1667 protocol. Then send out TPer Reset command separately.\r
1088\r
1089 @param[in] AtaDevice ATA_DEVICE pointer.\r
1090\r
1091**/\r
1092VOID\r
1093InitiateTPerReset (\r
1094 IN ATA_DEVICE *AtaDevice\r
1095 );\r
1096\r
ad86a50a 1097#endif\r