1 /** @file 2 The header file of IScsiImpl.c. 3 4 Copyright (c) 2004 - 2016, 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 <IndustryStandard/Dhcp.h> 21 22 #include <Library/BaseMemoryLib.h> 23 #include <Library/MemoryAllocationLib.h> 24 #include <Library/NetLib.h> 25 #include <Library/PrintLib.h> 26 #include <Library/UefiRuntimeServicesTableLib.h> 27 28 #include <Guid/EventGroup.h> 29 #include <Guid/Acpi.h> 30 31 #include "IScsiCommon.h" 32 #include "IScsiDriver.h" 33 #include "IScsiInitiatorName.h" 34 #include "ComponentName.h" 35 #include "IScsiConfigNVDataStruc.h" 36 #include "IScsiExtScsiPassThru.h" 37 #include "IScsiProto.h" 38 #include "IScsiMisc.h" 39 #include "IScsiCHAP.h" 40 #include "IScsiConfig.h" 41 #include "IScsiDhcp.h" 42 #include "IScsiTcp4Io.h" 43 #include "IScsiIbft.h" 44 45 46 #define ISCSI_SESSION_SIGNATURE SIGNATURE_32 ('I', 'S', 'S', 'N') 47 48 struct _ISCSI_SESSION { 49 UINT32 Signature; 50 51 ISCSI_SESSION_CONFIG_DATA ConfigData; 52 ISCSI_CHAP_AUTH_DATA AuthData; 53 54 CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE]; 55 UINTN InitiatorNameLength; 56 UINT8 State; 57 58 UINT8 Isid[6]; 59 UINT16 Tsih; 60 61 UINT32 CmdSN; 62 UINT32 ExpCmdSN; 63 UINT32 MaxCmdSN; 64 65 UINT32 InitiatorTaskTag; 66 UINT16 NextCid; 67 68 LIST_ENTRY Conns; 69 UINT32 NumConns; 70 71 LIST_ENTRY TcbList; 72 73 // 74 // session-wide parameters 75 // 76 UINT16 TargetPortalGroupTag; 77 UINT32 MaxConnections; 78 BOOLEAN InitialR2T; 79 BOOLEAN ImmediateData; 80 UINT32 MaxBurstLength; 81 UINT32 FirstBurstLength; 82 UINT32 DefaultTime2Wait; 83 UINT32 DefaultTime2Retain; 84 UINT16 MaxOutstandingR2T; 85 BOOLEAN DataPDUInOrder; 86 BOOLEAN DataSequenceInOrder; 87 UINT8 ErrorRecoveryLevel; 88 }; 89 90 #define ISCSI_CONNECTION_SIGNATURE SIGNATURE_32 ('I', 'S', 'C', 'N') 91 92 struct _ISCSI_CONNECTION { 93 UINT32 Signature; 94 LIST_ENTRY Link; 95 96 EFI_EVENT TimeoutEvent; 97 98 ISCSI_SESSION *Session; 99 100 UINT8 State; 101 UINT8 CurrentStage; 102 UINT8 NextStage; 103 104 UINT8 CHAPStep; 105 106 BOOLEAN PartialReqSent; 107 BOOLEAN PartialRspRcvd; 108 109 BOOLEAN TransitInitiated; 110 111 UINT16 Cid; 112 UINT32 ExpStatSN; 113 114 // 115 // queues... 116 // 117 NET_BUF_QUEUE RspQue; 118 119 TCP4_IO Tcp4Io; 120 121 // 122 // connection-only parameters 123 // 124 UINT32 MaxRecvDataSegmentLength; 125 ISCSI_DIGEST_TYPE HeaderDigest; 126 ISCSI_DIGEST_TYPE DataDigest; 127 }; 128 129 #define ISCSI_DRIVER_DATA_SIGNATURE SIGNATURE_32 ('I', 'S', 'D', 'A') 130 131 #define ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU(PassThru) \ 132 CR ( \ 133 PassThru, \ 134 ISCSI_DRIVER_DATA, \ 135 IScsiExtScsiPassThru, \ 136 ISCSI_DRIVER_DATA_SIGNATURE \ 137 ) 138 #define ISCSI_DRIVER_DATA_FROM_IDENTIFIER(Identifier) \ 139 CR ( \ 140 Identifier, \ 141 ISCSI_DRIVER_DATA, \ 142 IScsiIdentifier, \ 143 ISCSI_DRIVER_DATA_SIGNATURE \ 144 ) 145 #define ISCSI_DRIVER_DATA_FROM_SESSION(s) \ 146 CR ( \ 147 s, \ 148 ISCSI_DRIVER_DATA, \ 149 Session, \ 150 ISCSI_DRIVER_DATA_SIGNATURE \ 151 ) 152 153 struct _ISCSI_DRIVER_DATA { 154 UINT32 Signature; 155 EFI_HANDLE Image; 156 EFI_HANDLE Controller; 157 ISCSI_PRIVATE_PROTOCOL IScsiIdentifier; 158 EFI_HANDLE ChildHandle; 159 EFI_EVENT ExitBootServiceEvent; 160 161 EFI_EXT_SCSI_PASS_THRU_PROTOCOL IScsiExtScsiPassThru; 162 EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode; 163 EFI_HANDLE ExtScsiPassThruHandle; 164 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 165 166 ISCSI_SESSION Session; 167 }; 168 169 #endif 170