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:
@@ -25,6 +25,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
|
||||
PxeDhcp4ComponentNameGetDriverName (
|
||||
@@ -33,6 +72,75 @@ PxeDhcp4ComponentNameGetDriverName (
|
||||
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
|
||||
PxeDhcp4ComponentNameGetControllerName (
|
||||
@@ -43,20 +151,31 @@ PxeDhcp4ComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
|
||||
EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
|
||||
PxeDhcp4ComponentNameGetDriverName,
|
||||
PxeDhcp4ComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeDhcp4ComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeDhcp4ComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
|
||||
{
|
||||
"eng",
|
||||
"eng;en",
|
||||
L"PXE DHCPv4 Driver"
|
||||
},
|
||||
{
|
||||
@@ -65,7 +184,45 @@ static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
|
||||
}
|
||||
};
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/**
|
||||
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
|
||||
PxeDhcp4ComponentNameGetDriverName (
|
||||
@@ -73,42 +230,84 @@ PxeDhcp4ComponentNameGetDriverName (
|
||||
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_SUCCESS - 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 (
|
||||
Language,
|
||||
gPxeDhcp4ComponentName.SupportedLanguages,
|
||||
mPxeDhcp4DriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mPxeDhcp4DriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gPxeDhcp4ComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/**
|
||||
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
|
||||
PxeDhcp4ComponentNameGetControllerName (
|
||||
@@ -118,50 +317,6 @@ PxeDhcp4ComponentNameGetControllerName (
|
||||
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;
|
||||
}
|
||||
|
@@ -94,15 +94,14 @@ PxeDhcp4DriverEntryPoint (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
return EfiLibInstallAllDriverProtocols (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gPxeDhcp4DriverBinding,
|
||||
NULL,
|
||||
&gPxeDhcp4ComponentName,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gPxeDhcp4DriverBinding,
|
||||
NULL,
|
||||
&gPxeDhcp4ComponentName,
|
||||
&gPxeDhcp4ComponentName2
|
||||
);
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
@@ -1,345 +1,346 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 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:
|
||||
PxeDhcp4.h
|
||||
|
||||
Abstract:
|
||||
Common header for PxeDhcp4 protocol driver
|
||||
|
||||
|
||||
**/
|
||||
#ifndef _PXEDHCP4_H
|
||||
#define _PXEDHCP4_H
|
||||
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 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:
|
||||
PxeDhcp4.h
|
||||
|
||||
Abstract:
|
||||
Common header for PxeDhcp4 protocol driver
|
||||
|
||||
|
||||
**/
|
||||
#ifndef _PXEDHCP4_H
|
||||
#define _PXEDHCP4_H
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/PxeBaseCode.h>
|
||||
#include <Protocol/SimpleNetwork.h>
|
||||
#include <Protocol/PxeDhcp4.h>
|
||||
#include <Protocol/SimpleNetwork.h>
|
||||
#include <Protocol/PxeDhcp4.h>
|
||||
#include <Protocol/PxeDhcp4Callback.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// PxeDhcp4 protocol instance data
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
// Signature field used to locate beginning of containment record.
|
||||
//
|
||||
UINTN Signature;
|
||||
|
||||
#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
|
||||
//
|
||||
// Device handle the protocol is bound to.
|
||||
//
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Public PxeDhcp4 protocol interface.
|
||||
//
|
||||
EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
|
||||
|
||||
//
|
||||
// Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
|
||||
//
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
||||
EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
|
||||
|
||||
//
|
||||
// PxeDhcp4 called function for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_PXE_DHCP4_FUNCTION function;
|
||||
|
||||
//
|
||||
// Timeout event and flag for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_EVENT TimeoutEvent;
|
||||
BOOLEAN TimeoutOccurred;
|
||||
|
||||
//
|
||||
// Periodic event and flag for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_EVENT PeriodicEvent;
|
||||
BOOLEAN PeriodicOccurred;
|
||||
|
||||
//
|
||||
// DHCP server IP address.
|
||||
//
|
||||
UINT32 ServerIp;
|
||||
|
||||
//
|
||||
// DHCP renewal and rebinding times, in seconds.
|
||||
//
|
||||
UINT32 RenewTime;
|
||||
UINT32 RebindTime;
|
||||
UINT32 LeaseTime;
|
||||
|
||||
//
|
||||
// Number of offers received & allocated offer list.
|
||||
//
|
||||
UINTN offers;
|
||||
DHCP4_PACKET *offer_list;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
BOOLEAN StopPxeBc;
|
||||
|
||||
} PXE_DHCP4_PRIVATE_DATA;
|
||||
|
||||
#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Protocol function prototypes.
|
||||
//
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Run (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN OPTIONAL UINTN OpLen,
|
||||
IN OPTIONAL VOID *OpList
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Setup (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN EFI_PXE_DHCP4_DATA *Data
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Init (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN UINTN seconds_timeout,
|
||||
OUT UINTN *offer_list_entries,
|
||||
OUT DHCP4_PACKET **offer_list
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Select (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN UINTN seconds_timeout,
|
||||
IN DHCP4_PACKET *offer_list
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Renew (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Rebind (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Release (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This
|
||||
)
|
||||
;
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Support function prototypes.
|
||||
//
|
||||
extern
|
||||
UINT16
|
||||
htons (
|
||||
UINTN n
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
UINT32
|
||||
htonl (
|
||||
UINTN n
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
EFIAPI
|
||||
timeout_notify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
EFIAPI
|
||||
periodic_notify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
find_opt (
|
||||
IN DHCP4_PACKET *Packet,
|
||||
IN UINT8 OpCode,
|
||||
IN UINTN Skip,
|
||||
OUT DHCP4_OP **OpPtr
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
add_opt (
|
||||
IN DHCP4_PACKET *Packet,
|
||||
IN DHCP4_OP *OpPtr
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
start_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *station_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
stop_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
start_receive_events (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
stop_receive_events (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
tx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN EFI_IP_ADDRESS *dest_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
|
||||
IN EFI_IP_ADDRESS *src_ip,
|
||||
IN VOID *buffer,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
rx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
OUT VOID *buffer,
|
||||
OUT UINTN *BufferSize,
|
||||
IN OUT EFI_IP_ADDRESS *dest_ip,
|
||||
IN OUT EFI_IP_ADDRESS *src_ip,
|
||||
IN UINT16 op_flags
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
tx_rx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN OUT EFI_IP_ADDRESS *ServerIp,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *client_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
|
||||
IN DHCP4_PACKET *tx_pkt,
|
||||
OUT DHCP4_PACKET *rx_pkt,
|
||||
IN INTN
|
||||
(
|
||||
*rx_vfy)
|
||||
(
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN DHCP4_PACKET *tx_pkt,
|
||||
IN DHCP4_PACKET *rx_pkt,
|
||||
IN UINTN rx_pkt_size
|
||||
),
|
||||
IN UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Global variable definitions.
|
||||
//
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4DriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Register Driver Binding protocol for this driver.
|
||||
|
||||
Arguments:
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Driver loaded.
|
||||
other - Driver not loaded.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif /* _PXEDHCP4_H */
|
||||
|
||||
/* EOF - PxeDhcp4.h */
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// PxeDhcp4 protocol instance data
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
// Signature field used to locate beginning of containment record.
|
||||
//
|
||||
UINTN Signature;
|
||||
|
||||
#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
|
||||
//
|
||||
// Device handle the protocol is bound to.
|
||||
//
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Public PxeDhcp4 protocol interface.
|
||||
//
|
||||
EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
|
||||
|
||||
//
|
||||
// Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
|
||||
//
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
||||
EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
|
||||
|
||||
//
|
||||
// PxeDhcp4 called function for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_PXE_DHCP4_FUNCTION function;
|
||||
|
||||
//
|
||||
// Timeout event and flag for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_EVENT TimeoutEvent;
|
||||
BOOLEAN TimeoutOccurred;
|
||||
|
||||
//
|
||||
// Periodic event and flag for PxeDhcp4Callback.
|
||||
//
|
||||
EFI_EVENT PeriodicEvent;
|
||||
BOOLEAN PeriodicOccurred;
|
||||
|
||||
//
|
||||
// DHCP server IP address.
|
||||
//
|
||||
UINT32 ServerIp;
|
||||
|
||||
//
|
||||
// DHCP renewal and rebinding times, in seconds.
|
||||
//
|
||||
UINT32 RenewTime;
|
||||
UINT32 RebindTime;
|
||||
UINT32 LeaseTime;
|
||||
|
||||
//
|
||||
// Number of offers received & allocated offer list.
|
||||
//
|
||||
UINTN offers;
|
||||
DHCP4_PACKET *offer_list;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
BOOLEAN StopPxeBc;
|
||||
|
||||
} PXE_DHCP4_PRIVATE_DATA;
|
||||
|
||||
#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Protocol function prototypes.
|
||||
//
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Run (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN OPTIONAL UINTN OpLen,
|
||||
IN OPTIONAL VOID *OpList
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Setup (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN EFI_PXE_DHCP4_DATA *Data
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Init (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN UINTN seconds_timeout,
|
||||
OUT UINTN *offer_list_entries,
|
||||
OUT DHCP4_PACKET **offer_list
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Select (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
IN UINTN seconds_timeout,
|
||||
IN DHCP4_PACKET *offer_list
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Renew (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Rebind (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This,
|
||||
UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4Release (
|
||||
IN EFI_PXE_DHCP4_PROTOCOL *This
|
||||
)
|
||||
;
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Support function prototypes.
|
||||
//
|
||||
extern
|
||||
UINT16
|
||||
htons (
|
||||
UINTN n
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
UINT32
|
||||
htonl (
|
||||
UINTN n
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
EFIAPI
|
||||
timeout_notify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
EFIAPI
|
||||
periodic_notify (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
find_opt (
|
||||
IN DHCP4_PACKET *Packet,
|
||||
IN UINT8 OpCode,
|
||||
IN UINTN Skip,
|
||||
OUT DHCP4_OP **OpPtr
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
add_opt (
|
||||
IN DHCP4_PACKET *Packet,
|
||||
IN DHCP4_OP *OpPtr
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
start_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *station_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
stop_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
start_receive_events (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
VOID
|
||||
stop_receive_events (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
tx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN EFI_IP_ADDRESS *dest_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
|
||||
IN EFI_IP_ADDRESS *src_ip,
|
||||
IN VOID *buffer,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
rx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
OUT VOID *buffer,
|
||||
OUT UINTN *BufferSize,
|
||||
IN OUT EFI_IP_ADDRESS *dest_ip,
|
||||
IN OUT EFI_IP_ADDRESS *src_ip,
|
||||
IN UINT16 op_flags
|
||||
)
|
||||
;
|
||||
|
||||
extern
|
||||
EFI_STATUS
|
||||
tx_rx_udp (
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN OUT EFI_IP_ADDRESS *ServerIp,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *client_ip,
|
||||
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
|
||||
IN DHCP4_PACKET *tx_pkt,
|
||||
OUT DHCP4_PACKET *rx_pkt,
|
||||
IN INTN
|
||||
(
|
||||
*rx_vfy)
|
||||
(
|
||||
IN PXE_DHCP4_PRIVATE_DATA *Private,
|
||||
IN DHCP4_PACKET *tx_pkt,
|
||||
IN DHCP4_PACKET *rx_pkt,
|
||||
IN UINTN rx_pkt_size
|
||||
),
|
||||
IN UINTN seconds_timeout
|
||||
)
|
||||
;
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
//
|
||||
// Global variable definitions.
|
||||
//
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PxeDhcp4DriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Register Driver Binding protocol for this driver.
|
||||
|
||||
Arguments:
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Driver loaded.
|
||||
other - Driver not loaded.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif /* _PXEDHCP4_H */
|
||||
|
||||
/* EOF - PxeDhcp4.h */
|
||||
|
Reference in New Issue
Block a user