MdeModulePkg: Delete UefiPxeBcDxe in MdeModulePkg.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1278 This patch is to delete the UefiPxeBcDxe driver in MdeModulePkg. The driver will not be maintained and can't co-work with the dual-stack UefiPxeBcDxe in NetworkPkg. People should use below NetworkPkg drivers instead: NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf Which is actively maintained with more bug fixes and new feature support. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
parent
5ac92dd427
commit
b36c046960
@ -420,7 +420,6 @@
|
|||||||
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
|
MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
|
||||||
|
|
||||||
[Components.IA32, Components.X64, Components.AARCH64]
|
[Components.IA32, Components.X64, Components.AARCH64]
|
||||||
MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
|
|
||||||
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
|
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
|
||||||
|
@ -1,365 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
#include "PxeBcImpl.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[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param[in] Language 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 4646 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param[out] 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.
|
|
||||||
|
|
||||||
@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
|
|
||||||
PxeBcComponentNameGetDriverName (
|
|
||||||
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[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param[in] 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.
|
|
||||||
|
|
||||||
@param[in] 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.
|
|
||||||
|
|
||||||
@param[in] Language 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 4646 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param[out] 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.
|
|
||||||
|
|
||||||
@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 NULL.
|
|
||||||
|
|
||||||
@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
|
|
||||||
PxeBcComponentNameGetControllerName (
|
|
||||||
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
|
|
||||||
//
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
|
|
||||||
PxeBcComponentNameGetDriverName,
|
|
||||||
PxeBcComponentNameGetControllerName,
|
|
||||||
"eng"
|
|
||||||
};
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2 = {
|
|
||||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeBcComponentNameGetDriverName,
|
|
||||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeBcComponentNameGetControllerName,
|
|
||||||
"en"
|
|
||||||
};
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
|
|
||||||
{
|
|
||||||
"eng;en",
|
|
||||||
L"UEFI PXE Base Code Driver"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPxeBcControllerNameTable[] = {
|
|
||||||
{
|
|
||||||
"eng;en",
|
|
||||||
L"PXE Controller"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param[in] Language 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 4646 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param[out] 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.
|
|
||||||
|
|
||||||
@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
|
|
||||||
PxeBcComponentNameGetDriverName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL * This,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **DriverName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return LookupUnicodeString2 (
|
|
||||||
Language,
|
|
||||||
This->SupportedLanguages,
|
|
||||||
mPxeBcDriverNameTable,
|
|
||||||
DriverName,
|
|
||||||
(BOOLEAN)(This == &gPxeBcComponentName)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
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[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
|
|
||||||
@param[in] 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.
|
|
||||||
|
|
||||||
@param[in] 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.
|
|
||||||
|
|
||||||
@param[in] Language 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 4646 or ISO 639-2 language code format.
|
|
||||||
|
|
||||||
@param[out] 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.
|
|
||||||
|
|
||||||
@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 NULL.
|
|
||||||
|
|
||||||
@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
|
|
||||||
PxeBcComponentNameGetControllerName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **ControllerName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
|
|
||||||
EFI_HANDLE NicHandle;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
if (ControllerHandle == NULL || ChildHandle != NULL) {
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiArpProtocolGuid);
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
NicHandle,
|
|
||||||
&gEfiPxeBaseCodeProtocolGuid,
|
|
||||||
(VOID **) &PxeBc,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LookupUnicodeString2 (
|
|
||||||
Language,
|
|
||||||
This->SupportedLanguages,
|
|
||||||
mPxeBcControllerNameTable,
|
|
||||||
ControllerName,
|
|
||||||
(BOOLEAN)(This == &gPxeBcComponentName)
|
|
||||||
);
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,502 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Dhcp and Discover routines for PxeBc.
|
|
||||||
|
|
||||||
Copyright (c) 2013, Red Hat, Inc.
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __EFI_PXEBC_DHCP_H__
|
|
||||||
#define __EFI_PXEBC_DHCP_H__
|
|
||||||
|
|
||||||
#define PXEBC_DHCP4_MAX_OPTION_NUM 16
|
|
||||||
#define PXEBC_DHCP4_MAX_OPTION_SIZE 312
|
|
||||||
#define PXEBC_DHCP4_MAX_PACKET_SIZE (sizeof (EFI_PXE_BASE_CODE_PACKET))
|
|
||||||
|
|
||||||
#define PXEBC_DHCP4_S_PORT 67
|
|
||||||
#define PXEBC_DHCP4_C_PORT 68
|
|
||||||
#define PXEBC_BS_DOWNLOAD_PORT 69
|
|
||||||
#define PXEBC_BS_DISCOVER_PORT 4011
|
|
||||||
|
|
||||||
#define PXEBC_DHCP4_OPCODE_REQUEST 1
|
|
||||||
#define PXEBC_DHCP4_OPCODE_REPLY 2
|
|
||||||
#define PXEBC_DHCP4_MSG_TYPE_REQUEST 3
|
|
||||||
#define PXEBC_DHCP4_MAGIC 0x63538263 // network byte order
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sub-Options in Dhcp Vendor Option
|
|
||||||
//
|
|
||||||
#define PXEBC_VENDOR_TAG_MTFTP_IP 1
|
|
||||||
#define PXEBC_VENDOR_TAG_MTFTP_CPORT 2
|
|
||||||
#define PXEBC_VENDOR_TAG_MTFTP_SPORT 3
|
|
||||||
#define PXEBC_VENDOR_TAG_MTFTP_TIMEOUT 4
|
|
||||||
#define PXEBC_VENDOR_TAG_MTFTP_DELAY 5
|
|
||||||
#define PXEBC_VENDOR_TAG_DISCOVER_CTRL 6
|
|
||||||
#define PXEBC_VENDOR_TAG_DISCOVER_MCAST 7
|
|
||||||
#define PXEBC_VENDOR_TAG_BOOT_SERVERS 8
|
|
||||||
#define PXEBC_VENDOR_TAG_BOOT_MENU 9
|
|
||||||
#define PXEBC_VENDOR_TAG_MENU_PROMPT 10
|
|
||||||
#define PXEBC_VENDOR_TAG_MCAST_ALLOC 11
|
|
||||||
#define PXEBC_VENDOR_TAG_CREDENTIAL_TYPES 12
|
|
||||||
#define PXEBC_VENDOR_TAG_BOOT_ITEM 71
|
|
||||||
|
|
||||||
#define PXEBC_DHCP4_DISCOVER_INIT_TIMEOUT 4
|
|
||||||
#define PXEBC_DHCP4_DISCOVER_RETRIES 4
|
|
||||||
|
|
||||||
#define PXEBC_MAX_MENU_NUM 24
|
|
||||||
#define PXEBC_MAX_OFFER_NUM 16
|
|
||||||
|
|
||||||
#define PXEBC_BOOT_REQUEST_TIMEOUT 1
|
|
||||||
#define PXEBC_BOOT_REQUEST_RETRIES 4
|
|
||||||
|
|
||||||
#define PXEBC_DHCP4_OVERLOAD_FILE 1
|
|
||||||
#define PXEBC_DHCP4_OVERLOAD_SERVER_NAME 2
|
|
||||||
|
|
||||||
//
|
|
||||||
// The array index of the DHCP4 option tag interested
|
|
||||||
//
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN 0
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_VENDOR 1
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_OVERLOAD 2
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_MSG_TYPE 3
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_SERVER_ID 4
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_CLASS_ID 5
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_BOOTFILE 6
|
|
||||||
#define PXEBC_DHCP4_TAG_INDEX_MAX 7
|
|
||||||
|
|
||||||
//
|
|
||||||
// The type of DHCP OFFER, arranged by priority, PXE10 has the highest priority.
|
|
||||||
//
|
|
||||||
#define DHCP4_PACKET_TYPE_PXE10 0
|
|
||||||
#define DHCP4_PACKET_TYPE_WFM11A 1
|
|
||||||
#define DHCP4_PACKET_TYPE_BINL 2
|
|
||||||
#define DHCP4_PACKET_TYPE_DHCP_ONLY 3
|
|
||||||
#define DHCP4_PACKET_TYPE_BOOTP 4
|
|
||||||
#define DHCP4_PACKET_TYPE_MAX 5
|
|
||||||
|
|
||||||
#define BIT(x) (1 << x)
|
|
||||||
#define CTRL(x) (0x1F & (x))
|
|
||||||
|
|
||||||
//
|
|
||||||
// WfM11a options
|
|
||||||
//
|
|
||||||
#define MTFTP_VENDOR_OPTION_BIT_MAP (BIT (PXEBC_VENDOR_TAG_MTFTP_IP) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_MTFTP_CPORT) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_MTFTP_SPORT) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_MTFTP_TIMEOUT) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_MTFTP_DELAY))
|
|
||||||
//
|
|
||||||
// Discoverty options
|
|
||||||
//
|
|
||||||
#define DISCOVER_VENDOR_OPTION_BIT_MAP (BIT (PXEBC_VENDOR_TAG_DISCOVER_CTRL) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_DISCOVER_MCAST) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_BOOT_MENU) | \
|
|
||||||
BIT (PXEBC_VENDOR_TAG_MENU_PROMPT))
|
|
||||||
|
|
||||||
#define IS_VALID_BOOT_PROMPT(x) \
|
|
||||||
((((x)[0]) & BIT (PXEBC_VENDOR_TAG_MENU_PROMPT)) == BIT (PXEBC_VENDOR_TAG_MENU_PROMPT))
|
|
||||||
|
|
||||||
#define IS_VALID_BOOT_MENU(x) \
|
|
||||||
((((x)[0]) & BIT (PXEBC_VENDOR_TAG_BOOT_MENU)) == BIT (PXEBC_VENDOR_TAG_BOOT_MENU))
|
|
||||||
|
|
||||||
#define IS_VALID_MTFTP_VENDOR_OPTION(x) \
|
|
||||||
(((UINT32) ((x)[0]) & MTFTP_VENDOR_OPTION_BIT_MAP) == MTFTP_VENDOR_OPTION_BIT_MAP)
|
|
||||||
|
|
||||||
#define IS_VALID_DISCOVER_VENDOR_OPTION(x) (((UINT32) ((x)[0]) & DISCOVER_VENDOR_OPTION_BIT_MAP) != 0)
|
|
||||||
|
|
||||||
#define IS_VALID_CREDENTIAL_VENDOR_OPTION(x) \
|
|
||||||
(((UINT32) ((x)[0]) & BIT (PXEBC_VENDOR_TAG_CREDENTIAL_TYPES)) == BIT (PXEBC_VENDOR_TAG_CREDENTIAL_TYPES))
|
|
||||||
|
|
||||||
#define IS_VALID_BOOTITEM_VENDOR_OPTION(x) \
|
|
||||||
(((UINT32) ((x)[PXEBC_VENDOR_TAG_BOOT_ITEM / 32]) & BIT (PXEBC_VENDOR_TAG_BOOT_ITEM % 32)) \
|
|
||||||
== BIT (PXEBC_VENDOR_TAG_BOOT_ITEM % 32))
|
|
||||||
|
|
||||||
#define IS_DISABLE_BCAST_DISCOVER(x) (((x) & BIT (0)) == BIT (0))
|
|
||||||
#define IS_DISABLE_MCAST_DISCOVER(x) (((x) & BIT (1)) == BIT (1))
|
|
||||||
#define IS_ENABLE_USE_SERVER_LIST(x) (((x) & BIT (2)) == BIT (2))
|
|
||||||
#define IS_DISABLE_PROMPT_MENU(x) (((x) & BIT (3)) == BIT (3))
|
|
||||||
|
|
||||||
#define SET_VENDOR_OPTION_BIT_MAP(x, y) (((x)[(y) / 32]) = (UINT32) ((x)[(y) / 32]) | BIT ((y) % 32))
|
|
||||||
|
|
||||||
#pragma pack(1)
|
|
||||||
typedef struct {
|
|
||||||
UINT8 ParaList[135];
|
|
||||||
} PXEBC_DHCP4_OPTION_PARA;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Size;
|
|
||||||
} PXEBC_DHCP4_OPTION_MAX_MESG_SIZE;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Type;
|
|
||||||
UINT8 MajorVer;
|
|
||||||
UINT8 MinorVer;
|
|
||||||
} PXEBC_DHCP4_OPTION_UNDI;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Type;
|
|
||||||
} PXEBC_DHCP4_OPTION_MESG;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Type;
|
|
||||||
} PXEBC_DHCP4_OPTION_ARCH;
|
|
||||||
|
|
||||||
#define DEFAULT_CLASS_ID_DATA "PXEClient:Arch:xxxxx:UNDI:003000"
|
|
||||||
#define DEFAULT_UNDI_TYPE 1
|
|
||||||
#define DEFAULT_UNDI_MAJOR 3
|
|
||||||
#define DEFAULT_UNDI_MINOR 0
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 ClassIdentifier[10];
|
|
||||||
UINT8 ArchitecturePrefix[5];
|
|
||||||
UINT8 ArchitectureType[5];
|
|
||||||
UINT8 Lit3[1];
|
|
||||||
UINT8 InterfaceName[4];
|
|
||||||
UINT8 Lit4[1];
|
|
||||||
UINT8 UndiMajor[3];
|
|
||||||
UINT8 UndiMinor[3];
|
|
||||||
} PXEBC_DHCP4_OPTION_CLID;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Type;
|
|
||||||
UINT8 Guid[16];
|
|
||||||
} PXEBC_DHCP4_OPTION_UUID;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Type;
|
|
||||||
UINT16 Layer;
|
|
||||||
} PXEBC_OPTION_BOOT_ITEM;
|
|
||||||
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
PXEBC_DHCP4_OPTION_PARA *Para;
|
|
||||||
PXEBC_DHCP4_OPTION_UNDI *Undi;
|
|
||||||
PXEBC_DHCP4_OPTION_ARCH *Arch;
|
|
||||||
PXEBC_DHCP4_OPTION_CLID *Clid;
|
|
||||||
PXEBC_DHCP4_OPTION_UUID *Uuid;
|
|
||||||
PXEBC_DHCP4_OPTION_MESG *Mesg;
|
|
||||||
PXEBC_DHCP4_OPTION_MAX_MESG_SIZE *MaxMesgSize;
|
|
||||||
} PXEBC_DHCP4_OPTION_ENTRY;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Type;
|
|
||||||
UINT8 IpCnt;
|
|
||||||
EFI_IPv4_ADDRESS IpAddr[1];
|
|
||||||
} PXEBC_BOOT_SVR_ENTRY;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Type;
|
|
||||||
UINT8 DescLen;
|
|
||||||
UINT8 DescStr[1];
|
|
||||||
} PXEBC_BOOT_MENU_ENTRY;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Timeout;
|
|
||||||
UINT8 Prompt[1];
|
|
||||||
} PXEBC_MENU_PROMPT;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT32 BitMap[8];
|
|
||||||
EFI_IPv4_ADDRESS MtftpIp;
|
|
||||||
UINT16 MtftpCPort;
|
|
||||||
UINT16 MtftpSPort;
|
|
||||||
UINT8 MtftpTimeout;
|
|
||||||
UINT8 MtftpDelay;
|
|
||||||
UINT8 DiscoverCtrl;
|
|
||||||
EFI_IPv4_ADDRESS DiscoverMcastIp;
|
|
||||||
EFI_IPv4_ADDRESS McastIpBase;
|
|
||||||
UINT16 McastIpBlock;
|
|
||||||
UINT16 McastIpRange;
|
|
||||||
UINT16 BootSrvType;
|
|
||||||
UINT16 BootSrvLayer;
|
|
||||||
PXEBC_BOOT_SVR_ENTRY *BootSvr;
|
|
||||||
UINT8 BootSvrLen;
|
|
||||||
PXEBC_BOOT_MENU_ENTRY *BootMenu;
|
|
||||||
UINT8 BootMenuLen;
|
|
||||||
PXEBC_MENU_PROMPT *MenuPrompt;
|
|
||||||
UINT8 MenuPromptLen;
|
|
||||||
UINT32 *CredType;
|
|
||||||
UINT8 CredTypeLen;
|
|
||||||
} PXEBC_VENDOR_OPTION;
|
|
||||||
|
|
||||||
#define PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP4_PACKET, Dhcp4) + PXEBC_DHCP4_MAX_PACKET_SIZE)
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
EFI_DHCP4_PACKET Offer;
|
|
||||||
EFI_DHCP4_PACKET Ack;
|
|
||||||
UINT8 Buffer[PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE];
|
|
||||||
} PXEBC_DHCP4_PACKET;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PXEBC_DHCP4_PACKET Packet;
|
|
||||||
BOOLEAN IsPxeOffer;
|
|
||||||
UINT8 OfferType;
|
|
||||||
EFI_DHCP4_PACKET_OPTION *Dhcp4Option[PXEBC_DHCP4_TAG_INDEX_MAX];
|
|
||||||
PXEBC_VENDOR_OPTION PxeVendorOption;
|
|
||||||
} PXEBC_CACHED_DHCP4_PACKET;
|
|
||||||
|
|
||||||
#define GET_NEXT_DHCP_OPTION(Opt) \
|
|
||||||
(EFI_DHCP4_PACKET_OPTION *) ((UINT8 *) (Opt) + sizeof (EFI_DHCP4_PACKET_OPTION) + (Opt)->Length - 1)
|
|
||||||
|
|
||||||
#define GET_OPTION_BUFFER_LEN(Pkt) ((Pkt)->Length - sizeof (EFI_DHCP4_HEADER) - 4)
|
|
||||||
#define IS_PROXY_DHCP_OFFER(Offer) EFI_IP4_EQUAL (&((Offer)->Dhcp4.Header.YourAddr), &mZeroIp4Addr)
|
|
||||||
|
|
||||||
#define GET_NEXT_BOOT_SVR_ENTRY(Ent) \
|
|
||||||
(PXEBC_BOOT_SVR_ENTRY *) ((UINT8 *) Ent + sizeof (*(Ent)) + ((Ent)->IpCnt - 1) * sizeof (EFI_IPv4_ADDRESS))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function initialize the DHCP4 message instance.
|
|
||||||
|
|
||||||
This function will pad each item of dhcp4 message packet.
|
|
||||||
|
|
||||||
@param Seed Pointer to the message instance of the DHCP4 packet.
|
|
||||||
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
PxeBcInitSeedPacket (
|
|
||||||
IN EFI_DHCP4_PACKET *Seed,
|
|
||||||
IN EFI_UDP4_PROTOCOL *Udp4
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Parse the cached dhcp packet.
|
|
||||||
|
|
||||||
@param CachedPacket Pointer to cached dhcp packet.
|
|
||||||
|
|
||||||
@retval TRUE Succeed to parse and validation.
|
|
||||||
@retval FALSE Fail to parse or validation.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
PxeBcParseCachedDhcpPacket (
|
|
||||||
IN PXEBC_CACHED_DHCP4_PACKET *CachedPacket
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to check the selected proxy offer (include BINL dhcp offer and
|
|
||||||
DHCP_ONLY offer ) and set the flag and copy the DHCP packets to the Pxe base code
|
|
||||||
mode structure.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operational successful.
|
|
||||||
@retval EFI_NO_RESPONSE Offer dhcp service failed.
|
|
||||||
@retval EFI_BUFFER_TOO_SMALL Failed to copy the packet to Pxe base code mode.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcCheckSelectedOffer (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Callback routine.
|
|
||||||
|
|
||||||
EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
|
|
||||||
to intercept events that occurred in the configuration process. This structure
|
|
||||||
provides advanced control of each state transition of the DHCP process. The
|
|
||||||
returned status code determines the behavior of the EFI DHCPv4 Protocol driver.
|
|
||||||
There are three possible returned values, which are described in the following
|
|
||||||
table.
|
|
||||||
|
|
||||||
@param This Pointer to the EFI DHCPv4 Protocol instance that is used to
|
|
||||||
configure this callback function.
|
|
||||||
@param Context Pointer to the context that is initialized by
|
|
||||||
EFI_DHCP4_PROTOCOL.Configure().
|
|
||||||
@param CurrentState The current operational state of the EFI DHCPv4 Protocol
|
|
||||||
driver.
|
|
||||||
@param Dhcp4Event The event that occurs in the current state, which usually means a
|
|
||||||
state transition.
|
|
||||||
@param Packet The DHCP packet that is going to be sent or already received.
|
|
||||||
@param NewPacket The packet that is used to replace the above Packet.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
|
|
||||||
@retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
|
|
||||||
driver will continue to wait for more DHCPOFFER packets until the retry
|
|
||||||
timeout expires.
|
|
||||||
@retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
|
|
||||||
return to the Dhcp4Init or Dhcp4InitReboot state.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PxeBcDhcpCallBack (
|
|
||||||
IN EFI_DHCP4_PROTOCOL * This,
|
|
||||||
IN VOID *Context,
|
|
||||||
IN EFI_DHCP4_STATE CurrentState,
|
|
||||||
IN EFI_DHCP4_EVENT Dhcp4Event,
|
|
||||||
IN EFI_DHCP4_PACKET * Packet OPTIONAL,
|
|
||||||
OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Switch the Ip4 policy to static.
|
|
||||||
|
|
||||||
@param[in] Private The pointer to PXEBC_PRIVATE_DATA.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The policy is already configured to static.
|
|
||||||
@retval Others Other error as indicated..
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcSetIp4Policy (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Discover the boot of service and initialize the vendor option if exists.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
@param Type PxeBc option boot item type
|
|
||||||
@param Layer PxeBc option boot item layer
|
|
||||||
@param UseBis Use BIS or not
|
|
||||||
@param DestIp Ip address for server
|
|
||||||
@param IpCount The total count of the server ip address
|
|
||||||
@param SrvList Server list
|
|
||||||
@param IsDiscv Discover the vendor or not
|
|
||||||
@param Reply The dhcp4 packet of Pxe reply
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operation succeeds.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Allocate memory pool failed.
|
|
||||||
@retval EFI_NOT_FOUND There is no vendor option exists.
|
|
||||||
@retval EFI_TIMEOUT Send Pxe Discover time out.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcDiscvBootService (
|
|
||||||
IN PXEBC_PRIVATE_DATA * Private,
|
|
||||||
IN UINT16 Type,
|
|
||||||
IN UINT16 *Layer,
|
|
||||||
IN BOOLEAN UseBis,
|
|
||||||
IN EFI_IP_ADDRESS * DestIp,
|
|
||||||
IN UINT16 IpCount,
|
|
||||||
IN EFI_PXE_BASE_CODE_SRVLIST * SrvList,
|
|
||||||
IN BOOLEAN IsDiscv,
|
|
||||||
OUT EFI_DHCP4_PACKET * Reply OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize the DHCP options and build the option list.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
@param OptList Pointer to a DHCP option list.
|
|
||||||
|
|
||||||
@param IsDhcpDiscover Discover dhcp option or not.
|
|
||||||
|
|
||||||
@return The index item number of the option list.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT32
|
|
||||||
PxeBcBuildDhcpOptions (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_DHCP4_PACKET_OPTION **OptList,
|
|
||||||
IN BOOLEAN IsDhcpDiscover
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Create the boot options.
|
|
||||||
|
|
||||||
@param OptList Pointer to the list of the options
|
|
||||||
@param Type the type of option
|
|
||||||
@param Layer the layer of the boot options
|
|
||||||
@param OptLen length of opotion
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
PxeBcCreateBootOptions (
|
|
||||||
IN EFI_DHCP4_PACKET_OPTION *OptList,
|
|
||||||
IN UINT16 Type,
|
|
||||||
IN UINT16 *Layer,
|
|
||||||
OUT UINT32 *OptLen
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Parse interested dhcp options.
|
|
||||||
|
|
||||||
@param Buffer Pointer to the dhcp options packet.
|
|
||||||
@param Length The length of the dhcp options.
|
|
||||||
@param OptTag The option OpCode.
|
|
||||||
|
|
||||||
@return NULL if the buffer length is 0 and OpCode is not
|
|
||||||
DHCP4_TAG_EOP, or the pointer to the buffer.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_DHCP4_PACKET_OPTION *
|
|
||||||
PxeBcParseExtendOptions (
|
|
||||||
IN UINT8 *Buffer,
|
|
||||||
IN UINT32 Length,
|
|
||||||
IN UINT8 OptTag
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to parse and check vendor options.
|
|
||||||
|
|
||||||
@param Dhcp4Option Pointer to dhcp options
|
|
||||||
@param VendorOption Pointer to vendor options
|
|
||||||
|
|
||||||
@return TRUE if valid for vendor options, or FALSE.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
PxeBcParseVendorOptions (
|
|
||||||
IN EFI_DHCP4_PACKET_OPTION *Dhcp4Option,
|
|
||||||
IN PXEBC_VENDOR_OPTION *VendorOption
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Choose the boot prompt.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Select boot prompt done.
|
|
||||||
@retval EFI_TIMEOUT Select boot prompt time out.
|
|
||||||
@retval EFI_NOT_FOUND The proxy offer is not Pxe10.
|
|
||||||
@retval EFI_ABORTED User cancel the operation.
|
|
||||||
@retval EFI_NOT_READY Read the input key from the keybroad has not finish.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcSelectBootPrompt (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Select the boot menu.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
@param Type The type of the menu.
|
|
||||||
@param UseDefaultItem Use default item or not.
|
|
||||||
|
|
||||||
@retval EFI_ABORTED User cancel operation.
|
|
||||||
@retval EFI_SUCCESS Select the boot menu success.
|
|
||||||
@retval EFI_NOT_READY Read the input key from the keybroad has not finish.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcSelectBootMenu (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
OUT UINT16 *Type,
|
|
||||||
IN BOOLEAN UseDefaultItem
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,665 +0,0 @@
|
|||||||
/** @file
|
|
||||||
The driver binding for UEFI PXEBC protocol.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
#include "PxeBcImpl.h"
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding = {
|
|
||||||
PxeBcDriverBindingSupported,
|
|
||||||
PxeBcDriverBindingStart,
|
|
||||||
PxeBcDriverBindingStop,
|
|
||||||
0xa,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
This is the declaration of an EFI image entry point. This entry point is
|
|
||||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
|
||||||
both device drivers and bus drivers.
|
|
||||||
|
|
||||||
@param ImageHandle The firmware allocated handle for the UEFI image.
|
|
||||||
@param SystemTable A pointer to the EFI System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation completed successfully.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PxeBcDriverEntryPoint (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EfiLibInstallDriverBindingComponentName2 (
|
|
||||||
ImageHandle,
|
|
||||||
SystemTable,
|
|
||||||
&gPxeBcDriverBinding,
|
|
||||||
ImageHandle,
|
|
||||||
&gPxeBcComponentName,
|
|
||||||
&gPxeBcComponentName2
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
|
||||||
is called by the EFI boot service ConnectController(). In
|
|
||||||
order to make drivers as small as possible, there are a few calling
|
|
||||||
restrictions for this service. ConnectController() must
|
|
||||||
follow these calling restrictions. If any other agent wishes to call
|
|
||||||
Supported() it must also follow these calling restrictions.
|
|
||||||
PxeBc requires DHCP4 and MTFTP4 protocols.
|
|
||||||
|
|
||||||
@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_SUCCESS 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
|
|
||||||
PxeBcDriverBindingSupported (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
ControllerHandle,
|
|
||||||
&gEfiPxeBaseCodeProtocolGuid,
|
|
||||||
(VOID **) &PxeBc,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
return EFI_ALREADY_STARTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
ControllerHandle,
|
|
||||||
&gEfiDhcp4ServiceBindingProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
ControllerHandle,
|
|
||||||
&gEfiMtftp4ServiceBindingProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Start this driver on ControllerHandle. This service is called by the
|
|
||||||
EFI boot service ConnectController(). In order to make
|
|
||||||
drivers as small as possible, there are a few calling restrictions for
|
|
||||||
this service. ConnectController() must follow these
|
|
||||||
calling restrictions. If any other agent wishes to call Start() it
|
|
||||||
must also follow these calling restrictions.
|
|
||||||
|
|
||||||
@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_SUCCESS 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
|
|
||||||
PxeBcDriverBindingStart (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PXEBC_PRIVATE_DATA *Private;
|
|
||||||
UINTN Index;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_IP4_MODE_DATA Ip4ModeData;
|
|
||||||
|
|
||||||
Private = AllocateZeroPool (sizeof (PXEBC_PRIVATE_DATA));
|
|
||||||
if (Private == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
Private->Signature = PXEBC_PRIVATE_DATA_SIGNATURE;
|
|
||||||
Private->Controller = ControllerHandle;
|
|
||||||
Private->Image = This->DriverBindingHandle;
|
|
||||||
CopyMem (&Private->PxeBc, &mPxeBcProtocolTemplate, sizeof (Private->PxeBc));
|
|
||||||
Private->PxeBc.Mode = &Private->Mode;
|
|
||||||
CopyMem (&Private->LoadFile, &mLoadFileProtocolTemplate, sizeof (Private->LoadFile));
|
|
||||||
|
|
||||||
Private->ProxyOffer.Packet.Offer.Size = PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE;
|
|
||||||
Private->Dhcp4Ack.Packet.Ack.Size = PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE;
|
|
||||||
Private->PxeReply.Packet.Ack.Size = PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE;
|
|
||||||
|
|
||||||
for (Index = 0; Index < PXEBC_MAX_OFFER_NUM; Index++) {
|
|
||||||
Private->Dhcp4Offers[Index].Packet.Offer.Size = PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get the NII interface if it exists.
|
|
||||||
//
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
ControllerHandle,
|
|
||||||
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,
|
|
||||||
(VOID **) &Private->Nii,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
Private->Nii = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiArpServiceBindingProtocolGuid,
|
|
||||||
&Private->ArpChild
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->ArpChild,
|
|
||||||
&gEfiArpProtocolGuid,
|
|
||||||
(VOID **) &Private->Arp,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiDhcp4ServiceBindingProtocolGuid,
|
|
||||||
&Private->Dhcp4Child
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->Dhcp4Child,
|
|
||||||
&gEfiDhcp4ProtocolGuid,
|
|
||||||
(VOID **) &Private->Dhcp4,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiIp4ServiceBindingProtocolGuid,
|
|
||||||
&Private->Ip4Child
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->Ip4Child,
|
|
||||||
&gEfiIp4ProtocolGuid,
|
|
||||||
(VOID **) &Private->Ip4,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get max packet size from Ip4 to calculate block size for Tftp later.
|
|
||||||
//
|
|
||||||
Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Private->Ip4MaxPacketSize = Ip4ModeData.MaxPacketSize;
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiMtftp4ServiceBindingProtocolGuid,
|
|
||||||
&Private->Mtftp4Child
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->Mtftp4Child,
|
|
||||||
&gEfiMtftp4ProtocolGuid,
|
|
||||||
(VOID **) &Private->Mtftp4,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
&Private->Udp4ReadChild
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// The UDP instance for EfiPxeBcUdpRead
|
|
||||||
//
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->Udp4ReadChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
(VOID **) &Private->Udp4Read,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// The UDP instance for EfiPxeBcUdpWrite
|
|
||||||
//
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
&Private->Udp4WriteChild
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Private->Udp4WriteChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
(VOID **) &Private->Udp4Write,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
ZeroMem (&Private->Udp4CfgData, sizeof (EFI_UDP4_CONFIG_DATA));
|
|
||||||
Private->Udp4CfgData.AcceptBroadcast = FALSE;
|
|
||||||
Private->Udp4CfgData.AcceptPromiscuous = FALSE;
|
|
||||||
Private->Udp4CfgData.AcceptAnyPort = TRUE;
|
|
||||||
Private->Udp4CfgData.AllowDuplicatePort = TRUE;
|
|
||||||
Private->Udp4CfgData.TypeOfService = DEFAULT_ToS;
|
|
||||||
Private->Udp4CfgData.TimeToLive = DEFAULT_TTL;
|
|
||||||
Private->Udp4CfgData.DoNotFragment = FALSE;
|
|
||||||
Private->Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
|
|
||||||
Private->Udp4CfgData.UseDefaultAddress = FALSE;
|
|
||||||
|
|
||||||
PxeBcInitSeedPacket (&Private->SeedPacket, Private->Udp4Read);
|
|
||||||
Private->MacLen = Private->SeedPacket.Dhcp4.Header.HwAddrLen;
|
|
||||||
CopyMem (&Private->Mac, &Private->SeedPacket.Dhcp4.Header.ClientHwAddr[0], Private->MacLen);
|
|
||||||
|
|
||||||
|
|
||||||
ZeroMem (&Private->Ip4ConfigData, sizeof (EFI_IP4_CONFIG_DATA));
|
|
||||||
Private->Ip4ConfigData.DefaultProtocol = EFI_IP_PROTO_ICMP;
|
|
||||||
Private->Ip4ConfigData.AcceptIcmpErrors = TRUE;
|
|
||||||
Private->Ip4ConfigData.TypeOfService = DEFAULT_ToS;
|
|
||||||
Private->Ip4ConfigData.TimeToLive = DEFAULT_TTL;
|
|
||||||
Private->Ip4ConfigData.DoNotFragment = FALSE;
|
|
||||||
Private->Ip4ConfigData.RawData = FALSE;
|
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
|
||||||
&ControllerHandle,
|
|
||||||
&gEfiPxeBaseCodeProtocolGuid,
|
|
||||||
&Private->PxeBc,
|
|
||||||
&gEfiLoadFileProtocolGuid,
|
|
||||||
&Private->LoadFile,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.
|
|
||||||
//
|
|
||||||
Status = gBS->HandleProtocol (
|
|
||||||
ControllerHandle,
|
|
||||||
&gEfiIp4Config2ProtocolGuid,
|
|
||||||
(VOID **) &Private->Ip4Config2
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
|
|
||||||
ON_ERROR:
|
|
||||||
|
|
||||||
if (Private->Udp4WriteChild != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Udp4WriteChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Udp4WriteChild
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Private->Udp4ReadChild != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Udp4ReadChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Udp4ReadChild
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Private->Mtftp4Child != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Mtftp4Child,
|
|
||||||
&gEfiMtftp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiMtftp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Mtftp4Child
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Private->Ip4Child != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Ip4Child,
|
|
||||||
&gEfiIp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiIp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Ip4Child
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Private->Dhcp4Child != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Dhcp4Child,
|
|
||||||
&gEfiDhcp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiDhcp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Dhcp4Child
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Private->ArpChild != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->ArpChild,
|
|
||||||
&gEfiArpProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiArpServiceBindingProtocolGuid,
|
|
||||||
Private->ArpChild
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (Private);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Stop this driver on ControllerHandle. This service is called by the
|
|
||||||
EFI boot service DisconnectController(). In order to
|
|
||||||
make drivers as small as possible, there are a few calling
|
|
||||||
restrictions for this service. DisconnectController()
|
|
||||||
must follow these calling restrictions. If any other agent wishes
|
|
||||||
to call Stop() it must also follow these calling restrictions.
|
|
||||||
|
|
||||||
@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_SUCCESS This driver is removed ControllerHandle
|
|
||||||
@retval other This driver was not removed from this device
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PxeBcDriverBindingStop (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN UINTN NumberOfChildren,
|
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PXEBC_PRIVATE_DATA *Private;
|
|
||||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
|
|
||||||
EFI_HANDLE NicHandle;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiArpProtocolGuid);
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp4ProtocolGuid);
|
|
||||||
|
|
||||||
if (NicHandle == NULL) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
NicHandle,
|
|
||||||
&gEfiPxeBaseCodeProtocolGuid,
|
|
||||||
(VOID **) &PxeBc,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
ControllerHandle,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Stop functionality of PXE Base Code protocol
|
|
||||||
//
|
|
||||||
Status = PxeBc->Stop (PxeBc);
|
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_NOT_STARTED) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (PxeBc);
|
|
||||||
|
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
|
||||||
NicHandle,
|
|
||||||
&gEfiPxeBaseCodeProtocolGuid,
|
|
||||||
&Private->PxeBc,
|
|
||||||
&gEfiLoadFileProtocolGuid,
|
|
||||||
&Private->LoadFile,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Udp4WriteChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
ControllerHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Udp4WriteChild
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Udp4ReadChild,
|
|
||||||
&gEfiUdp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
NicHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiUdp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Udp4ReadChild
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Dhcp4Child,
|
|
||||||
&gEfiDhcp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
NicHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiDhcp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Dhcp4Child
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Mtftp4Child,
|
|
||||||
&gEfiMtftp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
NicHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiMtftp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Mtftp4Child
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->Ip4Child,
|
|
||||||
&gEfiIp4ProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
NicHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiIp4ServiceBindingProtocolGuid,
|
|
||||||
Private->Ip4Child
|
|
||||||
);
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Private->ArpChild,
|
|
||||||
&gEfiArpProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
NicHandle
|
|
||||||
);
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
NicHandle,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
&gEfiArpServiceBindingProtocolGuid,
|
|
||||||
Private->ArpChild
|
|
||||||
);
|
|
||||||
|
|
||||||
FreePool (Private);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __EFI_PXEBC_DRIVER_H__
|
|
||||||
#define __EFI_PXEBC_DRIVER_H__
|
|
||||||
|
|
||||||
/**
|
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
|
||||||
is called by the EFI boot service ConnectController(). In
|
|
||||||
order to make drivers as small as possible, there are a few calling
|
|
||||||
restrictions for this service. ConnectController() must
|
|
||||||
follow these calling restrictions. If any other agent wishes to call
|
|
||||||
Supported() it must also follow these calling restrictions.
|
|
||||||
PxeBc requires DHCP4 and MTFTP4 protocols.
|
|
||||||
|
|
||||||
@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_SUCCESS 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
|
|
||||||
PxeBcDriverBindingSupported (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Start this driver on ControllerHandle. This service is called by the
|
|
||||||
EFI boot service ConnectController(). In order to make
|
|
||||||
drivers as small as possible, there are a few calling restrictions for
|
|
||||||
this service. ConnectController() must follow these
|
|
||||||
calling restrictions. If any other agent wishes to call Start() it
|
|
||||||
must also follow these calling restrictions.
|
|
||||||
|
|
||||||
@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_SUCCESS 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
|
|
||||||
PxeBcDriverBindingStart (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Stop this driver on ControllerHandle. This service is called by the
|
|
||||||
EFI boot service DisconnectController(). In order to
|
|
||||||
make drivers as small as possible, there are a few calling
|
|
||||||
restrictions for this service. DisconnectController()
|
|
||||||
must follow these calling restrictions. If any other agent wishes
|
|
||||||
to call Stop() it must also follow these calling restrictions.
|
|
||||||
|
|
||||||
@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_SUCCESS This driver is removed ControllerHandle
|
|
||||||
@retval other This driver was not removed from this device
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PxeBcDriverBindingStop (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN UINTN NumberOfChildren,
|
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2;
|
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName;
|
|
||||||
extern EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,189 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __EFI_PXEBC_IMPL_H__
|
|
||||||
#define __EFI_PXEBC_IMPL_H__
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
#include <Guid/SmBios.h>
|
|
||||||
#include <IndustryStandard/SmBios.h>
|
|
||||||
#include <IndustryStandard/Dhcp.h>
|
|
||||||
#include <Protocol/Dhcp4.h>
|
|
||||||
#include <Protocol/PxeBaseCode.h>
|
|
||||||
#include <Protocol/Mtftp4.h>
|
|
||||||
#include <Protocol/Udp4.h>
|
|
||||||
#include <Protocol/LoadFile.h>
|
|
||||||
#include <Protocol/NetworkInterfaceIdentifier.h>
|
|
||||||
#include <Protocol/PxeBaseCodeCallBack.h>
|
|
||||||
#include <Protocol/Arp.h>
|
|
||||||
#include <Protocol/Ip4.h>
|
|
||||||
#include <Protocol/Ip4Config2.h>
|
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/DevicePathLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/NetLib.h>
|
|
||||||
#include <Library/DpcLib.h>
|
|
||||||
#include <Library/PcdLib.h>
|
|
||||||
|
|
||||||
#include "PxeBcDriver.h"
|
|
||||||
#include "PxeBcDhcp.h"
|
|
||||||
#include "PxeBcMtftp.h"
|
|
||||||
#include "PxeBcSupport.h"
|
|
||||||
|
|
||||||
#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')
|
|
||||||
#define PXEBC_MTFTP_TIMEOUT 4
|
|
||||||
#define PXEBC_MTFTP_RETRIES 6
|
|
||||||
#define PXEBC_DEFAULT_UDP_OVERHEAD_SIZE 8
|
|
||||||
#define PXEBC_DEFAULT_TFTP_OVERHEAD_SIZE 4
|
|
||||||
#define PXEBC_DEFAULT_PACKET_SIZE 1480
|
|
||||||
#define PXEBC_DEFAULT_LIFETIME 50000 // 50ms, unit is microsecond
|
|
||||||
#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
|
|
||||||
|
|
||||||
struct _PXEBC_PRIVATE_DATA {
|
|
||||||
UINT32 Signature;
|
|
||||||
EFI_HANDLE Controller;
|
|
||||||
EFI_HANDLE Image;
|
|
||||||
EFI_HANDLE ArpChild;
|
|
||||||
EFI_HANDLE Dhcp4Child;
|
|
||||||
EFI_HANDLE Ip4Child;
|
|
||||||
EFI_HANDLE Mtftp4Child;
|
|
||||||
EFI_HANDLE Udp4ReadChild;
|
|
||||||
EFI_HANDLE Udp4WriteChild;
|
|
||||||
|
|
||||||
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;
|
|
||||||
|
|
||||||
EFI_PXE_BASE_CODE_PROTOCOL PxeBc;
|
|
||||||
EFI_LOAD_FILE_PROTOCOL LoadFile;
|
|
||||||
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL LoadFileCallback;
|
|
||||||
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *PxeBcCallback;
|
|
||||||
EFI_ARP_PROTOCOL *Arp;
|
|
||||||
EFI_DHCP4_PROTOCOL *Dhcp4;
|
|
||||||
EFI_IP4_PROTOCOL *Ip4;
|
|
||||||
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
|
|
||||||
EFI_IP4_CONFIG_DATA Ip4ConfigData;
|
|
||||||
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
||||||
EFI_UDP4_PROTOCOL *Udp4Read;
|
|
||||||
EFI_UDP4_PROTOCOL *Udp4Write;
|
|
||||||
UINT16 CurrentUdpSrcPort;
|
|
||||||
EFI_UDP4_CONFIG_DATA Udp4CfgData;
|
|
||||||
|
|
||||||
|
|
||||||
EFI_PXE_BASE_CODE_MODE Mode;
|
|
||||||
EFI_PXE_BASE_CODE_FUNCTION Function;
|
|
||||||
|
|
||||||
CHAR8 *BootFileName;
|
|
||||||
|
|
||||||
EFI_IP_ADDRESS StationIp;
|
|
||||||
EFI_IP_ADDRESS SubnetMask;
|
|
||||||
EFI_IP_ADDRESS GatewayIp;
|
|
||||||
EFI_IP_ADDRESS ServerIp;
|
|
||||||
BOOLEAN AddressIsOk;
|
|
||||||
UINT32 Ip4MaxPacketSize;
|
|
||||||
UINTN BlockSize;
|
|
||||||
UINTN FileSize;
|
|
||||||
|
|
||||||
UINT8 OptionBuffer[PXEBC_DHCP4_MAX_OPTION_SIZE];
|
|
||||||
EFI_DHCP4_PACKET SeedPacket;
|
|
||||||
EFI_MAC_ADDRESS Mac;
|
|
||||||
UINT8 MacLen;
|
|
||||||
|
|
||||||
BOOLEAN SortOffers;
|
|
||||||
BOOLEAN GotProxyOffer;
|
|
||||||
UINT32 NumOffers;
|
|
||||||
UINT32 SelectedOffer;
|
|
||||||
UINT32 ProxyOfferType;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cached packets as complements of pxe mode data
|
|
||||||
//
|
|
||||||
PXEBC_CACHED_DHCP4_PACKET ProxyOffer;
|
|
||||||
PXEBC_CACHED_DHCP4_PACKET Dhcp4Ack;
|
|
||||||
PXEBC_CACHED_DHCP4_PACKET PxeReply;
|
|
||||||
PXEBC_CACHED_DHCP4_PACKET Dhcp4Offers[PXEBC_MAX_OFFER_NUM];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Arrays for different types of offers:
|
|
||||||
// ServerCount records the count of the servers we got the offers,
|
|
||||||
// OfferIndex records the index of the offer sent by the server indexed by ServerCount.
|
|
||||||
//
|
|
||||||
UINT32 ServerCount[DHCP4_PACKET_TYPE_MAX];
|
|
||||||
UINT32 OfferIndex[DHCP4_PACKET_TYPE_MAX][PXEBC_MAX_OFFER_NUM];
|
|
||||||
UINT32 BootpIndex;
|
|
||||||
UINT32 ProxyIndex[DHCP4_PACKET_TYPE_MAX];
|
|
||||||
UINT32 BinlIndex[PXEBC_MAX_OFFER_NUM];
|
|
||||||
|
|
||||||
EFI_EVENT GetArpCacheEvent;
|
|
||||||
//
|
|
||||||
// token and event used to get ICMP error data from IP
|
|
||||||
//
|
|
||||||
EFI_IP4_COMPLETION_TOKEN IcmpErrorRcvToken;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
|
|
||||||
|
|
||||||
#define PXEBC_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, PXEBC_PRIVATE_DATA, LoadFile, PXEBC_PRIVATE_DATA_SIGNATURE)
|
|
||||||
|
|
||||||
#define PXEBC_PRIVATE_DATA_FROM_PXEBCCALLBACK(a) CR (a, PXEBC_PRIVATE_DATA, PxeBcCallback, PXEBC_PRIVATE_DATA_SIGNATURE)
|
|
||||||
|
|
||||||
extern EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate;
|
|
||||||
extern EFI_LOAD_FILE_PROTOCOL mLoadFileProtocolTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Causes the driver to load a specified file.
|
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
|
||||||
@param FilePath The device specific path of the file to load.
|
|
||||||
@param BootPolicy If TRUE, indicates that the request originates from the
|
|
||||||
boot manager is attempting to load FilePath as a boot
|
|
||||||
selection. If FALSE, then FilePath must match as exact file
|
|
||||||
to be loaded.
|
|
||||||
@param BufferSize On input the size of Buffer in bytes. On output with a return
|
|
||||||
code of EFI_SUCCESS, the amount of data transferred to
|
|
||||||
Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
|
|
||||||
the size of Buffer required to retrieve the requested file.
|
|
||||||
@param Buffer The memory buffer to transfer the file to. IF Buffer is NULL,
|
|
||||||
then no the size of the requested file is returned in
|
|
||||||
BufferSize.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The file was loaded.
|
|
||||||
@retval EFI_UNSUPPORTED The device does not support the provided BootPolicy
|
|
||||||
@retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
|
|
||||||
BufferSize is NULL.
|
|
||||||
@retval EFI_NO_MEDIA No medium was present to load the file.
|
|
||||||
@retval EFI_DEVICE_ERROR The file was not loaded due to a device error.
|
|
||||||
@retval EFI_NO_RESPONSE The remote system did not respond.
|
|
||||||
@retval EFI_NOT_FOUND The file was not found.
|
|
||||||
@retval EFI_ABORTED The file load process was manually cancelled.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
EfiPxeLoadFile (
|
|
||||||
IN EFI_LOAD_FILE_PROTOCOL * This,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * FilePath,
|
|
||||||
IN BOOLEAN BootPolicy,
|
|
||||||
IN OUT UINTN *BufferSize,
|
|
||||||
IN VOID *Buffer OPTIONAL
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,454 +0,0 @@
|
|||||||
/** @file
|
|
||||||
PxeBc MTFTP functions.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "PxeBcImpl.h"
|
|
||||||
|
|
||||||
CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
|
|
||||||
"blksize",
|
|
||||||
"timeout",
|
|
||||||
"tsize",
|
|
||||||
"multicast"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This is a callback function when packets received/transmitted in Mtftp driver.
|
|
||||||
|
|
||||||
A callback function that is provided by the caller to intercept
|
|
||||||
the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the
|
|
||||||
EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept
|
|
||||||
EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to
|
|
||||||
EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory().
|
|
||||||
|
|
||||||
@param This Pointer to Mtftp protocol instance
|
|
||||||
@param Token Pointer to Mtftp token
|
|
||||||
@param PacketLen Length of Mtftp packet
|
|
||||||
@param Packet Pointer to Mtftp packet
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operation sucess
|
|
||||||
@retval EFI_ABORTED Abort transfer process
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PxeBcCheckPacket (
|
|
||||||
IN EFI_MTFTP4_PROTOCOL *This,
|
|
||||||
IN EFI_MTFTP4_TOKEN *Token,
|
|
||||||
IN UINT16 PacketLen,
|
|
||||||
IN EFI_MTFTP4_PACKET *Packet
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PXEBC_PRIVATE_DATA *Private;
|
|
||||||
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *Callback;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Private = (PXEBC_PRIVATE_DATA *) Token->Context;
|
|
||||||
Callback = Private->PxeBcCallback;
|
|
||||||
Status = EFI_SUCCESS;
|
|
||||||
|
|
||||||
if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) {
|
|
||||||
Private->Mode.TftpErrorReceived = TRUE;
|
|
||||||
Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;
|
|
||||||
AsciiStrnCpyS (Private->Mode.TftpError.ErrorString, PXE_MTFTP_ERROR_STRING_LENGTH, (CHAR8 *) Packet->Error.ErrorMessage, PXE_MTFTP_ERROR_STRING_LENGTH - 1);
|
|
||||||
Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Callback != NULL) {
|
|
||||||
|
|
||||||
Status = Callback->Callback (
|
|
||||||
Callback,
|
|
||||||
Private->Function,
|
|
||||||
TRUE,
|
|
||||||
PacketLen,
|
|
||||||
(EFI_PXE_BASE_CODE_PACKET *) Packet
|
|
||||||
);
|
|
||||||
if (Status != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
|
|
||||||
|
|
||||||
Status = EFI_ABORTED;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get size of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Get the size of file success
|
|
||||||
@retval EFI_NOT_FOUND Parse the tftp ptions failed.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval Other Has not get the size of the file.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpGetFileSize (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN OUT UINT64 *BufferSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
||||||
EFI_MTFTP4_OPTION ReqOpt[2];
|
|
||||||
EFI_MTFTP4_PACKET *Packet;
|
|
||||||
EFI_MTFTP4_OPTION *Option;
|
|
||||||
UINT32 PktLen;
|
|
||||||
UINT8 OptBuf[128];
|
|
||||||
UINT32 OptCnt;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
*BufferSize = 0;
|
|
||||||
Status = EFI_DEVICE_ERROR;
|
|
||||||
Mtftp4 = Private->Mtftp4;
|
|
||||||
Packet = NULL;
|
|
||||||
Option = NULL;
|
|
||||||
PktLen = 0;
|
|
||||||
OptCnt = 1;
|
|
||||||
Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
|
|
||||||
|
|
||||||
Status = Mtftp4->Configure (Mtftp4, Config);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReqOpt[0].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_TSIZE_INDEX];
|
|
||||||
UtoA10 (0, (CHAR8 *) OptBuf, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
|
|
||||||
ReqOpt[0].ValueStr = OptBuf;
|
|
||||||
|
|
||||||
if (BlockSize != NULL) {
|
|
||||||
ReqOpt[1].OptionStr = (UINT8*)mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
|
|
||||||
ReqOpt[1].ValueStr = ReqOpt[0].ValueStr + AsciiStrLen ((CHAR8 *) ReqOpt[0].ValueStr) + 1;
|
|
||||||
UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[1].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX - (AsciiStrLen ((CHAR8 *) ReqOpt[0].ValueStr) + 1));
|
|
||||||
OptCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Mtftp4->GetInfo (
|
|
||||||
Mtftp4,
|
|
||||||
NULL,
|
|
||||||
Filename,
|
|
||||||
NULL,
|
|
||||||
(UINT8) OptCnt,
|
|
||||||
ReqOpt,
|
|
||||||
&PktLen,
|
|
||||||
&Packet
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
if (Status == EFI_TFTP_ERROR) {
|
|
||||||
Private->Mode.TftpErrorReceived = TRUE;
|
|
||||||
Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;
|
|
||||||
AsciiStrnCpyS (
|
|
||||||
Private->Mode.TftpError.ErrorString,
|
|
||||||
PXE_MTFTP_ERROR_STRING_LENGTH,
|
|
||||||
(CHAR8 *) Packet->Error.ErrorMessage,
|
|
||||||
PXE_MTFTP_ERROR_STRING_LENGTH - 1
|
|
||||||
);
|
|
||||||
Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';
|
|
||||||
}
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
OptCnt = 0;
|
|
||||||
|
|
||||||
Status = Mtftp4->ParseOptions (
|
|
||||||
Mtftp4,
|
|
||||||
PktLen,
|
|
||||||
Packet,
|
|
||||||
(UINT32 *) &OptCnt,
|
|
||||||
&Option
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
|
||||||
|
|
||||||
while (OptCnt != 0) {
|
|
||||||
|
|
||||||
if (AsciiStrnCmp ((CHAR8 *) Option[OptCnt - 1].OptionStr, "tsize", 5) == 0) {
|
|
||||||
|
|
||||||
*BufferSize = AtoU64 (Option[OptCnt - 1].ValueStr);
|
|
||||||
Status = EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
OptCnt--;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (Option);
|
|
||||||
|
|
||||||
ON_ERROR:
|
|
||||||
|
|
||||||
if (Packet != NULL) {
|
|
||||||
FreePool (Packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
Mtftp4->Configure (Mtftp4, NULL);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get data of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferPtr Pointer to buffer
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
@param DontUseBuffer Indicate whether with a receive buffer
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Read the data success from the special file.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Read data from file failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpReadFile (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize,
|
|
||||||
IN BOOLEAN DontUseBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
||||||
EFI_MTFTP4_TOKEN Token;
|
|
||||||
EFI_MTFTP4_OPTION ReqOpt[1];
|
|
||||||
UINT32 OptCnt;
|
|
||||||
UINT8 OptBuf[128];
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = EFI_DEVICE_ERROR;
|
|
||||||
Mtftp4 = Private->Mtftp4;
|
|
||||||
OptCnt = 0;
|
|
||||||
Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
|
|
||||||
|
|
||||||
Status = Mtftp4->Configure (Mtftp4, Config);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BlockSize != NULL) {
|
|
||||||
|
|
||||||
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
|
|
||||||
ReqOpt[0].ValueStr = OptBuf;
|
|
||||||
UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
|
|
||||||
OptCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Token.Event = NULL;
|
|
||||||
Token.OverrideData = NULL;
|
|
||||||
Token.Filename = Filename;
|
|
||||||
Token.ModeStr = NULL;
|
|
||||||
Token.OptionCount = OptCnt;
|
|
||||||
Token.OptionList = ReqOpt;
|
|
||||||
Token.Context = Private;
|
|
||||||
|
|
||||||
if (DontUseBuffer) {
|
|
||||||
Token.BufferSize = 0;
|
|
||||||
Token.Buffer = NULL;
|
|
||||||
} else {
|
|
||||||
Token.BufferSize = *BufferSize;
|
|
||||||
Token.Buffer = BufferPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Token.CheckPacket = PxeBcCheckPacket;
|
|
||||||
Token.TimeoutCallback = NULL;
|
|
||||||
Token.PacketNeeded = NULL;
|
|
||||||
|
|
||||||
Status = Mtftp4->ReadFile (Mtftp4, &Token);
|
|
||||||
|
|
||||||
*BufferSize = Token.BufferSize;
|
|
||||||
|
|
||||||
Mtftp4->Configure (Mtftp4, NULL);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is put data of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param Overwrite Indicate whether with overwrite attribute
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferPtr Pointer to buffer
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Write the data success into the special file.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Write data into file failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpWriteFile (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN BOOLEAN Overwrite,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
||||||
EFI_MTFTP4_TOKEN Token;
|
|
||||||
EFI_MTFTP4_OPTION ReqOpt[1];
|
|
||||||
UINT32 OptCnt;
|
|
||||||
UINT8 OptBuf[128];
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = EFI_DEVICE_ERROR;
|
|
||||||
Mtftp4 = Private->Mtftp4;
|
|
||||||
OptCnt = 0;
|
|
||||||
Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
|
|
||||||
|
|
||||||
Status = Mtftp4->Configure (Mtftp4, Config);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BlockSize != NULL) {
|
|
||||||
|
|
||||||
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
|
|
||||||
ReqOpt[0].ValueStr = OptBuf;
|
|
||||||
UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
|
|
||||||
OptCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Token.Event = NULL;
|
|
||||||
Token.OverrideData = NULL;
|
|
||||||
Token.Filename = Filename;
|
|
||||||
Token.ModeStr = NULL;
|
|
||||||
Token.OptionCount = OptCnt;
|
|
||||||
Token.OptionList = ReqOpt;
|
|
||||||
Token.BufferSize = *BufferSize;
|
|
||||||
Token.Buffer = BufferPtr;
|
|
||||||
Token.CheckPacket = PxeBcCheckPacket;
|
|
||||||
Token.TimeoutCallback = NULL;
|
|
||||||
Token.PacketNeeded = NULL;
|
|
||||||
|
|
||||||
Status = Mtftp4->WriteFile (Mtftp4, &Token);
|
|
||||||
*BufferSize = Token.BufferSize;
|
|
||||||
|
|
||||||
Mtftp4->Configure (Mtftp4, NULL);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get data(file) from a directory(may be a server) by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
@param Config Pointer to Mtftp configuration data.
|
|
||||||
@param Filename Pointer to file name.
|
|
||||||
@param BlockSize Pointer to block size.
|
|
||||||
@param BufferPtr Pointer to buffer.
|
|
||||||
@param BufferSize Pointer to buffer size.
|
|
||||||
@param DontUseBuffer Indicate whether with a receive buffer.
|
|
||||||
|
|
||||||
@retval EFI_SUCCES Get the data from the file included in directory success.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Operation failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpReadDirectory (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize,
|
|
||||||
IN BOOLEAN DontUseBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_MTFTP4_PROTOCOL *Mtftp4;
|
|
||||||
EFI_MTFTP4_TOKEN Token;
|
|
||||||
EFI_MTFTP4_OPTION ReqOpt[1];
|
|
||||||
UINT32 OptCnt;
|
|
||||||
UINT8 OptBuf[128];
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = EFI_DEVICE_ERROR;
|
|
||||||
Mtftp4 = Private->Mtftp4;
|
|
||||||
OptCnt = 0;
|
|
||||||
Config->InitialServerPort = PXEBC_BS_DOWNLOAD_PORT;
|
|
||||||
|
|
||||||
Status = Mtftp4->Configure (Mtftp4, Config);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BlockSize != NULL) {
|
|
||||||
|
|
||||||
ReqOpt[0].OptionStr = (UINT8*) mMtftpOptions[PXE_MTFTP_OPTION_BLKSIZE_INDEX];
|
|
||||||
ReqOpt[0].ValueStr = OptBuf;
|
|
||||||
UtoA10 (*BlockSize, (CHAR8 *) ReqOpt[0].ValueStr, PXE_MTFTP_OPTBUF_MAXNUM_INDEX);
|
|
||||||
OptCnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Token.Event = NULL;
|
|
||||||
Token.OverrideData = NULL;
|
|
||||||
Token.Filename = Filename;
|
|
||||||
Token.ModeStr = NULL;
|
|
||||||
Token.OptionCount = OptCnt;
|
|
||||||
Token.OptionList = ReqOpt;
|
|
||||||
Token.Context = Private;
|
|
||||||
|
|
||||||
if (DontUseBuffer) {
|
|
||||||
Token.BufferSize = 0;
|
|
||||||
Token.Buffer = NULL;
|
|
||||||
} else {
|
|
||||||
Token.BufferSize = *BufferSize;
|
|
||||||
Token.Buffer = BufferPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Token.CheckPacket = PxeBcCheckPacket;
|
|
||||||
Token.TimeoutCallback = NULL;
|
|
||||||
Token.PacketNeeded = NULL;
|
|
||||||
|
|
||||||
Status = Mtftp4->ReadDirectory (Mtftp4, &Token);
|
|
||||||
|
|
||||||
*BufferSize = Token.BufferSize;
|
|
||||||
|
|
||||||
Mtftp4->Configure (Mtftp4, NULL);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
@ -1,137 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Mtftp routines for PxeBc.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __EFI_PXEBC_MTFTP_H__
|
|
||||||
#define __EFI_PXEBC_MTFTP_H__
|
|
||||||
|
|
||||||
#define PXE_MTFTP_OPTION_BLKSIZE_INDEX 0
|
|
||||||
#define PXE_MTFTP_OPTION_TIMEOUT_INDEX 1
|
|
||||||
#define PXE_MTFTP_OPTION_TSIZE_INDEX 2
|
|
||||||
#define PXE_MTFTP_OPTION_MULTICAST_INDEX 3
|
|
||||||
#define PXE_MTFTP_OPTION_MAXIMUM_INDEX 4
|
|
||||||
|
|
||||||
#define PXE_MTFTP_ERROR_STRING_LENGTH 127
|
|
||||||
#define PXE_MTFTP_OPTBUF_MAXNUM_INDEX 128
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get size of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Get the size of file success
|
|
||||||
@retval EFI_NOT_FOUND Parse the tftp ptions failed.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval Other Has not get the size of the file.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpGetFileSize (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN OUT UINT64 *BufferSize
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get data of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferPtr Pointer to buffer
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
@param DontUseBuffer Indicate whether with a receive buffer
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Read the data success from the special file.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Read data from file failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpReadFile (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize,
|
|
||||||
IN BOOLEAN DontUseBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is put data of a file by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data
|
|
||||||
@param Config Pointer to Mtftp configuration data
|
|
||||||
@param Filename Pointer to file name
|
|
||||||
@param Overwrite Indicate whether with overwrite attribute
|
|
||||||
@param BlockSize Pointer to block size
|
|
||||||
@param BufferPtr Pointer to buffer
|
|
||||||
@param BufferSize Pointer to buffer size
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Write the data success into the special file.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Write data into file failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpWriteFile (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN BOOLEAN Overwrite,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to get data(file) from a directory(may be a server) by Tftp.
|
|
||||||
|
|
||||||
@param Private Pointer to PxeBc private data.
|
|
||||||
@param Config Pointer to Mtftp configuration data.
|
|
||||||
@param Filename Pointer to file name.
|
|
||||||
@param BlockSize Pointer to block size.
|
|
||||||
@param BufferPtr Pointer to buffer.
|
|
||||||
@param BufferSize Pointer to buffer size.
|
|
||||||
@param DontUseBuffer Indicate whether with a receive buffer.
|
|
||||||
|
|
||||||
@retval EFI_SUCCES Get the data from the file included in directory success.
|
|
||||||
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
|
|
||||||
@retval other Operation failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcTftpReadDirectory (
|
|
||||||
IN PXEBC_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_MTFTP4_CONFIG_DATA *Config,
|
|
||||||
IN UINT8 *Filename,
|
|
||||||
IN UINTN *BlockSize,
|
|
||||||
IN UINT8 *BufferPtr,
|
|
||||||
IN OUT UINT64 *BufferSize,
|
|
||||||
IN BOOLEAN DontUseBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,221 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Support routines for PxeBc.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
#include "PxeBcImpl.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
The common notify function associated with various PxeBc events.
|
|
||||||
|
|
||||||
@param Event The event signaled.
|
|
||||||
@param Context The context.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
PxeBcCommonNotify (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
)
|
|
||||||
{
|
|
||||||
*((BOOLEAN *) Context) = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function initialize(or configure) the Udp4Write instance.
|
|
||||||
|
|
||||||
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
|
|
||||||
@param StationIp Pointer to the station ip address.
|
|
||||||
@param SubnetMask Pointer to the subnetmask of the station ip address.
|
|
||||||
@param Gateway Pointer to the gateway ip address.
|
|
||||||
@param SrcPort Pointer to the srouce port of the station.
|
|
||||||
@param Ttl The time to live field of the IP header.
|
|
||||||
@param ToS The type of service field of the IP header.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
|
|
||||||
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
|
|
||||||
RARP, etc.) is not finished yet.
|
|
||||||
@retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
|
|
||||||
@retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
|
|
||||||
and must be stopped/reset before it can be reconfigured.
|
|
||||||
@retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
|
|
||||||
and UdpConfigData.StationPort is already used by
|
|
||||||
other instance.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
|
|
||||||
EFI UDPv4 Protocol instance.
|
|
||||||
@retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
|
|
||||||
was not opened.
|
|
||||||
@retval Others Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcConfigureUdpWriteInstance (
|
|
||||||
IN EFI_UDP4_PROTOCOL *Udp4,
|
|
||||||
IN EFI_IPv4_ADDRESS *StationIp,
|
|
||||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
|
||||||
IN EFI_IPv4_ADDRESS *Gateway,
|
|
||||||
IN OUT UINT16 *SrcPort,
|
|
||||||
IN UINT8 Ttl,
|
|
||||||
IN UINT8 ToS
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_UDP4_CONFIG_DATA Udp4CfgData;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData));
|
|
||||||
|
|
||||||
Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
|
|
||||||
Udp4CfgData.TypeOfService = ToS;
|
|
||||||
Udp4CfgData.TimeToLive = Ttl;
|
|
||||||
Udp4CfgData.AllowDuplicatePort = TRUE;
|
|
||||||
|
|
||||||
CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));
|
|
||||||
CopyMem (&Udp4CfgData.SubnetMask, SubnetMask, sizeof (*SubnetMask));
|
|
||||||
|
|
||||||
Udp4CfgData.StationPort = *SrcPort;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reset the instance.
|
|
||||||
//
|
|
||||||
Udp4->Configure (Udp4, NULL);
|
|
||||||
|
|
||||||
Status = Udp4->Configure (Udp4, &Udp4CfgData);
|
|
||||||
if (!EFI_ERROR (Status) && (Gateway->Addr[0] != 0)) {
|
|
||||||
//
|
|
||||||
// basic configuration OK, need to add the default route entry
|
|
||||||
//
|
|
||||||
Status = Udp4->Routes (Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// roll back
|
|
||||||
//
|
|
||||||
Udp4->Configure (Udp4, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && (*SrcPort == 0)) {
|
|
||||||
Udp4->GetModeData (Udp4, &Udp4CfgData, NULL, NULL, NULL);
|
|
||||||
*SrcPort = Udp4CfgData.StationPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to display the IPv4 address.
|
|
||||||
|
|
||||||
@param[in] Ip The pointer to the IPv4 address.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
PxeBcShowIp4Addr (
|
|
||||||
IN EFI_IPv4_ADDRESS *Ip
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Index;
|
|
||||||
|
|
||||||
for (Index = 0; Index < 4; Index++) {
|
|
||||||
AsciiPrint ("%d", Ip->Addr[Index]);
|
|
||||||
if (Index < 3) {
|
|
||||||
AsciiPrint (".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert number to ASCII value.
|
|
||||||
|
|
||||||
@param Number Numeric value to convert to decimal ASCII value.
|
|
||||||
@param Buffer Buffer to place ASCII version of the Number.
|
|
||||||
@param Length Length of Buffer.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
CvtNum (
|
|
||||||
IN UINTN Number,
|
|
||||||
IN UINT8 *Buffer,
|
|
||||||
IN UINTN Length
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Remainder;
|
|
||||||
|
|
||||||
for (; Length > 0; Length--) {
|
|
||||||
Remainder = Number % 10;
|
|
||||||
Number /= 10;
|
|
||||||
Buffer[Length - 1] = (UINT8) ('0' + Remainder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert unsigned int number to decimal number.
|
|
||||||
|
|
||||||
@param Number The unsigned int number will be converted.
|
|
||||||
@param Buffer Pointer to the buffer to store the decimal number after transform.
|
|
||||||
@param[in] BufferSize The maxsize of the buffer.
|
|
||||||
|
|
||||||
@return the length of the number after transform.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINTN
|
|
||||||
UtoA10 (
|
|
||||||
IN UINTN Number,
|
|
||||||
IN CHAR8 *Buffer,
|
|
||||||
IN UINTN BufferSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Index;
|
|
||||||
CHAR8 TempStr[64];
|
|
||||||
|
|
||||||
Index = 63;
|
|
||||||
TempStr[Index] = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
Index--;
|
|
||||||
TempStr[Index] = (CHAR8) ('0' + (Number % 10));
|
|
||||||
Number = Number / 10;
|
|
||||||
} while (Number != 0);
|
|
||||||
|
|
||||||
AsciiStrCpyS (Buffer, BufferSize, &TempStr[Index]);
|
|
||||||
|
|
||||||
return AsciiStrLen (Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert ASCII numeric string to a UINTN value.
|
|
||||||
|
|
||||||
@param Buffer Pointer to the 8-byte unsigned int value.
|
|
||||||
|
|
||||||
@return UINTN value of the ASCII string.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT64
|
|
||||||
AtoU64 (
|
|
||||||
IN UINT8 *Buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINT64 Value;
|
|
||||||
UINT8 Character;
|
|
||||||
|
|
||||||
Value = 0;
|
|
||||||
while ((Character = *Buffer++) != '\0') {
|
|
||||||
Value = MultU64x32 (Value, 10) + (Character - '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
|
|
@ -1,134 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Support routines for PxeBc.
|
|
||||||
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __EFI_PXEBC_SUPPORT_H__
|
|
||||||
#define __EFI_PXEBC_SUPPORT_H__
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
The common notify function associated with various PxeBc events.
|
|
||||||
|
|
||||||
@param Event The event signaled.
|
|
||||||
@param Context The context.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
PxeBcCommonNotify (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function initialize(or configure) the Udp4Write instance.
|
|
||||||
|
|
||||||
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
|
|
||||||
@param StationIp Pointer to the station ip address.
|
|
||||||
@param SubnetMask Pointer to the subnetmask of the station ip address.
|
|
||||||
@param Gateway Pointer to the gateway ip address.
|
|
||||||
@param SrcPort Pointer to the srouce port of the station.
|
|
||||||
@param Ttl The time to live field of the IP header.
|
|
||||||
@param ToS The type of service field of the IP header.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
|
|
||||||
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
|
|
||||||
RARP, etc.) is not finished yet.
|
|
||||||
@retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
|
|
||||||
@retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
|
|
||||||
and must be stopped/reset before it can be reconfigured.
|
|
||||||
@retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
|
|
||||||
and UdpConfigData.StationPort is already used by
|
|
||||||
other instance.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
|
|
||||||
EFI UDPv4 Protocol instance.
|
|
||||||
@retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
|
|
||||||
was not opened.
|
|
||||||
@retval Others Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
PxeBcConfigureUdpWriteInstance (
|
|
||||||
IN EFI_UDP4_PROTOCOL *Udp4,
|
|
||||||
IN EFI_IPv4_ADDRESS *StationIp,
|
|
||||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
|
||||||
IN EFI_IPv4_ADDRESS *Gateway,
|
|
||||||
IN OUT UINT16 *SrcPort,
|
|
||||||
IN UINT8 Ttl,
|
|
||||||
IN UINT8 ToS
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is to display the IPv4 address.
|
|
||||||
|
|
||||||
@param[in] Ip The pointer to the IPv4 address.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
PxeBcShowIp4Addr (
|
|
||||||
IN EFI_IPv4_ADDRESS *Ip
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert number to ASCII value.
|
|
||||||
|
|
||||||
@param Number Numeric value to convert to decimal ASCII value.
|
|
||||||
@param Buffer Buffer to place ASCII version of the Number.
|
|
||||||
@param Length Length of Buffer.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
CvtNum (
|
|
||||||
IN UINTN Number,
|
|
||||||
IN UINT8 *Buffer,
|
|
||||||
IN UINTN Length
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert unsigned int number to decimal number.
|
|
||||||
|
|
||||||
@param Number The unsigned int number will be converted.
|
|
||||||
@param Buffer Pointer to the buffer to store the decimal number after transform.
|
|
||||||
@param[in] BufferSize The maxsize of the buffer.
|
|
||||||
|
|
||||||
@return the length of the number after transform.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINTN
|
|
||||||
UtoA10 (
|
|
||||||
IN UINTN Number,
|
|
||||||
IN CHAR8 *Buffer,
|
|
||||||
IN UINTN BufferSize
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert ASCII numeric string to a UINTN value.
|
|
||||||
|
|
||||||
@param Buffer Pointer to the 8-byte unsigned int value.
|
|
||||||
|
|
||||||
@return UINTN value of the ASCII string.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT64
|
|
||||||
AtoU64 (
|
|
||||||
IN UINT8 *Buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
// /** @file
|
|
||||||
// This module produces EFI Preboot Execution Environment (PXE) Base Code Protocol.
|
|
||||||
//
|
|
||||||
// This module produces EFI PXE Base Code Protocol upon EFI MMP Protocl and IPv4
|
|
||||||
// network stack, used to control PXE-compatible devices. It produces EFI Load File
|
|
||||||
// Protocol to provide one clean way to otain control from the boot manager if the
|
|
||||||
// boot patch is from the remote device.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// **/
|
|
||||||
|
|
||||||
|
|
||||||
#string STR_MODULE_ABSTRACT #language en-US "Produces EFI Preboot Execution Environment (PXE) Base Code Protocol"
|
|
||||||
|
|
||||||
#string STR_MODULE_DESCRIPTION #language en-US "This module produces EFI PXE Base Code Protocol upon the EFI MMP Protocol and the IPv4 network stack, and is used to control PXE-compatible devices. It produces the EFI Load File Protocol to provide a clean method to obtain control from the boot manager if the boot patch is from the remote device."
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
// /** @file
|
|
||||||
// UefiPxe4BcDxe Localized Strings and Content
|
|
||||||
//
|
|
||||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// **/
|
|
||||||
|
|
||||||
#string STR_PROPERTIES_MODULE_NAME
|
|
||||||
#language en-US
|
|
||||||
"UEFI PXE Base Code DXE Driver"
|
|
||||||
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
## @file
|
|
||||||
# This module produces EFI Preboot Execution Environment (PXE) Base Code Protocol.
|
|
||||||
#
|
|
||||||
# This module produces EFI PXE Base Code Protocol upon EFI MMP Protocl and IPv4
|
|
||||||
# network stack, used to control PXE-compatible devices. It produces EFI Load File
|
|
||||||
# Protocol to provide one clean way to otain control from the boot manager if the
|
|
||||||
# boot patch is from the remote device. This driver only supports IPv4 network stack.
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# 1) This driver can't co-work with the UefiPxeBcDxe driver in NetworkPkg.
|
|
||||||
# 2) This driver might have some issues that have been fixed in the UefiPxeBcDxe
|
|
||||||
# driver in NetworkPkg.
|
|
||||||
# 3) This driver supports fewer features than the UefiPxeBcDxe driver in NetworkPkg
|
|
||||||
# (e.g. IPv6, MTFTP windowsize).
|
|
||||||
# 4) UefiPxeBcDxe driver in NetworkPkg is recommended for use instead of this one even
|
|
||||||
# though both of them can be used.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x00010005
|
|
||||||
BASE_NAME = UefiPxe4BcDxe
|
|
||||||
MODULE_UNI_FILE = UefiPxe4BcDxe.uni
|
|
||||||
FILE_GUID = 3B1DEAB5-C75D-442e-9238-8E2FFB62B0BB
|
|
||||||
MODULE_TYPE = UEFI_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
ENTRY_POINT = PxeBcDriverEntryPoint
|
|
||||||
UNLOAD_IMAGE = NetLibDefaultUnload
|
|
||||||
|
|
||||||
#
|
|
||||||
# The following information is for reference only and not required by the build tools.
|
|
||||||
#
|
|
||||||
# VALID_ARCHITECTURES = IA32 X64
|
|
||||||
#
|
|
||||||
# DRIVER_BINDING = gPxeBcDriverBinding
|
|
||||||
# COMPONENT_NAME = gPxeBcComponentName
|
|
||||||
# COMPONENT_NAME2 = gPxeBcComponentName2
|
|
||||||
#
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
PxeBcMtftp.c
|
|
||||||
PxeBcSupport.h
|
|
||||||
PxeBcSupport.c
|
|
||||||
PxeBcDriver.c
|
|
||||||
PxeBcDhcp.h
|
|
||||||
ComponentName.c
|
|
||||||
PxeBcImpl.c
|
|
||||||
PxeBcImpl.h
|
|
||||||
PxeBcDhcp.c
|
|
||||||
PxeBcMtftp.h
|
|
||||||
PxeBcDriver.h
|
|
||||||
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
UefiLib
|
|
||||||
UefiBootServicesTableLib
|
|
||||||
UefiDriverEntryPoint
|
|
||||||
BaseMemoryLib
|
|
||||||
MemoryAllocationLib
|
|
||||||
DebugLib
|
|
||||||
NetLib
|
|
||||||
DpcLib
|
|
||||||
PcdLib
|
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gEfiPxeBaseCodeCallbackProtocolGuid ## SOMETIMES_PRODUCES
|
|
||||||
gEfiPxeBaseCodeProtocolGuid ## BY_START
|
|
||||||
gEfiLoadFileProtocolGuid ## BY_START
|
|
||||||
gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## SOMETIMES_CONSUMES
|
|
||||||
gEfiArpServiceBindingProtocolGuid ## TO_START
|
|
||||||
gEfiArpProtocolGuid ## TO_START
|
|
||||||
gEfiMtftp4ServiceBindingProtocolGuid ## TO_START
|
|
||||||
gEfiMtftp4ProtocolGuid ## TO_START
|
|
||||||
gEfiUdp4ServiceBindingProtocolGuid ## TO_START
|
|
||||||
gEfiUdp4ProtocolGuid ## TO_START
|
|
||||||
gEfiDhcp4ServiceBindingProtocolGuid ## TO_START
|
|
||||||
gEfiDhcp4ProtocolGuid ## TO_START
|
|
||||||
gEfiIp4ServiceBindingProtocolGuid ## TO_START
|
|
||||||
gEfiIp4ProtocolGuid ## TO_START
|
|
||||||
gEfiIp4Config2ProtocolGuid ## TO_START
|
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize ## SOMETIMES_CONSUMES
|
|
||||||
|
|
||||||
[UserExtensions.TianoCore."ExtraFiles"]
|
|
||||||
UefiPxe4BcDxeExtra.uni
|
|
Loading…
x
Reference in New Issue
Block a user