/** @file\r
Boot functions implementation for UefiPxeBc Driver.\r
\r
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
EFI_STATUS Status;\r
PXEBC_DHCP4_PACKET_CACHE *Cache4;\r
UINT16 Value;\r
-\r
+ PXEBC_VENDOR_OPTION *VendorOpt;\r
+ PXEBC_BOOT_SVR_ENTRY *Entry;\r
+ \r
PxeBc = &Private->PxeBc;\r
Mode = PxeBc->Mode;\r
Status = EFI_SUCCESS;\r
Cache4 = &Private->DhcpAck.Dhcp4;\r
}\r
\r
+ ASSERT (Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL);\r
+\r
//\r
- // Parse the boot server Ipv4 address by next server address.\r
- // If this field isn't available, use option 54 instead.\r
+ // Parse the boot server address.\r
+ // If prompt/discover is disabled, get the first boot server from the boot servers list.\r
+ // Otherwise, parse the boot server Ipv4 address from next server address field in DHCP header.\r
+ // If all these fields are not available, use option 54 instead.\r
//\r
- CopyMem (\r
- &Private->ServerIp,\r
- &Cache4->Packet.Offer.Dhcp4.Header.ServerAddr,\r
- sizeof (EFI_IPv4_ADDRESS)\r
- );\r
-\r
+ VendorOpt = &Cache4->VendorOpt;\r
+ if (IS_DISABLE_PROMPT_MENU (VendorOpt->DiscoverCtrl) && IS_VALID_BOOT_SERVERS (VendorOpt->BitMap)) {\r
+ Entry = VendorOpt->BootSvr;\r
+ if (VendorOpt->BootSvrLen >= sizeof (PXEBC_BOOT_SVR_ENTRY) && Entry->IpCnt > 0) {\r
+ CopyMem (\r
+ &Private->ServerIp,\r
+ &Entry->IpAddr[0],\r
+ sizeof (EFI_IPv4_ADDRESS)\r
+ );\r
+ }\r
+ }\r
+ if (Private->ServerIp.Addr[0] == 0) {\r
+ //\r
+ // ServerIp.Addr[0] equals zero means we failed to get IP address from boot server list.\r
+ // Try to use next server address field.\r
+ //\r
+ CopyMem (\r
+ &Private->ServerIp,\r
+ &Cache4->Packet.Offer.Dhcp4.Header.ServerAddr,\r
+ sizeof (EFI_IPv4_ADDRESS)\r
+ );\r
+ }\r
if (Private->ServerIp.Addr[0] == 0) {\r
+ //\r
+ // Still failed , use the IP address from option 54.\r
+ //\r
CopyMem (\r
&Private->ServerIp,\r
Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_SERVER_ID]->Data,\r
//\r
// Parse the boot file name by option.\r
//\r
- ASSERT (Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL);\r
Private->BootFileName = Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data;\r
\r
if (Cache4->OptList[PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN] != NULL) {\r