]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
Porting R8's PI-enabled ScsiBus driver
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiBusDxe / ScsiBus.h
index 594953e4d62e3dea1c0fc911f2f5a7236c06e432..f24afd3d101f6aaa51bc1839006e64b51a51b13a 100644 (file)
@@ -33,23 +33,64 @@ Revision History
 \r
 #define SCSI_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'i', 'o')\r
 \r
+typedef struct _SCSI_TARGET_ID {\r
+ union {\r
+   UINT32  Scsi;\r
+   UINT8   ExtScsi[4];   \r
+ } ScsiId;\r
+  UINT8   ExtScsiId[12];\r
+}SCSI_TARGET_ID;\r
+\r
+\r
+typedef struct {\r
+   VOID   *Data1;\r
+   VOID   *Data2;\r
+} SCSI_EVENT_DATA;\r
+\r
+\r
 typedef struct {\r
-  UINT32                      Signature;\r
-\r
-  EFI_HANDLE                  Handle;\r
-  EFI_SCSI_IO_PROTOCOL        ScsiIo;\r
-  EFI_DEVICE_PATH_PROTOCOL    *DevicePath;\r
-  EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;\r
-\r
-  UINT32                      Pun;\r
-  UINT64                      Lun;\r
-  UINT8                       ScsiDeviceType;\r
-  UINT8                       ScsiVersion;\r
-  BOOLEAN                     RemovableDevice;\r
+  UINT32                             Signature;\r
+  EFI_HANDLE                         Handle;\r
+  EFI_SCSI_IO_PROTOCOL               ScsiIo;\r
+  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;\r
+  BOOLEAN                            ExtScsiSupport; \r
+  EFI_SCSI_PASS_THRU_PROTOCOL        *ScsiPassThru;\r
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *ExtScsiPassThru;\r
+  SCSI_TARGET_ID                     Pun;\r
+  UINT64                             Lun;\r
+  UINT8                              ScsiDeviceType;\r
+  UINT8                              ScsiVersion;\r
+  BOOLEAN                            RemovableDevice;\r
 } SCSI_IO_DEV;\r
 \r
 #define SCSI_IO_DEV_FROM_THIS(a)  CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)\r
 \r
+//\r
+// SCSI Bus Controller device strcuture\r
+//\r
+#define EFI_SCSI_BUS_PROTOCOL_GUID \\r
+  { \\r
+    0x5261213D, 0x3A3D, 0x441E, 0xB3, 0xAF, 0x21, 0xD3, 0xF7, 0xA4, 0xCA, 0x17 \\r
+  }\r
+\r
+typedef struct _EFI_SCSI_BUS_PROTOCOL {\r
+  UINT64  Reserved;\r
+} EFI_SCSI_BUS_PROTOCOL;\r
+\r
+#define SCSI_BUS_DEVICE_SIGNATURE  EFI_SIGNATURE_32 ('s', 'c', 's', 'i')\r
+\r
+\r
+typedef struct _SCSI_BUS_DEVICE {\r
+  UINTN                                 Signature;\r
+  EFI_SCSI_BUS_PROTOCOL                 BusIdentify;\r
+  BOOLEAN                               ExtScsiSupport; \r
+  EFI_SCSI_PASS_THRU_PROTOCOL           *ScsiInterface;\r
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL       *ExtScsiInterface;\r
+  EFI_DEVICE_PATH_PROTOCOL              *DevicePath;\r
+} SCSI_BUS_DEVICE;\r
+\r
+#define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a)  CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)\r
+\r
 //\r
 // Global Variables\r
 //\r
