Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4006 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -24,6 +24,45 @@ Abstract:
|
||||
//
|
||||
// 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 (
|
||||
@@ -32,6 +71,75 @@ Ip4ConfigComponentNameGetDriverName (
|
||||
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 (
|
||||
@@ -42,21 +150,71 @@ Ip4ConfigComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
|
||||
EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
|
||||
Ip4ConfigComponentNameGetDriverName,
|
||||
Ip4ConfigComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ConfigComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ConfigComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable[] = {
|
||||
{"eng", L"IP4 CONFIG Network Service Driver"},
|
||||
{"eng;en", L"IP4 CONFIG Network Service Driver"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/**
|
||||
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 (
|
||||
@@ -64,94 +222,93 @@ Ip4ConfigComponentNameGetDriverName (
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that 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.
|
||||
DriverName - 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.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCES - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
gIp4ConfigComponentName.SupportedLanguages,
|
||||
This->SupportedLanguages,
|
||||
mIp4ConfigDriverNameTable,
|
||||
DriverName
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gIp4ConfigComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
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
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - 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.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that 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.
|
||||
ControllerName - 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.
|
||||
|
||||
Returns:
|
||||
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.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2007, 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
|
||||
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:
|
||||
|
||||
Ip4Config.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for IP4Config driver.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __EFI_IP4CONFIG_H__
|
||||
#define __EFI_IP4CONFIG_H__
|
||||
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006 - 2007, 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
|
||||
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:
|
||||
|
||||
Ip4Config.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for IP4Config driver.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __EFI_IP4CONFIG_H__
|
||||
#define __EFI_IP4CONFIG_H__
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/Dhcp4.h>
|
||||
@@ -36,97 +36,98 @@ Abstract:
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/NetLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include "NicIp4Variable.h"
|
||||
|
||||
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
|
||||
|
||||
enum {
|
||||
IP4_CONFIG_STATE_IDLE = 0,
|
||||
IP4_CONFIG_STATE_STARTED,
|
||||
IP4_CONFIG_STATE_CONFIGURED,
|
||||
|
||||
IP4_PROTO_ICMP = 0x01,
|
||||
IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
|
||||
|
||||
DHCP_TAG_PARA_LIST = 55,
|
||||
DHCP_TAG_NETMASK = 1,
|
||||
DHCP_TAG_ROUTER = 3
|
||||
};
|
||||
|
||||
//
|
||||
// Configure the DHCP to request the routers and netmask
|
||||
// from server. The DHCP_TAG_NETMASK is included in Head.
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
EFI_DHCP4_PACKET_OPTION Head;
|
||||
UINT8 Route;
|
||||
} IP4_CONFIG_DHCP4_OPTION;
|
||||
#pragma pack()
|
||||
|
||||
struct _IP4_CONFIG_INSTANCE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_HANDLE Image;
|
||||
|
||||
EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
|
||||
|
||||
//
|
||||
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
|
||||
//
|
||||
INTN State;
|
||||
|
||||
//
|
||||
// Mnp child to keep the connection with MNP.
|
||||
//
|
||||
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
|
||||
EFI_HANDLE MnpHandle;
|
||||
|
||||
//
|
||||
// User's requests data
|
||||
//
|
||||
EFI_EVENT DoneEvent;
|
||||
EFI_EVENT ReconfigEvent;
|
||||
EFI_STATUS Result;
|
||||
|
||||
//
|
||||
// Identity of this interface and some configuration info.
|
||||
//
|
||||
NIC_ADDR NicAddr;
|
||||
UINT16 NicName[IP4_NIC_NAME_LENGTH];
|
||||
UINT32 NicIndex;
|
||||
NIC_IP4_CONFIG_INFO *NicConfig;
|
||||
|
||||
//
|
||||
// DHCP handles to access DHCP
|
||||
//
|
||||
EFI_DHCP4_PROTOCOL *Dhcp4;
|
||||
EFI_HANDLE Dhcp4Handle;
|
||||
EFI_EVENT Dhcp4Event;
|
||||
};
|
||||
|
||||
#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
|
||||
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
|
||||
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
||||
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
|
||||
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
|
||||
|
||||
VOID
|
||||
Ip4ConfigCleanDhcp4 (
|
||||
IN IP4_CONFIG_INSTANCE *This
|
||||
);
|
||||
|
||||
VOID
|
||||
Ip4ConfigCleanConfig (
|
||||
IN IP4_CONFIG_INSTANCE *Instance
|
||||
);
|
||||
#endif
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include "NicIp4Variable.h"
|
||||
|
||||
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
|
||||
|
||||
enum {
|
||||
IP4_CONFIG_STATE_IDLE = 0,
|
||||
IP4_CONFIG_STATE_STARTED,
|
||||
IP4_CONFIG_STATE_CONFIGURED,
|
||||
|
||||
IP4_PROTO_ICMP = 0x01,
|
||||
IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
|
||||
|
||||
DHCP_TAG_PARA_LIST = 55,
|
||||
DHCP_TAG_NETMASK = 1,
|
||||
DHCP_TAG_ROUTER = 3
|
||||
};
|
||||
|
||||
//
|
||||
// Configure the DHCP to request the routers and netmask
|
||||
// from server. The DHCP_TAG_NETMASK is included in Head.
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
EFI_DHCP4_PACKET_OPTION Head;
|
||||
UINT8 Route;
|
||||
} IP4_CONFIG_DHCP4_OPTION;
|
||||
#pragma pack()
|
||||
|
||||
struct _IP4_CONFIG_INSTANCE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_HANDLE Image;
|
||||
|
||||
EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
|
||||
|
||||
//
|
||||
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
|
||||
//
|
||||
INTN State;
|
||||
|
||||
//
|
||||
// Mnp child to keep the connection with MNP.
|
||||
//
|
||||
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
|
||||
EFI_HANDLE MnpHandle;
|
||||
|
||||
//
|
||||
// User's requests data
|
||||
//
|
||||
EFI_EVENT DoneEvent;
|
||||
EFI_EVENT ReconfigEvent;
|
||||
EFI_STATUS Result;
|
||||
|
||||
//
|
||||
// Identity of this interface and some configuration info.
|
||||
//
|
||||
NIC_ADDR NicAddr;
|
||||
UINT16 NicName[IP4_NIC_NAME_LENGTH];
|
||||
UINT32 NicIndex;
|
||||
NIC_IP4_CONFIG_INFO *NicConfig;
|
||||
|
||||
//
|
||||
// DHCP handles to access DHCP
|
||||
//
|
||||
EFI_DHCP4_PROTOCOL *Dhcp4;
|
||||
EFI_HANDLE Dhcp4Handle;
|
||||
EFI_EVENT Dhcp4Event;
|
||||
};
|
||||
|
||||
#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
|
||||
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
|
||||
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;
|
||||
|
||||
VOID
|
||||
Ip4ConfigCleanDhcp4 (
|
||||
IN IP4_CONFIG_INSTANCE *This
|
||||
);
|
||||
|
||||
VOID
|
||||
Ip4ConfigCleanConfig (
|
||||
IN IP4_CONFIG_INSTANCE *Instance
|
||||
);
|
||||
#endif
|
||||
|
@@ -85,14 +85,13 @@ Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
return EfiLibInstallAllDriverProtocols (
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gIp4ConfigDriverBinding,
|
||||
ImageHandle,
|
||||
&gIp4ConfigComponentName,
|
||||
NULL,
|
||||
NULL
|
||||
&gIp4ConfigComponentName2
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,75 +1,75 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006, 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
|
||||
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:
|
||||
|
||||
NicIp4Variable.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Routines used to operate the Ip4 configure variable
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _NIC_IP4_VARIABLE_H_
|
||||
#define _NIC_IP4_VARIABLE_H_
|
||||
|
||||
|
||||
#include <Protocol/NicIp4Config.h>
|
||||
|
||||
//
|
||||
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
||||
// They are of variable size
|
||||
//
|
||||
#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
|
||||
(sizeof (EFI_IP4_IPCONFIG_DATA) + \
|
||||
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
|
||||
|
||||
#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
|
||||
(sizeof (NIC_IP4_CONFIG_INFO) + \
|
||||
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
|
||||
|
||||
//
|
||||
// Compare whether two NIC address are equal includes their type and length.
|
||||
//
|
||||
#define NIC_ADDR_EQUAL(Nic1, Nic2) \
|
||||
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
|
||||
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
|
||||
|
||||
BOOLEAN
|
||||
Ip4ConfigIsValid (
|
||||
IN NIC_IP4_CONFIG_INFO *NicConfig
|
||||
);
|
||||
|
||||
IP4_CONFIG_VARIABLE *
|
||||
Ip4ConfigReadVariable (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
Ip4ConfigWriteVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
|
||||
);
|
||||
|
||||
NIC_IP4_CONFIG_INFO *
|
||||
Ip4ConfigFindNicVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Variable,
|
||||
IN NIC_ADDR *NicAddr
|
||||
);
|
||||
|
||||
IP4_CONFIG_VARIABLE *
|
||||
Ip4ConfigModifyVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
|
||||
IN NIC_ADDR *NicAddr,
|
||||
IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
|
||||
);
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2006, 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
|
||||
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:
|
||||
|
||||
NicIp4Variable.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Routines used to operate the Ip4 configure variable
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _NIC_IP4_VARIABLE_H_
|
||||
#define _NIC_IP4_VARIABLE_H_
|
||||
|
||||
|
||||
#include <Protocol/NicIp4Config.h>
|
||||
|
||||
//
|
||||
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
||||
// They are of variable size
|
||||
//
|
||||
#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
|
||||
(sizeof (EFI_IP4_IPCONFIG_DATA) + \
|
||||
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
|
||||
|
||||
#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
|
||||
(sizeof (NIC_IP4_CONFIG_INFO) + \
|
||||
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
|
||||
|
||||
//
|
||||
// Compare whether two NIC address are equal includes their type and length.
|
||||
//
|
||||
#define NIC_ADDR_EQUAL(Nic1, Nic2) \
|
||||
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
|
||||
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
|
||||
|
||||
BOOLEAN
|
||||
Ip4ConfigIsValid (
|
||||
IN NIC_IP4_CONFIG_INFO *NicConfig
|
||||
);
|
||||
|
||||
IP4_CONFIG_VARIABLE *
|
||||
Ip4ConfigReadVariable (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
Ip4ConfigWriteVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
|
||||
);
|
||||
|
||||
NIC_IP4_CONFIG_INFO *
|
||||
Ip4ConfigFindNicVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Variable,
|
||||
IN NIC_ADDR *NicAddr
|
||||
);
|
||||
|
||||
IP4_CONFIG_VARIABLE *
|
||||
Ip4ConfigModifyVariable (
|
||||
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
|
||||
IN NIC_ADDR *NicAddr,
|
||||
IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
|
||||
);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user