+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;\r
+ EFI_HANDLE DeviceHandle;\r
+\r
+ DevicePath = NULL;\r
+ RemainingDevicePath = NULL;\r
+ ScsiDevicePath = NULL;\r
+ ScsiIoDevice = NULL;\r
+\r
+ //\r
+ // Build Device Path\r
+ //\r
+ if (ScsiBusDev->ExtScsiSupport){\r
+ Status = ScsiBusDev->ExtScsiInterface->BuildDevicePath (\r
+ ScsiBusDev->ExtScsiInterface,\r
+ &TargetId->ScsiId.ExtScsi[0],\r
+ Lun,\r
+ &ScsiDevicePath\r
+ );\r
+ } else {\r
+ Status = ScsiBusDev->ScsiInterface->BuildDevicePath (\r
+ ScsiBusDev->ScsiInterface,\r
+ TargetId->ScsiId.Scsi,\r
+ Lun,\r
+ &ScsiDevicePath\r
+ );\r
+ }\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ return Status;\r
+ }\r
+\r
+ DevicePath = AppendDevicePathNode (\r
+ ScsiBusDev->DevicePath,\r
+ ScsiDevicePath\r
+ );\r
+\r
+ if (DevicePath == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ DeviceHandle = NULL;\r
+ RemainingDevicePath = DevicePath;\r
+ Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);\r
+ if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {\r
+ //\r
+ // The device has been started, directly return to fast boot.\r
+ //\r
+ Status = EFI_ALREADY_STARTED;\r
+ goto ErrorExit;\r
+ }\r