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