SCSI Bus driver that layers on every SCSI Pass Thru and\r
Extended SCSI Pass Thru protocol in the system.\r
\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
SetMem (TargetId, TARGET_MAX_BYTES, 0xFF);\r
\r
//\r
- // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as \r
+ // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as\r
// EFI PassThru Protocol. From priority perspective, ExtPassThru Protocol is firstly\r
// tried to open on host controller handle. If fails, then PassThru Protocol is tried instead.\r
//\r
&gEfiExtScsiPassThruProtocolGuid,\r
This->DriverBindingHandle,\r
Controller\r
- ); \r
+ );\r
return EFI_SUCCESS;\r
} else {\r
//\r
&gEfiExtScsiPassThruProtocolGuid,\r
This->DriverBindingHandle,\r
Controller\r
- ); \r
+ );\r
if (!EFI_ERROR(Status)) {\r
return EFI_SUCCESS;\r
}\r
}\r
\r
//\r
- // Come here in 2 condition: \r
+ // Come here in 2 condition:\r
// 1. ExtPassThru doesn't exist.\r
// 2. ExtPassThru exists but RemainingDevicePath is invalid.\r
//\r
Controller,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
);\r
- \r
+\r
if (Status == EFI_ALREADY_STARTED) {\r
return EFI_SUCCESS;\r
}\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
//\r
// Test RemainingDevicePath is valid or not.\r
//\r
if ((RemainingDevicePath != NULL) && !IsDevicePathEnd (RemainingDevicePath)) {\r
Status = PassThru->GetTargetLun (PassThru, RemainingDevicePath, &ScsiTargetId.ScsiId.Scsi, &Lun);\r
}\r
- \r
+\r
gBS->CloseProtocol (\r
Controller,\r
&gEfiScsiPassThruProtocolGuid,\r
FromFirstTarget = FALSE;\r
ExtScsiSupport = FALSE;\r
PassThruStatus = EFI_SUCCESS;\r
- \r
+\r
TargetId = &ScsiTargetId.ScsiId.ExtScsi[0];\r
SetMem (TargetId, TARGET_MAX_BYTES, 0xFF);\r
- \r
+\r
DevicePathStatus = gBS->OpenProtocol (\r
Controller,\r
&gEfiDevicePathProtocolGuid,\r
EFI_PROGRESS_CODE,\r
(EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT),\r
ParentDevicePath\r
- ); \r
+ );\r
\r
//\r
- // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as \r
+ // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as\r
// EFI PassThru Protocol. From priority perspective, ExtPassThru Protocol is firstly\r
// tried to open on host controller handle. If fails, then PassThru Protocol is tried instead.\r
//\r
This->DriverBindingHandle,\r
Controller\r
);\r
- } \r
+ }\r
return Status;\r
- } \r
+ }\r
} else {\r
//\r
- // Succeed to open ExtPassThru Protocol, and meanwhile open PassThru Protocol \r
- // with BY_DRIVER if it is also present on the handle. The intent is to prevent \r
+ // Succeed to open ExtPassThru Protocol, and meanwhile open PassThru Protocol\r
+ // with BY_DRIVER if it is also present on the handle. The intent is to prevent\r
// another SCSI Bus Driver to work on the same host handle.\r
//\r
ExtScsiSupport = TRUE;\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
);\r
}\r
- \r
+\r
if (Status != EFI_ALREADY_STARTED) {\r
//\r
// Go through here means either ExtPassThru or PassThru Protocol is successfully opened\r
if (ScsiBusDev->ExtScsiSupport) {\r
ScsiBusDev->ExtScsiInterface = ExtScsiInterface;\r
} else {\r
- ScsiBusDev->ScsiInterface = ScsiInterface; \r
+ ScsiBusDev->ScsiInterface = ScsiInterface;\r
}\r
\r
//\r
// Install EFI_SCSI_BUS_PROTOCOL to the controller handle, So ScsiBusDev could be\r
// retrieved on this controller handle. With ScsiBusDev, we can know which PassThru\r
// Protocol is present on the handle, UEFI ExtPassThru Protocol or EFI PassThru Protocol.\r
- // \r
+ //\r
Status = gBS->InstallProtocolInterface (\r
&Controller,\r
&gEfiCallerIdGuid,\r
Lun = 0;\r
if (RemainingDevicePath == NULL) {\r
//\r
- // If RemainingDevicePath is NULL, \r
+ // If RemainingDevicePath is NULL,\r
// must enumerate all SCSI devices anyway\r
//\r
FromFirstTarget = TRUE;\r
} else if (!IsDevicePathEnd (RemainingDevicePath)) {\r
//\r
- // If RemainingDevicePath isn't the End of Device Path Node, \r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
// only scan the specified device by RemainingDevicePath\r
//\r
if (ScsiBusDev->ExtScsiSupport) {\r
- Status = ScsiBusDev->ExtScsiInterface->GetTargetLun (ScsiBusDev->ExtScsiInterface, RemainingDevicePath, &TargetId, &Lun); \r
+ Status = ScsiBusDev->ExtScsiInterface->GetTargetLun (ScsiBusDev->ExtScsiInterface, RemainingDevicePath, &TargetId, &Lun);\r
} else {\r
Status = ScsiBusDev->ScsiInterface->GetTargetLun (ScsiBusDev->ScsiInterface, RemainingDevicePath, &ScsiTargetId.ScsiId.Scsi, &Lun);\r
}\r
//\r
// If RemainingDevicePath is the End of Device Path Node,\r
// skip enumerate any device and return EFI_SUCESSS\r
- // \r
+ //\r
ScanOtherPuns = FALSE;\r
}\r
\r
return EFI_SUCCESS;\r
\r
ErrorExit:\r
- \r
+\r
if (ScsiBusDev != NULL) {\r
FreePool (ScsiBusDev);\r
}\r
- \r
+\r
if (ExtScsiSupport) {\r
gBS->CloseProtocol (\r
Controller,\r
restrictions for this service. DisconnectController() must follow these\r
calling restrictions. If any other agent wishes to call Stop() it must also\r
follow these calling restrictions.\r
- \r
+\r
@param This Protocol instance pointer.\r
@param ControllerHandle Handle of device to stop driver on\r
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
);\r
//\r
// When Start() succeeds to open ExtPassThru, it always tries to open PassThru BY_DRIVER.\r
- // Its intent is to prevent another SCSI Bus Driver from woking on the same host handle. \r
+ // Its intent is to prevent another SCSI Bus Driver from woking on the same host handle.\r
// So Stop() needs to try to close PassThru if present here.\r
//\r
gBS->CloseProtocol (\r
\r
@param This Protocol instance pointer.\r
@param DeviceType A pointer to the device type information retrieved from\r
- the SCSI Controller. \r
+ the SCSI Controller.\r
\r
@retval EFI_SUCCESS Retrieves the device type information successfully.\r
@retval EFI_INVALID_PARAMETER The DeviceType is NULL.\r
- \r
+\r
**/\r
EFI_STATUS\r
EFIAPI\r
@retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.\r
@retval EFI_UNSUPPORTED The bus reset operation is not supported by the\r
SCSI Host Controller.\r
- @retval EFI_TIMEOUT A timeout occurred while attempting to reset \r
+ @retval EFI_TIMEOUT A timeout occurred while attempting to reset\r
the SCSI bus.\r
**/\r
EFI_STATUS\r
(EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET),\r
ScsiIoDevice->ScsiBusDeviceData->DevicePath\r
);\r
- \r
+\r
CopyMem (Target,&ScsiIoDevice->Pun, TARGET_MAX_BYTES);\r
\r
\r
Sends a SCSI Request Packet to the SCSI Controller for execution.\r
\r
@param This Protocol instance pointer.\r
- @param CommandPacket The SCSI request packet to send to the SCSI \r
+ @param CommandPacket The SCSI request packet to send to the SCSI\r
Controller specified by the device handle.\r
@param 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
+ 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
+ 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
\r
- @retval 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
+ @retval 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
- @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, \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. See HostAdapterStatus, \r
- TargetStatus, SenseDataLength, and SenseData in \r
+ in TransferLength. See HostAdapterStatus,\r
+ TargetStatus, SenseDataLength, and SenseData in\r
that order for additional status information.\r
- @retval EFI_NOT_READY The SCSI Request Packet could not be sent because \r
- there are too many SCSI Command Packets already \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.The caller may retry again later.\r
- @retval 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
+ @retval 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
- @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. \r
- The SCSI Request Packet was not sent, so no \r
+ @retval 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
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet\r
- is not supported by the SCSI initiator(i.e., SCSI \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
+ sent, so no additional status information is\r
available.\r
- @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI \r
+ @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI\r
Request Packet to execute. See HostAdapterStatus,\r
- TargetStatus, SenseDataLength, and SenseData in \r
+ TargetStatus, SenseDataLength, and SenseData in\r
that order for additional status information.\r
**/\r
EFI_STATUS\r
UINT8 Target[TARGET_MAX_BYTES];\r
EFI_EVENT PacketEvent;\r
EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ExtRequestPacket;\r
- SCSI_EVENT_DATA EventData; \r
+ SCSI_EVENT_DATA EventData;\r
\r
PacketEvent = NULL;\r
- \r
+\r
if (Packet == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
return EFI_SUCCESS;\r
\r
ErrorExit:\r
- \r
+\r
//\r
// The memory space for ScsiDevicePath is allocated in\r
// ScsiPassThru->BuildDevicePath() function; It is no longer used\r
ScsiDeviceFound = FALSE;\r
goto Done;\r
}\r
- \r
+\r
//\r
// Retrieved inquiry data successfully\r
//\r