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