mirror of https://github.com/acidanthera/audk.git
code scrub for Ip4ConfigDxe
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7149 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
373ade0eb6
commit
c8d8f1e332
|
@ -1,5 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
This file defines NicIp4Config Protocol.
|
This file defines NicIp4Config Protocol.
|
||||||
|
EFI_NIC_IP4_CONFIG_PROTOCOL is a proprietary protocol, not defined by UEFI2.0.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
|
@ -54,34 +55,58 @@ typedef enum {
|
||||||
// because it don't know how to configure the default IP address even
|
// because it don't know how to configure the default IP address even
|
||||||
// it has got the address.
|
// it has got the address.
|
||||||
//
|
//
|
||||||
// NIC_ADDR contains the interface's type and MAC address to identify
|
|
||||||
// a specific NIC. NIC_IP4_CONFIG_INFO contains the IP4 configure
|
///
|
||||||
// parameters for that NIC. IP4_CONFIG_VARIABLE is the EFI variable to
|
/// NIC_ADDR contains the interface's type and MAC address to identify
|
||||||
// save the configuration. NIC_IP4_CONFIG_INFO and IP4_CONFIG_VARIABLE
|
/// a specific NIC.
|
||||||
// is of variable length.
|
///
|
||||||
//
|
|
||||||
// EFI_NIC_IP4_CONFIG_PROTOCOL is a priority protocol, not defined by UEFI2.0
|
|
||||||
//
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 Type;
|
UINT16 Type; ///< Interface type
|
||||||
UINT8 Len;
|
UINT8 Len; ///< Length of MAC address
|
||||||
EFI_MAC_ADDRESS MacAddr;
|
EFI_MAC_ADDRESS MacAddr; ///< MAC address of interface
|
||||||
} NIC_ADDR;
|
} NIC_ADDR;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// NIC_IP4_CONFIG_INFO contains the IP4 configure
|
||||||
|
/// parameters for that NIC. NIC_IP4_CONFIG_INFO is
|
||||||
|
/// of variable length.
|
||||||
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NIC_ADDR NicAddr; // Link layer address to identify the NIC
|
NIC_ADDR NicAddr; ///< Link layer address to identify the NIC
|
||||||
UINT32 Source; // Static or DHCP
|
UINT32 Source; ///< Static or DHCP
|
||||||
BOOLEAN Perment; // Survive the reboot or not
|
BOOLEAN Perment; ///< Survive the reboot or not
|
||||||
EFI_IP4_IPCONFIG_DATA Ip4Info; // IP addresses
|
EFI_IP4_IPCONFIG_DATA Ip4Info; ///< IP addresses
|
||||||
} NIC_IP4_CONFIG_INFO;
|
} NIC_IP4_CONFIG_INFO;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// IP4_CONFIG_VARIABLE is the EFI variable to
|
||||||
|
/// save the configuration. IP4_CONFIG_VARIABLE is
|
||||||
|
/// of variable length.
|
||||||
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Len; // Total length of the variable
|
UINT32 Len; ///< Total length of the variable
|
||||||
UINT16 CheckSum; // CheckSum, the same as IP4 head checksum
|
UINT16 CheckSum; ///< CheckSum, the same as IP4 head checksum
|
||||||
UINT32 Count; // Number of NIC_IP4_CONFIG_INFO follows
|
UINT32 Count; ///< Number of NIC_IP4_CONFIG_INFO follows
|
||||||
NIC_IP4_CONFIG_INFO ConfigInfo;
|
NIC_IP4_CONFIG_INFO ConfigInfo;
|
||||||
} IP4_CONFIG_VARIABLE;
|
} IP4_CONFIG_VARIABLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the configure parameter for this NIC.
|
||||||
|
|
||||||
|
@param This The NIC IP4 CONFIG protocol.
|
||||||
|
@param Len The length of the NicConfig buffer.
|
||||||
|
@param NicConfig The buffer to receive the NIC's configure
|
||||||
|
parameter.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||||
|
obtained successfully .
|
||||||
|
@retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
|
||||||
|
@retval EFI_NOT_FOUND There is no configure parameter for the NIC in
|
||||||
|
NVRam.
|
||||||
|
@retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
|
||||||
|
NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_INFO)(
|
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_INFO)(
|
||||||
|
@ -90,20 +115,55 @@ EFI_STATUS
|
||||||
OUT NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
|
OUT NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the IP configure parameters for this NIC.
|
||||||
|
|
||||||
|
If Reconfig is TRUE, the IP driver will be informed to discard current
|
||||||
|
auto configure parameter and restart the auto configuration process.
|
||||||
|
If current there is a pending auto configuration, EFI_ALREADY_STARTED is
|
||||||
|
returned. You can only change the configure setting when either
|
||||||
|
the configure has finished or not started yet. If NicConfig, the
|
||||||
|
NIC's configure parameter is removed from the variable.
|
||||||
|
|
||||||
|
@param This The NIC IP4 CONFIG protocol
|
||||||
|
@param NicConfig The new NIC IP4 configure parameter
|
||||||
|
@param Reconfig Inform the IP4 driver to restart the auto
|
||||||
|
configuration
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||||
|
set successfully .
|
||||||
|
@retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
|
||||||
|
invalid.
|
||||||
|
@retval EFI_ALREADY_STARTED There is a pending auto configuration.
|
||||||
|
@retval EFI_NOT_FOUND No auto configure parameter is found
|
||||||
|
|
||||||
|
**/
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EFI_NIC_IP4_CONFIG_SET_INFO)(
|
(EFIAPI *EFI_NIC_IP4_CONFIG_SET_INFO)(
|
||||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||||
IN NIC_IP4_CONFIG_INFO *NicConfig, OPTIONAL
|
IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,
|
||||||
IN BOOLEAN ReConfig
|
IN BOOLEAN ReConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the name and MAC address for the NIC. The Name, if not NULL,
|
||||||
|
has at least IP4_NIC_NAME_LENGTH bytes.
|
||||||
|
|
||||||
|
@param This The NIC IP4 CONFIG protocol
|
||||||
|
@param Name The buffer to return the name
|
||||||
|
@param NicAddr The buffer to return the MAC addr
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER This is NULL
|
||||||
|
@retval EFI_SUCCESS The name or address of the NIC are returned.
|
||||||
|
|
||||||
|
**/
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_NAME)(
|
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_NAME)(
|
||||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||||
IN UINT16 *Name, OPTIONAL
|
OUT UINT16 *Name OPTIONAL,
|
||||||
IN NIC_ADDR *NicAddr OPTIONAL
|
OUT NIC_ADDR *NicAddr OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
struct _EFI_NIC_IP4_CONFIG_PROTOCOL {
|
struct _EFI_NIC_IP4_CONFIG_PROTOCOL {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
UEFI Component Name(2) protocol implementation for Ip4ConfigDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation.<BR>
|
Copyright (c) 2006 - 2007, Intel Corporation.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -11,139 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Ip4Config.h"
|
#include "Ip4Config.h"
|
||||||
|
|
||||||
//
|
|
||||||
// EFI Component Name Functions
|
|
||||||
//
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of a driver in the form of a
|
|
||||||
Unicode string. If the driver specified by This has a user readable name in
|
|
||||||
the language specified by Language, then a pointer to the driver name is
|
|
||||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
|
||||||
by This does not support the language specified by Language,
|
|
||||||
then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified
|
|
||||||
in RFC 3066 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param DriverName[out] A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
driver specified by This in the language
|
|
||||||
specified by Language.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
|
||||||
This and the language specified by Language was
|
|
||||||
returned in DriverName.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
Ip4ConfigComponentNameGetDriverName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **DriverName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
|
||||||
that is being managed by a driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of the controller specified by
|
|
||||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
|
||||||
driver specified by This has a user readable name in the language specified by
|
|
||||||
Language, then a pointer to the controller name is returned in ControllerName,
|
|
||||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
|
||||||
managing the controller specified by ControllerHandle and ChildHandle,
|
|
||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param ControllerHandle[in] The handle of a controller that the driver
|
|
||||||
specified by This is managing. This handle
|
|
||||||
specifies the controller whose name is to be
|
|
||||||
returned.
|
|
||||||
|
|
||||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
|
||||||
the name of. This is an optional parameter that
|
|
||||||
may be NULL. It will be NULL for device
|
|
||||||
drivers. It will also be NULL for a bus drivers
|
|
||||||
that wish to retrieve the name of the bus
|
|
||||||
controller. It will not be NULL for a bus
|
|
||||||
driver that wishes to retrieve the name of a
|
|
||||||
child controller.
|
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified in
|
|
||||||
RFC 3066 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
controller specified by ControllerHandle and
|
|
||||||
ChildHandle in the language specified by
|
|
||||||
Language from the point of view of the driver
|
|
||||||
specified by This.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
|
||||||
the language specified by Language for the
|
|
||||||
driver specified by This was returned in
|
|
||||||
DriverName.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
|
||||||
EFI_HANDLE.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
|
||||||
managing the controller specified by
|
|
||||||
ControllerHandle and ChildHandle.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
Ip4ConfigComponentNameGetControllerName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **ControllerName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
|
@ -168,6 +38,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// EFI Component Name Functions
|
||||||
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
|
@ -180,7 +54,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
|
@ -188,8 +61,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable
|
||||||
languages specified in SupportedLanguages. The
|
languages specified in SupportedLanguages. The
|
||||||
number of languages supported by a driver is up
|
number of languages supported by a driver is up
|
||||||
to the driver writer. Language is specified
|
to the driver writer. Language is specified
|
||||||
in RFC 3066 or ISO 639-2 language code format.
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param DriverName[out] A pointer to the Unicode string to return.
|
@param DriverName[out] A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
driver specified by This in the language
|
driver specified by This in the language
|
||||||
|
@ -198,11 +70,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable
|
||||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||||
This and the language specified by Language was
|
This and the language specified by Language was
|
||||||
returned in DriverName.
|
returned in DriverName.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
the language specified by Language.
|
the language specified by Language.
|
||||||
|
|
||||||
|
@ -239,12 +108,10 @@ Ip4ConfigComponentNameGetDriverName (
|
||||||
|
|
||||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
|
||||||
@param ControllerHandle[in] The handle of a controller that the driver
|
@param ControllerHandle[in] The handle of a controller that the driver
|
||||||
specified by This is managing. This handle
|
specified by This is managing. This handle
|
||||||
specifies the controller whose name is to be
|
specifies the controller whose name is to be
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||||
the name of. This is an optional parameter that
|
the name of. This is an optional parameter that
|
||||||
may be NULL. It will be NULL for device
|
may be NULL. It will be NULL for device
|
||||||
|
@ -253,7 +120,6 @@ Ip4ConfigComponentNameGetDriverName (
|
||||||
controller. It will not be NULL for a bus
|
controller. It will not be NULL for a bus
|
||||||
driver that wishes to retrieve the name of a
|
driver that wishes to retrieve the name of a
|
||||||
child controller.
|
child controller.
|
||||||
|
|
||||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
array indicating the language. This is the
|
array indicating the language. This is the
|
||||||
language of the driver name that the caller is
|
language of the driver name that the caller is
|
||||||
|
@ -262,32 +128,25 @@ Ip4ConfigComponentNameGetDriverName (
|
||||||
number of languages supported by a driver is up
|
number of languages supported by a driver is up
|
||||||
to the driver writer. Language is specified in
|
to the driver writer. Language is specified in
|
||||||
RFC 3066 or ISO 639-2 language code format.
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
|
||||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||||
This Unicode string is the name of the
|
This Unicode string is the name of the
|
||||||
controller specified by ControllerHandle and
|
controller specified by ControllerHandle and
|
||||||
ChildHandle in the language specified by
|
ChildHandle in the language specified by
|
||||||
Language from the point of view of the driver
|
Language from the point of view of the driver
|
||||||
specified by This.
|
specified by This.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||||
the language specified by Language for the
|
the language specified by Language for the
|
||||||
driver specified by This was returned in
|
driver specified by This was returned in
|
||||||
DriverName.
|
DriverName.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||||
EFI_HANDLE.
|
EFI_HANDLE.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||||
managing the controller specified by
|
managing the controller specified by
|
||||||
ControllerHandle and ChildHandle.
|
ControllerHandle and ChildHandle.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
the language specified by Language.
|
the language specified by Language.
|
||||||
|
|
||||||
|
|
|
@ -16,24 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
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 (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the name and MAC address for the NIC. The Name, if not NULL,
|
Return the name and MAC address for the NIC. The Name, if not NULL,
|
||||||
has at least IP4_NIC_NAME_LENGTH bytes.
|
has at least IP4_NIC_NAME_LENGTH bytes.
|
||||||
|
@ -49,9 +31,9 @@ Ip4ConfigOnDhcp4Complete (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EfiNicIp4ConfigGetName (
|
EfiNicIp4ConfigGetName (
|
||||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||||
IN UINT16 *Name, OPTIONAL
|
OUT UINT16 *Name OPTIONAL,
|
||||||
IN NIC_ADDR *NicAddr OPTIONAL
|
OUT NIC_ADDR *NicAddr OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IP4_CONFIG_INSTANCE *Instance;
|
IP4_CONFIG_INSTANCE *Instance;
|
||||||
|
@ -75,13 +57,13 @@ EfiNicIp4ConfigGetName (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the NIC's configure information from the IP4 configure variable.
|
Get the NIC's configure information from the IP4 configure variable.
|
||||||
It will remove the invalid variable.
|
It will remove the invalid variable.
|
||||||
|
|
||||||
@param NicAddr The NIC to check
|
@param NicAddr The NIC to check
|
||||||
|
|
||||||
@return NULL if no configure for the NIC in the variable, or it is invalid.
|
@return NULL if no configure for the NIC in the variable, or it is invalid.
|
||||||
@return Otherwise the NIC's IP configure parameter.
|
Otherwise the pointer to the NIC's IP configure parameter will be returned.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
NIC_IP4_CONFIG_INFO *
|
NIC_IP4_CONFIG_INFO *
|
||||||
|
@ -134,14 +116,18 @@ Ip4ConfigGetNicInfo (
|
||||||
/**
|
/**
|
||||||
Get the configure parameter for this NIC.
|
Get the configure parameter for this NIC.
|
||||||
|
|
||||||
@param This The NIC IP4 CONFIG protocol
|
@param This The NIC IP4 CONFIG protocol.
|
||||||
@param ConfigLen The length of the NicConfig buffer.
|
@param ConfigLen The length of the NicConfig buffer.
|
||||||
@param NicConfig The buffer to receive the NIC's configure
|
@param NicConfig The buffer to receive the NIC's configure
|
||||||
parameter.
|
parameter.
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER This or ConfigLen is NULL
|
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||||
|
obtained successfully .
|
||||||
|
@retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
|
||||||
@retval EFI_NOT_FOUND There is no configure parameter for the NIC in
|
@retval EFI_NOT_FOUND There is no configure parameter for the NIC in
|
||||||
NVRam.
|
NVRam.
|
||||||
|
@retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
|
||||||
|
NULL.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -192,10 +178,11 @@ EfiNicIp4ConfigGetInfo (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the IP configure parameters for this NIC. If Reconfig is TRUE,
|
Set the IP configure parameters for this NIC.
|
||||||
the IP driver will be informed to discard current auto configure
|
|
||||||
parameter and restart the auto configuration process. If current
|
If Reconfig is TRUE, the IP driver will be informed to discard current
|
||||||
there is a pending auto configuration, EFI_ALREADY_STARTED is
|
auto configure parameter and restart the auto configuration process.
|
||||||
|
If current there is a pending auto configuration, EFI_ALREADY_STARTED is
|
||||||
returned. You can only change the configure setting when either
|
returned. You can only change the configure setting when either
|
||||||
the configure has finished or not started yet. If NicConfig, the
|
the configure has finished or not started yet. If NicConfig, the
|
||||||
NIC's configure parameter is removed from the variable.
|
NIC's configure parameter is removed from the variable.
|
||||||
|
@ -204,7 +191,9 @@ EfiNicIp4ConfigGetInfo (
|
||||||
@param NicConfig The new NIC IP4 configure parameter
|
@param NicConfig The new NIC IP4 configure parameter
|
||||||
@param Reconfig Inform the IP4 driver to restart the auto
|
@param Reconfig Inform the IP4 driver to restart the auto
|
||||||
configuration
|
configuration
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||||
|
set successfully .
|
||||||
@retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
|
@retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
|
||||||
invalid.
|
invalid.
|
||||||
@retval EFI_ALREADY_STARTED There is a pending auto configuration.
|
@retval EFI_ALREADY_STARTED There is a pending auto configuration.
|
||||||
|
@ -280,6 +269,120 @@ EfiNicIp4ConfigSetInfo (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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 (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IP4_CONFIG_INSTANCE *Instance;
|
||||||
|
EFI_DHCP4_MODE_DATA Dhcp4Mode;
|
||||||
|
EFI_IP4_IPCONFIG_DATA *Ip4Config;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
BOOLEAN Perment;
|
||||||
|
IP4_ADDR Subnet;
|
||||||
|
IP4_ADDR Ip1;
|
||||||
|
IP4_ADDR Ip2;
|
||||||
|
|
||||||
|
Instance = (IP4_CONFIG_INSTANCE *) Context;
|
||||||
|
ASSERT (Instance->Dhcp4 != NULL);
|
||||||
|
|
||||||
|
Instance->State = IP4_CONFIG_STATE_CONFIGURED;
|
||||||
|
Instance->Result = EFI_TIMEOUT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the DHCP retrieved parameters
|
||||||
|
//
|
||||||
|
Status = Instance->Dhcp4->GetModeData (Instance->Dhcp4, &Dhcp4Mode);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Dhcp4Mode.State == Dhcp4Bound) {
|
||||||
|
//
|
||||||
|
// Save the new configuration retrieved by DHCP both in
|
||||||
|
// the instance and to NVRam. So, both the IP4 driver and
|
||||||
|
// other user can get that address.
|
||||||
|
//
|
||||||
|
Perment = FALSE;
|
||||||
|
|
||||||
|
if (Instance->NicConfig != NULL) {
|
||||||
|
ASSERT (Instance->NicConfig->Source == IP4_CONFIG_SOURCE_DHCP);
|
||||||
|
Perment = Instance->NicConfig->Perment;
|
||||||
|
gBS->FreePool (Instance->NicConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance->NicConfig = AllocatePool (sizeof (NIC_IP4_CONFIG_INFO) + 2* sizeof (EFI_IP4_ROUTE_TABLE));
|
||||||
|
|
||||||
|
if (Instance->NicConfig == NULL) {
|
||||||
|
Instance->Result = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto ON_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance->NicConfig->Ip4Info.RouteTable = (EFI_IP4_ROUTE_TABLE *) (Instance->NicConfig + 1);
|
||||||
|
|
||||||
|
CopyMem (&Instance->NicConfig->NicAddr, &Instance->NicAddr, sizeof (Instance->NicConfig->NicAddr));
|
||||||
|
Instance->NicConfig->Source = IP4_CONFIG_SOURCE_DHCP;
|
||||||
|
Instance->NicConfig->Perment = Perment;
|
||||||
|
|
||||||
|
Ip4Config = &Instance->NicConfig->Ip4Info;
|
||||||
|
Ip4Config->StationAddress = Dhcp4Mode.ClientAddress;
|
||||||
|
Ip4Config->SubnetMask = Dhcp4Mode.SubnetMask;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a route for the connected network
|
||||||
|
//
|
||||||
|
Ip4Config->RouteTableSize = 1;
|
||||||
|
|
||||||
|
CopyMem (&Ip1, &Dhcp4Mode.ClientAddress, sizeof (IP4_ADDR));
|
||||||
|
CopyMem (&Ip2, &Dhcp4Mode.SubnetMask, sizeof (IP4_ADDR));
|
||||||
|
|
||||||
|
Subnet = Ip1 & Ip2;
|
||||||
|
|
||||||
|
CopyMem (&Ip4Config->RouteTable[0].SubnetAddress, &Subnet, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
CopyMem (&Ip4Config->RouteTable[0].SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
ZeroMem (&Ip4Config->RouteTable[0].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a route if there is a default router.
|
||||||
|
//
|
||||||
|
if (!EFI_IP4_EQUAL (&Dhcp4Mode.RouterAddress, &mZeroIp4Addr)) {
|
||||||
|
Ip4Config->RouteTableSize = 2;
|
||||||
|
|
||||||
|
ZeroMem (&Ip4Config->RouteTable[1].SubnetAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
ZeroMem (&Ip4Config->RouteTable[1].SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
CopyMem (&Ip4Config->RouteTable[1].GatewayAddress, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance->Result = EFI_SUCCESS;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ignore the return status of EfiNicIp4ConfigSetInfo. Network
|
||||||
|
// stack can operate even that failed.
|
||||||
|
//
|
||||||
|
EfiNicIp4ConfigSetInfo (&Instance->NicIp4Protocol, Instance->NicConfig, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ON_EXIT:
|
||||||
|
gBS->SignalEvent (Instance->DoneEvent);
|
||||||
|
Ip4ConfigCleanDhcp4 (Instance);
|
||||||
|
|
||||||
|
NetLibDispatchDpc ();
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts running the configuration policy for the EFI IPv4 Protocol driver.
|
Starts running the configuration policy for the EFI IPv4 Protocol driver.
|
||||||
|
@ -557,8 +660,9 @@ ON_EXIT:
|
||||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||||
@retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
|
@retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
|
||||||
driver is not running.
|
driver is not running.
|
||||||
@retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running.
|
@retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running.
|
||||||
@retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete.
|
@retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete.
|
||||||
|
Currently not implemented.
|
||||||
@retval EFI_BUFFER_TOO_SMALL *ConfigDataSize is smaller than the configuration
|
@retval EFI_BUFFER_TOO_SMALL *ConfigDataSize is smaller than the configuration
|
||||||
data buffer or ConfigData is NULL.
|
data buffer or ConfigData is NULL.
|
||||||
|
|
||||||
|
@ -623,123 +727,6 @@ ON_EXIT:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
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 (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IP4_CONFIG_INSTANCE *Instance;
|
|
||||||
EFI_DHCP4_MODE_DATA Dhcp4Mode;
|
|
||||||
EFI_IP4_IPCONFIG_DATA *Ip4Config;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
BOOLEAN Perment;
|
|
||||||
IP4_ADDR Subnet;
|
|
||||||
IP4_ADDR Ip1;
|
|
||||||
IP4_ADDR Ip2;
|
|
||||||
|
|
||||||
Instance = (IP4_CONFIG_INSTANCE *) Context;
|
|
||||||
ASSERT (Instance->Dhcp4 != NULL);
|
|
||||||
|
|
||||||
Instance->State = IP4_CONFIG_STATE_CONFIGURED;
|
|
||||||
Instance->Result = EFI_TIMEOUT;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get the DHCP retrieved parameters
|
|
||||||
//
|
|
||||||
Status = Instance->Dhcp4->GetModeData (Instance->Dhcp4, &Dhcp4Mode);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Dhcp4Mode.State == Dhcp4Bound) {
|
|
||||||
//
|
|
||||||
// Save the new configuration retrieved by DHCP both in
|
|
||||||
// the instance and to NVRam. So, both the IP4 driver and
|
|
||||||
// other user can get that address.
|
|
||||||
//
|
|
||||||
Perment = FALSE;
|
|
||||||
|
|
||||||
if (Instance->NicConfig != NULL) {
|
|
||||||
ASSERT (Instance->NicConfig->Source == IP4_CONFIG_SOURCE_DHCP);
|
|
||||||
Perment = Instance->NicConfig->Perment;
|
|
||||||
gBS->FreePool (Instance->NicConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance->NicConfig = AllocatePool (sizeof (NIC_IP4_CONFIG_INFO) + 2* sizeof (EFI_IP4_ROUTE_TABLE));
|
|
||||||
|
|
||||||
if (Instance->NicConfig == NULL) {
|
|
||||||
Instance->Result = EFI_OUT_OF_RESOURCES;
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance->NicConfig->Ip4Info.RouteTable = (EFI_IP4_ROUTE_TABLE *) (Instance->NicConfig + 1);
|
|
||||||
|
|
||||||
CopyMem (&Instance->NicConfig->NicAddr, &Instance->NicAddr, sizeof (Instance->NicConfig->NicAddr));
|
|
||||||
Instance->NicConfig->Source = IP4_CONFIG_SOURCE_DHCP;
|
|
||||||
Instance->NicConfig->Perment = Perment;
|
|
||||||
|
|
||||||
Ip4Config = &Instance->NicConfig->Ip4Info;
|
|
||||||
Ip4Config->StationAddress = Dhcp4Mode.ClientAddress;
|
|
||||||
Ip4Config->SubnetMask = Dhcp4Mode.SubnetMask;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create a route for the connected network
|
|
||||||
//
|
|
||||||
Ip4Config->RouteTableSize = 1;
|
|
||||||
|
|
||||||
CopyMem (&Ip1, &Dhcp4Mode.ClientAddress, sizeof (IP4_ADDR));
|
|
||||||
CopyMem (&Ip2, &Dhcp4Mode.SubnetMask, sizeof (IP4_ADDR));
|
|
||||||
|
|
||||||
Subnet = Ip1 & Ip2;
|
|
||||||
|
|
||||||
CopyMem (&Ip4Config->RouteTable[0].SubnetAddress, &Subnet, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
CopyMem (&Ip4Config->RouteTable[0].SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
ZeroMem (&Ip4Config->RouteTable[0].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create a route if there is a default router.
|
|
||||||
//
|
|
||||||
if (!EFI_IP4_EQUAL (&Dhcp4Mode.RouterAddress, &mZeroIp4Addr)) {
|
|
||||||
Ip4Config->RouteTableSize = 2;
|
|
||||||
|
|
||||||
ZeroMem (&Ip4Config->RouteTable[1].SubnetAddress, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
ZeroMem (&Ip4Config->RouteTable[1].SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
CopyMem (&Ip4Config->RouteTable[1].GatewayAddress, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance->Result = EFI_SUCCESS;
|
|
||||||
|
|
||||||
//
|
|
||||||
// ignore the return status of EfiNicIp4ConfigSetInfo. Network
|
|
||||||
// stack can operate even that failed.
|
|
||||||
//
|
|
||||||
EfiNicIp4ConfigSetInfo (&Instance->NicIp4Protocol, Instance->NicConfig, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ON_EXIT:
|
|
||||||
gBS->SignalEvent (Instance->DoneEvent);
|
|
||||||
Ip4ConfigCleanDhcp4 (Instance);
|
|
||||||
|
|
||||||
NetLibDispatchDpc ();
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release all the DHCP related resources.
|
Release all the DHCP related resources.
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#ifndef _EFI_IP4CONFIG_H_
|
#ifndef _EFI_IP4CONFIG_H_
|
||||||
#define _EFI_IP4CONFIG_H_
|
#define _EFI_IP4CONFIG_H_
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Protocol/Dhcp4.h>
|
#include <Protocol/Dhcp4.h>
|
||||||
#include <Protocol/Ip4Config.h>
|
#include <Protocol/Ip4Config.h>
|
||||||
|
@ -34,15 +34,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
|
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Global variables
|
||||||
|
//
|
||||||
|
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
|
||||||
|
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
|
||||||
|
extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
|
||||||
|
|
||||||
|
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
||||||
|
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
|
||||||
|
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
|
||||||
|
|
||||||
|
#define IP4_PROTO_ICMP 0x01
|
||||||
|
#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IP4_CONFIG_STATE_IDLE = 0,
|
IP4_CONFIG_STATE_IDLE = 0,
|
||||||
IP4_CONFIG_STATE_STARTED,
|
IP4_CONFIG_STATE_STARTED,
|
||||||
IP4_CONFIG_STATE_CONFIGURED
|
IP4_CONFIG_STATE_CONFIGURED
|
||||||
} IP4_CONFIG_STATE;
|
} IP4_CONFIG_STATE;
|
||||||
|
|
||||||
#define IP4_PROTO_ICMP 0x01
|
|
||||||
#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DHCP_TAG_PARA_LIST = 55,
|
DHCP_TAG_PARA_LIST = 55,
|
||||||
DHCP_TAG_NETMASK = 1,
|
DHCP_TAG_NETMASK = 1,
|
||||||
|
@ -108,13 +119,6 @@ struct _IP4_CONFIG_INSTANCE {
|
||||||
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
|
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
|
||||||
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||||
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
|
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
|
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
|
|
||||||
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
|
||||||
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
|
|
||||||
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release all the DHCP related resources.
|
Release all the DHCP related resources.
|
||||||
|
|
||||||
|
@ -125,7 +129,7 @@ extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Ip4ConfigCleanDhcp4 (
|
Ip4ConfigCleanDhcp4 (
|
||||||
IN IP4_CONFIG_INSTANCE *This
|
IN IP4_CONFIG_INSTANCE *This
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,4 +144,183 @@ VOID
|
||||||
Ip4ConfigCleanConfig (
|
Ip4ConfigCleanConfig (
|
||||||
IN IP4_CONFIG_INSTANCE *Instance
|
IN IP4_CONFIG_INSTANCE *Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// EFI Component Name Functions
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of a driver in the form of a
|
||||||
|
Unicode string. If the driver specified by This has a user readable name in
|
||||||
|
the language specified by Language, then a pointer to the driver name is
|
||||||
|
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||||
|
by This does not support the language specified by Language,
|
||||||
|
then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name that the caller is
|
||||||
|
requesting, and it must match one of the
|
||||||
|
languages specified in SupportedLanguages. The
|
||||||
|
number of languages supported by a driver is up
|
||||||
|
to the driver writer. Language is specified
|
||||||
|
in RFC 3066 or ISO 639-2 language code format.
|
||||||
|
@param DriverName[out] A pointer to the Unicode string to return.
|
||||||
|
This Unicode string is the name of the
|
||||||
|
driver specified by This in the language
|
||||||
|
specified by Language.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||||
|
This and the language specified by Language was
|
||||||
|
returned in DriverName.
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ip4ConfigComponentNameGetDriverName (
|
||||||
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||||
|
IN CHAR8 *Language,
|
||||||
|
OUT CHAR16 **DriverName
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
|
that is being managed by a driver.
|
||||||
|
|
||||||
|
This function retrieves the user readable name of the controller specified by
|
||||||
|
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||||
|
driver specified by This has a user readable name in the language specified by
|
||||||
|
Language, then a pointer to the controller name is returned in ControllerName,
|
||||||
|
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||||
|
managing the controller specified by ControllerHandle and ChildHandle,
|
||||||
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||||
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||||
|
|
||||||
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||||
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||||
|
@param ControllerHandle[in] The handle of a controller that the driver
|
||||||
|
specified by This is managing. This handle
|
||||||
|
specifies the controller whose name is to be
|
||||||
|
returned.
|
||||||
|
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||||
|
the name of. This is an optional parameter that
|
||||||
|
may be NULL. It will be NULL for device
|
||||||
|
drivers. It will also be NULL for a bus drivers
|
||||||
|
that wish to retrieve the name of the bus
|
||||||
|
controller. It will not be NULL for a bus
|
||||||
|
driver that wishes to retrieve the name of a
|
||||||
|
child controller.
|
||||||
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||||
|
array indicating the language. This is the
|
||||||
|
language of the driver name that the caller is
|
||||||
|
requesting, and it must match one of the
|
||||||
|
languages specified in SupportedLanguages. The
|
||||||
|
number of languages supported by a driver is up
|
||||||
|
to the driver writer. Language is specified in
|
||||||
|
RFC 3066 or ISO 639-2 language code format.
|
||||||
|
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||||
|
This Unicode string is the name of the
|
||||||
|
controller specified by ControllerHandle and
|
||||||
|
ChildHandle in the language specified by
|
||||||
|
Language from the point of view of the driver
|
||||||
|
specified by This.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||||
|
the language specified by Language for the
|
||||||
|
driver specified by This was returned in
|
||||||
|
DriverName.
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||||
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||||
|
EFI_HANDLE.
|
||||||
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||||
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||||
|
managing the controller specified by
|
||||||
|
ControllerHandle and ChildHandle.
|
||||||
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||||
|
the language specified by Language.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ip4ConfigComponentNameGetControllerName (
|
||||||
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||||
|
IN CHAR8 *Language,
|
||||||
|
OUT CHAR16 **ControllerName
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Test to see if this driver supports ControllerHandle.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to test
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCES This driver supports this device
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ip4ConfigDriverBindingSupported (
|
||||||
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Start this driver on ControllerHandle.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to bind driver to
|
||||||
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
|
device to start.
|
||||||
|
|
||||||
|
@retval EFI_SUCCES This driver is added to ControllerHandle
|
||||||
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
||||||
|
@retval other This driver does not support this device
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ip4ConfigDriverBindingStart (
|
||||||
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Stop this driver on ControllerHandle.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ControllerHandle Handle of device to stop driver on
|
||||||
|
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
||||||
|
children is zero stop the entire bus driver.
|
||||||
|
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||||
|
|
||||||
|
@retval EFI_SUCCES This driver is removed ControllerHandle
|
||||||
|
@retval other This driver was not removed from this device
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ip4ConfigDriverBindingStop (
|
||||||
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN UINTN NumberOfChildren,
|
||||||
|
IN EFI_HANDLE *ChildHandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include "Ip4Config.h"
|
#include "Ip4Config.h"
|
||||||
|
|
||||||
|
EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding = {
|
||||||
|
Ip4ConfigDriverBindingSupported,
|
||||||
|
Ip4ConfigDriverBindingStart,
|
||||||
|
Ip4ConfigDriverBindingStop,
|
||||||
|
0xa,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop all the auto configuration when the IP4 configure driver is
|
Stop all the auto configuration when the IP4 configure driver is
|
||||||
|
@ -500,11 +508,3 @@ Ip4ConfigDriverBindingStop (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding = {
|
|
||||||
Ip4ConfigDriverBindingSupported,
|
|
||||||
Ip4ConfigDriverBindingStart,
|
|
||||||
Ip4ConfigDriverBindingStop,
|
|
||||||
0xa,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
|
@ -12,15 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
#include <Library/NetLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
|
||||||
|
|
||||||
#include "NicIp4Variable.h"
|
#include "NicIp4Variable.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,7 +197,7 @@ Ip4ConfigWriteVariable (
|
||||||
@param NicAddr The interface address to check
|
@param NicAddr The interface address to check
|
||||||
|
|
||||||
@return The point to the NIC's IP4 configure info if it is found
|
@return The point to the NIC's IP4 configure info if it is found
|
||||||
@return in the IP4 variable, otherwise NULL.
|
in the IP4 variable, otherwise NULL.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
NIC_IP4_CONFIG_INFO *
|
NIC_IP4_CONFIG_INFO *
|
||||||
|
@ -263,9 +254,9 @@ Ip4ConfigFindNicVariable (
|
||||||
@param Config The new configuration parameter (NULL to remove the old)
|
@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 The new IP4_CONFIG_VARIABLE variable if the new variable has at
|
||||||
@return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
|
least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
|
||||||
@return Return NULL either because failed to locate memory for new variable
|
Return NULL either because failed to locate memory for new variable
|
||||||
@return or the only NIC configure is removed from the Variable.
|
or the only NIC configure is removed from the Variable.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
IP4_CONFIG_VARIABLE *
|
IP4_CONFIG_VARIABLE *
|
||||||
|
@ -387,7 +378,7 @@ Ip4ConfigModifyVariable (
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Ip4ConfigFixRouteTablePointer (
|
Ip4ConfigFixRouteTablePointer (
|
||||||
IN EFI_IP4_IPCONFIG_DATA *ConfigData
|
IN OUT EFI_IP4_IPCONFIG_DATA *ConfigData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,9 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#ifndef _NIC_IP4_VARIABLE_H_
|
#ifndef _NIC_IP4_VARIABLE_H_
|
||||||
#define _NIC_IP4_VARIABLE_H_
|
#define _NIC_IP4_VARIABLE_H_
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
|
||||||
|
#include <Library/NetLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
|
|
||||||
#include <Protocol/NicIp4Config.h>
|
#include <Protocol/NicIp4Config.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
||||||
// They are of variable size
|
// They are of variable size
|
||||||
|
@ -75,7 +84,7 @@ Ip4ConfigReadVariable (
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
Ip4ConfigWriteVariable (
|
Ip4ConfigWriteVariable (
|
||||||
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
|
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,9 +116,9 @@ Ip4ConfigFindNicVariable (
|
||||||
@param Config The new configuration parameter (NULL to remove the old)
|
@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 The new IP4_CONFIG_VARIABLE variable if the new variable has at
|
||||||
@return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
|
least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
|
||||||
@return Return NULL either because failed to locate memory for new variable
|
Return NULL either because failed to locate memory for new variable
|
||||||
@return or the only NIC configure is removed from the Variable.
|
or the only NIC configure is removed from the Variable.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
IP4_CONFIG_VARIABLE *
|
IP4_CONFIG_VARIABLE *
|
||||||
|
@ -130,7 +139,7 @@ Ip4ConfigModifyVariable (
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Ip4ConfigFixRouteTablePointer (
|
Ip4ConfigFixRouteTablePointer (
|
||||||
IN EFI_IP4_IPCONFIG_DATA *ConfigData
|
IN OUT EFI_IP4_IPCONFIG_DATA *ConfigData
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue