code scrub for UefiPxeBcDxe.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7452 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Support for PxeBc dhcp functions.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation.<BR>
|
||||
All rights reserved. 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
|
||||
@@ -9,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PxeBcDhcp.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Support for PxeBc dhcp functions
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
@@ -38,12 +30,14 @@ UINT8 mInterestedDhcp4Tags[PXEBC_DHCP4_TAG_INDEX_MAX] = {
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
This function initialize the DHCP4 message instance.
|
||||
|
||||
@param Seed GC_NOTO: add argument description
|
||||
@param Udp4 GC_NOTO: add argument description
|
||||
This function will pad each item of dhcp4 message packet.
|
||||
|
||||
@param Seed Pointer to the message instance of the DHCP4 packet.
|
||||
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return none.
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -74,12 +68,12 @@ PxeBcInitSeedPacket (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Copy the DCHP4 packet from srouce to destination.
|
||||
|
||||
@param Dst GC_NOTO: add argument description
|
||||
@param Src GC_NOTO: add argument description
|
||||
@param Dst Pointer to the EFI_DHCP4_PROTOCOL instance.
|
||||
@param Src Pointer to the EFI_DHCP4_PROTOCOL instance.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -96,12 +90,13 @@ PxeBcCopyEfiDhcp4Packet (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Copy the dhcp4 packet to the PxeBc private data and parse the dhcp4 packet.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param OfferIndex GC_NOTO: add argument description
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param OfferIndex Index of cached packets as complements of pxe mode data,
|
||||
the index is maximum offer number.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -129,10 +124,10 @@ PxeBcCopyProxyOffer (
|
||||
/**
|
||||
Parse the cached dhcp packet.
|
||||
|
||||
@param CachedPacket Pointer to cached dhcp packet
|
||||
@param CachedPacket Pointer to cached dhcp packet.
|
||||
|
||||
@return TRUE : Success to parse and validation
|
||||
@return FALSE : Fail to parse or validation
|
||||
@retval TRUE Succeed to parse and validation.
|
||||
@retval FALSE Fail to parse or validation.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -256,13 +251,16 @@ PxeBcParseCachedDhcpPacket (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Offer dhcp service with a BINL dhcp offer.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param Index GC_NOTO: add argument description
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param Index Index of cached packets as complements of pxe mode data,
|
||||
the index is maximum offer number.
|
||||
|
||||
@retval TRUE Offer the service successfully under priority BINL.
|
||||
@retval FALSE Boot Service failed, parse cached dhcp packet failed or this
|
||||
BINL ack cannot find options set or bootfile name specified.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
PxeBcTryBinl (
|
||||
@@ -334,12 +332,13 @@ PxeBcTryBinl (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Offer dhcp service for each proxy with a BINL dhcp offer.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param OfferIndex GC_NOTO: add argument description
|
||||
@param Private Pointer to PxeBc private data
|
||||
@param OfferIndex Pointer to the index of cached packets as complements of
|
||||
pxe mode data, the index is maximum offer number.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return If there is no service needed offer return FALSE, otherwise TRUE.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -366,11 +365,14 @@ PxeBcTryBinlProxy (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
This function is to check the selected proxy offer (include BINL dhcp offer and
|
||||
DHCP_ONLY offer ) and set the flag and copy the DHCP packets to the Pxe base code
|
||||
mode structure.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param Private Pointer to PxeBc private data.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@retval EFI_SUCCESS Operational successful.
|
||||
@retval EFI_NO_RESPONSE Offer dhcp service failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -518,12 +520,12 @@ PxeBcCheckSelectedOffer (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Cache the Dhcp4 packet offer, Parse and validate each option of the packet.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param RcvdOffer GC_NOTO: add argument description
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param RcvdOffer Pointer to the received Dhcp proxy offer packet.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -608,11 +610,12 @@ PxeBcCacheDhcpOffer (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Select the specified proxy offer, such as BINL, DHCP_ONLY and so on.
|
||||
If the proxy does not exist, try offers with bootfile.
|
||||
|
||||
@param Private Pointer to PxeBc private data.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -728,17 +731,32 @@ PxeBcSelectOffer (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Callback routine.
|
||||
|
||||
EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
|
||||
to intercept events that occurred in the configuration process. This structure
|
||||
provides advanced control of each state transition of the DHCP process. The
|
||||
returned status code determines the behavior of the EFI DHCPv4 Protocol driver.
|
||||
There are three possible returned values, which are described in the following
|
||||
table.
|
||||
|
||||
@param This GC_NOTO: add argument description
|
||||
@param Context GC_NOTO: add argument description
|
||||
@param CurrentState GC_NOTO: add argument description
|
||||
@param Dhcp4Event GC_NOTO: add argument description
|
||||
@param Packet GC_NOTO: add argument description
|
||||
@param NewPacket GC_NOTO: add argument description
|
||||
@param This Pointer to the EFI DHCPv4 Protocol instance that is used to
|
||||
configure this callback function.
|
||||
@param Context Pointer to the context that is initialized by
|
||||
EFI_DHCP4_PROTOCOL.Configure().
|
||||
@param CurrentState The current operational state of the EFI DHCPv4 Protocol
|
||||
driver.
|
||||
@param Dhcp4Event The event that occurs in the current state, which usually means a
|
||||
state transition.
|
||||
@param Packet The DHCP packet that is going to be sent or already received.
|
||||
@param NewPacket The packet that is used to replace the above Packet.
|
||||
|
||||
@retval EFI_SUCCESS GC_NOTO: Add description for return value
|
||||
@retval EFI_ABORTED GC_NOTO: Add description for return value
|
||||
@retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
|
||||
@retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
|
||||
driver will continue to wait for more DHCPOFFER packets until the retry
|
||||
timeout expires.
|
||||
@retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
|
||||
return to the Dhcp4Init or Dhcp4InitReboot state.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -878,13 +896,14 @@ PxeBcDhcpCallBack (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Initialize the DHCP options and build the option list.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param OptList GC_NOTO: add argument description
|
||||
@param IsDhcpDiscover GC_NOTO: add argument description
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param OptList Pointer to a DHCP option list.
|
||||
|
||||
@param IsDhcpDiscover Discover dhcp option or not.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return The index item number of the option list.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
@@ -1029,20 +1048,23 @@ PxeBcBuildDhcpOptions (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Discover the boot of service and initialize the vendor option if exists.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param Type GC_NOTO: add argument description
|
||||
@param Layer GC_NOTO: add argument description
|
||||
@param UseBis GC_NOTO: add argument description
|
||||
@param DestIp GC_NOTO: add argument description
|
||||
@param IpCount GC_NOTO: add argument description
|
||||
@param SrvList GC_NOTO: add argument description
|
||||
@param IsDiscv GC_NOTO: add argument description
|
||||
@param Reply GC_NOTO: add argument description
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES GC_NOTO: Add description for return value
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param Type PxeBc option boot item type
|
||||
@param Layer PxeBc option boot item layer
|
||||
@param UseBis Use BIS or not
|
||||
@param DestIp Ip address for server
|
||||
@param IpCount The total count of the server ip address
|
||||
@param SrvList Server list
|
||||
@param IsDiscv Discover the vendor or not
|
||||
@param Reply The dhcp4 packet of Pxe reply
|
||||
|
||||
@retval EFI_SUCCESS Operation succeeds.
|
||||
@retval EFI_OUT_OF_RESOURCES Allocate memory pool failed.
|
||||
@retval EFI_NOT_FOUND There is no vendor option exists.
|
||||
@retval EFI_TIMEOUT Send Pxe Discover time out.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PxeBcDiscvBootService (
|
||||
@@ -1242,13 +1264,14 @@ PxeBcDiscvBootService (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Parse interested dhcp options.
|
||||
|
||||
@param Buffer GC_NOTO: add argument description
|
||||
@param Length GC_NOTO: add argument description
|
||||
@param OptTag GC_NOTO: add argument description
|
||||
@param Buffer Pointer to the dhcp options packet.
|
||||
@param Length The length of the dhcp options.
|
||||
@param OptTag The option OpCode.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return NULL if the buffer length is 0 and OpCode is not
|
||||
PXEBC_DHCP4_TAG_EOP, or the pointer to the buffer.
|
||||
|
||||
**/
|
||||
EFI_DHCP4_PACKET_OPTION *
|
||||
@@ -1290,8 +1313,7 @@ PxeBcParseExtendOptions (
|
||||
@param Dhcp4Option Pointer to dhcp options
|
||||
@param VendorOption Pointer to vendor options
|
||||
|
||||
@return TRUE : Valid vendor options
|
||||
@return FALSE : Invalid vendor options
|
||||
@return TRUE if valid for vendor options, or FALSE.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@@ -1409,12 +1431,14 @@ PxeBcParseVendorOptions (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
This function display boot item detail.
|
||||
|
||||
@param Str GC_NOTO: add argument description
|
||||
@param Len GC_NOTO: add argument description
|
||||
If the length of the boot item string over 70 Char, just display 70 Char.
|
||||
|
||||
@param Str Pointer to a string (boot item string).
|
||||
@param Len The length of string.
|
||||
|
||||
@return GC_NOTO: add return values
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
@@ -1434,13 +1458,16 @@ PxeBcDisplayBootItem (
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Choose the boot prompt.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
|
||||
@retval EFI_SUCCESS GC_NOTO: Add description for return value
|
||||
@retval EFI_TIMEOUT GC_NOTO: Add description for return value
|
||||
@param Private Pointer to PxeBc private data.
|
||||
|
||||
@retval EFI_SUCCESS Select boot prompt done.
|
||||
@retval EFI_TIMEOUT Select boot prompt time out.
|
||||
@retval EFI_NOT_FOUND The proxy offer is not Pxe10.
|
||||
@retval EFI_ABORTED User cancel the operation.
|
||||
@retval EFI_NOT_READY Read the input key from the keybroad has not finish.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PxeBcSelectBootPrompt (
|
||||
@@ -1609,13 +1636,15 @@ ON_EXIT:
|
||||
|
||||
|
||||
/**
|
||||
GC_NOTO: Add function description
|
||||
Select the boot menu.
|
||||
|
||||
@param Private GC_NOTO: add argument description
|
||||
@param Type GC_NOTO: add argument description
|
||||
|
||||
@retval EFI_ABORTED GC_NOTO: Add description for return value
|
||||
@retval EFI_SUCCESS GC_NOTO: Add description for return value
|
||||
@param Private Pointer to PxeBc private data.
|
||||
@param Type The type of the menu.
|
||||
@param UseDefaultItem Use default item or not.
|
||||
|
||||
@retval EFI_ABORTED User cancel operation.
|
||||
@retval EFI_SUCCESS Select the boot menu success.
|
||||
@retval EFI_NOT_READY Read the input key from the keybroad has not finish.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -1734,7 +1763,7 @@ PxeBcSelectBootMenu (
|
||||
switch (InputKey.ScanCode) {
|
||||
case SCAN_LEFT:
|
||||
case SCAN_UP:
|
||||
if (Select) {
|
||||
if (Select > 0) {
|
||||
--Select;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user