NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// EFI Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName = {
IScsiComponentNameGetDriverName,
IScsiComponentNameGetControllerName,
"eng"
@@ -20,13 +20,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName =
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IScsiComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IScsiComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)IScsiComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)IScsiComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIScsiDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIScsiDriverNameTable[] = {
{
"eng;en",
L"iSCSI Driver"
@@ -81,9 +81,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gIScsiControllerNameTab
EFI_STATUS
EFIAPI
IScsiComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
@@ -91,7 +91,7 @@ IScsiComponentNameGetDriverName (
This->SupportedLanguages,
mIScsiDriverNameTable,
DriverName,
(BOOLEAN) (This == &gIScsiComponentName)
(BOOLEAN)(This == &gIScsiComponentName)
);
}
@@ -108,14 +108,14 @@ IScsiComponentNameGetDriverName (
**/
EFI_STATUS
UpdateName (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru,
IN BOOLEAN Ipv6Flag
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru,
IN BOOLEAN Ipv6Flag
)
{
EFI_STATUS Status;
CHAR16 HandleName[80];
ISCSI_DRIVER_DATA *Private;
UINT8 NicIndex;
EFI_STATUS Status;
CHAR16 HandleName[80];
ISCSI_DRIVER_DATA *Private;
UINT8 NicIndex;
if (IScsiExtScsiPassThru == NULL) {
return EFI_INVALID_PARAMETER;
@@ -130,7 +130,7 @@ UpdateName (
L"iSCSI (%s, NicIndex=%d)",
Ipv6Flag ? L"IPv6" : L"IPv4",
NicIndex
);
);
if (gIScsiControllerNameTable != NULL) {
FreeUnicodeStringTable (gIScsiControllerNameTable);
@@ -228,21 +228,21 @@ UpdateName (
EFI_STATUS
EFIAPI
IScsiComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
EFI_HANDLE IScsiController;
BOOLEAN Ipv6Flag;
EFI_GUID *IScsiPrivateGuid;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
EFI_HANDLE IScsiController;
BOOLEAN Ipv6Flag;
EFI_GUID *IScsiPrivateGuid;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *IScsiExtScsiPassThru;
if (ControllerHandle == NULL) {
return EFI_UNSUPPORTED;
@@ -254,12 +254,12 @@ IScsiComponentNameGetControllerName (
IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp4ProtocolGuid);
if (IScsiController != NULL) {
IScsiPrivateGuid = &gIScsiV4PrivateGuid;
Ipv6Flag = FALSE;
Ipv6Flag = FALSE;
} else {
IScsiController = NetLibGetNicHandle (ControllerHandle, &gEfiTcp6ProtocolGuid);
if (IScsiController != NULL) {
IScsiPrivateGuid = &gIScsiV6PrivateGuid;
Ipv6Flag = TRUE;
Ipv6Flag = TRUE;
} else {
return EFI_UNSUPPORTED;
}
@@ -268,7 +268,7 @@ IScsiComponentNameGetControllerName (
Status = gBS->OpenProtocol (
IScsiController,
IScsiPrivateGuid,
(VOID **) &IScsiIdentifier,
(VOID **)&IScsiIdentifier,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -277,8 +277,8 @@ IScsiComponentNameGetControllerName (
return Status;
}
if(ChildHandle != NULL) {
if(!Ipv6Flag) {
if (ChildHandle != NULL) {
if (!Ipv6Flag) {
//
// Make sure this driver produced ChildHandle
//
@@ -310,7 +310,7 @@ IScsiComponentNameGetControllerName (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiExtScsiPassThruProtocolGuid,
(VOID **)&IScsiExtScsiPassThru,
(VOID **)&IScsiExtScsiPassThru,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL

View File

@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo = {
EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo = {
IScsiGetAuthenticationInfo,
IScsiSetAuthenticationInfo
};
@@ -30,9 +30,9 @@ EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo = {
EFI_STATUS
EFIAPI
IScsiGetAuthenticationInfo (
IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
OUT VOID **Buffer
IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
OUT VOID **Buffer
)
{
return EFI_DEVICE_ERROR;

View File

@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// macros. CHAP_HASH structures at lower subscripts in the array are preferred
// by the initiator.
//
STATIC CONST CHAP_HASH mChapHash[] = {
STATIC CONST CHAP_HASH mChapHash[] = {
{
ISCSI_CHAP_ALGORITHM_SHA256,
SHA256_DIGEST_SIZE,
@@ -23,7 +23,7 @@ STATIC CONST CHAP_HASH mChapHash[] = {
Sha256Update,
Sha256Final
},
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
//
// Keep the deprecated MD5 entry at the end of the array (making MD5 the
// least preferred choice of the initiator).
@@ -36,7 +36,7 @@ STATIC CONST CHAP_HASH mChapHash[] = {
Md5Update,
Md5Final
},
#endif // ENABLE_MD5_DEPRECATED_INTERFACES
#endif // ENABLE_MD5_DEPRECATED_INTERFACES
};
//
@@ -44,17 +44,17 @@ STATIC CONST CHAP_HASH mChapHash[] = {
// CHAP_A=<A1,A2...> value string, by the IScsiCHAPInitHashList() function. It
// is sent by the initiator in ISCSI_CHAP_STEP_ONE.
//
STATIC CHAR8 mChapHashListString[
3 + // UINT8 identifier in
// decimal
(1 + 3) * (ARRAY_SIZE (mChapHash) - 1) + // comma prepended for
// entries after the
// first
1 + // extra character for
// AsciiSPrint()
// truncation check
1 // terminating NUL
];
STATIC CHAR8 mChapHashListString[
3 + // UINT8 identifier in
// decimal
(1 + 3) * (ARRAY_SIZE (mChapHash) - 1) + // comma prepended for
// entries after the
// first
1 + // extra character for
// AsciiSPrint()
// truncation check
1 // terminating NUL
];
/**
Initiator calculates its own expected hash value.
@@ -82,13 +82,13 @@ STATIC CHAR8 mChapHashListString[
**/
EFI_STATUS
IScsiCHAPCalculateResponse (
IN UINT32 ChapIdentifier,
IN CHAR8 *ChapSecret,
IN UINT32 SecretLength,
IN UINT8 *ChapChallenge,
IN UINT32 ChallengeLength,
IN CONST CHAP_HASH *Hash,
OUT UINT8 *ChapResponse
IN UINT32 ChapIdentifier,
IN CHAR8 *ChapSecret,
IN UINT32 SecretLength,
IN UINT8 *ChapChallenge,
IN UINT32 ChallengeLength,
IN CONST CHAP_HASH *Hash,
OUT UINT8 *ChapResponse
)
{
UINTN ContextSize;
@@ -103,7 +103,7 @@ IScsiCHAPCalculateResponse (
ASSERT (Hash != NULL);
ContextSize = Hash->GetContextSize ();
Ctx = AllocatePool (ContextSize);
Ctx = AllocatePool (ContextSize);
if (Ctx == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -117,7 +117,7 @@ IScsiCHAPCalculateResponse (
//
// Hash Identifier - Only calculate 1 byte data (RFC1994)
//
IdByte[0] = (CHAR8) ChapIdentifier;
IdByte[0] = (CHAR8)ChapIdentifier;
if (!Hash->Update (Ctx, IdByte, 1)) {
goto Exit;
}
@@ -170,9 +170,9 @@ IScsiCHAPAuthTarget (
UINT8 VerifyRsp[ISCSI_CHAP_MAX_DIGEST_SIZE];
INTN Mismatch;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
SecretSize = (UINT32) AsciiStrLen (AuthData->AuthConfig->ReverseCHAPSecret);
SecretSize = (UINT32)AsciiStrLen (AuthData->AuthConfig->ReverseCHAPSecret);
ASSERT (AuthData->Hash != NULL);
@@ -198,7 +198,6 @@ IScsiCHAPAuthTarget (
return Status;
}
/**
This function checks the received iSCSI Login Response during the security
negotiation stage.
@@ -216,33 +215,34 @@ IScsiCHAPOnRspReceived (
IN ISCSI_CONNECTION *Conn
)
{
EFI_STATUS Status;
ISCSI_SESSION *Session;
ISCSI_CHAP_AUTH_DATA *AuthData;
CHAR8 *Value;
UINT8 *Data;
UINT32 Len;
LIST_ENTRY *KeyValueList;
UINTN Algorithm;
CHAR8 *Identifier;
CHAR8 *Challenge;
CHAR8 *Name;
CHAR8 *Response;
UINT8 TargetRsp[ISCSI_CHAP_MAX_DIGEST_SIZE];
UINT32 RspLen;
UINTN Result;
UINTN HashIndex;
EFI_STATUS Status;
ISCSI_SESSION *Session;
ISCSI_CHAP_AUTH_DATA *AuthData;
CHAR8 *Value;
UINT8 *Data;
UINT32 Len;
LIST_ENTRY *KeyValueList;
UINTN Algorithm;
CHAR8 *Identifier;
CHAR8 *Challenge;
CHAR8 *Name;
CHAR8 *Response;
UINT8 TargetRsp[ISCSI_CHAP_MAX_DIGEST_SIZE];
UINT32 RspLen;
UINTN Result;
UINTN HashIndex;
ASSERT (Conn->CurrentStage == ISCSI_SECURITY_NEGOTIATION);
ASSERT (Conn->RspQue.BufNum != 0);
Session = Conn->Session;
AuthData = &Session->AuthData.CHAP;
Len = Conn->RspQue.BufSize;
Data = AllocateZeroPool (Len);
Session = Conn->Session;
AuthData = &Session->AuthData.CHAP;
Len = Conn->RspQue.BufSize;
Data = AllocateZeroPool (Len);
if (Data == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Copy the data in case the data spans over multiple PDUs.
//
@@ -251,7 +251,7 @@ IScsiCHAPOnRspReceived (
//
// Build the key-value list from the data segment of the Login Response.
//
KeyValueList = IScsiBuildKeyValueList ((CHAR8 *) Data, Len);
KeyValueList = IScsiBuildKeyValueList ((CHAR8 *)Data, Len);
if (KeyValueList == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
@@ -260,179 +260,184 @@ IScsiCHAPOnRspReceived (
Status = EFI_PROTOCOL_ERROR;
switch (Conn->AuthStep) {
case ISCSI_AUTH_INITIAL:
//
// The first Login Response.
//
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_TARGET_PORTAL_GROUP_TAG
);
if (Value == NULL) {
goto ON_EXIT;
}
case ISCSI_AUTH_INITIAL:
//
// The first Login Response.
//
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_TARGET_PORTAL_GROUP_TAG
);
if (Value == NULL) {
goto ON_EXIT;
}
Result = IScsiNetNtoi (Value);
if (Result > 0xFFFF) {
goto ON_EXIT;
}
Result = IScsiNetNtoi (Value);
if (Result > 0xFFFF) {
goto ON_EXIT;
}
Session->TargetPortalGroupTag = (UINT16) Result;
Session->TargetPortalGroupTag = (UINT16)Result;
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_AUTH_METHOD
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_AUTH_METHOD
);
if (Value == NULL) {
goto ON_EXIT;
}
//
// Initiator mandates CHAP authentication but target replies without
// "CHAP", or initiator suggets "None" but target replies with some kind of
// auth method.
//
if (Session->AuthType == ISCSI_AUTH_TYPE_NONE) {
if (AsciiStrCmp (Value, ISCSI_KEY_VALUE_NONE) != 0) {
goto ON_EXIT;
}
} else if (Session->AuthType == ISCSI_AUTH_TYPE_CHAP) {
if (AsciiStrCmp (Value, ISCSI_AUTH_METHOD_CHAP) != 0) {
goto ON_EXIT;
}
} else {
goto ON_EXIT;
}
//
// Transit to CHAP step one.
//
Conn->AuthStep = ISCSI_CHAP_STEP_ONE;
Status = EFI_SUCCESS;
break;
case ISCSI_CHAP_STEP_TWO:
//
// The Target replies with CHAP_A=<A> CHAP_I=<I> CHAP_C=<C>
//
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_ALGORITHM
);
if (Value == NULL) {
goto ON_EXIT;
}
Algorithm = IScsiNetNtoi (Value);
for (HashIndex = 0; HashIndex < ARRAY_SIZE (mChapHash); HashIndex++) {
if (Algorithm == mChapHash[HashIndex].Algorithm) {
break;
}
}
if (HashIndex == ARRAY_SIZE (mChapHash)) {
//
// Unsupported algorithm is chosen by target.
//
goto ON_EXIT;
}
//
// Remember the target's chosen hash algorithm.
//
ASSERT (AuthData->Hash == NULL);
AuthData->Hash = &mChapHash[HashIndex];
Identifier = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_IDENTIFIER
);
if (Identifier == NULL) {
goto ON_EXIT;
}
Challenge = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_CHALLENGE
);
if (Challenge == NULL) {
goto ON_EXIT;
}
//
// Process the CHAP identifier and CHAP Challenge from Target.
// Calculate Response value.
//
Result = IScsiNetNtoi (Identifier);
if (Result > 0xFF) {
goto ON_EXIT;
}
AuthData->InIdentifier = (UINT32)Result;
AuthData->InChallengeLength = (UINT32)sizeof (AuthData->InChallenge);
Status = IScsiHexToBin (
(UINT8 *)AuthData->InChallenge,
&AuthData->InChallengeLength,
Challenge
);
if (Value == NULL) {
goto ON_EXIT;
}
//
// Initiator mandates CHAP authentication but target replies without
// "CHAP", or initiator suggets "None" but target replies with some kind of
// auth method.
//
if (Session->AuthType == ISCSI_AUTH_TYPE_NONE) {
if (AsciiStrCmp (Value, ISCSI_KEY_VALUE_NONE) != 0) {
if (EFI_ERROR (Status)) {
Status = EFI_PROTOCOL_ERROR;
goto ON_EXIT;
}
} else if (Session->AuthType == ISCSI_AUTH_TYPE_CHAP) {
if (AsciiStrCmp (Value, ISCSI_AUTH_METHOD_CHAP) != 0) {
goto ON_EXIT;
}
} else {
goto ON_EXIT;
}
//
// Transit to CHAP step one.
//
Conn->AuthStep = ISCSI_CHAP_STEP_ONE;
Status = EFI_SUCCESS;
break;
case ISCSI_CHAP_STEP_TWO:
//
// The Target replies with CHAP_A=<A> CHAP_I=<I> CHAP_C=<C>
//
Value = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_ALGORITHM
);
if (Value == NULL) {
goto ON_EXIT;
}
Algorithm = IScsiNetNtoi (Value);
for (HashIndex = 0; HashIndex < ARRAY_SIZE (mChapHash); HashIndex++) {
if (Algorithm == mChapHash[HashIndex].Algorithm) {
break;
}
}
if (HashIndex == ARRAY_SIZE (mChapHash)) {
//
// Unsupported algorithm is chosen by target.
//
goto ON_EXIT;
}
//
// Remember the target's chosen hash algorithm.
//
ASSERT (AuthData->Hash == NULL);
AuthData->Hash = &mChapHash[HashIndex];
Identifier = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_IDENTIFIER
);
if (Identifier == NULL) {
goto ON_EXIT;
}
Challenge = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_CHALLENGE
);
if (Challenge == NULL) {
goto ON_EXIT;
}
//
// Process the CHAP identifier and CHAP Challenge from Target.
// Calculate Response value.
//
Result = IScsiNetNtoi (Identifier);
if (Result > 0xFF) {
goto ON_EXIT;
}
AuthData->InIdentifier = (UINT32) Result;
AuthData->InChallengeLength = (UINT32) sizeof (AuthData->InChallenge);
Status = IScsiHexToBin (
(UINT8 *) AuthData->InChallenge,
&AuthData->InChallengeLength,
Challenge
);
if (EFI_ERROR (Status)) {
Status = EFI_PROTOCOL_ERROR;
goto ON_EXIT;
}
Status = IScsiCHAPCalculateResponse (
AuthData->InIdentifier,
AuthData->AuthConfig->CHAPSecret,
(UINT32) AsciiStrLen (AuthData->AuthConfig->CHAPSecret),
AuthData->InChallenge,
AuthData->InChallengeLength,
AuthData->Hash,
AuthData->CHAPResponse
);
//
// Transit to next step.
//
Conn->AuthStep = ISCSI_CHAP_STEP_THREE;
break;
case ISCSI_CHAP_STEP_THREE:
//
// One way CHAP authentication and the target would like to
// authenticate us.
//
Status = EFI_SUCCESS;
break;
case ISCSI_CHAP_STEP_FOUR:
ASSERT (AuthData->AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL);
//
// The forth step, CHAP_N=<N> CHAP_R=<R> is received from Target.
//
Name = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_CHAP_NAME);
if (Name == NULL) {
goto ON_EXIT;
}
Response = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_RESPONSE
Status = IScsiCHAPCalculateResponse (
AuthData->InIdentifier,
AuthData->AuthConfig->CHAPSecret,
(UINT32)AsciiStrLen (AuthData->AuthConfig->CHAPSecret),
AuthData->InChallenge,
AuthData->InChallengeLength,
AuthData->Hash,
AuthData->CHAPResponse
);
if (Response == NULL) {
goto ON_EXIT;
}
ASSERT (AuthData->Hash != NULL);
RspLen = AuthData->Hash->DigestSize;
Status = IScsiHexToBin (TargetRsp, &RspLen, Response);
if (EFI_ERROR (Status) || RspLen != AuthData->Hash->DigestSize) {
Status = EFI_PROTOCOL_ERROR;
goto ON_EXIT;
}
//
// Transit to next step.
//
Conn->AuthStep = ISCSI_CHAP_STEP_THREE;
break;
//
// Check the CHAP Name and Response replied by Target.
//
Status = IScsiCHAPAuthTarget (AuthData, TargetRsp);
break;
case ISCSI_CHAP_STEP_THREE:
//
// One way CHAP authentication and the target would like to
// authenticate us.
//
Status = EFI_SUCCESS;
break;
default:
break;
case ISCSI_CHAP_STEP_FOUR:
ASSERT (AuthData->AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL);
//
// The forth step, CHAP_N=<N> CHAP_R=<R> is received from Target.
//
Name = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_CHAP_NAME);
if (Name == NULL) {
goto ON_EXIT;
}
Response = IScsiGetValueByKeyFromList (
KeyValueList,
ISCSI_KEY_CHAP_RESPONSE
);
if (Response == NULL) {
goto ON_EXIT;
}
ASSERT (AuthData->Hash != NULL);
RspLen = AuthData->Hash->DigestSize;
Status = IScsiHexToBin (TargetRsp, &RspLen, Response);
if (EFI_ERROR (Status) || (RspLen != AuthData->Hash->DigestSize)) {
Status = EFI_PROTOCOL_ERROR;
goto ON_EXIT;
}
//
// Check the CHAP Name and Response replied by Target.
//
Status = IScsiCHAPAuthTarget (AuthData, TargetRsp);
break;
default:
break;
}
ON_EXIT:
@@ -446,7 +451,6 @@ ON_EXIT:
return Status;
}
/**
This function fills the CHAP authentication information into the login PDU
during the security negotiation stage in the iSCSI connection login.
@@ -467,140 +471,142 @@ IScsiCHAPToSendReq (
IN OUT NET_BUF *Pdu
)
{
EFI_STATUS Status;
ISCSI_SESSION *Session;
ISCSI_LOGIN_REQUEST *LoginReq;
ISCSI_CHAP_AUTH_DATA *AuthData;
CHAR8 *Value;
CHAR8 ValueStr[256];
CHAR8 *Response;
UINT32 RspLen;
CHAR8 *Challenge;
UINT32 ChallengeLen;
EFI_STATUS BinToHexStatus;
EFI_STATUS Status;
ISCSI_SESSION *Session;
ISCSI_LOGIN_REQUEST *LoginReq;
ISCSI_CHAP_AUTH_DATA *AuthData;
CHAR8 *Value;
CHAR8 ValueStr[256];
CHAR8 *Response;
UINT32 RspLen;
CHAR8 *Challenge;
UINT32 ChallengeLen;
EFI_STATUS BinToHexStatus;
ASSERT (Conn->CurrentStage == ISCSI_SECURITY_NEGOTIATION);
Session = Conn->Session;
AuthData = &Session->AuthData.CHAP;
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, 0);
Session = Conn->Session;
AuthData = &Session->AuthData.CHAP;
LoginReq = (ISCSI_LOGIN_REQUEST *)NetbufGetByte (Pdu, 0, 0);
if (LoginReq == NULL) {
return EFI_PROTOCOL_ERROR;
}
Status = EFI_SUCCESS;
RspLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
Response = AllocateZeroPool (RspLen);
Status = EFI_SUCCESS;
RspLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
Response = AllocateZeroPool (RspLen);
if (Response == NULL) {
return EFI_OUT_OF_RESOURCES;
}
ChallengeLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
Challenge = AllocateZeroPool (ChallengeLen);
ChallengeLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
Challenge = AllocateZeroPool (ChallengeLen);
if (Challenge == NULL) {
FreePool (Response);
return EFI_OUT_OF_RESOURCES;
}
switch (Conn->AuthStep) {
case ISCSI_AUTH_INITIAL:
//
// It's the initial Login Request. Fill in the key=value pairs mandatory
// for the initial Login Request.
//
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_INITIATOR_NAME,
mPrivate->InitiatorName
);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_SESSION_TYPE, "Normal");
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_TARGET_NAME,
Session->ConfigData->SessionConfigData.TargetName
);
if (Session->AuthType == ISCSI_AUTH_TYPE_NONE) {
Value = ISCSI_KEY_VALUE_NONE;
ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
} else {
Value = ISCSI_AUTH_METHOD_CHAP;
}
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_AUTH_METHOD, Value);
break;
case ISCSI_CHAP_STEP_ONE:
//
// First step, send the Login Request with CHAP_A=<A1,A2...> key-value
// pair.
//
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_ALGORITHM, mChapHashListString);
Conn->AuthStep = ISCSI_CHAP_STEP_TWO;
break;
case ISCSI_CHAP_STEP_THREE:
//
// Third step, send the Login Request with CHAP_N=<N> CHAP_R=<R> or
// CHAP_N=<N> CHAP_R=<R> CHAP_I=<I> CHAP_C=<C> if target authentication is
// required too.
//
// CHAP_N=<N>
//
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_CHAP_NAME,
(CHAR8 *) &AuthData->AuthConfig->CHAPName
);
//
// CHAP_R=<R>
//
ASSERT (AuthData->Hash != NULL);
BinToHexStatus = IScsiBinToHex (
(UINT8 *) AuthData->CHAPResponse,
AuthData->Hash->DigestSize,
Response,
&RspLen
);
ASSERT_EFI_ERROR (BinToHexStatus);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_RESPONSE, Response);
if (AuthData->AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL) {
case ISCSI_AUTH_INITIAL:
//
// CHAP_I=<I>
// It's the initial Login Request. Fill in the key=value pairs mandatory
// for the initial Login Request.
//
IScsiGenRandom ((UINT8 *) &AuthData->OutIdentifier, 1);
AsciiSPrint (ValueStr, sizeof (ValueStr), "%d", AuthData->OutIdentifier);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_IDENTIFIER, ValueStr);
//
// CHAP_C=<C>
//
IScsiGenRandom (
(UINT8 *) AuthData->OutChallenge,
AuthData->Hash->DigestSize
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_INITIATOR_NAME,
mPrivate->InitiatorName
);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_SESSION_TYPE, "Normal");
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_TARGET_NAME,
Session->ConfigData->SessionConfigData.TargetName
);
if (Session->AuthType == ISCSI_AUTH_TYPE_NONE) {
Value = ISCSI_KEY_VALUE_NONE;
ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
} else {
Value = ISCSI_AUTH_METHOD_CHAP;
}
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_AUTH_METHOD, Value);
break;
case ISCSI_CHAP_STEP_ONE:
//
// First step, send the Login Request with CHAP_A=<A1,A2...> key-value
// pair.
//
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_ALGORITHM, mChapHashListString);
Conn->AuthStep = ISCSI_CHAP_STEP_TWO;
break;
case ISCSI_CHAP_STEP_THREE:
//
// Third step, send the Login Request with CHAP_N=<N> CHAP_R=<R> or
// CHAP_N=<N> CHAP_R=<R> CHAP_I=<I> CHAP_C=<C> if target authentication is
// required too.
//
// CHAP_N=<N>
//
IScsiAddKeyValuePair (
Pdu,
ISCSI_KEY_CHAP_NAME,
(CHAR8 *)&AuthData->AuthConfig->CHAPName
);
//
// CHAP_R=<R>
//
ASSERT (AuthData->Hash != NULL);
BinToHexStatus = IScsiBinToHex (
(UINT8 *) AuthData->OutChallenge,
(UINT8 *)AuthData->CHAPResponse,
AuthData->Hash->DigestSize,
Challenge,
&ChallengeLen
Response,
&RspLen
);
ASSERT_EFI_ERROR (BinToHexStatus);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_CHALLENGE, Challenge);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_RESPONSE, Response);
Conn->AuthStep = ISCSI_CHAP_STEP_FOUR;
}
//
// Set the stage transition flag.
//
ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
break;
if (AuthData->AuthConfig->CHAPType == ISCSI_CHAP_MUTUAL) {
//
// CHAP_I=<I>
//
IScsiGenRandom ((UINT8 *)&AuthData->OutIdentifier, 1);
AsciiSPrint (ValueStr, sizeof (ValueStr), "%d", AuthData->OutIdentifier);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_IDENTIFIER, ValueStr);
//
// CHAP_C=<C>
//
IScsiGenRandom (
(UINT8 *)AuthData->OutChallenge,
AuthData->Hash->DigestSize
);
BinToHexStatus = IScsiBinToHex (
(UINT8 *)AuthData->OutChallenge,
AuthData->Hash->DigestSize,
Challenge,
&ChallengeLen
);
ASSERT_EFI_ERROR (BinToHexStatus);
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_CHAP_CHALLENGE, Challenge);
default:
Status = EFI_PROTOCOL_ERROR;
break;
Conn->AuthStep = ISCSI_CHAP_STEP_FOUR;
}
//
// Set the stage transition flag.
//
ISCSI_SET_FLAG (LoginReq, ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT);
break;
default:
Status = EFI_PROTOCOL_ERROR;
break;
}
FreePool (Response);
@@ -621,14 +627,14 @@ IScsiCHAPInitHashList (
VOID
)
{
CHAR8 *Position;
UINTN Left;
UINTN HashIndex;
CONST CHAP_HASH *Hash;
UINTN Printed;
CHAR8 *Position;
UINTN Left;
UINTN HashIndex;
CONST CHAP_HASH *Hash;
UINTN Printed;
Position = mChapHashListString;
Left = sizeof (mChapHashListString);
Left = sizeof (mChapHashListString);
for (HashIndex = 0; HashIndex < ARRAY_SIZE (mChapHash); HashIndex++) {
Hash = &mChapHash[HashIndex];
@@ -657,7 +663,7 @@ IScsiCHAPInitHashList (
ASSERT (Printed + 1 < Left);
Position += Printed;
Left -= Printed;
Left -= Printed;
//
// Sanity-check the digest size for Hash.

View File

@@ -9,41 +9,40 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _ISCSI_CHAP_H_
#define _ISCSI_CHAP_H_
#define ISCSI_AUTH_METHOD_CHAP "CHAP"
#define ISCSI_AUTH_METHOD_CHAP "CHAP"
#define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"
#define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"
#define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"
#define ISCSI_KEY_CHAP_NAME "CHAP_N"
#define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"
#define ISCSI_KEY_CHAP_ALGORITHM "CHAP_A"
#define ISCSI_KEY_CHAP_IDENTIFIER "CHAP_I"
#define ISCSI_KEY_CHAP_CHALLENGE "CHAP_C"
#define ISCSI_KEY_CHAP_NAME "CHAP_N"
#define ISCSI_KEY_CHAP_RESPONSE "CHAP_R"
//
// Identifiers of supported CHAP hash algorithms:
// https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml#ppp-numbers-9
//
#define ISCSI_CHAP_ALGORITHM_MD5 5
#define ISCSI_CHAP_ALGORITHM_SHA256 7
#define ISCSI_CHAP_ALGORITHM_MD5 5
#define ISCSI_CHAP_ALGORITHM_SHA256 7
//
// Byte count of the largest digest over the above-listed
// ISCSI_CHAP_ALGORITHM_* hash algorithms.
//
#define ISCSI_CHAP_MAX_DIGEST_SIZE SHA256_DIGEST_SIZE
#define ISCSI_CHAP_STEP_ONE 1
#define ISCSI_CHAP_STEP_TWO 2
#define ISCSI_CHAP_STEP_THREE 3
#define ISCSI_CHAP_STEP_FOUR 4
#define ISCSI_CHAP_MAX_DIGEST_SIZE SHA256_DIGEST_SIZE
#define ISCSI_CHAP_STEP_ONE 1
#define ISCSI_CHAP_STEP_TWO 2
#define ISCSI_CHAP_STEP_THREE 3
#define ISCSI_CHAP_STEP_FOUR 4
#pragma pack(1)
typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
UINT8 CHAPType;
CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
UINT8 CHAPType;
CHAR8 CHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR8 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR8 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR8 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
} ISCSI_CHAP_AUTH_CONFIG_NVDATA;
#pragma pack()
@@ -53,19 +52,19 @@ typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
//
typedef
UINTN
(EFIAPI *CHAP_HASH_GET_CONTEXT_SIZE) (
(EFIAPI *CHAP_HASH_GET_CONTEXT_SIZE)(
VOID
);
typedef
BOOLEAN
(EFIAPI *CHAP_HASH_INIT) (
(EFIAPI *CHAP_HASH_INIT)(
OUT VOID *Context
);
typedef
BOOLEAN
(EFIAPI *CHAP_HASH_UPDATE) (
(EFIAPI *CHAP_HASH_UPDATE)(
IN OUT VOID *Context,
IN CONST VOID *Data,
IN UINTN DataSize
@@ -73,37 +72,37 @@ BOOLEAN
typedef
BOOLEAN
(EFIAPI *CHAP_HASH_FINAL) (
(EFIAPI *CHAP_HASH_FINAL)(
IN OUT VOID *Context,
OUT UINT8 *HashValue
);
typedef struct {
UINT8 Algorithm; // ISCSI_CHAP_ALGORITHM_*, CHAP_A
UINT32 DigestSize;
CHAP_HASH_GET_CONTEXT_SIZE GetContextSize;
CHAP_HASH_INIT Init;
CHAP_HASH_UPDATE Update;
CHAP_HASH_FINAL Final;
UINT8 Algorithm; // ISCSI_CHAP_ALGORITHM_*, CHAP_A
UINT32 DigestSize;
CHAP_HASH_GET_CONTEXT_SIZE GetContextSize;
CHAP_HASH_INIT Init;
CHAP_HASH_UPDATE Update;
CHAP_HASH_FINAL Final;
} CHAP_HASH;
///
/// ISCSI CHAP Authentication Data
///
typedef struct _ISCSI_CHAP_AUTH_DATA {
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
UINT32 InIdentifier;
UINT8 InChallenge[1024];
UINT32 InChallengeLength;
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
UINT32 InIdentifier;
UINT8 InChallenge[1024];
UINT32 InChallengeLength;
//
// The hash algorithm (CHAP_A) that the target selects in
// ISCSI_CHAP_STEP_TWO.
//
CONST CHAP_HASH *Hash;
CONST CHAP_HASH *Hash;
//
// Calculated CHAP Response (CHAP_R) value.
//
UINT8 CHAPResponse[ISCSI_CHAP_MAX_DIGEST_SIZE];
UINT8 CHAPResponse[ISCSI_CHAP_MAX_DIGEST_SIZE];
//
// Auth-data to be sent out for mutual authentication.
@@ -113,8 +112,8 @@ typedef struct _ISCSI_CHAP_AUTH_DATA {
// digest size. In other words, it's good practice to feed *at least as many
// bytes* to the hashing algorithm as the hashing algorithm will output.
//
UINT32 OutIdentifier;
UINT8 OutChallenge[ISCSI_CHAP_MAX_DIGEST_SIZE];
UINT32 OutIdentifier;
UINT8 OutChallenge[ISCSI_CHAP_MAX_DIGEST_SIZE];
} ISCSI_CHAP_AUTH_DATA;
/**
@@ -133,6 +132,7 @@ EFI_STATUS
IScsiCHAPOnRspReceived (
IN ISCSI_CONNECTION *Conn
);
/**
This function fills the CHAP authentication information into the login PDU
during the security negotiation stage in the iSCSI connection login.
@@ -164,4 +164,5 @@ VOID
IScsiCHAPInitHashList (
VOID
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -14,10 +14,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
typedef struct _ISCSI_FORM_CALLBACK_INFO ISCSI_FORM_CALLBACK_INFO;
extern UINT8 IScsiConfigVfrBin[];
extern UINT8 IScsiDxeStrings[];
extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
extern UINT8 IScsiConfigVfrBin[];
extern UINT8 IScsiDxeStrings[];
extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
#define VAR_OFFSET(Field) \
((UINT16) ((UINTN) &(((ISCSI_CONFIG_IFR_NVDATA *) 0)->Field)))
@@ -25,65 +24,64 @@ extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
#define QUESTION_ID(Field) \
((UINT16) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET))
#define DYNAMIC_ONE_OF_VAR_OFFSET VAR_OFFSET (Enabled)
#define DYNAMIC_ORDERED_LIST_QUESTION_ID QUESTION_ID (DynamicOrderedList)
#define DYNAMIC_ORDERED_LIST_VAR_OFFSET VAR_OFFSET (DynamicOrderedList)
#define ATTEMPT_DEL_QUESTION_ID QUESTION_ID (DeleteAttemptList)
#define ATTEMPT_DEL_VAR_OFFSET VAR_OFFSET (DeleteAttemptList)
#define ATTEMPT_ADD_QUESTION_ID QUESTION_ID (AddAttemptList)
#define ATTEMPT_ADD_VAR_OFFSET VAR_OFFSET (AddAttemptList)
#define DYNAMIC_ONE_OF_VAR_OFFSET VAR_OFFSET (Enabled)
#define DYNAMIC_ORDERED_LIST_QUESTION_ID QUESTION_ID (DynamicOrderedList)
#define DYNAMIC_ORDERED_LIST_VAR_OFFSET VAR_OFFSET (DynamicOrderedList)
#define ATTEMPT_DEL_QUESTION_ID QUESTION_ID (DeleteAttemptList)
#define ATTEMPT_DEL_VAR_OFFSET VAR_OFFSET (DeleteAttemptList)
#define ATTEMPT_ADD_QUESTION_ID QUESTION_ID (AddAttemptList)
#define ATTEMPT_ADD_VAR_OFFSET VAR_OFFSET (AddAttemptList)
//
// Define QuestionId and OffSet for Keywords.
//
#define ATTEMPT_MAC_ADDR_VAR_OFFSET VAR_OFFSET (ISCSIMacAddr)
#define ATTEMPT_ATTEMPT_NAME_QUESTION_ID QUESTION_ID (ISCSIAttemptName)
#define ATTEMPT_ATTEMPT_NAME_VAR_OFFSET VAR_OFFSET (ISCSIAttemptName)
#define ATTEMPT_BOOTENABLE_QUESTION_ID QUESTION_ID (ISCSIBootEnableList)
#define ATTEMPT_BOOTENABLE_VAR_OFFSET VAR_OFFSET (ISCSIBootEnableList)
#define ATTEMPT_ADDRESS_TYPE_QUESTION_ID QUESTION_ID (ISCSIIpAddressTypeList)
#define ATTEMPT_ADDRESS_TYPE_VAR_OFFSET VAR_OFFSET (ISCSIIpAddressTypeList)
#define ATTEMPT_CONNECT_RETRY_QUESTION_ID QUESTION_ID (ISCSIConnectRetry)
#define ATTEMPT_CONNECT_RETRY_VAR_OFFSET VAR_OFFSET (ISCSIConnectRetry)
#define ATTEMPT_CONNECT_TIMEOUT_QUESTION_ID QUESTION_ID (ISCSIConnectTimeout)
#define ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET VAR_OFFSET (ISCSIConnectTimeout)
#define ATTEMPT_ISID_QUESTION_ID QUESTION_ID (Keyword->ISCSIIsId)
#define ATTEMPT_ISID_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIIsId)
#define ATTEMPT_INITIATOR_VIA_DHCP_QUESTION_ID QUESTION_ID (ISCSIInitiatorInfoViaDHCP)
#define ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET VAR_OFFSET (ISCSIInitiatorInfoViaDHCP)
#define ATTEMPT_INITIATOR_IP_ADDRESS_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorIpAddress)
#define ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorIpAddress)
#define ATTEMPT_INITIATOR_NET_MASK_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorNetmask)
#define ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorNetmask)
#define ATTEMPT_INITIATOR_GATE_WAY_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorGateway)
#define ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorGateway)
#define ATTEMPT_TARGET_VIA_DHCP_QUESTION_ID QUESTION_ID (ISCSITargetInfoViaDHCP)
#define ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET VAR_OFFSET (ISCSITargetInfoViaDHCP)
#define ATTEMPT_TARGET_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSITargetName)
#define ATTEMPT_TARGET_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSITargetName)
#define ATTEMPT_TARGET_IP_ADDRESS_QUESTION_ID QUESTION_ID (Keyword->ISCSITargetIpAddress)
#define ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET VAR_OFFSET (Keyword->ISCSITargetIpAddress)
#define ATTEMPT_TARGET_TCP_PORT_QUESTION_ID QUESTION_ID (ISCSITargetTcpPort)
#define ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET VAR_OFFSET (ISCSITargetTcpPort)
#define ATTEMPT_LUN_QUESTION_ID QUESTION_ID (Keyword->ISCSILun)
#define ATTEMPT_LUN_VAR_OFFSET VAR_OFFSET (Keyword->ISCSILun)
#define ATTEMPT_AUTHENTICATION_METHOD_QUESTION_ID QUESTION_ID (ISCSIAuthenticationMethod)
#define ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET VAR_OFFSET (ISCSIAuthenticationMethod)
#define ATTEMPT_CHARTYPE_QUESTION_ID QUESTION_ID (ISCSIChapType)
#define ATTEMPT_CHARTYPE_VAR_OFFSET VAR_OFFSET (ISCSIChapType)
#define ATTEMPT_CHAR_USER_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSIChapUsername)
#define ATTEMPT_CHAR_USER_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIChapUsername)
#define ATTEMPT_CHAR_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIChapSecret)
#define ATTEMPT_CHAR_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIChapSecret)
#define ATTEMPT_CHAR_REVERSE_USER_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapUsername)
#define ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapUsername)
#define ATTEMPT_CHAR_REVERSE_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapSecret)
#define ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapSecret)
#define ATTEMPT_MAC_ADDR_VAR_OFFSET VAR_OFFSET (ISCSIMacAddr)
#define ATTEMPT_ATTEMPT_NAME_QUESTION_ID QUESTION_ID (ISCSIAttemptName)
#define ATTEMPT_ATTEMPT_NAME_VAR_OFFSET VAR_OFFSET (ISCSIAttemptName)
#define ATTEMPT_BOOTENABLE_QUESTION_ID QUESTION_ID (ISCSIBootEnableList)
#define ATTEMPT_BOOTENABLE_VAR_OFFSET VAR_OFFSET (ISCSIBootEnableList)
#define ATTEMPT_ADDRESS_TYPE_QUESTION_ID QUESTION_ID (ISCSIIpAddressTypeList)
#define ATTEMPT_ADDRESS_TYPE_VAR_OFFSET VAR_OFFSET (ISCSIIpAddressTypeList)
#define ATTEMPT_CONNECT_RETRY_QUESTION_ID QUESTION_ID (ISCSIConnectRetry)
#define ATTEMPT_CONNECT_RETRY_VAR_OFFSET VAR_OFFSET (ISCSIConnectRetry)
#define ATTEMPT_CONNECT_TIMEOUT_QUESTION_ID QUESTION_ID (ISCSIConnectTimeout)
#define ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET VAR_OFFSET (ISCSIConnectTimeout)
#define ATTEMPT_ISID_QUESTION_ID QUESTION_ID (Keyword->ISCSIIsId)
#define ATTEMPT_ISID_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIIsId)
#define ATTEMPT_INITIATOR_VIA_DHCP_QUESTION_ID QUESTION_ID (ISCSIInitiatorInfoViaDHCP)
#define ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET VAR_OFFSET (ISCSIInitiatorInfoViaDHCP)
#define ATTEMPT_INITIATOR_IP_ADDRESS_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorIpAddress)
#define ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorIpAddress)
#define ATTEMPT_INITIATOR_NET_MASK_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorNetmask)
#define ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorNetmask)
#define ATTEMPT_INITIATOR_GATE_WAY_QUESTION_ID QUESTION_ID (Keyword->ISCSIInitiatorGateway)
#define ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIInitiatorGateway)
#define ATTEMPT_TARGET_VIA_DHCP_QUESTION_ID QUESTION_ID (ISCSITargetInfoViaDHCP)
#define ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET VAR_OFFSET (ISCSITargetInfoViaDHCP)
#define ATTEMPT_TARGET_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSITargetName)
#define ATTEMPT_TARGET_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSITargetName)
#define ATTEMPT_TARGET_IP_ADDRESS_QUESTION_ID QUESTION_ID (Keyword->ISCSITargetIpAddress)
#define ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET VAR_OFFSET (Keyword->ISCSITargetIpAddress)
#define ATTEMPT_TARGET_TCP_PORT_QUESTION_ID QUESTION_ID (ISCSITargetTcpPort)
#define ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET VAR_OFFSET (ISCSITargetTcpPort)
#define ATTEMPT_LUN_QUESTION_ID QUESTION_ID (Keyword->ISCSILun)
#define ATTEMPT_LUN_VAR_OFFSET VAR_OFFSET (Keyword->ISCSILun)
#define ATTEMPT_AUTHENTICATION_METHOD_QUESTION_ID QUESTION_ID (ISCSIAuthenticationMethod)
#define ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET VAR_OFFSET (ISCSIAuthenticationMethod)
#define ATTEMPT_CHARTYPE_QUESTION_ID QUESTION_ID (ISCSIChapType)
#define ATTEMPT_CHARTYPE_VAR_OFFSET VAR_OFFSET (ISCSIChapType)
#define ATTEMPT_CHAR_USER_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSIChapUsername)
#define ATTEMPT_CHAR_USER_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIChapUsername)
#define ATTEMPT_CHAR_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIChapSecret)
#define ATTEMPT_CHAR_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIChapSecret)
#define ATTEMPT_CHAR_REVERSE_USER_NAME_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapUsername)
#define ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapUsername)
#define ATTEMPT_CHAR_REVERSE_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapSecret)
#define ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapSecret)
#define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
#define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
#define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
#define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
#define ISCSI_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'f', 'c', 'i')
@@ -97,47 +95,47 @@ extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
#pragma pack(1)
struct _ISCSI_ATTEMPT_CONFIG_NVDATA {
LIST_ENTRY Link;
UINT8 NicIndex;
UINT8 AttemptConfigIndex;
BOOLEAN DhcpSuccess;
BOOLEAN ValidiBFTPath;
BOOLEAN ValidPath;
UINT8 AutoConfigureMode;
EFI_STRING_ID AttemptTitleToken;
EFI_STRING_ID AttemptTitleHelpToken;
CHAR8 AttemptName[ATTEMPT_NAME_SIZE];
CHAR8 MacString[ISCSI_MAX_MAC_STRING_LEN];
EFI_IP_ADDRESS PrimaryDns;
EFI_IP_ADDRESS SecondaryDns;
EFI_IP_ADDRESS DhcpServer;
ISCSI_SESSION_CONFIG_NVDATA SessionConfigData;
UINT8 AuthenticationType;
LIST_ENTRY Link;
UINT8 NicIndex;
UINT8 AttemptConfigIndex;
BOOLEAN DhcpSuccess;
BOOLEAN ValidiBFTPath;
BOOLEAN ValidPath;
UINT8 AutoConfigureMode;
EFI_STRING_ID AttemptTitleToken;
EFI_STRING_ID AttemptTitleHelpToken;
CHAR8 AttemptName[ATTEMPT_NAME_SIZE];
CHAR8 MacString[ISCSI_MAX_MAC_STRING_LEN];
EFI_IP_ADDRESS PrimaryDns;
EFI_IP_ADDRESS SecondaryDns;
EFI_IP_ADDRESS DhcpServer;
ISCSI_SESSION_CONFIG_NVDATA SessionConfigData;
UINT8 AuthenticationType;
union {
ISCSI_CHAP_AUTH_CONFIG_NVDATA CHAP;
ISCSI_CHAP_AUTH_CONFIG_NVDATA CHAP;
} AuthConfigData;
BOOLEAN AutoConfigureSuccess;
UINT8 Actived;
BOOLEAN AutoConfigureSuccess;
UINT8 Actived;
};
///
/// HII specific Vendor Device Path definition.
///
typedef struct {
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
#pragma pack()
struct _ISCSI_FORM_CALLBACK_INFO {
UINT32 Signature;
EFI_HANDLE DriverHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
UINT16 *KeyList;
VOID *FormBuffer;
EFI_HII_HANDLE RegisteredHandle;
ISCSI_ATTEMPT_CONFIG_NVDATA *Current;
UINT32 Signature;
EFI_HANDLE DriverHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
UINT16 *KeyList;
VOID *FormBuffer;
EFI_HII_HANDLE RegisteredHandle;
ISCSI_ATTEMPT_CONFIG_NVDATA *Current;
};
/**
@@ -158,11 +156,11 @@ struct _ISCSI_FORM_CALLBACK_INFO {
**/
EFI_STATUS
IScsiCreateOpCode (
IN UINT16 StartLabelNumber,
OUT VOID **StartOpCodeHandle,
OUT EFI_IFR_GUID_LABEL **StartLabel,
OUT VOID **EndOpCodeHandle,
OUT EFI_IFR_GUID_LABEL **EndLabel
IN UINT16 StartLabelNumber,
OUT VOID **StartOpCodeHandle,
OUT EFI_IFR_GUID_LABEL **StartLabel,
OUT VOID **EndOpCodeHandle,
OUT EFI_IFR_GUID_LABEL **EndLabel
);
/**
@@ -215,7 +213,7 @@ IScsiConfigUpdateAttempt (
**/
ISCSI_ATTEMPT_CONFIG_NVDATA *
IScsiConfigGetAttemptByConfigIndex (
IN UINT8 AttemptConfigIndex
IN UINT8 AttemptConfigIndex
);
#endif

View File

@@ -11,139 +11,139 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Guid/IScsiConfigHii.h>
#define VAR_EQ_TEST_NAME 0x100
#define CONFIGURATION_VARSTORE_ID 0x6666
#define VAR_EQ_TEST_NAME 0x100
#define CONFIGURATION_VARSTORE_ID 0x6666
#define FORMID_MAIN_FORM 1
#define FORMID_MAC_FORM 2
#define FORMID_ATTEMPT_FORM 3
#define FORMID_ORDER_FORM 4
#define FORMID_DELETE_FORM 5
#define FORMID_MAIN_FORM 1
#define FORMID_MAC_FORM 2
#define FORMID_ATTEMPT_FORM 3
#define FORMID_ORDER_FORM 4
#define FORMID_DELETE_FORM 5
#define ISCSI_MAX_ATTEMPTS_NUM FixedPcdGet8 (PcdMaxIScsiAttemptNumber)
#define ISCSI_MAX_ATTEMPTS_NUM FixedPcdGet8 (PcdMaxIScsiAttemptNumber)
#define ISCSI_NAME_IFR_MIN_SIZE 4
#define ISCSI_NAME_IFR_MAX_SIZE 223
#define ISCSI_NAME_MAX_SIZE 224
#define ISCSI_NAME_IFR_MIN_SIZE 4
#define ISCSI_NAME_IFR_MAX_SIZE 223
#define ISCSI_NAME_MAX_SIZE 224
#define ATTEMPT_NAME_LIST_SIZE 96
#define ATTEMPT_NAME_SIZE 12
#define ATTEMPT_NAME_LIST_SIZE 96
#define ATTEMPT_NAME_SIZE 12
#define CONNECT_MIN_RETRY 0
#define CONNECT_MAX_RETRY 16
#define CONNECT_MIN_RETRY 0
#define CONNECT_MAX_RETRY 16
#define CONNECT_MIN_TIMEOUT 100
#define CONNECT_MAX_TIMEOUT 20000
#define CONNECT_DEFAULT_TIMEOUT 1000
#define CONNECT_MIN_TIMEOUT 100
#define CONNECT_MAX_TIMEOUT 20000
#define CONNECT_DEFAULT_TIMEOUT 1000
#define ISCSI_ACTIVE_DISABLED 0
#define ISCSI_ACTIVE_ENABLED 1
#define ISCSI_ACTIVE_DISABLED 0
#define ISCSI_ACTIVE_ENABLED 1
#define ISCSI_DISABLED 0
#define ISCSI_ENABLED 1
#define ISCSI_ENABLED_FOR_MPIO 2
#define ISCSI_DISABLED 0
#define ISCSI_ENABLED 1
#define ISCSI_ENABLED_FOR_MPIO 2
#define IP_MODE_IP4 0
#define IP_MODE_IP6 1
#define IP_MODE_AUTOCONFIG 2
#define IP_MODE_IP4 0
#define IP_MODE_IP6 1
#define IP_MODE_AUTOCONFIG 2
#define ISCSI_AUTH_TYPE_NONE 0
#define ISCSI_AUTH_TYPE_CHAP 1
#define ISCSI_AUTH_TYPE_KRB 2
#define ISCSI_AUTH_TYPE_NONE 0
#define ISCSI_AUTH_TYPE_CHAP 1
#define ISCSI_AUTH_TYPE_KRB 2
#define IP4_MIN_SIZE 7
#define IP4_MAX_SIZE 15
#define IP4_STR_MAX_SIZE 16
#define IP4_MIN_SIZE 7
#define IP4_MAX_SIZE 15
#define IP4_STR_MAX_SIZE 16
//
// Macros used for an IPv4 or an IPv6 address.
//
#define IP_MIN_SIZE 2
#define IP_MAX_SIZE 39
#define IP_STR_MAX_SIZE 40
#define IP_MIN_SIZE 2
#define IP_MAX_SIZE 39
#define IP_STR_MAX_SIZE 40
#define LUN_MIN_SIZE 1
#define LUN_MAX_SIZE 20
#define ISCSI_LUN_STR_MAX_LEN 21
#define LUN_MIN_SIZE 1
#define LUN_MAX_SIZE 20
#define ISCSI_LUN_STR_MAX_LEN 21
#define ISCSI_CHAP_UNI 0
#define ISCSI_CHAP_MUTUAL 1
#define ISCSI_CHAP_UNI 0
#define ISCSI_CHAP_MUTUAL 1
#define TARGET_PORT_MIN_NUM 0
#define TARGET_PORT_MAX_NUM 65535
#define LABEL_END 0xffff
#define TARGET_PORT_MIN_NUM 0
#define TARGET_PORT_MAX_NUM 65535
#define LABEL_END 0xffff
#define KEY_INITIATOR_NAME 0x101
#define KEY_DHCP_ENABLE 0x102
#define KEY_LOCAL_IP 0x103
#define KEY_SUBNET_MASK 0x104
#define KEY_GATE_WAY 0x105
#define KEY_TARGET_IP 0x106
#define KEY_CHAP_NAME 0x107
#define KEY_CHAP_SECRET 0x108
#define KEY_REVERSE_CHAP_NAME 0x109
#define KEY_REVERSE_CHAP_SECRET 0x10a
#define KEY_SAVE_CHANGES 0x10b
#define KEY_TARGET_NAME 0x10c
#define KEY_BOOT_LUN 0x10d
#define KEY_INITIATOR_NAME 0x101
#define KEY_DHCP_ENABLE 0x102
#define KEY_LOCAL_IP 0x103
#define KEY_SUBNET_MASK 0x104
#define KEY_GATE_WAY 0x105
#define KEY_TARGET_IP 0x106
#define KEY_CHAP_NAME 0x107
#define KEY_CHAP_SECRET 0x108
#define KEY_REVERSE_CHAP_NAME 0x109
#define KEY_REVERSE_CHAP_SECRET 0x10a
#define KEY_SAVE_CHANGES 0x10b
#define KEY_TARGET_NAME 0x10c
#define KEY_BOOT_LUN 0x10d
#define KEY_ADD_ATTEMPT 0x10e
#define KEY_SAVE_ATTEMPT_CONFIG 0x10f
#define KEY_ORDER_ATTEMPT_CONFIG 0x110
#define KEY_SAVE_ORDER_CHANGES 0x111
#define KEY_IGNORE_ORDER_CHANGES 0x112
#define KEY_ATTEMPT_NAME 0x113
#define KEY_SAVE_DELETE_ATTEMPT 0x114
#define KEY_IGNORE_DELETE_ATTEMPT 0x115
#define KEY_DELETE_ATTEMPT 0x116
#define KEY_ADD_ATTEMPT 0x10e
#define KEY_SAVE_ATTEMPT_CONFIG 0x10f
#define KEY_ORDER_ATTEMPT_CONFIG 0x110
#define KEY_SAVE_ORDER_CHANGES 0x111
#define KEY_IGNORE_ORDER_CHANGES 0x112
#define KEY_ATTEMPT_NAME 0x113
#define KEY_SAVE_DELETE_ATTEMPT 0x114
#define KEY_IGNORE_DELETE_ATTEMPT 0x115
#define KEY_DELETE_ATTEMPT 0x116
#define KEY_IP_MODE 0x11c
#define KEY_AUTH_TYPE 0x11d
#define KEY_CONFIG_ISID 0x11e
#define KEY_IP_MODE 0x11c
#define KEY_AUTH_TYPE 0x11d
#define KEY_CONFIG_ISID 0x11e
#define ATTEMPT_ENTRY_LABEL 0x9000
#define KEY_ATTEMPT_ENTRY_BASE 0xa000
#define KEY_DE_ATTEMPT_ENTRY_BASE 0xb000
#define ATTEMPT_ENTRY_LABEL 0x9000
#define KEY_ATTEMPT_ENTRY_BASE 0xa000
#define KEY_DE_ATTEMPT_ENTRY_BASE 0xb000
#define KEY_DEVICE_ENTRY_BASE 0x1000
#define KEY_MAC_ENTRY_BASE 0x2000
#define MAC_ENTRY_LABEL 0x3000
#define ORDER_ENTRY_LABEL 0x4000
#define DELETE_ENTRY_LABEL 0x5000
#define KEYWORD_ENTRY_LABEL 0x6000
#define CONFIG_OPTION_OFFSET 0x9000
#define KEY_DEVICE_ENTRY_BASE 0x1000
#define KEY_MAC_ENTRY_BASE 0x2000
#define MAC_ENTRY_LABEL 0x3000
#define ORDER_ENTRY_LABEL 0x4000
#define DELETE_ENTRY_LABEL 0x5000
#define KEYWORD_ENTRY_LABEL 0x6000
#define CONFIG_OPTION_OFFSET 0x9000
#define ISCSI_CHAP_SECRET_MIN_LEN 12
#define ISCSI_CHAP_SECRET_MAX_LEN 16
#define ISCSI_CHAP_SECRET_MIN_LEN 12
#define ISCSI_CHAP_SECRET_MAX_LEN 16
//
// ISCSI_CHAP_SECRET_STORAGE = ISCSI_CHAP_SECRET_MAX_LEN + sizeof (NULL-Terminator)
//
#define ISCSI_CHAP_SECRET_STORAGE 17
#define ISCSI_CHAP_NAME_MAX_LEN 126
#define ISCSI_CHAP_NAME_STORAGE 127
#define ISCSI_CHAP_NAME_MAX_LEN 126
#define ISCSI_CHAP_NAME_STORAGE 127
#define KERBEROS_SECRET_MIN_LEN 12
#define KERBEROS_SECRET_MAX_LEN 16
#define KERBEROS_SECRET_STORAGE 17
#define KERBEROS_NAME_MAX_LEN 96
#define KERBEROS_KDC_PORT_MIN_NUM 0
#define KERBEROS_KDC_PORT_MAX_NUM 65535
#define KERBEROS_SECRET_MIN_LEN 12
#define KERBEROS_SECRET_MAX_LEN 16
#define KERBEROS_SECRET_STORAGE 17
#define KERBEROS_NAME_MAX_LEN 96
#define KERBEROS_KDC_PORT_MIN_NUM 0
#define KERBEROS_KDC_PORT_MAX_NUM 65535
#define ISID_CONFIGURABLE_MIN_LEN 6
#define ISID_CONFIGURABLE_MAX_LEN 12
#define ISID_CONFIGURABLE_STORAGE 13
#define ISID_CONFIGURABLE_MIN_LEN 6
#define ISID_CONFIGURABLE_MAX_LEN 12
#define ISID_CONFIGURABLE_STORAGE 13
//
// sizeof (EFI_MAC_ADDRESS) * 3
//
#define ISCSI_MAX_MAC_STRING_LEN 96
#define ISCSI_MAX_MAC_STRING_LEN 96
///
/// Macro used for target Url.
///
#define ISCSI_TARGET_URI_MIN_SIZE 0
#define ISCSI_TARGET_URI_MAX_SIZE 255
#define ISCSI_TARGET_URI_MIN_SIZE 0
#define ISCSI_TARGET_URI_MAX_SIZE 255
#pragma pack(1)
@@ -151,81 +151,81 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Used by keyword.
//
typedef struct {
CHAR16 ISCSIIsId[ISID_CONFIGURABLE_STORAGE];
CHAR16 ISCSIInitiatorIpAddress[IP4_STR_MAX_SIZE];
CHAR16 ISCSIInitiatorNetmask[IP4_STR_MAX_SIZE];
CHAR16 ISCSIInitiatorGateway[IP4_STR_MAX_SIZE];
CHAR16 ISCSITargetName[ISCSI_NAME_MAX_SIZE];
CHAR16 ISCSITargetIpAddress[ISCSI_TARGET_URI_MAX_SIZE];
CHAR16 ISCSILun[ISCSI_LUN_STR_MAX_LEN];
CHAR16 ISCSIChapUsername[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ISCSIChapSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR16 ISCSIReverseChapUsername[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ISCSIReverseChapSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR16 ISCSIIsId[ISID_CONFIGURABLE_STORAGE];
CHAR16 ISCSIInitiatorIpAddress[IP4_STR_MAX_SIZE];
CHAR16 ISCSIInitiatorNetmask[IP4_STR_MAX_SIZE];
CHAR16 ISCSIInitiatorGateway[IP4_STR_MAX_SIZE];
CHAR16 ISCSITargetName[ISCSI_NAME_MAX_SIZE];
CHAR16 ISCSITargetIpAddress[ISCSI_TARGET_URI_MAX_SIZE];
CHAR16 ISCSILun[ISCSI_LUN_STR_MAX_LEN];
CHAR16 ISCSIChapUsername[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ISCSIChapSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR16 ISCSIReverseChapUsername[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ISCSIReverseChapSecret[ISCSI_CHAP_SECRET_STORAGE];
} KEYWORD_STR;
typedef struct _ISCSI_CONFIG_IFR_NVDATA {
CHAR16 InitiatorName[ISCSI_NAME_MAX_SIZE];
CHAR16 AttemptName[ATTEMPT_NAME_SIZE];
UINT8 Enabled;
UINT8 IpMode;
CHAR16 InitiatorName[ISCSI_NAME_MAX_SIZE];
CHAR16 AttemptName[ATTEMPT_NAME_SIZE];
UINT8 Enabled;
UINT8 IpMode;
UINT8 ConnectRetryCount;
UINT8 Padding1;
UINT16 ConnectTimeout; // Timeout value in milliseconds.
UINT8 ConnectRetryCount;
UINT8 Padding1;
UINT16 ConnectTimeout; // Timeout value in milliseconds.
UINT8 InitiatorInfoFromDhcp;
UINT8 TargetInfoFromDhcp;
CHAR16 LocalIp[IP4_STR_MAX_SIZE];
CHAR16 SubnetMask[IP4_STR_MAX_SIZE];
CHAR16 Gateway[IP4_STR_MAX_SIZE];
UINT8 InitiatorInfoFromDhcp;
UINT8 TargetInfoFromDhcp;
CHAR16 LocalIp[IP4_STR_MAX_SIZE];
CHAR16 SubnetMask[IP4_STR_MAX_SIZE];
CHAR16 Gateway[IP4_STR_MAX_SIZE];
CHAR16 TargetName[ISCSI_NAME_MAX_SIZE];
CHAR16 TargetIp[ISCSI_TARGET_URI_MAX_SIZE];
UINT16 TargetPort;
CHAR16 BootLun[ISCSI_LUN_STR_MAX_LEN];
CHAR16 TargetName[ISCSI_NAME_MAX_SIZE];
CHAR16 TargetIp[ISCSI_TARGET_URI_MAX_SIZE];
UINT16 TargetPort;
CHAR16 BootLun[ISCSI_LUN_STR_MAX_LEN];
UINT8 AuthenticationType;
UINT8 AuthenticationType;
UINT8 CHAPType;
CHAR16 CHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR16 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR16 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
UINT8 CHAPType;
CHAR16 CHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR16 CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
CHAR16 ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
BOOLEAN MutualRequired;
UINT8 Padding2;
CHAR16 KerberosUserName[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosUserSecret[KERBEROS_SECRET_STORAGE];
CHAR16 KerberosKDCName[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosKDCRealm[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosKDCIp[IP_STR_MAX_SIZE];
UINT16 KerberosKDCPort;
BOOLEAN MutualRequired;
UINT8 Padding2;
CHAR16 KerberosUserName[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosUserSecret[KERBEROS_SECRET_STORAGE];
CHAR16 KerberosKDCName[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosKDCRealm[KERBEROS_NAME_MAX_LEN];
CHAR16 KerberosKDCIp[IP_STR_MAX_SIZE];
UINT16 KerberosKDCPort;
UINT8 DynamicOrderedList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 DeleteAttemptList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 AddAttemptList[ISCSI_MAX_ATTEMPTS_NUM];
CHAR16 IsId[ISID_CONFIGURABLE_STORAGE];
UINT8 DynamicOrderedList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 DeleteAttemptList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 AddAttemptList[ISCSI_MAX_ATTEMPTS_NUM];
CHAR16 IsId[ISID_CONFIGURABLE_STORAGE];
//
// This will be used by keywords.
//
CHAR16 ISCSIMacAddr[ISCSI_MAX_MAC_STRING_LEN];
CHAR16 ISCSIAttemptOrder[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIAddAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIDeleteAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIDisplayAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIAttemptName[ATTEMPT_NAME_LIST_SIZE];
UINT8 ISCSIBootEnableList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIIpAddressTypeList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIConnectRetry[ISCSI_MAX_ATTEMPTS_NUM];
UINT16 ISCSIConnectTimeout[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIInitiatorInfoViaDHCP[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSITargetInfoViaDHCP[ISCSI_MAX_ATTEMPTS_NUM];
UINT16 ISCSITargetTcpPort[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIAuthenticationMethod[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIChapType[ISCSI_MAX_ATTEMPTS_NUM];
KEYWORD_STR Keyword[ISCSI_MAX_ATTEMPTS_NUM];
CHAR16 ISCSIMacAddr[ISCSI_MAX_MAC_STRING_LEN];
CHAR16 ISCSIAttemptOrder[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIAddAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIDeleteAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIDisplayAttemptList[ATTEMPT_NAME_LIST_SIZE];
CHAR16 ISCSIAttemptName[ATTEMPT_NAME_LIST_SIZE];
UINT8 ISCSIBootEnableList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIIpAddressTypeList[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIConnectRetry[ISCSI_MAX_ATTEMPTS_NUM];
UINT16 ISCSIConnectTimeout[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIInitiatorInfoViaDHCP[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSITargetInfoViaDHCP[ISCSI_MAX_ATTEMPTS_NUM];
UINT16 ISCSITargetTcpPort[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIAuthenticationMethod[ISCSI_MAX_ATTEMPTS_NUM];
UINT8 ISCSIChapType[ISCSI_MAX_ATTEMPTS_NUM];
KEYWORD_STR Keyword[ISCSI_MAX_ATTEMPTS_NUM];
} ISCSI_CONFIG_IFR_NVDATA;
#pragma pack()

View File

@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
/**
Extract the Root Path option and get the required target information.
@@ -27,46 +26,47 @@ EFI_STATUS
IScsiDhcpExtractRootPath (
IN CHAR8 *RootPath,
IN UINT8 Length,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
)
{
EFI_STATUS Status;
UINT8 IScsiRootPathIdLen;
CHAR8 *TmpStr;
ISCSI_ROOT_PATH_FIELD Fields[RP_FIELD_IDX_MAX];
ISCSI_ROOT_PATH_FIELD *Field;
UINT32 FieldIndex;
UINT8 Index;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
EFI_IP_ADDRESS Ip;
UINT8 IpMode;
EFI_STATUS Status;
UINT8 IScsiRootPathIdLen;
CHAR8 *TmpStr;
ISCSI_ROOT_PATH_FIELD Fields[RP_FIELD_IDX_MAX];
ISCSI_ROOT_PATH_FIELD *Field;
UINT32 FieldIndex;
UINT8 Index;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
EFI_IP_ADDRESS Ip;
UINT8 IpMode;
ConfigNvData = &ConfigData->SessionConfigData;
//
// "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
//
IScsiRootPathIdLen = (UINT8) AsciiStrLen (ISCSI_ROOT_PATH_ID);
IScsiRootPathIdLen = (UINT8)AsciiStrLen (ISCSI_ROOT_PATH_ID);
if ((Length <= IScsiRootPathIdLen) || (CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0)) {
return EFI_NOT_FOUND;
}
//
// Skip the iSCSI RootPath ID "iscsi:".
//
RootPath += IScsiRootPathIdLen;
Length = (UINT8) (Length - IScsiRootPathIdLen);
Length = (UINT8)(Length - IScsiRootPathIdLen);
TmpStr = (CHAR8 *) AllocatePool (Length + 1);
TmpStr = (CHAR8 *)AllocatePool (Length + 1);
if (TmpStr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (TmpStr, RootPath, Length);
TmpStr[Length] = '\0';
TmpStr[Length] = '\0';
Index = 0;
FieldIndex = RP_FIELD_IDX_SERVERNAME;
Index = 0;
FieldIndex = RP_FIELD_IDX_SERVERNAME;
ZeroMem (&Fields[0], sizeof (Fields));
//
@@ -88,7 +88,7 @@ IScsiDhcpExtractRootPath (
}
if (Fields[FieldIndex].Str != NULL) {
Fields[FieldIndex].Len = (UINT8) AsciiStrLen (Fields[FieldIndex].Str);
Fields[FieldIndex].Len = (UINT8)AsciiStrLen (Fields[FieldIndex].Str);
}
}
}
@@ -101,15 +101,16 @@ IScsiDhcpExtractRootPath (
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
) {
)
{
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Get the IP address of the target.
//
Field = &Fields[RP_FIELD_IDX_SERVERNAME];
Field = &Fields[RP_FIELD_IDX_SERVERNAME];
if (ConfigNvData->IpMode < IP_MODE_AUTOCONFIG) {
IpMode = ConfigNvData->IpMode;
@@ -125,11 +126,12 @@ IScsiDhcpExtractRootPath (
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
return EFI_INVALID_PARAMETER;
}
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
} else {
ConfigNvData->DnsMode = FALSE;
ZeroMem(ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));
ZeroMem (ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));
Status = IScsiAsciiStrToIp (Field->Str, IpMode, &Ip);
CopyMem (&ConfigNvData->TargetIp, &Ip, sizeof (EFI_IP_ADDRESS));
@@ -137,6 +139,7 @@ IScsiDhcpExtractRootPath (
goto ON_EXIT;
}
}
//
// Check the protocol type.
//
@@ -145,15 +148,17 @@ IScsiDhcpExtractRootPath (
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Get the port of the iSCSI target.
//
Field = &Fields[RP_FIELD_IDX_PORT];
if (Field->Str != NULL) {
ConfigNvData->TargetPort = (UINT16) AsciiStrDecimalToUintn (Field->Str);
ConfigNvData->TargetPort = (UINT16)AsciiStrDecimalToUintn (Field->Str);
} else {
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
}
//
// Get the LUN.
//
@@ -166,6 +171,7 @@ IScsiDhcpExtractRootPath (
} else {
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
}
//
// Get the target iSCSI Name.
//
@@ -175,6 +181,7 @@ IScsiDhcpExtractRootPath (
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Validate the iSCSI name.
//
@@ -220,10 +227,10 @@ IScsiDhcpSelectOffer (
OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL
)
{
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 Index;
EFI_STATUS Status;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 Index;
if ((Dhcp4Event != Dhcp4RcvdOffer) && (Dhcp4Event != Dhcp4SelectOffer)) {
return EFI_SUCCESS;
@@ -231,7 +238,7 @@ IScsiDhcpSelectOffer (
OptionCount = 0;
Status = This->Parse (This, Packet, &OptionCount, NULL);
Status = This->Parse (This, Packet, &OptionCount, NULL);
if (Status != EFI_BUFFER_TOO_SMALL) {
return EFI_NOT_READY;
}
@@ -253,9 +260,9 @@ IScsiDhcpSelectOffer (
}
Status = IScsiDhcpExtractRootPath (
(CHAR8 *) &OptionList[Index]->Data[0],
(CHAR8 *)&OptionList[Index]->Data[0],
OptionList[Index]->Length,
(ISCSI_ATTEMPT_CONFIG_NVDATA *) Context
(ISCSI_ATTEMPT_CONFIG_NVDATA *)Context
);
break;
@@ -285,16 +292,16 @@ IScsiDhcpSelectOffer (
**/
EFI_STATUS
IScsiParseDhcpAck (
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN EFI_DHCP4_PROTOCOL *Dhcp4,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
)
{
EFI_STATUS Status;
EFI_DHCP4_MODE_DATA Dhcp4ModeData;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 Index;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
EFI_STATUS Status;
EFI_DHCP4_MODE_DATA Dhcp4ModeData;
UINT32 OptionCount;
EFI_DHCP4_PACKET_OPTION **OptionList;
UINT32 Index;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
Status = Dhcp4->GetModeData (Dhcp4, &Dhcp4ModeData);
if (EFI_ERROR (Status)) {
@@ -314,7 +321,7 @@ IScsiParseDhcpAck (
OptionCount = 0;
OptionList = NULL;
Status = Dhcp4->Parse (Dhcp4, Dhcp4ModeData.ReplyPacket, &OptionCount, OptionList);
Status = Dhcp4->Parse (Dhcp4, Dhcp4ModeData.ReplyPacket, &OptionCount, OptionList);
if (Status != EFI_BUFFER_TOO_SMALL) {
return EFI_DEVICE_ERROR;
}
@@ -335,11 +342,11 @@ IScsiParseDhcpAck (
// Get DNS server addresses and DHCP server address from this offer.
//
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
Status = EFI_INVALID_PARAMETER;
break;
}
//
// Primary DNS server address.
//
@@ -377,32 +384,32 @@ IScsiParseDhcpAck (
**/
EFI_STATUS
IScsiSetIp4Policy (
IN EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2
IN EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2
)
{
EFI_IP4_CONFIG2_POLICY Policy;
EFI_STATUS Status;
UINTN DataSize;
EFI_IP4_CONFIG2_POLICY Policy;
EFI_STATUS Status;
UINTN DataSize;
DataSize = sizeof (EFI_IP4_CONFIG2_POLICY);
Status = Ip4Config2->GetData (
Ip4Config2,
Ip4Config2DataTypePolicy,
&DataSize,
&Policy
);
Status = Ip4Config2->GetData (
Ip4Config2,
Ip4Config2DataTypePolicy,
&DataSize,
&Policy
);
if (EFI_ERROR (Status)) {
return Status;
}
if (Policy != Ip4Config2PolicyStatic) {
Policy = Ip4Config2PolicyStatic;
Status= Ip4Config2->SetData (
Ip4Config2,
Ip4Config2DataTypePolicy,
sizeof (EFI_IP4_CONFIG2_POLICY),
&Policy
);
Status = Ip4Config2->SetData (
Ip4Config2,
Ip4Config2DataTypePolicy,
sizeof (EFI_IP4_CONFIG2_POLICY),
&Policy
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -426,19 +433,19 @@ IScsiSetIp4Policy (
**/
EFI_STATUS
IScsiDoDhcp (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
)
{
EFI_HANDLE Dhcp4Handle;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_STATUS Status;
EFI_DHCP4_PACKET_OPTION *ParaList;
EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
EFI_STATUS MediaStatus;
EFI_HANDLE Dhcp4Handle;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_STATUS Status;
EFI_DHCP4_PACKET_OPTION *ParaList;
EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
EFI_STATUS MediaStatus;
Dhcp4Handle = NULL;
Ip4Config2 = NULL;
@@ -450,7 +457,7 @@ IScsiDoDhcp (
//
MediaStatus = EFI_SUCCESS;
NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
if (MediaStatus!= EFI_SUCCESS) {
if (MediaStatus != EFI_SUCCESS) {
AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
@@ -462,7 +469,7 @@ IScsiDoDhcp (
// will not be in the right state for the iSCSI to start a new round D.O.R.A.
// So, we need to switch its policy to static.
//
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **) &Ip4Config2);
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **)&Ip4Config2);
if (!EFI_ERROR (Status)) {
Status = IScsiSetIp4Policy (Ip4Config2);
if (EFI_ERROR (Status)) {
@@ -486,7 +493,7 @@ IScsiDoDhcp (
Status = gBS->OpenProtocol (
Dhcp4Handle,
&gEfiDhcp4ProtocolGuid,
(VOID **) &Dhcp4,
(VOID **)&Dhcp4,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -495,7 +502,7 @@ IScsiDoDhcp (
goto ON_EXIT;
}
NvData = &ConfigData->SessionConfigData;
NvData = &ConfigData->SessionConfigData;
ParaList = AllocatePool (sizeof (EFI_DHCP4_PACKET_OPTION) + 3);
if (ParaList == NULL) {
@@ -507,7 +514,7 @@ IScsiDoDhcp (
// Ask the server to reply with Netmask, Router, DNS, and RootPath options.
//
ParaList->OpCode = DHCP4_TAG_PARA_LIST;
ParaList->Length = (UINT8) (NvData->TargetInfoFromDhcp ? 4 : 3);
ParaList->Length = (UINT8)(NvData->TargetInfoFromDhcp ? 4 : 3);
ParaList->Data[0] = DHCP4_TAG_NETMASK;
ParaList->Data[1] = DHCP4_TAG_ROUTER;
ParaList->Data[2] = DHCP4_TAG_DNS_SERVER;
@@ -534,6 +541,7 @@ IScsiDoDhcp (
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
//
// Parse the ACK to get required information.
//

View File

@@ -9,21 +9,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _ISCSI_DHCP_H_
#define _ISCSI_DHCP_H_
#define ISCSI_ROOT_PATH_ID "iscsi:"
#define ISCSI_ROOT_PATH_FIELD_DELIMITER ':'
#define ISCSI_ROOT_PATH_ID "iscsi:"
#define ISCSI_ROOT_PATH_FIELD_DELIMITER ':'
#define RP_FIELD_IDX_SERVERNAME 0
#define RP_FIELD_IDX_PROTOCOL 1
#define RP_FIELD_IDX_PORT 2
#define RP_FIELD_IDX_LUN 3
#define RP_FIELD_IDX_TARGETNAME 4
#define RP_FIELD_IDX_MAX 5
#define RP_FIELD_IDX_SERVERNAME 0
#define RP_FIELD_IDX_PROTOCOL 1
#define RP_FIELD_IDX_PORT 2
#define RP_FIELD_IDX_LUN 3
#define RP_FIELD_IDX_TARGETNAME 4
#define RP_FIELD_IDX_MAX 5
typedef struct _ISCSI_ATTEMPT_CONFIG_NVDATA ISCSI_ATTEMPT_CONFIG_NVDATA;
typedef struct _ISCSI_ROOT_PATH_FIELD {
CHAR8 *Str;
UINT8 Len;
CHAR8 *Str;
UINT8 Len;
} ISCSI_ROOT_PATH_FIELD;
/**
@@ -41,9 +41,9 @@ typedef struct _ISCSI_ROOT_PATH_FIELD {
**/
EFI_STATUS
IScsiDoDhcp (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
);
#endif

View File

@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
/**
Extract the Root Path option and get the required target information from
Boot File Uniform Resource Locator (URL) Option.
@@ -29,47 +28,49 @@ EFI_STATUS
IScsiDhcp6ExtractRootPath (
IN CHAR8 *RootPath,
IN UINT16 Length,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
)
{
EFI_STATUS Status;
UINT16 IScsiRootPathIdLen;
CHAR8 *TmpStr;
ISCSI_ROOT_PATH_FIELD Fields[RP_FIELD_IDX_MAX];
ISCSI_ROOT_PATH_FIELD *Field;
UINT32 FieldIndex;
UINT8 Index;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
EFI_IP_ADDRESS Ip;
UINT8 IpMode;
EFI_STATUS Status;
UINT16 IScsiRootPathIdLen;
CHAR8 *TmpStr;
ISCSI_ROOT_PATH_FIELD Fields[RP_FIELD_IDX_MAX];
ISCSI_ROOT_PATH_FIELD *Field;
UINT32 FieldIndex;
UINT8 Index;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
EFI_IP_ADDRESS Ip;
UINT8 IpMode;
ConfigNvData = &ConfigData->SessionConfigData;
ConfigNvData = &ConfigData->SessionConfigData;
ConfigNvData->DnsMode = FALSE;
//
// "iscsi:"<servername>":"<protocol>":"<port>":"<LUN>":"<targetname>
//
IScsiRootPathIdLen = (UINT16) AsciiStrLen (ISCSI_ROOT_PATH_ID);
IScsiRootPathIdLen = (UINT16)AsciiStrLen (ISCSI_ROOT_PATH_ID);
if ((Length <= IScsiRootPathIdLen) ||
(CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0)) {
(CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0))
{
return EFI_NOT_FOUND;
}
//
// Skip the iSCSI RootPath ID "iscsi:".
//
RootPath = RootPath + IScsiRootPathIdLen;
Length = (UINT16) (Length - IScsiRootPathIdLen);
Length = (UINT16)(Length - IScsiRootPathIdLen);
TmpStr = (CHAR8 *) AllocatePool (Length + 1);
TmpStr = (CHAR8 *)AllocatePool (Length + 1);
if (TmpStr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (TmpStr, RootPath, Length);
TmpStr[Length] = '\0';
TmpStr[Length] = '\0';
Index = 0;
FieldIndex = 0;
Index = 0;
FieldIndex = 0;
ZeroMem (&Fields[0], sizeof (Fields));
//
@@ -87,7 +88,7 @@ IScsiDhcp6ExtractRootPath (
Fields[RP_FIELD_IDX_SERVERNAME].Str = &TmpStr[Index];
if (!ConfigNvData->DnsMode) {
while ((TmpStr[Index] != ISCSI_ROOT_PATH_ADDR_END_DELIMITER)&& (Index < Length)) {
while ((TmpStr[Index] != ISCSI_ROOT_PATH_ADDR_END_DELIMITER) && (Index < Length)) {
Index++;
}
@@ -95,25 +96,25 @@ IScsiDhcp6ExtractRootPath (
// Skip ']' and ':'.
//
TmpStr[Index] = '\0';
Index += 2;
Index += 2;
} else {
while ((TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) && (Index < Length)) {
Index++;
}
//
// Skip ':'.
//
TmpStr[Index] = '\0';
Index += 1;
Index += 1;
}
Fields[RP_FIELD_IDX_SERVERNAME].Len = (UINT8) AsciiStrLen (Fields[RP_FIELD_IDX_SERVERNAME].Str);
Fields[RP_FIELD_IDX_SERVERNAME].Len = (UINT8)AsciiStrLen (Fields[RP_FIELD_IDX_SERVERNAME].Str);
//
// Extract others fields in the Root Path option string.
//
for (FieldIndex = 1; (FieldIndex < RP_FIELD_IDX_MAX) && (Index < Length); FieldIndex++) {
if (TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) {
Fields[FieldIndex].Str = &TmpStr[Index];
}
@@ -129,7 +130,7 @@ IScsiDhcp6ExtractRootPath (
}
if (Fields[FieldIndex].Str != NULL) {
Fields[FieldIndex].Len = (UINT8) AsciiStrLen (Fields[FieldIndex].Str);
Fields[FieldIndex].Len = (UINT8)AsciiStrLen (Fields[FieldIndex].Str);
}
}
}
@@ -142,15 +143,16 @@ IScsiDhcp6ExtractRootPath (
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
) {
)
{
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Get the IP address of the target.
//
Field = &Fields[RP_FIELD_IDX_SERVERNAME];
Field = &Fields[RP_FIELD_IDX_SERVERNAME];
if (ConfigNvData->IpMode < IP_MODE_AUTOCONFIG) {
IpMode = ConfigNvData->IpMode;
} else {
@@ -164,10 +166,11 @@ IScsiDhcp6ExtractRootPath (
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
return EFI_INVALID_PARAMETER;
}
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
} else {
ZeroMem(&ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));
ZeroMem (&ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));
Status = IScsiAsciiStrToIp (Field->Str, IpMode, &Ip);
CopyMem (&ConfigNvData->TargetIp, &Ip, sizeof (EFI_IP_ADDRESS));
@@ -184,15 +187,17 @@ IScsiDhcp6ExtractRootPath (
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Get the port of the iSCSI target.
//
Field = &Fields[RP_FIELD_IDX_PORT];
if (Field->Str != NULL) {
ConfigNvData->TargetPort = (UINT16) AsciiStrDecimalToUintn (Field->Str);
ConfigNvData->TargetPort = (UINT16)AsciiStrDecimalToUintn (Field->Str);
} else {
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
}
//
// Get the LUN.
//
@@ -205,6 +210,7 @@ IScsiDhcp6ExtractRootPath (
} else {
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
}
//
// Get the target iSCSI Name.
//
@@ -214,6 +220,7 @@ IScsiDhcp6ExtractRootPath (
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
//
// Validate the iSCSI name.
//
@@ -258,23 +265,23 @@ ON_EXIT:
EFI_STATUS
EFIAPI
IScsiDhcp6ParseReply (
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
IN EFI_DHCP6_PROTOCOL *This,
IN VOID *Context,
IN EFI_DHCP6_PACKET *Packet
)
{
EFI_STATUS Status;
UINT32 Index;
UINT32 OptionCount;
EFI_DHCP6_PACKET_OPTION *BootFileOpt;
EFI_DHCP6_PACKET_OPTION **OptionList;
ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;
UINT16 ParaLen;
EFI_STATUS Status;
UINT32 Index;
UINT32 OptionCount;
EFI_DHCP6_PACKET_OPTION *BootFileOpt;
EFI_DHCP6_PACKET_OPTION **OptionList;
ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;
UINT16 ParaLen;
OptionCount = 0;
BootFileOpt = NULL;
Status = This->Parse (This, Packet, &OptionCount, NULL);
Status = This->Parse (This, Packet, &OptionCount, NULL);
if (Status != EFI_BUFFER_TOO_SMALL) {
return EFI_NOT_READY;
}
@@ -290,7 +297,7 @@ IScsiDhcp6ParseReply (
goto Exit;
}
ConfigData = (ISCSI_ATTEMPT_CONFIG_NVDATA *) Context;
ConfigData = (ISCSI_ATTEMPT_CONFIG_NVDATA *)Context;
for (Index = 0; Index < OptionCount; Index++) {
OptionList[Index]->OpCode = NTOHS (OptionList[Index]->OpCode);
@@ -300,11 +307,11 @@ IScsiDhcp6ParseReply (
// Get DNS server addresses from this reply packet.
//
if (OptionList[Index]->OpCode == DHCP6_OPT_DNS_SERVERS) {
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
Status = EFI_UNSUPPORTED;
goto Exit;
}
//
// Primary DNS server address.
//
@@ -316,7 +323,6 @@ IScsiDhcp6ParseReply (
//
CopyMem (&ConfigData->SecondaryDns, &OptionList[Index]->Data[16], sizeof (EFI_IPv6_ADDRESS));
}
} else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_URL) {
//
// The server sends this option to inform the client about an URL to a boot file.
@@ -330,6 +336,7 @@ IScsiDhcp6ParseReply (
Status = EFI_UNSUPPORTED;
goto Exit;
}
//
// Check param-len 1, should be 16 bytes.
//
@@ -352,7 +359,7 @@ IScsiDhcp6ParseReply (
// Get iSCSI root path from Boot File Uniform Resource Locator (URL) Option
//
Status = IScsiDhcp6ExtractRootPath (
(CHAR8 *) BootFileOpt->Data,
(CHAR8 *)BootFileOpt->Data,
BootFileOpt->OpLen,
ConfigData
);
@@ -363,7 +370,6 @@ Exit:
return Status;
}
/**
Parse the DHCP ACK to get the address configuration and DNS information.
@@ -383,9 +389,9 @@ Exit:
**/
EFI_STATUS
IScsiDoDhcp6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
)
{
EFI_HANDLE Dhcp6Handle;
@@ -435,7 +441,7 @@ IScsiDoDhcp6 (
Status = gBS->OpenProtocol (
Dhcp6Handle,
&gEfiDhcp6ProtocolGuid,
(VOID **) &Dhcp6,
(VOID **)&Dhcp6,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -493,7 +499,6 @@ IScsiDoDhcp6 (
}
do {
TimerStatus = gBS->CheckEvent (Timer);
if (!EFI_ERROR (TimerStatus)) {
@@ -509,9 +514,7 @@ IScsiDoDhcp6 (
ConfigData
);
}
} while (TimerStatus == EFI_NOT_READY);
}
ON_EXIT:
@@ -542,4 +545,3 @@ ON_EXIT:
return Status;
}

View File

@@ -9,11 +9,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _ISCSI_DHCP6_H_
#define _ISCSI_DHCP6_H_
#define ISCSI_ROOT_PATH_ID "iscsi:"
#define ISCSI_ROOT_PATH_FIELD_DELIMITER ':'
#define ISCSI_ROOT_PATH_ADDR_START_DELIMITER '['
#define ISCSI_ROOT_PATH_ADDR_END_DELIMITER ']'
#define ISCSI_ROOT_PATH_ID "iscsi:"
#define ISCSI_ROOT_PATH_FIELD_DELIMITER ':'
#define ISCSI_ROOT_PATH_ADDR_START_DELIMITER '['
#define ISCSI_ROOT_PATH_ADDR_END_DELIMITER ']'
/**
Extract the Root Path option and get the required target information from
@@ -35,7 +34,7 @@ EFI_STATUS
IScsiDhcp6ExtractRootPath (
IN CHAR8 *RootPath,
IN UINT16 Length,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
);
/**
@@ -57,9 +56,9 @@ IScsiDhcp6ExtractRootPath (
**/
EFI_STATUS
IScsiDoDhcp6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
);
#endif

View File

@@ -18,11 +18,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID
EFIAPI
IScsiCommonNotify (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
*((BOOLEAN *) Context) = TRUE;
*((BOOLEAN *)Context) = TRUE;
}
/**
@@ -40,22 +40,22 @@ IScsiCommonNotify (
**/
EFI_STATUS
IScsiDns4 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
)
{
EFI_STATUS Status;
EFI_DNS4_PROTOCOL *Dns4;
EFI_DNS4_CONFIG_DATA Dns4CfgData;
EFI_DNS4_COMPLETION_TOKEN Token;
BOOLEAN IsDone;
EFI_HANDLE Dns4Handle;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
EFI_IPv4_ADDRESS *DnsServerList;
UINTN DnsServerListCount;
UINTN DataSize;
CHAR16 *HostName;
EFI_STATUS Status;
EFI_DNS4_PROTOCOL *Dns4;
EFI_DNS4_CONFIG_DATA Dns4CfgData;
EFI_DNS4_COMPLETION_TOKEN Token;
BOOLEAN IsDone;
EFI_HANDLE Dns4Handle;
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
EFI_IPv4_ADDRESS *DnsServerList;
UINTN DnsServerListCount;
UINTN DataSize;
CHAR16 *HostName;
DnsServerList = NULL;
DnsServerListCount = 0;
@@ -66,7 +66,7 @@ IScsiDns4 (
//
// Get DNS server list from EFI IPv4 Configuration II protocol.
//
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **) &Ip4Config2);
Status = gBS->HandleProtocol (Controller, &gEfiIp4Config2ProtocolGuid, (VOID **)&Ip4Config2);
if (!EFI_ERROR (Status)) {
//
// Get the required size.
@@ -79,7 +79,7 @@ IScsiDns4 (
return EFI_OUT_OF_RESOURCES;
}
Status = Ip4Config2->GetData (Ip4Config2, Ip4Config2DataTypeDnsServer, &DataSize, DnsServerList);
Status = Ip4Config2->GetData (Ip4Config2, Ip4Config2DataTypeDnsServer, &DataSize, DnsServerList);
if (EFI_ERROR (Status)) {
FreePool (DnsServerList);
DnsServerList = NULL;
@@ -89,7 +89,6 @@ IScsiDns4 (
}
}
//
// Create a DNS child instance and get the protocol.
//
@@ -106,7 +105,7 @@ IScsiDns4 (
Status = gBS->OpenProtocol (
Dns4Handle,
&gEfiDns4ProtocolGuid,
(VOID **) &Dns4,
(VOID **)&Dns4,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -124,11 +123,11 @@ IScsiDns4 (
Dns4CfgData.EnableDnsCache = TRUE;
IP4_COPY_ADDRESS (&Dns4CfgData.StationIp, &NvData->LocalIp);
IP4_COPY_ADDRESS (&Dns4CfgData.SubnetMask, &NvData->SubnetMask);
Dns4CfgData.Protocol = EFI_IP_PROTO_UDP;
Status = Dns4->Configure (
Dns4,
&Dns4CfgData
);
Dns4CfgData.Protocol = EFI_IP_PROTO_UDP;
Status = Dns4->Configure (
Dns4,
&Dns4CfgData
);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -154,7 +153,7 @@ IScsiDns4 (
Token.Status = EFI_NOT_READY;
IsDone = FALSE;
HostName = (CHAR16 *) AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
HostName = (CHAR16 *)AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
if (HostName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -183,10 +182,12 @@ IScsiDns4 (
Status = EFI_DEVICE_ERROR;
goto Exit;
}
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
Status = EFI_DEVICE_ERROR;
goto Exit;
}
//
// We just return the first IP address from DNS protocol.
//
@@ -199,10 +200,12 @@ Exit:
if (Token.Event != NULL) {
gBS->CloseEvent (Token.Event);
}
if (Token.RspData.H2AData != NULL) {
if (Token.RspData.H2AData->IpList != NULL) {
FreePool (Token.RspData.H2AData->IpList);
}
FreePool (Token.RspData.H2AData);
}
@@ -244,39 +247,39 @@ Exit:
**/
EFI_STATUS
IScsiDns6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
)
{
EFI_STATUS Status;
EFI_DNS6_PROTOCOL *Dns6;
EFI_DNS6_CONFIG_DATA Dns6ConfigData;
EFI_DNS6_COMPLETION_TOKEN Token;
EFI_HANDLE Dns6Handle;
EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
EFI_IPv6_ADDRESS *DnsServerList;
UINTN DnsServerListCount;
UINTN DataSize;
BOOLEAN IsDone;
CHAR16 *HostName;
EFI_STATUS Status;
EFI_DNS6_PROTOCOL *Dns6;
EFI_DNS6_CONFIG_DATA Dns6ConfigData;
EFI_DNS6_COMPLETION_TOKEN Token;
EFI_HANDLE Dns6Handle;
EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
EFI_IPv6_ADDRESS *DnsServerList;
UINTN DnsServerListCount;
UINTN DataSize;
BOOLEAN IsDone;
CHAR16 *HostName;
DnsServerList = NULL;
DnsServerListCount = 0;
Dns6 = NULL;
Dns6Handle = NULL;
DnsServerList = NULL;
DnsServerListCount = 0;
Dns6 = NULL;
Dns6Handle = NULL;
ZeroMem (&Token, sizeof (EFI_DNS6_COMPLETION_TOKEN));
//
// Get DNS server list from EFI IPv6 Configuration protocol.
//
Status = gBS->HandleProtocol (Controller, &gEfiIp6ConfigProtocolGuid, (VOID **) &Ip6Config);
Status = gBS->HandleProtocol (Controller, &gEfiIp6ConfigProtocolGuid, (VOID **)&Ip6Config);
if (!EFI_ERROR (Status)) {
//
// Get the required size.
//
DataSize = 0;
Status = Ip6Config->GetData (Ip6Config, Ip6ConfigDataTypeDnsServer, &DataSize, NULL);
Status = Ip6Config->GetData (Ip6Config, Ip6ConfigDataTypeDnsServer, &DataSize, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
DnsServerList = AllocatePool (DataSize);
if (DnsServerList == NULL) {
@@ -309,7 +312,7 @@ IScsiDns6 (
Status = gBS->OpenProtocol (
Dns6Handle,
&gEfiDns6ProtocolGuid,
(VOID **) &Dns6,
(VOID **)&Dns6,
Image,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -326,10 +329,10 @@ IScsiDns6 (
Dns6ConfigData.DnsServerList = DnsServerList;
Dns6ConfigData.EnableDnsCache = TRUE;
Dns6ConfigData.Protocol = EFI_IP_PROTO_UDP;
Status = Dns6->Configure (
Dns6,
&Dns6ConfigData
);
Status = Dns6->Configure (
Dns6,
&Dns6ConfigData
);
if (EFI_ERROR (Status)) {
goto Exit;
}
@@ -353,7 +356,7 @@ IScsiDns6 (
//
// Start asynchronous name resolution.
//
HostName = (CHAR16 *) AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
HostName = (CHAR16 *)AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
if (HostName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -381,10 +384,12 @@ IScsiDns6 (
Status = EFI_DEVICE_ERROR;
goto Exit;
}
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
Status = EFI_DEVICE_ERROR;
goto Exit;
}
//
// We just return the first IPv6 address from DNS protocol.
//
@@ -397,10 +402,12 @@ Exit:
if (Token.Event != NULL) {
gBS->CloseEvent (Token.Event);
}
if (Token.RspData.H2AData != NULL) {
if (Token.RspData.H2AData->IpList != NULL) {
FreePool (Token.RspData.H2AData->IpList);
}
FreePool (Token.RspData.H2AData);
}
@@ -426,4 +433,3 @@ Exit:
return Status;
}

View File

@@ -25,9 +25,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_STATUS
IScsiDns4 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
);
/**
@@ -45,9 +45,9 @@ IScsiDns4 (
**/
EFI_STATUS
IScsiDns6 (
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
IN EFI_HANDLE Image,
IN EFI_HANDLE Controller,
IN OUT ISCSI_SESSION_CONFIG_NVDATA *NvData
);
#endif

View File

@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
IScsiIp4DriverBindingSupported,
IScsiIp4DriverBindingStart,
IScsiIp4DriverBindingStop,
@@ -20,7 +20,7 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiIp4DriverBinding = {
NULL
};
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
IScsiIp6DriverBindingSupported,
IScsiIp6DriverBindingStart,
IScsiIp6DriverBindingStop,
@@ -29,9 +29,9 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiIp6DriverBinding = {
NULL
};
EFI_GUID gIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID;
EFI_GUID gIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID;
ISCSI_PRIVATE_DATA *mPrivate = NULL;
EFI_GUID gIScsiV4PrivateGuid = ISCSI_V4_PRIVATE_GUID;
EFI_GUID gIScsiV6PrivateGuid = ISCSI_V6_PRIVATE_GUID;
ISCSI_PRIVATE_DATA *mPrivate = NULL;
/**
Tests to see if this driver supports the RemainingDevicePath.
@@ -50,7 +50,7 @@ ISCSI_PRIVATE_DATA *mPrivate = NULL;
**/
EFI_STATUS
IScsiIsDevicePathSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
@@ -85,34 +85,34 @@ IScsiCheckAip (
VOID
)
{
UINTN AipHandleCount;
EFI_HANDLE *AipHandleBuffer;
UINTN AipIndex;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
EFI_GUID *InfoTypesBuffer;
UINTN InfoTypeBufferCount;
UINTN TypeIndex;
VOID *InfoBlock;
UINTN InfoBlockSize;
BOOLEAN Supported;
EFI_ADAPTER_INFO_NETWORK_BOOT *NetworkBoot;
EFI_STATUS Status;
UINT8 NetworkBootPolicy;
UINTN AipHandleCount;
EFI_HANDLE *AipHandleBuffer;
UINTN AipIndex;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
EFI_GUID *InfoTypesBuffer;
UINTN InfoTypeBufferCount;
UINTN TypeIndex;
VOID *InfoBlock;
UINTN InfoBlockSize;
BOOLEAN Supported;
EFI_ADAPTER_INFO_NETWORK_BOOT *NetworkBoot;
EFI_STATUS Status;
UINT8 NetworkBootPolicy;
//
// Check any AIP instances exist in system.
//
AipHandleCount = 0;
AipHandleBuffer = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiAdapterInformationProtocolGuid,
NULL,
&AipHandleCount,
&AipHandleBuffer
);
if (EFI_ERROR (Status) || AipHandleCount == 0) {
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiAdapterInformationProtocolGuid,
NULL,
&AipHandleCount,
&AipHandleBuffer
);
if (EFI_ERROR (Status) || (AipHandleCount == 0)) {
return EFI_NOT_FOUND;
}
@@ -124,7 +124,7 @@ IScsiCheckAip (
Status = gBS->HandleProtocol (
AipHandleBuffer[AipIndex],
&gEfiAdapterInformationProtocolGuid,
(VOID *) &Aip
(VOID *)&Aip
);
ASSERT_EFI_ERROR (Status);
ASSERT (Aip != NULL);
@@ -132,18 +132,19 @@ IScsiCheckAip (
Status = gBS->HandleProtocol (
AipHandleBuffer[AipIndex],
&gEfiExtScsiPassThruProtocolGuid,
(VOID *) &ExtScsiPassThru
(VOID *)&ExtScsiPassThru
);
if (EFI_ERROR (Status) || ExtScsiPassThru == NULL) {
if (EFI_ERROR (Status) || (ExtScsiPassThru == NULL)) {
continue;
}
InfoTypesBuffer = NULL;
InfoTypeBufferCount = 0;
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
continue;
}
//
// Check whether the AIP instance has Network boot information block.
//
@@ -165,33 +166,35 @@ IScsiCheckAip (
//
InfoBlock = NULL;
InfoBlockSize = 0;
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
if (EFI_ERROR (Status) || InfoBlock == NULL) {
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
continue;
}
//
// Check whether the network boot policy matches.
//
NetworkBoot = (EFI_ADAPTER_INFO_NETWORK_BOOT *) InfoBlock;
NetworkBoot = (EFI_ADAPTER_INFO_NETWORK_BOOT *)InfoBlock;
NetworkBootPolicy = PcdGet8 (PcdIScsiAIPNetworkBootPolicy);
if (NetworkBootPolicy == STOP_UEFI_ISCSI_IF_HBA_INSTALL_AIP) {
Status = EFI_SUCCESS;
goto Exit;
}
if (((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0 &&
if ((((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0) &&
!NetworkBoot->iScsiIpv4BootCapablity) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0) &&
!NetworkBoot->iScsiIpv6BootCapablity) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0) &&
!NetworkBoot->OffloadCapability) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0) &&
!NetworkBoot->iScsiMpioCapability) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0 &&
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0) &&
!NetworkBoot->iScsiIpv4Boot) ||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0 &&
!NetworkBoot->iScsiIpv6Boot)) {
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0) &&
!NetworkBoot->iScsiIpv6Boot))
{
FreePool (InfoBlock);
continue;
}
@@ -206,9 +209,11 @@ Exit:
if (InfoBlock != NULL) {
FreePool (InfoBlock);
}
if (AipHandleBuffer != NULL) {
FreePool (AipHandleBuffer);
}
return Status;
}
@@ -246,23 +251,22 @@ IScsiSupported (
IN UINT8 IpVersion
)
{
EFI_STATUS Status;
EFI_GUID *IScsiServiceBindingGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *DhcpServiceBindingGuid;
EFI_GUID *DnsServiceBindingGuid;
EFI_STATUS Status;
EFI_GUID *IScsiServiceBindingGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *DhcpServiceBindingGuid;
EFI_GUID *DnsServiceBindingGuid;
if (IpVersion == IP_VERSION_4) {
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
} else {
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns6ServiceBindingProtocolGuid;
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
DnsServiceBindingGuid = &gEfiDns6ServiceBindingProtocolGuid;
}
Status = gBS->OpenProtocol (
@@ -325,7 +329,6 @@ IScsiSupported (
return EFI_SUCCESS;
}
/**
Start to manage the controller. This is the worker function for
IScsiIp4(6)DriverBindingStart.
@@ -347,33 +350,33 @@ IScsiSupported (
**/
EFI_STATUS
IScsiStart (
IN EFI_HANDLE Image,
IN EFI_HANDLE ControllerHandle,
IN UINT8 IpVersion
IN EFI_HANDLE Image,
IN EFI_HANDLE ControllerHandle,
IN UINT8 IpVersion
)
{
EFI_STATUS Status;
ISCSI_DRIVER_DATA *Private;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptConfigData;
ISCSI_SESSION *Session;
UINT8 Index;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExistIScsiExtScsiPassThru;
ISCSI_DRIVER_DATA *ExistPrivate;
UINT8 *AttemptConfigOrder;
UINTN AttemptConfigOrderSize;
UINT8 BootSelected;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_GUID *IScsiPrivateGuid;
EFI_GUID *TcpServiceBindingGuid;
BOOLEAN NeedUpdate;
VOID *Interface;
EFI_GUID *ProtocolGuid;
UINT8 NetworkBootPolicy;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
EFI_STATUS Status;
ISCSI_DRIVER_DATA *Private;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptConfigData;
ISCSI_SESSION *Session;
UINT8 Index;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExistIScsiExtScsiPassThru;
ISCSI_DRIVER_DATA *ExistPrivate;
UINT8 *AttemptConfigOrder;
UINTN AttemptConfigOrderSize;
UINT8 BootSelected;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_GUID *IScsiPrivateGuid;
EFI_GUID *TcpServiceBindingGuid;
BOOLEAN NeedUpdate;
VOID *Interface;
EFI_GUID *ProtocolGuid;
UINT8 NetworkBootPolicy;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
//
// Test to see if iSCSI driver supports the given controller.
@@ -518,7 +521,7 @@ IScsiStart (
if (mPrivate->OneSessionEstablished && mPrivate->EnableMpio) {
AttemptConfigData = NULL;
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
AttemptConfigData = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
break;
}
@@ -558,7 +561,7 @@ IScsiStart (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath
(VOID **)&DevicePath
);
if (EFI_ERROR (Status)) {
continue;
@@ -572,7 +575,7 @@ IScsiStart (
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiExtScsiPassThruProtocolGuid,
(VOID **) &ExistIScsiExtScsiPassThru
(VOID **)&ExistIScsiExtScsiPassThru
);
ASSERT_EFI_ERROR (Status);
break;
@@ -622,9 +625,10 @@ IScsiStart (
// Don't process the attempt that does not associate with the current NIC or
// this attempt is disabled or established.
//
if (AttemptConfigData->NicIndex != mPrivate->CurrentNic ||
AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED ||
AttemptConfigData->ValidPath) {
if ((AttemptConfigData->NicIndex != mPrivate->CurrentNic) ||
(AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED) ||
AttemptConfigData->ValidPath)
{
continue;
}
@@ -633,9 +637,10 @@ IScsiStart (
// In default single path mode, don't process attempts configured for multipath.
//
if ((mPrivate->EnableMpio &&
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO) ||
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO)) ||
(!mPrivate->EnableMpio &&
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)) {
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)))
{
continue;
}
@@ -643,18 +648,21 @@ IScsiStart (
// Don't process the attempt that fails to get the init/target information from DHCP.
//
if (AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp &&
!AttemptConfigData->DhcpSuccess) {
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
!AttemptConfigData->DhcpSuccess)
{
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
continue;
}
//
// Don't process the autoconfigure path if it is already established.
//
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureSuccess) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
AttemptConfigData->AutoConfigureSuccess)
{
continue;
}
@@ -665,16 +673,20 @@ IScsiStart (
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) {
continue;
}
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6))
{
continue;
}
} else {
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) {
continue;
}
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4) {
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4))
{
continue;
}
}
@@ -682,7 +694,7 @@ IScsiStart (
//
// Fill in the Session and init it.
//
Session = (ISCSI_SESSION *) AllocateZeroPool (sizeof (ISCSI_SESSION));
Session = (ISCSI_SESSION *)AllocateZeroPool (sizeof (ISCSI_SESSION));
if (Session == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
@@ -694,9 +706,9 @@ IScsiStart (
UnicodeSPrint (
mPrivate->PortString,
(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
(UINTN)ISCSI_NAME_IFR_MAX_SIZE,
L"Attempt %d",
(UINTN) AttemptConfigData->AttemptConfigIndex
(UINTN)AttemptConfigData->AttemptConfigIndex
);
if (Session->AuthType == ISCSI_AUTH_TYPE_CHAP) {
@@ -742,12 +754,11 @@ IScsiStart (
// In Single path mode, only the successful attempt will be recorded in iBFT;
// in multi-path mode, all the attempt entries in MPIO will be recorded in iBFT.
//
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
FreePool (Session);
} else {
AttemptConfigData->ValidPath = TRUE;
@@ -756,7 +767,7 @@ IScsiStart (
// TODO: record KRB5 attempt information in the iSCSI device path.
//
if (Session->AuthType == ISCSI_AUTH_TYPE_KRB) {
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
mPrivate->ValidSinglePathCount--;
}
@@ -814,7 +825,7 @@ IScsiStart (
//
// Reinstall the original ExtScsiPassThru back.
//
if (mPrivate->OneSessionEstablished && ExistPrivate != NULL) {
if (mPrivate->OneSessionEstablished && (ExistPrivate != NULL)) {
Status = gBS->InstallProtocolInterface (
&ExistPrivate->ExtScsiPassThruHandle,
&gEfiExtScsiPassThruProtocolGuid,
@@ -837,8 +848,7 @@ IScsiStart (
//
// More than one attempt successes.
//
if (Private->Session != NULL && mPrivate->OneSessionEstablished) {
if ((Private->Session != NULL) && mPrivate->OneSessionEstablished) {
AttemptConfigOrder = IScsiGetVariableAndSize (
L"AttemptOrder",
&gIScsiConfigGuid,
@@ -847,9 +857,11 @@ IScsiStart (
if (AttemptConfigOrder == NULL) {
goto ON_ERROR;
}
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
if (AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex ||
AttemptConfigOrder[Index] == BootSelected) {
if ((AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex) ||
(AttemptConfigOrder[Index] == BootSelected))
{
break;
}
}
@@ -887,6 +899,7 @@ IScsiStart (
if (AttemptConfigOrder[Index] != BootSelected) {
goto ON_ERROR;
}
mPrivate->BootSelectedIndex = BootSelected;
//
// Clear the resource in ExistPrivate.
@@ -917,7 +930,6 @@ IScsiStart (
gBS->CloseEvent (ExistPrivate->ExitBootServiceEvent);
FreePool (ExistPrivate);
}
} else {
//
@@ -927,7 +939,6 @@ IScsiStart (
NeedUpdate = FALSE;
}
}
}
if (NeedUpdate) {
@@ -945,6 +956,7 @@ IScsiStart (
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
//
// Install the updated device path onto the ExtScsiPassThruHandle.
//
@@ -1032,16 +1044,15 @@ IScsiStop (
IN UINT8 IpVersion
)
{
EFI_HANDLE IScsiController;
EFI_STATUS Status;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
ISCSI_DRIVER_DATA *Private;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
ISCSI_CONNECTION *Conn;
EFI_GUID *ProtocolGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *TcpProtocolGuid;
EFI_HANDLE IScsiController;
EFI_STATUS Status;
ISCSI_PRIVATE_PROTOCOL *IScsiIdentifier;
ISCSI_DRIVER_DATA *Private;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *PassThru;
ISCSI_CONNECTION *Conn;
EFI_GUID *ProtocolGuid;
EFI_GUID *TcpServiceBindingGuid;
EFI_GUID *TcpProtocolGuid;
if (NumberOfChildren != 0) {
//
@@ -1050,7 +1061,7 @@ IScsiStop (
Status = gBS->OpenProtocol (
ChildHandleBuffer[0],
&gEfiExtScsiPassThruProtocolGuid,
(VOID **) &PassThru,
(VOID **)&PassThru,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1094,14 +1105,15 @@ IScsiStop (
// Get the handle of the controller we are controlling.
//
if (IpVersion == IP_VERSION_4) {
ProtocolGuid = &gIScsiV4PrivateGuid;
TcpProtocolGuid = &gEfiTcp4ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
ProtocolGuid = &gIScsiV4PrivateGuid;
TcpProtocolGuid = &gEfiTcp4ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
} else {
ProtocolGuid = &gIScsiV6PrivateGuid;
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
ProtocolGuid = &gIScsiV6PrivateGuid;
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
}
IScsiController = NetLibGetNicHandle (ControllerHandle, TcpProtocolGuid);
if (IScsiController == NULL) {
return EFI_SUCCESS;
@@ -1110,7 +1122,7 @@ IScsiStop (
Status = gBS->OpenProtocol (
IScsiController,
ProtocolGuid,
(VOID **) &IScsiIdentifier,
(VOID **)&IScsiIdentifier,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1272,7 +1284,7 @@ IScsiIp4DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_4);
if (Status == EFI_ALREADY_STARTED) {
@@ -1427,7 +1439,7 @@ IScsiIp6DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_6);
if (Status == EFI_ALREADY_STARTED) {
@@ -1496,12 +1508,12 @@ IScsiUnload (
IN EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
UINTN DeviceHandleCount;
EFI_HANDLE *DeviceHandleBuffer;
UINTN Index;
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
EFI_STATUS Status;
UINTN DeviceHandleCount;
EFI_HANDLE *DeviceHandleBuffer;
UINTN Index;
EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
//
// Try to disconnect the driver from the devices it's controlling.
@@ -1524,11 +1536,13 @@ IScsiUnload (
Status = IScsiTestManagedDevice (
DeviceHandleBuffer[Index],
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiTcp4ProtocolGuid)
;
&gEfiTcp4ProtocolGuid
)
;
if (EFI_ERROR (Status)) {
continue;
}
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gIScsiIp4DriverBinding.DriverBindingHandle,
@@ -1551,6 +1565,7 @@ IScsiUnload (
if (EFI_ERROR (Status)) {
continue;
}
Status = gBS->DisconnectController (
DeviceHandleBuffer[Index],
gIScsiIp6DriverBinding.DriverBindingHandle,
@@ -1582,11 +1597,12 @@ IScsiUnload (
goto ON_EXIT;
}
if (gIScsiControllerNameTable!= NULL) {
if (gIScsiControllerNameTable != NULL) {
Status = FreeUnicodeStringTable (gIScsiControllerNameTable);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
gIScsiControllerNameTable = NULL;
}
@@ -1597,15 +1613,15 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
(VOID **) &ComponentName
(VOID **)&ComponentName
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -1614,7 +1630,7 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp4DriverBinding.DriverBindingHandle,
&gEfiComponentName2ProtocolGuid,
(VOID **) &ComponentName2
(VOID **)&ComponentName2
);
if (!EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
@@ -1635,15 +1651,15 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
(VOID **) &ComponentName
(VOID **)&ComponentName
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -1652,7 +1668,7 @@ IScsiUnload (
Status = gBS->HandleProtocol (
gIScsiIp6DriverBinding.DriverBindingHandle,
&gEfiComponentName2ProtocolGuid,
(VOID **) &ComponentName2
(VOID **)&ComponentName2
);
if (!EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
@@ -1716,8 +1732,8 @@ ON_EXIT:
EFI_STATUS
EFIAPI
IScsiDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -1730,7 +1746,7 @@ IScsiDriverEntryPoint (
Status = gBS->LocateProtocol (
&gEfiIScsiInitiatorNameProtocolGuid,
NULL,
(VOID **) &IScsiInitiatorName
(VOID **)&IScsiInitiatorName
);
if (!EFI_ERROR (Status)) {
return EFI_ACCESS_DENIED;
@@ -1821,7 +1837,7 @@ IScsiDriverEntryPoint (
Status = gBS->LocateProtocol (
&gEfiAuthenticationInfoProtocolGuid,
NULL,
(VOID **) &AuthenticationInfo
(VOID **)&AuthenticationInfo
);
if (Status == EFI_NOT_FOUND) {
Status = gBS->InstallProtocolInterface (
@@ -1873,4 +1889,3 @@ Error1:
return Status;
}

View File

@@ -21,10 +21,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
0x28be27e5, 0x66cc, 0x4a31, { 0xa3, 0x15, 0xdb, 0x14, 0xc3, 0x74, 0x4d, 0x85 } \
}
#define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
#define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
#define IP_MODE_AUTOCONFIG_IP4 3
#define IP_MODE_AUTOCONFIG_IP6 4
#define IP_MODE_AUTOCONFIG_IP4 3
#define IP_MODE_AUTOCONFIG_IP6 4
#define ALWAYS_USE_UEFI_ISCSI_AND_IGNORE_ISCSI_HBA 0x00
#define STOP_UEFI_ISCSI_IF_HBA_INSTALL_AIP 0x01
#define STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4 0x02
@@ -45,41 +45,41 @@ extern EFI_GUID gIScsiV4PrivateGuid;
extern EFI_GUID gIScsiV6PrivateGuid;
typedef struct {
CHAR16 PortString[ISCSI_NAME_IFR_MAX_SIZE];
LIST_ENTRY NicInfoList;
UINT8 NicCount;
UINT8 CurrentNic;
UINT8 MaxNic;
BOOLEAN Ipv6Flag;
BOOLEAN OneSessionEstablished;
BOOLEAN EnableMpio;
UINT8 MpioCount; // The number of attempts in MPIO.
UINT8 Krb5MpioCount; // The number of attempts login with KRB5 in MPIO.
UINT8 SinglePathCount; // The number of single path attempts.
UINT8 ValidSinglePathCount; // The number of valid single path attempts.
UINT8 BootSelectedIndex;
UINT8 AttemptCount;
LIST_ENTRY AttemptConfigs; // User configured Attempt list.
CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE];
UINTN InitiatorNameLength;
CHAR16 PortString[ISCSI_NAME_IFR_MAX_SIZE];
LIST_ENTRY NicInfoList;
UINT8 NicCount;
UINT8 CurrentNic;
UINT8 MaxNic;
BOOLEAN Ipv6Flag;
BOOLEAN OneSessionEstablished;
BOOLEAN EnableMpio;
UINT8 MpioCount; // The number of attempts in MPIO.
UINT8 Krb5MpioCount; // The number of attempts login with KRB5 in MPIO.
UINT8 SinglePathCount; // The number of single path attempts.
UINT8 ValidSinglePathCount; // The number of valid single path attempts.
UINT8 BootSelectedIndex;
UINT8 AttemptCount;
LIST_ENTRY AttemptConfigs; // User configured Attempt list.
CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE];
UINTN InitiatorNameLength;
} ISCSI_PRIVATE_DATA;
extern ISCSI_PRIVATE_DATA *mPrivate;
extern ISCSI_PRIVATE_DATA *mPrivate;
typedef struct {
LIST_ENTRY Link;
UINT32 HwAddressSize;
EFI_MAC_ADDRESS PermanentAddress;
UINT8 NicIndex;
UINT16 VlanId;
UINTN BusNumber;
UINTN DeviceNumber;
UINTN FunctionNumber;
BOOLEAN Ipv6Available;
LIST_ENTRY Link;
UINT32 HwAddressSize;
EFI_MAC_ADDRESS PermanentAddress;
UINT8 NicIndex;
UINT16 VlanId;
UINTN BusNumber;
UINTN DeviceNumber;
UINTN FunctionNumber;
BOOLEAN Ipv6Available;
} ISCSI_NIC_INFO;
typedef struct _ISCSI_PRIVATE_PROTOCOL {
UINT32 Reserved;
UINT32 Reserved;
} ISCSI_PRIVATE_PROTOCOL;
//
@@ -388,9 +388,9 @@ IScsiIp6DriverBindingStop (
EFI_STATUS
EFIAPI
IScsiComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
/**
@@ -465,11 +465,11 @@ IScsiComponentNameGetDriverName (
EFI_STATUS
EFIAPI
IScsiComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
@@ -560,9 +560,9 @@ IScsiSetInitiatorName (
EFI_STATUS
EFIAPI
IScsiGetAuthenticationInfo (
IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
OUT VOID **Buffer
IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
OUT VOID **Buffer
);
/**
@@ -641,11 +641,11 @@ IScsiSetAuthenticationInfo (
EFI_STATUS
EFIAPI
IScsiExtScsiPassThruFunction (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
/**

View File

@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate = {
EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate = {
NULL,
IScsiExtScsiPassThruFunction,
IScsiExtScsiPassThruGetNextTargetLun,
@@ -19,7 +19,6 @@ EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate = {
IScsiExtScsiPassThruGetNextTarget
};
/**
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.
This function supports both blocking I/O and nonblocking I/O. The blocking I/O
@@ -73,11 +72,11 @@ EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate = {
EFI_STATUS
EFIAPI
IScsiExtScsiPassThruFunction (
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
)
{
EFI_STATUS Status;
@@ -107,7 +106,6 @@ IScsiExtScsiPassThruFunction (
return Status;
}
/**
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on
a SCSI channel. These can either be the list SCSI devices that are actually
@@ -145,14 +143,14 @@ IScsiExtScsiPassThruGetNextTargetLun (
IN OUT UINT64 *Lun
)
{
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
UINT8 TargetId[TARGET_MAX_BYTES];
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
UINT8 TargetId[TARGET_MAX_BYTES];
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
if ((*Target)[0] == 0 && (CompareMem (Lun, ConfigNvData->BootLun, sizeof (UINT64)) == 0)) {
if (((*Target)[0] == 0) && (CompareMem (Lun, ConfigNvData->BootLun, sizeof (UINT64)) == 0)) {
//
// Only one <Target, Lun> pair per iSCSI Driver instance.
//
@@ -170,7 +168,6 @@ IScsiExtScsiPassThruGetNextTargetLun (
return EFI_INVALID_PARAMETER;
}
/**
Allocate and build a device path node for a SCSI device on a SCSI channel.
@@ -206,12 +203,12 @@ IScsiExtScsiPassThruBuildDevicePath (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION *Session;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
EFI_DEV_PATH *Node;
UINTN DevPathNodeLen;
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION *Session;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
EFI_DEV_PATH *Node;
UINTN DevPathNodeLen;
if (DevicePath == NULL) {
return EFI_INVALID_PARAMETER;
@@ -221,17 +218,17 @@ IScsiExtScsiPassThruBuildDevicePath (
return EFI_NOT_FOUND;
}
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
Session = Private->Session;
ConfigNvData = &Session->ConfigData->SessionConfigData;
AuthConfig = Session->AuthData.CHAP.AuthConfig;
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
Session = Private->Session;
ConfigNvData = &Session->ConfigData->SessionConfigData;
AuthConfig = Session->AuthData.CHAP.AuthConfig;
if (CompareMem (&Lun, ConfigNvData->BootLun, sizeof (UINT64)) != 0) {
return EFI_NOT_FOUND;
}
DevPathNodeLen = sizeof (ISCSI_DEVICE_PATH) + AsciiStrLen (ConfigNvData->TargetName) + 1;
Node = AllocateZeroPool (DevPathNodeLen);
DevPathNodeLen = sizeof (ISCSI_DEVICE_PATH) + AsciiStrLen (ConfigNvData->TargetName) + 1;
Node = AllocateZeroPool (DevPathNodeLen);
if (Node == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -245,36 +242,36 @@ IScsiExtScsiPassThruBuildDevicePath (
//
Node->Iscsi.NetworkProtocol = 0;
Node->Iscsi.LoginOption = 0;
Node->Iscsi.LoginOption = 0;
switch (Session->AuthType) {
case ISCSI_AUTH_TYPE_NONE:
Node->Iscsi.LoginOption |= 0x0800;
break;
case ISCSI_AUTH_TYPE_NONE:
Node->Iscsi.LoginOption |= 0x0800;
break;
case ISCSI_AUTH_TYPE_CHAP:
//
// Bit12: 0=CHAP_BI, 1=CHAP_UNI
//
if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {
Node->Iscsi.LoginOption |= 0x1000;
}
break;
case ISCSI_AUTH_TYPE_CHAP:
//
// Bit12: 0=CHAP_BI, 1=CHAP_UNI
//
if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {
Node->Iscsi.LoginOption |= 0x1000;
}
default:
break;
break;
default:
break;
}
CopyMem (&Node->Iscsi.Lun, ConfigNvData->BootLun, sizeof (UINT64));
Node->Iscsi.TargetPortalGroupTag = Session->TargetPortalGroupTag;
AsciiStrCpyS ((CHAR8 *) Node + sizeof (ISCSI_DEVICE_PATH), AsciiStrLen (ConfigNvData->TargetName) + 1, ConfigNvData->TargetName);
AsciiStrCpyS ((CHAR8 *)Node + sizeof (ISCSI_DEVICE_PATH), AsciiStrLen (ConfigNvData->TargetName) + 1, ConfigNvData->TargetName);
*DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;
*DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)Node;
return EFI_SUCCESS;
}
/**
Translate a device path node to a Target ID and LUN.
@@ -305,8 +302,8 @@ IScsiExtScsiPassThruGetTargetLun (
OUT UINT64 *Lun
)
{
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
ISCSI_DRIVER_DATA *Private;
ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
if ((DevicePath == NULL) || (Target == NULL) || (Lun == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -315,17 +312,18 @@ IScsiExtScsiPassThruGetTargetLun (
if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
(DevicePath->SubType != MSG_ISCSI_DP) ||
(DevicePathNodeLength (DevicePath) <= sizeof (ISCSI_DEVICE_PATH))
) {
)
{
return EFI_UNSUPPORTED;
}
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
SetMem (*Target, TARGET_MAX_BYTES, 0xFF);
(*Target)[0] = 0;
if (AsciiStrCmp (ConfigNvData->TargetName, (CHAR8 *) DevicePath + sizeof (ISCSI_DEVICE_PATH)) != 0) {
if (AsciiStrCmp (ConfigNvData->TargetName, (CHAR8 *)DevicePath + sizeof (ISCSI_DEVICE_PATH)) != 0) {
return EFI_UNSUPPORTED;
}
@@ -334,7 +332,6 @@ IScsiExtScsiPassThruGetTargetLun (
return EFI_SUCCESS;
}
/**
Resets a SCSI channel. This operation resets all the SCSI devices connected to
the SCSI channel.
@@ -353,7 +350,6 @@ IScsiExtScsiPassThruResetChannel (
return EFI_UNSUPPORTED;
}
/**
Resets a SCSI device that is connected to a SCSI channel.
@@ -403,7 +399,7 @@ IScsiExtScsiPassThruGetNextTarget (
IN OUT UINT8 **Target
)
{
UINT8 TargetId[TARGET_MAX_BYTES];
UINT8 TargetId[TARGET_MAX_BYTES];
SetMem (TargetId, TARGET_MAX_BYTES, 0xFF);
@@ -416,4 +412,3 @@ IScsiExtScsiPassThruGetNextTarget (
return EFI_INVALID_PARAMETER;
}
}

View File

@@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
BOOLEAN mIbftInstalled = FALSE;
UINTN mTableKey;
BOOLEAN mIbftInstalled = FALSE;
UINTN mTableKey;
/**
Initialize the header of the iSCSI Boot Firmware Table.
@@ -21,9 +21,9 @@ UINTN mTableKey;
**/
VOID
IScsiInitIbfTableHeader (
OUT EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Header,
IN UINT8 *OemId,
IN UINT64 *OemTableId
OUT EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Header,
IN UINT8 *OemId,
IN UINT64 *OemTableId
)
{
Header->Signature = EFI_ACPI_3_0_ISCSI_BOOT_FIRMWARE_TABLE_SIGNATURE;
@@ -35,7 +35,6 @@ IScsiInitIbfTableHeader (
CopyMem (&Header->OemTableId, OemTableId, sizeof (UINT64));
}
/**
Initialize the control section of the iSCSI Boot Firmware Table.
@@ -50,11 +49,11 @@ IScsiInitControlSection (
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *Control;
UINTN NumOffset;
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *) (Table + 1);
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *)(Table + 1);
Control->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_ID;
Control->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_VERSION;
Control->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE);
Control->Header.Length = (UINT16)sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE);
//
// If in multipathing mode, enable the Boot Failover Flag.
@@ -65,7 +64,7 @@ IScsiInitControlSection (
//
if (mPrivate->EnableMpio) {
Control->Header.Flags = 0;
NumOffset = 2 * (mPrivate->MpioCount - mPrivate->Krb5MpioCount);
NumOffset = 2 * (mPrivate->MpioCount - mPrivate->Krb5MpioCount);
} else {
NumOffset = 2 * mPrivate->ValidSinglePathCount;
}
@@ -79,11 +78,10 @@ IScsiInitControlSection (
// Need expand the control section if more than 2 NIC/Target attempts
// exist.
//
Control->Header.Length = (UINT16) (Control->Header.Length + (NumOffset - 4) * sizeof (UINT16));
Control->Header.Length = (UINT16)(Control->Header.Length + (NumOffset - 4) * sizeof (UINT16));
}
}
/**
Add one item into the heap.
@@ -109,7 +107,6 @@ IScsiAddHeapItem (
*(*Heap + Len) = 0;
}
/**
Fill the Initiator section of the iSCSI Boot Firmware Table.
@@ -126,19 +123,19 @@ IScsiFillInitiatorSection (
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *Control;
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE *Initiator;
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *) (Table + 1);
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *)(Table + 1);
//
// Initiator section immediately follows the control section.
//
Initiator = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE *)
((UINT8 *) Control + IBFT_ROUNDUP (Control->Header.Length));
((UINT8 *)Control + IBFT_ROUNDUP (Control->Header.Length));
Control->InitiatorOffset = (UINT16) ((UINTN) Initiator - (UINTN) Table);
Control->InitiatorOffset = (UINT16)((UINTN)Initiator - (UINTN)Table);
Initiator->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_ID;
Initiator->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_VERSION;
Initiator->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE);
Initiator->Header.Length = (UINT16)sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE);
Initiator->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BLOCK_VALID |
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BOOT_SELECTED;
@@ -147,11 +144,10 @@ IScsiFillInitiatorSection (
//
IScsiAddHeapItem (Heap, mPrivate->InitiatorName, mPrivate->InitiatorNameLength - 1);
Initiator->IScsiNameLength = (UINT16) (mPrivate->InitiatorNameLength - 1);
Initiator->IScsiNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Initiator->IScsiNameLength = (UINT16)(mPrivate->InitiatorNameLength - 1);
Initiator->IScsiNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
}
/**
Map the v4 IP address into v6 IP address.
@@ -161,23 +157,22 @@ IScsiFillInitiatorSection (
**/
VOID
IScsiMapV4ToV6Addr (
IN EFI_IPv4_ADDRESS *V4,
OUT EFI_IPv6_ADDRESS *V6
IN EFI_IPv4_ADDRESS *V4,
OUT EFI_IPv6_ADDRESS *V6
)
{
UINTN Index;
UINTN Index;
ZeroMem (V6, sizeof (EFI_IPv6_ADDRESS));
V6->Addr[10] = 0xff;
V6->Addr[11] = 0xff;
V6->Addr[10] = 0xff;
V6->Addr[11] = 0xff;
for (Index = 0; Index < 4; Index++) {
V6->Addr[12 + Index] = V4->Addr[Index];
}
}
/**
Fill the NIC and target sections in iSCSI Boot Firmware Table.
@@ -208,11 +203,11 @@ IScsiFillNICAndTargetSections (
//
// Get the offset of the first Nic and Target section.
//
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *) (Table + 1);
Nic = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE *) ((UINTN) Table +
Control->InitiatorOffset + IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE)));
Target = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE *) ((UINTN) Nic +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE)));
Control = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE *)(Table + 1);
Nic = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE *)((UINTN)Table +
Control->InitiatorOffset + IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE)));
Target = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE *)((UINTN)Nic +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE)));
SectionOffset = &Control->NIC0Offset;
@@ -233,11 +228,10 @@ IScsiFillNICAndTargetSections (
}
ASSERT (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED);
} else {
if (Index == 1 && Flag) {
if ((Index == 1) && Flag) {
Entry = mPrivate->AttemptConfigs.ForwardLink;
Flag = FALSE;
Flag = FALSE;
}
Attempt = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
@@ -260,7 +254,7 @@ IScsiFillNICAndTargetSections (
//
// If multipath mode is enabled, only the attempts in MPIO will be recorded in iBFT.
//
if (mPrivate->EnableMpio && Attempt->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO) {
if (mPrivate->EnableMpio && (Attempt->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO)) {
continue;
}
@@ -280,13 +274,13 @@ IScsiFillNICAndTargetSections (
Nic->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_ID;
Nic->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_VERSION;
Nic->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE);
Nic->Header.Index = (UINT8) Index;
Nic->Header.Length = (UINT16)sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE);
Nic->Header.Index = (UINT8)Index;
Nic->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BLOCK_VALID |
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_GLOBAL;
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_GLOBAL;
if (Index == 0) {
Nic->Header.Flags |= EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BOOT_SELECTED;
Nic->Header.Flags |= EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BOOT_SELECTED;
}
if (NvData->InitiatorInfoFromDhcp) {
@@ -295,7 +289,7 @@ IScsiFillNICAndTargetSections (
Nic->Origin = IpPrefixOriginManual;
}
if (NvData->IpMode == IP_MODE_IP4 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
if ((NvData->IpMode == IP_MODE_IP4) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
//
// Get the subnet mask prefix length.
//
@@ -309,16 +303,13 @@ IScsiFillNICAndTargetSections (
IScsiMapV4ToV6Addr (&Attempt->PrimaryDns.v4, &Nic->PrimaryDns);
IScsiMapV4ToV6Addr (&Attempt->SecondaryDns.v4, &Nic->SecondaryDns);
IScsiMapV4ToV6Addr (&Attempt->DhcpServer.v4, &Nic->DhcpServer);
} else if (NvData->IpMode == IP_MODE_IP6 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
} else if ((NvData->IpMode == IP_MODE_IP6) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
Nic->SubnetMaskPrefixLength = NvData->PrefixLength;
CopyMem (&Nic->Ip, &NvData->LocalIp, sizeof (EFI_IPv6_ADDRESS));
CopyMem (&Nic->Gateway, &NvData->Gateway, sizeof (EFI_IPv6_ADDRESS));
CopyMem (&Nic->PrimaryDns, &Attempt->PrimaryDns, sizeof (EFI_IPv6_ADDRESS));
CopyMem (&Nic->SecondaryDns, &Attempt->SecondaryDns, sizeof (EFI_IPv6_ADDRESS));
CopyMem (&Nic->DhcpServer, &Attempt->DhcpServer, sizeof (EFI_IPv6_ADDRESS));
} else {
ASSERT (FALSE);
}
@@ -331,26 +322,26 @@ IScsiFillNICAndTargetSections (
Nic->VLanTag = NicInfo->VlanId;
CopyMem (Nic->Mac, &NicInfo->PermanentAddress, sizeof (Nic->Mac));
Nic->PciLocation = (UINT16) ((NicInfo->BusNumber << 8) |
(NicInfo->DeviceNumber << 3) | NicInfo->FunctionNumber);
*SectionOffset = (UINT16) ((UINTN) Nic - (UINTN) Table);
Nic->PciLocation = (UINT16)((NicInfo->BusNumber << 8) |
(NicInfo->DeviceNumber << 3) | NicInfo->FunctionNumber);
*SectionOffset = (UINT16)((UINTN)Nic - (UINTN)Table);
SectionOffset++;
//
// Fill the Target section.
//
Target->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_ID;
Target->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_VERSION;
Target->Header.Length = (UINT16) sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE);
Target->Header.Index = (UINT8) Index;
Target->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID;
Target->Header.StructureId = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_ID;
Target->Header.Version = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_VERSION;
Target->Header.Length = (UINT16)sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE);
Target->Header.Index = (UINT8)Index;
Target->Header.Flags = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID;
if (Index == 0) {
Target->Header.Flags |= EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED;
Target->Header.Flags |= EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED;
}
Target->Port = NvData->TargetPort;
Target->Port = NvData->TargetPort;
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {
@@ -362,11 +353,11 @@ IScsiFillNICAndTargetSections (
Target->CHAPType = EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP;
}
Target->NicIndex = (UINT8) Index;
Target->NicIndex = (UINT8)Index;
if (NvData->IpMode == IP_MODE_IP4 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
if ((NvData->IpMode == IP_MODE_IP4) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
IScsiMapV4ToV6Addr (&NvData->TargetIp.v4, &Target->Ip);
} else if (NvData->IpMode == IP_MODE_IP6 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
} else if ((NvData->IpMode == IP_MODE_IP6) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
CopyMem (&Target->Ip, &NvData->TargetIp, sizeof (EFI_IPv6_ADDRESS));
} else {
ASSERT (FALSE);
@@ -377,64 +368,63 @@ IScsiFillNICAndTargetSections (
//
// Target iSCSI Name, CHAP name/secret, reverse CHAP name/secret.
//
Length = (UINT16) AsciiStrLen (NvData->TargetName);
Length = (UINT16)AsciiStrLen (NvData->TargetName);
IScsiAddHeapItem (Heap, NvData->TargetName, Length);
Target->IScsiNameLength = Length;
Target->IScsiNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Target->IScsiNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
//
// CHAP Name
//
Length = (UINT16) AsciiStrLen (AuthConfig->CHAPName);
Length = (UINT16)AsciiStrLen (AuthConfig->CHAPName);
IScsiAddHeapItem (Heap, AuthConfig->CHAPName, Length);
Target->CHAPNameLength = Length;
Target->CHAPNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Target->CHAPNameLength = Length;
Target->CHAPNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
//
// CHAP Secret
//
Length = (UINT16) AsciiStrLen (AuthConfig->CHAPSecret);
Length = (UINT16)AsciiStrLen (AuthConfig->CHAPSecret);
IScsiAddHeapItem (Heap, AuthConfig->CHAPSecret, Length);
Target->CHAPSecretLength = Length;
Target->CHAPSecretOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Target->CHAPSecretLength = Length;
Target->CHAPSecretOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
if (Target->CHAPType == EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP) {
//
// Reverse CHAP Name.
//
Length = (UINT16) AsciiStrLen (AuthConfig->ReverseCHAPName);
Length = (UINT16)AsciiStrLen (AuthConfig->ReverseCHAPName);
IScsiAddHeapItem (Heap, AuthConfig->ReverseCHAPName, Length);
Target->ReverseCHAPNameLength = Length;
Target->ReverseCHAPNameOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Target->ReverseCHAPNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
//
// Reverse CHAP Secret.
//
Length = (UINT16) AsciiStrLen (AuthConfig->ReverseCHAPSecret);
Length = (UINT16)AsciiStrLen (AuthConfig->ReverseCHAPSecret);
IScsiAddHeapItem (Heap, AuthConfig->ReverseCHAPSecret, Length);
Target->ReverseCHAPSecretLength = Length;
Target->ReverseCHAPSecretOffset = (UINT16) ((UINTN) *Heap - (UINTN) Table);
Target->ReverseCHAPSecretOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
}
}
*SectionOffset = (UINT16) ((UINTN) Target - (UINTN) Table);
*SectionOffset = (UINT16)((UINTN)Target - (UINTN)Table);
SectionOffset++;
//
// Advance to the next NIC/Target pair.
//
Nic = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE *) ((UINTN) Target +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE)));
Target = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE *) ((UINTN) Nic +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE)));
Nic = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE *)((UINTN)Target +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE)));
Target = (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE *)((UINTN)Nic +
IBFT_ROUNDUP (sizeof (EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE)));
Index++;
}
}
/**
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
session status.
@@ -457,29 +447,29 @@ IScsiPublishIbft (
Rsdt = NULL;
Xsdt = NULL;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) {
return ;
return;
}
//
// Find ACPI table RSD_PTR from the system table.
//
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **)&Rsdp);
if (EFI_ERROR (Status)) {
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **)&Rsdp);
}
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
return ;
} else if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress;
return;
} else if ((Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) && (Rsdp->XsdtAddress != 0)) {
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
} else if (Rsdp->RsdtAddress != 0) {
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
}
if ((Xsdt == NULL) && (Rsdt == NULL)) {
return ;
return;
}
if (mIbftInstalled) {
@@ -488,17 +478,19 @@ IScsiPublishIbft (
mTableKey
);
if (EFI_ERROR (Status)) {
return ;
return;
}
mIbftInstalled = FALSE;
}
//
// If there is no valid attempt configuration, just return.
//
if ((!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount == 0) ||
(mPrivate->EnableMpio && mPrivate->MpioCount <= mPrivate->Krb5MpioCount)) {
return ;
if ((!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount == 0)) ||
(mPrivate->EnableMpio && (mPrivate->MpioCount <= mPrivate->Krb5MpioCount)))
{
return;
}
//
@@ -506,10 +498,10 @@ IScsiPublishIbft (
//
Table = AllocateZeroPool (IBFT_MAX_SIZE);
if (Table == NULL) {
return ;
return;
}
Heap = (UINT8 *) Table + IBFT_HEAP_OFFSET;
Heap = (UINT8 *)Table + IBFT_HEAP_OFFSET;
//
// Fill in the various section of the iSCSI Boot Firmware Table.
@@ -524,7 +516,7 @@ IScsiPublishIbft (
IScsiFillInitiatorSection (Table, &Heap);
IScsiFillNICAndTargetSections (Table, &Heap);
Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length);
Checksum = CalculateCheckSum8 ((UINT8 *)Table, Table->Length);
Table->Checksum = Checksum;
//
@@ -536,7 +528,7 @@ IScsiPublishIbft (
Table->Length,
&mTableKey
);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return;
}

View File

@@ -14,9 +14,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Protocol/AcpiTable.h>
#include <Protocol/PciIo.h>
#define IBFT_TABLE_VAR_NAME L"iBFT"
#define IBFT_MAX_SIZE 4096
#define IBFT_HEAP_OFFSET 2048
#define IBFT_TABLE_VAR_NAME L"iBFT"
#define IBFT_MAX_SIZE 4096
#define IBFT_HEAP_OFFSET 2048
#define IBFT_ROUNDUP(size) NET_ROUNDUP ((size), EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_ALIGNMENT)

View File

@@ -67,105 +67,105 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiDns.h"
#include "IScsiConfig.h"
#define ISCSI_AUTH_INITIAL 0
#define ISCSI_AUTH_INITIAL 0
#define ISCSI_SESSION_SIGNATURE SIGNATURE_32 ('I', 'S', 'S', 'N')
#define ISCSI_SESSION_SIGNATURE SIGNATURE_32 ('I', 'S', 'S', 'N')
///
/// 10 seconds
///
#define ISCSI_GET_MAPPING_TIMEOUT 100000000U
#define ISCSI_GET_MAPPING_TIMEOUT 100000000U
///
/// 3 seconds
///
#define ISCSI_WAIT_IPSEC_TIMEOUT 30000000U
struct _ISCSI_SESSION {
UINT32 Signature;
UINT32 Signature;
ISCSI_DRIVER_DATA *Private;
ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;
ISCSI_DRIVER_DATA *Private;
ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;
UINT8 AuthType;
UINT8 AuthType;
union {
ISCSI_CHAP_AUTH_DATA CHAP;
ISCSI_CHAP_AUTH_DATA CHAP;
} AuthData;
UINT8 State;
UINT8 State;
UINT8 Isid[6];
UINT16 Tsih;
UINT8 Isid[6];
UINT16 Tsih;
UINT32 CmdSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 CmdSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 InitiatorTaskTag;
UINT16 NextCid;
UINT32 InitiatorTaskTag;
UINT16 NextCid;
LIST_ENTRY Conns;
UINT32 NumConns;
LIST_ENTRY Conns;
UINT32 NumConns;
LIST_ENTRY TcbList;
LIST_ENTRY TcbList;
//
// Session-wide parameters
//
UINT16 TargetPortalGroupTag;
UINT32 MaxConnections;
BOOLEAN InitialR2T;
BOOLEAN ImmediateData;
UINT32 MaxBurstLength;
UINT32 FirstBurstLength;
UINT32 DefaultTime2Wait;
UINT32 DefaultTime2Retain;
UINT16 MaxOutstandingR2T;
BOOLEAN DataPDUInOrder;
BOOLEAN DataSequenceInOrder;
UINT8 ErrorRecoveryLevel;
UINT16 TargetPortalGroupTag;
UINT32 MaxConnections;
BOOLEAN InitialR2T;
BOOLEAN ImmediateData;
UINT32 MaxBurstLength;
UINT32 FirstBurstLength;
UINT32 DefaultTime2Wait;
UINT32 DefaultTime2Retain;
UINT16 MaxOutstandingR2T;
BOOLEAN DataPDUInOrder;
BOOLEAN DataSequenceInOrder;
UINT8 ErrorRecoveryLevel;
};
#define ISCSI_CONNECTION_SIGNATURE SIGNATURE_32 ('I', 'S', 'C', 'N')
struct _ISCSI_CONNECTION {
UINT32 Signature;
LIST_ENTRY Link;
UINT32 Signature;
LIST_ENTRY Link;
EFI_EVENT TimeoutEvent;
EFI_EVENT TimeoutEvent;
ISCSI_SESSION *Session;
ISCSI_SESSION *Session;
UINT8 State;
UINT8 CurrentStage;
UINT8 NextStage;
UINT8 State;
UINT8 CurrentStage;
UINT8 NextStage;
UINT8 AuthStep;
UINT8 AuthStep;
BOOLEAN PartialReqSent;
BOOLEAN PartialRspRcvd;
BOOLEAN PartialReqSent;
BOOLEAN PartialRspRcvd;
BOOLEAN TransitInitiated;
BOOLEAN ParamNegotiated;
BOOLEAN TransitInitiated;
BOOLEAN ParamNegotiated;
UINT16 Cid;
UINT32 ExpStatSN;
UINT16 Cid;
UINT32 ExpStatSN;
//
// Queues...
//
NET_BUF_QUEUE RspQue;
NET_BUF_QUEUE RspQue;
BOOLEAN Ipv6Flag;
TCP_IO TcpIo;
BOOLEAN Ipv6Flag;
TCP_IO TcpIo;
//
// Connection-only parameters.
//
UINT32 MaxRecvDataSegmentLength;
ISCSI_DIGEST_TYPE HeaderDigest;
ISCSI_DIGEST_TYPE DataDigest;
UINT32 MaxRecvDataSegmentLength;
ISCSI_DIGEST_TYPE HeaderDigest;
ISCSI_DIGEST_TYPE DataDigest;
};
#define ISCSI_DRIVER_DATA_SIGNATURE SIGNATURE_32 ('I', 'S', 'D', 'A')
#define ISCSI_DRIVER_DATA_SIGNATURE SIGNATURE_32 ('I', 'S', 'D', 'A')
#define ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU(PassThru) \
CR ( \
@@ -184,19 +184,19 @@ struct _ISCSI_CONNECTION {
)
struct _ISCSI_DRIVER_DATA {
UINT32 Signature;
EFI_HANDLE Image;
EFI_HANDLE Controller;
ISCSI_PRIVATE_PROTOCOL IScsiIdentifier;
UINT32 Signature;
EFI_HANDLE Image;
EFI_HANDLE Controller;
ISCSI_PRIVATE_PROTOCOL IScsiIdentifier;
EFI_EVENT ExitBootServiceEvent;
EFI_EVENT ExitBootServiceEvent;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL IScsiExtScsiPassThru;
EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;
EFI_HANDLE ExtScsiPassThruHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE ChildHandle;
ISCSI_SESSION *Session;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL IScsiExtScsiPassThru;
EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;
EFI_HANDLE ExtScsiPassThruHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE ChildHandle;
ISCSI_SESSION *Session;
};
#endif

View File

@@ -8,12 +8,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "IScsiImpl.h"
EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName = {
EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName = {
IScsiGetInitiatorName,
IScsiSetInitiatorName
};
/**
Retrieves the current set value of iSCSI Initiator Name.
@@ -64,7 +63,6 @@ IScsiGetInitiatorName (
return Status;
}
/**
Sets the iSSI Initiator Name.
@@ -110,10 +108,11 @@ IScsiSetInitiatorName (
*BufferSize = ISCSI_NAME_MAX_SIZE;
return EFI_INVALID_PARAMETER;
}
//
// Only support iqn iSCSI names.
//
Status = IScsiNormalizeName ((CHAR8 *) Buffer, *BufferSize - 1);
Status = IScsiNormalizeName ((CHAR8 *)Buffer, *BufferSize - 1);
if (EFI_ERROR (Status)) {
return Status;
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,49 +14,47 @@ typedef struct _ISCSI_DRIVER_DATA ISCSI_DRIVER_DATA;
///
/// IPv4 Device Path Node Length
///
#define IP4_NODE_LEN_NEW_VERSIONS 27
#define IP4_NODE_LEN_NEW_VERSIONS 27
///
/// IPv6 Device Path Node Length
///
#define IP6_NODE_LEN_OLD_VERSIONS 43
#define IP6_NODE_LEN_NEW_VERSIONS 60
#define IP6_NODE_LEN_OLD_VERSIONS 43
#define IP6_NODE_LEN_NEW_VERSIONS 60
///
/// The ignored field StaticIpAddress's offset in old IPv6 Device Path
///
#define IP6_OLD_IPADDRESS_OFFSET 42
#define IP6_OLD_IPADDRESS_OFFSET 42
#pragma pack(1)
typedef struct _ISCSI_SESSION_CONFIG_NVDATA {
UINT16 TargetPort;
UINT8 Enabled;
UINT8 IpMode;
UINT16 TargetPort;
UINT8 Enabled;
UINT8 IpMode;
EFI_IP_ADDRESS LocalIp;
EFI_IPv4_ADDRESS SubnetMask;
EFI_IP_ADDRESS Gateway;
EFI_IP_ADDRESS LocalIp;
EFI_IPv4_ADDRESS SubnetMask;
EFI_IP_ADDRESS Gateway;
BOOLEAN InitiatorInfoFromDhcp;
BOOLEAN TargetInfoFromDhcp;
BOOLEAN InitiatorInfoFromDhcp;
BOOLEAN TargetInfoFromDhcp;
CHAR8 TargetName[ISCSI_NAME_MAX_SIZE];
EFI_IP_ADDRESS TargetIp;
UINT8 PrefixLength;
UINT8 BootLun[8];
CHAR8 TargetName[ISCSI_NAME_MAX_SIZE];
EFI_IP_ADDRESS TargetIp;
UINT8 PrefixLength;
UINT8 BootLun[8];
UINT16 ConnectTimeout; ///< timeout value in milliseconds.
UINT8 ConnectRetryCount;
UINT8 IsId[6];
UINT16 ConnectTimeout; ///< timeout value in milliseconds.
UINT8 ConnectRetryCount;
UINT8 IsId[6];
BOOLEAN RedirectFlag;
UINT16 OriginalTargetPort; // The port of proxy/virtual target.
EFI_IP_ADDRESS OriginalTargetIp; // The address of proxy/virtual target.
BOOLEAN DnsMode; // Flag indicate whether the Target address is expressed as URL format.
CHAR8 TargetUrl[ISCSI_TARGET_URI_MAX_SIZE];
BOOLEAN RedirectFlag;
UINT16 OriginalTargetPort; // The port of proxy/virtual target.
EFI_IP_ADDRESS OriginalTargetIp; // The address of proxy/virtual target.
BOOLEAN DnsMode; // Flag indicate whether the Target address is expressed as URL format.
CHAR8 TargetUrl[ISCSI_TARGET_URI_MAX_SIZE];
} ISCSI_SESSION_CONFIG_NVDATA;
#pragma pack()
@@ -134,9 +132,9 @@ IScsiMacAddrToStr (
**/
EFI_STATUS
IScsiAsciiStrToIp (
IN CHAR8 *Str,
IN UINT8 IpMode,
OUT EFI_IP_ADDRESS *Ip
IN CHAR8 *Str,
IN UINT8 IpMode,
OUT EFI_IP_ADDRESS *Ip
);
/**
@@ -156,10 +154,10 @@ IScsiAsciiStrToIp (
**/
EFI_STATUS
IScsiBinToHex (
IN UINT8 *BinBuffer,
IN UINT32 BinLength,
IN OUT CHAR8 *HexStr,
IN OUT UINT32 *HexLength
IN UINT8 *BinBuffer,
IN UINT32 BinLength,
IN OUT CHAR8 *HexStr,
IN OUT UINT32 *HexLength
);
/**
@@ -180,12 +178,11 @@ IScsiBinToHex (
**/
EFI_STATUS
IScsiHexToBin (
IN OUT UINT8 *BinBuffer,
IN OUT UINT32 *BinLength,
IN CHAR8 *HexStr
IN OUT UINT8 *BinBuffer,
IN OUT UINT32 *BinLength,
IN CHAR8 *HexStr
);
/**
Convert the decimal-constant string or hex-constant string into a numerical value.
@@ -255,7 +252,7 @@ IScsiRemoveNic (
**/
EFI_STATUS
IScsiCreateAttempts (
IN UINTN AttemptNum
IN UINTN AttemptNum
);
/**
@@ -269,7 +266,7 @@ IScsiCreateAttempts (
**/
EFI_STATUS
IScsiCreateKeywords (
IN UINTN KeywordNum
IN UINTN KeywordNum
);
/**
@@ -292,10 +289,9 @@ IScsiCleanAttemptVariable (
**/
ISCSI_NIC_INFO *
IScsiGetNicInfoByIndex (
IN UINT8 NicIndex
IN UINT8 NicIndex
);
/**
Get the NIC's PCI location and return it according to the composited
format defined in iSCSI Boot Firmware Table.
@@ -331,9 +327,9 @@ IScsiGetNICPciLocation (
**/
VOID *
IScsiGetVariableAndSize (
IN CHAR16 *Name,
IN EFI_GUID *VendorGuid,
OUT UINTN *VariableSize
IN CHAR16 *Name,
IN EFI_GUID *VendorGuid,
OUT UINTN *VariableSize
);
/**
@@ -422,7 +418,7 @@ IScsiGetConfigData (
**/
EFI_DEVICE_PATH_PROTOCOL *
IScsiGetTcpConnDevicePath (
IN ISCSI_SESSION *Session
IN ISCSI_SESSION *Session
);
/**
@@ -465,8 +461,9 @@ IScsiOnExitBootService (
EFI_STATUS
EFIAPI
IScsiTestManagedDevice (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_GUID *ProtocolGuid
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_GUID *ProtocolGuid
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -24,21 +24,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
(((INT32) (s1) > (INT32) (s2)) && (s1 - s2) < ((UINT32) 1 << 31)) \
)
#define ISCSI_WELL_KNOWN_PORT 3260
#define ISCSI_MAX_CONNS_PER_SESSION 1
#define ISCSI_WELL_KNOWN_PORT 3260
#define ISCSI_MAX_CONNS_PER_SESSION 1
#define DEFAULT_MAX_RECV_DATA_SEG_LEN 8192
#define MAX_RECV_DATA_SEG_LEN_IN_FFP 65536
#define DEFAULT_MAX_OUTSTANDING_R2T 1
#define DEFAULT_MAX_RECV_DATA_SEG_LEN 8192
#define MAX_RECV_DATA_SEG_LEN_IN_FFP 65536
#define DEFAULT_MAX_OUTSTANDING_R2T 1
#define ISCSI_VERSION_MAX 0x00
#define ISCSI_VERSION_MIN 0x00
#define ISCSI_VERSION_MAX 0x00
#define ISCSI_VERSION_MIN 0x00
#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
#define ISCSI_REDIRECT_ADDR_START_DELIMITER '['
#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']'
#define ISCSI_REDIRECT_ADDR_START_DELIMITER '['
#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']'
#define ISCSI_KEY_AUTH_METHOD "AuthMethod"
#define ISCSI_KEY_HEADER_DIGEST "HeaderDigest"
@@ -63,32 +63,32 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define ISCSI_KEY_SESSION_TYPE "SessionType"
#define ISCSI_KEY_MAX_RECV_DATA_SEGMENT_LENGTH "MaxRecvDataSegmentLength"
#define ISCSI_KEY_VALUE_NONE "None"
#define ISCSI_KEY_VALUE_NONE "None"
///
/// connection state for initiator
///
#define CONN_STATE_FREE 0
#define CONN_STATE_XPT_WAIT 1
#define CONN_STATE_IN_LOGIN 2
#define CONN_STATE_LOGGED_IN 3
#define CONN_STATE_IN_LOGOUT 4
#define CONN_STATE_LOGOUT_REQUESTED 5
#define CONN_STATE_CLEANUP_WAIT 6
#define CONN_STATE_IN_CLEANUP 7
#define CONN_STATE_FREE 0
#define CONN_STATE_XPT_WAIT 1
#define CONN_STATE_IN_LOGIN 2
#define CONN_STATE_LOGGED_IN 3
#define CONN_STATE_IN_LOGOUT 4
#define CONN_STATE_LOGOUT_REQUESTED 5
#define CONN_STATE_CLEANUP_WAIT 6
#define CONN_STATE_IN_CLEANUP 7
///
/// session state for initiator
///
#define SESSION_STATE_FREE 0
#define SESSION_STATE_LOGGED_IN 1
#define SESSION_STATE_FAILED 2
#define SESSION_STATE_FREE 0
#define SESSION_STATE_LOGGED_IN 1
#define SESSION_STATE_FAILED 2
#define ISCSI_RESERVED_TAG 0xffffffff
#define ISCSI_RESERVED_TAG 0xffffffff
#define ISCSI_REQ_IMMEDIATE 0x40
#define ISCSI_OPCODE_MASK 0x3F
#define ISCSI_REQ_IMMEDIATE 0x40
#define ISCSI_OPCODE_MASK 0x3F
#define ISCSI_SET_OPCODE(PduHdr, Op, Flgs) ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) = ((Op) | (Flgs)))
#define ISCSI_GET_OPCODE(PduHdr) ((((ISCSI_BASIC_HEADER *) (PduHdr))->OpCode) & ISCSI_OPCODE_MASK)
@@ -101,8 +101,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define ISCSI_GET_CURRENT_STAGE(PduHdr) ((UINT8) (((PduHdr)->Flags >> 2) & 0x3))
#define ISCSI_GET_NEXT_STAGE(PduHdr) ((UINT8) (((PduHdr)->Flags) & 0x3))
#define ISCSI_GET_PAD_LEN(DataLen) ((~(DataLen) + 1) & 0x3)
#define ISCSI_ROUNDUP(DataLen) (((DataLen) + 3) &~(0x3))
#define ISCSI_GET_PAD_LEN(DataLen) ((~(DataLen) + 1) & 0x3)
#define ISCSI_ROUNDUP(DataLen) (((DataLen) + 3) &~(0x3))
#define HTON24(Dst, Src) \
do { \
@@ -111,7 +111,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
(Dst)[2] = (UINT8) ((UINT8) (Src) & 0xFF); \
} while (0);
#define NTOH24(src) (((src)[0] << 16) | ((src)[1] << 8) | ((src)[2]))
#define NTOH24(src) (((src)[0] << 16) | ((src)[1] << 8) | ((src)[2]))
#define ISCSI_GET_DATASEG_LEN(PduHdr) NTOH24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength)
#define ISCSI_SET_DATASEG_LEN(PduHdr, Len) HTON24 (((ISCSI_BASIC_HEADER *) (PduHdr))->DataSegmentLength, (Len))
@@ -135,30 +135,30 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Target opcodes.
//
#define ISCSI_OPCODE_NOP_IN 0x20
#define ISCSI_OPCODE_SCSI_RSP 0x21
#define ISCSI_OPCODE_SCSI_TMF_RSP 0x22
#define ISCSI_OPCODE_LOGIN_RSP 0x23
#define ISCSI_OPCODE_TEXT_RSP 0x24
#define ISCSI_OPCODE_SCSI_DATA_IN 0x25
#define ISCSI_OPCODE_LOGOUT_RSP 0x26
#define ISCSI_OPCODE_R2T 0x31
#define ISCSI_OPCODE_ASYNC_MSG 0x32
#define ISCSI_OPCODE_VENDOR_T0 0x3c
#define ISCSI_OPCODE_VENDOR_T1 0x3d
#define ISCSI_OPCODE_VENDOR_T2 0x3e
#define ISCSI_OPCODE_REJECT 0x3f
#define ISCSI_OPCODE_NOP_IN 0x20
#define ISCSI_OPCODE_SCSI_RSP 0x21
#define ISCSI_OPCODE_SCSI_TMF_RSP 0x22
#define ISCSI_OPCODE_LOGIN_RSP 0x23
#define ISCSI_OPCODE_TEXT_RSP 0x24
#define ISCSI_OPCODE_SCSI_DATA_IN 0x25
#define ISCSI_OPCODE_LOGOUT_RSP 0x26
#define ISCSI_OPCODE_R2T 0x31
#define ISCSI_OPCODE_ASYNC_MSG 0x32
#define ISCSI_OPCODE_VENDOR_T0 0x3c
#define ISCSI_OPCODE_VENDOR_T1 0x3d
#define ISCSI_OPCODE_VENDOR_T2 0x3e
#define ISCSI_OPCODE_REJECT 0x3f
#define ISCSI_BHS_FLAG_FINAL 0x80
#define ISCSI_BHS_FLAG_FINAL 0x80
//
// Defined AHS types, others are reserved.
//
#define ISCSI_AHS_TYPE_EXT_CDB 0x1
#define ISCSI_AHS_TYPE_BI_EXP_READ_DATA_LEN 0x2
#define ISCSI_AHS_TYPE_EXT_CDB 0x1
#define ISCSI_AHS_TYPE_BI_EXP_READ_DATA_LEN 0x2
#define SCSI_CMD_PDU_FLAG_READ 0x40
#define SCSI_CMD_PDU_FLAG_WRITE 0x20
#define SCSI_CMD_PDU_FLAG_READ 0x40
#define SCSI_CMD_PDU_FLAG_WRITE 0x20
#define ISCSI_CMD_PDU_TASK_ATTR_MASK 0x07
@@ -174,10 +174,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Flag bit definitions in SCSI response.
//
#define SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW 0x10
#define SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW 0x08
#define SCSI_RSP_PDU_FLAG_OVERFLOW 0x04
#define SCSI_RSP_PDU_FLAG_UNDERFLOW 0x02
#define SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW 0x10
#define SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW 0x08
#define SCSI_RSP_PDU_FLAG_OVERFLOW 0x04
#define SCSI_RSP_PDU_FLAG_UNDERFLOW 0x02
//
// iSCSI service response codes.
@@ -185,25 +185,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define ISCSI_SERVICE_RSP_COMMAND_COMPLETE_AT_TARGET 0x00
#define ISCSI_SERVICE_RSP_TARGET_FAILURE 0x01
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_COMPLETE 0
#define ISCSI_TMF_RSP_PDU_RSP_TASK_NOT_EXIST 1
#define ISCSI_TMF_RSP_PDU_RSP_LUN_NOT_EXIST 2
#define ISCSI_TMF_RSP_PDU_RSP_TASK_STILL_ALLEGIANT 3
#define ISCSI_TMF_RSP_PDU_RSP_TASK_REASSGIN_NOT_SUPPORTED 4
#define ISCSI_TMF_RSP_PDU_RSP_NOT_SUPPORTED 5
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_AHTH_FAILED 6
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_REJECTED 255
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_COMPLETE 0
#define ISCSI_TMF_RSP_PDU_RSP_TASK_NOT_EXIST 1
#define ISCSI_TMF_RSP_PDU_RSP_LUN_NOT_EXIST 2
#define ISCSI_TMF_RSP_PDU_RSP_TASK_STILL_ALLEGIANT 3
#define ISCSI_TMF_RSP_PDU_RSP_TASK_REASSGIN_NOT_SUPPORTED 4
#define ISCSI_TMF_RSP_PDU_RSP_NOT_SUPPORTED 5
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_AHTH_FAILED 6
#define ISCSI_TMF_RSP_PDU_RSP_FUNCTION_REJECTED 255
#define SCSI_DATA_IN_PDU_FLAG_ACKKNOWLEDGE 0x40
#define SCSI_DATA_IN_PDU_FLAG_OVERFLOW SCSI_RSP_PDU_FLAG_OVERFLOW
#define SCSI_DATA_IN_PDU_FLAG_UNDERFLOW SCSI_RSP_PDU_FLAG_UNDERFLOW
#define SCSI_DATA_IN_PDU_FLAG_STATUS_VALID 0x01
#define ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT 0x80
#define ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE 0x40
#define ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT 0x80
#define ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE 0x40
#define ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT
#define ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE
#define ISCSI_LOGIN_RSP_PDU_FLAG_TRANSIT ISCSI_LOGIN_REQ_PDU_FLAG_TRANSIT
#define ISCSI_LOGIN_RSP_PDU_FLAG_CONTINUE ISCSI_LOGIN_REQ_PDU_FLAG_CONTINUE
#define ISCSI_LOGIN_STATUS_SUCCESS 0
#define ISCSI_LOGIN_STATUS_REDIRECTION 1
@@ -224,12 +224,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define ISCSI_SNACK_REQUEST_TYPE_DATA_ACK 2
#define ISCSI_SNACK_REQUEST_TYPE_RDATA 3
#define ISCSI_SECURITY_NEGOTIATION 0
#define ISCSI_LOGIN_OPERATIONAL_NEGOTIATION 1
#define ISCSI_FULL_FEATURE_PHASE 3
#define ISCSI_SECURITY_NEGOTIATION 0
#define ISCSI_LOGIN_OPERATIONAL_NEGOTIATION 1
#define ISCSI_FULL_FEATURE_PHASE 3
typedef struct _ISCSI_SESSION ISCSI_SESSION;
typedef struct _ISCSI_CONNECTION ISCSI_CONNECTION;
typedef struct _ISCSI_SESSION ISCSI_SESSION;
typedef struct _ISCSI_CONNECTION ISCSI_CONNECTION;
typedef enum {
DataIn = 0,
@@ -241,340 +241,340 @@ typedef enum {
/// iSCSI Basic Header Segment
///
typedef struct _ISCSI_BASIC_HEADER {
UINT8 OpCode;
UINT8 Flags;
UINT16 OpCodeSpecific1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 OpCodeSpecific2[7];
UINT8 OpCode;
UINT8 Flags;
UINT16 OpCodeSpecific1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 OpCodeSpecific2[7];
} ISCSI_BASIC_HEADER;
typedef struct _ISCSI_ADDTIONAL_HEADER {
UINT16 Length;
UINT8 Type;
UINT8 TypeSpecific[1];
UINT16 Length;
UINT8 Type;
UINT8 TypeSpecific[1];
} ISCSI_ADDITIONAL_HEADER;
typedef struct _ISCSI_BI_EXP_READ_DATA_LEN_AHS {
UINT16 Length;
UINT8 Type;
UINT8 Reserved;
UINT32 ExpReadDataLength;
UINT16 Length;
UINT8 Type;
UINT8 Reserved;
UINT32 ExpReadDataLength;
} ISCSI_BI_EXP_READ_DATA_LEN_AHS;
///
/// SCSI Command
///
typedef struct _SCSI_COMMAND {
UINT8 OpCode;
UINT8 Flags;
UINT16 Reserved;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 ExpDataXferLength;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT8 Cdb[16];
UINT8 OpCode;
UINT8 Flags;
UINT16 Reserved;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 ExpDataXferLength;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT8 Cdb[16];
} SCSI_COMMAND;
///
/// SCSI Response
///
typedef struct _SCSI_RESPONSE {
UINT8 OpCode;
UINT8 Flags;
UINT8 Response;
UINT8 Status;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Reserved[8];
UINT32 InitiatorTaskTag;
UINT32 SNACKTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 ExpDataSN;
UINT32 BiReadResidualCount;
UINT32 ResidualCount;
UINT8 OpCode;
UINT8 Flags;
UINT8 Response;
UINT8 Status;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Reserved[8];
UINT32 InitiatorTaskTag;
UINT32 SNACKTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 ExpDataSN;
UINT32 BiReadResidualCount;
UINT32 ResidualCount;
} SCSI_RESPONSE;
typedef struct _ISCSI_SENSE_DATA {
UINT16 Length;
UINT8 Data[2];
UINT16 Length;
UINT8 Data[2];
} ISCSI_SENSE_DATA;
///
/// iSCSI Task Management Function Request.
///
typedef struct _ISCSI_TMF_REQUEST {
UINT8 OpCode;
UINT8 Fuction;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 ReferencedTaskTag;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 RefCmdSN;
UINT32 ExpDataSN;
UINT32 Reserved2[2];
UINT8 OpCode;
UINT8 Fuction;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 ReferencedTaskTag;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 RefCmdSN;
UINT32 ExpDataSN;
UINT32 Reserved2[2];
} ISCSI_TMF_REQUEST;
///
/// iSCSI Task Management Function Response.
///
typedef struct _ISCSI_TMF_RESPONSE {
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Response;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserver3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved[3];
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Response;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserver3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved[3];
} ISCSI_TMF_RESPONSE;
///
/// SCSI Data-Out
///
typedef struct _ISCSI_SCSI_DATA_OUT {
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 Reserved2;
UINT32 ExpStatSN;
UINT32 Reserved3;
UINT32 DataSN;
UINT32 BufferOffset;
UINT32 Reserved4;
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 Reserved2;
UINT32 ExpStatSN;
UINT32 Reserved3;
UINT32 DataSN;
UINT32 BufferOffset;
UINT32 Reserved4;
} ISCSI_SCSI_DATA_OUT;
///
/// SCSI Data-In
///
typedef struct _ISCSI_SCSI_DATA_IN {
UINT8 OpCode;
UINT8 Flags;
UINT8 Reserved1;
UINT8 Status;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 DataSN;
UINT32 BufferOffset;
UINT32 ResidualCount;
UINT8 OpCode;
UINT8 Flags;
UINT8 Reserved1;
UINT8 Status;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 DataSN;
UINT32 BufferOffset;
UINT32 ResidualCount;
} ISCSI_SCSI_DATA_IN;
///
/// Ready To Transfer.
///
typedef struct _ISCSI_READY_TO_TRANSFER {
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 R2TSeqNum;
UINT32 BufferOffset;
UINT32 DesiredDataTransferLength;
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 R2TSeqNum;
UINT32 BufferOffset;
UINT32 DesiredDataTransferLength;
} ISCSI_READY_TO_TRANSFER;
typedef struct _ISCSI_ASYNC_MESSAGE {
UINT8 OpCode;
UINT8 Reserved1[8];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 Reserved2;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT8 AsyncEvent;
UINT8 AsyncVCode;
UINT16 Parameter1;
UINT16 Parameter2;
UINT16 Parameter3;
UINT32 Reserved3;
UINT8 OpCode;
UINT8 Reserved1[8];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 Reserved2;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT8 AsyncEvent;
UINT8 AsyncVCode;
UINT16 Parameter1;
UINT16 Parameter2;
UINT16 Parameter3;
UINT32 Reserved3;
} ISCSI_ASYNC_MESSAGE;
///
/// Login Request.
///
typedef struct _ISCSI_LOGIN_REQUEST {
UINT8 OpCode;
UINT8 Flags;
UINT8 VersionMax;
UINT8 VersionMin;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Isid[6];
UINT16 Tsih;
UINT32 InitiatorTaskTag;
UINT16 Cid;
UINT16 Reserved1;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved2[4];
UINT8 OpCode;
UINT8 Flags;
UINT8 VersionMax;
UINT8 VersionMin;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Isid[6];
UINT16 Tsih;
UINT32 InitiatorTaskTag;
UINT16 Cid;
UINT16 Reserved1;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved2[4];
} ISCSI_LOGIN_REQUEST;
///
/// Login Response.
///
typedef struct _ISCSI_LOGIN_RESPONSE {
UINT8 OpCode;
UINT8 Flags;
UINT8 VersionMax;
UINT8 VersionActive;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Isid[6];
UINT16 Tsih;
UINT32 InitiatorTaskTag;
UINT32 Reserved1;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT8 StatusClass;
UINT8 StatusDetail;
UINT8 Reserved2[10];
UINT8 OpCode;
UINT8 Flags;
UINT8 VersionMax;
UINT8 VersionActive;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Isid[6];
UINT16 Tsih;
UINT32 InitiatorTaskTag;
UINT32 Reserved1;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT8 StatusClass;
UINT8 StatusDetail;
UINT8 Reserved2[10];
} ISCSI_LOGIN_RESPONSE;
///
/// Logout Request.
///
typedef struct _ISCSI_LOGOUT_REQUEST {
UINT8 OpCode;
UINT8 ReasonCode;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved2[2];
UINT32 InitiatorTaskTag;
UINT16 Cid;
UINT16 Reserved3;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved4[4];
UINT8 OpCode;
UINT8 ReasonCode;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved2[2];
UINT32 InitiatorTaskTag;
UINT16 Cid;
UINT16 Reserved3;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved4[4];
} ISCSI_LOGOUT_REQUEST;
///
/// Logout Response.
///
typedef struct _ISCSI_LOGOUT_RESPONSE {
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Response;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved5;
UINT16 Time2Wait;
UINT16 Time2Retain;
UINT32 Reserved6;
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Response;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved5;
UINT16 Time2Wait;
UINT16 Time2Retain;
UINT32 Reserved6;
} ISCSI_LOGOUT_RESPONSE;
///
/// SNACK Request.
///
typedef struct _ISCSI_SNACK_REQUEST {
UINT8 OpCode;
UINT8 Type;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 Reserved2;
UINT32 ExpStatSN;
UINT32 Reserved[2];
UINT32 BegRun;
UINT32 RunLength;
UINT8 OpCode;
UINT8 Type;
UINT16 Reserved1;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 Reserved2;
UINT32 ExpStatSN;
UINT32 Reserved[2];
UINT32 BegRun;
UINT32 RunLength;
} ISCSI_SNACK_REQUEST;
///
/// Reject.
///
typedef struct _ISCSI_REJECT {
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Reason;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 DataSN;
UINT32 Reserved5[2];
UINT8 OpCode;
UINT8 Reserved1;
UINT8 Reason;
UINT8 Reserved2;
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT32 Reserved3[2];
UINT32 InitiatorTaskTag;
UINT32 Reserved4;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 DataSN;
UINT32 Reserved5[2];
} ISCSI_REJECT;
///
/// NOP-Out.
///
typedef struct _ISCSI_NOP_OUT {
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved2[4];
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 CmdSN;
UINT32 ExpStatSN;
UINT32 Reserved2[4];
} ISCSI_NOP_OUT;
///
/// NOP-In.
///
typedef struct _ISCSI_NOP_IN {
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved2[3];
UINT8 OpCode;
UINT8 Reserved1[3];
UINT8 TotalAHSLength;
UINT8 DataSegmentLength[3];
UINT8 Lun[8];
UINT32 InitiatorTaskTag;
UINT32 TargetTransferTag;
UINT32 StatSN;
UINT32 ExpCmdSN;
UINT32 MaxCmdSN;
UINT32 Reserved2[3];
} ISCSI_NOP_IN;
typedef enum {
@@ -583,41 +583,41 @@ typedef enum {
} ISCSI_DIGEST_TYPE;
typedef struct _ISCSI_XFER_CONTEXT {
UINT32 TargetTransferTag;
UINT32 Offset;
UINT32 DesiredLength;
UINT32 ExpDataSN;
UINT32 TargetTransferTag;
UINT32 Offset;
UINT32 DesiredLength;
UINT32 ExpDataSN;
} ISCSI_XFER_CONTEXT;
typedef struct _ISCSI_IN_BUFFER_CONTEXT {
UINT8 *InData;
UINT32 InDataLen;
UINT8 *InData;
UINT32 InDataLen;
} ISCSI_IN_BUFFER_CONTEXT;
typedef struct _ISCSI_TCB {
LIST_ENTRY Link;
LIST_ENTRY Link;
BOOLEAN SoFarInOrder;
UINT32 ExpDataSN;
BOOLEAN FbitReceived;
BOOLEAN StatusXferd;
UINT32 ActiveR2Ts;
UINT32 Response;
CHAR8 *Reason;
UINT32 InitiatorTaskTag;
UINT32 CmdSN;
UINT32 SNACKTag;
BOOLEAN SoFarInOrder;
UINT32 ExpDataSN;
BOOLEAN FbitReceived;
BOOLEAN StatusXferd;
UINT32 ActiveR2Ts;
UINT32 Response;
CHAR8 *Reason;
UINT32 InitiatorTaskTag;
UINT32 CmdSN;
UINT32 SNACKTag;
ISCSI_XFER_CONTEXT XferContext;
ISCSI_XFER_CONTEXT XferContext;
ISCSI_CONNECTION *Conn;
ISCSI_CONNECTION *Conn;
} ISCSI_TCB;
typedef struct _ISCSI_KEY_VALUE_PAIR {
LIST_ENTRY List;
LIST_ENTRY List;
CHAR8 *Key;
CHAR8 *Value;
CHAR8 *Key;
CHAR8 *Value;
} ISCSI_KEY_VALUE_PAIR;
/**
@@ -657,8 +657,8 @@ IScsiDetatchConnection (
**/
EFI_STATUS
IScsiConnLogin (
IN OUT ISCSI_CONNECTION *Conn,
IN UINT16 Timeout
IN OUT ISCSI_CONNECTION *Conn,
IN UINT16 Timeout
);
/**
@@ -671,7 +671,7 @@ IScsiConnLogin (
**/
ISCSI_CONNECTION *
IScsiCreateConnection (
IN ISCSI_SESSION *Session
IN ISCSI_SESSION *Session
);
/**
@@ -764,9 +764,9 @@ IScsiReceiveLoginRsp (
**/
EFI_STATUS
IScsiAddKeyValuePair (
IN OUT NET_BUF *Pdu,
IN CHAR8 *Key,
IN CHAR8 *Value
IN OUT NET_BUF *Pdu,
IN CHAR8 *Key,
IN CHAR8 *Value
);
/**
@@ -818,9 +818,9 @@ IScsiProcessLoginRsp (
**/
EFI_STATUS
IScsiUpdateTargetAddress (
IN OUT ISCSI_SESSION *Session,
IN CHAR8 *Data,
IN UINT32 Len
IN OUT ISCSI_SESSION *Session,
IN CHAR8 *Data,
IN UINT32 Len
);
/**
@@ -832,7 +832,7 @@ IScsiUpdateTargetAddress (
VOID
EFIAPI
IScsiFreeNbufList (
VOID *Arg
VOID *Arg
);
/**
@@ -857,12 +857,12 @@ IScsiFreeNbufList (
**/
EFI_STATUS
IScsiReceivePdu (
IN ISCSI_CONNECTION *Conn,
OUT NET_BUF **Pdu,
IN ISCSI_IN_BUFFER_CONTEXT *Context OPTIONAL,
IN BOOLEAN HeaderDigest,
IN BOOLEAN DataDigest,
IN EFI_EVENT TimeoutEvent OPTIONAL
IN ISCSI_CONNECTION *Conn,
OUT NET_BUF **Pdu,
IN ISCSI_IN_BUFFER_CONTEXT *Context OPTIONAL,
IN BOOLEAN HeaderDigest,
IN BOOLEAN DataDigest,
IN EFI_EVENT TimeoutEvent OPTIONAL
);
/**
@@ -905,8 +905,8 @@ IScsiFillOpParams (
**/
EFI_STATUS
IScsiPadSegment (
IN OUT NET_BUF *Pdu,
IN UINT32 Len
IN OUT NET_BUF *Pdu,
IN UINT32 Len
);
/**
@@ -921,8 +921,8 @@ IScsiPadSegment (
**/
LIST_ENTRY *
IScsiBuildKeyValueList (
IN CHAR8 *Data,
IN UINT32 Len
IN CHAR8 *Data,
IN UINT32 Len
);
/**
@@ -938,8 +938,8 @@ IScsiBuildKeyValueList (
**/
CHAR8 *
IScsiGetValueByKeyFromList (
IN OUT LIST_ENTRY *KeyValueList,
IN CHAR8 *Key
IN OUT LIST_ENTRY *KeyValueList,
IN CHAR8 *Key
);
/**
@@ -950,7 +950,7 @@ IScsiGetValueByKeyFromList (
**/
VOID
IScsiFreeKeyValueList (
IN LIST_ENTRY *KeyValueList
IN LIST_ENTRY *KeyValueList
);
/**
@@ -965,8 +965,8 @@ IScsiFreeKeyValueList (
**/
EFI_STATUS
IScsiNormalizeName (
IN OUT CHAR8 *Name,
IN UINTN Len
IN OUT CHAR8 *Name,
IN UINTN Len
);
/**