]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/LsiScsiDxe/LsiScsi.h
05deeed379fea24fc4a8fec708b59509010c3529
[mirror_edk2.git] / OvmfPkg / LsiScsiDxe / LsiScsi.h
1 /** @file
2
3 Internal definitions for the LSI 53C895A SCSI driver, which produces
4 Extended SCSI Pass Thru Protocol instances for LSI 53C895A SCSI devices.
5
6 Copyright (C) 2020, SUSE LLC.
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef _LSI_SCSI_DXE_H_
13 #define _LSI_SCSI_DXE_H_
14
15 typedef struct {
16 //
17 // The max size of CDB is 32.
18 //
19 UINT8 Cdb[32];
20 //
21 // Allocate 64KB for read/write buffer. It seems sufficient for the common
22 // boot scenarios.
23 //
24 // NOTE: The number of bytes for data transmission is bounded by DMA Byte
25 // Count (DBC), a 24-bit register, so the maximum is 0xFFFFFF (16MB-1).
26 //
27 UINT8 Data[SIZE_64KB];
28 } LSI_SCSI_DMA_BUFFER;
29
30 typedef struct {
31 UINT32 Signature;
32 UINT64 OrigPciAttrs;
33 EFI_EVENT ExitBoot;
34 EFI_PCI_IO_PROTOCOL *PciIo;
35 UINT8 MaxTarget;
36 UINT8 MaxLun;
37 LSI_SCSI_DMA_BUFFER *Dma;
38 EFI_PHYSICAL_ADDRESS DmaPhysical;
39 VOID *DmaMapping;
40 EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode;
41 EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
42 } LSI_SCSI_DEV;
43
44 #define LSI_SCSI_DEV_SIGNATURE SIGNATURE_32 ('L','S','I','S')
45
46 #define LSI_SCSI_FROM_PASS_THRU(PassThruPtr) \
47 CR (PassThruPtr, LSI_SCSI_DEV, PassThru, LSI_SCSI_DEV_SIGNATURE)
48
49
50 //
51 // Probe, start and stop functions of this driver, called by the DXE core for
52 // specific devices.
53 //
54 // The following specifications document these interfaces:
55 // - Driver Writer's Guide for UEFI 2.3.1 v1.01, 9 Driver Binding Protocol
56 // - UEFI Spec 2.3.1 + Errata C, 10.1 EFI Driver Binding Protocol
57 //
58
59 EFI_STATUS
60 EFIAPI
61 LsiScsiControllerSupported (
62 IN EFI_DRIVER_BINDING_PROTOCOL *This,
63 IN EFI_HANDLE ControllerHandle,
64 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
65 );
66
67 EFI_STATUS
68 EFIAPI
69 LsiScsiControllerStart (
70 IN EFI_DRIVER_BINDING_PROTOCOL *This,
71 IN EFI_HANDLE ControllerHandle,
72 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
73 );
74
75 EFI_STATUS
76 EFIAPI
77 LsiScsiControllerStop (
78 IN EFI_DRIVER_BINDING_PROTOCOL *This,
79 IN EFI_HANDLE ControllerHandle,
80 IN UINTN NumberOfChildren,
81 IN EFI_HANDLE *ChildHandleBuffer
82 );
83
84
85 //
86 // The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL
87 // for the LSI 53C895A SCSI Controller. Refer to UEFI Spec 2.3.1 + Errata C,
88 // sections
89 // - 14.1 SCSI Driver Model Overview,
90 // - 14.7 Extended SCSI Pass Thru Protocol.
91 //
92
93 EFI_STATUS
94 EFIAPI
95 LsiScsiPassThru (
96 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
97 IN UINT8 *Target,
98 IN UINT64 Lun,
99 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
100 IN EFI_EVENT Event OPTIONAL
101 );
102
103 EFI_STATUS
104 EFIAPI
105 LsiScsiGetNextTargetLun (
106 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
107 IN OUT UINT8 **TargetPointer,
108 IN OUT UINT64 *Lun
109 );
110
111 EFI_STATUS
112 EFIAPI
113 LsiScsiBuildDevicePath (
114 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
115 IN UINT8 *Target,
116 IN UINT64 Lun,
117 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
118 );
119
120 EFI_STATUS
121 EFIAPI
122 LsiScsiGetTargetLun (
123 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
124 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
125 OUT UINT8 **TargetPointer,
126 OUT UINT64 *Lun
127 );
128
129 EFI_STATUS
130 EFIAPI
131 LsiScsiResetChannel (
132 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
133 );
134
135 EFI_STATUS
136 EFIAPI
137 LsiScsiResetTargetLun (
138 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
139 IN UINT8 *Target,
140 IN UINT64 Lun
141 );
142
143 EFI_STATUS
144 EFIAPI
145 LsiScsiGetNextTarget (
146 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
147 IN OUT UINT8 **TargetPointer
148 );
149
150
151 //
152 // The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
153 // EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's name
154 // in English, for display on standard console devices. This is recommended for
155 // UEFI drivers that follow the UEFI Driver Model. Refer to the Driver Writer's
156 // Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
157 //
158 // Device type names ("LSI 53C895A SCSI Controller") are not formatted because
159 // the driver supports only that device type. Therefore the driver name
160 // suffices for unambiguous identification.
161 //
162
163 EFI_STATUS
164 EFIAPI
165 LsiScsiGetDriverName (
166 IN EFI_COMPONENT_NAME_PROTOCOL *This,
167 IN CHAR8 *Language,
168 OUT CHAR16 **DriverName
169 );
170
171 EFI_STATUS
172 EFIAPI
173 LsiScsiGetDeviceName (
174 IN EFI_COMPONENT_NAME_PROTOCOL *This,
175 IN EFI_HANDLE DeviceHandle,
176 IN EFI_HANDLE ChildHandle,
177 IN CHAR8 *Language,
178 OUT CHAR16 **ControllerName
179 );
180
181 #endif // _LSI_SCSI_DXE_H_