X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FBus%2FAta%2FAtaAtapiPassThru%2FAtaAtapiPassThru.h;h=8d6eac706c0b7a4294d19b1a80e806ef0f07732e;hb=0641808ece210dd2855a69302a0876af7bdc44a2;hp=69e6dc0ebf6f144651b4502972bfe9f6bec0639c;hpb=a41b5272cdffba5fd9c4734d4c06c8682186d822;p=mirror_edk2.git diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h index 69e6dc0ebf..8d6eac706c 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h @@ -1,14 +1,14 @@ /** @file Header file for ATA/ATAPI PASS THRU driver. - - Copyright (c) 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __ATA_ATAPI_PASS_THRU_H__ @@ -47,6 +47,9 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2; #define ATA_ATAPI_PASS_THRU_SIGNATURE SIGNATURE_32 ('a', 'a', 'p', 't') #define ATA_ATAPI_DEVICE_SIGNATURE SIGNATURE_32 ('a', 'd', 'e', 'v') +#define ATA_NONBLOCKING_TASK_SIGNATURE SIGNATURE_32 ('a', 't', 's', 'k') + +typedef struct _ATA_NONBLOCK_TASK ATA_NONBLOCK_TASK; typedef enum { EfiAtaIdeMode, @@ -92,28 +95,60 @@ typedef struct { EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel]; EFI_AHCI_REGISTERS AhciRegisters; - + // // The attached device list // LIST_ENTRY DeviceList; + UINT64 EnabledPciAttributes; UINT64 OriginalPciAttributes; - + // - // For AtaPassThru protocol, using the following bytes to record the previous call in + // For AtaPassThru protocol, using the following bytes to record the previous call in // GetNextPort()/GetNextDevice(). // UINT16 PreviousPort; UINT16 PreviousPortMultiplier; // - // For ExtScsiPassThru protocol, using the following bytes to record the previous call in + // For ExtScsiPassThru protocol, using the following bytes to record the previous call in // GetNextTarget()/GetNextTargetLun(). // UINT16 PreviousTargetId; UINT64 PreviousLun; + // + // For Non-blocking. + // + EFI_EVENT TimerEvent; + LIST_ENTRY NonBlockingTaskList; + + // + // For disabling the device (especially Bus Master DMA) at + // ExitBootServices(). + // + EFI_EVENT ExitBootEvent; } ATA_ATAPI_PASS_THRU_INSTANCE; +// +// Task for Non-blocking mode. +// +struct _ATA_NONBLOCK_TASK { + UINT32 Signature; + LIST_ENTRY Link; + + UINT16 Port; + UINT16 PortMultiplier; + EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet; + BOOLEAN IsStart; + EFI_EVENT Event; + UINT64 RetryTimes; + BOOLEAN InfiniteWait; + VOID *Map; // Pointer to map. + VOID *TableMap; // Pointer to PRD table map. + EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map. + UINTN PageCount; // The page numbers used by PCIO freebuffer. +}; + // // Timeout value which uses 100ns as a unit. // It means 3 second span. @@ -142,6 +177,14 @@ typedef struct { Link, \ ATA_ATAPI_DEVICE_SIGNATURE \ ); + +#define ATA_NON_BLOCK_TASK_FROM_ENTRY(a) \ + CR (a, \ + ATA_NONBLOCK_TASK, \ + Link, \ + ATA_NONBLOCKING_TASK_SIGNATURE \ + ); + /** Retrieves a Unicode string that is the user readable name of the driver. @@ -240,7 +283,7 @@ AtaAtapiPassThruComponentNameGetDriverName ( driver specified by This was returned in DriverName. - @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. @@ -268,33 +311,33 @@ AtaAtapiPassThruComponentNameGetControllerName ( ); /** - Tests to see if this driver supports a given controller. If a child device is provided, + Tests to see if this driver supports a given controller. If a child device is provided, it further tests to see if this driver supports creating a handle for the specified child device. - This function checks to see if the driver specified by This supports the device specified by - ControllerHandle. Drivers will typically use the device path attached to - ControllerHandle and/or the services from the bus I/O abstraction attached to - ControllerHandle to determine if the driver supports ControllerHandle. This function - may be called many times during platform initialization. In order to reduce boot times, the tests - performed by this function must be very small, and take as little time as possible to execute. This - function must not change the state of any hardware devices, and this function must be aware that the - device specified by ControllerHandle may already be managed by the same driver or a - different driver. This function must match its calls to AllocatePages() with FreePages(), - AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). - Because ControllerHandle may have been previously started by the same driver, if a protocol is - already in the opened state, then it must not be closed with CloseProtocol(). This is required + This function checks to see if the driver specified by This supports the device specified by + ControllerHandle. Drivers will typically use the device path attached to + ControllerHandle and/or the services from the bus I/O abstraction attached to + ControllerHandle to determine if the driver supports ControllerHandle. This function + may be called many times during platform initialization. In order to reduce boot times, the tests + performed by this function must be very small, and take as little time as possible to execute. This + function must not change the state of any hardware devices, and this function must be aware that the + device specified by ControllerHandle may already be managed by the same driver or a + different driver. This function must match its calls to AllocatePages() with FreePages(), + AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). + Because ControllerHandle may have been previously started by the same driver, if a protocol is + already in the opened state, then it must not be closed with CloseProtocol(). This is required to guarantee the state of ControllerHandle is not modified by this function. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. - @param[in] ControllerHandle The handle of the controller to test. This handle - must support a protocol interface that supplies + @param[in] ControllerHandle The handle of the controller to test. This handle + must support a protocol interface that supplies an I/O abstraction to the driver. - @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This - parameter is ignored by device drivers, and is optional for bus - drivers. For bus drivers, if this parameter is not NULL, then - the bus driver must determine if the bus controller specified - by ControllerHandle and the child controller specified - by RemainingDevicePath are both supported by this + @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This + parameter is ignored by device drivers, and is optional for bus + drivers. For bus drivers, if this parameter is not NULL, then + the bus driver must determine if the bus controller specified + by ControllerHandle and the child controller specified + by RemainingDevicePath are both supported by this bus driver. @retval EFI_SUCCESS The device specified by ControllerHandle and @@ -321,28 +364,28 @@ AtaAtapiPassThruSupported ( Starts a device controller or a bus controller. The Start() function is designed to be invoked from the EFI boot service ConnectController(). - As a result, much of the error checking on the parameters to Start() has been moved into this - common boot service. It is legal to call Start() from other locations, + As a result, much of the error checking on the parameters to Start() has been moved into this + common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed, or the system behavior will not be deterministic. 1. ControllerHandle must be a valid EFI_HANDLE. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned EFI_DEVICE_PATH_PROTOCOL. 3. Prior to calling Start(), the Supported() function for the driver specified by This must - have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. + have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. - @param[in] ControllerHandle The handle of the controller to start. This handle - must support a protocol interface that supplies + @param[in] ControllerHandle The handle of the controller to start. This handle + must support a protocol interface that supplies an I/O abstraction to the driver. - @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This - parameter is ignored by device drivers, and is optional for bus - drivers. For a bus driver, if this parameter is NULL, then handles - for all the children of Controller are created by this driver. - If this parameter is not NULL and the first Device Path Node is - not the End of Device Path Node, then only the handle for the - child device specified by the first Device Path Node of + @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This + parameter is ignored by device drivers, and is optional for bus + drivers. For a bus driver, if this parameter is NULL, then handles + for all the children of Controller are created by this driver. + If this parameter is not NULL and the first Device Path Node is + not the End of Device Path Node, then only the handle for the + child device specified by the first Device Path Node of RemainingDevicePath is created by this driver. - If the first Device Path Node of RemainingDevicePath is + If the first Device Path Node of RemainingDevicePath is the End of Device Path Node, no child handle is created by this driver. @@ -362,10 +405,10 @@ AtaAtapiPassThruStart ( /** Stops a device controller or a bus controller. - - The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). - As a result, much of the error checking on the parameters to Stop() has been moved - into this common boot service. It is legal to call Stop() from other locations, + + The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). + As a result, much of the error checking on the parameters to Stop() has been moved + into this common boot service. It is legal to call Stop() from other locations, but the following calling restrictions must be followed, or the system behavior will not be deterministic. 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this same driver's Start() function. @@ -373,13 +416,13 @@ AtaAtapiPassThruStart ( EFI_HANDLE. In addition, all of these handles must have been created in this driver's Start() function, and the Start() function must have called OpenProtocol() on ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. - + @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. - @param[in] ControllerHandle A handle to the device being stopped. The handle must - support a bus specific I/O protocol for the driver + @param[in] ControllerHandle A handle to the device being stopped. The handle must + support a bus specific I/O protocol for the driver to use to stop the device. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer. - @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL + @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL if NumberOfChildren is 0. @retval EFI_SUCCESS The device was stopped. @@ -397,13 +440,13 @@ AtaAtapiPassThruStop ( /** Traverse the attached ATA devices list to find out the device to access. - + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. - @param[in] Port The port number of the ATA device to send the command. + @param[in] Port The port number of the ATA device to send the command. @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command. - If there is no port multiplier, then specify 0. + If there is no port multiplier, then specify 0xFFFF. @param[in] DeviceType The device type of the ATA device. - + @retval The pointer to the data structure of the device info to access. **/ @@ -419,11 +462,11 @@ SearchDeviceInfoList ( /** Allocate device info data structure to contain device info. And insert the data structure to the tail of device list for tracing. - + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. - @param[in] Port The port number of the ATA device to send the command. + @param[in] Port The port number of the ATA device to send the command. @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command. - If there is no port multiplier, then specify 0. + If there is no port multiplier, then specify 0xFFFF. @param[in] DeviceType The device type of the ATA device. @param[in] IdentifyData The data buffer to store the output of the IDENTIFY cmd. @@ -443,7 +486,7 @@ CreateNewDeviceInfo ( /** Destroy all attached ATA devices info. - + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. **/ @@ -453,11 +496,26 @@ DestroyDeviceInfoList ( IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance ); +/** + Destroy all pending non blocking tasks. + + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. + @param[in] IsSigEvent Indicate whether signal the task event when remove the + task. + +**/ +VOID +EFIAPI +DestroyAsynTaskList ( + IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, + IN BOOLEAN IsSigEvent + ); + /** Enumerate all attached ATA devices at IDE mode or AHCI mode separately. - - The function is designed to enumerate all attached ATA devices. - + + The function is designed to enumerate all attached ATA devices. + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. @retval EFI_SUCCESS Successfully enumerate attached ATA devices. @@ -470,15 +528,30 @@ EnumerateAttachedDevice ( IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance ); +/** + Call back funtion when the timer event is signaled. + + @param[in] Event The Event this notify function registered to. + @param[in] Context Pointer to the context data registered to the + Event. + +**/ +VOID +EFIAPI +AsyncNonBlockingTransferRoutine ( + EFI_EVENT Event, + VOID* Context + ); + /** Sends an ATA command to an ATA device that is attached to the ATA controller. This function supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required, and the non-blocking I/O functionality is optional. - @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. - @param[in] Port The port number of the ATA device to send the command. + @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. + @param[in] Port The port number of the ATA device to send the command. @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command. - If there is no port multiplier, then specify 0. + If there is no port multiplier, then specify 0xFFFF. @param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port and PortMultiplierPort. @param[in] Event If non-blocking I/O is not supported then Event is ignored, and blocking @@ -486,11 +559,11 @@ EnumerateAttachedDevice ( Event is not NULL and non blocking I/O is supported, then non-blocking I/O is performed, and Event will be signaled when the ATA command completes. - @retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands, + @retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands, InTransferLength bytes were transferred from InDataBuffer. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer. @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred - is returned in InTransferLength. For write and bi-directional commands, + is returned in InTransferLength. For write and bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer. @retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands already queued. The caller may retry again later. @@ -500,6 +573,7 @@ EnumerateAttachedDevice ( **/ EFI_STATUS +EFIAPI AtaPassThruPassThru ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, @@ -527,7 +601,7 @@ AtaPassThruPassThru ( If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is returned. - @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. + @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. @param[in, out] Port On input, a pointer to the port number on the ATA controller. On output, a pointer to the next port number on the ATA controller. An input value of 0xFFFF retrieves the first port @@ -540,42 +614,43 @@ AtaPassThruPassThru ( **/ EFI_STATUS +EFIAPI AtaPassThruGetNextPort ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN OUT UINT16 *Port ); /** - Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA - controller. These can either be the list of port multiplier ports where ATA devices are actually - present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this - function must probe the port number and port multiplier port number returned to see if an ATA + Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA + controller. These can either be the list of port multiplier ports where ATA devices are actually + present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this + function must probe the port number and port multiplier port number returned to see if an ATA device is actually present. - The GetNextDevice() function retrieves the port multiplier port number of an ATA device + The GetNextDevice() function retrieves the port multiplier port number of an ATA device present on a port of an ATA controller. - - If PortMultiplierPort points to a port multiplier port number value that was returned on a + + If PortMultiplierPort points to a port multiplier port number value that was returned on a previous call to GetNextDevice(), then the port multiplier port number of the next ATA device on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is returned. - - If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first - ATA device on port of the ATA controller is returned in PortMultiplierPort and + + If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first + ATA device on port of the ATA controller is returned in PortMultiplierPort and EFI_SUCCESS is returned. - + If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER is returned. - - If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of + + If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of the ATA controller, then EFI_NOT_FOUND is returned. @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. @param[in] Port The port number present on the ATA controller. @param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an - ATA device present on the ATA controller. - If on input a PortMultiplierPort of 0xFFFF is specified, + ATA device present on the ATA controller. + If on input a PortMultiplierPort of 0xFFFF is specified, then the port multiplier port number of the first ATA device is returned. On output, a pointer to the port multiplier port number of the next ATA device present on an ATA controller. @@ -588,6 +663,7 @@ AtaPassThruGetNextPort ( **/ EFI_STATUS +EFIAPI AtaPassThruGetNextDevice ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, @@ -612,7 +688,7 @@ AtaPassThruGetNextDevice ( device path node is to be allocated and built. @param[in] PortMultiplierPort The port multiplier port number of the ATA device for which a device path node is to be allocated and built. If there is no - port multiplier, then specify 0. + port multiplier, then specify 0xFFFF. @param[in, out] DevicePath A pointer to a single device path node that describes the ATA device specified by Port and PortMultiplierPort. This function is responsible for allocating the buffer DevicePath with the @@ -627,6 +703,7 @@ AtaPassThruGetNextDevice ( **/ EFI_STATUS +EFIAPI AtaPassThruBuildDevicePath ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, @@ -639,7 +716,7 @@ AtaPassThruBuildDevicePath ( The GetDevice() function determines the port and port multiplier port number associated with the ATA device described by DevicePath. If DevicePath is a device path node type that the - ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents + ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents DevicePath into a port number and port multiplier port number. If this translation is successful, then that port number and port multiplier port number are returned @@ -647,11 +724,11 @@ AtaPassThruBuildDevicePath ( If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned. - If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then + If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then EFI_UNSUPPORTED is returned. - If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not - a valid translation from DevicePath to a port number and port multiplier port number, then + If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not + a valid translation from DevicePath to a port number and port multiplier port number, then EFI_NOT_FOUND is returned. @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. @@ -669,8 +746,10 @@ AtaPassThruBuildDevicePath ( @retval EFI_UNSUPPORTED This driver does not support the device path node type in DevicePath. @retval EFI_NOT_FOUND A valid translation from DevicePath to a port number and port multiplier port number does not exist. + **/ EFI_STATUS +EFIAPI AtaPassThruGetDevice ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, @@ -703,6 +782,7 @@ AtaPassThruGetDevice ( **/ EFI_STATUS +EFIAPI AtaPassThruResetPort ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port @@ -715,7 +795,7 @@ AtaPassThruResetPort ( If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is returned. - If Port or PortMultiplierPort are not in a valid range for this ATA controller, then + If Port or PortMultiplierPort are not in a valid range for this ATA controller, then EFI_INVALID_PARAMETER is returned. If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR @@ -729,7 +809,7 @@ AtaPassThruResetPort ( @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. @param[in] Port Port represents the port number of the ATA device to be reset. @param[in] PortMultiplierPort The port multiplier port number of the ATA device to reset. - If there is no port multiplier, then specify 0. + If there is no port multiplier, then specify 0xFFFF. @retval EFI_SUCCESS The ATA device specified by Port and PortMultiplierPort was reset. @retval EFI_UNSUPPORTED The ATA controller does not support a device reset operation. @retval EFI_INVALID_PARAMETER Port or PortMultiplierPort are invalid. @@ -740,6 +820,7 @@ AtaPassThruResetPort ( **/ EFI_STATUS +EFIAPI AtaPassThruResetDevice ( IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, @@ -747,9 +828,9 @@ AtaPassThruResetDevice ( ); /** - Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function + Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the - nonblocking I/O functionality is optional. + nonblocking I/O functionality is optional. @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. @param Target The Target is an array of size TARGET_MAX_BYTES and it represents @@ -798,11 +879,11 @@ ExtScsiPassThruPassThru ( ); /** - Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These + Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal - Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the - Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI - channel. + Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the + Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI + channel. @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. @param Target On input, a pointer to the Target ID (an array of size @@ -911,7 +992,7 @@ EFIAPI ExtScsiPassThruResetChannel ( IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This ); - + /** Resets a SCSI logical unit that is connected to a SCSI channel. @@ -937,13 +1018,13 @@ ExtScsiPassThruResetTargetLun ( IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN UINT8 *Target, IN UINT64 Lun - ); + ); /** - Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either + Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs - for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to - see if a SCSI device is actually present at that location on the SCSI channel. + for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to + see if a SCSI device is actually present at that location on the SCSI channel. @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel. @@ -970,9 +1051,9 @@ ExtScsiPassThruGetNextTarget ( /** Initialize ATA host controller at IDE mode. - - The function is designed to initialize ATA host controller. - + + The function is designed to initialize ATA host controller. + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. **/ @@ -984,9 +1065,9 @@ IdeModeInitialization ( /** Initialize ATA host controller at AHCI mode. - - The function is designed to initialize ATA host controller. - + + The function is designed to initialize ATA host controller. + @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance. **/ @@ -996,5 +1077,231 @@ AhciModeInitialization ( IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance ); +/** + Start a non data transfer on specific port. + + @param[in] PciIo The PCI IO protocol instance. + @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS. + @param[in] Port The number of port. + @param[in] PortMultiplier The timeout value of stop. + @param[in] AtapiCommand The atapi command will be used for the + transfer. + @param[in] AtapiCommandLength The length of the atapi command. + @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data. + @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data. + @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_DEVICE_ERROR The non data transfer abort with error occurs. + @retval EFI_TIMEOUT The operation is time out. + @retval EFI_UNSUPPORTED The device is not ready for transfer. + @retval EFI_SUCCESS The non data transfer executes successfully. + +**/ +EFI_STATUS +EFIAPI +AhciNonDataTransfer ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_AHCI_REGISTERS *AhciRegisters, + IN UINT8 Port, + IN UINT8 PortMultiplier, + IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, + IN UINT8 AtapiCommandLength, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + +/** + Start a DMA data transfer on specific port + + @param[in] Instance The ATA_ATAPI_PASS_THRU_INSTANCE protocol instance. + @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS. + @param[in] Port The number of port. + @param[in] PortMultiplier The timeout value of stop. + @param[in] AtapiCommand The atapi command will be used for the + transfer. + @param[in] AtapiCommandLength The length of the atapi command. + @param[in] Read The transfer direction. + @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data. + @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data. + @param[in, out] MemoryAddr The pointer to the data buffer. + @param[in] DataCount The data count to be transferred. + @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_DEVICE_ERROR The DMA data transfer abort with error occurs. + @retval EFI_TIMEOUT The operation is time out. + @retval EFI_UNSUPPORTED The device is not ready for transfer. + @retval EFI_SUCCESS The DMA data transfer executes successfully. + +**/ +EFI_STATUS +EFIAPI +AhciDmaTransfer ( + IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, + IN EFI_AHCI_REGISTERS *AhciRegisters, + IN UINT8 Port, + IN UINT8 PortMultiplier, + IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, + IN UINT8 AtapiCommandLength, + IN BOOLEAN Read, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN OUT VOID *MemoryAddr, + IN UINT32 DataCount, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + +/** + Start a PIO data transfer on specific port. + + @param[in] PciIo The PCI IO protocol instance. + @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS. + @param[in] Port The number of port. + @param[in] PortMultiplier The timeout value of stop. + @param[in] AtapiCommand The atapi command will be used for the + transfer. + @param[in] AtapiCommandLength The length of the atapi command. + @param[in] Read The transfer direction. + @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data. + @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data. + @param[in, out] MemoryAddr The pointer to the data buffer. + @param[in] DataCount The data count to be transferred. + @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_DEVICE_ERROR The PIO data transfer abort with error occurs. + @retval EFI_TIMEOUT The operation is time out. + @retval EFI_UNSUPPORTED The device is not ready for transfer. + @retval EFI_SUCCESS The PIO data transfer executes successfully. + +**/ +EFI_STATUS +EFIAPI +AhciPioTransfer ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_AHCI_REGISTERS *AhciRegisters, + IN UINT8 Port, + IN UINT8 PortMultiplier, + IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL, + IN UINT8 AtapiCommandLength, + IN BOOLEAN Read, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN OUT VOID *MemoryAddr, + IN UINT32 DataCount, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + +/** + Send ATA command into device with NON_DATA protocol + + @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE + data structure. + @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure. + @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data + structure. + @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure. + @param[in] Timeout The time to complete the command, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_SUCCESS Reading succeed + @retval EFI_ABORTED Command failed + @retval EFI_DEVICE_ERROR Device status error. + +**/ +EFI_STATUS +EFIAPI +AtaNonDataCommandIn ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_IDE_REGISTERS *IdeRegisters, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + +/** + Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt). + + @param[in] Instance A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data + structure. + @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure. + @param[in] Read Flag used to determine the data transfer + direction. Read equals 1, means data transferred + from device to host;Read equals 0, means data + transferred from host to device. + @param[in] DataBuffer A pointer to the source buffer for the data. + @param[in] DataLength The length of the data. + @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure. + @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure. + @param[in] Timeout The time to complete the command, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_SUCCESS the operation is successful. + @retval EFI_OUT_OF_RESOURCES Build PRD table failed + @retval EFI_UNSUPPORTED Unknown channel or operations command + @retval EFI_DEVICE_ERROR Ata command execute failed + +**/ +EFI_STATUS +EFIAPI +AtaUdmaInOut ( + IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, + IN EFI_IDE_REGISTERS *IdeRegisters, + IN BOOLEAN Read, + IN VOID *DataBuffer, + IN UINT64 DataLength, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + +/** + This function is used to send out ATA commands conforms to the PIO Data In Protocol. + + @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data + structure. + @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure. + @param[in, out] Buffer A pointer to the source buffer for the data. + @param[in] ByteCount The length of the data. + @param[in] Read Flag used to determine the data transfer direction. + Read equals 1, means data transferred from device + to host;Read equals 0, means data transferred + from host to device. + @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure. + @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure. + @param[in] Timeout The time to complete the command, uses 100ns as a unit. + @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK + used by non-blocking mode. + + @retval EFI_SUCCESS send out the ATA command and device send required data successfully. + @retval EFI_DEVICE_ERROR command sent failed. + +**/ +EFI_STATUS +EFIAPI +AtaPioDataInOut ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_IDE_REGISTERS *IdeRegisters, + IN OUT VOID *Buffer, + IN UINT64 ByteCount, + IN BOOLEAN Read, + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, + IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock, + IN UINT64 Timeout, + IN ATA_NONBLOCK_TASK *Task + ); + #endif