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