\r
@retval EFI_SUCCESS Successfully to discover the device and attach\r
ScsiIoProtocol to it.\r
- @retval EFI_OUT_OF_RESOURCES Fail to discover the device.\r
+ @retval EFI_NOT_FOUND Fail to discover the device.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resources.\r
\r
**/\r
EFI_STATUS\r
ScsiBusDev->DevicePath\r
);\r
\r
- if (!DiscoverScsiDevice (ScsiIoDevice)) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
+ Status = DiscoverScsiDevice (ScsiIoDevice);\r
+ if (EFI_ERROR (Status)) {\r
goto ErrorExit;\r
}\r
\r
\r
@param ScsiIoDevice The pointer of SCSI_IO_DEV\r
\r
- @retval TRUE Find SCSI Device and verify it.\r
- @retval FALSE Unable to find SCSI Device.\r
+ @retval EFI_SUCCESS Find SCSI Device and verify it.\r
+ @retval EFI_NOT_FOUND Unable to find SCSI Device.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resources.\r
\r
**/\r
-BOOLEAN\r
+EFI_STATUS\r
DiscoverScsiDevice (\r
IN OUT SCSI_IO_DEV *ScsiIoDevice\r
)\r
EFI_SCSI_SENSE_DATA *SenseData;\r
UINT8 MaxRetry;\r
UINT8 Index;\r
- BOOLEAN ScsiDeviceFound;\r
\r
HostAdapterStatus = 0;\r
TargetStatus = 0;\r
\r
InquiryData = AllocateAlignedBuffer (ScsiIoDevice, sizeof (EFI_SCSI_INQUIRY_DATA));\r
if (InquiryData == NULL) {\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r
}\r
\r
sizeof (EFI_SCSI_SENSE_DATA)\r
);\r
if (SenseData == NULL) {\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r
}\r
\r
(SenseData->Error_Code == 0x70) &&\r
(SenseData->Sense_Key == EFI_SCSI_SK_ILLEGAL_REQUEST))\r
{\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
\r
(Status == EFI_INVALID_PARAMETER) ||\r
(Status == EFI_UNSUPPORTED))\r
{\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
}\r
\r
if (Index == MaxRetry) {\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
\r
// Retrieved inquiry data successfully\r
//\r
if (InquiryData->Peripheral_Qualifier != 0) {\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
\r
if ((InquiryData->Peripheral_Type >= EFI_SCSI_TYPE_RESERVED_LOW) &&\r
(InquiryData->Peripheral_Type <= EFI_SCSI_TYPE_RESERVED_HIGH))\r
{\r
- ScsiDeviceFound = FALSE;\r
+ Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
\r
ScsiIoDevice->ScsiVersion = (UINT8)(InquiryData->Version & 0x07);\r
}\r
\r
- ScsiDeviceFound = TRUE;\r
+ Status = EFI_SUCCESS;\r
\r
Done:\r
FreeAlignedBuffer (SenseData, sizeof (EFI_SCSI_SENSE_DATA));\r
FreeAlignedBuffer (InquiryData, sizeof (EFI_SCSI_INQUIRY_DATA));\r
\r
- return ScsiDeviceFound;\r
+ return Status;\r
}\r
\r
/**\r
\r
@retval EFI_SUCCESS Successfully to discover the device and attach\r
ScsiIoProtocol to it.\r
- @retval EFI_OUT_OF_RESOURCES Fail to discover the device.\r
+ @retval EFI_NOT_FOUND Fail to discover the device.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resources.\r
\r
**/\r
EFI_STATUS\r
\r
@param ScsiIoDevice The pointer of SCSI_IO_DEV\r
\r
- @retval TRUE Find SCSI Device and verify it.\r
- @retval FALSE Unable to find SCSI Device.\r
+ @retval EFI_SUCCESS Find SCSI Device and verify it.\r
+ @retval EFI_NOT_FOUND Unable to find SCSI Device.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate memory resources.\r
\r
**/\r
-BOOLEAN\r
+EFI_STATUS\r
DiscoverScsiDevice (\r
IN OUT SCSI_IO_DEV *ScsiIoDevice\r
);\r