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