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