@@ -112,16 +153,18 @@ ScsiGetDeviceType (
 \r
 Routine Description:\r
 \r
-  TODO: Add function description\r
-\r
+  Retrieves the device type information of the SCSI Controller.\r
+    \r
 Arguments:\r
 \r
-  This        - TODO: add argument description\r
-  DeviceType  - TODO: add argument description\r
+  This                  - Protocol instance pointer.\r
+  DeviceType            - A pointer to the device type information\r
+                            retrieved from the SCSI Controller. \r
 \r
 Returns:\r
 \r
-  TODO: add return values\r
+  EFI_SUCCESS           - Retrieves the device type information successfully.\r
+  EFI_INVALID_PARAMETER - The DeviceType is NULL.\r
 \r
 --*/\r
 ;\r
@@ -135,15 +178,20 @@ ScsiResetBus (
 \r
 Routine Description:\r
 \r
-  TODO: Add function description\r
-\r
+  Resets the SCSI Bus that the SCSI Controller is attached to.\r
+    \r
 Arguments:\r
 \r
-  This  - TODO: add argument description\r
+  This                  - Protocol instance pointer.\r
 \r
 Returns:\r
 \r
-  TODO: add return values\r
+  EFI_SUCCESS           - The SCSI bus is reset successfully.\r
+  EFI_DEVICE_ERROR      - Errors encountered when resetting the SCSI bus.\r
+  EFI_UNSUPPORTED       - The bus reset operation is not supported by the\r
+                          SCSI Host Controller.\r
+  EFI_TIMEOUT           - A timeout occurred while attempting to reset \r
+                          the SCSI bus.\r
 \r
 --*/\r
 ;\r
@@ -157,15 +205,21 @@ ScsiResetDevice (
 \r
 Routine Description:\r
 \r
-  TODO: Add function description\r
-\r
+  Resets the SCSI Controller that the device handle specifies.\r
+    \r
 Arguments:\r
 \r
-  This  - TODO: add argument description\r
-\r
+  This                  - Protocol instance pointer.\r
+    \r
 Returns:\r
 \r
-  TODO: add return values\r
+  EFI_SUCCESS           - Reset the SCSI controller successfully.\r
+  EFI_DEVICE_ERROR      - Errors are encountered when resetting the\r
+                          SCSI Controller.\r
+  EFI_UNSUPPORTED       - The SCSI bus does not support a device \r
+                          reset operation.\r
+  EFI_TIMEOUT           - A timeout occurred while attempting to \r
+                          reset the SCSI Controller.\r
 \r
 --*/\r
 ;\r
@@ -181,17 +235,54 @@ ScsiExecuteSCSICommand (
 \r
 Routine Description:\r
 \r
-  TODO: Add function description\r
-\r
+  Sends a SCSI Request Packet to the SCSI Controller for execution.\r
+    \r
 Arguments:\r
 \r
-  This          - TODO: add argument description\r
-  CommandPacket - TODO: add argument description\r
-  Event         - TODO: add argument description\r
-\r
+  This                  - Protocol instance pointer.\r
+  Packet                - The SCSI request packet to send to the SCSI \r
+                          Controller specified by the device handle.\r
+  Event                 - If the SCSI bus where the SCSI device is attached\r
+                          does not support non-blocking I/O, then Event is \r
+                          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
 Returns:\r
 \r
-  TODO: add return values\r
+  EFI_SUCCESS           - The SCSI Request Packet was sent by the host \r
+                          successfully, and TransferLength bytes were \r
+                          transferred to/from DataBuffer.See \r
+                          HostAdapterStatus, TargetStatus, \r
+                          SenseDataLength, and SenseData in that order\r
+                          for additional status information.\r
+  EFI_BAD_BUFFER_SIZE   - The SCSI Request Packet was executed, \r
+                          but the 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
+  EFI_NOT_READY         - The SCSI Request Packet could not be sent because \r
+                          there are too many SCSI Command Packets already \r
+                          queued.The caller may retry again later.\r
+  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
+  EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.  \r
+                          The SCSI Request Packet was not sent, so no \r
+                          additional status information is available.\r
+  EFI_UNSUPPORTED       - The command described by the SCSI Request Packet\r
+                          is not supported by the SCSI initiator(i.e., SCSI \r
+                          Host Controller). The SCSI Request Packet was not\r
+                          sent, so no additional status information is \r
+                          available.\r
+  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
 ;\r
@@ -200,29 +291,28 @@ EFI_STATUS
 ScsiScanCreateDevice (\r
   EFI_DRIVER_BINDING_PROTOCOL   *This,\r
   EFI_HANDLE                    Controller,\r
-  UINT32                        Pun,\r
+  SCSI_TARGET_ID                *TargetId,\r
   UINT64                        Lun,\r
-  EFI_SCSI_PASS_THRU_PROTOCOL   *ScsiPassThru,\r
-  EFI_DEVICE_PATH_PROTOCOL      *ParentDevicePath\r
+  SCSI_BUS_DEVICE              *ScsiBusDev\r
   )\r
 /*++\r
 \r
 Routine Description:\r
 \r
-  TODO: Add function description\r
+  Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.\r
 \r
 Arguments:\r
 \r
-  This              - TODO: add argument description\r
-  Controller        - TODO: add argument description\r
-  Pun               - TODO: add argument description\r
-  Lun               - TODO: add argument description\r
-  ScsiPassThru      - TODO: add argument description\r
-  ParentDevicePath  - TODO: add argument description\r
+  This              - Protocol instance pointer\r
+  Controller        - Controller handle\r
+  Pun               - The Pun of the SCSI device on the SCSI channel.\r
+  Lun               - The Lun of the SCSI device on the SCSI channel.\r
+  ScsiBusDev        - The pointer of SCSI_BUS_DEVICE\r
 \r
 Returns:\r
 \r
-  TODO: add return values\r
+  EFI_SUCCESS       - Successfully to discover the device and attach ScsiIoProtocol to it.\r
+  EFI_OUT_OF_RESOURCES - Fail to discover the device.\r
 \r
 --*/\r
 ;\r