TianoCore EDK2 master
Loading...
Searching...
No Matches
ScsiBus.h File Reference

Go to the source code of this file.

Data Structures

union  SCSI_ID
 
struct  _SCSI_TARGET_ID
 
struct  SCSI_EVENT_DATA
 
struct  _EFI_SCSI_BUS_PROTOCOL
 
struct  _SCSI_BUS_DEVICE
 
struct  SCSI_IO_DEV
 

Macros

#define SCSI_IO_DEV_SIGNATURE   SIGNATURE_32 ('s', 'c', 'i', 'o')
 
#define SCSI_BUS_DEVICE_SIGNATURE   SIGNATURE_32 ('s', 'c', 's', 'i')
 
#define SCSI_BUS_TIMEOUT   EFI_TIMER_PERIOD_SECONDS (3)
 
#define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a)   CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)
 
#define SCSI_IO_DEV_FROM_THIS(a)   CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)
 

Typedefs

typedef struct _SCSI_TARGET_ID SCSI_TARGET_ID
 
typedef struct _EFI_SCSI_BUS_PROTOCOL EFI_SCSI_BUS_PROTOCOL
 
typedef struct _SCSI_BUS_DEVICE SCSI_BUS_DEVICE
 

Functions

EFI_STATUS EFIAPI SCSIBusDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI SCSIBusDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI SCSIBusDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS EFIAPI ScsiBusComponentNameGetDriverName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
 
EFI_STATUS EFIAPI ScsiBusComponentNameGetControllerName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
 
EFI_STATUS EFIAPI ScsiGetDeviceType (IN EFI_SCSI_IO_PROTOCOL *This, OUT UINT8 *DeviceType)
 
EFI_STATUS EFIAPI ScsiGetDeviceLocation (IN EFI_SCSI_IO_PROTOCOL *This, IN OUT UINT8 **Target, OUT UINT64 *Lun)
 
EFI_STATUS EFIAPI ScsiResetBus (IN EFI_SCSI_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI ScsiResetDevice (IN EFI_SCSI_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI ScsiExecuteSCSICommand (IN EFI_SCSI_IO_PROTOCOL *This, IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket, IN EFI_EVENT Event OPTIONAL)
 
EFI_STATUS EFIAPI ScsiScanCreateDevice (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN SCSI_TARGET_ID *TargetId, IN UINT64 Lun, IN OUT SCSI_BUS_DEVICE *ScsiBusDev)
 
EFI_STATUS DiscoverScsiDevice (IN OUT SCSI_IO_DEV *ScsiIoDevice)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding
 
EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName
 
EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2
 

Detailed Description

Header file for SCSI Bus Driver.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ScsiBus.h.

Macro Definition Documentation

◆ SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS

#define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS (   a)    CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)

Definition at line 80 of file ScsiBus.h.

◆ SCSI_BUS_DEVICE_SIGNATURE

#define SCSI_BUS_DEVICE_SIGNATURE   SIGNATURE_32 ('s', 'c', 's', 'i')

Definition at line 53 of file ScsiBus.h.

◆ SCSI_BUS_TIMEOUT

#define SCSI_BUS_TIMEOUT   EFI_TIMER_PERIOD_SECONDS (3)

Definition at line 58 of file ScsiBus.h.

◆ SCSI_IO_DEV_FROM_THIS

#define SCSI_IO_DEV_FROM_THIS (   a)    CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)

Definition at line 98 of file ScsiBus.h.

◆ SCSI_IO_DEV_SIGNATURE

#define SCSI_IO_DEV_SIGNATURE   SIGNATURE_32 ('s', 'c', 'i', 'o')

Definition at line 33 of file ScsiBus.h.

Function Documentation

◆ DiscoverScsiDevice()

EFI_STATUS DiscoverScsiDevice ( IN OUT SCSI_IO_DEV ScsiIoDevice)

Discovery SCSI Device

Parameters
ScsiIoDeviceThe pointer of SCSI_IO_DEV
Return values
EFI_SUCCESSFind SCSI Device and verify it.
EFI_NOT_FOUNDUnable to find SCSI Device.
EFI_OUT_OF_RESOURCESFail to allocate memory resources.

Definition at line 1286 of file ScsiBus.c.

◆ ScsiBusComponentNameGetControllerName()

EFI_STATUS EFIAPI ScsiBusComponentNameGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE ChildHandle  OPTIONAL,
IN CHAR8 *  Language,
OUT CHAR16 **  ControllerName 
)

Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver.

This function retrieves the user readable name of the controller specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the controller name is returned in ControllerName, and EFI_SUCCESS is returned. If the driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
ThisA pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandleThe handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned.
ChildHandleThe handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to retrieve the name of the bus controller. It will not be NULL for a bus driver that wishes to retrieve the name of a child controller.
LanguageA pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
ControllerNameA pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by Language from the point of view of the driver specified by This.
Return values
EFI_SUCCESSThe Unicode string for the user readable name in the language specified by Language for the driver specified by This was returned in DriverName.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_INVALID_PARAMETERChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERControllerName is NULL.
EFI_UNSUPPORTEDThe driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 160 of file ComponentName.c.

◆ ScsiBusComponentNameGetDriverName()

EFI_STATUS EFIAPI ScsiBusComponentNameGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN CHAR8 *  Language,
OUT CHAR16 **  DriverName 
)

Retrieves a Unicode string that is the user readable name of the driver.

This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
ThisA pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
LanguageA pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
DriverNameA pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language.
Return values
EFI_SUCCESSThe Unicode string for the Driver specified by This and the language specified by Language was returned in DriverName.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERDriverName is NULL.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 75 of file ComponentName.c.

