--- /dev/null
+/** @file\r
+ EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+ Module Name: ScsiPassThruExt.h\r
+\r
+**/\r
+\r
+#ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
+#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
+\r
+#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \\r
+ { \\r
+ 0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \\r
+ }\r
+\r
+typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;\r
+\r
+#define TARGET_MAX_BYTES 0x10\r
+\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004\r
+\r
+//\r
+// DataDirection\r
+//\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_READ 0\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2\r
+//\r
+// HostAdapterStatus\r
+//\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f\r
+//\r
+// TargetStatus\r
+//\r
+#define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00\r
+#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02\r
+#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04\r
+#define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08\r
+#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10\r
+#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14\r
+#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18\r
+#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28\r
+#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30\r
+#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40\r
+\r
+typedef struct {\r
+ UINT32 AdapterId;\r
+ UINT32 Attributes;\r
+ UINT32 IoAlign;\r
+} EFI_EXT_SCSI_PASS_THRU_MODE;\r
+\r
+typedef struct {\r
+ UINT64 Timeout;\r
+ VOID *InDataBuffer;\r
+ VOID *OutDataBuffer;\r
+ VOID *SenseData;\r
+ VOID *Cdb;\r
+ UINT32 InTransferLength;\r
+ UINT32 OutTransferLength;\r
+ UINT8 CdbLength;\r
+ UINT8 DataDirection;\r
+ UINT8 HostAdapterStatus;\r
+ UINT8 TargetStatus;\r
+ UINT8 SenseDataLength;\r
+} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
+\r
+/**\r
+ Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function \r
+ supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
+ nonblocking I/O functionality is optional. \r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r
+ the id of the SCSI device to send the SCSI Request Packet. Each\r
+ transport driver may chose to utilize a subset of this size to suit the needs\r
+ of transport target representation. For example, a Fibre Channel driver\r
+ may use only 8 bytes (WWN) to represent an FC target.\r
+ @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
+ @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
+ specified by Target and Lun.\r
+ @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
+ I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
+ Event is not NULL and non blocking I/O is supported, then\r
+ nonblocking I/O is performed, and Event will be signaled when the\r
+ SCSI Request Packet completes.\r
+\r
+ @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
+ commands, InTransferLength bytes were transferred from\r
+ InDataBuffer. For write and bi-directional commands,\r
+ OutTransferLength bytes were transferred by\r
+ OutDataBuffer.\r
+ @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
+ could be transferred is returned in InTransferLength. For write\r
+ and bi-directional commands, OutTransferLength bytes were\r
+ transferred by OutDataBuffer.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
+ SCSI Request Packets already queued. The caller may retry again later.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
+ Packet.\r
+ @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
+ by the host adapter. This includes the case of Bi-directional SCSI\r
+ commands not supported by the implementation. The SCSI Request\r
+ Packet was not sent, so no additional status information is available.\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN UINT8 *Target,\r
+ IN UINT64 Lun,\r
+ IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
+ IN EFI_EVENT Event OPTIONAL\r
+ )\r
+; \r
+\r
+/**\r
+ Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These \r
+ can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
+ Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the \r
+ Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI \r
+ channel. \r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param Target On input, a pointer to the Target ID (an array of size\r
+ TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+ On output, a pointer to the Target ID (an array of\r
+ TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+ channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+ Target array retrieves the Target ID of the first SCSI device present on a\r
+ SCSI channel.\r
+ @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
+ channel. On output, a pointer to the LUN of the next SCSI device present\r
+ on a SCSI channel.\r
+\r
+ @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
+ channel was returned in Target and Lun.\r
+ @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
+ not returned on a previous call to GetNextTargetLun().\r
+ @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN OUT UINT8 **Target,\r
+ IN OUT UINT64 *Lun\r
+ )\r
+; \r
+\r
+/**\r
+ Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
+ Target ID of the SCSI device for which a device path node is to be\r
+ allocated and built. Transport drivers may chose to utilize a subset of\r
+ this size to suit the representation of targets. For example, a Fibre\r
+ Channel driver may use only 8 bytes (WWN) in the array to represent a\r
+ FC target.\r
+ @param Lun The LUN of the SCSI device for which a device path node is to be\r
+ allocated and built.\r
+ @param DevicePath A pointer to a single device path node that describes the SCSI device\r
+ specified by Target and Lun. This function is responsible for\r
+ allocating the buffer DevicePath with the boot service\r
+ AllocatePool(). It is the caller's responsibility to free\r
+ DevicePath when the caller is finished with DevicePath.\r
+\r
+ @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
+ Target and Lun was allocated and returned in\r
+ DevicePath.\r
+ @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+ @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
+ on the SCSI channel.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN UINT8 *Target,\r
+ IN UINT64 Lun,\r
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
+ )\r
+; \r
+\r
+/**\r
+ Used to translate a device path node to a Target ID and LUN.\r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param DevicePath A pointer to a single device path node that describes the SCSI device\r
+ on the SCSI channel.\r
+ @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
+ on the SCSI channel.\r
+ @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
+\r
+ @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
+ LUN, and they were returned in Target and Lun.\r
+ @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
+ @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
+ does not exist.\r
+ @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
+ DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
+ OUT UINT8 **Target,\r
+ OUT UINT64 *Lun\r
+ )\r
+; \r
+\r
+/**\r
+ Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The SCSI channel was reset.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
+ @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
+ @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
+ )\r
+; \r
+ \r
+/**\r
+ Resets a SCSI logical unit that is connected to a SCSI channel.\r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
+ target port ID of the SCSI device containing the SCSI logical unit to\r
+ reset. Transport drivers may chose to utilize a subset of this array to suit\r
+ the representation of their targets.\r
+ @param Lun The LUN of the SCSI device to reset.\r
+\r
+ @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
+ @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+ @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
+ specified by Target and Lun.\r
+ @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
+ specified by Target and Lun.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN UINT8 *Target,\r
+ IN UINT64 Lun\r
+ )\r
+; \r
+\r
+/**\r
+ Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either \r
+ be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
+ for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to \r
+ see if a SCSI device is actually present at that location on the SCSI channel. \r
+\r
+ @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+ @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+ On output, a pointer to the Target ID (an array of\r
+ TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+ channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+ Target array retrieves the Target ID of the first SCSI device present on a\r
+ SCSI channel.\r
+\r
+ @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
+ channel was returned in Target.\r
+ @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+ @retval EFI_TIMEOUT Target array is not all 0xF, and Target were not\r
+ returned on a previous call to GetNextTarget().\r
+ @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) (\r
+ IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
+ IN OUT UINT8 **Target\r
+ )\r
+; \r
+ \r
+struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r
+ EFI_EXT_SCSI_PASS_THRU_MODE *Mode;\r
+ EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;\r
+ EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r
+ EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r
+ EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r
+ EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r
+ EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;\r
+ EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;\r
+};\r
+\r
+extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r
+\r
+#endif\r