mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 21:54:27 +02:00
Fix a bug about the iSCSI DHCP dependency issue.
Create rules to determine whether iSCSI need DHCP protocol in current configuration by examining user’s configuration data in DriverBindingSupported(). Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com > Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14803 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
05a300115a
commit
b7cc5bf180
@ -112,13 +112,16 @@ IScsiSupported (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_GUID *IScsiServiceBindingGuid;
|
EFI_GUID *IScsiServiceBindingGuid;
|
||||||
EFI_GUID *TcpServiceBindingGuid;
|
EFI_GUID *TcpServiceBindingGuid;
|
||||||
|
EFI_GUID *DhcpServiceBindingGuid;
|
||||||
|
|
||||||
if (IpVersion == IP_VERSION_4) {
|
if (IpVersion == IP_VERSION_4) {
|
||||||
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
|
IScsiServiceBindingGuid = &gIScsiV4PrivateGuid;
|
||||||
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
||||||
|
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
|
||||||
} else {
|
} else {
|
||||||
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
|
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
|
||||||
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
||||||
|
DhcpServiceBindingGuid = &gEfiDhcp6ServiceBindingProtocolGuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
@ -131,24 +134,40 @@ IScsiSupported (
|
|||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
ControllerHandle,
|
||||||
|
TcpServiceBindingGuid,
|
||||||
|
NULL,
|
||||||
|
This->DriverBindingHandle,
|
||||||
|
ControllerHandle,
|
||||||
|
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = IScsiIsDevicePathSupported (RemainingDevicePath);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IScsiDhcpIsConfigured (ControllerHandle, IpVersion)) {
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
TcpServiceBindingGuid,
|
DhcpServiceBindingGuid,
|
||||||
NULL,
|
NULL,
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Status = IScsiIsDevicePathSupported (RemainingDevicePath);
|
return EFI_UNSUPPORTED;
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous routines for iSCSI driver.
|
Miscellaneous routines for iSCSI driver.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -890,6 +890,99 @@ IScsiCleanDriverData (
|
|||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check wheather the Controller handle is configured to use DHCP protocol.
|
||||||
|
|
||||||
|
@param[in] Controller The handle of the controller.
|
||||||
|
@param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
|
||||||
|
|
||||||
|
@retval TRUE The handle of the controller need the Dhcp protocol.
|
||||||
|
@retval FALSE The handle of the controller does not need the Dhcp protocol.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IScsiDhcpIsConfigured (
|
||||||
|
IN EFI_HANDLE Controller,
|
||||||
|
IN UINT8 IpVersion
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ISCSI_ATTEMPT_CONFIG_NVDATA *AttemptTmp;
|
||||||
|
UINT8 *AttemptConfigOrder;
|
||||||
|
UINTN AttemptConfigOrderSize;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_MAC_ADDRESS MacAddr;
|
||||||
|
UINTN HwAddressSize;
|
||||||
|
UINT16 VlanId;
|
||||||
|
CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
|
||||||
|
CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE];
|
||||||
|
|
||||||
|
AttemptConfigOrder = IScsiGetVariableAndSize (
|
||||||
|
L"AttemptOrder",
|
||||||
|
&gIScsiConfigGuid,
|
||||||
|
&AttemptConfigOrderSize
|
||||||
|
);
|
||||||
|
if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get MAC address of this network device.
|
||||||
|
//
|
||||||
|
Status = NetLibGetMacAddress (Controller, &MacAddr, &HwAddressSize);
|
||||||
|
if(EFI_ERROR (Status)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Get VLAN ID of this network device.
|
||||||
|
//
|
||||||
|
VlanId = NetLibGetVlanId (Controller);
|
||||||
|
IScsiMacAddrToStr (&MacAddr, (UINT32) HwAddressSize, VlanId, MacString);
|
||||||
|
|
||||||
|
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
|
||||||
|
UnicodeSPrint (
|
||||||
|
AttemptName,
|
||||||
|
(UINTN) 128,
|
||||||
|
L"%s%d",
|
||||||
|
MacString,
|
||||||
|
(UINTN) AttemptConfigOrder[Index]
|
||||||
|
);
|
||||||
|
Status = GetVariable2 (
|
||||||
|
AttemptName,
|
||||||
|
&gEfiIScsiInitiatorNameProtocolGuid,
|
||||||
|
(VOID**)&AttemptTmp,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if(EFI_ERROR (Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);
|
||||||
|
|
||||||
|
if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {
|
||||||
|
FreePool (AttemptTmp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG &&
|
||||||
|
AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)) {
|
||||||
|
FreePool (AttemptTmp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG ||
|
||||||
|
AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp == TRUE ||
|
||||||
|
AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE) {
|
||||||
|
FreePool (AttemptTmp);
|
||||||
|
FreePool (AttemptConfigOrder);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (AttemptTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (AttemptConfigOrder);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the various configuration data.
|
Get the various configuration data.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous definitions for iSCSI driver.
|
Miscellaneous definitions for iSCSI driver.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -298,6 +298,22 @@ IScsiCleanDriverData (
|
|||||||
IN ISCSI_DRIVER_DATA *Private
|
IN ISCSI_DRIVER_DATA *Private
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check wheather the Controller handle is configured to use DHCP protocol.
|
||||||
|
|
||||||
|
@param[in] Controller The handle of the controller.
|
||||||
|
@param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
|
||||||
|
|
||||||
|
@retval TRUE The handle of the controller need the Dhcp protocol.
|
||||||
|
@retval FALSE The handle of the controller does not need the Dhcp protocol.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IScsiDhcpIsConfigured (
|
||||||
|
IN EFI_HANDLE Controller,
|
||||||
|
IN UINT8 IpVersion
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the various configuration data of this iSCSI instance.
|
Get the various configuration data of this iSCSI instance.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user