]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
MdeModulePkg/AtaAtapiPassThru: disable only BM-DMA at ExitBootServices()
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaAtapiPassThru / AtaAtapiPassThru.h
... / ...
CommitLineData
1/** @file\r
2 Header file for ATA/ATAPI PASS THRU driver.\r
3\r
4 Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14#ifndef __ATA_ATAPI_PASS_THRU_H__\r
15#define __ATA_ATAPI_PASS_THRU_H__\r
16\r
17#include <Uefi.h>\r
18\r
19#include <IndustryStandard/Pci.h>\r
20#include <IndustryStandard/Atapi.h>\r
21#include <IndustryStandard/Scsi.h>\r
22\r
23#include <Protocol/PciIo.h>\r
24#include <Protocol/IdeControllerInit.h>\r
25#include <Protocol/AtaPassThru.h>\r
26#include <Protocol/ScsiPassThruExt.h>\r
27\r
28#include <Library/DebugLib.h>\r
29#include <Library/BaseLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/UefiDriverEntryPoint.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/PciLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/TimerLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/ReportStatusCodeLib.h>\r
39#include <Library/DevicePathLib.h>\r
40\r
41#include "IdeMode.h"\r
42#include "AhciMode.h"\r
43\r
44extern EFI_DRIVER_BINDING_PROTOCOL gAtaAtapiPassThruDriverBinding;\r
45extern EFI_COMPONENT_NAME_PROTOCOL gAtaAtapiPassThruComponentName;\r
46extern EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2;\r
47\r
48#define ATA_ATAPI_PASS_THRU_SIGNATURE SIGNATURE_32 ('a', 'a', 'p', 't')\r
49#define ATA_ATAPI_DEVICE_SIGNATURE SIGNATURE_32 ('a', 'd', 'e', 'v')\r
50#define ATA_NONBLOCKING_TASK_SIGNATURE SIGNATURE_32 ('a', 't', 's', 'k')\r
51\r
52typedef struct _ATA_NONBLOCK_TASK ATA_NONBLOCK_TASK;\r
53\r
54typedef enum {\r
55 EfiAtaIdeMode,\r
56 EfiAtaAhciMode,\r
57 EfiAtaRaidMode,\r
58 EfiAtaUnknownMode\r
59} EFI_ATA_HC_WORK_MODE;\r
60\r
61typedef enum {\r
62 EfiIdeCdrom, /* ATAPI CDROM */\r
63 EfiIdeHarddisk, /* Hard Disk */\r
64 EfiPortMultiplier, /* Port Multiplier */\r
65 EfiIdeUnknown\r
66} EFI_ATA_DEVICE_TYPE;\r
67\r
68//\r
69// Ahci mode device info\r
70//\r
71typedef struct {\r
72 UINT32 Signature;\r
73 LIST_ENTRY Link;\r
74\r
75 UINT16 Port;\r
76 UINT16 PortMultiplier;\r
77 EFI_ATA_DEVICE_TYPE Type;\r
78\r
79 EFI_IDENTIFY_DATA *IdentifyData;\r
80} EFI_ATA_DEVICE_INFO;\r
81\r
82typedef struct {\r
83 UINT32 Signature;\r
84\r
85 EFI_HANDLE ControllerHandle;\r
86 EFI_PCI_IO_PROTOCOL *PciIo;\r
87 EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;\r
88\r
89 EFI_ATA_PASS_THRU_MODE AtaPassThruMode;\r
90 EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru;\r
91 EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;\r
92 EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;\r
93\r
94 EFI_ATA_HC_WORK_MODE Mode;\r
95\r
96 EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];\r
97 EFI_AHCI_REGISTERS AhciRegisters;\r
98\r
99 //\r
100 // The attached device list\r
101 //\r
102 LIST_ENTRY DeviceList;\r
103 UINT64 EnabledPciAttributes;\r
104 UINT64 OriginalPciAttributes;\r
105\r
106 //\r
107 // For AtaPassThru protocol, using the following bytes to record the previous call in\r
108 // GetNextPort()/GetNextDevice().\r
109 //\r
110 UINT16 PreviousPort;\r
111 UINT16 PreviousPortMultiplier;\r
112 //\r
113 // For ExtScsiPassThru protocol, using the following bytes to record the previous call in\r
114 // GetNextTarget()/GetNextTargetLun().\r
115 //\r
116 UINT16 PreviousTargetId;\r
117 UINT64 PreviousLun;\r
118\r
119 //\r
120 // For Non-blocking.\r
121 //\r
122 EFI_EVENT TimerEvent;\r
123 LIST_ENTRY NonBlockingTaskList;\r
124\r
125 //\r
126 // For disabling Bus Master DMA on the device at ExitBootServices().\r
127 //\r
128 EFI_EVENT ExitBootEvent;\r
129} ATA_ATAPI_PASS_THRU_INSTANCE;\r
130\r
131//\r
132// Task for Non-blocking mode.\r
133//\r
134struct _ATA_NONBLOCK_TASK {\r
135 UINT32 Signature;\r
136 LIST_ENTRY Link;\r
137\r
138 UINT16 Port;\r
139 UINT16 PortMultiplier;\r
140 EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;\r
141 BOOLEAN IsStart;\r
142 EFI_EVENT Event;\r
143 UINT64 RetryTimes;\r
144 BOOLEAN InfiniteWait;\r
145 VOID *Map; // Pointer to map.\r
146 VOID *TableMap; // Pointer to PRD table map.\r
147 EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.\r
148 UINTN PageCount; // The page numbers used by PCIO freebuffer.\r
149};\r
150\r
151//\r
152// Timeout value which uses 100ns as a unit.\r
153// It means 3 second span.\r
154//\r
155#define ATA_ATAPI_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)\r
156\r
157#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r
158\r
159#define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \\r
160 CR (a, \\r
161 ATA_ATAPI_PASS_THRU_INSTANCE, \\r
162 AtaPassThru, \\r
163 ATA_ATAPI_PASS_THRU_SIGNATURE \\r
164 )\r
165\r
166#define EXT_SCSI_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \\r
167 CR (a, \\r
168 ATA_ATAPI_PASS_THRU_INSTANCE, \\r
169 ExtScsiPassThru, \\r
170 ATA_ATAPI_PASS_THRU_SIGNATURE \\r
171 )\r
172\r
173#define ATA_ATAPI_DEVICE_INFO_FROM_THIS(a) \\r
174 CR (a, \\r
175 EFI_ATA_DEVICE_INFO, \\r
176 Link, \\r
177 ATA_ATAPI_DEVICE_SIGNATURE \\r
178 );\r
179\r
180#define ATA_NON_BLOCK_TASK_FROM_ENTRY(a) \\r
181 CR (a, \\r
182 ATA_NONBLOCK_TASK, \\r
183 Link, \\r
184 ATA_NONBLOCKING_TASK_SIGNATURE \\r
185 );\r
186\r
187/**\r
188 Retrieves a Unicode string that is the user readable name of the driver.\r
189\r
190 This function retrieves the user readable name of a driver in the form of a\r
191 Unicode string. If the driver specified by This has a user readable name in\r
192 the language specified by Language, then a pointer to the driver name is\r
193 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
194 by This does not support the language specified by Language,\r
195 then EFI_UNSUPPORTED is returned.\r
196\r
197 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
198 EFI_COMPONENT_NAME_PROTOCOL instance.\r
199\r
200 @param Language[in] A pointer to a Null-terminated ASCII string\r
201 array indicating the language. This is the\r
202 language of the driver name that the caller is\r
203 requesting, and it must match one of the\r
204 languages specified in SupportedLanguages. The\r
205 number of languages supported by a driver is up\r
206 to the driver writer. Language is specified\r
207 in RFC 4646 or ISO 639-2 language code format.\r
208\r
209 @param DriverName[out] A pointer to the Unicode string to return.\r
210 This Unicode string is the name of the\r
211 driver specified by This in the language\r
212 specified by Language.\r
213\r
214 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
215 This and the language specified by Language was\r
216 returned in DriverName.\r
217\r
218 @retval EFI_INVALID_PARAMETER Language is NULL.\r
219\r
220 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
221\r
222 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
223 the language specified by Language.\r
224\r
225**/\r
226EFI_STATUS\r
227EFIAPI\r
228AtaAtapiPassThruComponentNameGetDriverName (\r
229 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
230 IN CHAR8 *Language,\r
231 OUT CHAR16 **DriverName\r
232 );\r
233\r
234/**\r
235 Retrieves a Unicode string that is the user readable name of the controller\r
236 that is being managed by a driver.\r
237\r
238 This function retrieves the user readable name of the controller specified by\r
239 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
240 driver specified by This has a user readable name in the language specified by\r
241 Language, then a pointer to the controller name is returned in ControllerName,\r
242 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
243 managing the controller specified by ControllerHandle and ChildHandle,\r
244 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
245 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
246\r
247 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
248 EFI_COMPONENT_NAME_PROTOCOL instance.\r
249\r
250 @param ControllerHandle[in] The handle of a controller that the driver\r
251 specified by This is managing. This handle\r
252 specifies the controller whose name is to be\r
253 returned.\r
254\r
255 @param ChildHandle[in] The handle of the child controller to retrieve\r
256 the name of. This is an optional parameter that\r
257 may be NULL. It will be NULL for device\r
258 drivers. It will also be NULL for a bus drivers\r
259 that wish to retrieve the name of the bus\r
260 controller. It will not be NULL for a bus\r
261 driver that wishes to retrieve the name of a\r
262 child controller.\r
263\r
264 @param Language[in] A pointer to a Null-terminated ASCII string\r
265 array indicating the language. This is the\r
266 language of the driver name that the caller is\r
267 requesting, and it must match one of the\r
268 languages specified in SupportedLanguages. The\r
269 number of languages supported by a driver is up\r
270 to the driver writer. Language is specified in\r
271 RFC 4646 or ISO 639-2 language code format.\r
272\r
273 @param ControllerName[out] A pointer to the Unicode string to return.\r
274 This Unicode string is the name of the\r
275 controller specified by ControllerHandle and\r
276 ChildHandle in the language specified by\r
277 Language from the point of view of the driver\r
278 specified by This.\r
279\r
280 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
281 the language specified by Language for the\r
282 driver specified by This was returned in\r
283 DriverName.\r
284\r
285 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
286\r
287 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
288 EFI_HANDLE.\r
289\r
290 @retval EFI_INVALID_PARAMETER Language is NULL.\r
291\r
292 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
293\r
294 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
295 managing the controller specified by\r
296 ControllerHandle and ChildHandle.\r
297\r
298 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
299 the language specified by Language.\r
300\r
301**/\r
302EFI_STATUS\r
303EFIAPI\r
304AtaAtapiPassThruComponentNameGetControllerName (\r
305 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
306 IN EFI_HANDLE ControllerHandle,\r
307 IN EFI_HANDLE ChildHandle OPTIONAL,\r
308 IN CHAR8 *Language,\r
309 OUT CHAR16 **ControllerName\r
310 );\r
311\r
312/**\r
313 Tests to see if this driver supports a given controller. If a child device is provided,\r
314 it further tests to see if this driver supports creating a handle for the specified child device.\r
315\r
316 This function checks to see if the driver specified by This supports the device specified by\r
317 ControllerHandle. Drivers will typically use the device path attached to\r
318 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
319 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
320 may be called many times during platform initialization. In order to reduce boot times, the tests\r
321 performed by this function must be very small, and take as little time as possible to execute. This\r
322 function must not change the state of any hardware devices, and this function must be aware that the\r
323 device specified by ControllerHandle may already be managed by the same driver or a\r
324 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
325 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
326 Because ControllerHandle may have been previously started by the same driver, if a protocol is\r
327 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
328 to guarantee the state of ControllerHandle is not modified by this function.\r
329\r
330 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
331 @param[in] ControllerHandle The handle of the controller to test. This handle\r
332 must support a protocol interface that supplies\r
333 an I/O abstraction to the driver.\r
334 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
335 parameter is ignored by device drivers, and is optional for bus\r
336 drivers. For bus drivers, if this parameter is not NULL, then\r
337 the bus driver must determine if the bus controller specified\r
338 by ControllerHandle and the child controller specified\r
339 by RemainingDevicePath are both supported by this\r
340 bus driver.\r
341\r
342 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
343 RemainingDevicePath is supported by the driver specified by This.\r
344 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
345 RemainingDevicePath is already being managed by the driver\r
346 specified by This.\r
347 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
348 RemainingDevicePath is already being managed by a different\r
349 driver or an application that requires exclusive access.\r
350 Currently not implemented.\r
351 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
352 RemainingDevicePath is not supported by the driver specified by This.\r
353**/\r
354EFI_STATUS\r
355EFIAPI\r
356AtaAtapiPassThruSupported (\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 Starts a device controller or a bus controller.\r
364\r
365 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
366 As a result, much of the error checking on the parameters to Start() has been moved into this\r
367 common boot service. It is legal to call Start() 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.\r
370 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
371 EFI_DEVICE_PATH_PROTOCOL.\r
372 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
373 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
374\r
375 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
376 @param[in] ControllerHandle The handle of the controller to start. This handle\r
377 must support a protocol interface that supplies\r
378 an I/O abstraction to the driver.\r
379 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
380 parameter is ignored by device drivers, and is optional for bus\r
381 drivers. For a bus driver, if this parameter is NULL, then handles\r
382 for all the children of Controller are created by this driver.\r
383 If this parameter is not NULL and the first Device Path Node is\r
384 not the End of Device Path Node, then only the handle for the\r
385 child device specified by the first Device Path Node of\r
386 RemainingDevicePath is created by this driver.\r
387 If the first Device Path Node of RemainingDevicePath is\r
388 the End of Device Path Node, no child handle is created by this\r
389 driver.\r
390\r
391 @retval EFI_SUCCESS The device was started.\r
392 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
393 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
394 @retval Others The driver failded to start the device.\r
395\r
396**/\r
397EFI_STATUS\r
398EFIAPI\r
399AtaAtapiPassThruStart (\r
400 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
401 IN EFI_HANDLE Controller,\r
402 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
403 );\r
404\r
405/**\r
406 Stops a device controller or a bus controller.\r
407\r
408 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
409 As a result, much of the error checking on the parameters to Stop() has been moved\r
410 into this common boot service. It is legal to call Stop() from other locations,\r
411 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
412 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
413 same driver's Start() function.\r
414 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
415 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
416 Start() function, and the Start() function must have called OpenProtocol() on\r
417 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
418\r
419 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
420 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
421 support a bus specific I/O protocol for the driver\r
422 to use to stop the device.\r
423 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
424 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
425 if NumberOfChildren is 0.\r
426\r
427 @retval EFI_SUCCESS The device was stopped.\r
428 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
429\r
430**/\r
431EFI_STATUS\r
432EFIAPI\r
433AtaAtapiPassThruStop (\r
434 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
435 IN EFI_HANDLE Controller,\r
436 IN UINTN NumberOfChildren,\r
437 IN EFI_HANDLE *ChildHandleBuffer\r
438 );\r
439\r
440/**\r
441 Traverse the attached ATA devices list to find out the device to access.\r
442\r
443 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
444 @param[in] Port The port number of the ATA device to send the command.\r
445 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
446 If there is no port multiplier, then specify 0xFFFF.\r
447 @param[in] DeviceType The device type of the ATA device.\r
448\r
449 @retval The pointer to the data structure of the device info to access.\r
450\r
451**/\r
452LIST_ENTRY *\r
453EFIAPI\r
454SearchDeviceInfoList (\r
455 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
456 IN UINT16 Port,\r
457 IN UINT16 PortMultiplier,\r
458 IN EFI_ATA_DEVICE_TYPE DeviceType\r
459 );\r
460\r
461/**\r
462 Allocate device info data structure to contain device info.\r
463 And insert the data structure to the tail of device list for tracing.\r
464\r
465 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
466 @param[in] Port The port number of the ATA device to send the command.\r
467 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
468 If there is no port multiplier, then specify 0xFFFF.\r
469 @param[in] DeviceType The device type of the ATA device.\r
470 @param[in] IdentifyData The data buffer to store the output of the IDENTIFY cmd.\r
471\r
472 @retval EFI_SUCCESS Successfully insert the ata device to the tail of device list.\r
473 @retval EFI_OUT_OF_RESOURCES Can not allocate enough resource for use.\r
474\r
475**/\r
476EFI_STATUS\r
477EFIAPI\r
478CreateNewDeviceInfo (\r
479 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
480 IN UINT16 Port,\r
481 IN UINT16 PortMultiplier,\r
482 IN EFI_ATA_DEVICE_TYPE DeviceType,\r
483 IN EFI_IDENTIFY_DATA *IdentifyData\r
484 );\r
485\r
486/**\r
487 Destroy all attached ATA devices info.\r
488\r
489 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
490\r
491**/\r
492VOID\r
493EFIAPI\r
494DestroyDeviceInfoList (\r
495 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
496 );\r
497\r
498/**\r
499 Destroy all pending non blocking tasks.\r
500\r
501 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
502 @param[in] IsSigEvent Indicate whether signal the task event when remove the\r
503 task.\r
504\r
505**/\r
506VOID\r
507EFIAPI\r
508DestroyAsynTaskList (\r
509 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
510 IN BOOLEAN IsSigEvent\r
511 );\r
512\r
513/**\r
514 Enumerate all attached ATA devices at IDE mode or AHCI mode separately.\r
515\r
516 The function is designed to enumerate all attached ATA devices.\r
517\r
518 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
519\r
520 @retval EFI_SUCCESS Successfully enumerate attached ATA devices.\r
521 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
522\r
523**/\r
524EFI_STATUS\r
525EFIAPI\r
526EnumerateAttachedDevice (\r
527 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
528 );\r
529\r
530/**\r
531 Call back funtion when the timer event is signaled.\r
532\r
533 @param[in] Event The Event this notify function registered to.\r
534 @param[in] Context Pointer to the context data registered to the\r
535 Event.\r
536\r
537**/\r
538VOID\r
539EFIAPI\r
540AsyncNonBlockingTransferRoutine (\r
541 EFI_EVENT Event,\r
542 VOID* Context\r
543 );\r
544\r
545/**\r
546 Sends an ATA command to an ATA device that is attached to the ATA controller. This function\r
547 supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,\r
548 and the non-blocking I/O functionality is optional.\r
549\r
550 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
551 @param[in] Port The port number of the ATA device to send the command.\r
552 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
553 If there is no port multiplier, then specify 0xFFFF.\r
554 @param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port\r
555 and PortMultiplierPort.\r
556 @param[in] Event If non-blocking I/O is not supported then Event is ignored, and blocking\r
557 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
558 Event is not NULL and non blocking I/O is supported, then non-blocking\r
559 I/O is performed, and Event will be signaled when the ATA command completes.\r
560\r
561 @retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,\r
562 InTransferLength bytes were transferred from InDataBuffer. For write and\r
563 bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.\r
564 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred\r
565 is returned in InTransferLength. For write and bi-directional commands,\r
566 OutTransferLength bytes were transferred by OutDataBuffer.\r
567 @retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands\r
568 already queued. The caller may retry again later.\r
569 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the ATA command.\r
570 @retval EFI_INVALID_PARAMETER Port, PortMultiplierPort, or the contents of Acb are invalid. The ATA\r
571 command was not sent, so no additional status information is available.\r
572\r
573**/\r
574EFI_STATUS\r
575EFIAPI\r
576AtaPassThruPassThru (\r
577 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
578 IN UINT16 Port,\r
579 IN UINT16 PortMultiplierPort,\r
580 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,\r
581 IN EFI_EVENT Event OPTIONAL\r
582 );\r
583\r
584/**\r
585 Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.\r
586 These can either be the list of ports where ATA devices are actually present or the\r
587 list of legal port numbers for the ATA controller. Regardless, the caller of this\r
588 function must probe the port number returned to see if an ATA device is actually\r
589 present at that location on the ATA controller.\r
590\r
591 The GetNextPort() function retrieves the port number on an ATA controller. If on input\r
592 Port is 0xFFFF, then the port number of the first port on the ATA controller is returned\r
593 in Port and EFI_SUCCESS is returned.\r
594\r
595 If Port is a port number that was returned on a previous call to GetNextPort(), then the\r
596 port number of the next port on the ATA controller is returned in Port, and EFI_SUCCESS\r
597 is returned. If Port is not 0xFFFF and Port was not returned on a previous call to\r
598 GetNextPort(), then EFI_INVALID_PARAMETER is returned.\r
599\r
600 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is\r
601 returned.\r
602\r
603 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
604 @param[in, out] Port On input, a pointer to the port number on the ATA controller.\r
605 On output, a pointer to the next port number on the ATA\r
606 controller. An input value of 0xFFFF retrieves the first port\r
607 number on the ATA controller.\r
608\r
609 @retval EFI_SUCCESS The next port number on the ATA controller was returned in Port.\r
610 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.\r
611 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned on a previous call\r
612 to GetNextPort().\r
613\r
614**/\r
615EFI_STATUS\r
616EFIAPI\r
617AtaPassThruGetNextPort (\r
618 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
619 IN OUT UINT16 *Port\r
620 );\r
621\r
622/**\r
623 Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA\r
624 controller. These can either be the list of port multiplier ports where ATA devices are actually\r
625 present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this\r
626 function must probe the port number and port multiplier port number returned to see if an ATA\r
627 device is actually present.\r
628\r
629 The GetNextDevice() function retrieves the port multiplier port number of an ATA device\r
630 present on a port of an ATA controller.\r
631\r
632 If PortMultiplierPort points to a port multiplier port number value that was returned on a\r
633 previous call to GetNextDevice(), then the port multiplier port number of the next ATA device\r
634 on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is\r
635 returned.\r
636\r
637 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first\r
638 ATA device on port of the ATA controller is returned in PortMultiplierPort and\r
639 EFI_SUCCESS is returned.\r
640\r
641 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort\r
642 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER\r
643 is returned.\r
644\r
645 If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of\r
646 the ATA controller, then EFI_NOT_FOUND is returned.\r
647\r
648 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
649 @param[in] Port The port number present on the ATA controller.\r
650 @param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an\r
651 ATA device present on the ATA controller.\r
652 If on input a PortMultiplierPort of 0xFFFF is specified,\r
653 then the port multiplier port number of the first ATA device\r
654 is returned. On output, a pointer to the port multiplier port\r
655 number of the next ATA device present on an ATA controller.\r
656\r
657 @retval EFI_SUCCESS The port multiplier port number of the next ATA device on the port\r
658 of the ATA controller was returned in PortMultiplierPort.\r
659 @retval EFI_NOT_FOUND There are no more ATA devices on this port of the ATA controller.\r
660 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort was not\r
661 returned on a previous call to GetNextDevice().\r
662\r
663**/\r
664EFI_STATUS\r
665EFIAPI\r
666AtaPassThruGetNextDevice (\r
667 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
668 IN UINT16 Port,\r
669 IN OUT UINT16 *PortMultiplierPort\r
670 );\r
671\r
672/**\r
673 Used to allocate and build a device path node for an ATA device on an ATA controller.\r
674\r
675 The BuildDevicePath() function allocates and builds a single device node for the ATA\r
676 device specified by Port and PortMultiplierPort. If the ATA device specified by Port and\r
677 PortMultiplierPort is not present on the ATA controller, then EFI_NOT_FOUND is returned.\r
678 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned. If there are not enough\r
679 resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.\r
680\r
681 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of\r
682 DevicePath are initialized to describe the ATA device specified by Port and PortMultiplierPort,\r
683 and EFI_SUCCESS is returned.\r
684\r
685 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
686 @param[in] Port Port specifies the port number of the ATA device for which a\r
687 device path node is to be allocated and built.\r
688 @param[in] PortMultiplierPort The port multiplier port number of the ATA device for which a\r
689 device path node is to be allocated and built. If there is no\r
690 port multiplier, then specify 0xFFFF.\r
691 @param[in, out] DevicePath A pointer to a single device path node that describes the ATA\r
692 device specified by Port and PortMultiplierPort. This function\r
693 is responsible for allocating the buffer DevicePath with the\r
694 boot service AllocatePool(). It is the caller's responsibility\r
695 to free DevicePath when the caller is finished with DevicePath.\r
696 @retval EFI_SUCCESS The device path node that describes the ATA device specified by\r
697 Port and PortMultiplierPort was allocated and returned in DevicePath.\r
698 @retval EFI_NOT_FOUND The ATA device specified by Port and PortMultiplierPort does not\r
699 exist on the ATA controller.\r
700 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
701 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
702\r
703**/\r
704EFI_STATUS\r
705EFIAPI\r
706AtaPassThruBuildDevicePath (\r
707 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
708 IN UINT16 Port,\r
709 IN UINT16 PortMultiplierPort,\r
710 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
711 );\r
712\r
713/**\r
714 Used to translate a device path node to a port number and port multiplier port number.\r
715\r
716 The GetDevice() function determines the port and port multiplier port number associated with\r
717 the ATA device described by DevicePath. If DevicePath is a device path node type that the\r
718 ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents\r
719 DevicePath into a port number and port multiplier port number.\r
720\r
721 If this translation is successful, then that port number and port multiplier port number are returned\r
722 in Port and PortMultiplierPort, and EFI_SUCCESS is returned.\r
723\r
724 If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.\r
725\r
726 If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then\r
727 EFI_UNSUPPORTED is returned.\r
728\r
729 If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not\r
730 a valid translation from DevicePath to a port number and port multiplier port number, then\r
731 EFI_NOT_FOUND is returned.\r
732\r
733 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
734 @param[in] DevicePath A pointer to the device path node that describes an ATA device on the\r
735 ATA controller.\r
736 @param[out] Port On return, points to the port number of an ATA device on the ATA controller.\r
737 @param[out] PortMultiplierPort On return, points to the port multiplier port number of an ATA device\r
738 on the ATA controller.\r
739\r
740 @retval EFI_SUCCESS DevicePath was successfully translated to a port number and port multiplier\r
741 port number, and they were returned in Port and PortMultiplierPort.\r
742 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
743 @retval EFI_INVALID_PARAMETER Port is NULL.\r
744 @retval EFI_INVALID_PARAMETER PortMultiplierPort is NULL.\r
745 @retval EFI_UNSUPPORTED This driver does not support the device path node type in DevicePath.\r
746 @retval EFI_NOT_FOUND A valid translation from DevicePath to a port number and port multiplier\r
747 port number does not exist.\r
748\r
749**/\r
750EFI_STATUS\r
751EFIAPI\r
752AtaPassThruGetDevice (\r
753 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
754 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
755 OUT UINT16 *Port,\r
756 OUT UINT16 *PortMultiplierPort\r
757 );\r
758\r
759/**\r
760 Resets a specific port on the ATA controller. This operation also resets all the ATA devices\r
761 connected to the port.\r
762\r
763 The ResetChannel() function resets an a specific port on an ATA controller. This operation\r
764 resets all the ATA devices connected to that port. If this ATA controller does not support\r
765 a reset port operation, then EFI_UNSUPPORTED is returned.\r
766\r
767 If a device error occurs while executing that port reset operation, then EFI_DEVICE_ERROR is\r
768 returned.\r
769\r
770 If a timeout occurs during the execution of the port reset operation, then EFI_TIMEOUT is returned.\r
771\r
772 If the port reset operation is completed, then EFI_SUCCESS is returned.\r
773\r
774 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
775 @param[in] Port The port number on the ATA controller.\r
776\r
777 @retval EFI_SUCCESS The ATA controller port was reset.\r
778 @retval EFI_UNSUPPORTED The ATA controller does not support a port reset operation.\r
779 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the ATA port.\r
780 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the ATA port.\r
781\r
782**/\r
783EFI_STATUS\r
784EFIAPI\r
785AtaPassThruResetPort (\r
786 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
787 IN UINT16 Port\r
788 );\r
789\r
790/**\r
791 Resets an ATA device that is connected to an ATA controller.\r
792\r
793 The ResetDevice() function resets the ATA device specified by Port and PortMultiplierPort.\r
794 If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is\r
795 returned.\r
796\r
797 If Port or PortMultiplierPort are not in a valid range for this ATA controller, then\r
798 EFI_INVALID_PARAMETER is returned.\r
799\r
800 If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR\r
801 is returned.\r
802\r
803 If a timeout occurs during the execution of the device reset operation, then EFI_TIMEOUT is\r
804 returned.\r
805\r
806 If the device reset operation is completed, then EFI_SUCCESS is returned.\r
807\r
808 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
809 @param[in] Port Port represents the port number of the ATA device to be reset.\r
810 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to reset.\r
811 If there is no port multiplier, then specify 0xFFFF.\r
812 @retval EFI_SUCCESS The ATA device specified by Port and PortMultiplierPort was reset.\r
813 @retval EFI_UNSUPPORTED The ATA controller does not support a device reset operation.\r
814 @retval EFI_INVALID_PARAMETER Port or PortMultiplierPort are invalid.\r
815 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the ATA device\r
816 specified by Port and PortMultiplierPort.\r
817 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the ATA device\r
818 specified by Port and PortMultiplierPort.\r
819\r
820**/\r
821EFI_STATUS\r
822EFIAPI\r
823AtaPassThruResetDevice (\r
824 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
825 IN UINT16 Port,\r
826 IN UINT16 PortMultiplierPort\r
827 );\r
828\r
829/**\r
830 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function\r
831 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
832 nonblocking I/O functionality is optional.\r
833\r
834 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
835 @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r
836 the id of the SCSI device to send the SCSI Request Packet. Each\r
837 transport driver may choose to utilize a subset of this size to suit the needs\r
838 of transport target representation. For example, a Fibre Channel driver\r
839 may use only 8 bytes (WWN) to represent an FC target.\r
840 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
841 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
842 specified by Target and Lun.\r
843 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
844 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
845 Event is not NULL and non blocking I/O is supported, then\r
846 nonblocking I/O is performed, and Event will be signaled when the\r
847 SCSI Request Packet completes.\r
848\r
849 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
850 commands, InTransferLength bytes were transferred from\r
851 InDataBuffer. For write and bi-directional commands,\r
852 OutTransferLength bytes were transferred by\r
853 OutDataBuffer.\r
854 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
855 could be transferred is returned in InTransferLength. For write\r
856 and bi-directional commands, OutTransferLength bytes were\r
857 transferred by OutDataBuffer.\r
858 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
859 SCSI Request Packets already queued. The caller may retry again later.\r
860 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
861 Packet.\r
862 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
863 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
864 by the host adapter. This includes the case of Bi-directional SCSI\r
865 commands not supported by the implementation. The SCSI Request\r
866 Packet was not sent, so no additional status information is available.\r
867 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
868\r
869**/\r
870EFI_STATUS\r
871EFIAPI\r
872ExtScsiPassThruPassThru (\r
873 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
874 IN UINT8 *Target,\r
875 IN UINT64 Lun,\r
876 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
877 IN EFI_EVENT Event OPTIONAL\r
878 );\r
879\r
880/**\r
881 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These\r
882 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
883 Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the\r
884 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI\r
885 channel.\r
886\r
887 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
888 @param Target On input, a pointer to the Target ID (an array of size\r
889 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
890 On output, a pointer to the Target ID (an array of\r
891 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
892 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
893 Target array retrieves the Target ID of the first SCSI device present on a\r
894 SCSI channel.\r
895 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
896 channel. On output, a pointer to the LUN of the next SCSI device present\r
897 on a SCSI channel.\r
898\r
899 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
900 channel was returned in Target and Lun.\r
901 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
902 not returned on a previous call to GetNextTargetLun().\r
903 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
904\r
905**/\r
906EFI_STATUS\r
907EFIAPI\r
908ExtScsiPassThruGetNextTargetLun (\r
909 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
910 IN OUT UINT8 **Target,\r
911 IN OUT UINT64 *Lun\r
912 );\r
913\r
914/**\r
915 Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
916\r
917 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
918 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
919 Target ID of the SCSI device for which a device path node is to be\r
920 allocated and built. Transport drivers may chose to utilize a subset of\r
921 this size to suit the representation of targets. For example, a Fibre\r
922 Channel driver may use only 8 bytes (WWN) in the array to represent a\r
923 FC target.\r
924 @param Lun The LUN of the SCSI device for which a device path node is to be\r
925 allocated and built.\r
926 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
927 specified by Target and Lun. This function is responsible for\r
928 allocating the buffer DevicePath with the boot service\r
929 AllocatePool(). It is the caller's responsibility to free\r
930 DevicePath when the caller is finished with DevicePath.\r
931\r
932 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
933 Target and Lun was allocated and returned in\r
934 DevicePath.\r
935 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
936 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
937 on the SCSI channel.\r
938 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
939\r
940**/\r
941EFI_STATUS\r
942EFIAPI\r
943ExtScsiPassThruBuildDevicePath (\r
944 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
945 IN UINT8 *Target,\r
946 IN UINT64 Lun,\r
947 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
948 );\r
949\r
950/**\r
951 Used to translate a device path node to a Target ID and LUN.\r
952\r
953 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
954 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
955 on the SCSI channel.\r
956 @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
957 on the SCSI channel.\r
958 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
959\r
960 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
961 LUN, and they were returned in Target and Lun.\r
962 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
963 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
964 does not exist.\r
965 @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
966 DevicePath.\r
967\r
968**/\r
969EFI_STATUS\r
970EFIAPI\r
971ExtScsiPassThruGetTargetLun (\r
972 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
973 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
974 OUT UINT8 **Target,\r
975 OUT UINT64 *Lun\r
976 );\r
977\r
978/**\r
979 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
980\r
981 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
982\r
983 @retval EFI_SUCCESS The SCSI channel was reset.\r
984 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
985 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
986 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
987\r
988**/\r
989EFI_STATUS\r
990EFIAPI\r
991ExtScsiPassThruResetChannel (\r
992 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
993 );\r
994\r
995/**\r
996 Resets a SCSI logical unit that is connected to a SCSI channel.\r
997\r
998 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
999 @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
1000 target port ID of the SCSI device containing the SCSI logical unit to\r
1001 reset. Transport drivers may chose to utilize a subset of this array to suit\r
1002 the representation of their targets.\r
1003 @param Lun The LUN of the SCSI device to reset.\r
1004\r
1005 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
1006 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
1007 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
1008 specified by Target and Lun.\r
1009 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
1010 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
1011 specified by Target and Lun.\r
1012\r
1013**/\r
1014EFI_STATUS\r
1015EFIAPI\r
1016ExtScsiPassThruResetTargetLun (\r
1017 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
1018 IN UINT8 *Target,\r
1019 IN UINT64 Lun\r
1020 );\r
1021\r
1022/**\r
1023 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either\r
1024 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
1025 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to\r
1026 see if a SCSI device is actually present at that location on the SCSI channel.\r
1027\r
1028 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
1029 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
1030 On output, a pointer to the Target ID (an array of\r
1031 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
1032 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
1033 Target array retrieves the Target ID of the first SCSI device present on a\r
1034 SCSI channel.\r
1035\r
1036 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
1037 channel was returned in Target.\r
1038 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
1039 @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not\r
1040 returned on a previous call to GetNextTarget().\r
1041 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
1042\r
1043**/\r
1044EFI_STATUS\r
1045EFIAPI\r
1046ExtScsiPassThruGetNextTarget (\r
1047 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
1048 IN OUT UINT8 **Target\r
1049 );\r
1050\r
1051/**\r
1052 Initialize ATA host controller at IDE mode.\r
1053\r
1054 The function is designed to initialize ATA host controller.\r
1055\r
1056 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
1057\r
1058**/\r
1059EFI_STATUS\r
1060EFIAPI\r
1061IdeModeInitialization (\r
1062 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
1063 );\r
1064\r
1065/**\r
1066 Initialize ATA host controller at AHCI mode.\r
1067\r
1068 The function is designed to initialize ATA host controller.\r
1069\r
1070 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
1071\r
1072**/\r
1073EFI_STATUS\r
1074EFIAPI\r
1075AhciModeInitialization (\r
1076 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
1077 );\r
1078\r
1079/**\r
1080 Start a non data transfer on specific port.\r
1081\r
1082 @param[in] PciIo The PCI IO protocol instance.\r
1083 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1084 @param[in] Port The number of port.\r
1085 @param[in] PortMultiplier The timeout value of stop.\r
1086 @param[in] AtapiCommand The atapi command will be used for the\r
1087 transfer.\r
1088 @param[in] AtapiCommandLength The length of the atapi command.\r
1089 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1090 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1091 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1092 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1093 used by non-blocking mode.\r
1094\r
1095 @retval EFI_DEVICE_ERROR The non data transfer abort with error occurs.\r
1096 @retval EFI_TIMEOUT The operation is time out.\r
1097 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1098 @retval EFI_SUCCESS The non data transfer executes successfully.\r
1099\r
1100**/\r
1101EFI_STATUS\r
1102EFIAPI\r
1103AhciNonDataTransfer (\r
1104 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1105 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1106 IN UINT8 Port,\r
1107 IN UINT8 PortMultiplier,\r
1108 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1109 IN UINT8 AtapiCommandLength,\r
1110 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1111 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1112 IN UINT64 Timeout,\r
1113 IN ATA_NONBLOCK_TASK *Task\r
1114 );\r
1115\r
1116/**\r
1117 Start a DMA data transfer on specific port\r
1118\r
1119 @param[in] Instance The ATA_ATAPI_PASS_THRU_INSTANCE protocol instance.\r
1120 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1121 @param[in] Port The number of port.\r
1122 @param[in] PortMultiplier The timeout value of stop.\r
1123 @param[in] AtapiCommand The atapi command will be used for the\r
1124 transfer.\r
1125 @param[in] AtapiCommandLength The length of the atapi command.\r
1126 @param[in] Read The transfer direction.\r
1127 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1128 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1129 @param[in, out] MemoryAddr The pointer to the data buffer.\r
1130 @param[in] DataCount The data count to be transferred.\r
1131 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1132 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1133 used by non-blocking mode.\r
1134\r
1135 @retval EFI_DEVICE_ERROR The DMA data transfer abort with error occurs.\r
1136 @retval EFI_TIMEOUT The operation is time out.\r
1137 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1138 @retval EFI_SUCCESS The DMA data transfer executes successfully.\r
1139\r
1140**/\r
1141EFI_STATUS\r
1142EFIAPI\r
1143AhciDmaTransfer (\r
1144 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
1145 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1146 IN UINT8 Port,\r
1147 IN UINT8 PortMultiplier,\r
1148 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1149 IN UINT8 AtapiCommandLength,\r
1150 IN BOOLEAN Read,\r
1151 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1152 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1153 IN OUT VOID *MemoryAddr,\r
1154 IN UINT32 DataCount,\r
1155 IN UINT64 Timeout,\r
1156 IN ATA_NONBLOCK_TASK *Task\r
1157 );\r
1158\r
1159/**\r
1160 Start a PIO data transfer on specific port.\r
1161\r
1162 @param[in] PciIo The PCI IO protocol instance.\r
1163 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1164 @param[in] Port The number of port.\r
1165 @param[in] PortMultiplier The timeout value of stop.\r
1166 @param[in] AtapiCommand The atapi command will be used for the\r
1167 transfer.\r
1168 @param[in] AtapiCommandLength The length of the atapi command.\r
1169 @param[in] Read The transfer direction.\r
1170 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1171 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1172 @param[in, out] MemoryAddr The pointer to the data buffer.\r
1173 @param[in] DataCount The data count to be transferred.\r
1174 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1175 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1176 used by non-blocking mode.\r
1177\r
1178 @retval EFI_DEVICE_ERROR The PIO data transfer abort with error occurs.\r
1179 @retval EFI_TIMEOUT The operation is time out.\r
1180 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1181 @retval EFI_SUCCESS The PIO data transfer executes successfully.\r
1182\r
1183**/\r
1184EFI_STATUS\r
1185EFIAPI\r
1186AhciPioTransfer (\r
1187 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1188 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1189 IN UINT8 Port,\r
1190 IN UINT8 PortMultiplier,\r
1191 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1192 IN UINT8 AtapiCommandLength,\r
1193 IN BOOLEAN Read,\r
1194 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1195 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1196 IN OUT VOID *MemoryAddr,\r
1197 IN UINT32 DataCount,\r
1198 IN UINT64 Timeout,\r
1199 IN ATA_NONBLOCK_TASK *Task\r
1200 );\r
1201\r
1202/**\r
1203 Send ATA command into device with NON_DATA protocol\r
1204\r
1205 @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE\r
1206 data structure.\r
1207 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1208 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data\r
1209 structure.\r
1210 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1211 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1212 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1213 used by non-blocking mode.\r
1214\r
1215 @retval EFI_SUCCESS Reading succeed\r
1216 @retval EFI_ABORTED Command failed\r
1217 @retval EFI_DEVICE_ERROR Device status error.\r
1218\r
1219**/\r
1220EFI_STATUS\r
1221EFIAPI\r
1222AtaNonDataCommandIn (\r
1223 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1224 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1225 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1226 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1227 IN UINT64 Timeout,\r
1228 IN ATA_NONBLOCK_TASK *Task\r
1229 );\r
1230\r
1231/**\r
1232 Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt).\r
1233\r
1234 @param[in] Instance A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data\r
1235 structure.\r
1236 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1237 @param[in] Read Flag used to determine the data transfer\r
1238 direction. Read equals 1, means data transferred\r
1239 from device to host;Read equals 0, means data\r
1240 transferred from host to device.\r
1241 @param[in] DataBuffer A pointer to the source buffer for the data.\r
1242 @param[in] DataLength The length of the data.\r
1243 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure.\r
1244 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1245 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1246 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1247 used by non-blocking mode.\r
1248\r
1249 @retval EFI_SUCCESS the operation is successful.\r
1250 @retval EFI_OUT_OF_RESOURCES Build PRD table failed\r
1251 @retval EFI_UNSUPPORTED Unknown channel or operations command\r
1252 @retval EFI_DEVICE_ERROR Ata command execute failed\r
1253\r
1254**/\r
1255EFI_STATUS\r
1256EFIAPI\r
1257AtaUdmaInOut (\r
1258 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
1259 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1260 IN BOOLEAN Read,\r
1261 IN VOID *DataBuffer,\r
1262 IN UINT64 DataLength,\r
1263 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1264 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1265 IN UINT64 Timeout,\r
1266 IN ATA_NONBLOCK_TASK *Task\r
1267 );\r
1268\r
1269/**\r
1270 This function is used to send out ATA commands conforms to the PIO Data In Protocol.\r
1271\r
1272 @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data\r
1273 structure.\r
1274 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1275 @param[in, out] Buffer A pointer to the source buffer for the data.\r
1276 @param[in] ByteCount The length of the data.\r
1277 @param[in] Read Flag used to determine the data transfer direction.\r
1278 Read equals 1, means data transferred from device\r
1279 to host;Read equals 0, means data transferred\r
1280 from host to device.\r
1281 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure.\r
1282 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1283 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1284 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1285 used by non-blocking mode.\r
1286\r
1287 @retval EFI_SUCCESS send out the ATA command and device send required data successfully.\r
1288 @retval EFI_DEVICE_ERROR command sent failed.\r
1289\r
1290**/\r
1291EFI_STATUS\r
1292EFIAPI\r
1293AtaPioDataInOut (\r
1294 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1295 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1296 IN OUT VOID *Buffer,\r
1297 IN UINT64 ByteCount,\r
1298 IN BOOLEAN Read,\r
1299 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1300 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1301 IN UINT64 Timeout,\r
1302 IN ATA_NONBLOCK_TASK *Task\r
1303 );\r
1304\r
1305#endif\r
1306\r