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