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