diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-02-25 07:01:44 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-02-25 07:01:44 +0000 |
commit | 8069d49e9abf619afac16e44bf72266de57b1411 (patch) | |
tree | a282f6a89fab449d16accd48d1224c5d847a1082 /MdePkg/Library/UefiScsiLib | |
parent | 2ae8963ce89f711acd773b85ca4fe7458b9b0b84 (diff) | |
download | edk2-8069d49e9abf619afac16e44bf72266de57b1411.zip edk2-8069d49e9abf619afac16e44bf72266de57b1411.tar.gz edk2-8069d49e9abf619afac16e44bf72266de57b1411.tar.bz2 |
update comments and add assert for these files.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4750 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiScsiLib')
-rw-r--r-- | MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 122 |
1 files changed, 92 insertions, 30 deletions
diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c index 6eb21dd..5ac3433 100644 --- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c +++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c @@ -25,8 +25,10 @@ @param[in] ScsiIo A pointer to SCSI IO protocol.
@param[in] Timeout The length of timeout period.
- @param[out] SenseData A pointer to output sense data.
- @param[out] SenseDataLength The length of output sense data.
+ @param[in out] SenseData A pointer to the sense data that
+ was generated by the execution of the SCSI Request Packet.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
@@ -40,7 +42,7 @@ queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -52,8 +54,8 @@ EFI_STATUS ScsiTestUnitReadyCommand (
IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
IN UINT64 Timeout,
- OUT VOID *SenseData,
- OUT UINT8 *SenseDataLength,
+ IN OUT VOID *SenseData,
+ IN OUT UINT8 *SenseDataLength,
OUT UINT8 *HostAdapterStatus,
OUT UINT8 *TargetStatus
)
@@ -65,6 +67,13 @@ ScsiTestUnitReadyCommand ( EFI_STATUS Status;
UINT8 Cdb[6];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 6);
@@ -103,10 +112,11 @@ ScsiTestUnitReadyCommand ( @param[in] ScsiIo SCSI IO Protocol to use
@param[in] Timeout The length of timeout period.
@param[out] SenseData A pointer to output sense data.
- @param[in,out] SenseDataLength The length of output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
- @param[in,out] InquirydataBuffer A pointer to inquiry data buffer.
+ @param[in] InquirydataBuffer A pointer to inquiry data buffer.
@param[in,out] InquiryDataLength The length of inquiry data buffer.
@param[in] EnableVitalProductData Boolean to enable Vital Product Data.
@@ -120,7 +130,7 @@ ScsiTestUnitReadyCommand ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -136,7 +146,7 @@ ScsiInquiryCommand ( IN OUT UINT8 *SenseDataLength,
OUT UINT8 *HostAdapterStatus,
OUT UINT8 *TargetStatus,
- IN OUT VOID *InquiryDataBuffer,
+ IN VOID *InquiryDataBuffer,
IN OUT UINT32 *InquiryDataLength,
IN BOOLEAN EnableVitalProductData
)
@@ -148,6 +158,15 @@ ScsiInquiryCommand ( EFI_STATUS Status;
UINT8 Cdb[6];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+ ASSERT (InquiryDataLength != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 6);
@@ -192,7 +211,8 @@ ScsiInquiryCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol.
@param[in] Timeout The length of timeout period.
@param[out] SenseData A pointer to output sense data.
- @param[in,out] SenseDataLength The length of output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
@param[in] DataBuffer A pointer to input data buffer.
@@ -211,7 +231,7 @@ ScsiInquiryCommand ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -241,6 +261,15 @@ ScsiModeSense10Command ( EFI_STATUS Status;
UINT8 Cdb[10];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+ ASSERT (DataLength != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 10);
@@ -278,19 +307,14 @@ ScsiModeSense10Command ( /**
Function to submit SCSI request sense command.
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- @param[in] ScsiIo SCSI IO Protocol to use
- @param[in] Timeout TODO:
- @param[out] SenseData TODO:
- @param[in,out] SenseDataLength TODO:
- @param[out] HostAdapterStatus TODO:
- @param[out] TargetStatus TODO:
+ @param[in] ScsiIo A pointer to SCSI IO protocol.
+ @param[in] Timeout The length of timeout period.
+ @param[in] SenseData A pointer to output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
+ @param[out] HostAdapterStatus The status of Host Adapter.
+ @param[out] TargetStatus The status of the target.
@retval EFI_SUCCESS Valid data returned
@retval EFI_SUCCESS The status of the unit is tested successfully.
@@ -303,7 +327,7 @@ ScsiModeSense10Command ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -328,6 +352,14 @@ ScsiRequestSenseCommand ( EFI_STATUS Status;
UINT8 Cdb[6];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 6);
@@ -366,7 +398,8 @@ ScsiRequestSenseCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol.
@param[in] Timeout The length of timeout period.
@param[out] SenseData A pointer to output sense data.
- @param[in,out] SenseDataLength The length of output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
@param[out] DataBuffer A pointer to a data buffer.
@@ -383,7 +416,7 @@ ScsiRequestSenseCommand ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -411,6 +444,15 @@ ScsiReadCapacityCommand ( EFI_STATUS Status;
UINT8 Cdb[10];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+ ASSERT (DataLength != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 10);
@@ -457,7 +499,8 @@ ScsiReadCapacityCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol.
@param[in] Timeout The length of timeout period.
@param[out] SenseData A pointer to output sense data.
- @param[in,out] SenseDataLength The length of output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
@param[out] DataBuffer Read 10 command data.
@@ -475,7 +518,7 @@ ScsiReadCapacityCommand ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -504,6 +547,15 @@ ScsiRead10Command ( EFI_STATUS Status;
UINT8 Cdb[10];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+ ASSERT (DataLength != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 10);
@@ -548,7 +600,8 @@ ScsiRead10Command ( @param[in] ScsiIo SCSI IO Protocol to use
@param[in] Timeout The length of timeout period.
@param[out] SenseData A pointer to output sense data.
- @param[in,out] SenseDataLength The length of output sense data.
+ @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On
+ output, the number of bytes written to the SenseData buffer.
@param[out] HostAdapterStatus The status of Host Adapter.
@param[out] TargetStatus The status of the target.
@param[out] DataBuffer A pointer to a data buffer.
@@ -566,7 +619,7 @@ ScsiRead10Command ( queued.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet.
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
+ @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller).
@@ -595,6 +648,15 @@ ScsiWrite10Command ( EFI_STATUS Status;
UINT8 Cdb[10];
+ ASSERT (SenseDataLength != NULL);
+ ASSERT (HostAdapterStatus != NULL);
+ ASSERT (TargetStatus != NULL);
+ ASSERT (DataLength != NULL);
+
+ if (ScsiIo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, 10);
|