TianoCore EDK2 master
Loading...
Searching...
No Matches
ScsiBus.h
Go to the documentation of this file.
1
9#ifndef _SCSI_BUS_H_
10#define _SCSI_BUS_H_
11
12#include <Uefi.h>
13
16#include <Protocol/ScsiIo.h>
19#include <Protocol/DevicePath.h>
20
21#include <Library/DebugLib.h>
23#include <Library/UefiLib.h>
26#include <Library/UefiScsiLib.h>
30
32
33#define SCSI_IO_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'i', 'o')
34
35typedef union {
36 UINT32 Scsi;
37 UINT8 ExtScsi[4];
38} SCSI_ID;
39
40typedef struct _SCSI_TARGET_ID {
41 SCSI_ID ScsiId;
42 UINT8 ExtScsiId[12];
44
45typedef struct {
46 VOID *Data1;
47 VOID *Data2;
49
50//
51// SCSI Bus Controller device structure
52//
53#define SCSI_BUS_DEVICE_SIGNATURE SIGNATURE_32 ('s', 'c', 's', 'i')
54
55//
56// SCSI Bus Timeout Experience Value
57//
58#define SCSI_BUS_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
59
60//
61// The ScsiBusProtocol is just used to locate ScsiBusDev
62// structure in the SCSIBusDriverBindingStop(). Then we can
63// Close all opened protocols and release this structure.
64// ScsiBusProtocol is the private protocol.
65// gEfiCallerIdGuid will be used as its protocol guid.
66//
67typedef struct _EFI_SCSI_BUS_PROTOCOL {
68 UINT64 Reserved;
70
71typedef struct _SCSI_BUS_DEVICE {
72 UINTN Signature;
73 EFI_SCSI_BUS_PROTOCOL BusIdentify;
74 BOOLEAN ExtScsiSupport;
75 EFI_SCSI_PASS_THRU_PROTOCOL *ScsiInterface;
76 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiInterface;
77 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
79
80#define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a) CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)
81
82typedef struct {
83 UINT32 Signature;
84 EFI_HANDLE Handle;
86 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
87 BOOLEAN ExtScsiSupport;
88 EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
89 EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
90 SCSI_BUS_DEVICE *ScsiBusDeviceData;
92 UINT64 Lun;
93 UINT8 ScsiDeviceType;
94 UINT8 ScsiVersion;
95 BOOLEAN RemovableDevice;
97
98#define SCSI_IO_DEV_FROM_THIS(a) CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)
99
100//
101// Global Variables
102//
103extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding;
104extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName;
105extern EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2;
106
127EFIAPI
130 IN EFI_HANDLE Controller,
131 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
132 );
133
154EFIAPI
157 IN EFI_HANDLE Controller,
158 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
159 );
160
181EFIAPI
184 IN EFI_HANDLE Controller,
185 IN UINTN NumberOfChildren,
186 IN EFI_HANDLE *ChildHandleBuffer
187 );
188
189//
190// EFI Component Name Functions
191//
192
233EFIAPI
236 IN CHAR8 *Language,
237 OUT CHAR16 **DriverName
238 );
239
309EFIAPI
312 IN EFI_HANDLE ControllerHandle,
313 IN EFI_HANDLE ChildHandle OPTIONAL,
314 IN CHAR8 *Language,
315 OUT CHAR16 **ControllerName
316 );
317
330EFIAPI
333 OUT UINT8 *DeviceType
334 );
335
350EFIAPI
353 IN OUT UINT8 **Target,
354 OUT UINT64 *Lun
355 );
356
370EFIAPI
373 );
374
387EFIAPI
390 );
391
440EFIAPI
444 IN EFI_EVENT Event OPTIONAL
445 );
446
463EFIAPI
466 IN EFI_HANDLE Controller,
467 IN SCSI_TARGET_ID *TargetId,
468 IN UINT64 Lun,
469 IN OUT SCSI_BUS_DEVICE *ScsiBusDev
470 );
471
484 IN OUT SCSI_IO_DEV *ScsiIoDevice
485 );
486
487#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
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 ScsiResetBus(IN EFI_SCSI_IO_PROTOCOL *This)
Definition: ScsiBus.c:840
EFI_STATUS EFIAPI SCSIBusDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: ScsiBus.c:294
EFI_STATUS EFIAPI ScsiGetDeviceLocation(IN EFI_SCSI_IO_PROTOCOL *This, IN OUT UINT8 **Target, OUT UINT64 *Lun)
Definition: ScsiBus.c:805
EFI_STATUS EFIAPI SCSIBusDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: ScsiBus.c:597
EFI_STATUS EFIAPI SCSIBusDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: ScsiBus.c:167
EFI_STATUS DiscoverScsiDevice(IN OUT SCSI_IO_DEV *ScsiIoDevice)
Definition: ScsiBus.c:1286
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)
Definition: ScsiBus.c:1114
EFI_STATUS EFIAPI ScsiResetDevice(IN EFI_SCSI_IO_PROTOCOL *This)
Definition: ScsiBus.c:877
EFI_STATUS EFIAPI ScsiExecuteSCSICommand(IN EFI_SCSI_IO_PROTOCOL *This, IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket, IN EFI_EVENT Event OPTIONAL)
Definition: ScsiBus.c:961
EFI_STATUS EFIAPI ScsiGetDeviceType(IN EFI_SCSI_IO_PROTOCOL *This, OUT UINT8 *DeviceType)
Definition: ScsiBus.c:774
EFI_STATUS EFIAPI ScsiBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
Definition: ComponentName.c:75
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33