]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/ScsiPassThru.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / ScsiPassThru.h
diff --git a/OldMdePkg/Include/Protocol/ScsiPassThru.h b/OldMdePkg/Include/Protocol/ScsiPassThru.h
new file mode 100644 (file)
index 0000000..a5aa6c4
--- /dev/null
@@ -0,0 +1,312 @@
+/** @file\r
+  SCSI Pass Through protocol.\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:  ScsiPassThru.h\r
+\r
+**/\r
+\r
+#ifndef __SCSI_PASS_THROUGH_H__\r
+#define __SCSI_PASS_THROUGH_H__\r
+\r
+#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \\r
+  { \\r
+    0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL  EFI_SCSI_PASS_THRU_PROTOCOL;\r
+\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL    0x0001\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL     0x0002\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO  0x0004\r
+\r
+//\r
+// SCSI Host Adapter Status definition\r
+//\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_OK                     0x00\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND        0x09  // timeout when processing the command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT                0x0b  // timeout when waiting for the command processing\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT         0x0d  // a message reject was received when processing command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET              0x0e  // a bus reset was detected\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR           0x0f\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED   0x10  // the adapter failed in issuing request sense command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT      0x11  // selection timeout\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN  0x12  // data overrun or data underrun\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE               0x13  // Unexepected bus free\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR            0x14  // Target bus phase sequence failure\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER                  0x7f\r
+\r
+//\r
+// SCSI Target Status definition\r
+//\r
+#define EFI_SCSI_STATUS_TARGET_GOOD                       0x00\r
+#define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION            0x02  // check condition\r
+#define EFI_SCSI_STATUS_TARGET_CONDITION_MET              0x04  // condition met\r
+#define EFI_SCSI_STATUS_TARGET_BUSY                       0x08  // busy\r
+#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE               0x10  // intermediate\r
+#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14  // intermediate-condition met\r
+#define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT       0x18  // reservation conflict\r
+#define EFI_SCSI_STATUS_TARGET_COMMOND_TERMINATED         0x22  // command terminated\r
+#define EFI_SCSI_STATUS_TARGET_QUEUE_FULL                 0x28  // queue full\r
+\r
+typedef struct {\r
+  UINT64  Timeout;\r
+  VOID    *DataBuffer;\r
+  VOID    *SenseData;\r
+  VOID    *Cdb;\r
+  UINT32  TransferLength;\r
+  UINT8   CdbLength;\r
+  UINT8   DataDirection;\r
+  UINT8   HostAdapterStatus;\r
+  UINT8   TargetStatus;\r
+  UINT8   SenseDataLength;\r
+} EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
+\r
+typedef struct {\r
+  CHAR16  *ControllerName;\r
+  CHAR16  *ChannelName;\r
+  UINT32  AdapterId;\r
+  UINT32  Attributes;\r
+  UINT32  IoAlign;\r
+} EFI_SCSI_PASS_THRU_MODE;\r
+\r
+/**\r
+  Sends a SCSI Request Packet to a SCSI device that is attached to \r
+  the SCSI channel. This function supports both blocking I/O and \r
+  non-blocking I/O.  The blocking I/O functionality is required, \r
+  and the non-blocking I/O functionality is optional.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target The Target ID of the SCSI device to\r
+                 send the SCSI Request Packet.\r
+  @param  Lun    The LUN of the SCSI device to send the\r
+                 SCSI Request Packet.\r
+  @param  Packet A pointer to the SCSI Request Packet to send\r
+                 to the SCSI device specified by Target and Lun.\r
+  @param  Event  If non-blocking I/O is not supported then Event\r
+                 is ignored, and blocking I/O is performed.\r
+                 If Event is NULL, then blocking I/O is performed.\r
+                 If Event is not NULL and non blocking I/O is\r
+                 supported, then non-blocking I/O is performed,\r
+                 and Event will be signaled when the SCSI Request\r
+                 Packet completes\r
+\r
+  @retval EFI_SUCCESS               The SCSI Request Packet was sent by the host, and\r
+                                    TransferLength bytes were transferred to/from\r
+                                    DataBuffer.See HostAdapterStatus, TargetStatus,\r
+                                    SenseDataLength,and SenseData in that order\r
+                                    for additional status information.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed, but the\r
+                                    entire DataBuffer could not be transferred.\r
+                                    The actual number of bytes transferred is returned\r
+                                    in TransferLength. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because\r
+                                    there are too many SCSI Request Packets already\r
+                                    queued.  The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send\r
+                                    the SCSI Request Packet. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_INVALID_PARAMETER     Target, Lun, or the contents of ScsiRequestPacket\r
+                                    are invalid. The SCSI Request Packet was not sent,\r
+                                    so no additional status information is available.\r
+  @retval EFI_UNSUPPORTED           The command described by the SCSI Request Packet\r
+                                    is not supported by the host adapter. The SCSI\r
+                                    Request Packet was not sent, so no additional\r
+                                    status information is available.\r
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI\r
+                                    Request Packet to execute. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL                          *This,\r
+  IN UINT32                                               Target,\r
+  IN UINT64                                               Lun,\r
+  IN OUT EFI_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 for SCSI devices \r
+  on a SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target On input, a pointer to the Target ID of a\r
+                 SCSI device present on the SCSI channel.\r
+                 On output, a pointer to the Target ID of\r
+                 the next SCSI device present on a SCSI channel.\r
+                 An input value of 0xFFFFFFFF retrieves the\r
+                 Target ID of the first SCSI device present on\r
+                 a SCSI channel.\r
+  @param  Lun    On input, a pointer to the LUN of a SCSI device\r
+                 present on the SCSI channel.On output, a pointer\r
+                 to the LUN of the next 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 and Lun.\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+  @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF, and Target and Lun were\r
+                                 not returned on a previous call to GetNextDevice().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN OUT UINT32                             *Target,\r
+  IN OUT UINT64                             *Lun\r
+  )\r
+;\r
+\r
+/**\r
+  Used to allocate and build a device path node for a SCSI device \r
+  on a SCSI channel.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  Target     The Target ID of the SCSI device for which\r
+                     a device path node is to be allocated and built.\r
+  @param  Lun        The LUN of the SCSI device for which a device\r
+                     path node is to be allocated and built.\r
+  @param  DevicePath A pointer to a single device path node that\r
+                     describes the SCSI device specified by\r
+                     Target and Lun. This function is responsible\r
+                     for allocating the buffer DevicePath with the boot\r
+                     service AllocatePool().  It is the caller's\r
+                     responsibility to free DevicePath when the caller\r
+                     is finished with DevicePath.\r
+\r
+  @retval EFI_SUCCESS           The device path node that describes the SCSI device\r
+                                specified by Target and Lun was allocated and\r
+                                returned in DevicePath.\r
+  @retval EFI_NOT_FOUND         The SCSI devices specified by Target and Lun does\r
+                                not exist on the SCSI channel.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate\r
+                                DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN     UINT32                             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       Protocol instance pointer.\r
+  @param  DevicePath A pointer to the device path node that\r
+                     describes a SCSI device on the SCSI channel.\r
+  @param  Target     A pointer to the Target ID of a SCSI device\r
+                     on the SCSI channel.\r
+  @param  Lun        A pointer to the LUN of a SCSI device on\r
+                     the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           DevicePath was successfully translated to a\r
+                                Target ID and LUN, and they were returned\r
+                                in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_INVALID_PARAMETER Target is NULL.\r
+  @retval EFI_INVALID_PARAMETER Lun is NULL.\r
+  @retval EFI_UNSUPPORTED       This driver does not support the device path\r
+                                node type in DevicePath.\r
+  @retval EFI_NOT_FOUND         A valid translation from DevicePath to a\r
+                                Target ID and LUN does not exist.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL              *DevicePath,\r
+  OUT UINT32                                *Target,\r
+  OUT UINT64                                *Lun\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a SCSI channel.This operation resets all the \r
+  SCSI devices connected to the SCSI channel.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS      The SCSI channel was reset.\r
+  @retval EFI_UNSUPPORTED  The SCSI channel does not support\r
+                           a channel reset operation.\r
+  @retval EFI_DEVICE_ERROR A device error occurred while\r
+                           attempting to reset the SCSI channel.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting\r
+                           to reset the SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL             *This\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a SCSI device that is connected to a SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target The Target ID of the SCSI device to reset.\r
+  @param  Lun    The LUN of the SCSI device to reset.\r
+\r
+  @retval EFI_SUCCESS           The SCSI device specified by Target and\r
+                                Lun was reset.\r
+  @retval EFI_UNSUPPORTED       The SCSI channel does not support a target\r
+                                reset operation.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun are invalid.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting\r
+                                to reset the SCSI device specified by Target\r
+                                and Lun.\r
+  @retval EFI_TIMEOUT           A timeout occurred while attempting to reset\r
+                                the SCSI device specified by Target and Lun.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL             *This,\r
+  IN UINT32                                  Target,\r
+  IN UINT64                                  Lun\r
+  )\r
+;\r
+\r
+struct _EFI_SCSI_PASS_THRU_PROTOCOL {\r
+  EFI_SCSI_PASS_THRU_MODE               *Mode;\r
+  EFI_SCSI_PASS_THRU_PASSTHRU           PassThru;\r
+  EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE    GetNextDevice;\r
+  EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH  BuildDevicePath;\r
+  EFI_SCSI_PASS_THRU_GET_TARGET_LUN     GetTargetLun;\r
+  EFI_SCSI_PASS_THRU_RESET_CHANNEL      ResetChannel;\r
+  EFI_SCSI_PASS_THRU_RESET_TARGET       ResetTarget;\r
+};\r
+\r
+extern EFI_GUID gEfiScsiPassThruProtocolGuid;\r
+\r
+#endif\r