+/**\r
+ Check wheather the Controller is configured to use DHCP protocol.\r
+\r
+ @param[in] Controller The handle of the controller.\r
+ \r
+ @retval TRUE The handle of the controller need the Dhcp protocol.\r
+ @retval FALSE The handle of the controller does not need the Dhcp protocol.\r
+ \r
+**/\r
+BOOLEAN\r
+IScsiDhcpIsConfigured (\r
+ IN EFI_HANDLE Controller\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_MAC_ADDRESS MacAddress;\r
+ UINTN HwAddressSize;\r
+ UINT16 VlanId;\r
+ CHAR16 MacString[70];\r
+ ISCSI_SESSION_CONFIG_NVDATA *ConfigDataTmp;\r
+\r
+ //\r
+ // Get the mac string, it's the name of various variable\r
+ //\r
+ Status = NetLibGetMacAddress (Controller, &MacAddress, &HwAddressSize);\r
+ if (EFI_ERROR (Status)) {\r
+ return FALSE;\r
+ }\r
+ VlanId = NetLibGetVlanId (Controller);\r
+ IScsiMacAddrToStr (&MacAddress, (UINT32) HwAddressSize, VlanId, MacString);\r
+\r
+ //\r
+ // Get the normal configuration.\r
+ //\r
+ Status = GetVariable2 (\r
+ MacString,\r
+ &gEfiIScsiInitiatorNameProtocolGuid,\r
+ (VOID**)&ConfigDataTmp,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return FALSE;\r
+ }\r
+ \r
+\r
+ if (ConfigDataTmp->Enabled && ConfigDataTmp->InitiatorInfoFromDhcp) {\r
+ FreePool (ConfigDataTmp);\r
+ return TRUE;\r
+ }\r
+\r
+ FreePool (ConfigDataTmp);\r
+ return FALSE;\r
+}\r
+\r