◆ SCSIBusDriverBindingStart()

EFI_STATUS EFIAPI SCSIBusDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
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.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to bind driver to
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_ALREADY_STARTEDThis driver is already running on ControllerHandle
otherThis driver does not support this device

Definition at line 294 of file ScsiBus.c.

◆ SCSIBusDriverBindingStop()

EFI_STATUS EFIAPI SCSIBusDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

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.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to stop driver on
NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
ChildHandleBufferList of Child Handles to Stop.
Return values
EFI_SUCCESSThis driver is removed ControllerHandle
otherThis driver was not removed from this device

Definition at line 597 of file ScsiBus.c.

◆ SCSIBusDriverBindingSupported()

EFI_STATUS EFIAPI SCSIBusDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

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.

Parameters
ThisProtocol instance pointer.
ControllerHandleHandle of device to test
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver supports this device
EFI_ALREADY_STARTEDThis driver is already running on this device
otherThis driver does not support this device

Definition at line 167 of file ScsiBus.c.

◆ ScsiExecuteSCSICommand()

EFI_STATUS EFIAPI ScsiExecuteSCSICommand ( IN EFI_SCSI_IO_PROTOCOL This,
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET Packet,
IN EFI_EVENT Event  OPTIONAL 
)

Sends a SCSI Request Packet to the SCSI Controller for execution.

Parameters
ThisProtocol instance pointer.
CommandPacketThe SCSI request packet to send to the SCSI Controller specified by the device handle.
EventIf the SCSI bus where the SCSI device is attached does not support non-blocking I/O, then Event is ignored, and blocking I/O is performed. If Event is NULL, then blocking I/O is performed. If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed, and Event will be signaled when the SCSI Request Packet completes.
Return values
EFI_SUCCESSThe 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_SIZEThe 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_READYThe 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_ERRORA 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_PARAMETERThe contents of CommandPacket are invalid. The SCSI Request Packet was not sent, so no additional status information is available.
EFI_UNSUPPORTEDThe 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_TIMEOUTA timeout occurred while waiting for the SCSI Request Packet to execute. See HostAdapterStatus, TargetStatus, SenseDataLength, and SenseData in that order for additional status information.

Definition at line 961 of file ScsiBus.c.

◆ ScsiGetDeviceLocation()

EFI_STATUS EFIAPI ScsiGetDeviceLocation ( IN EFI_SCSI_IO_PROTOCOL This,
IN OUT UINT8 **  Target,
OUT UINT64 *  Lun 
)

Retrieves the device location in the SCSI channel.

Parameters
ThisProtocol instance pointer.
TargetA pointer to the Target ID of a SCSI device on the SCSI channel.
LunA pointer to the LUN of the SCSI device on the SCSI channel.
Return values
EFI_SUCCESSRetrieves the device location successfully.
EFI_INVALID_PARAMETERThe Target or Lun is NULL.

Definition at line 805 of file ScsiBus.c.

◆ ScsiGetDeviceType()

EFI_STATUS EFIAPI ScsiGetDeviceType ( IN EFI_SCSI_IO_PROTOCOL This,
OUT UINT8 *  DeviceType 
)

Retrieves the device type information of the SCSI Controller.

Parameters
ThisProtocol instance pointer.
DeviceTypeA pointer to the device type information retrieved from the SCSI Controller.
Return values
EFI_SUCCESSRetrieves the device type information successfully.
EFI_INVALID_PARAMETERThe DeviceType is NULL.

Definition at line 774 of file ScsiBus.c.

◆ ScsiResetBus()

EFI_STATUS EFIAPI ScsiResetBus ( IN EFI_SCSI_IO_PROTOCOL This)

Resets the SCSI Bus that the SCSI Controller is attached to.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSThe SCSI bus is reset successfully.
EFI_DEVICE_ERRORErrors encountered when resetting the SCSI bus.
EFI_UNSUPPORTEDThe bus reset operation is not supported by the SCSI Host Controller.
EFI_TIMEOUTA timeout occurred while attempting to reset the SCSI bus.

Definition at line 840 of file ScsiBus.c.

◆ ScsiResetDevice()

EFI_STATUS EFIAPI ScsiResetDevice ( IN EFI_SCSI_IO_PROTOCOL This)

Resets the SCSI Controller that the device handle specifies.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSReset the SCSI controller successfully.
EFI_DEVICE_ERRORErrors are encountered when resetting the SCSI Controller.
EFI_UNSUPPORTEDThe SCSI bus does not support a device reset operation.
EFI_TIMEOUTA timeout occurred while attempting to reset the SCSI Controller.

Definition at line 877 of file ScsiBus.c.

◆ ScsiScanCreateDevice()

EFI_STATUS EFIAPI ScsiScanCreateDevice ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN SCSI_TARGET_ID TargetId,
IN UINT64  Lun,
IN OUT SCSI_BUS_DEVICE ScsiBusDev 
)

Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.

Parameters
ThisProtocol instance pointer
ControllerController handle
TargetIdTarget to be scanned
LunThe Lun of the SCSI device on the SCSI channel.
ScsiBusDevThe pointer of SCSI_BUS_DEVICE
Return values
EFI_SUCCESSSuccessfully to discover the device and attach ScsiIoProtocol to it.
EFI_NOT_FOUNDFail to discover the device.
EFI_OUT_OF_RESOURCESFail to allocate memory resources.

Definition at line 1114 of file ScsiBus.c.

Variable Documentation

◆ gScsiBusComponentName

EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName
extern

Definition at line 14 of file ComponentName.c.

◆ gScsiBusComponentName2

EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2
extern

Definition at line 23 of file ComponentName.c.