Code Scrub:
MdeModulePkg\Bus\ScsiBusDxe\ MdeModulePkg\Bus\ScsiDisk\ git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6465 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -13,25 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <Protocol/ScsiPassThru.h>
|
|
||||||
#include <Protocol/ScsiPassThruExt.h>
|
|
||||||
#include <Protocol/ScsiIo.h>
|
|
||||||
#include <Protocol/ComponentName.h>
|
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
#include <Protocol/DevicePath.h>
|
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/ScsiLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/DevicePathLib.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "ScsiBus.h"
|
#include "ScsiBus.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -68,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[]
|
|||||||
by This does not support the language specified by Language,
|
by This does not support the language specified by Language,
|
||||||
then EFI_UNSUPPORTED is returned.
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -80,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[]
|
|||||||
to the driver writer. Language is specified
|
to the driver writer. Language is specified
|
||||||
in RFC 3066 or ISO 639-2 language code format.
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param DriverName[out] A pointer to the Unicode string to return.
|
@param DriverName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
driver specified by This in the language
|
driver specified by This in the language
|
||||||
specified by Language.
|
specified by Language.
|
||||||
@@ -127,15 +108,15 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param ControllerHandle[in] The handle of a controller that the driver
|
@param ControllerHandle The handle of a controller that the driver
|
||||||
specified by This is managing. This handle
|
specified by This is managing. This handle
|
||||||
specifies the controller whose name is to be
|
specifies the controller whose name is to be
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
@param ChildHandle The handle of the child controller to retrieve
|
||||||
the name of. This is an optional parameter that
|
the name of. This is an optional parameter that
|
||||||
may be NULL. It will be NULL for device
|
may be NULL. It will be NULL for device
|
||||||
drivers. It will also be NULL for a bus drivers
|
drivers. It will also be NULL for a bus drivers
|
||||||
@@ -144,7 +125,7 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
driver that wishes to retrieve the name of a
|
driver that wishes to retrieve the name of a
|
||||||
child controller.
|
child controller.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -153,7 +134,7 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
to the driver writer. Language is specified in
|
to the driver writer. Language is specified in
|
||||||
RFC 3066 or ISO 639-2 language code format.
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
@param ControllerName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
controller specified by ControllerHandle and
|
controller specified by ControllerHandle and
|
||||||
ChildHandle in the language specified by
|
ChildHandle in the language specified by
|
||||||
|
@@ -14,27 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <Protocol/ScsiPassThru.h>
|
|
||||||
#include <Protocol/ScsiPassThruExt.h>
|
|
||||||
#include <Protocol/ScsiIo.h>
|
|
||||||
#include <Protocol/ComponentName.h>
|
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
#include <Protocol/DevicePath.h>
|
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/ScsiLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/DevicePathLib.h>
|
|
||||||
|
|
||||||
#include "ScsiBus.h"
|
#include "ScsiBus.h"
|
||||||
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
|
EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
|
||||||
SCSIBusDriverBindingSupported,
|
SCSIBusDriverBindingSupported,
|
||||||
SCSIBusDriverBindingStart,
|
SCSIBusDriverBindingStart,
|
||||||
@@ -52,37 +34,59 @@ EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
|
|||||||
//
|
//
|
||||||
EFI_GUID mScsiBusProtocolGuid = EFI_SCSI_BUS_PROTOCOL_GUID;
|
EFI_GUID mScsiBusProtocolGuid = EFI_SCSI_BUS_PROTOCOL_GUID;
|
||||||
|
|
||||||
VOID *WorkingBuffer;
|
VOID *mWorkingBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet.
|
||||||
|
|
||||||
|
@param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
||||||
|
@param CommandPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiioToPassThruPacket (
|
ScsiioToPassThruPacket (
|
||||||
IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
||||||
IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket
|
OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet.
|
||||||
|
|
||||||
|
@param ScsiPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
||||||
|
@param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PassThruToScsiioPacket (
|
PassThruToScsiioPacket (
|
||||||
IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket,
|
IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket,
|
||||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet
|
OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0
|
||||||
|
SCSI IO Packet.
|
||||||
|
|
||||||
|
@param Event The instance of EFI_EVENT.
|
||||||
|
@param Context The parameter passed in.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
NotifyFunction (
|
NotifyFunction (
|
||||||
EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The user Entry Point for module ScsiBus. The user code starts with this function.
|
The user Entry Point for module ScsiBus. The user code starts with this function.
|
||||||
|
|
||||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||||
@param[in] SystemTable A pointer to the EFI System Table.
|
@param SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||||
@retval other Some error occurs when executing this entry point.
|
@retval other Some error occurs when executing this entry point.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@@ -110,6 +114,26 @@ InitializeScsiBus(
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Test to see if this driver supports ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service ConnectController(). In order
|
||||||
|
to make drivers as small as possible, there are a few calling restrictions for
|
||||||
|
this service. ConnectController() must follow these calling restrictions. If
|
||||||
|
any other agent wishes to call Supported() it must also follow these calling
|
||||||
|
restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to test
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver supports this device
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingSupported (
|
SCSIBusDriverBindingSupported (
|
||||||
@@ -117,26 +141,6 @@ SCSIBusDriverBindingSupported (
|
|||||||
IN EFI_HANDLE Controller,
|
IN EFI_HANDLE Controller,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Test to see if this driver supports ControllerHandle. Any ControllerHandle
|
|
||||||
that has ExtScsiPassThruProtocol/ScsiPassThruProtocol installed will be supported.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
Controller - Handle of device to test
|
|
||||||
RemainingDevicePath - Not used
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - This driver supports this device.
|
|
||||||
EFI_UNSUPPORTED - This driver does not support this device.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_SCSI_PASS_THRU_PROTOCOL *PassThru;
|
EFI_SCSI_PASS_THRU_PROTOCOL *PassThru;
|
||||||
@@ -194,6 +198,26 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Start this driver on ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service ConnectController(). In order
|
||||||
|
to make drivers as small as possible, there are a few calling restrictions for
|
||||||
|
this service. ConnectController() must follow these calling restrictions. If
|
||||||
|
any other agent wishes to call Start() it must also follow these calling
|
||||||
|
restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to bind driver to
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver is added to ControllerHandle
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingStart (
|
SCSIBusDriverBindingStart (
|
||||||
@@ -201,22 +225,6 @@ SCSIBusDriverBindingStart (
|
|||||||
IN EFI_HANDLE Controller,
|
IN EFI_HANDLE Controller,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Starting the SCSI Bus Driver
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
Controller - Handle of device to test
|
|
||||||
RemainingDevicePath - Not used
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - This driver supports this device.
|
|
||||||
EFI_UNSUPPORTED - This driver does not support this device.
|
|
||||||
EFI_DEVICE_ERROR - This driver cannot be started due to device Error
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT64 Lun;
|
UINT64 Lun;
|
||||||
UINT8 *TargetId;
|
UINT8 *TargetId;
|
||||||
@@ -239,7 +247,7 @@ Returns:
|
|||||||
FromFirstTarget = FALSE;
|
FromFirstTarget = FALSE;
|
||||||
ExtScsiSupport = FALSE;
|
ExtScsiSupport = FALSE;
|
||||||
PassThruStatus = EFI_SUCCESS;
|
PassThruStatus = EFI_SUCCESS;
|
||||||
|
|
||||||
ScsiTargetId = AllocateZeroPool(sizeof(SCSI_TARGET_ID));
|
ScsiTargetId = AllocateZeroPool(sizeof(SCSI_TARGET_ID));
|
||||||
if (ScsiTargetId == NULL) {
|
if (ScsiTargetId == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@@ -419,7 +427,7 @@ Returns:
|
|||||||
//
|
//
|
||||||
Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev);
|
Status = ScsiScanCreateDevice (This, Controller, ScsiTargetId, Lun, ScsiBusDev);
|
||||||
}
|
}
|
||||||
gBS->FreePool (ScsiTargetId);
|
FreePool (ScsiTargetId);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
ErrorExit:
|
ErrorExit:
|
||||||
@@ -454,6 +462,25 @@ ErrorExit:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Stop this driver on ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service DisconnectController().
|
||||||
|
In order to make drivers as small as possible, there are a few calling
|
||||||
|
restrictions for this service. DisconnectController() must follow these
|
||||||
|
calling restrictions. If any other agent wishes to call Stop() it must also
|
||||||
|
follow these calling restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to stop driver on
|
||||||
|
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
||||||
|
children is zero stop the entire bus driver.
|
||||||
|
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver is removed ControllerHandle
|
||||||
|
@retval other This driver was not removed from this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingStop (
|
SCSIBusDriverBindingStop (
|
||||||
@@ -462,25 +489,6 @@ SCSIBusDriverBindingStop (
|
|||||||
IN UINTN NumberOfChildren,
|
IN UINTN NumberOfChildren,
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
IN EFI_HANDLE *ChildHandleBuffer
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Stop this driver on ControllerHandle. Support stoping any child handles
|
|
||||||
created by this driver.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
Controller - Handle of device to stop driver on
|
|
||||||
NumberOfChildren - Number of Children in the ChildHandleBuffer
|
|
||||||
ChildHandleBuffer - List of handles for the children we need to stop.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS
|
|
||||||
Others
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN AllChildrenStopped;
|
BOOLEAN AllChildrenStopped;
|
||||||
@@ -627,30 +635,24 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the device type information of the SCSI Controller.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param DeviceType A pointer to the device type information retrieved from
|
||||||
|
the SCSI Controller.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Retrieves the device type information successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The DeviceType is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiGetDeviceType (
|
ScsiGetDeviceType (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||||
OUT UINT8 *DeviceType
|
OUT UINT8 *DeviceType
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Retrieves the device type information of the SCSI Controller.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
DeviceType - A pointer to the device type information
|
|
||||||
retrieved from the SCSI Controller.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Retrieves the device type information successfully.
|
|
||||||
EFI_INVALID_PARAMETER - The DeviceType is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
|
|
||||||
@@ -663,6 +665,20 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the device location in the SCSI channel.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param Target A pointer to the Target ID of a SCSI device
|
||||||
|
on the SCSI channel.
|
||||||
|
@param Lun A pointer to the LUN of the SCSI device on
|
||||||
|
the SCSI channel.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Retrieves the device location successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The Target or Lun is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiGetDeviceLocation (
|
ScsiGetDeviceLocation (
|
||||||
@@ -670,26 +686,6 @@ ScsiGetDeviceLocation (
|
|||||||
IN OUT UINT8 **Target,
|
IN OUT UINT8 **Target,
|
||||||
OUT UINT64 *Lun
|
OUT UINT64 *Lun
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Retrieves the device location in the SCSI channel.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
Target - A pointer to the Target Array which represents ID of a SCSI device
|
|
||||||
on the SCSI channel.
|
|
||||||
Lun - A pointer to the LUN of the SCSI device on
|
|
||||||
the SCSI channel.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Retrieves the device location successfully.
|
|
||||||
EFI_INVALID_PARAMETER - The Target or Lun is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
|
|
||||||
@@ -706,30 +702,23 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets the SCSI Bus that the SCSI Controller is attached to.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The SCSI bus is reset successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.
|
||||||
|
@retval EFI_UNSUPPORTED The bus reset operation is not supported by the
|
||||||
|
SCSI Host Controller.
|
||||||
|
@retval EFI_TIMEOUT A timeout occurred while attempting to reset
|
||||||
|
the SCSI bus.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiResetBus (
|
ScsiResetBus (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This
|
IN EFI_SCSI_IO_PROTOCOL *This
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Resets the SCSI Bus that the SCSI Controller is attached to.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The SCSI bus is reset successfully.
|
|
||||||
EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
|
|
||||||
EFI_UNSUPPORTED - The bus reset operation is not supported by the
|
|
||||||
SCSI Host Controller.
|
|
||||||
EFI_TIMEOUT - A timeout occurred while attempting to reset
|
|
||||||
the SCSI bus.
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
|
|
||||||
@@ -742,31 +731,23 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets the SCSI Controller that the device handle specifies.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Reset the SCSI controller successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Errors are encountered when resetting the SCSI Controller.
|
||||||
|
@retval EFI_UNSUPPORTED The SCSI bus does not support a device reset operation.
|
||||||
|
@retval EFI_TIMEOUT A timeout occurred while attempting to reset the
|
||||||
|
SCSI Controller.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiResetDevice (
|
ScsiResetDevice (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This
|
IN EFI_SCSI_IO_PROTOCOL *This
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Resets the SCSI Controller that the device handle specifies.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Reset the SCSI controller successfully.
|
|
||||||
EFI_DEVICE_ERROR - Errors are encountered when resetting the
|
|
||||||
SCSI Controller.
|
|
||||||
EFI_UNSUPPORTED - The SCSI bus does not support a device
|
|
||||||
reset operation.
|
|
||||||
EFI_TIMEOUT - A timeout occurred while attempting to
|
|
||||||
reset the SCSI Controller.
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
UINT8 Target[TARGET_MAX_BYTES];
|
UINT8 Target[TARGET_MAX_BYTES];
|
||||||
@@ -790,25 +771,14 @@ Returns:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
ScsiExecuteSCSICommand (
|
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
|
||||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
|
||||||
IN EFI_EVENT Event OPTIONAL
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
/**
|
||||||
Sends a SCSI Request Packet to the SCSI Controller for execution.
|
Sends a SCSI Request Packet to the SCSI Controller for execution.
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
Packet - The SCSI request packet to send to the SCSI
|
@param CommandPacket The SCSI request packet to send to the SCSI
|
||||||
Controller specified by the device handle.
|
Controller specified by the device handle.
|
||||||
Event - If the SCSI bus where the SCSI device is attached
|
@param Event If the SCSI bus where the SCSI device is attached
|
||||||
does not support non-blocking I/O, then Event is
|
does not support non-blocking I/O, then Event is
|
||||||
ignored, and blocking I/O is performed.
|
ignored, and blocking I/O is performed.
|
||||||
If Event is NULL, then blocking I/O is performed.
|
If Event is NULL, then blocking I/O is performed.
|
||||||
@@ -816,40 +786,46 @@ Arguments:
|
|||||||
supported, then non-blocking I/O is performed,
|
supported, then non-blocking I/O is performed,
|
||||||
and Event will be signaled when the SCSI Request
|
and Event will be signaled when the SCSI Request
|
||||||
Packet completes.
|
Packet completes.
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The SCSI Request Packet was sent by the host
|
@retval EFI_SUCCESS The SCSI Request Packet was sent by the host
|
||||||
successfully, and TransferLength bytes were
|
successfully, and TransferLength bytes were
|
||||||
transferred to/from DataBuffer.See
|
transferred to/from DataBuffer.See
|
||||||
HostAdapterStatus, TargetStatus,
|
HostAdapterStatus, TargetStatus,
|
||||||
SenseDataLength, and SenseData in that order
|
SenseDataLength, and SenseData in that order
|
||||||
for additional status information.
|
for additional status information.
|
||||||
EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed,
|
@retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,
|
||||||
but the entire DataBuffer could not be transferred.
|
but the entire DataBuffer could not be transferred.
|
||||||
The actual number of bytes transferred is returned
|
The actual number of bytes transferred is returned
|
||||||
in TransferLength. See HostAdapterStatus,
|
in TransferLength. See HostAdapterStatus,
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
that order for additional status information.
|
that order for additional status information.
|
||||||
EFI_NOT_READY - The SCSI Request Packet could not be sent because
|
@retval EFI_NOT_READY The SCSI Request Packet could not be sent because
|
||||||
there are too many SCSI Command Packets already
|
there are too many SCSI Command Packets already
|
||||||
queued.The caller may retry again later.
|
queued.The caller may retry again later.
|
||||||
EFI_DEVICE_ERROR - A device error occurred while attempting to send
|
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
|
||||||
the SCSI Request Packet. See HostAdapterStatus,
|
the SCSI Request Packet. See HostAdapterStatus,
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
that order for additional status information.
|
that order for additional status information.
|
||||||
EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
|
@retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
|
||||||
The SCSI Request Packet was not sent, so no
|
The SCSI Request Packet was not sent, so no
|
||||||
additional status information is available.
|
additional status information is available.
|
||||||
EFI_UNSUPPORTED - The command described by the SCSI Request Packet
|
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
|
||||||
is not supported by the SCSI initiator(i.e., SCSI
|
is not supported by the SCSI initiator(i.e., SCSI
|
||||||
Host Controller). The SCSI Request Packet was not
|
Host Controller). The SCSI Request Packet was not
|
||||||
sent, so no additional status information is
|
sent, so no additional status information is
|
||||||
available.
|
available.
|
||||||
EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
|
@retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
|
||||||
Request Packet to execute. See HostAdapterStatus,
|
Request Packet to execute. See HostAdapterStatus,
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
that order for additional status information.
|
that order for additional status information.
|
||||||
--*/
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ScsiExecuteSCSICommand (
|
||||||
|
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||||
|
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
||||||
|
IN EFI_EVENT Event OPTIONAL
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@@ -881,7 +857,7 @@ Returns:
|
|||||||
Status = gBS->AllocatePool (
|
Status = gBS->AllocatePool (
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET),
|
sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET),
|
||||||
(VOID**)&WorkingBuffer
|
(VOID**)&mWorkingBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@@ -891,9 +867,9 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Convert package into EFI1.0, EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET.
|
// Convert package into EFI1.0, EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET.
|
||||||
//
|
//
|
||||||
Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer);
|
Status = ScsiioToPassThruPacket(Packet, (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
gBS->FreePool(WorkingBuffer);
|
FreePool(mWorkingBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -911,7 +887,7 @@ Returns:
|
|||||||
&PacketEvent
|
&PacketEvent
|
||||||
);
|
);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
gBS->FreePool(WorkingBuffer);
|
FreePool(mWorkingBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,12 +895,12 @@ Returns:
|
|||||||
ScsiIoDevice->ScsiPassThru,
|
ScsiIoDevice->ScsiPassThru,
|
||||||
ScsiIoDevice->Pun.ScsiId.Scsi,
|
ScsiIoDevice->Pun.ScsiId.Scsi,
|
||||||
ScsiIoDevice->Lun,
|
ScsiIoDevice->Lun,
|
||||||
WorkingBuffer,
|
mWorkingBuffer,
|
||||||
PacketEvent
|
PacketEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
gBS->FreePool(WorkingBuffer);
|
gBS->FreePool(mWorkingBuffer);
|
||||||
gBS->CloseEvent(PacketEvent);
|
gBS->CloseEvent(PacketEvent);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -938,70 +914,59 @@ Returns:
|
|||||||
ScsiIoDevice->ScsiPassThru,
|
ScsiIoDevice->ScsiPassThru,
|
||||||
ScsiIoDevice->Pun.ScsiId.Scsi,
|
ScsiIoDevice->Pun.ScsiId.Scsi,
|
||||||
ScsiIoDevice->Lun,
|
ScsiIoDevice->Lun,
|
||||||
WorkingBuffer,
|
mWorkingBuffer,
|
||||||
Event
|
Event
|
||||||
);
|
);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
gBS->FreePool(WorkingBuffer);
|
FreePool(mWorkingBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer,Packet);
|
PassThruToScsiioPacket((EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer,Packet);
|
||||||
//
|
//
|
||||||
// After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,
|
// After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,
|
||||||
// free WorkingBuffer.
|
// free mWorkingBuffer.
|
||||||
//
|
//
|
||||||
gBS->FreePool(WorkingBuffer);
|
FreePool(mWorkingBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer
|
||||||
|
@param Controller Controller handle
|
||||||
|
@param TargetId Tartget to be scanned
|
||||||
|
@param Lun The Lun of the SCSI device on the SCSI channel.
|
||||||
|
@param ScsiBusDev The pointer of SCSI_BUS_DEVICE
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully to discover the device and attach
|
||||||
|
ScsiIoProtocol to it.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Fail to discover the device.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiScanCreateDevice (
|
ScsiScanCreateDevice (
|
||||||
EFI_DRIVER_BINDING_PROTOCOL *This,
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
EFI_HANDLE Controller,
|
IN EFI_HANDLE Controller,
|
||||||
SCSI_TARGET_ID *TargetId,
|
IN SCSI_TARGET_ID *TargetId,
|
||||||
UINT64 Lun,
|
IN UINT64 Lun,
|
||||||
SCSI_BUS_DEVICE *ScsiBusDev
|
IN OUT SCSI_BUS_DEVICE *ScsiBusDev
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer
|
|
||||||
Controller - Controller handle
|
|
||||||
Pun - The Pun of the SCSI device on the SCSI channel.
|
|
||||||
Lun - The Lun of the SCSI device on the SCSI channel.
|
|
||||||
ScsiBusDev - The pointer of SCSI_BUS_DEVICE
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Successfully to discover the device and attach ScsiIoProtocol to it.
|
|
||||||
EFI_OUT_OF_RESOURCES - Fail to discover the device.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
SCSI_IO_DEV *ScsiIoDevice;
|
SCSI_IO_DEV *ScsiIoDevice;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *ScsiDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *ScsiDevicePath;
|
||||||
|
|
||||||
Status = gBS->AllocatePool (
|
ScsiIoDevice = AllocateZeroPool (sizeof (SCSI_IO_DEV));
|
||||||
EfiBootServicesData,
|
if (ScsiIoDevice == NULL) {
|
||||||
sizeof (SCSI_IO_DEV),
|
return EFI_OUT_OF_RESOURCES;
|
||||||
(VOID **) &ScsiIoDevice
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (ScsiIoDevice, sizeof (SCSI_IO_DEV));
|
|
||||||
|
|
||||||
ScsiIoDevice->Signature = SCSI_IO_DEV_SIGNATURE;
|
ScsiIoDevice->Signature = SCSI_IO_DEV_SIGNATURE;
|
||||||
CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);
|
CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);
|
||||||
ScsiIoDevice->Lun = Lun;
|
ScsiIoDevice->Lun = Lun;
|
||||||
@@ -1025,7 +990,7 @@ Returns:
|
|||||||
|
|
||||||
|
|
||||||
if (!DiscoverScsiDevice (ScsiIoDevice)) {
|
if (!DiscoverScsiDevice (ScsiIoDevice)) {
|
||||||
gBS->FreePool (ScsiIoDevice);
|
FreePool (ScsiIoDevice);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1040,7 +1005,7 @@ Returns:
|
|||||||
&ScsiDevicePath
|
&ScsiDevicePath
|
||||||
);
|
);
|
||||||
if (Status == EFI_OUT_OF_RESOURCES) {
|
if (Status == EFI_OUT_OF_RESOURCES) {
|
||||||
gBS->FreePool (ScsiIoDevice);
|
FreePool (ScsiIoDevice);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1051,7 +1016,7 @@ Returns:
|
|||||||
&ScsiDevicePath
|
&ScsiDevicePath
|
||||||
);
|
);
|
||||||
if (Status == EFI_OUT_OF_RESOURCES) {
|
if (Status == EFI_OUT_OF_RESOURCES) {
|
||||||
gBS->FreePool (ScsiIoDevice);
|
FreePool (ScsiIoDevice);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1107,27 +1072,20 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
EFIAPI
|
|
||||||
DiscoverScsiDevice (
|
|
||||||
SCSI_IO_DEV *ScsiIoDevice
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
/**
|
||||||
Discovery SCSI Device
|
Discovery SCSI Device
|
||||||
|
|
||||||
Arguments:
|
@param ScsiIoDevice The pointer of SCSI_IO_DEV
|
||||||
|
|
||||||
ScsiIoDevice - The pointer of SCSI_IO_DEV
|
@retval TRUE Find SCSI Device and verify it.
|
||||||
|
@retval FALSE Unable to find SCSI Device.
|
||||||
|
|
||||||
Returns:
|
**/
|
||||||
|
BOOLEAN
|
||||||
TRUE - Find SCSI Device and verify it.
|
DiscoverScsiDevice (
|
||||||
FALSE - Unable to find SCSI Device.
|
IN OUT SCSI_IO_DEV *ScsiIoDevice
|
||||||
|
)
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 InquiryDataLength;
|
UINT32 InquiryDataLength;
|
||||||
@@ -1157,9 +1115,6 @@ Returns:
|
|||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
//
|
|
||||||
// ParseSenseData (&SenseData,SenseDataLength);
|
|
||||||
//
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -1198,29 +1153,19 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet.
|
||||||
|
|
||||||
|
@param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
||||||
|
@param CommandPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiioToPassThruPacket (
|
ScsiioToPassThruPacket (
|
||||||
IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
IN EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
||||||
IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket
|
OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *CommandPacket
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Convert EFI_SCSI_IO_SCSI_REQUEST_PACKET packet to
|
|
||||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Packet - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
|
||||||
CommandPacket - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
NONE
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
//EFI 1.10 doesn't support Bi-Direction Command.
|
//EFI 1.10 doesn't support Bi-Direction Command.
|
||||||
@@ -1251,29 +1196,19 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to EFI_SCSI_IO_SCSI_REQUEST_PACKET packet.
|
||||||
|
|
||||||
|
@param ScsiPacket The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
||||||
|
@param Packet The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PassThruToScsiioPacket (
|
PassThruToScsiioPacket (
|
||||||
IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket,
|
IN EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket,
|
||||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet
|
OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Convert EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET packet to
|
|
||||||
EFI_SCSI_IO_SCSI_REQUEST_PACKET packet
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ScsiPacket - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET
|
|
||||||
Packet - The pointer of EFI_SCSI_IO_SCSI_REQUEST_PACKET
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
NONE
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
Packet->Timeout = ScsiPacket->Timeout;
|
Packet->Timeout = ScsiPacket->Timeout;
|
||||||
Packet->Cdb = ScsiPacket->Cdb;
|
Packet->Cdb = ScsiPacket->Cdb;
|
||||||
@@ -1295,31 +1230,20 @@ Returns:
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
NotifyFunction (
|
|
||||||
EFI_EVENT Event,
|
|
||||||
VOID *Context
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0
|
Notify Function in which convert EFI1.0 PassThru Packet back to UEF2.0
|
||||||
SCSI IO Packet.
|
SCSI IO Packet.
|
||||||
|
|
||||||
Arguments:
|
@param Event The instance of EFI_EVENT.
|
||||||
|
@param Context The parameter passed in.
|
||||||
|
|
||||||
Event - The instance of EFI_EVENT.
|
**/
|
||||||
Context - The parameter passed in.
|
VOID
|
||||||
|
EFIAPI
|
||||||
Returns:
|
NotifyFunction (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
NONE
|
IN VOID *Context
|
||||||
|
)
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet;
|
EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet;
|
||||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket;
|
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *ScsiPacket;
|
||||||
@@ -1328,7 +1252,7 @@ Returns:
|
|||||||
|
|
||||||
PassData = (SCSI_EVENT_DATA*)Context;
|
PassData = (SCSI_EVENT_DATA*)Context;
|
||||||
Packet = (EFI_SCSI_IO_SCSI_REQUEST_PACKET *)PassData->Data1;
|
Packet = (EFI_SCSI_IO_SCSI_REQUEST_PACKET *)PassData->Data1;
|
||||||
ScsiPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)WorkingBuffer;
|
ScsiPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET*)mWorkingBuffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert EFI1.0 PassThru packet to UEFI2.0 SCSI IO Packet.
|
// Convert EFI1.0 PassThru packet to UEFI2.0 SCSI IO Packet.
|
||||||
@@ -1337,9 +1261,9 @@ Returns:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,
|
// After converting EFI1.0 PassThru Packet back to UEFI2.0 SCSI IO Packet,
|
||||||
// free WorkingBuffer.
|
// free mWorkingBuffer.
|
||||||
//
|
//
|
||||||
gBS->FreePool(WorkingBuffer);
|
gBS->FreePool(mWorkingBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signal Event to tell caller to pick up UEFI2.0 SCSI IO Packet.
|
// Signal Event to tell caller to pick up UEFI2.0 SCSI IO Packet.
|
||||||
@@ -1348,3 +1272,4 @@ Returns:
|
|||||||
gBS->CloseEvent(Event);
|
gBS->CloseEvent(Event);
|
||||||
gBS->SignalEvent(CallerEvent);
|
gBS->SignalEvent(CallerEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,10 +12,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _SCSI_BUS_H
|
#ifndef _SCSI_BUS_H_
|
||||||
#define _SCSI_BUS_H
|
#define _SCSI_BUS_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
|
||||||
|
#include <Protocol/ScsiPassThru.h>
|
||||||
|
#include <Protocol/ScsiPassThruExt.h>
|
||||||
|
#include <Protocol/ScsiIo.h>
|
||||||
|
#include <Protocol/ComponentName.h>
|
||||||
|
#include <Protocol/DriverBinding.h>
|
||||||
|
#include <Protocol/DevicePath.h>
|
||||||
|
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
|
#include <Library/UefiLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
#include <Library/ScsiLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/DevicePathLib.h>
|
||||||
|
|
||||||
#include <IndustryStandard/Scsi.h>
|
#include <IndustryStandard/Scsi.h>
|
||||||
//
|
//
|
||||||
// 1000 * 1000 * 10
|
// 1000 * 1000 * 10
|
||||||
@@ -89,6 +107,25 @@ extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding;
|
|||||||
extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName;
|
extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName;
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2;
|
extern EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Test to see if this driver supports ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service ConnectController(). In order
|
||||||
|
to make drivers as small as possible, there are a few calling restrictions for
|
||||||
|
this service. ConnectController() must follow these calling restrictions. If
|
||||||
|
any other agent wishes to call Supported() it must also follow these calling
|
||||||
|
restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to test
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver supports this device
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingSupported (
|
SCSIBusDriverBindingSupported (
|
||||||
@@ -97,6 +134,25 @@ SCSIBusDriverBindingSupported (
|
|||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Start this driver on ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service ConnectController(). In order
|
||||||
|
to make drivers as small as possible, there are a few calling restrictions for
|
||||||
|
this service. ConnectController() must follow these calling restrictions. If
|
||||||
|
any other agent wishes to call Start() it must also follow these calling
|
||||||
|
restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to bind driver to
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver is added to ControllerHandle
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingStart (
|
SCSIBusDriverBindingStart (
|
||||||
@@ -105,6 +161,25 @@ SCSIBusDriverBindingStart (
|
|||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Stop this driver on ControllerHandle.
|
||||||
|
|
||||||
|
This service is called by the EFI boot service DisconnectController().
|
||||||
|
In order to make drivers as small as possible, there are a few calling
|
||||||
|
restrictions for this service. DisconnectController() must follow these
|
||||||
|
calling restrictions. If any other agent wishes to call Stop() it must also
|
||||||
|
follow these calling restrictions.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to stop driver on
|
||||||
|
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
||||||
|
children is zero stop the entire bus driver.
|
||||||
|
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS This driver is removed ControllerHandle
|
||||||
|
@retval other This driver was not removed from this device
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SCSIBusDriverBindingStop (
|
SCSIBusDriverBindingStop (
|
||||||
@@ -127,10 +202,10 @@ SCSIBusDriverBindingStop (
|
|||||||
by This does not support the language specified by Language,
|
by This does not support the language specified by Language,
|
||||||
then EFI_UNSUPPORTED is returned.
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -139,7 +214,7 @@ SCSIBusDriverBindingStop (
|
|||||||
to the driver writer. Language is specified
|
to the driver writer. Language is specified
|
||||||
in RFC 3066 or ISO 639-2 language code format.
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param DriverName[out] A pointer to the Unicode string to return.
|
@param DriverName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
driver specified by This in the language
|
driver specified by This in the language
|
||||||
specified by Language.
|
specified by Language.
|
||||||
@@ -164,7 +239,6 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@@ -178,15 +252,15 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param ControllerHandle[in] The handle of a controller that the driver
|
@param ControllerHandle The handle of a controller that the driver
|
||||||
specified by This is managing. This handle
|
specified by This is managing. This handle
|
||||||
specifies the controller whose name is to be
|
specifies the controller whose name is to be
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
@param ChildHandle The handle of the child controller to retrieve
|
||||||
the name of. This is an optional parameter that
|
the name of. This is an optional parameter that
|
||||||
may be NULL. It will be NULL for device
|
may be NULL. It will be NULL for device
|
||||||
drivers. It will also be NULL for a bus drivers
|
drivers. It will also be NULL for a bus drivers
|
||||||
@@ -195,7 +269,7 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
driver that wishes to retrieve the name of a
|
driver that wishes to retrieve the name of a
|
||||||
child controller.
|
child controller.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -204,7 +278,7 @@ ScsiBusComponentNameGetDriverName (
|
|||||||
to the driver writer. Language is specified in
|
to the driver writer. Language is specified in
|
||||||
RFC 3066 or ISO 639-2 language code format.
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
@param ControllerName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
controller specified by ControllerHandle and
|
controller specified by ControllerHandle and
|
||||||
ChildHandle in the language specified by
|
ChildHandle in the language specified by
|
||||||
@@ -243,107 +317,87 @@ ScsiBusComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves the device type information of the SCSI Controller.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param DeviceType A pointer to the device type information retrieved from
|
||||||
|
the SCSI Controller.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Retrieves the device type information successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The DeviceType is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiGetDeviceType (
|
ScsiGetDeviceType (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||||
OUT UINT8 *DeviceType
|
OUT UINT8 *DeviceType
|
||||||
)
|
);
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
/**
|
||||||
|
Retrieves the device location in the SCSI channel.
|
||||||
|
|
||||||
Retrieves the device type information of the SCSI Controller.
|
@param This Protocol instance pointer.
|
||||||
|
@param Target A pointer to the Target ID of a SCSI device
|
||||||
Arguments:
|
on the SCSI channel.
|
||||||
|
@param Lun A pointer to the LUN of the SCSI device on
|
||||||
|
the SCSI channel.
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
@retval EFI_SUCCESS Retrieves the device location successfully.
|
||||||
DeviceType - A pointer to the device type information
|
@retval EFI_INVALID_PARAMETER The Target or Lun is NULL.
|
||||||
retrieved from the SCSI Controller.
|
|
||||||
|
|
||||||
Returns:
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ScsiGetDeviceLocation (
|
||||||
|
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||||
|
IN OUT UINT8 **Target,
|
||||||
|
OUT UINT64 *Lun
|
||||||
|
);
|
||||||
|
|
||||||
EFI_SUCCESS - Retrieves the device type information successfully.
|
/**
|
||||||
EFI_INVALID_PARAMETER - The DeviceType is NULL.
|
Resets the SCSI Bus that the SCSI Controller is attached to.
|
||||||
|
|
||||||
--*/
|
@param This Protocol instance pointer.
|
||||||
;
|
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The SCSI bus is reset successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.
|
||||||
|
@retval EFI_UNSUPPORTED The bus reset operation is not supported by the
|
||||||
|
SCSI Host Controller.
|
||||||
|
@retval EFI_TIMEOUT A timeout occurred while attempting to reset
|
||||||
|
the SCSI bus.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiResetBus (
|
ScsiResetBus (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This
|
IN EFI_SCSI_IO_PROTOCOL *This
|
||||||
)
|
);
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
/**
|
||||||
|
Resets the SCSI Controller that the device handle specifies.
|
||||||
|
|
||||||
Resets the SCSI Bus that the SCSI Controller is attached to.
|
@param This Protocol instance pointer.
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The SCSI bus is reset successfully.
|
|
||||||
EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
|
|
||||||
EFI_UNSUPPORTED - The bus reset operation is not supported by the
|
|
||||||
SCSI Host Controller.
|
|
||||||
EFI_TIMEOUT - A timeout occurred while attempting to reset
|
|
||||||
the SCSI bus.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Reset the SCSI controller successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Errors are encountered when resetting the SCSI Controller.
|
||||||
|
@retval EFI_UNSUPPORTED The SCSI bus does not support a device reset operation.
|
||||||
|
@retval EFI_TIMEOUT A timeout occurred while attempting to reset the
|
||||||
|
SCSI Controller.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ScsiResetDevice (
|
ScsiResetDevice (
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This
|
IN EFI_SCSI_IO_PROTOCOL *This
|
||||||
)
|
);
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Resets the SCSI Controller that the device handle specifies.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Reset the SCSI controller successfully.
|
|
||||||
EFI_DEVICE_ERROR - Errors are encountered when resetting the
|
|
||||||
SCSI Controller.
|
|
||||||
EFI_UNSUPPORTED - The SCSI bus does not support a device
|
|
||||||
reset operation.
|
|
||||||
EFI_TIMEOUT - A timeout occurred while attempting to
|
|
||||||
reset the SCSI Controller.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
ScsiExecuteSCSICommand (
|
|
||||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
|
||||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket,
|
|
||||||
IN EFI_EVENT Event
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
/**
|
||||||
Sends a SCSI Request Packet to the SCSI Controller for execution.
|
Sends a SCSI Request Packet to the SCSI Controller for execution.
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
This - Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
Packet - The SCSI request packet to send to the SCSI
|
@param CommandPacket The SCSI request packet to send to the SCSI
|
||||||
Controller specified by the device handle.
|
Controller specified by the device handle.
|
||||||
Event - If the SCSI bus where the SCSI device is attached
|
@param Event If the SCSI bus where the SCSI device is attached
|
||||||
does not support non-blocking I/O, then Event is
|
does not support non-blocking I/O, then Event is
|
||||||
ignored, and blocking I/O is performed.
|
ignored, and blocking I/O is performed.
|
||||||
If Event is NULL, then blocking I/O is performed.
|
If Event is NULL, then blocking I/O is performed.
|
||||||
@@ -351,92 +405,83 @@ Arguments:
|
|||||||
supported, then non-blocking I/O is performed,
|
supported, then non-blocking I/O is performed,
|
||||||
and Event will be signaled when the SCSI Request
|
and Event will be signaled when the SCSI Request
|
||||||
Packet completes.
|
Packet completes.
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - The SCSI Request Packet was sent by the host
|
|
||||||
successfully, and TransferLength bytes were
|
|
||||||
transferred to/from DataBuffer.See
|
|
||||||
HostAdapterStatus, TargetStatus,
|
|
||||||
SenseDataLength, and SenseData in that order
|
|
||||||
for additional status information.
|
|
||||||
EFI_BAD_BUFFER_SIZE - The SCSI Request Packet was executed,
|
|
||||||
but the entire DataBuffer could not be transferred.
|
|
||||||
The actual number of bytes transferred is returned
|
|
||||||
in TransferLength. See HostAdapterStatus,
|
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
|
||||||
that order for additional status information.
|
|
||||||
EFI_NOT_READY - The SCSI Request Packet could not be sent because
|
|
||||||
there are too many SCSI Command Packets already
|
|
||||||
queued.The caller may retry again later.
|
|
||||||
EFI_DEVICE_ERROR - A device error occurred while attempting to send
|
|
||||||
the SCSI Request Packet. See HostAdapterStatus,
|
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
|
||||||
that order for additional status information.
|
|
||||||
EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
|
|
||||||
The SCSI Request Packet was not sent, so no
|
|
||||||
additional status information is available.
|
|
||||||
EFI_UNSUPPORTED - The command described by the SCSI Request Packet
|
|
||||||
is not supported by the SCSI initiator(i.e., SCSI
|
|
||||||
Host Controller). The SCSI Request Packet was not
|
|
||||||
sent, so no additional status information is
|
|
||||||
available.
|
|
||||||
EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
|
|
||||||
Request Packet to execute. See HostAdapterStatus,
|
|
||||||
TargetStatus, SenseDataLength, and SenseData in
|
|
||||||
that order for additional status information.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The SCSI Request Packet was sent by the host
|
||||||
|
successfully, and TransferLength bytes were
|
||||||
|
transferred to/from DataBuffer.See
|
||||||
|
HostAdapterStatus, TargetStatus,
|
||||||
|
SenseDataLength, and SenseData in that order
|
||||||
|
for additional status information.
|
||||||
|
@retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,
|
||||||
|
but the entire DataBuffer could not be transferred.
|
||||||
|
The actual number of bytes transferred is returned
|
||||||
|
in TransferLength. See HostAdapterStatus,
|
||||||
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
|
that order for additional status information.
|
||||||
|
@retval EFI_NOT_READY The SCSI Request Packet could not be sent because
|
||||||
|
there are too many SCSI Command Packets already
|
||||||
|
queued.The caller may retry again later.
|
||||||
|
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
|
||||||
|
the SCSI Request Packet. See HostAdapterStatus,
|
||||||
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
|
that order for additional status information.
|
||||||
|
@retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
|
||||||
|
The SCSI Request Packet was not sent, so no
|
||||||
|
additional status information is available.
|
||||||
|
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
|
||||||
|
is not supported by the SCSI initiator(i.e., SCSI
|
||||||
|
Host Controller). The SCSI Request Packet was not
|
||||||
|
sent, so no additional status information is
|
||||||
|
available.
|
||||||
|
@retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
|
||||||
|
Request Packet to execute. See HostAdapterStatus,
|
||||||
|
TargetStatus, SenseDataLength, and SenseData in
|
||||||
|
that order for additional status information.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ScsiScanCreateDevice (
|
EFIAPI
|
||||||
EFI_DRIVER_BINDING_PROTOCOL *This,
|
ScsiExecuteSCSICommand (
|
||||||
EFI_HANDLE Controller,
|
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||||
SCSI_TARGET_ID *TargetId,
|
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket,
|
||||||
UINT64 Lun,
|
IN EFI_EVENT Event OPTIONAL
|
||||||
SCSI_BUS_DEVICE *ScsiBusDev
|
);
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
/**
|
||||||
Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.
|
Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.
|
||||||
|
|
||||||
Arguments:
|
@param This Protocol instance pointer
|
||||||
|
@param Controller Controller handle
|
||||||
|
@param TargetId Tartget to be scanned
|
||||||
|
@param Lun The Lun of the SCSI device on the SCSI channel.
|
||||||
|
@param ScsiBusDev The pointer of SCSI_BUS_DEVICE
|
||||||
|
|
||||||
This - Protocol instance pointer
|
@retval EFI_SUCCESS Successfully to discover the device and attach
|
||||||
Controller - Controller handle
|
ScsiIoProtocol to it.
|
||||||
Pun - The Pun of the SCSI device on the SCSI channel.
|
@retval EFI_OUT_OF_RESOURCES Fail to discover the device.
|
||||||
Lun - The Lun of the SCSI device on the SCSI channel.
|
|
||||||
ScsiBusDev - The pointer of SCSI_BUS_DEVICE
|
|
||||||
|
|
||||||
Returns:
|
**/
|
||||||
|
EFI_STATUS
|
||||||
EFI_SUCCESS - Successfully to discover the device and attach ScsiIoProtocol to it.
|
EFIAPI
|
||||||
EFI_OUT_OF_RESOURCES - Fail to discover the device.
|
ScsiScanCreateDevice (
|
||||||
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
--*/
|
IN EFI_HANDLE Controller,
|
||||||
;
|
IN SCSI_TARGET_ID *TargetId,
|
||||||
|
IN UINT64 Lun,
|
||||||
BOOLEAN
|
IN OUT SCSI_BUS_DEVICE *ScsiBusDev
|
||||||
DiscoverScsiDevice (
|
);
|
||||||
SCSI_IO_DEV *ScsiIoDevice
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
|
/**
|
||||||
Discovery SCSI Device
|
Discovery SCSI Device
|
||||||
|
|
||||||
Arguments:
|
@param ScsiIoDevice The pointer of SCSI_IO_DEV
|
||||||
|
|
||||||
ScsiIoDevice - The pointer of SCSI_IO_DEV
|
@retval TRUE Find SCSI Device and verify it.
|
||||||
|
@retval FALSE Unable to find SCSI Device.
|
||||||
|
|
||||||
Returns:
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
DiscoverScsiDevice (
|
||||||
|
IN OUT SCSI_IO_DEV *ScsiIoDevice
|
||||||
|
);
|
||||||
|
|
||||||
TRUE - Find SCSI Device and verify it.
|
|
||||||
FALSE - Unable to find SCSI Device.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -32,7 +32,8 @@
|
|||||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
#
|
#
|
||||||
# DRIVER_BINDING = gSCSIBusDriverBinding
|
# DRIVER_BINDING = gSCSIBusDriverBinding
|
||||||
# COMPONENT_NAME = gScsiBusComponentName
|
# COMPONENT_NAME = gScsiBusComponentName
|
||||||
|
# COMPONENT_NAME2 = gScsiBusComponentName2
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
@@ -62,4 +63,4 @@
|
|||||||
gEfiScsiIoProtocolGuid # PROTOCOL BY_START
|
gEfiScsiIoProtocolGuid # PROTOCOL BY_START
|
||||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||||
gEfiScsiPassThruProtocolGuid # PROTOCOL TO_START
|
gEfiScsiPassThruProtocolGuid # PROTOCOL TO_START
|
||||||
gEfiExtScsiPassThruProtocolGuid
|
gEfiExtScsiPassThruProtocolGuid # PROTOCOL TO_START
|
||||||
|
@@ -13,21 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <Protocol/ScsiIo.h>
|
|
||||||
#include <Protocol/ComponentName.h>
|
|
||||||
#include <Protocol/BlockIo.h>
|
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/ScsiLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
|
|
||||||
#include "ScsiDisk.h"
|
#include "ScsiDisk.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -64,10 +49,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[
|
|||||||
by This does not support the language specified by Language,
|
by This does not support the language specified by Language,
|
||||||
then EFI_UNSUPPORTED is returned.
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -76,7 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[
|
|||||||
to the driver writer. Language is specified
|
to the driver writer. Language is specified
|
||||||
in RFC 3066 or ISO 639-2 language code format.
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param DriverName[out] A pointer to the Unicode string to return.
|
@param DriverName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
driver specified by This in the language
|
driver specified by This in the language
|
||||||
specified by Language.
|
specified by Language.
|
||||||
@@ -123,15 +108,15 @@ ScsiDiskComponentNameGetDriverName (
|
|||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param ControllerHandle[in] The handle of a controller that the driver
|
@param ControllerHandle The handle of a controller that the driver
|
||||||
specified by This is managing. This handle
|
specified by This is managing. This handle
|
||||||
specifies the controller whose name is to be
|
specifies the controller whose name is to be
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
@param ChildHandle The handle of the child controller to retrieve
|
||||||
the name of. This is an optional parameter that
|
the name of. This is an optional parameter that
|
||||||
may be NULL. It will be NULL for device
|
may be NULL. It will be NULL for device
|
||||||
drivers. It will also be NULL for a bus drivers
|
drivers. It will also be NULL for a bus drivers
|
||||||
@@ -140,7 +125,7 @@ ScsiDiskComponentNameGetDriverName (
|
|||||||
driver that wishes to retrieve the name of a
|
driver that wishes to retrieve the name of a
|
||||||
child controller.
|
child controller.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
requesting, and it must match one of the
|
requesting, and it must match one of the
|
||||||
@@ -149,7 +134,7 @@ ScsiDiskComponentNameGetDriverName (
|
|||||||
to the driver writer. Language is specified in
|
to the driver writer. Language is specified in
|
||||||
RFC 3066 or ISO 639-2 language code format.
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
@param ControllerName A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
controller specified by ControllerHandle and
|
controller specified by ControllerHandle and
|
||||||
ChildHandle in the language specified by
|
ChildHandle in the language specified by
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
#
|
#
|
||||||
# Component description file for Scsi Disk module.
|
# Component description file for Scsi Disk module.
|
||||||
#
|
#
|
||||||
# Scsi Disk driver. This driver detected the Scsi disk media and export block io protocol
|
# Scsi Disk driver. This driver detected the Scsi disk media and export block io protocol
|
||||||
#
|
#
|
||||||
@@ -32,7 +32,8 @@
|
|||||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
#
|
#
|
||||||
# DRIVER_BINDING = gScsiDiskDriverBinding
|
# DRIVER_BINDING = gScsiDiskDriverBinding
|
||||||
# COMPONENT_NAME = gScsiDiskComponentName
|
# COMPONENT_NAME = gScsiDiskComponentName
|
||||||
|
# COMPONENT_NAME2 = gScsiDiskComponentName2
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
|
Reference in New Issue
Block a user