Clean codes per ECC.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5384 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2008-06-30 07:20:33 +00:00
parent 4611e327f4
commit 7bce0c5a0e
19 changed files with 843 additions and 157 deletions

View File

@@ -24,6 +24,16 @@ Abstract:
IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
/**
Callback function when DHCP process finished. It will save the
retrieved IP configure parameter from DHCP to the NVRam.
@param Event The callback event
@param Context Opaque context to the callback
@return None
**/
VOID
EFIAPI
Ip4ConfigOnDhcp4Complete (
@@ -44,7 +54,6 @@ Ip4ConfigOnDhcp4Complete (
@retval EFI_SUCCESS The name or address of the NIC are returned.
**/
STATIC
EFI_STATUS
EFIAPI
EfiNicIp4ConfigGetName (
@@ -733,7 +742,7 @@ Ip4ConfigCleanDhcp4 (
/**
Clean up all the configuration parameters
Clean up all the configuration parameters.
@param Instance The IP4 configure instance

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
Copyright (c) 2006 - 2008, Intel Corporation
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
@@ -42,18 +42,20 @@ Abstract:
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
enum {
typedef enum {
IP4_CONFIG_STATE_IDLE = 0,
IP4_CONFIG_STATE_STARTED,
IP4_CONFIG_STATE_CONFIGURED,
IP4_CONFIG_STATE_CONFIGURED
} IP4_CONFIG_STATE;
IP4_PROTO_ICMP = 0x01,
IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
#define IP4_PROTO_ICMP 0x01
#define IP4_CONFIG_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('I', 'P', '4', 'C')
typedef enum {
DHCP_TAG_PARA_LIST = 55,
DHCP_TAG_NETMASK = 1,
DHCP_TAG_ROUTER = 3
};
} DHCP_TAGS;
//
// Configure the DHCP to request the routers and netmask
@@ -121,11 +123,27 @@ extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIAB
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
/**
Release all the DHCP related resources.
@param This The IP4 configure instance
@return None
**/
VOID
Ip4ConfigCleanDhcp4 (
IN IP4_CONFIG_INSTANCE *This
);
/**
Clean up all the configuration parameters.
@param Instance The IP4 configure instance
@return None
**/
VOID
Ip4ConfigCleanConfig (
IN IP4_CONFIG_INSTANCE *Instance

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2006, Intel Corporation
Copyright (c) 2006 - 2008, Intel Corporation
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
@@ -60,30 +60,22 @@ EfiIp4ConfigUnload (
return NetLibDefaultUnload (ImageHandle);
}
/**
The entry point for IP4 config driver which install the driver
binding and component name protocol on its image.
@param ImageHandle The image handle of the driver.
@param SystemTable The system table.
@retval EFI_SUCCES All the related protocols are installed on the driver.
@retval Others Failed to install protocols.
**/
EFI_STATUS
Ip4ConfigDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
The entry point for IP4 config driver which install the driver
binding and component name protocol on its image.
Arguments:
ImageHandle - The Image handle of the driver
SystemTable - The system table
Returns:
EFI_SUCCESS - All the related protocols are installed on the driver
Others - Failed to install the protocol
--*/
{
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,

View File

@@ -91,7 +91,7 @@ Ip4ConfigIsValid (
/**
Read the ip4 configure variable from the EFI variable
Read the ip4 configure variable from the EFI variable.
None
@@ -186,7 +186,7 @@ ON_ERROR:
**/
EFI_STATUS
Ip4ConfigWriteVariable (
IN IP4_CONFIG_VARIABLE * Config OPTIONAL
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
)
{
EFI_STATUS Status;

View File

@@ -45,27 +45,81 @@ Abstract:
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
/**
Check whether the configure parameter is valid.
@param NicConfig The configure parameter to check
@return TRUE if the parameter is valid for the interface, otherwise FALSE.
**/
BOOLEAN
Ip4ConfigIsValid (
IN NIC_IP4_CONFIG_INFO *NicConfig
);
/**
Read the ip4 configure variable from the EFI variable.
None
@return The IP4 configure read if it is there and is valid, otherwise NULL
**/
IP4_CONFIG_VARIABLE *
Ip4ConfigReadVariable (
VOID
);
/**
Write the IP4 configure variable to the NVRAM. If Config
is NULL, remove the variable.
@param Config The IP4 configure data to write
@retval EFI_SUCCESS The variable is written to the NVRam
@retval Others Failed to write the variable.
**/
EFI_STATUS
Ip4ConfigWriteVariable (
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
);
/**
Locate the IP4 configure parameters from the variable.If a
configuration is found, copy it to a newly allocated block
of memory to avoid the alignment problem. Caller should
release the memory after use.
@param Variable The IP4 configure variable to search in
@param NicAddr The interface address to check
@return The point to the NIC's IP4 configure info if it is found
@return in the IP4 variable, otherwise NULL.
**/
NIC_IP4_CONFIG_INFO *
Ip4ConfigFindNicVariable (
IN IP4_CONFIG_VARIABLE *Variable,
IN NIC_ADDR *NicAddr
);
/**
Modify the configuration parameter for the NIC in the variable.
If Config is NULL, old configuration will be remove from the new
variable. Otherwise, append it or replace the old one.
@param Variable The IP4 variable to change
@param NicAddr The interface to search
@param Config The new configuration parameter (NULL to remove the old)
@return The new IP4_CONFIG_VARIABLE variable if the new variable has at
@return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
@return Return NULL either because failed to locate memory for new variable
@return or the only NIC configure is removed from the Variable.
**/
IP4_CONFIG_VARIABLE *
Ip4ConfigModifyVariable (
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL