TianoCore EDK2 master
|
#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/UefiScsiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <IndustryStandard/Scsi.h>
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 |
Variables | |
EFI_DRIVER_BINDING_PROTOCOL | gScsiBusDriverBinding |
EFI_COMPONENT_NAME_PROTOCOL | gScsiBusComponentName |
EFI_COMPONENT_NAME2_PROTOCOL | gScsiBusComponentName2 |
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.
#define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS | ( | a | ) | CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE) |
#define SCSI_BUS_DEVICE_SIGNATURE SIGNATURE_32 ('s', 'c', 's', 'i') |
#define SCSI_BUS_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3) |
#define SCSI_IO_DEV_FROM_THIS | ( | a | ) | CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE) |
#define SCSI_IO_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'i', 'o') |
EFI_STATUS DiscoverScsiDevice | ( | IN OUT SCSI_IO_DEV * | ScsiIoDevice | ) |
Discovery SCSI Device
ScsiIoDevice | The pointer of SCSI_IO_DEV |
EFI_SUCCESS | Find SCSI Device and verify it. |
EFI_NOT_FOUND | Unable to find SCSI Device. |
EFI_OUT_OF_RESOURCES | Fail to allocate memory resources. |
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.
This | A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. |
ControllerHandle | The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. |
ChildHandle | The 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. |
Language | A 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. |
ControllerName | A 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. |
EFI_SUCCESS | The 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_PARAMETER | ControllerHandle is NULL. |
EFI_INVALID_PARAMETER | ChildHandle is not NULL and it is not a valid EFI_HANDLE. |
EFI_INVALID_PARAMETER | Language is NULL. |
EFI_INVALID_PARAMETER | ControllerName is NULL. |
EFI_UNSUPPORTED | The driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle. |
EFI_UNSUPPORTED | The driver specified by This does not support the language specified by Language. |
Definition at line 160 of file ComponentName.c.
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.
This | A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance. |
Language | A 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. |
DriverName | A 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. |
EFI_SUCCESS | The Unicode string for the Driver specified by This and the language specified by Language was returned in DriverName. |
EFI_INVALID_PARAMETER | Language is NULL. |
EFI_INVALID_PARAMETER | DriverName is NULL. |
EFI_UNSUPPORTED | The driver specified by This does not support the language specified by Language. |
Definition at line 75 of file ComponentName.c.
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.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to bind driver to |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver is added to ControllerHandle |
EFI_ALREADY_STARTED | This driver is already running on ControllerHandle |
other | This driver does not support this device |
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.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to stop driver on |
NumberOfChildren | Number of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver. |
ChildHandleBuffer | List of Child Handles to Stop. |
EFI_SUCCESS | This driver is removed ControllerHandle |
other | This driver was not removed from this device |
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.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to test |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver supports this device |
EFI_ALREADY_STARTED | This driver is already running on this device |
other | This driver does not support this device |
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.
This | Protocol instance pointer. |
CommandPacket | The SCSI request packet to send to the SCSI Controller specified by the device handle. |
Event | If 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. |
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. |
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.
This | Protocol instance pointer. |
Target | A pointer to the Target ID of a SCSI device on the SCSI channel. |
Lun | A pointer to the LUN of the SCSI device on the SCSI channel. |
EFI_SUCCESS | Retrieves the device location successfully. |
EFI_INVALID_PARAMETER | The Target or Lun is NULL. |
EFI_STATUS EFIAPI ScsiGetDeviceType | ( | IN EFI_SCSI_IO_PROTOCOL * | This, |
OUT UINT8 * | DeviceType | ||
) |
Retrieves the device type information of the SCSI Controller.
This | Protocol instance pointer. |
DeviceType | A pointer to the device type information retrieved from the SCSI Controller. |
EFI_SUCCESS | Retrieves the device type information successfully. |
EFI_INVALID_PARAMETER | The DeviceType is NULL. |
EFI_STATUS EFIAPI ScsiResetBus | ( | IN EFI_SCSI_IO_PROTOCOL * | This | ) |
Resets the SCSI Bus that the SCSI Controller is attached to.
This | Protocol instance pointer. |
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. |
EFI_STATUS EFIAPI ScsiResetDevice | ( | IN EFI_SCSI_IO_PROTOCOL * | This | ) |
Resets the SCSI Controller that the device handle specifies.
This | Protocol instance pointer. |
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 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.
This | Protocol instance pointer |
Controller | Controller handle |
TargetId | Target to be scanned |
Lun | The Lun of the SCSI device on the SCSI channel. |
ScsiBusDev | The pointer of SCSI_BUS_DEVICE |
EFI_SUCCESS | Successfully to discover the device and attach ScsiIoProtocol to it. |
EFI_NOT_FOUND | Fail to discover the device. |
EFI_OUT_OF_RESOURCES | Fail to allocate memory resources. |
|
extern |
Definition at line 14 of file ComponentName.c.
|
extern |
Definition at line 23 of file ComponentName.c.