]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
1. Add definition for SSP(StorageSecurityCommand Protocol)
[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
e519983a 7 Copyright (c) 2009 - 2011, 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
23#include <Protocol/AtaPassThru.h>\r
24#include <Protocol/BlockIo.h>\r
490b5ea1 25#include <Protocol/BlockIo2.h>\r
ad86a50a 26#include <Protocol/DiskInfo.h>\r
27#include <Protocol/DevicePath.h>\r
ad86a50a 28\r
29#include <Library/DebugLib.h>\r
30#include <Library/UefiDriverEntryPoint.h>\r
31#include <Library/BaseLib.h>\r
32#include <Library/UefiLib.h>\r
33#include <Library/BaseMemoryLib.h>\r
34#include <Library/MemoryAllocationLib.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/DevicePathLib.h>\r
37\r
38#include <IndustryStandard/Atapi.h>\r
39\r
40//\r
41// Time out value for ATA pass through protocol\r
42//\r
e519983a 43#define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)\r
ad86a50a 44\r
45//\r
46// Maximum number of times to retry ATA command\r
47//\r
48#define MAX_RETRY_TIMES 3\r
49\r
50//\r
51// The maximum total sectors count in 28 bit addressing mode\r
52//\r
53#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff\r
54\r
55//\r
56// The maximum ATA transaction sector count in 28 bit addressing mode. \r
57//\r
58#define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100\r
59\r
60//\r
61// The maximum ATA transaction sector count in 48 bit addressing mode. \r
62//\r
490b5ea1 63//#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000\r
64\r
65//\r
66// BugBug: if the TransferLength is equal with 0x10000 (the 48bit max length),\r
67// there is a bug that even the register interrupt bit has been sit, the buffer\r
68// seems not ready. Change the Maximum Sector Numbers to 0xFFFF to work round\r
69// this issue.\r
70//\r
71#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF\r
ad86a50a 72\r
73//\r
74// The maximum model name in ATA identify data \r
75//\r
76#define MAX_MODEL_NAME_LEN 40\r
77\r
490b5ea1 78#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')\r
79#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')\r
80\r
81#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r
82\r
83//\r
84// Task for the non blocking I/O\r
85//\r
86typedef struct {\r
87 UINT32 Signature;\r
88 EFI_BLOCK_IO2_TOKEN *Token;\r
89 UINTN *UnsignalledEventCount;\r
90 EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r
91 BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.\r
92 LIST_ENTRY TaskEntry;\r
93} ATA_BUS_ASYN_TASK;\r
ad86a50a 94\r
95//\r
96// ATA bus data structure for ATA controller\r
97//\r
98typedef struct {\r
99 EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;\r
100 EFI_HANDLE Controller;\r
101 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
102 EFI_HANDLE DriverBindingHandle;\r
103} ATA_BUS_DRIVER_DATA;\r
104\r
ad86a50a 105//\r
106// ATA device data structure for each child device\r
107//\r
108typedef struct {\r
490b5ea1 109 UINT32 Signature;\r
ad86a50a 110\r
490b5ea1 111 EFI_HANDLE Handle;\r
112 EFI_BLOCK_IO_PROTOCOL BlockIo;\r
113 EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r
114 EFI_BLOCK_IO_MEDIA BlockMedia;\r
115 EFI_DISK_INFO_PROTOCOL DiskInfo;\r
116 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
ad86a50a 117\r
490b5ea1 118 ATA_BUS_DRIVER_DATA *AtaBusDriverData;\r
119 UINT16 Port;\r
120 UINT16 PortMultiplierPort;\r
ad86a50a 121\r
122 //\r
123 // Buffer for the execution of ATA pass through protocol\r
124 //\r
490b5ea1 125 EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r
126 EFI_ATA_COMMAND_BLOCK Acb;\r
127 EFI_ATA_STATUS_BLOCK *Asb;\r
ad86a50a 128\r
490b5ea1 129 BOOLEAN UdmaValid;\r
130 BOOLEAN Lba48Bit;\r
ad86a50a 131\r
132 //\r
133 // Cached data for ATA identify data\r
134 //\r
490b5ea1 135 ATA_IDENTIFY_DATA *IdentifyData;\r
ad86a50a 136\r
490b5ea1 137 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
138 CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];\r
ad86a50a 139\r
490b5ea1 140 LIST_ENTRY AtaTaskList;\r
ad86a50a 141} ATA_DEVICE;\r
142\r
490b5ea1 143#define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)\r
144#define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)\r
145#define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r
146#define ATA_AYNS_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r
ad86a50a 147\r
148//\r
149// Global Variables\r
150//\r
151extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;\r
152extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;\r
153extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;\r
154\r
490b5ea1 155/**\r
156 Allocates an aligned buffer for ATA device.\r
157\r
158 This function allocates an aligned buffer for the ATA device to perform\r
159 ATA pass through operations. The alignment requirement is from ATA pass\r
160 through interface.\r
161\r
162 @param AtaDevice The ATA child device involved for the operation.\r
163 @param BufferSize The request buffer size.\r
164\r
165 @return A pointer to the aligned buffer or NULL if the allocation fails.\r
166\r
167**/\r
168VOID *\r
169AllocateAlignedBuffer (\r
170 IN ATA_DEVICE *AtaDevice,\r
171 IN UINTN BufferSize\r
172 );\r
173\r
174/**\r
175 Frees an aligned buffer for ATA device.\r
176\r
177 This function frees an aligned buffer for the ATA device to perform\r
178 ATA pass through operations.\r
179\r
180 @param Buffer The aligned buffer to be freed.\r
181 @param BufferSize The request buffer size.\r
182\r
183**/\r
184VOID\r
185FreeAlignedBuffer (\r
186 IN VOID *Buffer,\r
187 IN UINTN BufferSize\r
188 );\r
189\r
190/**\r
191 Free SubTask. \r
192\r
193 @param[in, out] Task Pointer to task to be freed.\r
194 \r
195**/\r
196VOID\r
197EFIAPI \r
198FreeAtaSubTask (\r
199 IN ATA_BUS_ASYN_TASK *Task\r
200 );\r
ad86a50a 201\r
202/**\r
203 Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().\r
204\r
205 This function wraps the ResetDevice() invocation for ATA pass through function\r
206 for an ATA device. \r
207\r
208 @param AtaDevice The ATA child device involved for the operation.\r
209\r
210 @return The return status from EFI_ATA_PASS_THRU_PROTOCOL.PassThru().\r
211\r
212**/\r
213EFI_STATUS\r
214ResetAtaDevice (\r
215 IN ATA_DEVICE *AtaDevice\r
216 );\r
217\r
218\r
219/**\r
220 Discovers whether it is a valid ATA device.\r
221\r
222 This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it.\r
223 If the command is executed successfully, it then identifies it and initializes\r
224 the Media information in Block IO protocol interface.\r
225\r
226 @param AtaDevice The ATA child device involved for the operation.\r
227\r
228 @retval EFI_SUCCESS The device is successfully identified and Media information\r
229 is correctly initialized.\r
230 @return others Some error occurs when discovering the ATA device. \r
231\r
232**/\r
233EFI_STATUS\r
234DiscoverAtaDevice (\r
235 IN OUT ATA_DEVICE *AtaDevice\r
236 );\r
237\r
ad86a50a 238/**\r
239 Read or write a number of blocks from ATA device.\r
240\r
241 This function performs ATA pass through transactions to read/write data from/to\r
242 ATA device. It may separate the read/write request into several ATA pass through\r
243 transactions.\r
244\r
490b5ea1 245 @param[in, out] AtaDevice The ATA child device involved for the operation.\r
246 @param[in, out] Buffer The pointer to the current transaction buffer.\r
247 @param[in] StartLba The starting logical block address to be accessed.\r
248 @param[in] NumberOfBlocks The block number or sector count of the transfer.\r
249 @param[in] IsWrite Indicates whether it is a write operation.\r
250 @param[in, out] Token A pointer to the token associated with the transaction.\r
ad86a50a 251\r
252 @retval EFI_SUCCESS The data transfer is complete successfully.\r
253 @return others Some error occurs when transferring data. \r
254\r
255**/\r
256EFI_STATUS \r
257AccessAtaDevice(\r
258 IN OUT ATA_DEVICE *AtaDevice,\r
259 IN OUT UINT8 *Buffer,\r
260 IN EFI_LBA StartLba,\r
261 IN UINTN NumberOfBlocks,\r
490b5ea1 262 IN BOOLEAN IsWrite,\r
263 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
ad86a50a 264 );\r
265\r
266//\r
267// Protocol interface prototypes\r
268//\r
269/**\r
270 Tests to see if this driver supports a given controller. If a child device is provided, \r
271 it further tests to see if this driver supports creating a handle for the specified child device.\r
272\r
273 This function checks to see if the driver specified by This supports the device specified by \r
274 ControllerHandle. Drivers will typically use the device path attached to \r
275 ControllerHandle and/or the services from the bus I/O abstraction attached to \r
276 ControllerHandle to determine if the driver supports ControllerHandle. This function \r
277 may be called many times during platform initialization. In order to reduce boot times, the tests \r
278 performed by this function must be very small, and take as little time as possible to execute. This \r
279 function must not change the state of any hardware devices, and this function must be aware that the \r
280 device specified by ControllerHandle may already be managed by the same driver or a \r
281 different driver. This function must match its calls to AllocatePages() with FreePages(), \r
282 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). \r
283 Since ControllerHandle may have been previously started by the same driver, if a protocol is \r
284 already in the opened state, then it must not be closed with CloseProtocol(). This is required \r
285 to guarantee the state of ControllerHandle is not modified by this function.\r
286\r
287 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
288 @param[in] ControllerHandle The handle of the controller to test. This handle \r
289 must support a protocol interface that supplies \r
290 an I/O abstraction to the driver.\r
291 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
292 parameter is ignored by device drivers, and is optional for bus \r
293 drivers. For bus drivers, if this parameter is not NULL, then \r
294 the bus driver must determine if the bus controller specified \r
295 by ControllerHandle and the child controller specified \r
296 by RemainingDevicePath are both supported by this \r
297 bus driver.\r
298\r
299 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
300 RemainingDevicePath is supported by the driver specified by This.\r
301 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
302 RemainingDevicePath is already being managed by the driver\r
303 specified by This.\r
304 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
305 RemainingDevicePath is already being managed by a different\r
306 driver or an application that requires exclusive access.\r
307 Currently not implemented.\r
308 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
309 RemainingDevicePath is not supported by the driver specified by This.\r
310**/\r
311EFI_STATUS\r
312EFIAPI\r
313AtaBusDriverBindingSupported (\r
314 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
315 IN EFI_HANDLE Controller,\r
316 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
317 );\r
318\r
319/**\r
320 Starts a device controller or a bus controller.\r
321\r
322 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
323 As a result, much of the error checking on the parameters to Start() has been moved into this \r
324 common boot service. It is legal to call Start() from other locations, \r
325 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
326 1. ControllerHandle must be a valid EFI_HANDLE.\r
327 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
328 EFI_DEVICE_PATH_PROTOCOL.\r
329 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
330 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r
331\r
332 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
333 @param[in] ControllerHandle The handle of the controller to start. This handle \r
334 must support a protocol interface that supplies \r
335 an I/O abstraction to the driver.\r
336 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r
337 parameter is ignored by device drivers, and is optional for bus \r
338 drivers. For a bus driver, if this parameter is NULL, then handles \r
339 for all the children of Controller are created by this driver. \r
340 If this parameter is not NULL and the first Device Path Node is \r
341 not the End of Device Path Node, then only the handle for the \r
342 child device specified by the first Device Path Node of \r
343 RemainingDevicePath is created by this driver.\r
344 If the first Device Path Node of RemainingDevicePath is \r
345 the End of Device Path Node, no child handle is created by this\r
346 driver.\r
347\r
348 @retval EFI_SUCCESS The device was started.\r
349 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
350 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
351 @retval Others The driver failded to start the device.\r
352\r
353**/\r
354EFI_STATUS\r
355EFIAPI\r
356AtaBusDriverBindingStart (\r
357 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
358 IN EFI_HANDLE Controller,\r
359 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
360 );\r
361\r
362/**\r
363 Stops a device controller or a bus controller.\r
364 \r
365 The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r
366 As a result, much of the error checking on the parameters to Stop() has been moved \r
367 into this common boot service. It is legal to call Stop() from other locations, \r
368 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
369 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
370 same driver's Start() function.\r
371 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
372 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
373 Start() function, and the Start() function must have called OpenProtocol() on\r
374 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
375 \r
376 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
377 @param[in] ControllerHandle A handle to the device being stopped. The handle must \r
378 support a bus specific I/O protocol for the driver \r
379 to use to stop the device.\r
380 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
381 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r
382 if NumberOfChildren is 0.\r
383\r
384 @retval EFI_SUCCESS The device was stopped.\r
385 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
386\r
387**/\r
388EFI_STATUS\r
389EFIAPI\r
390AtaBusDriverBindingStop (\r
391 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
392 IN EFI_HANDLE Controller,\r
393 IN UINTN NumberOfChildren,\r
394 IN EFI_HANDLE *ChildHandleBuffer\r
395 );\r
396\r
397\r
398/**\r
399 Retrieves a Unicode string that is the user readable name of the driver.\r
400\r
401 This function retrieves the user readable name of a driver in the form of a\r
402 Unicode string. If the driver specified by This has a user readable name in\r
403 the language specified by Language, then a pointer to the driver name is\r
404 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
405 by This does not support the language specified by Language,\r
406 then EFI_UNSUPPORTED is returned.\r
407\r
408 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
409 EFI_COMPONENT_NAME_PROTOCOL instance.\r
410\r
411 @param Language[in] A pointer to a Null-terminated ASCII string\r
412 array indicating the language. This is the\r
413 language of the driver name that the caller is\r
414 requesting, and it must match one of the\r
415 languages specified in SupportedLanguages. The\r
416 number of languages supported by a driver is up\r
417 to the driver writer. Language is specified\r
418 in RFC 4646 or ISO 639-2 language code format.\r
419\r
420 @param DriverName[out] A pointer to the Unicode string to return.\r
421 This Unicode string is the name of the\r
422 driver specified by This in the language\r
423 specified by Language.\r
424\r
425 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
426 This and the language specified by Language was\r
427 returned in DriverName.\r
428\r
429 @retval EFI_INVALID_PARAMETER Language is NULL.\r
430\r
431 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
432\r
433 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
434 the language specified by Language.\r
435\r
436**/\r
437EFI_STATUS\r
438EFIAPI\r
439AtaBusComponentNameGetDriverName (\r
440 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
441 IN CHAR8 *Language,\r
442 OUT CHAR16 **DriverName\r
443 );\r
444\r
445\r
446/**\r
447 Retrieves a Unicode string that is the user readable name of the controller\r
448 that is being managed by a driver.\r
449\r
450 This function retrieves the user readable name of the controller specified by\r
451 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
452 driver specified by This has a user readable name in the language specified by\r
453 Language, then a pointer to the controller name is returned in ControllerName,\r
454 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
455 managing the controller specified by ControllerHandle and ChildHandle,\r
456 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
457 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
458\r
459 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
460 EFI_COMPONENT_NAME_PROTOCOL instance.\r
461\r
462 @param ControllerHandle[in] The handle of a controller that the driver\r
463 specified by This is managing. This handle\r
464 specifies the controller whose name is to be\r
465 returned.\r
466\r
467 @param ChildHandle[in] The handle of the child controller to retrieve\r
468 the name of. This is an optional parameter that\r
469 may be NULL. It will be NULL for device\r
470 drivers. It will also be NULL for a bus drivers\r
471 that wish to retrieve the name of the bus\r
472 controller. It will not be NULL for a bus\r
473 driver that wishes to retrieve the name of a\r
474 child controller.\r
475\r
476 @param Language[in] A pointer to a Null-terminated ASCII string\r
477 array indicating the language. This is the\r
478 language of the driver name that the caller is\r
479 requesting, and it must match one of the\r
480 languages specified in SupportedLanguages. The\r
481 number of languages supported by a driver is up\r
482 to the driver writer. Language is specified in\r
483 RFC 4646 or ISO 639-2 language code format.\r
484\r
485 @param ControllerName[out] A pointer to the Unicode string to return.\r
486 This Unicode string is the name of the\r
487 controller specified by ControllerHandle and\r
488 ChildHandle in the language specified by\r
489 Language from the point of view of the driver\r
490 specified by This.\r
491\r
492 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
493 the language specified by Language for the\r
494 driver specified by This was returned in\r
495 DriverName.\r
496\r
497 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
498\r
499 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
500 EFI_HANDLE.\r
501\r
502 @retval EFI_INVALID_PARAMETER Language is NULL.\r
503\r
504 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
505\r
506 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
507 managing the controller specified by\r
508 ControllerHandle and ChildHandle.\r
509\r
510 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
511 the language specified by Language.\r
512\r
513**/\r
514EFI_STATUS\r
515EFIAPI\r
516AtaBusComponentNameGetControllerName (\r
517 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
518 IN EFI_HANDLE ControllerHandle,\r
519 IN EFI_HANDLE ChildHandle OPTIONAL,\r
520 IN CHAR8 *Language,\r
521 OUT CHAR16 **ControllerName\r
522 );\r
523\r
524\r
525/**\r
526 Reset the Block Device.\r
527\r
528 @param This Indicates a pointer to the calling context.\r
529 @param ExtendedVerification Driver may perform diagnostics on reset.\r
530\r
531 @retval EFI_SUCCESS The device was reset.\r
532 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
533 not be reset.\r
534\r
535**/\r
536EFI_STATUS\r
537EFIAPI\r
538AtaBlockIoReset (\r
539 IN EFI_BLOCK_IO_PROTOCOL *This,\r
540 IN BOOLEAN ExtendedVerification\r
541 );\r
542\r
543\r
544/**\r
545 Read BufferSize bytes from Lba into Buffer.\r
546\r
547 @param This Indicates a pointer to the calling context.\r
548 @param MediaId Id of the media, changes every time the media is replaced.\r
549 @param Lba The starting Logical Block Address to read from\r
550 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
551 @param Buffer A pointer to the destination buffer for the data. The caller is\r
552 responsible for either having implicit or explicit ownership of the buffer.\r
553\r
554 @retval EFI_SUCCESS The data was read correctly from the device.\r
555 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
556 @retval EFI_NO_MEDIA There is no media in the device.\r
557 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r
558 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
559 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
560 or the buffer is not on proper alignment.\r
561\r
562**/\r
563EFI_STATUS\r
564EFIAPI\r
565AtaBlockIoReadBlocks (\r
566 IN EFI_BLOCK_IO_PROTOCOL *This,\r
567 IN UINT32 MediaId,\r
568 IN EFI_LBA Lba,\r
569 IN UINTN BufferSize,\r
570 OUT VOID *Buffer\r
571 );\r
572\r
573\r
574/**\r
575 Write BufferSize bytes from Lba into Buffer.\r
576\r
577 @param This Indicates a pointer to the calling context.\r
578 @param MediaId The media ID that the write request is for.\r
579 @param Lba The starting logical block address to be written. The caller is\r
580 responsible for writing to only legitimate locations.\r
581 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
582 @param Buffer A pointer to the source buffer for the data.\r
583\r
584 @retval EFI_SUCCESS The data was written correctly to the device.\r
585 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
586 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
587 @retval EFI_NO_MEDIA There is no media in the device.\r
588 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
589 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
590 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
591 or the buffer is not on proper alignment.\r
592\r
593**/\r
594EFI_STATUS\r
595EFIAPI\r
596AtaBlockIoWriteBlocks (\r
597 IN EFI_BLOCK_IO_PROTOCOL *This,\r
598 IN UINT32 MediaId,\r
599 IN EFI_LBA Lba,\r
600 IN UINTN BufferSize,\r
601 IN VOID *Buffer\r
602 );\r
603\r
604\r
605/**\r
606 Flush the Block Device.\r
607\r
608 @param This Indicates a pointer to the calling context.\r
609\r
610 @retval EFI_SUCCESS All outstanding data was written to the device\r
611 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
612 @retval EFI_NO_MEDIA There is no media in the device.\r
613\r
614**/\r
615EFI_STATUS\r
616EFIAPI\r
617AtaBlockIoFlushBlocks (\r
618 IN EFI_BLOCK_IO_PROTOCOL *This\r
619 );\r
620\r
490b5ea1 621/**\r
622 Reset the Block Device throught Block I/O2 protocol.\r
623\r
624 @param[in] This Indicates a pointer to the calling context.\r
625 @param[in] ExtendedVerification Driver may perform diagnostics on reset.\r
626\r
627 @retval EFI_SUCCESS The device was reset.\r
628 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
629 not be reset.\r
630\r
631**/\r
632EFI_STATUS\r
633EFIAPI\r
634AtaBlockIoResetEx (\r
635 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
636 IN BOOLEAN ExtendedVerification\r
637 );\r
638\r
639/**\r
640 Read BufferSize bytes from Lba into Buffer.\r
641\r
642 @param[in] This Indicates a pointer to the calling context.\r
643 @param[in] MediaId Id of the media, changes every time the media is replaced.\r
644 @param[in] Lba The starting Logical Block Address to read from.\r
645 @param[in, out] Token A pointer to the token associated with the transaction.\r
646 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
647 @param[out] Buffer A pointer to the destination buffer for the data. The caller is\r
648 responsible for either having implicit or explicit ownership of the buffer.\r
649\r
650 @retval EFI_SUCCESS The read request was queued if Event is not NULL.\r
651 The data was read correctly from the device if\r
652 the Event is NULL.\r
653 @retval EFI_DEVICE_ERROR The device reported an error while performing\r
654 the read.\r
655 @retval EFI_NO_MEDIA There is no media in the device.\r
656 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
657 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
658 intrinsic block size of the device.\r
659 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
660 or the buffer is not on proper alignment.\r
661 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
662 of resources.\r
663\r
664**/\r
665EFI_STATUS\r
666EFIAPI\r
667AtaBlockIoReadBlocksEx (\r
668 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
669 IN UINT32 MediaId,\r
670 IN EFI_LBA Lba,\r
671 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
672 IN UINTN BufferSize,\r
673 OUT VOID *Buffer\r
674 );\r
675\r
676/**\r
677 Write BufferSize bytes from Lba into Buffer.\r
678\r
679 @param[in] This Indicates a pointer to the calling context.\r
680 @param[in] MediaId The media ID that the write request is for.\r
681 @param[in] Lba The starting logical block address to be written. The\r
682 caller is responsible for writing to only legitimate\r
683 locations.\r
684 @param[in, out] Token A pointer to the token associated with the transaction.\r
685 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
686 @param[in] Buffer A pointer to the source buffer for the data.\r
687\r
688 @retval EFI_SUCCESS The data was written correctly to the device.\r
689 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
690 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
691 @retval EFI_NO_MEDIA There is no media in the device.\r
692 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
693 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
694 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
695 or the buffer is not on proper alignment.\r
696\r
697**/\r
698EFI_STATUS\r
699EFIAPI\r
700AtaBlockIoWriteBlocksEx (\r
701 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
702 IN UINT32 MediaId,\r
703 IN EFI_LBA Lba,\r
704 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
705 IN UINTN BufferSize,\r
706 IN VOID *Buffer\r
707 );\r
708\r
709/**\r
710 Flush the Block Device.\r
711\r
712 @param[in] This Indicates a pointer to the calling context.\r
713 @param[in, out] Token A pointer to the token associated with the transaction.\r
714\r
715 @retval EFI_SUCCESS All outstanding data was written to the device\r
716 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r
717 @retval EFI_NO_MEDIA There is no media in the device.\r
718\r
719**/\r
720EFI_STATUS\r
721EFIAPI\r
722AtaBlockIoFlushBlocksEx (\r
723 IN EFI_BLOCK_IO2_PROTOCOL *This,\r
724 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
725 );\r
ad86a50a 726\r
727/**\r
728 Provides inquiry information for the controller type.\r
729 \r
730 This function is used by the IDE bus driver to get inquiry data. Data format\r
731 of Identify data is defined by the Interface GUID.\r
732\r
05a44e91 733 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
734 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r
735 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r
ad86a50a 736\r
737 @retval EFI_SUCCESS The command was accepted without any errors.\r
738 @retval EFI_NOT_FOUND Device does not support this data class \r
739 @retval EFI_DEVICE_ERROR Error reading InquiryData from device \r
740 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough \r
741\r
742**/\r
743EFI_STATUS\r
744EFIAPI\r
745AtaDiskInfoInquiry (\r
746 IN EFI_DISK_INFO_PROTOCOL *This,\r
747 IN OUT VOID *InquiryData,\r
748 IN OUT UINT32 *InquiryDataSize\r
749 );\r
750\r
751\r
752/**\r
753 Provides identify information for the controller type.\r
754\r
755 This function is used by the IDE bus driver to get identify data. Data format\r
756 of Identify data is defined by the Interface GUID.\r
757\r
05a44e91 758 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL \r
ad86a50a 759 instance.\r
05a44e91 760 @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r
761 @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r
ad86a50a 762 size.\r
763\r
764 @retval EFI_SUCCESS The command was accepted without any errors.\r
765 @retval EFI_NOT_FOUND Device does not support this data class \r
766 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device \r
767 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough \r
768\r
769**/\r
770EFI_STATUS\r
771EFIAPI\r
772AtaDiskInfoIdentify (\r
773 IN EFI_DISK_INFO_PROTOCOL *This,\r
774 IN OUT VOID *IdentifyData,\r
775 IN OUT UINT32 *IdentifyDataSize\r
776 );\r
777\r
778\r
779/**\r
780 Provides sense data information for the controller type.\r
781 \r
782 This function is used by the IDE bus driver to get sense data. \r
783 Data format of Sense data is defined by the Interface GUID.\r
784\r
05a44e91 785 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
786 @param[in, out] SenseData Pointer to the SenseData.\r
787 @param[in, out] SenseDataSize Size of SenseData in bytes.\r
788 @param[out] SenseDataNumber Pointer to the value for the sense data size.\r
ad86a50a 789\r
790 @retval EFI_SUCCESS The command was accepted without any errors.\r
791 @retval EFI_NOT_FOUND Device does not support this data class.\r
792 @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r
793 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r
794\r
795**/\r
796EFI_STATUS\r
797EFIAPI\r
798AtaDiskInfoSenseData (\r
799 IN EFI_DISK_INFO_PROTOCOL *This,\r
800 IN OUT VOID *SenseData,\r
801 IN OUT UINT32 *SenseDataSize,\r
802 OUT UINT8 *SenseDataNumber\r
803 );\r
804\r
805\r
806/**\r
807 This function is used by the IDE bus driver to get controller information.\r
808\r
809 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. \r
810 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r
811 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r
812\r
813 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r
814 @retval EFI_UNSUPPORTED This is not an IDE device.\r
815\r
816**/\r
817EFI_STATUS\r
818EFIAPI\r
819AtaDiskInfoWhichIde (\r
820 IN EFI_DISK_INFO_PROTOCOL *This,\r
821 OUT UINT32 *IdeChannel,\r
822 OUT UINT32 *IdeDevice\r
823 );\r
824\r
825#endif\r