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@14802 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Miscellaneous routines for iSCSI driver.
|
||||
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
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
|
||||
@@ -616,6 +616,60 @@ IScsiCleanDriverData (
|
||||
FreePool (Private);
|
||||
}
|
||||
|
||||
/**
|
||||
Check wheather the Controller is configured to use DHCP protocol.
|
||||
|
||||
@param[in] Controller The handle of the controller.
|
||||
|
||||
@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
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_MAC_ADDRESS MacAddress;
|
||||
UINTN HwAddressSize;
|
||||
UINT16 VlanId;
|
||||
CHAR16 MacString[70];
|
||||
ISCSI_SESSION_CONFIG_NVDATA *ConfigDataTmp;
|
||||
|
||||
//
|
||||
// Get the mac string, it's the name of various variable
|
||||
//
|
||||
Status = NetLibGetMacAddress (Controller, &MacAddress, &HwAddressSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
VlanId = NetLibGetVlanId (Controller);
|
||||
IScsiMacAddrToStr (&MacAddress, (UINT32) HwAddressSize, VlanId, MacString);
|
||||
|
||||
//
|
||||
// Get the normal configuration.
|
||||
//
|
||||
Status = GetVariable2 (
|
||||
MacString,
|
||||
&gEfiIScsiInitiatorNameProtocolGuid,
|
||||
(VOID**)&ConfigDataTmp,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ConfigDataTmp->Enabled && ConfigDataTmp->InitiatorInfoFromDhcp) {
|
||||
FreePool (ConfigDataTmp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FreePool (ConfigDataTmp);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the various configuration data of this iSCSI instance.
|
||||
|
||||
|
Reference in New Issue
Block a user