\r
**/\r
\r
-#ifndef _SCSI_LIB_H\r
-#define _SCSI_LIB_H\r
+#ifndef _SCSI_LIB_H_\r
+#define _SCSI_LIB_H_\r
\r
#include <Protocol/ScsiIo.h>\r
\r
#define EFI_SCSI_STALL_1_MILLISECOND 10000\r
#define EFI_SCSI_STALL_1_SECOND 10000000\r
\r
-//\r
-// this macro cannot be directly used by the gBS->Stall(),\r
-// since the value output by this macro is in 100ns unit,\r
-// not 1us unit (1us = 1000ns)\r
-//\r
-#define EfiScsiStallSeconds(a) (a) * EFI_SCSI_STALL_1_SECOND\r
+///\r
+/// this macro cannot be directly used by the gBS->Stall(),\r
+/// since the value output by this macro is in 100ns unit,\r
+/// not 1us unit (1us = 1000ns)\r
+///\r
+#define EfiScsiStallSeconds(a) ((a) * EFI_SCSI_STALL_1_SECOND)\r
+\r
+\r
+/**\r
+ Function test the ready status of the SCSI unit.\r
+\r
+ @param[in] ScsiIo A pointer to SCSI IO protocol.\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[out] SenseData A pointer to output sense data.\r
+ @param[out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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 InTransferLength.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitTestUnitReadyCommand (\r
+EFIAPI\r
+ScsiTestUnitReadyCommand (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
OUT VOID *SenseData,\r
OUT UINT8 *SenseDataLength,\r
OUT UINT8 *HostAdapterStatus,\r
OUT UINT8 *TargetStatus\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
+\r
+\r
+/**\r
+ Function to submit SCSI inquiry command.\r
+\r
+ @param[in] ScsiIo SCSI IO Protocol to use\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[in] SenseData A pointer to output sense data.\r
+ @param[in out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+ @param[in out] InquirydataBuffer A pointer to inquiry data buffer.\r
+ @param[in out] InquiryDataLength The length of inquiry data buffer.\r
+ @param[in] EnableVitalProductData Boolean to enable Vital Product Data.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitInquiryCommand (\r
+EFIAPI\r
+ScsiInquiryCommand (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
IN OUT VOID *InquiryDataBuffer,\r
IN OUT UINT32 *InquiryDataLength,\r
IN BOOLEAN EnableVitalProductData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
- InquiryDataBuffer - TODO: add argument description\r
- InquiryDataLength - TODO: add argument description\r
- EnableVitalProductData - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
+\r
+\r
+/**\r
+ Function to submit SCSI mode sense 10 command.\r
+\r
+ @param[in] ScsiIo A pointer to SCSI IO protocol.\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[in] SenseData A pointer to output sense data.\r
+ @param[in out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+ @param[in] DataBuffer A pointer to input data buffer.\r
+ @param[in out] DataLength The length of input data buffer.\r
+ @param[in] DBDField The DBD Field (Optional).\r
+ @param[in] PageControl Page Control.\r
+ @param[in] PageCode Page code.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitModeSense10Command (\r
+EFIAPI\r
+ScsiModeSense10Command (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
IN UINT8 DBDField, OPTIONAL\r
IN UINT8 PageControl,\r
IN UINT8 PageCode\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
- DataBuffer - TODO: add argument description\r
- DataLength - TODO: add argument description\r
- DBDField - TODO: add argument description\r
- PageControl - TODO: add argument description\r
- PageCode - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
+\r
+\r
+\r
+/**\r
+ Function to submit SCSI request sense command.\r
+ ScsiIo - A pointer to SCSI IO protocol.\r
+ Timeout - The length of timeout period.\r
+ SenseData - A pointer to output sense data.\r
+ SenseDataLength - The length of output sense data.\r
+ HostAdapterStatus - The status of Host Adapter.\r
+ TargetStatus - The status of the target.\r
+\r
+ @param[in] ScsiIo SCSI IO Protocol to use\r
+ @param[in] Timeout TODO:\r
+ @param[in] SenseData TODO:\r
+ @param[in out] SenseDataLength TODO:\r
+ @param[out] HostAdapterStatus TODO:\r
+ @param[out] TargetStatus TODO:\r
+\r
+ @retval EFI_SUCCESS Valid data returned\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitRequestSenseCommand (\r
+EFIAPI\r
+ScsiRequestSenseCommand (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
IN OUT UINT8 *SenseDataLength,\r
OUT UINT8 *HostAdapterStatus,\r
OUT UINT8 *TargetStatus\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
+ );\r
+\r
+\r
+/**\r
+ Function to submit read capacity command.\r
+\r
+ @param[in] ScsiIo A pointer to SCSI IO protocol.\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[in] SenseData A pointer to output sense data.\r
+ @param[in out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+ @param[out] DataBuffer A pointer to a data buffer.\r
+ @param[in out] DataLength The length of data buffer.\r
+ @param[in] PMI Partial medium indicator.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-//\r
-// Commands for direct access command\r
-//\r
+**/\r
EFI_STATUS\r
-SubmitReadCapacityCommand (\r
+EFIAPI\r
+ScsiReadCapacityCommand (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
OUT VOID *DataBuffer,\r
IN OUT UINT32 *DataLength,\r
IN BOOLEAN PMI\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
- DataBuffer - TODO: add argument description\r
- DataLength - TODO: add argument description\r
- PMI - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
+\r
+\r
+/**\r
+ Function to submit read 10 command.\r
+\r
+ @param[in] ScsiIo A pointer to SCSI IO protocol.\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[in] SenseData A pointer to output sense data.\r
+ @param[in out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+ @param[out] DataBuffer Read 10 command data.\r
+ @param[in out] DataLength The length of data buffer.\r
+ @param[in] StartLba The start address of LBA.\r
+ @param[in] SectorSize The sector size.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitRead10Command (\r
+EFIAPI\r
+ScsiRead10Command (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
IN OUT UINT32 *DataLength,\r
IN UINT32 StartLba,\r
IN UINT32 SectorSize\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
- DataBuffer - TODO: add argument description\r
- DataLength - TODO: add argument description\r
- StartLba - TODO: add argument description\r
- SectorSize - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
+\r
+\r
+/**\r
+ Function to submit SCSI write 10 command.\r
+\r
+ @param[in] ScsiIo SCSI IO Protocol to use\r
+ @param[in] Timeout The length of timeout period.\r
+ @param[in] SenseData A pointer to output sense data.\r
+ @param[in out] SenseDataLength The length of output sense data.\r
+ @param[out] HostAdapterStatus The status of Host Adapter.\r
+ @param[out] TargetStatus The status of the target.\r
+ @param[out] DataBuffer A pointer to a data buffer.\r
+ @param[in out] DataLength The length of data buffer.\r
+ @param[in] StartLba The start address of LBA.\r
+ @param[in] SectorSize The sector size.\r
+\r
+ @retval EFI_SUCCESS The status of the unit is tested successfully.\r
+ @retval 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 InTransferLength.\r
+ @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
+ there are too many SCSI Command Packets already \r
+ queued.\r
+ @retval EFI_DEVICE_ERROR A device error occurred while attempting to send \r
+ the SCSI Request Packet.\r
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
+ @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
+ is not supported by the SCSI initiator(i.e., SCSI \r
+ Host Controller).\r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ Request Packet to execute.\r
\r
+**/\r
EFI_STATUS\r
-SubmitWrite10Command (\r
+EFIAPI\r
+ScsiWrite10Command (\r
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,\r
IN UINT64 Timeout,\r
IN VOID *SenseData,\r
IN OUT UINT32 *DataLength,\r
IN UINT32 StartLba,\r
IN UINT32 SectorSize\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ScsiIo - TODO: add argument description\r
- Timeout - TODO: add argument description\r
- SenseData - TODO: add argument description\r
- SenseDataLength - TODO: add argument description\r
- HostAdapterStatus - TODO: add argument description\r
- TargetStatus - TODO: add argument description\r
- DataBuffer - TODO: add argument description\r
- DataLength - TODO: add argument description\r
- StartLba - TODO: add argument description\r
- SectorSize - TODO: add argument description\r
-\r
-Returns:\r
-\r
- TODO: add return values\r
+ );\r
\r
---*/\r
-;\r
\r
#endif\r