1 | /** @file
|
---|
2 | The shared head file for iSCSI driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _ISCSI_IMPL_H_
|
---|
10 | #define _ISCSI_IMPL_H_
|
---|
11 |
|
---|
12 | #include <Uefi.h>
|
---|
13 |
|
---|
14 | #include <IndustryStandard/Dhcp.h>
|
---|
15 |
|
---|
16 | #include <Protocol/ComponentName.h>
|
---|
17 | #include <Protocol/ComponentName2.h>
|
---|
18 | #include <Protocol/DriverBinding.h>
|
---|
19 | #include <Protocol/DevicePath.h>
|
---|
20 | #include <Protocol/HiiConfigAccess.h>
|
---|
21 |
|
---|
22 | #include <Protocol/Ip6.h>
|
---|
23 | #include <Protocol/Dhcp4.h>
|
---|
24 | #include <Protocol/Dhcp6.h>
|
---|
25 | #include <Protocol/Dns4.h>
|
---|
26 | #include <Protocol/Dns6.h>
|
---|
27 | #include <Protocol/Tcp4.h>
|
---|
28 | #include <Protocol/Tcp6.h>
|
---|
29 | #include <Protocol/Ip4Config2.h>
|
---|
30 | #include <Protocol/Ip6Config.h>
|
---|
31 |
|
---|
32 | #include <Protocol/AuthenticationInfo.h>
|
---|
33 | #include <Protocol/IScsiInitiatorName.h>
|
---|
34 | #include <Protocol/ScsiPassThruExt.h>
|
---|
35 | #include <Protocol/AdapterInformation.h>
|
---|
36 | #include <Protocol/NetworkInterfaceIdentifier.h>
|
---|
37 |
|
---|
38 | #include <Library/HiiLib.h>
|
---|
39 | #include <Library/UefiHiiServicesLib.h>
|
---|
40 | #include <Library/DevicePathLib.h>
|
---|
41 | #include <Library/DebugLib.h>
|
---|
42 | #include <Library/BaseLib.h>
|
---|
43 | #include <Library/BaseMemoryLib.h>
|
---|
44 | #include <Library/MemoryAllocationLib.h>
|
---|
45 | #include <Library/PrintLib.h>
|
---|
46 | #include <Library/UefiBootServicesTableLib.h>
|
---|
47 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
48 | #include <Library/UefiLib.h>
|
---|
49 | #include <Library/DpcLib.h>
|
---|
50 | #include <Library/NetLib.h>
|
---|
51 | #include <Library/TcpIoLib.h>
|
---|
52 | #include <Library/BaseCryptLib.h>
|
---|
53 |
|
---|
54 | #include <Guid/MdeModuleHii.h>
|
---|
55 | #include <Guid/EventGroup.h>
|
---|
56 | #include <Guid/Acpi.h>
|
---|
57 |
|
---|
58 | #include "IScsiConfigNVDataStruc.h"
|
---|
59 | #include "IScsiDriver.h"
|
---|
60 | #include "IScsiProto.h"
|
---|
61 | #include "IScsiCHAP.h"
|
---|
62 | #include "IScsiDhcp.h"
|
---|
63 | #include "IScsiDhcp6.h"
|
---|
64 |
|
---|
65 | #include "IScsiIbft.h"
|
---|
66 | #include "IScsiMisc.h"
|
---|
67 | #include "IScsiDns.h"
|
---|
68 | #include "IScsiConfig.h"
|
---|
69 |
|
---|
70 | #define ISCSI_AUTH_INITIAL 0
|
---|
71 |
|
---|
72 | #define ISCSI_SESSION_SIGNATURE SIGNATURE_32 ('I', 'S', 'S', 'N')
|
---|
73 | ///
|
---|
74 | /// 10 seconds
|
---|
75 | ///
|
---|
76 | #define ISCSI_GET_MAPPING_TIMEOUT 100000000U
|
---|
77 | ///
|
---|
78 | /// 3 seconds
|
---|
79 | ///
|
---|
80 | #define ISCSI_WAIT_IPSEC_TIMEOUT 30000000U
|
---|
81 |
|
---|
82 | struct _ISCSI_SESSION {
|
---|
83 | UINT32 Signature;
|
---|
84 |
|
---|
85 | ISCSI_DRIVER_DATA *Private;
|
---|
86 | ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;
|
---|
87 |
|
---|
88 | UINT8 AuthType;
|
---|
89 | union {
|
---|
90 | ISCSI_CHAP_AUTH_DATA CHAP;
|
---|
91 | } AuthData;
|
---|
92 |
|
---|
93 | UINT8 State;
|
---|
94 |
|
---|
95 | UINT8 Isid[6];
|
---|
96 | UINT16 Tsih;
|
---|
97 |
|
---|
98 | UINT32 CmdSN;
|
---|
99 | UINT32 ExpCmdSN;
|
---|
100 | UINT32 MaxCmdSN;
|
---|
101 |
|
---|
102 | UINT32 InitiatorTaskTag;
|
---|
103 | UINT16 NextCid;
|
---|
104 |
|
---|
105 | LIST_ENTRY Conns;
|
---|
106 | UINT32 NumConns;
|
---|
107 |
|
---|
108 | LIST_ENTRY TcbList;
|
---|
109 |
|
---|
110 | //
|
---|
111 | // Session-wide parameters
|
---|
112 | //
|
---|
113 | UINT16 TargetPortalGroupTag;
|
---|
114 | UINT32 MaxConnections;
|
---|
115 | BOOLEAN InitialR2T;
|
---|
116 | BOOLEAN ImmediateData;
|
---|
117 | UINT32 MaxBurstLength;
|
---|
118 | UINT32 FirstBurstLength;
|
---|
119 | UINT32 DefaultTime2Wait;
|
---|
120 | UINT32 DefaultTime2Retain;
|
---|
121 | UINT16 MaxOutstandingR2T;
|
---|
122 | BOOLEAN DataPDUInOrder;
|
---|
123 | BOOLEAN DataSequenceInOrder;
|
---|
124 | UINT8 ErrorRecoveryLevel;
|
---|
125 | };
|
---|
126 |
|
---|
127 | #define ISCSI_CONNECTION_SIGNATURE SIGNATURE_32 ('I', 'S', 'C', 'N')
|
---|
128 |
|
---|
129 | struct _ISCSI_CONNECTION {
|
---|
130 | UINT32 Signature;
|
---|
131 | LIST_ENTRY Link;
|
---|
132 |
|
---|
133 | EFI_EVENT TimeoutEvent;
|
---|
134 |
|
---|
135 | ISCSI_SESSION *Session;
|
---|
136 |
|
---|
137 | UINT8 State;
|
---|
138 | UINT8 CurrentStage;
|
---|
139 | UINT8 NextStage;
|
---|
140 |
|
---|
141 | UINT8 AuthStep;
|
---|
142 |
|
---|
143 | BOOLEAN PartialReqSent;
|
---|
144 | BOOLEAN PartialRspRcvd;
|
---|
145 |
|
---|
146 | BOOLEAN TransitInitiated;
|
---|
147 | BOOLEAN ParamNegotiated;
|
---|
148 |
|
---|
149 | UINT16 Cid;
|
---|
150 | UINT32 ExpStatSN;
|
---|
151 |
|
---|
152 | //
|
---|
153 | // Queues...
|
---|
154 | //
|
---|
155 | NET_BUF_QUEUE RspQue;
|
---|
156 |
|
---|
157 | BOOLEAN Ipv6Flag;
|
---|
158 | TCP_IO TcpIo;
|
---|
159 |
|
---|
160 | //
|
---|
161 | // Connection-only parameters.
|
---|
162 | //
|
---|
163 | UINT32 MaxRecvDataSegmentLength;
|
---|
164 | ISCSI_DIGEST_TYPE HeaderDigest;
|
---|
165 | ISCSI_DIGEST_TYPE DataDigest;
|
---|
166 | };
|
---|
167 |
|
---|
168 | #define ISCSI_DRIVER_DATA_SIGNATURE SIGNATURE_32 ('I', 'S', 'D', 'A')
|
---|
169 |
|
---|
170 | #define ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU(PassThru) \
|
---|
171 | CR ( \
|
---|
172 | PassThru, \
|
---|
173 | ISCSI_DRIVER_DATA, \
|
---|
174 | IScsiExtScsiPassThru, \
|
---|
175 | ISCSI_DRIVER_DATA_SIGNATURE \
|
---|
176 | )
|
---|
177 |
|
---|
178 | #define ISCSI_DRIVER_DATA_FROM_IDENTIFIER(Identifier) \
|
---|
179 | CR ( \
|
---|
180 | Identifier, \
|
---|
181 | ISCSI_DRIVER_DATA, \
|
---|
182 | IScsiIdentifier, \
|
---|
183 | ISCSI_DRIVER_DATA_SIGNATURE \
|
---|
184 | )
|
---|
185 |
|
---|
186 | struct _ISCSI_DRIVER_DATA {
|
---|
187 | UINT32 Signature;
|
---|
188 | EFI_HANDLE Image;
|
---|
189 | EFI_HANDLE Controller;
|
---|
190 | ISCSI_PRIVATE_PROTOCOL IScsiIdentifier;
|
---|
191 |
|
---|
192 | EFI_EVENT ExitBootServiceEvent;
|
---|
193 |
|
---|
194 | EFI_EXT_SCSI_PASS_THRU_PROTOCOL IScsiExtScsiPassThru;
|
---|
195 | EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;
|
---|
196 | EFI_HANDLE ExtScsiPassThruHandle;
|
---|
197 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
198 | EFI_HANDLE ChildHandle;
|
---|
199 | ISCSI_SESSION *Session;
|
---|
200 | };
|
---|
201 |
|
---|
202 | #endif
|
---|