Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4006 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-30 03:08:02 +00:00
parent 5bca971e54
commit 83cbd279b6
68 changed files with 11129 additions and 9421 deletions

View File

@ -1,30 +1,30 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpDebug.h
Abstract:
**/
#ifndef _ARP_DEBUG_H_
#define _ARP_DEBUG_H_
#define ARP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Arp", PrintArg)
#define ARP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Arp", PrintArg)
#define ARP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Arp", PrintArg)
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpDebug.h
Abstract:
**/
#ifndef _ARP_DEBUG_H_
#define _ARP_DEBUG_H_
#define ARP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Arp", PrintArg)
#define ARP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Arp", PrintArg)
#define ARP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Arp", PrintArg)
#endif

View File

@ -749,14 +749,13 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gArpDriverBinding,
ImageHandle,
&gArpComponentName,
NULL,
NULL
&gArpComponentName2
);
}

View File

@ -1,84 +1,85 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpDriver.c
Abstract:
**/
#ifndef _ARP_DRIVER_H_
#define _ARP_DRIVER_H_
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpDriver.c
Abstract:
**/
#ifndef _ARP_DRIVER_H_
#define _ARP_DRIVER_H_
#include <PiDxe.h>
#include <Protocol/Arp.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include "ArpDebug.h"
//
// Global variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gArpComponentName;
EFI_STATUS
EFIAPI
ArpDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
ArpDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
ArpDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
ArpServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
ArpServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
#include <Library/UefiLib.h>
#include "ArpDebug.h"
//
// Global variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gArpComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2;
EFI_STATUS
EFIAPI
ArpDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
ArpDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
ArpDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
ArpServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
ArpServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,341 +1,341 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpImpl.h
Abstract:
**/
#ifndef _ARP_IMPL_H_
#define _ARP_IMPL_H_
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ArpImpl.h
Abstract:
**/
#ifndef _ARP_IMPL_H_
#define _ARP_IMPL_H_
#include <PiDxe.h>
#include <Protocol/Arp.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "ArpDebug.h"
#define ARP_ETHER_PROTO_TYPE 0x0806
#define IPv4_ETHER_PROTO_TYPE 0x0800
#define IPv6_ETHER_PROTO_TYPE 0x86DD
#define ARP_OPCODE_REQUEST 0x0001
#define ARP_OPCODE_REPLY 0x0002
#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)
#define ARP_DEFAULT_RETRY_COUNT 2
#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)
#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)
#pragma pack(1)
typedef struct _ARP_HEAD {
UINT16 HwType;
UINT16 ProtoType;
UINT8 HwAddrLen;
UINT8 ProtoAddrLen;
UINT16 OpCode;
} ARP_HEAD;
#pragma pack()
typedef struct _ARP_ADDRESS {
UINT8 *SenderHwAddr;
UINT8 *SenderProtoAddr;
UINT8 *TargetHwAddr;
UINT8 *TargetProtoAddr;
} ARP_ADDRESS;
#define MATCH_SW_ADDRESS 0x1
#define MATCH_HW_ADDRESS 0x2
typedef enum {
ByNone = 0,
ByProtoAddress = MATCH_SW_ADDRESS,
ByHwAddress = MATCH_HW_ADDRESS,
ByBoth = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
} FIND_OPTYPE;
#define ARP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'I')
#define ARP_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
ARP_INSTANCE_DATA, \
ArpProto, \
ARP_INSTANCE_DATA_SIGNATURE \
)
typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;
typedef struct _ARP_INSTANCE_DATA {
UINT32 Signature;
ARP_SERVICE_DATA *ArpService;
EFI_HANDLE Handle;
EFI_ARP_PROTOCOL ArpProto;
NET_LIST_ENTRY List;
EFI_ARP_CONFIG_DATA ConfigData;
BOOLEAN Configured;
BOOLEAN Destroyed;
} ARP_INSTANCE_DATA;
#define ARP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'S')
#define ARP_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
ARP_SERVICE_DATA, \
ServiceBinding, \
ARP_SERVICE_DATA_SIGNATURE \
)
struct _ARP_SERVICE_DATA {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_HANDLE MnpChildHandle;
EFI_HANDLE ImageHandle;
EFI_HANDLE ControllerHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN RxToken;
EFI_SIMPLE_NETWORK_MODE SnpMode;
NET_LOCK Lock;
UINTN ChildrenNumber;
NET_LIST_ENTRY ChildrenList;
NET_LIST_ENTRY PendingRequestTable;
NET_LIST_ENTRY DeniedCacheTable;
NET_LIST_ENTRY ResolvedCacheTable;
EFI_EVENT PeriodicTimer;
};
typedef struct _USER_REQUEST_CONTEXT {
NET_LIST_ENTRY List;
ARP_INSTANCE_DATA *Instance;
EFI_EVENT UserRequestEvent;
VOID *UserHwAddrBuffer;
} USER_REQUEST_CONTEXT;
#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)
#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)
typedef struct _NET_ARP_ADDRESS {
UINT16 Type;
UINT8 Length;
UINT8 *AddressPtr;
union {
UINT8 ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
UINT8 HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
} Buffer;
} NET_ARP_ADDRESS;
typedef enum {
Hardware,
Protocol
} ARP_ADDRESS_TYPE;
typedef struct _ARP_CACHE_ENTRY {
NET_LIST_ENTRY List;
UINT32 RetryCount;
UINT32 DefaultDecayTime;
UINT32 DecayTime;
UINT32 NextRetryTime;
NET_ARP_ADDRESS Addresses[2];
NET_LIST_ENTRY UserRequestList;
} ARP_CACHE_ENTRY;
EFI_STATUS
EFIAPI
ArpConfigure (
IN EFI_ARP_PROTOCOL *This,
IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
ArpAdd (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN DenyFlag,
IN VOID *TargetSwAddress OPTIONAL,
IN VOID *TargetHwAddress OPTIONAL,
IN UINT32 TimeoutValue,
IN BOOLEAN Overwrite
);
EFI_STATUS
EFIAPI
ArpFind (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL,
OUT UINT32 *EntryLength OPTIONAL,
OUT UINT32 *EntryCount OPTIONAL,
OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
IN BOOLEAN Refresh
);
EFI_STATUS
EFIAPI
ArpDelete (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL
);
EFI_STATUS
EFIAPI
ArpFlush (
IN EFI_ARP_PROTOCOL *This
);
EFI_STATUS
EFIAPI
ArpRequest (
IN EFI_ARP_PROTOCOL *This,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT ResolvedEvent OPTIONAL,
OUT VOID *TargetHwAddress
);
EFI_STATUS
EFIAPI
ArpCancel (
IN EFI_ARP_PROTOCOL *This,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT ResolvedEvent OPTIONAL
);
EFI_STATUS
ArpConfigureInstance (
IN ARP_INSTANCE_DATA *Instance,
IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
);
ARP_CACHE_ENTRY *
ArpFindDeniedCacheEntry (
IN ARP_SERVICE_DATA *ArpService,
IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
);
ARP_CACHE_ENTRY *
ArpFindNextCacheEntryInTable (
IN NET_LIST_ENTRY *CacheTable,
IN NET_LIST_ENTRY *StartEntry,
IN FIND_OPTYPE FindOpType,
IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
);
ARP_CACHE_ENTRY *
ArpAllocCacheEntry (
IN ARP_INSTANCE_DATA *Instance
);
VOID
ArpFillAddressInCacheEntry (
IN ARP_CACHE_ENTRY *CacheEntry,
IN NET_ARP_ADDRESS *HwAddr OPTIONAL,
IN NET_ARP_ADDRESS *SwAddr OPTIONAL
);
UINTN
ArpAddressResolved (
IN ARP_CACHE_ENTRY *CacheEntry,
IN ARP_INSTANCE_DATA *Instance OPTIONAL,
IN EFI_EVENT UserEvent OPTIONAL
);
UINTN
ArpDeleteCacheEntry (
IN ARP_INSTANCE_DATA *Instance,
IN BOOLEAN BySwAddress,
IN UINT8 *AddressBuffer OPTIONAL,
IN BOOLEAN Force
);
VOID
ArpSendFrame (
IN ARP_INSTANCE_DATA *Instance,
IN ARP_CACHE_ENTRY *CacheEntry,
IN UINT16 ArpOpCode
);
VOID
ArpInitInstance (
IN ARP_SERVICE_DATA *ArpService,
IN ARP_INSTANCE_DATA *Instance
);
VOID
EFIAPI
ArpOnFrameRcvd (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
ArpOnFrameSent (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
ArpTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
);
UINTN
ArpCancelRequest (
IN ARP_INSTANCE_DATA *Instance,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT UserEvent OPTIONAL
);
EFI_STATUS
ArpFindCacheEntry (
IN ARP_INSTANCE_DATA *Instance,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL,
OUT UINT32 *EntryLength OPTIONAL,
OUT UINT32 *EntryCount OPTIONAL,
OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
IN BOOLEAN Refresh
);
#endif
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "ArpDebug.h"
#define ARP_ETHER_PROTO_TYPE 0x0806
#define IPv4_ETHER_PROTO_TYPE 0x0800
#define IPv6_ETHER_PROTO_TYPE 0x86DD
#define ARP_OPCODE_REQUEST 0x0001
#define ARP_OPCODE_REPLY 0x0002
#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)
#define ARP_DEFAULT_RETRY_COUNT 2
#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)
#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)
#pragma pack(1)
typedef struct _ARP_HEAD {
UINT16 HwType;
UINT16 ProtoType;
UINT8 HwAddrLen;
UINT8 ProtoAddrLen;
UINT16 OpCode;
} ARP_HEAD;
#pragma pack()
typedef struct _ARP_ADDRESS {
UINT8 *SenderHwAddr;
UINT8 *SenderProtoAddr;
UINT8 *TargetHwAddr;
UINT8 *TargetProtoAddr;
} ARP_ADDRESS;
#define MATCH_SW_ADDRESS 0x1
#define MATCH_HW_ADDRESS 0x2
typedef enum {
ByNone = 0,
ByProtoAddress = MATCH_SW_ADDRESS,
ByHwAddress = MATCH_HW_ADDRESS,
ByBoth = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
} FIND_OPTYPE;
#define ARP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'I')
#define ARP_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
ARP_INSTANCE_DATA, \
ArpProto, \
ARP_INSTANCE_DATA_SIGNATURE \
)
typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;
typedef struct _ARP_INSTANCE_DATA {
UINT32 Signature;
ARP_SERVICE_DATA *ArpService;
EFI_HANDLE Handle;
EFI_ARP_PROTOCOL ArpProto;
NET_LIST_ENTRY List;
EFI_ARP_CONFIG_DATA ConfigData;
BOOLEAN Configured;
BOOLEAN Destroyed;
} ARP_INSTANCE_DATA;
#define ARP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('A', 'R', 'P', 'S')
#define ARP_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
ARP_SERVICE_DATA, \
ServiceBinding, \
ARP_SERVICE_DATA_SIGNATURE \
)
struct _ARP_SERVICE_DATA {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_HANDLE MnpChildHandle;
EFI_HANDLE ImageHandle;
EFI_HANDLE ControllerHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN RxToken;
EFI_SIMPLE_NETWORK_MODE SnpMode;
NET_LOCK Lock;
UINTN ChildrenNumber;
NET_LIST_ENTRY ChildrenList;
NET_LIST_ENTRY PendingRequestTable;
NET_LIST_ENTRY DeniedCacheTable;
NET_LIST_ENTRY ResolvedCacheTable;
EFI_EVENT PeriodicTimer;
};
typedef struct _USER_REQUEST_CONTEXT {
NET_LIST_ENTRY List;
ARP_INSTANCE_DATA *Instance;
EFI_EVENT UserRequestEvent;
VOID *UserHwAddrBuffer;
} USER_REQUEST_CONTEXT;
#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)
#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)
typedef struct _NET_ARP_ADDRESS {
UINT16 Type;
UINT8 Length;
UINT8 *AddressPtr;
union {
UINT8 ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
UINT8 HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
} Buffer;
} NET_ARP_ADDRESS;
typedef enum {
Hardware,
Protocol
} ARP_ADDRESS_TYPE;
typedef struct _ARP_CACHE_ENTRY {
NET_LIST_ENTRY List;
UINT32 RetryCount;
UINT32 DefaultDecayTime;
UINT32 DecayTime;
UINT32 NextRetryTime;
NET_ARP_ADDRESS Addresses[2];
NET_LIST_ENTRY UserRequestList;
} ARP_CACHE_ENTRY;
EFI_STATUS
EFIAPI
ArpConfigure (
IN EFI_ARP_PROTOCOL *This,
IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
ArpAdd (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN DenyFlag,
IN VOID *TargetSwAddress OPTIONAL,
IN VOID *TargetHwAddress OPTIONAL,
IN UINT32 TimeoutValue,
IN BOOLEAN Overwrite
);
EFI_STATUS
EFIAPI
ArpFind (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL,
OUT UINT32 *EntryLength OPTIONAL,
OUT UINT32 *EntryCount OPTIONAL,
OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
IN BOOLEAN Refresh
);
EFI_STATUS
EFIAPI
ArpDelete (
IN EFI_ARP_PROTOCOL *This,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL
);
EFI_STATUS
EFIAPI
ArpFlush (
IN EFI_ARP_PROTOCOL *This
);
EFI_STATUS
EFIAPI
ArpRequest (
IN EFI_ARP_PROTOCOL *This,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT ResolvedEvent OPTIONAL,
OUT VOID *TargetHwAddress
);
EFI_STATUS
EFIAPI
ArpCancel (
IN EFI_ARP_PROTOCOL *This,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT ResolvedEvent OPTIONAL
);
EFI_STATUS
ArpConfigureInstance (
IN ARP_INSTANCE_DATA *Instance,
IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
);
ARP_CACHE_ENTRY *
ArpFindDeniedCacheEntry (
IN ARP_SERVICE_DATA *ArpService,
IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
);
ARP_CACHE_ENTRY *
ArpFindNextCacheEntryInTable (
IN NET_LIST_ENTRY *CacheTable,
IN NET_LIST_ENTRY *StartEntry,
IN FIND_OPTYPE FindOpType,
IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL
);
ARP_CACHE_ENTRY *
ArpAllocCacheEntry (
IN ARP_INSTANCE_DATA *Instance
);
VOID
ArpFillAddressInCacheEntry (
IN ARP_CACHE_ENTRY *CacheEntry,
IN NET_ARP_ADDRESS *HwAddr OPTIONAL,
IN NET_ARP_ADDRESS *SwAddr OPTIONAL
);
UINTN
ArpAddressResolved (
IN ARP_CACHE_ENTRY *CacheEntry,
IN ARP_INSTANCE_DATA *Instance OPTIONAL,
IN EFI_EVENT UserEvent OPTIONAL
);
UINTN
ArpDeleteCacheEntry (
IN ARP_INSTANCE_DATA *Instance,
IN BOOLEAN BySwAddress,
IN UINT8 *AddressBuffer OPTIONAL,
IN BOOLEAN Force
);
VOID
ArpSendFrame (
IN ARP_INSTANCE_DATA *Instance,
IN ARP_CACHE_ENTRY *CacheEntry,
IN UINT16 ArpOpCode
);
VOID
ArpInitInstance (
IN ARP_SERVICE_DATA *ArpService,
IN ARP_INSTANCE_DATA *Instance
);
VOID
EFIAPI
ArpOnFrameRcvd (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
ArpOnFrameSent (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
ArpTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
);
UINTN
ArpCancelRequest (
IN ARP_INSTANCE_DATA *Instance,
IN VOID *TargetSwAddress OPTIONAL,
IN EFI_EVENT UserEvent OPTIONAL
);
EFI_STATUS
ArpFindCacheEntry (
IN ARP_INSTANCE_DATA *Instance,
IN BOOLEAN BySwAddress,
IN VOID *AddressBuffer OPTIONAL,
OUT UINT32 *EntryLength OPTIONAL,
OUT UINT32 *EntryCount OPTIONAL,
OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
IN BOOLEAN Refresh
);
#endif

View File

@ -23,6 +23,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
ArpComponentNameGetDriverName (
@ -31,16 +70,86 @@ ArpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
ArpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
@ -48,13 +157,62 @@ EFI_COMPONENT_NAME_PROTOCOL gArpComponentName = {
ArpComponentNameGetDriverName,
ArpComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ArpComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ArpComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mArpDriverNameTable[] = {
{ "eng", L"ARP Network Service Driver" },
{ "eng;en", L"ARP Network Service Driver" },
{ NULL, NULL }
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
ArpComponentNameGetDriverName (
@ -62,94 +220,93 @@ ArpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
return LookupUnicodeString2 (
Language,
gArpComponentName.SupportedLanguages,
This->SupportedLanguages,
mArpDriverNameTable,
DriverName
DriverName,
(BOOLEAN)(This == &gArpComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
ArpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -24,6 +24,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
DhcpComponentNameGetDriverName (
@ -32,6 +71,75 @@ DhcpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
DhcpComponentNameGetControllerName (
@ -42,18 +150,29 @@ DhcpComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = {
DhcpComponentNameGetDriverName,
DhcpComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DhcpComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DhcpComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
{
"eng",
"eng;en",
L"DHCP Protocol Driver"
},
{
@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
DhcpComponentNameGetDriverName (
@ -69,41 +227,84 @@ DhcpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gDhcp4ComponentName.SupportedLanguages,
mDhcpDriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mDhcpDriverNameTable,
DriverName,
(BOOLEAN)(This == &gDhcp4ComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
DhcpComponentNameGetControllerName (
@ -113,50 +314,6 @@ DhcpComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the
driver specified by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle isn't NULL and isn't a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -61,14 +61,13 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gDhcp4DriverBinding,
ImageHandle,
&gDhcp4ComponentName,
NULL,
NULL
&gDhcp4ComponentName2
);
}

View File

@ -1,67 +1,68 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Driver.h
Abstract:
Header for the DHCP4 driver
**/
#ifndef __EFI_DHCP4_DRIVER_H__
#define __EFI_DHCP4_DRIVER_H__
extern EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName;
EFI_STATUS
EFIAPI
Dhcp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Dhcp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Dhcp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
Dhcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Dhcp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Driver.h
Abstract:
Header for the DHCP4 driver
**/
#ifndef __EFI_DHCP4_DRIVER_H__
#define __EFI_DHCP4_DRIVER_H__
extern EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2;
EFI_STATUS
EFIAPI
Dhcp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Dhcp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Dhcp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
Dhcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Dhcp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,34 +1,34 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Impl.h
Abstract:
EFI DHCP protocol implementation
RFCs supported are:
RFC 2131: Dynamic Host Configuration Protocol
RFC 2132: DHCP Options and BOOTP Vendor Extensions
RFC 1534: Interoperation Between DHCP and BOOTP
RFC 3396: Encoding Long Options in DHCP
**/
#ifndef __EFI_DHCP4_IMPL_H__
#define __EFI_DHCP4_IMPL_H__
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Impl.h
Abstract:
EFI DHCP protocol implementation
RFCs supported are:
RFC 2131: Dynamic Host Configuration Protocol
RFC 2132: DHCP Options and BOOTP Vendor Extensions
RFC 1534: Interoperation Between DHCP and BOOTP
RFC 3396: Encoding Long Options in DHCP
**/
#ifndef __EFI_DHCP4_IMPL_H__
#define __EFI_DHCP4_IMPL_H__
#include <PiDxe.h>
@ -39,121 +39,121 @@ Abstract:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/NetLib.h>
typedef struct _DHCP_SERVICE DHCP_SERVICE;
typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
#include "Dhcp4Option.h"
#include "Dhcp4Io.h"
enum {
DHCP_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),
DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),
//
// The state of the DHCP service. It starts as UNCONFIGED. If
// and active child configures the service successfully, it
// goes to CONFIGED. If the active child configures NULL, it
// goes back to UNCONFIGED. It becomes DESTORY if it is (partly)
// destoried.
//
DHCP_UNCONFIGED = 0,
DHCP_CONFIGED,
DHCP_DESTORY
};
struct _DHCP_PROTOCOL {
UINT32 Signature;
EFI_DHCP4_PROTOCOL Dhcp4Protocol;
NET_LIST_ENTRY Link;
EFI_HANDLE Handle;
DHCP_SERVICE *Service;
BOOLEAN InDestory;
EFI_EVENT CompletionEvent;
EFI_EVENT RenewRebindEvent;
EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;
};
//
// DHCP driver is specical in that it is a singleton. Although it
// has a service binding, there can be only one active child.
//
struct _DHCP_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY
BOOLEAN InDestory;
EFI_HANDLE Controller;
EFI_HANDLE Image;
NET_LIST_ENTRY Children;
UINTN NumChildren;
INTN DhcpState;
EFI_STATUS IoStatus; // the result of last user operation
UINT32 Xid;
IP4_ADDR ClientAddr; // lease IP or configured client address
IP4_ADDR Netmask;
IP4_ADDR ServerAddr;
EFI_DHCP4_PACKET *LastOffer; // The last received offer
EFI_DHCP4_PACKET *Selected;
DHCP_PARAMETER *Para;
UINT32 Lease;
UINT32 T1;
UINT32 T2;
INTN ExtraRefresh; // This refresh is reqested by user
UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message
UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP
NET_BUF *LastPacket; // The last sent packet for retransmission
EFI_MAC_ADDRESS Mac;
UINT8 HwType;
UINT8 HwLen;
DHCP_PROTOCOL *ActiveChild;
EFI_DHCP4_CONFIG_DATA ActiveConfig;
UINT32 UserOptionLen;
//
// Timer event and various timer
//
EFI_EVENT Timer;
UINT32 PacketToLive; // Retransmission timer for our packets
INTN CurRetry;
INTN MaxRetries;
UINT32 WaitOffer; // Time to collect the offers
UINT32 LeaseLife;
};
typedef struct {
EFI_DHCP4_PACKET_OPTION **Option;
UINT32 OptionCount;
UINT32 Index;
} DHCP_PARSE_CONTEXT;
#define DHCP_INSTANCE_FROM_THIS(Proto) \
CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)
#define DHCP_SERVICE_FROM_THIS(Sb) \
CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)
extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;
VOID
DhcpYieldControl (
IN DHCP_SERVICE *DhcpSb
);
#endif
#include <Library/BaseLib.h>
#include <Library/NetLib.h>
typedef struct _DHCP_SERVICE DHCP_SERVICE;
typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
#include "Dhcp4Option.h"
#include "Dhcp4Io.h"
enum {
DHCP_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),
DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),
//
// The state of the DHCP service. It starts as UNCONFIGED. If
// and active child configures the service successfully, it
// goes to CONFIGED. If the active child configures NULL, it
// goes back to UNCONFIGED. It becomes DESTORY if it is (partly)
// destoried.
//
DHCP_UNCONFIGED = 0,
DHCP_CONFIGED,
DHCP_DESTORY
};
struct _DHCP_PROTOCOL {
UINT32 Signature;
EFI_DHCP4_PROTOCOL Dhcp4Protocol;
NET_LIST_ENTRY Link;
EFI_HANDLE Handle;
DHCP_SERVICE *Service;
BOOLEAN InDestory;
EFI_EVENT CompletionEvent;
EFI_EVENT RenewRebindEvent;
EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;
};
//
// DHCP driver is specical in that it is a singleton. Although it
// has a service binding, there can be only one active child.
//
struct _DHCP_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTORY
BOOLEAN InDestory;
EFI_HANDLE Controller;
EFI_HANDLE Image;
NET_LIST_ENTRY Children;
UINTN NumChildren;
INTN DhcpState;
EFI_STATUS IoStatus; // the result of last user operation
UINT32 Xid;
IP4_ADDR ClientAddr; // lease IP or configured client address
IP4_ADDR Netmask;
IP4_ADDR ServerAddr;
EFI_DHCP4_PACKET *LastOffer; // The last received offer
EFI_DHCP4_PACKET *Selected;
DHCP_PARAMETER *Para;
UINT32 Lease;
UINT32 T1;
UINT32 T2;
INTN ExtraRefresh; // This refresh is reqested by user
UDP_IO_PORT *UdpIo; // Udp child receiving all DHCP message
UDP_IO_PORT *LeaseIoPort; // Udp child with lease IP
NET_BUF *LastPacket; // The last sent packet for retransmission
EFI_MAC_ADDRESS Mac;
UINT8 HwType;
UINT8 HwLen;
DHCP_PROTOCOL *ActiveChild;
EFI_DHCP4_CONFIG_DATA ActiveConfig;
UINT32 UserOptionLen;
//
// Timer event and various timer
//
EFI_EVENT Timer;
UINT32 PacketToLive; // Retransmission timer for our packets
INTN CurRetry;
INTN MaxRetries;
UINT32 WaitOffer; // Time to collect the offers
UINT32 LeaseLife;
};
typedef struct {
EFI_DHCP4_PACKET_OPTION **Option;
UINT32 OptionCount;
UINT32 Index;
} DHCP_PARSE_CONTEXT;
#define DHCP_INSTANCE_FROM_THIS(Proto) \
CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)
#define DHCP_SERVICE_FROM_THIS(Sb) \
CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)
extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;
VOID
DhcpYieldControl (
IN DHCP_SERVICE *DhcpSb
);
#endif

View File

@ -1,115 +1,115 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Io.h
Abstract:
The DHCP4 protocol implementation.
**/
#ifndef __EFI_DHCP4_IO_H__
#define __EFI_DHCP4_IO_H__
#include <PiDxe.h>
#include <Protocol/ServiceBinding.h>
#include <Library/NetLib.h>
#include <Library/UdpIoLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
enum {
DHCP_WAIT_OFFER = 3, // Time to wait the offers
DHCP_DEFAULT_LEASE = 7 *24 *60 *60, // Seven days as default.
DHCP_SERVER_PORT = 67,
DHCP_CLIENT_PORT = 68,
//
// BOOTP header "op" field
//
BOOTP_REQUEST = 1,
BOOTP_REPLY = 2,
//
// DHCP message types
//
DHCP_MSG_DISCOVER = 1,
DHCP_MSG_OFFER = 2,
DHCP_MSG_REQUEST = 3,
DHCP_MSG_DECLINE = 4,
DHCP_MSG_ACK = 5,
DHCP_MSG_NAK = 6,
DHCP_MSG_RELEASE = 7,
DHCP_MSG_INFORM = 8,
//
// DHCP notify user type
//
DHCP_NOTIFY_COMPLETION = 1,
DHCP_NOTIFY_RENEWREBIND,
DHCP_NOTIFY_ALL
};
#define DHCP_IS_BOOTP(Parameter) (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))
#define DHCP_CONNECTED(State) \
(((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))
EFI_STATUS
DhcpSetState (
IN DHCP_SERVICE *DhcpSb,
IN INTN State,
IN BOOLEAN CallUser
);
EFI_STATUS
DhcpSendMessage (
IN DHCP_SERVICE *DhcpSb,
IN EFI_DHCP4_PACKET *Seed,
IN DHCP_PARAMETER *Para,
IN UINT8 Type,
IN UINT8 *Msg
);
VOID
EFIAPI
DhcpOnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
DhcpInput (
NET_BUF *UdpPacket,
UDP_POINTS *Points,
EFI_STATUS IoStatus,
VOID *Context
);
EFI_STATUS
DhcpInitRequest (
IN DHCP_SERVICE *DhcpSb
);
VOID
DhcpCleanLease (
IN DHCP_SERVICE *DhcpSb
);
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Io.h
Abstract:
The DHCP4 protocol implementation.
**/
#ifndef __EFI_DHCP4_IO_H__
#define __EFI_DHCP4_IO_H__
#include <PiDxe.h>
#include <Protocol/ServiceBinding.h>
#include <Library/NetLib.h>
#include <Library/UdpIoLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
enum {
DHCP_WAIT_OFFER = 3, // Time to wait the offers
DHCP_DEFAULT_LEASE = 7 *24 *60 *60, // Seven days as default.
DHCP_SERVER_PORT = 67,
DHCP_CLIENT_PORT = 68,
//
// BOOTP header "op" field
//
BOOTP_REQUEST = 1,
BOOTP_REPLY = 2,
//
// DHCP message types
//
DHCP_MSG_DISCOVER = 1,
DHCP_MSG_OFFER = 2,
DHCP_MSG_REQUEST = 3,
DHCP_MSG_DECLINE = 4,
DHCP_MSG_ACK = 5,
DHCP_MSG_NAK = 6,
DHCP_MSG_RELEASE = 7,
DHCP_MSG_INFORM = 8,
//
// DHCP notify user type
//
DHCP_NOTIFY_COMPLETION = 1,
DHCP_NOTIFY_RENEWREBIND,
DHCP_NOTIFY_ALL
};
#define DHCP_IS_BOOTP(Parameter) (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))
#define DHCP_CONNECTED(State) \
(((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))
EFI_STATUS
DhcpSetState (
IN DHCP_SERVICE *DhcpSb,
IN INTN State,
IN BOOLEAN CallUser
);
EFI_STATUS
DhcpSendMessage (
IN DHCP_SERVICE *DhcpSb,
IN EFI_DHCP4_PACKET *Seed,
IN DHCP_PARAMETER *Para,
IN UINT8 Type,
IN UINT8 *Msg
);
VOID
EFIAPI
DhcpOnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
DhcpInput (
NET_BUF *UdpPacket,
UDP_POINTS *Points,
EFI_STATUS IoStatus,
VOID *Context
);
EFI_STATUS
DhcpInitRequest (
IN DHCP_SERVICE *DhcpSb
);
VOID
DhcpCleanLease (
IN DHCP_SERVICE *DhcpSb
);
#endif

View File

@ -1,266 +1,266 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Option.h
Abstract:
To validate, parse and process the DHCP options
**/
#ifndef __EFI_DHCP4_OPTION_H__
#define __EFI_DHCP4_OPTION_H__
//
// DHCP option tags (types)
//
enum {
//
// RFC1497 vendor extensions
//
DHCP_TAG_PAD = 0, // Pad Option
DHCP_TAG_EOP = 255, // End Option
DHCP_TAG_NETMASK = 1, // Subnet Mask
DHCP_TAG_TIME_OFFSET = 2, // Time Offset from UTC
DHCP_TAG_ROUTER = 3, // Router option,
DHCP_TAG_TIME_SERVER = 4, // Time Server
DHCP_TAG_NAME_SERVER = 5, // Name Server
DHCP_TAG_DNS_SERVER = 6, // Domain Name Server
DHCP_TAG_LOG_SERVER = 7, // Log Server
DHCP_TAG_COOKIE_SERVER = 8, // Cookie Server
DHCP_TAG_LPR_SERVER = 9, // LPR Print Server
DHCP_TAG_IMPRESS_SERVER = 10, // Impress Server
DHCP_TAG_RL_SERVER = 11, // Resource Location Server
DHCP_TAG_HOSTNAME = 12, // Host Name
DHCP_TAG_BOOTFILE_LEN = 13, // Boot File Size
DHCP_TAG_DUMP = 14, // Merit Dump File
DHCP_TAG_DOMAINNAME = 15, // Domain Name
DHCP_TAG_SWAP_SERVER = 16, // Swap Server
DHCP_TAG_ROOTPATH = 17, // Root path
DHCP_TAG_EXTEND_PATH = 18, // Extensions Path
//
// IP Layer Parameters per Host
//
DHCP_TAG_IPFORWARD = 19, // IP Forwarding Enable/Disable
DHCP_TAG_NONLOCAL_SRR = 20, // on-Local Source Routing Enable/Disable
DHCP_TAG_POLICY_SRR = 21, // Policy Filter
DHCP_TAG_EMTU = 22, // Maximum Datagram Reassembly Size
DHCP_TAG_TTL = 23, // Default IP Time-to-live
DHCP_TAG_PATHMTU_AGE = 24, // Path MTU Aging Timeout
DHCP_TAG_PATHMTU_PLATEAU = 25, // Path MTU Plateau Table
//
// IP Layer Parameters per Interface
//
DHCP_TAG_IFMTU = 26, // Interface MTU
DHCP_TAG_SUBNET_LOCAL = 27, // All Subnets are Local
DHCP_TAG_BROADCAST = 28, // Broadcast Address
DHCP_TAG_DISCOVER_MASK = 29, // Perform Mask Discovery
DHCP_TAG_SUPPLY_MASK = 30, // Mask Supplier
DHCP_TAG_DISCOVER_ROUTE = 31, // Perform Router Discovery
DHCP_TAG_ROUTER_SOLICIT = 32, // Router Solicitation Address
DHCP_TAG_STATIC_ROUTE = 33, // Static Route
//
// Link Layer Parameters per Interface
//
DHCP_TAG_TRAILER = 34, // Trailer Encapsulation
DHCP_TAG_ARPAGE = 35, // ARP Cache Timeout
DHCP_TAG_ETHER_ENCAP = 36, // Ethernet Encapsulation
//
// TCP Parameters
//
DHCP_TAG_TCP_TTL = 37, // TCP Default TTL
DHCP_TAG_KEEP_INTERVAL = 38, // TCP Keepalive Interval
DHCP_TAG_KEEP_GARBAGE = 39, // TCP Keepalive Garbage
//
// Application and Service Parameters
//
DHCP_TAG_NIS_DOMAIN = 40, // Network Information Service Domain
DHCP_TAG_NIS_SERVER = 41, // Network Information Servers
DHCP_TAG_NTP_SERVER = 42, // Network Time Protocol Servers
DHCP_TAG_VENDOR = 43, // Vendor Specific Information
DHCP_TAG_NBNS = 44, // NetBIOS over TCP/IP Name Server
DHCP_TAG_NBDD = 45, // NetBIOS Datagram Distribution Server
DHCP_TAG_NBTYPE = 46, // NetBIOS over TCP/IP Node Type
DHCP_TAG_NBSCOPE = 47, // NetBIOS over TCP/IP Scope
DHCP_TAG_XFONT = 48, // X Window System Font Server
DHCP_TAG_XDM = 49, // X Window System Display Manager
DHCP_TAG_NISPLUS = 64, // Network Information Service+ Domain
DHCP_TAG_NISPLUS_SERVER = 65, // Network Information Service+ Servers
DHCP_TAG_MOBILEIP = 68, // Mobile IP Home Agent
DHCP_TAG_SMTP = 69, // Simple Mail Transport Protocol Server
DHCP_TAG_POP3 = 70, // Post Office Protocol (POP3) Server
DHCP_TAG_NNTP = 71, // Network News Transport Protocol Server
DHCP_TAG_WWW = 72, // Default World Wide Web (WWW) Server
DHCP_TAG_FINGER = 73, // Default Finger Server
DHCP_TAG_IRC = 74, // Default Internet Relay Chat (IRC) Server
DHCP_TAG_STTALK = 75, // StreetTalk Server
DHCP_TAG_STDA = 76, // StreetTalk Directory Assistance Server
DHCP_TAG_CLASSLESS_ROUTE = 121, // Classless Route
//
// DHCP Extensions
//
DHCP_TAG_REQUEST_IP = 50, // Requested IP Address
DHCP_TAG_LEASE = 51, // IP Address Lease Time
DHCP_TAG_OVERLOAD = 52, // Option Overload
DHCP_TAG_TFTP = 66, // TFTP server name
DHCP_TAG_BOOTFILE = 67, // Bootfile name
DHCP_TAG_TYPE = 53, // DHCP Message Type
DHCP_TAG_SERVER_ID = 54, // Server Identifier
DHCP_TAG_PARA_LIST = 55, // Parameter Request List
DHCP_TAG_MESSAGE = 56, // Message
DHCP_TAG_MAXMSG = 57, // Maximum DHCP Message Size
DHCP_TAG_T1 = 58, // Renewal (T1) Time Value
DHCP_TAG_T2 = 59, // Rebinding (T2) Time Value
DHCP_TAG_VENDOR_CLASS = 60, // Vendor class identifier
DHCP_TAG_CLIENT_ID = 61 // Client-identifier
};
enum {
DHCP_OPTION_MAGIC = 0x63538263, // Network byte order
DHCP_MAX_OPTIONS = 256,
//
// DHCP option types, this is used to validate the DHCP options.
//
DHCP_OPTION_SWITCH = 1,
DHCP_OPTION_INT8,
DHCP_OPTION_INT16,
DHCP_OPTION_INT32,
DHCP_OPTION_IP,
DHCP_OPTION_IPPAIR,
//
// Value of DHCP overload option
//
DHCP_OVERLOAD_FILENAME = 1,
DHCP_OVERLOAD_SVRNAME = 2,
DHCP_OVERLOAD_BOTH = 3
};
//
// The DHCP option structure. This structure extends the EFI_DHCP_OPTION
// structure to support options longer than 255 bytes, such as classless route.
//
typedef struct {
UINT8 Tag;
UINT16 Len;
UINT8 *Data;
} DHCP_OPTION;
//
// Structures used to parse the DHCP options with RFC3396 support.
//
typedef struct {
UINT8 Index;
UINT16 Offset;
} DHCP_OPTION_COUNT;
typedef struct {
DHCP_OPTION_COUNT *OpCount;
DHCP_OPTION *Options;
UINT8 *Buf;
} DHCP_OPTION_CONTEXT;
//
// The options that matters to DHCP driver itself. The user of
// DHCP clients may be interested in other options, such as
// classless route, who can parse the DHCP offer to get them.
//
typedef struct {
IP4_ADDR NetMask; // DHCP_TAG_NETMASK
IP4_ADDR Router; // DHCP_TAG_ROUTER, only the first router is used
//
// DHCP specific options
//
UINT8 DhcpType; // DHCP_TAG_TYPE
UINT8 Overload; // DHCP_TAG_OVERLOAD
IP4_ADDR ServerId; // DHCP_TAG_SERVER_ID
UINT32 Lease; // DHCP_TAG_LEASE
UINT32 T1; // DHCP_TAG_T1
UINT32 T2; // DHCP_TAG_T2
} DHCP_PARAMETER;
//
// Structure used to describe and validate the format of DHCP options.
// Type is the options' data type, such as DHCP_OPTION_INT8. MinOccur
// is the minium occurance of this data type. MaxOccur is defined
// similarly. If MaxOccur is -1, it means that there is no limit on the
// maximum occurance. Alert tells whether DHCP client should further
// inspect the option to parse DHCP_PARAMETER.
//
typedef struct {
UINT8 Tag;
INTN Type;
INTN MinOccur;
INTN MaxOccur;
BOOLEAN Alert;
} DHCP_OPTION_FORMAT;
typedef
EFI_STATUS
(*DHCP_CHECK_OPTION) (
IN UINT8 Tag,
IN UINT8 Len,
IN UINT8 *Data,
IN VOID *Context
);
EFI_STATUS
DhcpIterateOptions (
IN EFI_DHCP4_PACKET *Packet,
IN DHCP_CHECK_OPTION Check, OPTIONAL
IN VOID *Context
);
EFI_STATUS
DhcpValidateOptions (
IN EFI_DHCP4_PACKET *Packet,
OUT DHCP_PARAMETER **Para OPTIONAL
);
EFI_STATUS
DhcpParseOption (
IN EFI_DHCP4_PACKET *Packet,
OUT INTN *Count,
OUT DHCP_OPTION **OptionPoint
);
UINT8 *
DhcpAppendOption (
IN UINT8 *Buf,
IN UINT8 Tag,
IN UINT16 DataLen,
IN UINT8 *Data
);
EFI_STATUS
DhcpBuild (
IN EFI_DHCP4_PACKET *SeedPacket,
IN UINT32 DeleteCount,
IN UINT8 *DeleteList OPTIONAL,
IN UINT32 AppendCount,
IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
OUT EFI_DHCP4_PACKET **NewPacket
);
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Dhcp4Option.h
Abstract:
To validate, parse and process the DHCP options
**/
#ifndef __EFI_DHCP4_OPTION_H__
#define __EFI_DHCP4_OPTION_H__
//
// DHCP option tags (types)
//
enum {
//
// RFC1497 vendor extensions
//
DHCP_TAG_PAD = 0, // Pad Option
DHCP_TAG_EOP = 255, // End Option
DHCP_TAG_NETMASK = 1, // Subnet Mask
DHCP_TAG_TIME_OFFSET = 2, // Time Offset from UTC
DHCP_TAG_ROUTER = 3, // Router option,
DHCP_TAG_TIME_SERVER = 4, // Time Server
DHCP_TAG_NAME_SERVER = 5, // Name Server
DHCP_TAG_DNS_SERVER = 6, // Domain Name Server
DHCP_TAG_LOG_SERVER = 7, // Log Server
DHCP_TAG_COOKIE_SERVER = 8, // Cookie Server
DHCP_TAG_LPR_SERVER = 9, // LPR Print Server
DHCP_TAG_IMPRESS_SERVER = 10, // Impress Server
DHCP_TAG_RL_SERVER = 11, // Resource Location Server
DHCP_TAG_HOSTNAME = 12, // Host Name
DHCP_TAG_BOOTFILE_LEN = 13, // Boot File Size
DHCP_TAG_DUMP = 14, // Merit Dump File
DHCP_TAG_DOMAINNAME = 15, // Domain Name
DHCP_TAG_SWAP_SERVER = 16, // Swap Server
DHCP_TAG_ROOTPATH = 17, // Root path
DHCP_TAG_EXTEND_PATH = 18, // Extensions Path
//
// IP Layer Parameters per Host
//
DHCP_TAG_IPFORWARD = 19, // IP Forwarding Enable/Disable
DHCP_TAG_NONLOCAL_SRR = 20, // on-Local Source Routing Enable/Disable
DHCP_TAG_POLICY_SRR = 21, // Policy Filter
DHCP_TAG_EMTU = 22, // Maximum Datagram Reassembly Size
DHCP_TAG_TTL = 23, // Default IP Time-to-live
DHCP_TAG_PATHMTU_AGE = 24, // Path MTU Aging Timeout
DHCP_TAG_PATHMTU_PLATEAU = 25, // Path MTU Plateau Table
//
// IP Layer Parameters per Interface
//
DHCP_TAG_IFMTU = 26, // Interface MTU
DHCP_TAG_SUBNET_LOCAL = 27, // All Subnets are Local
DHCP_TAG_BROADCAST = 28, // Broadcast Address
DHCP_TAG_DISCOVER_MASK = 29, // Perform Mask Discovery
DHCP_TAG_SUPPLY_MASK = 30, // Mask Supplier
DHCP_TAG_DISCOVER_ROUTE = 31, // Perform Router Discovery
DHCP_TAG_ROUTER_SOLICIT = 32, // Router Solicitation Address
DHCP_TAG_STATIC_ROUTE = 33, // Static Route
//
// Link Layer Parameters per Interface
//
DHCP_TAG_TRAILER = 34, // Trailer Encapsulation
DHCP_TAG_ARPAGE = 35, // ARP Cache Timeout
DHCP_TAG_ETHER_ENCAP = 36, // Ethernet Encapsulation
//
// TCP Parameters
//
DHCP_TAG_TCP_TTL = 37, // TCP Default TTL
DHCP_TAG_KEEP_INTERVAL = 38, // TCP Keepalive Interval
DHCP_TAG_KEEP_GARBAGE = 39, // TCP Keepalive Garbage
//
// Application and Service Parameters
//
DHCP_TAG_NIS_DOMAIN = 40, // Network Information Service Domain
DHCP_TAG_NIS_SERVER = 41, // Network Information Servers
DHCP_TAG_NTP_SERVER = 42, // Network Time Protocol Servers
DHCP_TAG_VENDOR = 43, // Vendor Specific Information
DHCP_TAG_NBNS = 44, // NetBIOS over TCP/IP Name Server
DHCP_TAG_NBDD = 45, // NetBIOS Datagram Distribution Server
DHCP_TAG_NBTYPE = 46, // NetBIOS over TCP/IP Node Type
DHCP_TAG_NBSCOPE = 47, // NetBIOS over TCP/IP Scope
DHCP_TAG_XFONT = 48, // X Window System Font Server
DHCP_TAG_XDM = 49, // X Window System Display Manager
DHCP_TAG_NISPLUS = 64, // Network Information Service+ Domain
DHCP_TAG_NISPLUS_SERVER = 65, // Network Information Service+ Servers
DHCP_TAG_MOBILEIP = 68, // Mobile IP Home Agent
DHCP_TAG_SMTP = 69, // Simple Mail Transport Protocol Server
DHCP_TAG_POP3 = 70, // Post Office Protocol (POP3) Server
DHCP_TAG_NNTP = 71, // Network News Transport Protocol Server
DHCP_TAG_WWW = 72, // Default World Wide Web (WWW) Server
DHCP_TAG_FINGER = 73, // Default Finger Server
DHCP_TAG_IRC = 74, // Default Internet Relay Chat (IRC) Server
DHCP_TAG_STTALK = 75, // StreetTalk Server
DHCP_TAG_STDA = 76, // StreetTalk Directory Assistance Server
DHCP_TAG_CLASSLESS_ROUTE = 121, // Classless Route
//
// DHCP Extensions
//
DHCP_TAG_REQUEST_IP = 50, // Requested IP Address
DHCP_TAG_LEASE = 51, // IP Address Lease Time
DHCP_TAG_OVERLOAD = 52, // Option Overload
DHCP_TAG_TFTP = 66, // TFTP server name
DHCP_TAG_BOOTFILE = 67, // Bootfile name
DHCP_TAG_TYPE = 53, // DHCP Message Type
DHCP_TAG_SERVER_ID = 54, // Server Identifier
DHCP_TAG_PARA_LIST = 55, // Parameter Request List
DHCP_TAG_MESSAGE = 56, // Message
DHCP_TAG_MAXMSG = 57, // Maximum DHCP Message Size
DHCP_TAG_T1 = 58, // Renewal (T1) Time Value
DHCP_TAG_T2 = 59, // Rebinding (T2) Time Value
DHCP_TAG_VENDOR_CLASS = 60, // Vendor class identifier
DHCP_TAG_CLIENT_ID = 61 // Client-identifier
};
enum {
DHCP_OPTION_MAGIC = 0x63538263, // Network byte order
DHCP_MAX_OPTIONS = 256,
//
// DHCP option types, this is used to validate the DHCP options.
//
DHCP_OPTION_SWITCH = 1,
DHCP_OPTION_INT8,
DHCP_OPTION_INT16,
DHCP_OPTION_INT32,
DHCP_OPTION_IP,
DHCP_OPTION_IPPAIR,
//
// Value of DHCP overload option
//
DHCP_OVERLOAD_FILENAME = 1,
DHCP_OVERLOAD_SVRNAME = 2,
DHCP_OVERLOAD_BOTH = 3
};
//
// The DHCP option structure. This structure extends the EFI_DHCP_OPTION
// structure to support options longer than 255 bytes, such as classless route.
//
typedef struct {
UINT8 Tag;
UINT16 Len;
UINT8 *Data;
} DHCP_OPTION;
//
// Structures used to parse the DHCP options with RFC3396 support.
//
typedef struct {
UINT8 Index;
UINT16 Offset;
} DHCP_OPTION_COUNT;
typedef struct {
DHCP_OPTION_COUNT *OpCount;
DHCP_OPTION *Options;
UINT8 *Buf;
} DHCP_OPTION_CONTEXT;
//
// The options that matters to DHCP driver itself. The user of
// DHCP clients may be interested in other options, such as
// classless route, who can parse the DHCP offer to get them.
//
typedef struct {
IP4_ADDR NetMask; // DHCP_TAG_NETMASK
IP4_ADDR Router; // DHCP_TAG_ROUTER, only the first router is used
//
// DHCP specific options
//
UINT8 DhcpType; // DHCP_TAG_TYPE
UINT8 Overload; // DHCP_TAG_OVERLOAD
IP4_ADDR ServerId; // DHCP_TAG_SERVER_ID
UINT32 Lease; // DHCP_TAG_LEASE
UINT32 T1; // DHCP_TAG_T1
UINT32 T2; // DHCP_TAG_T2
} DHCP_PARAMETER;
//
// Structure used to describe and validate the format of DHCP options.
// Type is the options' data type, such as DHCP_OPTION_INT8. MinOccur
// is the minium occurance of this data type. MaxOccur is defined
// similarly. If MaxOccur is -1, it means that there is no limit on the
// maximum occurance. Alert tells whether DHCP client should further
// inspect the option to parse DHCP_PARAMETER.
//
typedef struct {
UINT8 Tag;
INTN Type;
INTN MinOccur;
INTN MaxOccur;
BOOLEAN Alert;
} DHCP_OPTION_FORMAT;
typedef
EFI_STATUS
(*DHCP_CHECK_OPTION) (
IN UINT8 Tag,
IN UINT8 Len,
IN UINT8 *Data,
IN VOID *Context
);
EFI_STATUS
DhcpIterateOptions (
IN EFI_DHCP4_PACKET *Packet,
IN DHCP_CHECK_OPTION Check, OPTIONAL
IN VOID *Context
);
EFI_STATUS
DhcpValidateOptions (
IN EFI_DHCP4_PACKET *Packet,
OUT DHCP_PARAMETER **Para OPTIONAL
);
EFI_STATUS
DhcpParseOption (
IN EFI_DHCP4_PACKET *Packet,
OUT INTN *Count,
OUT DHCP_OPTION **OptionPoint
);
UINT8 *
DhcpAppendOption (
IN UINT8 *Buf,
IN UINT8 Tag,
IN UINT16 DataLen,
IN UINT8 *Data
);
EFI_STATUS
DhcpBuild (
IN EFI_DHCP4_PACKET *SeedPacket,
IN UINT32 DeleteCount,
IN UINT8 *DeleteList OPTIONAL,
IN UINT32 AppendCount,
IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
OUT EFI_DHCP4_PACKET **NewPacket
);
#endif

View File

@ -24,6 +24,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ConfigComponentNameGetDriverName (
@ -32,6 +71,75 @@ Ip4ConfigComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ConfigComponentNameGetControllerName (
@ -42,21 +150,71 @@ Ip4ConfigComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
Ip4ConfigComponentNameGetDriverName,
Ip4ConfigComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ConfigComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ConfigComponentNameGetControllerName,
"en"
};
STATIC
EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable[] = {
{"eng", L"IP4 CONFIG Network Service Driver"},
{"eng;en", L"IP4 CONFIG Network Service Driver"},
{NULL, NULL}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ConfigComponentNameGetDriverName (
@ -64,94 +222,93 @@ Ip4ConfigComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
return LookupUnicodeString2 (
Language,
gIp4ConfigComponentName.SupportedLanguages,
This->SupportedLanguages,
mIp4ConfigDriverNameTable,
DriverName
DriverName,
(BOOLEAN)(This == &gIp4ConfigComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ConfigComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1,28 +1,28 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Config.h
Abstract:
Header file for IP4Config driver.
**/
#ifndef __EFI_IP4CONFIG_H__
#define __EFI_IP4CONFIG_H__
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Config.h
Abstract:
Header file for IP4Config driver.
**/
#ifndef __EFI_IP4CONFIG_H__
#define __EFI_IP4CONFIG_H__
#include <PiDxe.h>
#include <Protocol/Dhcp4.h>
@ -36,97 +36,98 @@ Abstract:
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "NicIp4Variable.h"
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
enum {
IP4_CONFIG_STATE_IDLE = 0,
IP4_CONFIG_STATE_STARTED,
IP4_CONFIG_STATE_CONFIGURED,
IP4_PROTO_ICMP = 0x01,
IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
DHCP_TAG_PARA_LIST = 55,
DHCP_TAG_NETMASK = 1,
DHCP_TAG_ROUTER = 3
};
//
// Configure the DHCP to request the routers and netmask
// from server. The DHCP_TAG_NETMASK is included in Head.
//
#pragma pack(1)
typedef struct {
EFI_DHCP4_PACKET_OPTION Head;
UINT8 Route;
} IP4_CONFIG_DHCP4_OPTION;
#pragma pack()
struct _IP4_CONFIG_INSTANCE {
UINT32 Signature;
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
//
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
//
INTN State;
//
// Mnp child to keep the connection with MNP.
//
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_HANDLE MnpHandle;
//
// User's requests data
//
EFI_EVENT DoneEvent;
EFI_EVENT ReconfigEvent;
EFI_STATUS Result;
//
// Identity of this interface and some configuration info.
//
NIC_ADDR NicAddr;
UINT16 NicName[IP4_NIC_NAME_LENGTH];
UINT32 NicIndex;
NIC_IP4_CONFIG_INFO *NicConfig;
//
// DHCP handles to access DHCP
//
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_HANDLE Dhcp4Handle;
EFI_EVENT Dhcp4Event;
};
#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
VOID
Ip4ConfigCleanDhcp4 (
IN IP4_CONFIG_INSTANCE *This
);
VOID
Ip4ConfigCleanConfig (
IN IP4_CONFIG_INSTANCE *Instance
);
#endif
#include <Library/MemoryAllocationLib.h>
#include "NicIp4Variable.h"
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
enum {
IP4_CONFIG_STATE_IDLE = 0,
IP4_CONFIG_STATE_STARTED,
IP4_CONFIG_STATE_CONFIGURED,
IP4_PROTO_ICMP = 0x01,
IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
DHCP_TAG_PARA_LIST = 55,
DHCP_TAG_NETMASK = 1,
DHCP_TAG_ROUTER = 3
};
//
// Configure the DHCP to request the routers and netmask
// from server. The DHCP_TAG_NETMASK is included in Head.
//
#pragma pack(1)
typedef struct {
EFI_DHCP4_PACKET_OPTION Head;
UINT8 Route;
} IP4_CONFIG_DHCP4_OPTION;
#pragma pack()
struct _IP4_CONFIG_INSTANCE {
UINT32 Signature;
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
//
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
//
INTN State;
//
// Mnp child to keep the connection with MNP.
//
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_HANDLE MnpHandle;
//
// User's requests data
//
EFI_EVENT DoneEvent;
EFI_EVENT ReconfigEvent;
EFI_STATUS Result;
//
// Identity of this interface and some configuration info.
//
NIC_ADDR NicAddr;
UINT16 NicName[IP4_NIC_NAME_LENGTH];
UINT32 NicIndex;
NIC_IP4_CONFIG_INFO *NicConfig;
//
// DHCP handles to access DHCP
//
EFI_DHCP4_PROTOCOL *Dhcp4;
EFI_HANDLE Dhcp4Handle;
EFI_EVENT Dhcp4Event;
};
#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
VOID
Ip4ConfigCleanDhcp4 (
IN IP4_CONFIG_INSTANCE *This
);
VOID
Ip4ConfigCleanConfig (
IN IP4_CONFIG_INSTANCE *Instance
);
#endif

View File

@ -85,14 +85,13 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gIp4ConfigDriverBinding,
ImageHandle,
&gIp4ConfigComponentName,
NULL,
NULL
&gIp4ConfigComponentName2
);
}

View File

@ -1,75 +1,75 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
NicIp4Variable.h
Abstract:
Routines used to operate the Ip4 configure variable
**/
#ifndef _NIC_IP4_VARIABLE_H_
#define _NIC_IP4_VARIABLE_H_
#include <Protocol/NicIp4Config.h>
//
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
// They are of variable size
//
#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
(sizeof (EFI_IP4_IPCONFIG_DATA) + \
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
(sizeof (NIC_IP4_CONFIG_INFO) + \
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
//
// Compare whether two NIC address are equal includes their type and length.
//
#define NIC_ADDR_EQUAL(Nic1, Nic2) \
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
BOOLEAN
Ip4ConfigIsValid (
IN NIC_IP4_CONFIG_INFO *NicConfig
);
IP4_CONFIG_VARIABLE *
Ip4ConfigReadVariable (
VOID
);
EFI_STATUS
Ip4ConfigWriteVariable (
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
);
NIC_IP4_CONFIG_INFO *
Ip4ConfigFindNicVariable (
IN IP4_CONFIG_VARIABLE *Variable,
IN NIC_ADDR *NicAddr
);
IP4_CONFIG_VARIABLE *
Ip4ConfigModifyVariable (
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
IN NIC_ADDR *NicAddr,
IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
);
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
NicIp4Variable.h
Abstract:
Routines used to operate the Ip4 configure variable
**/
#ifndef _NIC_IP4_VARIABLE_H_
#define _NIC_IP4_VARIABLE_H_
#include <Protocol/NicIp4Config.h>
//
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
// They are of variable size
//
#define SIZEOF_IP4_CONFIG_INFO(Ip4Config) \
(sizeof (EFI_IP4_IPCONFIG_DATA) + \
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (Ip4Config)->RouteTableSize) - 1))
#define SIZEOF_NIC_IP4_CONFIG_INFO(NicConfig) \
(sizeof (NIC_IP4_CONFIG_INFO) + \
sizeof (EFI_IP4_ROUTE_TABLE) * (NET_MAX (1, (NicConfig)->Ip4Info.RouteTableSize) - 1))
//
// Compare whether two NIC address are equal includes their type and length.
//
#define NIC_ADDR_EQUAL(Nic1, Nic2) \
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
BOOLEAN
Ip4ConfigIsValid (
IN NIC_IP4_CONFIG_INFO *NicConfig
);
IP4_CONFIG_VARIABLE *
Ip4ConfigReadVariable (
VOID
);
EFI_STATUS
Ip4ConfigWriteVariable (
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
);
NIC_IP4_CONFIG_INFO *
Ip4ConfigFindNicVariable (
IN IP4_CONFIG_VARIABLE *Variable,
IN NIC_ADDR *NicAddr
);
IP4_CONFIG_VARIABLE *
Ip4ConfigModifyVariable (
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL
IN NIC_ADDR *NicAddr,
IN NIC_IP4_CONFIG_INFO *Config OPTIONAL
);
#endif

View File

@ -24,6 +24,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ComponentNameGetDriverName (
@ -32,6 +71,75 @@ Ip4ComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ComponentNameGetControllerName (
@ -42,18 +150,29 @@ Ip4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
Ip4ComponentNameGetDriverName,
Ip4ComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
{
"eng",
"eng;en",
L"IP4 Network Service Driver"
},
{
@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ComponentNameGetDriverName (
@ -69,44 +227,85 @@ Ip4ComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable
name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the driver name
that that the caller is requesting, and it must match
one of the languages specified in SupportedLanguages.
The number of languages supported by a driver is up to
the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode
string is the name of the driver specified by This in the
language specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gIp4ComponentName.SupportedLanguages,
mIp4DriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mIp4DriverNameTable,
DriverName,
(BOOLEAN)(This == &gIp4ComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Ip4ComponentNameGetControllerName (
@ -116,51 +315,6 @@ Ip4ComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of
the controller that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the
driver specified by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not
a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1,143 +1,143 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Common.h
Abstract:
Common definition for IP4.
**/
#ifndef __EFI_IP4_COMMON_H__
#define __EFI_IP4_COMMON_H__
typedef struct _IP4_INTERFACE IP4_INTERFACE;
typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
typedef struct _IP4_SERVICE IP4_SERVICE;
enum {
IP4_ETHER_PROTO = 0x0800,
IP4_PROTO_ICMP = 0x01,
IP4_PROTO_IGMP = 0x02,
//
// The packet is received as link level broadcast/multicast/promiscuous.
//
IP4_LINK_BROADCAST = 0x00000001,
IP4_LINK_MULTICAST = 0x00000002,
IP4_LINK_PROMISC = 0x00000004,
//
// IP4 address cast type classfication. Keep it true that any
// type bigger than or equal to LOCAL_BROADCAST is broadcast.
//
IP4_PROMISCUOUS = 1,
IP4_LOCAL_HOST,
IP4_MULTICAST,
IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255
IP4_SUBNET_BROADCAST,
IP4_NET_BROADCAST,
//
// IP4 header flags
//
IP4_HEAD_DF_MASK = 0x4000,
IP4_HEAD_MF_MASK = 0x2000,
IP4_HEAD_OFFSET_MASK = 0x1fff
};
#define IP4_ALLZERO_ADDRESS 0x00000000u
#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
#define IP4_ALLROUTER_ADDRESS 0xE0000002u
//
// Compose the fragment field to be used in the IP4 header.
//
#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 0x1fff)))
#define IP4_LAST_FRAGMENT(FragmentField) \
(((FragmentField) & IP4_HEAD_MF_MASK) == 0)
#define IP4_FIRST_FRAGMENT(FragmentField) \
((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))
#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
//
// Conver the Microsecond to second. IP transmit/receive time is
// in the unit of microsecond. IP ticks once per second.
//
#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
INTN
Ip4GetNetCast (
IN IP4_ADDR IpAddr,
IN IP4_INTERFACE *IpIf
);
INTN
Ip4GetHostCast (
IN IP4_SERVICE *IpSb,
IN IP4_ADDR Dst,
IN IP4_ADDR Src
);
IP4_INTERFACE *
Ip4FindInterface (
IN IP4_SERVICE *IpService,
IN IP4_ADDR Addr
);
IP4_INTERFACE *
Ip4FindNet (
IN IP4_SERVICE *IpService,
IN IP4_ADDR Addr
);
IP4_INTERFACE *
Ip4FindStationAddress (
IN IP4_SERVICE *IpSb,
IN IP4_ADDR Ip,
IN IP4_ADDR Netmask
);
EFI_STATUS
Ip4GetMulticastMac (
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
IN IP4_ADDR Multicast,
OUT EFI_MAC_ADDRESS *Mac
);
IP4_HEAD *
Ip4NtohHead (
IN IP4_HEAD *Head
);
EFI_STATUS
Ip4SetVariableData (
IN IP4_SERVICE *IpSb
);
VOID
Ip4ClearVariableData (
IN IP4_SERVICE *IpSb
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Common.h
Abstract:
Common definition for IP4.
**/
#ifndef __EFI_IP4_COMMON_H__
#define __EFI_IP4_COMMON_H__
typedef struct _IP4_INTERFACE IP4_INTERFACE;
typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
typedef struct _IP4_SERVICE IP4_SERVICE;
enum {
IP4_ETHER_PROTO = 0x0800,
IP4_PROTO_ICMP = 0x01,
IP4_PROTO_IGMP = 0x02,
//
// The packet is received as link level broadcast/multicast/promiscuous.
//
IP4_LINK_BROADCAST = 0x00000001,
IP4_LINK_MULTICAST = 0x00000002,
IP4_LINK_PROMISC = 0x00000004,
//
// IP4 address cast type classfication. Keep it true that any
// type bigger than or equal to LOCAL_BROADCAST is broadcast.
//
IP4_PROMISCUOUS = 1,
IP4_LOCAL_HOST,
IP4_MULTICAST,
IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255
IP4_SUBNET_BROADCAST,
IP4_NET_BROADCAST,
//
// IP4 header flags
//
IP4_HEAD_DF_MASK = 0x4000,
IP4_HEAD_MF_MASK = 0x2000,
IP4_HEAD_OFFSET_MASK = 0x1fff
};
#define IP4_ALLZERO_ADDRESS 0x00000000u
#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
#define IP4_ALLROUTER_ADDRESS 0xE0000002u
//
// Compose the fragment field to be used in the IP4 header.
//
#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 0x1fff)))
#define IP4_LAST_FRAGMENT(FragmentField) \
(((FragmentField) & IP4_HEAD_MF_MASK) == 0)
#define IP4_FIRST_FRAGMENT(FragmentField) \
((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))
#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
//
// Conver the Microsecond to second. IP transmit/receive time is
// in the unit of microsecond. IP ticks once per second.
//
#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
INTN
Ip4GetNetCast (
IN IP4_ADDR IpAddr,
IN IP4_INTERFACE *IpIf
);
INTN
Ip4GetHostCast (
IN IP4_SERVICE *IpSb,
IN IP4_ADDR Dst,
IN IP4_ADDR Src
);
IP4_INTERFACE *
Ip4FindInterface (
IN IP4_SERVICE *IpService,
IN IP4_ADDR Addr
);
IP4_INTERFACE *
Ip4FindNet (
IN IP4_SERVICE *IpService,
IN IP4_ADDR Addr
);
IP4_INTERFACE *
Ip4FindStationAddress (
IN IP4_SERVICE *IpSb,
IN IP4_ADDR Ip,
IN IP4_ADDR Netmask
);
EFI_STATUS
Ip4GetMulticastMac (
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
IN IP4_ADDR Multicast,
OUT EFI_MAC_ADDRESS *Mac
);
IP4_HEAD *
Ip4NtohHead (
IN IP4_HEAD *Head
);
EFI_STATUS
Ip4SetVariableData (
IN IP4_SERVICE *IpSb
);
VOID
Ip4ClearVariableData (
IN IP4_SERVICE *IpSb
);
#endif

View File

@ -56,14 +56,13 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gIp4DriverBinding,
ImageHandle,
&gIp4ComponentName,
NULL,
NULL
&gIp4ComponentName2
);
}

View File

@ -1,84 +1,85 @@
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Driver.h
Abstract:
**/
#ifndef __EFI_IP4_DRIVER_H__
#define __EFI_IP4_DRIVER_H__
#include <Protocol/ServiceBinding.h>
extern EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName;
//
// Function prototype for the driver's entry point
//
EFI_STATUS
EFIAPI
Ip4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
//
// Function prototypes for the Drivr Binding Protocol
//
EFI_STATUS
EFIAPI
Ip4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Ip4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Ip4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// Function ptototypes for the ServiceBinding Prococol
//
EFI_STATUS
EFIAPI
Ip4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Ip4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Driver.h
Abstract:
**/
#ifndef __EFI_IP4_DRIVER_H__
#define __EFI_IP4_DRIVER_H__
#include <Protocol/ServiceBinding.h>
extern EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2;
//
// Function prototype for the driver's entry point
//
EFI_STATUS
EFIAPI
Ip4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
//
// Function prototypes for the Drivr Binding Protocol
//
EFI_STATUS
EFIAPI
Ip4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Ip4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Ip4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// Function ptototypes for the ServiceBinding Prococol
//
EFI_STATUS
EFIAPI
Ip4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Ip4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,99 +1,99 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Icmp.h
Abstract:
Header file for ICMP protocol.
**/
#ifndef __EFI_IP4_ICMP_H__
#define __EFI_IP4_ICMP_H__
enum {
//
// ICMP type definations
//
ICMP_ECHO_REPLY = 0,
ICMP_DEST_UNREACHABLE = 3,
ICMP_SOURCE_QUENCH = 4,
ICMP_REDIRECT = 5,
ICMP_ECHO_REQUEST = 8,
ICMP_TIME_EXCEEDED = 11,
ICMP_PARAMETER_PROBLEM = 12,
ICMP_TIMESTAMP = 13,
ICMP_INFO_REQUEST = 15,
ICMP_INFO_REPLY = 16,
ICMP_TYPE_MAX = ICMP_INFO_REPLY,
ICMP_DEFAULT_CODE = 0,
//
// ICMP code definations for ICMP_DEST_UNREACHABLE
//
ICMP_NET_UNREACHABLE = 0,
ICMP_HOST_UNREACHABLE = 1,
ICMP_PROTO_UNREACHABLE = 2, // Host may generate
ICMP_PORT_UNREACHABLE = 3, // Host may generate
ICMP_FRAGMENT_FAILED = 4,
ICMP_SOURCEROUTE_FAILED = 5, // Host may generate
ICMP_NET_UNKNOWN = 6,
ICMP_HOST_UNKNOWN = 7,
ICMP_SOURCE_ISOLATED = 8,
ICMP_NET_PROHIBITED = 9,
ICMP_HOST_PROHIBITED = 10,
ICMP_NET_UNREACHABLE_TOS = 11,
ICMP_HOST_UNREACHABLE_TOS = 12,
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
ICMP_TIMEOUT_IN_TRANSIT = 0,
ICMp_TIMEOUT_REASSEMBLE = 1, // Host may generate
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
ICMP_NET_REDIRECT = 0,
ICMP_HOST_REDIRECT = 1,
ICMP_NET_TOS_REDIRECT = 2,
ICMP_HOST_TOS_REDIRECT = 3,
//
// ICMP message classes, each class of ICMP message shares
// a common message format. INVALID_MESSAGE is only a flag.
//
ICMP_INVALID_MESSAGE = 0,
ICMP_ERROR_MESSAGE = 1,
ICMP_QUERY_MESSAGE = 2
};
typedef struct {
UINT8 IcmpType;
UINT8 IcmpClass;
} IP4_ICMP_CLASS;
extern IP4_ICMP_CLASS mIcmpClass[];
extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];
EFI_STATUS
Ip4IcmpHandle (
IN IP4_SERVICE *IpSb,
IN IP4_HEAD *Header,
IN NET_BUF *Packet
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Icmp.h
Abstract:
Header file for ICMP protocol.
**/
#ifndef __EFI_IP4_ICMP_H__
#define __EFI_IP4_ICMP_H__
enum {
//
// ICMP type definations
//
ICMP_ECHO_REPLY = 0,
ICMP_DEST_UNREACHABLE = 3,
ICMP_SOURCE_QUENCH = 4,
ICMP_REDIRECT = 5,
ICMP_ECHO_REQUEST = 8,
ICMP_TIME_EXCEEDED = 11,
ICMP_PARAMETER_PROBLEM = 12,
ICMP_TIMESTAMP = 13,
ICMP_INFO_REQUEST = 15,
ICMP_INFO_REPLY = 16,
ICMP_TYPE_MAX = ICMP_INFO_REPLY,
ICMP_DEFAULT_CODE = 0,
//
// ICMP code definations for ICMP_DEST_UNREACHABLE
//
ICMP_NET_UNREACHABLE = 0,
ICMP_HOST_UNREACHABLE = 1,
ICMP_PROTO_UNREACHABLE = 2, // Host may generate
ICMP_PORT_UNREACHABLE = 3, // Host may generate
ICMP_FRAGMENT_FAILED = 4,
ICMP_SOURCEROUTE_FAILED = 5, // Host may generate
ICMP_NET_UNKNOWN = 6,
ICMP_HOST_UNKNOWN = 7,
ICMP_SOURCE_ISOLATED = 8,
ICMP_NET_PROHIBITED = 9,
ICMP_HOST_PROHIBITED = 10,
ICMP_NET_UNREACHABLE_TOS = 11,
ICMP_HOST_UNREACHABLE_TOS = 12,
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
ICMP_TIMEOUT_IN_TRANSIT = 0,
ICMp_TIMEOUT_REASSEMBLE = 1, // Host may generate
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
ICMP_NET_REDIRECT = 0,
ICMP_HOST_REDIRECT = 1,
ICMP_NET_TOS_REDIRECT = 2,
ICMP_HOST_TOS_REDIRECT = 3,
//
// ICMP message classes, each class of ICMP message shares
// a common message format. INVALID_MESSAGE is only a flag.
//
ICMP_INVALID_MESSAGE = 0,
ICMP_ERROR_MESSAGE = 1,
ICMP_QUERY_MESSAGE = 2
};
typedef struct {
UINT8 IcmpType;
UINT8 IcmpClass;
} IP4_ICMP_CLASS;
extern IP4_ICMP_CLASS mIcmpClass[];
extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];
EFI_STATUS
Ip4IcmpHandle (
IN IP4_SERVICE *IpSb,
IN IP4_HEAD *Header,
IN NET_BUF *Packet
);
#endif

View File

@ -1,238 +1,238 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4If.h
Abstract:
Definition for IP4 pesudo interface structure.
**/
#ifndef __EFI_IP4_IF_H__
#define __EFI_IP4_IF_H__
enum {
IP4_FRAME_RX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
IP4_FRAME_TX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
};
//
// This prototype is used by both receive and transmission.
// When receiving Netbuf is allocated by IP4_INTERFACE, and
// released by IP4. Flag shows whether the frame is received
// as link broadcast/multicast...
//
// When transmitting, the Netbuf is from IP4, and provided
// to the callback as a reference. Flag isn't used.
//
// IpInstance can be NULL which means that it is the IP4 driver
// itself sending the packets. IP4 driver may send packets that
// don't belong to any instance, such as ICMP errors, ICMP echo
// responses, or IGMP packets. IpInstance is used as a tag in
// this module.
//
typedef
VOID
(*IP4_FRAME_CALLBACK) (
IP4_PROTOCOL *IpInstance, OPTIONAL
NET_BUF *Packet,
EFI_STATUS IoStatus,
UINT32 LinkFlag,
VOID *Context
);
//
// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
// Upon completion, the Callback will be called. Only one
// receive request is send to MNP. IpInstance is always NULL.
// Reference MNP's spec for information.
//
typedef struct {
UINT32 Signature;
IP4_INTERFACE *Interface;
IP4_PROTOCOL *IpInstance;
IP4_FRAME_CALLBACK CallBack;
VOID *Context;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
} IP4_LINK_RX_TOKEN;
//
// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
// Upon completion, the Callback will be called.
//
typedef struct {
UINT32 Signature;
NET_LIST_ENTRY Link;
IP4_INTERFACE *Interface;
IP4_PROTOCOL *IpInstance;
IP4_FRAME_CALLBACK CallBack;
NET_BUF *Packet;
VOID *Context;
EFI_MAC_ADDRESS DstMac;
EFI_MAC_ADDRESS SrcMac;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;
} IP4_LINK_TX_TOKEN;
//
// Only one ARP request is requested for all the frames in
// a time. It is started for the first frames to the Ip. Any
// subsequent transmission frame will be linked to Frames, and
// be sent all at once the ARP requests succeed.
//
typedef struct {
UINT32 Signature;
NET_LIST_ENTRY Link;
NET_LIST_ENTRY Frames;
IP4_INTERFACE *Interface;
//
// ARP requesting staffs
//
EFI_EVENT OnResolved;
IP4_ADDR Ip;
EFI_MAC_ADDRESS Mac;
} IP4_ARP_QUE;
//
// Callback to select which frame to cancel. Caller can cancel a
// single frame, or all the frame from an IP instance.
//
typedef
BOOLEAN
(*IP4_FRAME_TO_CANCEL) (
IP4_LINK_TX_TOKEN *Frame,
VOID *Context
);
//
// Each IP4 instance has its own station address. All the instances
// with the same station address share a single interface structure.
// Each interface has its own ARP child, and shares one MNP child.
// Notice the special cases that DHCP can configure the interface
// with 0.0.0.0/0.0.0.0.
//
struct _IP4_INTERFACE {
UINT32 Signature;
NET_LIST_ENTRY Link;
INTN RefCnt;
//
// IP address and subnet mask of the interface. It also contains
// the subnet/net broadcast address for quick access. The fileds
// are invalid if (Configured == FALSE)
//
IP4_ADDR Ip;
IP4_ADDR SubnetMask;
IP4_ADDR SubnetBrdcast;
IP4_ADDR NetBrdcast;
BOOLEAN Configured;
//
// Handle used to create/destory ARP child. All the IP children
// share one MNP which is owned by IP service binding.
//
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_ARP_PROTOCOL *Arp;
EFI_HANDLE ArpHandle;
//
// Queues to keep the frames sent and waiting ARP request.
//
NET_LIST_ENTRY ArpQues;
NET_LIST_ENTRY SentFrames;
IP4_LINK_RX_TOKEN *RecvRequest;
//
// The interface's MAC and broadcast MAC address.
//
EFI_MAC_ADDRESS Mac;
EFI_MAC_ADDRESS BroadcastMac;
UINT32 HwaddrLen;
//
// All the IP instances that have the same IP/SubnetMask are linked
// together through IpInstances. If any of the instance enables
// promiscuous receive, PromiscRecv is true.
//
NET_LIST_ENTRY IpInstances;
BOOLEAN PromiscRecv;
};
IP4_INTERFACE *
Ip4CreateInterface (
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
IN EFI_HANDLE Controller,
IN EFI_HANDLE ImageHandle
);
EFI_STATUS
Ip4SetAddress (
IN IP4_INTERFACE *Interface,
IN IP4_ADDR IpAddr,
IN IP4_ADDR SubnetMask
);
EFI_STATUS
Ip4FreeInterface (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance OPTIONAL
);
EFI_STATUS
Ip4SendFrame (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN NET_BUF *Packet,
IN IP4_ADDR NextHop,
IN IP4_FRAME_CALLBACK CallBack,
IN VOID *Context
);
VOID
Ip4CancelFrames (
IN IP4_INTERFACE *Interface,
IN EFI_STATUS IoStatus,
IN IP4_FRAME_TO_CANCEL FrameToCancel, OPTIONAL
IN VOID *Context
);
VOID
Ip4CancelReceive (
IN IP4_INTERFACE *Interface
);
EFI_STATUS
Ip4ReceiveFrame (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN IP4_FRAME_CALLBACK CallBack,
IN VOID *Context
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4If.h
Abstract:
Definition for IP4 pesudo interface structure.
**/
#ifndef __EFI_IP4_IF_H__
#define __EFI_IP4_IF_H__
enum {
IP4_FRAME_RX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
IP4_FRAME_TX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
};
//
// This prototype is used by both receive and transmission.
// When receiving Netbuf is allocated by IP4_INTERFACE, and
// released by IP4. Flag shows whether the frame is received
// as link broadcast/multicast...
//
// When transmitting, the Netbuf is from IP4, and provided
// to the callback as a reference. Flag isn't used.
//
// IpInstance can be NULL which means that it is the IP4 driver
// itself sending the packets. IP4 driver may send packets that
// don't belong to any instance, such as ICMP errors, ICMP echo
// responses, or IGMP packets. IpInstance is used as a tag in
// this module.
//
typedef
VOID
(*IP4_FRAME_CALLBACK) (
IP4_PROTOCOL *IpInstance, OPTIONAL
NET_BUF *Packet,
EFI_STATUS IoStatus,
UINT32 LinkFlag,
VOID *Context
);
//
// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
// Upon completion, the Callback will be called. Only one
// receive request is send to MNP. IpInstance is always NULL.
// Reference MNP's spec for information.
//
typedef struct {
UINT32 Signature;
IP4_INTERFACE *Interface;
IP4_PROTOCOL *IpInstance;
IP4_FRAME_CALLBACK CallBack;
VOID *Context;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
} IP4_LINK_RX_TOKEN;
//
// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
// Upon completion, the Callback will be called.
//
typedef struct {
UINT32 Signature;
NET_LIST_ENTRY Link;
IP4_INTERFACE *Interface;
IP4_PROTOCOL *IpInstance;
IP4_FRAME_CALLBACK CallBack;
NET_BUF *Packet;
VOID *Context;
EFI_MAC_ADDRESS DstMac;
EFI_MAC_ADDRESS SrcMac;
EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken;
EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData;
} IP4_LINK_TX_TOKEN;
//
// Only one ARP request is requested for all the frames in
// a time. It is started for the first frames to the Ip. Any
// subsequent transmission frame will be linked to Frames, and
// be sent all at once the ARP requests succeed.
//
typedef struct {
UINT32 Signature;
NET_LIST_ENTRY Link;
NET_LIST_ENTRY Frames;
IP4_INTERFACE *Interface;
//
// ARP requesting staffs
//
EFI_EVENT OnResolved;
IP4_ADDR Ip;
EFI_MAC_ADDRESS Mac;
} IP4_ARP_QUE;
//
// Callback to select which frame to cancel. Caller can cancel a
// single frame, or all the frame from an IP instance.
//
typedef
BOOLEAN
(*IP4_FRAME_TO_CANCEL) (
IP4_LINK_TX_TOKEN *Frame,
VOID *Context
);
//
// Each IP4 instance has its own station address. All the instances
// with the same station address share a single interface structure.
// Each interface has its own ARP child, and shares one MNP child.
// Notice the special cases that DHCP can configure the interface
// with 0.0.0.0/0.0.0.0.
//
struct _IP4_INTERFACE {
UINT32 Signature;
NET_LIST_ENTRY Link;
INTN RefCnt;
//
// IP address and subnet mask of the interface. It also contains
// the subnet/net broadcast address for quick access. The fileds
// are invalid if (Configured == FALSE)
//
IP4_ADDR Ip;
IP4_ADDR SubnetMask;
IP4_ADDR SubnetBrdcast;
IP4_ADDR NetBrdcast;
BOOLEAN Configured;
//
// Handle used to create/destory ARP child. All the IP children
// share one MNP which is owned by IP service binding.
//
EFI_HANDLE Controller;
EFI_HANDLE Image;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_ARP_PROTOCOL *Arp;
EFI_HANDLE ArpHandle;
//
// Queues to keep the frames sent and waiting ARP request.
//
NET_LIST_ENTRY ArpQues;
NET_LIST_ENTRY SentFrames;
IP4_LINK_RX_TOKEN *RecvRequest;
//
// The interface's MAC and broadcast MAC address.
//
EFI_MAC_ADDRESS Mac;
EFI_MAC_ADDRESS BroadcastMac;
UINT32 HwaddrLen;
//
// All the IP instances that have the same IP/SubnetMask are linked
// together through IpInstances. If any of the instance enables
// promiscuous receive, PromiscRecv is true.
//
NET_LIST_ENTRY IpInstances;
BOOLEAN PromiscRecv;
};
IP4_INTERFACE *
Ip4CreateInterface (
IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp,
IN EFI_HANDLE Controller,
IN EFI_HANDLE ImageHandle
);
EFI_STATUS
Ip4SetAddress (
IN IP4_INTERFACE *Interface,
IN IP4_ADDR IpAddr,
IN IP4_ADDR SubnetMask
);
EFI_STATUS
Ip4FreeInterface (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance OPTIONAL
);
EFI_STATUS
Ip4SendFrame (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN NET_BUF *Packet,
IN IP4_ADDR NextHop,
IN IP4_FRAME_CALLBACK CallBack,
IN VOID *Context
);
VOID
Ip4CancelFrames (
IN IP4_INTERFACE *Interface,
IN EFI_STATUS IoStatus,
IN IP4_FRAME_TO_CANCEL FrameToCancel, OPTIONAL
IN VOID *Context
);
VOID
Ip4CancelReceive (
IN IP4_INTERFACE *Interface
);
EFI_STATUS
Ip4ReceiveFrame (
IN IP4_INTERFACE *Interface,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN IP4_FRAME_CALLBACK CallBack,
IN VOID *Context
);
#endif

View File

@ -1,120 +1,120 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Igmp.h
Abstract:
**/
#ifndef __EFI_IP4_IGMP_H__
#define __EFI_IP4_IGMP_H__
#pragma pack(1)
typedef struct {
UINT8 Type;
UINT8 MaxRespTime;
UINT16 Checksum;
IP4_ADDR Group;
} IGMP_HEAD;
#pragma pack()
//
// The status of multicast group. It isn't necessary to maintain
// explicit state of host state diagram. A group with non-zero
// DelayTime is in "delaying member" state. otherwise, it is in
// "idle member" state.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Address;
INTN DelayTime;
BOOLEAN ReportByUs;
EFI_MAC_ADDRESS Mac;
} IGMP_GROUP;
//
// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
// attached. The Igmpv1QuerySeen remember whether the server on this
// connected network is v1 or v2.
//
typedef struct {
INTN Igmpv1QuerySeen;
NET_LIST_ENTRY Groups;
} IGMP_SERVICE_DATA;
enum {
//
// IGMP message type
//
IGMP_MEMBERSHIP_QUERY = 0x11,
IGMP_V1_MEMBERSHIP_REPORT = 0x12,
IGMP_V2_MEMBERSHIP_REPORT = 0x16,
IGMP_LEAVE_GROUP = 0x17,
IGMP_V1ROUTER_PRESENT = 400,
IGMP_UNSOLICIATED_REPORT = 10
};
EFI_STATUS
Ip4InitIgmp (
IN IP4_SERVICE *IpService
);
EFI_STATUS
Ip4JoinGroup (
IN IP4_PROTOCOL *IpInstance,
IN IP4_ADDR Address
);
EFI_STATUS
Ip4LeaveGroup (
IN IP4_PROTOCOL *IpInstance,
IN IP4_ADDR Address
);
EFI_STATUS
Ip4IgmpHandle (
IN IP4_SERVICE *IpService,
IN IP4_HEAD *Head,
IN NET_BUF *Packet
);
VOID
Ip4IgmpTicking (
IN IP4_SERVICE *IpService
);
IP4_ADDR *
Ip4CombineGroups (
IN IP4_ADDR *SourceGroups,
IN UINT32 Count,
IN IP4_ADDR Addr
);
INTN
Ip4RemoveGroupAddr (
IN IP4_ADDR *Group,
IN UINT32 GroupCnt,
IN IP4_ADDR Addr
);
IGMP_GROUP *
Ip4FindGroup (
IN IGMP_SERVICE_DATA *IgmpCtrl,
IN IP4_ADDR Address
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Igmp.h
Abstract:
**/
#ifndef __EFI_IP4_IGMP_H__
#define __EFI_IP4_IGMP_H__
#pragma pack(1)
typedef struct {
UINT8 Type;
UINT8 MaxRespTime;
UINT16 Checksum;
IP4_ADDR Group;
} IGMP_HEAD;
#pragma pack()
//
// The status of multicast group. It isn't necessary to maintain
// explicit state of host state diagram. A group with non-zero
// DelayTime is in "delaying member" state. otherwise, it is in
// "idle member" state.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Address;
INTN DelayTime;
BOOLEAN ReportByUs;
EFI_MAC_ADDRESS Mac;
} IGMP_GROUP;
//
// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
// attached. The Igmpv1QuerySeen remember whether the server on this
// connected network is v1 or v2.
//
typedef struct {
INTN Igmpv1QuerySeen;
NET_LIST_ENTRY Groups;
} IGMP_SERVICE_DATA;
enum {
//
// IGMP message type
//
IGMP_MEMBERSHIP_QUERY = 0x11,
IGMP_V1_MEMBERSHIP_REPORT = 0x12,
IGMP_V2_MEMBERSHIP_REPORT = 0x16,
IGMP_LEAVE_GROUP = 0x17,
IGMP_V1ROUTER_PRESENT = 400,
IGMP_UNSOLICIATED_REPORT = 10
};
EFI_STATUS
Ip4InitIgmp (
IN IP4_SERVICE *IpService
);
EFI_STATUS
Ip4JoinGroup (
IN IP4_PROTOCOL *IpInstance,
IN IP4_ADDR Address
);
EFI_STATUS
Ip4LeaveGroup (
IN IP4_PROTOCOL *IpInstance,
IN IP4_ADDR Address
);
EFI_STATUS
Ip4IgmpHandle (
IN IP4_SERVICE *IpService,
IN IP4_HEAD *Head,
IN NET_BUF *Packet
);
VOID
Ip4IgmpTicking (
IN IP4_SERVICE *IpService
);
IP4_ADDR *
Ip4CombineGroups (
IN IP4_ADDR *SourceGroups,
IN UINT32 Count,
IN IP4_ADDR Addr
);
INTN
Ip4RemoveGroupAddr (
IN IP4_ADDR *Group,
IN UINT32 GroupCnt,
IN IP4_ADDR Addr
);
IGMP_GROUP *
Ip4FindGroup (
IN IGMP_SERVICE_DATA *IgmpCtrl,
IN IP4_ADDR Address
);
#endif

View File

@ -1,28 +1,28 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Impl.h
Abstract:
Ip4 internal functions and type defintions.
**/
#ifndef __EFI_IP4_IMPL_H__
#define __EFI_IP4_IMPL_H__
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Impl.h
Abstract:
Ip4 internal functions and type defintions.
**/
#ifndef __EFI_IP4_IMPL_H__
#define __EFI_IP4_IMPL_H__
#include <PiDxe.h>
#include <Protocol/IP4.h>
@ -35,224 +35,224 @@ Abstract:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "Ip4Common.h"
#include "Ip4Driver.h"
#include "Ip4If.h"
#include "Ip4Icmp.h"
#include "Ip4Option.h"
#include "Ip4Igmp.h"
#include "Ip4Route.h"
#include "Ip4Input.h"
#include "Ip4Output.h"
enum {
IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),
IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),
//
// The state of IP4 protocol. It starts from UNCONFIGED. if it is
// successfully configured, it goes to CONFIGED. if configure NULL
// is called, it becomes UNCONFIGED again. If (partly) destoried, it
// becomes DESTORY.
//
IP4_STATE_UNCONFIGED = 0,
IP4_STATE_CONFIGED,
IP4_STATE_DESTORY,
//
// The state of IP4 service. It starts from UNSTARTED. It transits
// to STARTED if autoconfigure is started. If default address is
// configured, it becomes CONFIGED. and if partly destoried, it goes
// to DESTORY.
//
IP4_SERVICE_UNSTARTED = 0,
IP4_SERVICE_STARTED,
IP4_SERVICE_CONFIGED,
IP4_SERVICE_DESTORY
};
//
// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is
// needed, each fragment of the Packet has a reference to the
// Packet, no data is actually copied. The Packet will be
// released when all the fragments of it have been recycled by
// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
// user's event signalled.
//
typedef struct {
IP4_PROTOCOL *IpInstance;
EFI_IP4_COMPLETION_TOKEN *Token;
NET_BUF *Packet;
BOOLEAN Sent;
INTN Life;
} IP4_TXTOKEN_WRAP;
//
// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
// upper layers. The received packet is kept in the Packet.
// The Packet itself may be constructured from some fragments.
// All the fragments of the Packet is organized by a
// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
// the upper layer, the assemble entry and its associated
// fragments will be freed at last.
//
typedef struct {
NET_LIST_ENTRY Link;
IP4_PROTOCOL *IpInstance;
NET_BUF *Packet;
EFI_IP4_RECEIVE_DATA RxData;
} IP4_RXDATA_WRAP;
struct _IP4_PROTOCOL {
UINT32 Signature;
EFI_IP4_PROTOCOL Ip4Proto;
EFI_HANDLE Handle;
INTN State;
IP4_SERVICE *Service;
NET_LIST_ENTRY Link; // Link to all the IP protocol from the service
//
// User's transmit/receive tokens, and received/deliverd packets
//
NET_MAP RxTokens;
NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
NET_LIST_ENTRY Received; // Received but not delivered packet
NET_LIST_ENTRY Delivered; // Delivered and to be recycled packets
EFI_LOCK RecycleLock;
//
// Instance's address and route tables. There are two route tables.
// RouteTable is used by the IP4 driver to route packet. EfiRouteTable
// is used to communicate the current route info to the upper layer.
//
IP4_INTERFACE *Interface;
NET_LIST_ENTRY AddrLink; // Ip instances with the same IP address.
IP4_ROUTE_TABLE *RouteTable;
EFI_IP4_ROUTE_TABLE *EfiRouteTable;
UINT32 EfiRouteCount;
//
// IGMP data for this instance
//
IP4_ADDR *Groups; // stored in network byte order
UINT32 GroupCount;
EFI_IP4_CONFIG_DATA ConfigData;
};
struct _IP4_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
INTN State;
BOOLEAN InDestory;
//
// List of all the IP instances and interfaces, and default
// interface and route table and caches.
//
UINTN NumChildren;
NET_LIST_ENTRY Children;
NET_LIST_ENTRY Interfaces;
IP4_INTERFACE *DefaultInterface;
IP4_ROUTE_TABLE *DefaultRouteTable;
//
// Ip reassemble utilities, and IGMP data
//
IP4_ASSEMBLE_TABLE Assemble;
IGMP_SERVICE_DATA IgmpCtrl;
//
// Low level protocol used by this service instance
//
EFI_HANDLE Image;
EFI_HANDLE Controller;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_SIMPLE_NETWORK_MODE SnpMode;
EFI_EVENT Timer;
//
// Auto configure staff
//
EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
EFI_EVENT DoneEvent;
EFI_EVENT ReconfigEvent;
//
// The string representation of the current mac address of the
// NIC this IP4_SERVICE works on.
//
CHAR16 *MacString;
};
#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
EFI_STATUS
Ip4ServiceConfigMnp (
IN IP4_SERVICE *IpSb,
IN BOOLEAN Force
);
VOID
Ip4InitProtocol (
IN IP4_SERVICE *IpSb,
IN IP4_PROTOCOL *IpInstance
);
EFI_STATUS
Ip4CleanProtocol (
IN IP4_PROTOCOL *IpInstance
);
EFI_STATUS
Ip4Cancel (
IN IP4_PROTOCOL *IpInstance,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
Ip4Groups (
IN IP4_PROTOCOL *IpInstance,
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress
);
VOID
EFIAPI
Ip4TimerTicking (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
Ip4SentPacketTicking (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Context
);
#endif
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "Ip4Common.h"
#include "Ip4Driver.h"
#include "Ip4If.h"
#include "Ip4Icmp.h"
#include "Ip4Option.h"
#include "Ip4Igmp.h"
#include "Ip4Route.h"
#include "Ip4Input.h"
#include "Ip4Output.h"
enum {
IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),
IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),
//
// The state of IP4 protocol. It starts from UNCONFIGED. if it is
// successfully configured, it goes to CONFIGED. if configure NULL
// is called, it becomes UNCONFIGED again. If (partly) destoried, it
// becomes DESTORY.
//
IP4_STATE_UNCONFIGED = 0,
IP4_STATE_CONFIGED,
IP4_STATE_DESTORY,
//
// The state of IP4 service. It starts from UNSTARTED. It transits
// to STARTED if autoconfigure is started. If default address is
// configured, it becomes CONFIGED. and if partly destoried, it goes
// to DESTORY.
//
IP4_SERVICE_UNSTARTED = 0,
IP4_SERVICE_STARTED,
IP4_SERVICE_CONFIGED,
IP4_SERVICE_DESTORY
};
//
// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
// The user's data is kept in the Packet. When fragment is
// needed, each fragment of the Packet has a reference to the
// Packet, no data is actually copied. The Packet will be
// released when all the fragments of it have been recycled by
// MNP. Upon then, the IP4_TXTOKEN_WRAP will be released, and
// user's event signalled.
//
typedef struct {
IP4_PROTOCOL *IpInstance;
EFI_IP4_COMPLETION_TOKEN *Token;
NET_BUF *Packet;
BOOLEAN Sent;
INTN Life;
} IP4_TXTOKEN_WRAP;
//
// IP4_RXDATA_WRAP wraps the data IP4 child delivers to the
// upper layers. The received packet is kept in the Packet.
// The Packet itself may be constructured from some fragments.
// All the fragments of the Packet is organized by a
// IP4_ASSEMBLE_ENTRY structure. If the Packet is recycled by
// the upper layer, the assemble entry and its associated
// fragments will be freed at last.
//
typedef struct {
NET_LIST_ENTRY Link;
IP4_PROTOCOL *IpInstance;
NET_BUF *Packet;
EFI_IP4_RECEIVE_DATA RxData;
} IP4_RXDATA_WRAP;
struct _IP4_PROTOCOL {
UINT32 Signature;
EFI_IP4_PROTOCOL Ip4Proto;
EFI_HANDLE Handle;
INTN State;
IP4_SERVICE *Service;
NET_LIST_ENTRY Link; // Link to all the IP protocol from the service
//
// User's transmit/receive tokens, and received/deliverd packets
//
NET_MAP RxTokens;
NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
NET_LIST_ENTRY Received; // Received but not delivered packet
NET_LIST_ENTRY Delivered; // Delivered and to be recycled packets
EFI_LOCK RecycleLock;
//
// Instance's address and route tables. There are two route tables.
// RouteTable is used by the IP4 driver to route packet. EfiRouteTable
// is used to communicate the current route info to the upper layer.
//
IP4_INTERFACE *Interface;
NET_LIST_ENTRY AddrLink; // Ip instances with the same IP address.
IP4_ROUTE_TABLE *RouteTable;
EFI_IP4_ROUTE_TABLE *EfiRouteTable;
UINT32 EfiRouteCount;
//
// IGMP data for this instance
//
IP4_ADDR *Groups; // stored in network byte order
UINT32 GroupCount;
EFI_IP4_CONFIG_DATA ConfigData;
};
struct _IP4_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
INTN State;
BOOLEAN InDestory;
//
// List of all the IP instances and interfaces, and default
// interface and route table and caches.
//
UINTN NumChildren;
NET_LIST_ENTRY Children;
NET_LIST_ENTRY Interfaces;
IP4_INTERFACE *DefaultInterface;
IP4_ROUTE_TABLE *DefaultRouteTable;
//
// Ip reassemble utilities, and IGMP data
//
IP4_ASSEMBLE_TABLE Assemble;
IGMP_SERVICE_DATA IgmpCtrl;
//
// Low level protocol used by this service instance
//
EFI_HANDLE Image;
EFI_HANDLE Controller;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
EFI_SIMPLE_NETWORK_MODE SnpMode;
EFI_EVENT Timer;
//
// Auto configure staff
//
EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
EFI_EVENT DoneEvent;
EFI_EVENT ReconfigEvent;
//
// The string representation of the current mac address of the
// NIC this IP4_SERVICE works on.
//
CHAR16 *MacString;
};
#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
EFI_STATUS
Ip4ServiceConfigMnp (
IN IP4_SERVICE *IpSb,
IN BOOLEAN Force
);
VOID
Ip4InitProtocol (
IN IP4_SERVICE *IpSb,
IN IP4_PROTOCOL *IpInstance
);
EFI_STATUS
Ip4CleanProtocol (
IN IP4_PROTOCOL *IpInstance
);
EFI_STATUS
Ip4Cancel (
IN IP4_PROTOCOL *IpInstance,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
Ip4Groups (
IN IP4_PROTOCOL *IpInstance,
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress
);
VOID
EFIAPI
Ip4TimerTicking (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
Ip4SentPacketTicking (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Context
);
#endif

View File

@ -1,138 +1,138 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Input.h
Abstract:
**/
#ifndef __EFI_IP4_INPUT_H__
#define __EFI_IP4_INPUT_H__
enum {
IP4_MIN_HEADLEN = 20,
IP4_MAX_HEADLEN = 60,
IP4_ASSEMLE_HASH_SIZE = 31,
IP4_FRAGMENT_LIFE = 120,
IP4_MAX_PACKET_SIZE = 65535
};
//
// Per packet information for input process. LinkFlag specifies whether
// the packet is received as Link layer unicast, multicast or broadcast.
// The CastType is the IP layer cast type, such as IP multicast or unicast.
// Start, End and Length are staffs used to assemble the packets. Start
// is the sequence number of the first byte of data in the packet. Length
// is the number of bytes of data. End = Start + Length, that is, the
// sequence number of last byte + 1. Each assembled packet has a count down
// life. If it isn't consumed before Life reaches zero, the packet is released.
//
typedef struct {
UINTN LinkFlag;
INTN CastType;
INTN Start;
INTN End;
INTN Length;
UINT32 Life;
EFI_STATUS Status;
} IP4_CLIP_INFO;
//
// Structure used to assemble IP packets.
//
typedef struct {
NET_LIST_ENTRY Link;
//
// Identity of one IP4 packet. Each fragment of a packet has
// the same (Dst, Src, Id, Protocol).
//
IP4_ADDR Dst;
IP4_ADDR Src;
UINT16 Id;
UINT8 Protocol;
INTN TotalLen;
INTN CurLen;
NET_LIST_ENTRY Fragments; // List of all the fragments of this packet
IP4_HEAD *Head; // IP head of the first fragment
IP4_CLIP_INFO *Info; // Per packet info of the first fragment
INTN Life; // Count down life for the packet.
} IP4_ASSEMBLE_ENTRY;
//
// Each Ip service instance has an assemble table to reassemble
// the packets before delivery to its children. It is organized
// as hash table.
//
typedef struct {
NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
} IP4_ASSEMBLE_TABLE;
#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \
(((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
#define IP4_RXDATA_WRAP_SIZE(NumFrag) \
(sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
VOID
Ip4InitAssembleTable (
IN IP4_ASSEMBLE_TABLE *Table
);
VOID
Ip4CleanAssembleTable (
IN IP4_ASSEMBLE_TABLE *Table
);
VOID
Ip4AccpetFrame (
IN IP4_PROTOCOL *Ip4Instance,
IN NET_BUF *Packet,
IN EFI_STATUS IoStatus,
IN UINT32 Flag,
IN VOID *Context
);
EFI_STATUS
Ip4Demultiplex (
IN IP4_SERVICE *SbInstance,
IN IP4_HEAD *Head,
IN NET_BUF *Packet
);
INTN
Ip4InterfaceEnquePacket (
IN IP4_SERVICE *SbInstance,
IN IP4_HEAD *Head,
IN NET_BUF *Packet,
IN IP4_INTERFACE *Interface
);
EFI_STATUS
Ip4InstanceDeliverPacket (
IN IP4_PROTOCOL *Ip4Instance
);
VOID
Ip4PacketTimerTicking (
IN IP4_SERVICE *IpSb
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Input.h
Abstract:
**/
#ifndef __EFI_IP4_INPUT_H__
#define __EFI_IP4_INPUT_H__
enum {
IP4_MIN_HEADLEN = 20,
IP4_MAX_HEADLEN = 60,
IP4_ASSEMLE_HASH_SIZE = 31,
IP4_FRAGMENT_LIFE = 120,
IP4_MAX_PACKET_SIZE = 65535
};
//
// Per packet information for input process. LinkFlag specifies whether
// the packet is received as Link layer unicast, multicast or broadcast.
// The CastType is the IP layer cast type, such as IP multicast or unicast.
// Start, End and Length are staffs used to assemble the packets. Start
// is the sequence number of the first byte of data in the packet. Length
// is the number of bytes of data. End = Start + Length, that is, the
// sequence number of last byte + 1. Each assembled packet has a count down
// life. If it isn't consumed before Life reaches zero, the packet is released.
//
typedef struct {
UINTN LinkFlag;
INTN CastType;
INTN Start;
INTN End;
INTN Length;
UINT32 Life;
EFI_STATUS Status;
} IP4_CLIP_INFO;
//
// Structure used to assemble IP packets.
//
typedef struct {
NET_LIST_ENTRY Link;
//
// Identity of one IP4 packet. Each fragment of a packet has
// the same (Dst, Src, Id, Protocol).
//
IP4_ADDR Dst;
IP4_ADDR Src;
UINT16 Id;
UINT8 Protocol;
INTN TotalLen;
INTN CurLen;
NET_LIST_ENTRY Fragments; // List of all the fragments of this packet
IP4_HEAD *Head; // IP head of the first fragment
IP4_CLIP_INFO *Info; // Per packet info of the first fragment
INTN Life; // Count down life for the packet.
} IP4_ASSEMBLE_ENTRY;
//
// Each Ip service instance has an assemble table to reassemble
// the packets before delivery to its children. It is organized
// as hash table.
//
typedef struct {
NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
} IP4_ASSEMBLE_TABLE;
#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \
(((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
#define IP4_RXDATA_WRAP_SIZE(NumFrag) \
(sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
VOID
Ip4InitAssembleTable (
IN IP4_ASSEMBLE_TABLE *Table
);
VOID
Ip4CleanAssembleTable (
IN IP4_ASSEMBLE_TABLE *Table
);
VOID
Ip4AccpetFrame (
IN IP4_PROTOCOL *Ip4Instance,
IN NET_BUF *Packet,
IN EFI_STATUS IoStatus,
IN UINT32 Flag,
IN VOID *Context
);
EFI_STATUS
Ip4Demultiplex (
IN IP4_SERVICE *SbInstance,
IN IP4_HEAD *Head,
IN NET_BUF *Packet
);
INTN
Ip4InterfaceEnquePacket (
IN IP4_SERVICE *SbInstance,
IN IP4_HEAD *Head,
IN NET_BUF *Packet,
IN IP4_INTERFACE *Interface
);
EFI_STATUS
Ip4InstanceDeliverPacket (
IN IP4_PROTOCOL *Ip4Instance
);
VOID
Ip4PacketTimerTicking (
IN IP4_SERVICE *IpSb
);
#endif

View File

@ -1,52 +1,52 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Option.h
Abstract:
IP4 option support routines.
**/
#ifndef __EFI_IP4_OPTION_H__
#define __EFI_IP4_OPTION_H__
enum {
IP4_OPTION_EOP = 0,
IP4_OPTION_NOP = 1,
IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
IP4_OPTION_RR = 7, // Record routing, 00000111
IP4_OPTION_COPY_MASK = 0x80
};
BOOLEAN
Ip4OptionIsValid (
IN UINT8 *Option,
IN UINT32 OptLen,
IN BOOLEAN Rcvd
);
EFI_STATUS
Ip4CopyOption (
IN UINT8 *Option,
IN UINT32 OptLen,
IN BOOLEAN Fragment,
IN UINT8 *Buf, OPTIONAL
IN OUT UINT32 *BufLen
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Option.h
Abstract:
IP4 option support routines.
**/
#ifndef __EFI_IP4_OPTION_H__
#define __EFI_IP4_OPTION_H__
enum {
IP4_OPTION_EOP = 0,
IP4_OPTION_NOP = 1,
IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
IP4_OPTION_RR = 7, // Record routing, 00000111
IP4_OPTION_COPY_MASK = 0x80
};
BOOLEAN
Ip4OptionIsValid (
IN UINT8 *Option,
IN UINT32 OptLen,
IN BOOLEAN Rcvd
);
EFI_STATUS
Ip4CopyOption (
IN UINT8 *Option,
IN UINT32 OptLen,
IN BOOLEAN Fragment,
IN UINT8 *Buf, OPTIONAL
IN OUT UINT32 *BufLen
);
#endif

View File

@ -1,54 +1,54 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Output.h
Abstract:
**/
#ifndef __EFI_IP4_OUTPUT_H__
#define __EFI_IP4_OUTPUT_H__
VOID
Ip4SysPacketSent (
IP4_PROTOCOL *Ip4Instance,
NET_BUF *Packet,
EFI_STATUS IoStatus,
UINT32 Flag,
VOID *Context
);
EFI_STATUS
Ip4Output (
IN IP4_SERVICE *IpSb,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN NET_BUF *Data,
IN IP4_HEAD *Head,
IN UINT8 *Option,
IN UINT32 OptLen,
IN IP4_ADDR GateWay,
IN IP4_FRAME_CALLBACK Callback,
IN VOID *Context
);
VOID
Ip4CancelPacket (
IN IP4_INTERFACE *IpIf,
IN NET_BUF *Packet,
IN EFI_STATUS IoStatus
);
extern UINT16 mIp4Id;
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Output.h
Abstract:
**/
#ifndef __EFI_IP4_OUTPUT_H__
#define __EFI_IP4_OUTPUT_H__
VOID
Ip4SysPacketSent (
IP4_PROTOCOL *Ip4Instance,
NET_BUF *Packet,
EFI_STATUS IoStatus,
UINT32 Flag,
VOID *Context
);
EFI_STATUS
Ip4Output (
IN IP4_SERVICE *IpSb,
IN IP4_PROTOCOL *IpInstance, OPTIONAL
IN NET_BUF *Data,
IN IP4_HEAD *Head,
IN UINT8 *Option,
IN UINT32 OptLen,
IN IP4_ADDR GateWay,
IN IP4_FRAME_CALLBACK Callback,
IN VOID *Context
);
VOID
Ip4CancelPacket (
IN IP4_INTERFACE *IpIf,
IN NET_BUF *Packet,
IN EFI_STATUS IoStatus
);
extern UINT16 mIp4Id;
#endif

View File

@ -1,151 +1,151 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Route.h
Abstract:
EFI IP4 route table and route cache table defintions.
**/
#ifndef __EFI_IP4_ROUTE_H__
#define __EFI_IP4_ROUTE_H__
#include "IP4Common.h"
enum {
IP4_DIRECT_ROUTE = 0x00000001,
IP4_ROUTE_CACHE_HASH = 31,
IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
};
#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
//
// The route entry in the route table. Dest/Netmask is the destion
// network. The nexthop is the gateway to send the packet to in
// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
// on, the gateway is the destination of the IP packet itself. Route
// enties of the connected network have the flag on.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Dest;
IP4_ADDR Netmask;
IP4_ADDR NextHop;
UINT32 Flag;
} IP4_ROUTE_ENTRY;
//
// The route cache entry. The route cache entry is optional.
// But it is necessary to support the ICMP redirect message.
// Check Ip4ProcessIcmpRedirect for information.
//
// The cache entry field Tag is used to tag all the route
// cache entry spawned from a route table entry. This makes
// it simple to delete all the route cache entries from a
// to-be-deleted route entry.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Dest;
IP4_ADDR Src;
IP4_ADDR NextHop;
UINTN Tag;
} IP4_ROUTE_CACHE_ENTRY;
//
// The route cache table is organized as a hash table. Each
// IP4 route table has a embedded route cache. For now the
// route cache and route table are binded togehter. But keep
// the route cache a seperated structure in case we want to
// detach them later.
//
typedef struct {
NET_LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
} IP4_ROUTE_CACHE;
//
// Each IP4 instance has its own route table. Each ServiceBinding
// instance has a default route table and default address.
//
// All the route table entries with the same mask are linked
// together in one route area. For example, RouteArea[0] contains
// the default routes. A route table also contains a route cache.
//
typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
struct _IP4_ROUTE_TABLE {
INTN RefCnt;
UINT32 TotalNum;
NET_LIST_ENTRY RouteArea[IP4_MASK_NUM];
IP4_ROUTE_TABLE *Next;
IP4_ROUTE_CACHE Cache;
};
IP4_ROUTE_TABLE*
Ip4CreateRouteTable (
VOID
);
VOID
Ip4FreeRouteTable (
IN IP4_ROUTE_TABLE *RouteTable
);
EFI_STATUS
Ip4AddRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
);
EFI_STATUS
Ip4DelRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
);
IP4_ROUTE_CACHE_ENTRY *
Ip4FindRouteCache (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Src
);
VOID
Ip4FreeRouteCacheEntry (
IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry
);
IP4_ROUTE_CACHE_ENTRY *
Ip4Route (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Src
);
EFI_STATUS
Ip4BuildEfiRouteTable (
IN IP4_PROTOCOL *IpInstance
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Ip4Route.h
Abstract:
EFI IP4 route table and route cache table defintions.
**/
#ifndef __EFI_IP4_ROUTE_H__
#define __EFI_IP4_ROUTE_H__
#include "IP4Common.h"
enum {
IP4_DIRECT_ROUTE = 0x00000001,
IP4_ROUTE_CACHE_HASH = 31,
IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
};
#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
//
// The route entry in the route table. Dest/Netmask is the destion
// network. The nexthop is the gateway to send the packet to in
// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
// on, the gateway is the destination of the IP packet itself. Route
// enties of the connected network have the flag on.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Dest;
IP4_ADDR Netmask;
IP4_ADDR NextHop;
UINT32 Flag;
} IP4_ROUTE_ENTRY;
//
// The route cache entry. The route cache entry is optional.
// But it is necessary to support the ICMP redirect message.
// Check Ip4ProcessIcmpRedirect for information.
//
// The cache entry field Tag is used to tag all the route
// cache entry spawned from a route table entry. This makes
// it simple to delete all the route cache entries from a
// to-be-deleted route entry.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN RefCnt;
IP4_ADDR Dest;
IP4_ADDR Src;
IP4_ADDR NextHop;
UINTN Tag;
} IP4_ROUTE_CACHE_ENTRY;
//
// The route cache table is organized as a hash table. Each
// IP4 route table has a embedded route cache. For now the
// route cache and route table are binded togehter. But keep
// the route cache a seperated structure in case we want to
// detach them later.
//
typedef struct {
NET_LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
} IP4_ROUTE_CACHE;
//
// Each IP4 instance has its own route table. Each ServiceBinding
// instance has a default route table and default address.
//
// All the route table entries with the same mask are linked
// together in one route area. For example, RouteArea[0] contains
// the default routes. A route table also contains a route cache.
//
typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
struct _IP4_ROUTE_TABLE {
INTN RefCnt;
UINT32 TotalNum;
NET_LIST_ENTRY RouteArea[IP4_MASK_NUM];
IP4_ROUTE_TABLE *Next;
IP4_ROUTE_CACHE Cache;
};
IP4_ROUTE_TABLE*
Ip4CreateRouteTable (
VOID
);
VOID
Ip4FreeRouteTable (
IN IP4_ROUTE_TABLE *RouteTable
);
EFI_STATUS
Ip4AddRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
);
EFI_STATUS
Ip4DelRoute (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Netmask,
IN IP4_ADDR Gateway
);
IP4_ROUTE_CACHE_ENTRY *
Ip4FindRouteCache (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Src
);
VOID
Ip4FreeRouteCacheEntry (
IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry
);
IP4_ROUTE_CACHE_ENTRY *
Ip4Route (
IN IP4_ROUTE_TABLE *RtTable,
IN IP4_ADDR Dest,
IN IP4_ADDR Src
);
EFI_STATUS
Ip4BuildEfiRouteTable (
IN IP4_PROTOCOL *IpInstance
);
#endif

View File

@ -24,6 +24,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
MnpComponentNameGetDriverName (
@ -32,6 +71,75 @@ MnpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
MnpComponentNameGetControllerName (
@ -42,18 +150,29 @@ MnpComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {
MnpComponentNameGetDriverName,
MnpComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) MnpComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) MnpComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {
{
"eng",
"eng;en",
L"MNP Network Service Driver"
},
{
@ -62,6 +181,45 @@ STATIC EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
MnpComponentNameGetDriverName (
@ -69,41 +227,84 @@ MnpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gMnpComponentName.SupportedLanguages,
mMnpDriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mMnpDriverNameTable,
DriverName,
(BOOLEAN)(This == &gMnpComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
MnpComponentNameGetControllerName (
@ -113,50 +314,6 @@ MnpComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1,28 +1,28 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpDebug.h
Abstract:
**/
#ifndef _MNP_DEBUG_H_
#define _MNP_DEBUG_H_
#define MNP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Mnp", PrintArg)
#define MNP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Mnp", PrintArg)
#define MNP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Mnp", PrintArg)
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpDebug.h
Abstract:
**/
#ifndef _MNP_DEBUG_H_
#define _MNP_DEBUG_H_
#define MNP_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Mnp", PrintArg)
#define MNP_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Mnp", PrintArg)
#define MNP_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Mnp", PrintArg)
#endif

View File

@ -547,13 +547,12 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gMnpDriverBinding,
ImageHandle,
&gMnpComponentName,
NULL,
NULL
&gMnpComponentName2
);
}

View File

@ -1,137 +1,138 @@
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpDriver.h
Abstract:
**/
#ifndef _MNP_DRIVER_H_
#define _MNP_DRIVER_H_
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpDriver.h
Abstract:
**/
#ifndef _MNP_DRIVER_H_
#define _MNP_DRIVER_H_
#include <PiDxe.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/ServiceBinding.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include "MnpDebug.h"
//
// Required Global Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;
#define MNP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'S')
typedef struct _MNP_SERVICE_DATA {
UINT32 Signature;
EFI_HANDLE ControllerHandle;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
UINT32 Mtu;
NET_LIST_ENTRY ChildrenList;
UINTN ChildrenNumber;
UINTN ConfiguredChildrenNumber;
NET_LIST_ENTRY GroupAddressList;
UINT32 GroupAddressCount;
EFI_EVENT TxTimeoutEvent;
NET_BUF_QUEUE FreeNbufQue;
INTN NbufCnt;
EFI_EVENT PollTimer;
BOOLEAN EnableSystemPoll;
EFI_EVENT TimeoutCheckTimer;
UINT32 UnicastCount;
UINT32 BroadcastCount;
UINT32 MulticastCount;
UINT32 PromiscuousCount;
//
// The size of the data buffer in the MNP_PACKET_BUFFER used to
// store a packet.
//
UINT32 BufferLength;
UINT32 PaddingSize;
NET_BUF *RxNbufCache;
UINT8 *TxBuf;
} MNP_SERVICE_DATA;
#define MNP_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
MNP_SERVICE_DATA, \
ServiceBinding, \
MNP_SERVICE_DATA_SIGNATURE \
)
EFI_STATUS
EFIAPI
MnpDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
MnpDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
MnpDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
MnpServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
MnpServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include "MnpDebug.h"
//
// Required Global Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2;
#define MNP_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'S')
typedef struct _MNP_SERVICE_DATA {
UINT32 Signature;
EFI_HANDLE ControllerHandle;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
UINT32 Mtu;
NET_LIST_ENTRY ChildrenList;
UINTN ChildrenNumber;
UINTN ConfiguredChildrenNumber;
NET_LIST_ENTRY GroupAddressList;
UINT32 GroupAddressCount;
EFI_EVENT TxTimeoutEvent;
NET_BUF_QUEUE FreeNbufQue;
INTN NbufCnt;
EFI_EVENT PollTimer;
BOOLEAN EnableSystemPoll;
EFI_EVENT TimeoutCheckTimer;
UINT32 UnicastCount;
UINT32 BroadcastCount;
UINT32 MulticastCount;
UINT32 PromiscuousCount;
//
// The size of the data buffer in the MNP_PACKET_BUFFER used to
// store a packet.
//
UINT32 BufferLength;
UINT32 PaddingSize;
NET_BUF *RxNbufCache;
UINT8 *TxBuf;
} MNP_SERVICE_DATA;
#define MNP_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
MNP_SERVICE_DATA, \
ServiceBinding, \
MNP_SERVICE_DATA_SIGNATURE \
)
EFI_STATUS
EFIAPI
MnpDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
MnpDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
MnpDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
MnpServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
MnpServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,274 +1,274 @@
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpImpl.h
Abstract:
**/
#ifndef _MNP_IMPL_H_
#define _MNP_IMPL_H_
#include "MnpDriver.h"
#include "MnpDebug.h"
#define NET_ETHER_FCS_SIZE 4
#define MNP_SYS_POLL_INTERVAL (2 * TICKS_PER_MS) // 2 milliseconds
#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
#define MNP_INIT_NET_BUFFER_NUM 512
#define MNP_NET_BUFFER_INCREASEMENT 64
#define MNP_MAX_NET_BUFFER_NUM 65536
#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256
#define MNP_RECEIVE_UNICAST 0x01
#define MNP_RECEIVE_BROADCAST 0x02
#define UNICAST_PACKET MNP_RECEIVE_UNICAST
#define BROADCAST_PACKET MNP_RECEIVE_BROADCAST
#define MNP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'I')
#define MNP_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
MNP_INSTANCE_DATA, \
ManagedNetwork, \
MNP_INSTANCE_DATA_SIGNATURE \
)
typedef struct _MNP_INSTANCE_DATA {
UINT32 Signature;
MNP_SERVICE_DATA *MnpServiceData;
EFI_HANDLE Handle;
NET_LIST_ENTRY InstEntry;
EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;
BOOLEAN Configured;
BOOLEAN Destroyed;
NET_LIST_ENTRY GroupCtrlBlkList;
NET_MAP RxTokenMap;
NET_LIST_ENTRY RxDeliveredPacketQueue;
NET_LIST_ENTRY RcvdPacketQueue;
UINTN RcvdPacketQueueSize;
EFI_MANAGED_NETWORK_CONFIG_DATA ConfigData;
UINT8 ReceiveFilter;
} MNP_INSTANCE_DATA;
typedef struct _MNP_GROUP_ADDRESS {
NET_LIST_ENTRY AddrEntry;
EFI_MAC_ADDRESS Address;
INTN RefCnt;
} MNP_GROUP_ADDRESS;
typedef struct _MNP_GROUP_CONTROL_BLOCK {
NET_LIST_ENTRY CtrlBlkEntry;
MNP_GROUP_ADDRESS *GroupAddress;
} MNP_GROUP_CONTROL_BLOCK;
typedef struct _MNP_RXDATA_WRAP {
NET_LIST_ENTRY WrapEntry;
MNP_INSTANCE_DATA *Instance;
EFI_MANAGED_NETWORK_RECEIVE_DATA RxData;
NET_BUF *Nbuf;
UINT64 TimeoutTick;
} MNP_RXDATA_WRAP;
EFI_STATUS
MnpInitializeServiceData (
IN MNP_SERVICE_DATA *MnpServiceData,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle
);
VOID
MnpFlushServiceData (
MNP_SERVICE_DATA *MnpServiceData
);
VOID
MnpInitializeInstanceData (
IN MNP_SERVICE_DATA *MnpServiceData,
IN MNP_INSTANCE_DATA *Instance
);
EFI_STATUS
MnpTokenExist (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg
);
EFI_STATUS
MnpCancelTokens (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg
);
VOID
MnpFlushRcvdDataQueue (
IN MNP_INSTANCE_DATA *Instance
);
EFI_STATUS
MnpConfigureInstance (
IN MNP_INSTANCE_DATA *Instance,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
);
EFI_STATUS
MnpGroupOp (
IN MNP_INSTANCE_DATA *Instance,
IN BOOLEAN JoinFlag,
IN EFI_MAC_ADDRESS *MacAddr OPTIONAL,
IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
);
BOOLEAN
MnpIsValidTxToken (
IN MNP_INSTANCE_DATA *Instance,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
VOID
MnpBuildTxPacket (
IN MNP_SERVICE_DATA *MnpServiceData,
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
OUT UINT8 **PktBuf,
OUT UINT32 *PktLen
);
EFI_STATUS
MnpSyncSendPacket (
IN MNP_SERVICE_DATA *MnpServiceData,
IN UINT8 *Packet,
IN UINT32 Length,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
MnpInstanceDeliverPacket (
IN MNP_INSTANCE_DATA *Instance
);
VOID
EFIAPI
MnpRecycleRxData (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
MnpReceivePacket (
IN MNP_SERVICE_DATA *MnpServiceData
);
NET_BUF *
MnpAllocNbuf (
IN MNP_SERVICE_DATA *MnpServiceData
);
VOID
MnpFreeNbuf (
IN MNP_SERVICE_DATA *MnpServiceData,
IN NET_BUF *Nbuf
);
VOID
EFIAPI
MnpCheckPacketTimeout (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
MnpSystemPoll (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
EFIAPI
MnpGetModeData (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
EFI_STATUS
EFIAPI
MnpConfigure (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
MnpMcastIpToMac (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN BOOLEAN Ipv6Flag,
IN EFI_IP_ADDRESS *IpAddress,
OUT EFI_MAC_ADDRESS *MacAddress
);
EFI_STATUS
EFIAPI
MnpGroups (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN BOOLEAN JoinFlag,
IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
);
EFI_STATUS
EFIAPI
MnpTransmit (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
MnpCancel (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
);
EFI_STATUS
EFIAPI
MnpReceive (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
MnpPoll (
IN EFI_MANAGED_NETWORK_PROTOCOL *This
);
#endif
/** @file
Copyright (c) 2005 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MnpImpl.h
Abstract:
**/
#ifndef _MNP_IMPL_H_
#define _MNP_IMPL_H_
#include "MnpDriver.h"
#include "MnpDebug.h"
#define NET_ETHER_FCS_SIZE 4
#define MNP_SYS_POLL_INTERVAL (2 * TICKS_PER_MS) // 2 milliseconds
#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
#define MNP_INIT_NET_BUFFER_NUM 512
#define MNP_NET_BUFFER_INCREASEMENT 64
#define MNP_MAX_NET_BUFFER_NUM 65536
#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256
#define MNP_RECEIVE_UNICAST 0x01
#define MNP_RECEIVE_BROADCAST 0x02
#define UNICAST_PACKET MNP_RECEIVE_UNICAST
#define BROADCAST_PACKET MNP_RECEIVE_BROADCAST
#define MNP_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32 ('M', 'n', 'p', 'I')
#define MNP_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
MNP_INSTANCE_DATA, \
ManagedNetwork, \
MNP_INSTANCE_DATA_SIGNATURE \
)
typedef struct _MNP_INSTANCE_DATA {
UINT32 Signature;
MNP_SERVICE_DATA *MnpServiceData;
EFI_HANDLE Handle;
NET_LIST_ENTRY InstEntry;
EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;
BOOLEAN Configured;
BOOLEAN Destroyed;
NET_LIST_ENTRY GroupCtrlBlkList;
NET_MAP RxTokenMap;
NET_LIST_ENTRY RxDeliveredPacketQueue;
NET_LIST_ENTRY RcvdPacketQueue;
UINTN RcvdPacketQueueSize;
EFI_MANAGED_NETWORK_CONFIG_DATA ConfigData;
UINT8 ReceiveFilter;
} MNP_INSTANCE_DATA;
typedef struct _MNP_GROUP_ADDRESS {
NET_LIST_ENTRY AddrEntry;
EFI_MAC_ADDRESS Address;
INTN RefCnt;
} MNP_GROUP_ADDRESS;
typedef struct _MNP_GROUP_CONTROL_BLOCK {
NET_LIST_ENTRY CtrlBlkEntry;
MNP_GROUP_ADDRESS *GroupAddress;
} MNP_GROUP_CONTROL_BLOCK;
typedef struct _MNP_RXDATA_WRAP {
NET_LIST_ENTRY WrapEntry;
MNP_INSTANCE_DATA *Instance;
EFI_MANAGED_NETWORK_RECEIVE_DATA RxData;
NET_BUF *Nbuf;
UINT64 TimeoutTick;
} MNP_RXDATA_WRAP;
EFI_STATUS
MnpInitializeServiceData (
IN MNP_SERVICE_DATA *MnpServiceData,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle
);
VOID
MnpFlushServiceData (
MNP_SERVICE_DATA *MnpServiceData
);
VOID
MnpInitializeInstanceData (
IN MNP_SERVICE_DATA *MnpServiceData,
IN MNP_INSTANCE_DATA *Instance
);
EFI_STATUS
MnpTokenExist (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg
);
EFI_STATUS
MnpCancelTokens (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg
);
VOID
MnpFlushRcvdDataQueue (
IN MNP_INSTANCE_DATA *Instance
);
EFI_STATUS
MnpConfigureInstance (
IN MNP_INSTANCE_DATA *Instance,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
);
EFI_STATUS
MnpGroupOp (
IN MNP_INSTANCE_DATA *Instance,
IN BOOLEAN JoinFlag,
IN EFI_MAC_ADDRESS *MacAddr OPTIONAL,
IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
);
BOOLEAN
MnpIsValidTxToken (
IN MNP_INSTANCE_DATA *Instance,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
VOID
MnpBuildTxPacket (
IN MNP_SERVICE_DATA *MnpServiceData,
IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData,
OUT UINT8 **PktBuf,
OUT UINT32 *PktLen
);
EFI_STATUS
MnpSyncSendPacket (
IN MNP_SERVICE_DATA *MnpServiceData,
IN UINT8 *Packet,
IN UINT32 Length,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
MnpInstanceDeliverPacket (
IN MNP_INSTANCE_DATA *Instance
);
VOID
EFIAPI
MnpRecycleRxData (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
MnpReceivePacket (
IN MNP_SERVICE_DATA *MnpServiceData
);
NET_BUF *
MnpAllocNbuf (
IN MNP_SERVICE_DATA *MnpServiceData
);
VOID
MnpFreeNbuf (
IN MNP_SERVICE_DATA *MnpServiceData,
IN NET_BUF *Nbuf
);
VOID
EFIAPI
MnpCheckPacketTimeout (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
MnpSystemPoll (
IN EFI_EVENT Event,
IN VOID *Context
);
EFI_STATUS
EFIAPI
MnpGetModeData (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
EFI_STATUS
EFIAPI
MnpConfigure (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
MnpMcastIpToMac (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN BOOLEAN Ipv6Flag,
IN EFI_IP_ADDRESS *IpAddress,
OUT EFI_MAC_ADDRESS *MacAddress
);
EFI_STATUS
EFIAPI
MnpGroups (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN BOOLEAN JoinFlag,
IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
);
EFI_STATUS
EFIAPI
MnpTransmit (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
MnpCancel (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
);
EFI_STATUS
EFIAPI
MnpReceive (
IN EFI_MANAGED_NETWORK_PROTOCOL *This,
IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
MnpPoll (
IN EFI_MANAGED_NETWORK_PROTOCOL *This
);
#endif

View File

@ -23,6 +23,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetDriverName (
@ -31,6 +70,75 @@ Mtftp4ComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetControllerName (
@ -41,18 +149,29 @@ Mtftp4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = {
Mtftp4ComponentNameGetDriverName,
Mtftp4ComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gMtftp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Mtftp4ComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Mtftp4ComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mMtftp4DriverNameTable[] = {
{
"eng",
"eng;en",
L"MTFTP4 Network Service"
},
{
@ -61,6 +180,45 @@ static EFI_UNICODE_STRING_TABLE mMtftp4DriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetDriverName (
@ -68,41 +226,84 @@ Mtftp4ComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This : A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language : A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName : A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES : The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER : Language is NULL.
EFI_INVALID_PARAMETER : DriverName is NULL.
EFI_UNSUPPORTED : The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gMtftp4ComponentName.SupportedLanguages,
mMtftp4DriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mMtftp4DriverNameTable,
DriverName,
(BOOLEAN)(This == &gMtftp4ComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
Mtftp4ComponentNameGetControllerName (
@ -112,50 +313,6 @@ Mtftp4ComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This : A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle :The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle :The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language : A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName : A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS :The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER : ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER : ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER : Language is NULL.
EFI_INVALID_PARAMETER : ControllerName is NULL.
EFI_UNSUPPORTED : The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED :The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -58,14 +58,13 @@ Returns:
--*/
{
return EfiLibInstallAllDriverProtocols (
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gMtftp4DriverBinding,
ImageHandle,
&gMtftp4ComponentName,
NULL,
NULL
&gMtftp4ComponentName2
);
}

View File

@ -1,69 +1,70 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Driver.h
Abstract:
**/
#ifndef __EFI_MTFTP4_DRIVER_H__
#define __EFI_MTFTP4_DRIVER_H__
#include <PiDxe.h>
#include <Protocol/ServiceBinding.h>
#include <Library/NetLib.h>
#include <Library/UefiLib.h>
EFI_STATUS
Mtftp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
Mtftp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
Mtftp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
Mtftp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN OUT EFI_HANDLE *ChildHandle
);
EFI_STATUS
Mtftp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
extern EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName;
extern EFI_DRIVER_BINDING_PROTOCOL gMtftp4DriverBinding;
#endif
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Driver.h
Abstract:
**/
#ifndef __EFI_MTFTP4_DRIVER_H__
#define __EFI_MTFTP4_DRIVER_H__
#include <PiDxe.h>
#include <Protocol/ServiceBinding.h>
#include <Library/NetLib.h>
#include <Library/UefiLib.h>
EFI_STATUS
Mtftp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
Mtftp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
Mtftp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
Mtftp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN OUT EFI_HANDLE *ChildHandle
);
EFI_STATUS
Mtftp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
extern EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gMtftp4ComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gMtftp4DriverBinding;
#endif

View File

@ -1,33 +1,33 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Impl.h
Abstract:
Mtftp4 Implementation, it supports the following RFCs:
RFC1350 - THE TFTP PROTOCOL (REVISION 2)
RFC2090 - TFTP Multicast Option
RFC2347 - TFTP Option Extension
RFC2348 - TFTP Blocksize Option
RFC2349 - TFTP Timeout Interval and Transfer Size Options
**/
#ifndef __EFI_MTFTP4_IMPL_H__
#define __EFI_MTFTP4_IMPL_H__
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Impl.h
Abstract:
Mtftp4 Implementation, it supports the following RFCs:
RFC1350 - THE TFTP PROTOCOL (REVISION 2)
RFC2090 - TFTP Multicast Option
RFC2347 - TFTP Option Extension
RFC2348 - TFTP Blocksize Option
RFC2349 - TFTP Timeout Interval and Transfer Size Options
**/
#ifndef __EFI_MTFTP4_IMPL_H__
#define __EFI_MTFTP4_IMPL_H__
#include <PiDxe.h>
#include <Protocol/Udp4.h>
@ -37,142 +37,142 @@ Abstract:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/UdpIoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE;
typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL;
#include "Mtftp4Driver.h"
#include "Mtftp4Option.h"
#include "Mtftp4Support.h"
enum {
MTFTP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'),
MTFTP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('t', 'f', 't', 'p'),
MTFTP4_DEFAULT_SERVER_PORT = 69,
MTFTP4_DEFAULT_TIMEOUT = 3,
MTFTP4_DEFAULT_RETRY = 5,
MTFTP4_DEFAULT_BLKSIZE = 512,
MTFTP4_TIME_TO_GETMAP = 5,
MTFTP4_STATE_UNCONFIGED = 0,
MTFTP4_STATE_CONFIGED,
MTFTP4_STATE_DESTORY
};
struct _MTFTP4_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
BOOLEAN InDestory;
UINT16 ChildrenNum;
NET_LIST_ENTRY Children;
EFI_EVENT Timer; // Ticking timer for all the MTFTP clients
EFI_EVENT TimerToGetMap;
EFI_HANDLE Controller;
EFI_HANDLE Image;
//
// This UDP child is used to keep the connection between the UDP
// and MTFTP, so MTFTP will be notified when UDP is uninstalled.
//
UDP_IO_PORT *ConnectUdp;
};
typedef struct {
EFI_MTFTP4_PACKET **Packet;
UINT32 *PacketLen;
EFI_STATUS Status;
} MTFTP4_GETINFO_STATE;
struct _MTFTP4_PROTOCOL {
UINT32 Signature;
NET_LIST_ENTRY Link;
EFI_MTFTP4_PROTOCOL Mtftp4;
INTN State;
BOOLEAN Indestory;
MTFTP4_SERVICE *Service;
EFI_HANDLE Handle;
EFI_MTFTP4_CONFIG_DATA Config;
//
// Operation parameters: token and requested options.
//
EFI_MTFTP4_TOKEN *Token;
MTFTP4_OPTION RequestOption;
UINT16 Operation;
//
// Blocks is a list of MTFTP4_BLOCK_RANGE which contains
// holes in the file
//
UINT16 BlkSize;
UINT16 LastBlock;
NET_LIST_ENTRY Blocks;
//
// The server's communication end point: IP and two ports. one for
// initial request, one for its selected port.
//
IP4_ADDR ServerIp;
UINT16 ListeningPort;
UINT16 ConnectedPort;
IP4_ADDR Gateway;
UDP_IO_PORT *UnicastPort;
//
// Timeout and retransmit status
//
NET_BUF *LastPacket;
UINT32 PacketToLive;
UINT32 CurRetry;
UINT32 MaxRetry;
UINT32 Timeout;
//
// Parameter used by RRQ's multicast download.
//
IP4_ADDR McastIp;
UINT16 McastPort;
BOOLEAN Master;
UDP_IO_PORT *McastUdpPort;
MTFTP4_GETINFO_STATE GetInfoState;
};
VOID
Mtftp4CleanOperation (
IN MTFTP4_PROTOCOL *Instance,
IN EFI_STATUS Result
);
EFI_STATUS
Mtftp4WrqStart (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 Operation
);
EFI_STATUS
Mtftp4RrqStart (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 Operation
);
#define MTFTP4_SERVICE_FROM_THIS(a) \
CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
#define MTFTP4_PROTOCOL_FROM_THIS(a) \
CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;
#endif
#include <Library/BaseLib.h>
#include <Library/UdpIoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
typedef struct _MTFTP4_SERVICE MTFTP4_SERVICE;
typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL;
#include "Mtftp4Driver.h"
#include "Mtftp4Option.h"
#include "Mtftp4Support.h"
enum {
MTFTP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('T', 'F', 'T', 'P'),
MTFTP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('t', 'f', 't', 'p'),
MTFTP4_DEFAULT_SERVER_PORT = 69,
MTFTP4_DEFAULT_TIMEOUT = 3,
MTFTP4_DEFAULT_RETRY = 5,
MTFTP4_DEFAULT_BLKSIZE = 512,
MTFTP4_TIME_TO_GETMAP = 5,
MTFTP4_STATE_UNCONFIGED = 0,
MTFTP4_STATE_CONFIGED,
MTFTP4_STATE_DESTORY
};
struct _MTFTP4_SERVICE {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
BOOLEAN InDestory;
UINT16 ChildrenNum;
NET_LIST_ENTRY Children;
EFI_EVENT Timer; // Ticking timer for all the MTFTP clients
EFI_EVENT TimerToGetMap;
EFI_HANDLE Controller;
EFI_HANDLE Image;
//
// This UDP child is used to keep the connection between the UDP
// and MTFTP, so MTFTP will be notified when UDP is uninstalled.
//
UDP_IO_PORT *ConnectUdp;
};
typedef struct {
EFI_MTFTP4_PACKET **Packet;
UINT32 *PacketLen;
EFI_STATUS Status;
} MTFTP4_GETINFO_STATE;
struct _MTFTP4_PROTOCOL {
UINT32 Signature;
NET_LIST_ENTRY Link;
EFI_MTFTP4_PROTOCOL Mtftp4;
INTN State;
BOOLEAN Indestory;
MTFTP4_SERVICE *Service;
EFI_HANDLE Handle;
EFI_MTFTP4_CONFIG_DATA Config;
//
// Operation parameters: token and requested options.
//
EFI_MTFTP4_TOKEN *Token;
MTFTP4_OPTION RequestOption;
UINT16 Operation;
//
// Blocks is a list of MTFTP4_BLOCK_RANGE which contains
// holes in the file
//
UINT16 BlkSize;
UINT16 LastBlock;
NET_LIST_ENTRY Blocks;
//
// The server's communication end point: IP and two ports. one for
// initial request, one for its selected port.
//
IP4_ADDR ServerIp;
UINT16 ListeningPort;
UINT16 ConnectedPort;
IP4_ADDR Gateway;
UDP_IO_PORT *UnicastPort;
//
// Timeout and retransmit status
//
NET_BUF *LastPacket;
UINT32 PacketToLive;
UINT32 CurRetry;
UINT32 MaxRetry;
UINT32 Timeout;
//
// Parameter used by RRQ's multicast download.
//
IP4_ADDR McastIp;
UINT16 McastPort;
BOOLEAN Master;
UDP_IO_PORT *McastUdpPort;
MTFTP4_GETINFO_STATE GetInfoState;
};
VOID
Mtftp4CleanOperation (
IN MTFTP4_PROTOCOL *Instance,
IN EFI_STATUS Result
);
EFI_STATUS
Mtftp4WrqStart (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 Operation
);
EFI_STATUS
Mtftp4RrqStart (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 Operation
);
#define MTFTP4_SERVICE_FROM_THIS(a) \
CR (a, MTFTP4_SERVICE, ServiceBinding, MTFTP4_SERVICE_SIGNATURE)
#define MTFTP4_PROTOCOL_FROM_THIS(a) \
CR (a, MTFTP4_PROTOCOL, Mtftp4, MTFTP4_PROTOCOL_SIGNATURE)
extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate;
#endif

View File

@ -1,73 +1,73 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Option.h
Abstract:
Mtftp4 option process routines.
**/
#ifndef __EFI_MTFTP4_OPTION_H__
#define __EFI_MTFTP4_OPTION_H__
enum {
MTFTP4_SUPPORTED_OPTIONS = 4,
MTFTP4_OPCODE_LEN = 2,
MTFTP4_ERRCODE_LEN = 2,
MTFTP4_BLKNO_LEN = 2,
MTFTP4_DATA_HEAD_LEN = 4,
MTFTP4_BLKSIZE_EXIST = 0x01,
MTFTP4_TIMEOUT_EXIST = 0x02,
MTFTP4_TSIZE_EXIST = 0x04,
MTFTP4_MCAST_EXIST = 0x08
};
typedef struct {
UINT16 BlkSize;
UINT8 Timeout;
UINT32 Tsize;
IP4_ADDR McastIp;
UINT16 McastPort;
BOOLEAN Master;
UINT32 Exist;
} MTFTP4_OPTION;
EFI_STATUS
Mtftp4ExtractOptions (
IN EFI_MTFTP4_PACKET *Packet,
IN UINT32 PacketLen,
IN OUT UINT32 *OptionCount,
OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL
);
EFI_STATUS
Mtftp4ParseOption (
IN EFI_MTFTP4_OPTION *OptionList,
IN UINT32 Count,
IN BOOLEAN Request,
OUT MTFTP4_OPTION *Option
);
EFI_STATUS
Mtftp4ParseOptionOack (
IN EFI_MTFTP4_PACKET *Packet,
IN UINT32 PacketLen,
OUT MTFTP4_OPTION *Option
);
extern UINT8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Option.h
Abstract:
Mtftp4 option process routines.
**/
#ifndef __EFI_MTFTP4_OPTION_H__
#define __EFI_MTFTP4_OPTION_H__
enum {
MTFTP4_SUPPORTED_OPTIONS = 4,
MTFTP4_OPCODE_LEN = 2,
MTFTP4_ERRCODE_LEN = 2,
MTFTP4_BLKNO_LEN = 2,
MTFTP4_DATA_HEAD_LEN = 4,
MTFTP4_BLKSIZE_EXIST = 0x01,
MTFTP4_TIMEOUT_EXIST = 0x02,
MTFTP4_TSIZE_EXIST = 0x04,
MTFTP4_MCAST_EXIST = 0x08
};
typedef struct {
UINT16 BlkSize;
UINT8 Timeout;
UINT32 Tsize;
IP4_ADDR McastIp;
UINT16 McastPort;
BOOLEAN Master;
UINT32 Exist;
} MTFTP4_OPTION;
EFI_STATUS
Mtftp4ExtractOptions (
IN EFI_MTFTP4_PACKET *Packet,
IN UINT32 PacketLen,
IN OUT UINT32 *OptionCount,
OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL
);
EFI_STATUS
Mtftp4ParseOption (
IN EFI_MTFTP4_OPTION *OptionList,
IN UINT32 Count,
IN BOOLEAN Request,
OUT MTFTP4_OPTION *Option
);
EFI_STATUS
Mtftp4ParseOptionOack (
IN EFI_MTFTP4_PACKET *Packet,
IN UINT32 PacketLen,
OUT MTFTP4_OPTION *Option
);
extern UINT8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];
#endif

View File

@ -1,96 +1,96 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Support.h
Abstract:
Support routines for MTFTP
**/
#ifndef __EFI_MTFTP4_SUPPORT_H__
#define __EFI_MTFTP4_SUPPORT_H__
//
// The structure representing a range of block numbers, [Start, End].
// It is used to remember the holes in the MTFTP block space. If all
// the holes are filled in, then the download or upload has completed.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN Start;
INTN End;
} MTFTP4_BLOCK_RANGE;
EFI_STATUS
Mtftp4InitBlockRange (
IN NET_LIST_ENTRY *Head,
IN UINT16 Start,
IN UINT16 End
);
INTN
Mtftp4GetNextBlockNum (
IN NET_LIST_ENTRY *Head
);
VOID
Mtftp4SetLastBlockNum (
IN NET_LIST_ENTRY *Head,
IN UINT16 Last
);
EFI_STATUS
Mtftp4RemoveBlockNum (
IN NET_LIST_ENTRY *Head,
IN UINT16 Num
);
VOID
Mtftp4SetTimeout (
IN MTFTP4_PROTOCOL *Instance
);
EFI_STATUS
Mtftp4SendPacket (
IN MTFTP4_PROTOCOL *Instance,
IN NET_BUF *Packet
);
EFI_STATUS
Mtftp4SendRequest (
IN MTFTP4_PROTOCOL *Instance
);
EFI_STATUS
Mtftp4SendError (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 ErrCode,
IN UINT8* ErrInfo
);
EFI_STATUS
Mtftp4Retransmit (
IN MTFTP4_PROTOCOL *Instance
);
VOID
EFIAPI
Mtftp4OnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Mtftp4Support.h
Abstract:
Support routines for MTFTP
**/
#ifndef __EFI_MTFTP4_SUPPORT_H__
#define __EFI_MTFTP4_SUPPORT_H__
//
// The structure representing a range of block numbers, [Start, End].
// It is used to remember the holes in the MTFTP block space. If all
// the holes are filled in, then the download or upload has completed.
//
typedef struct {
NET_LIST_ENTRY Link;
INTN Start;
INTN End;
} MTFTP4_BLOCK_RANGE;
EFI_STATUS
Mtftp4InitBlockRange (
IN NET_LIST_ENTRY *Head,
IN UINT16 Start,
IN UINT16 End
);
INTN
Mtftp4GetNextBlockNum (
IN NET_LIST_ENTRY *Head
);
VOID
Mtftp4SetLastBlockNum (
IN NET_LIST_ENTRY *Head,
IN UINT16 Last
);
EFI_STATUS
Mtftp4RemoveBlockNum (
IN NET_LIST_ENTRY *Head,
IN UINT16 Num
);
VOID
Mtftp4SetTimeout (
IN MTFTP4_PROTOCOL *Instance
);
EFI_STATUS
Mtftp4SendPacket (
IN MTFTP4_PROTOCOL *Instance,
IN NET_BUF *Packet
);
EFI_STATUS
Mtftp4SendRequest (
IN MTFTP4_PROTOCOL *Instance
);
EFI_STATUS
Mtftp4SendError (
IN MTFTP4_PROTOCOL *Instance,
IN UINT16 ErrCode,
IN UINT8* ErrInfo
);
EFI_STATUS
Mtftp4Retransmit (
IN MTFTP4_PROTOCOL *Instance
);
VOID
EFIAPI
Mtftp4OnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif

View File

@ -2381,15 +2381,14 @@ InitializeBCDriver (
//
// Initialize EFI library
//
Status = EfiLibInstallAllDriverProtocols (
ImageHandle,
SystemTable,
&mPxeBcDriverBinding,
NULL,
&gPxeBcComponentName,
NULL,
NULL
);
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&mPxeBcDriverBinding,
NULL,
&gPxeBcComponentName,
&gPxeBcComponentName2
);
InitArpHeader ();
OptionsStrucInit ();

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeBcComponentNameGetDriverName (
@ -30,6 +69,75 @@ PxeBcComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeBcComponentNameGetControllerName (
@ -40,18 +148,29 @@ PxeBcComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
PxeBcComponentNameGetDriverName,
PxeBcComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPxeBcComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeBcComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeBcComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
{
"eng",
"eng;en",
L"PXE Base Code Driver"
},
{
@ -60,6 +179,45 @@ static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeBcComponentNameGetDriverName (
@ -67,41 +225,84 @@ PxeBcComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gPxeBcComponentName.SupportedLanguages,
mPxeBcDriverNameTable,
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 This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeBcComponentNameGetControllerName (
@ -111,50 +312,6 @@ PxeBcComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,36 @@
/** @file
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
//
// warning #175: subscript out of range
//
#pragma warning (disable: 175)
#define SYS_ARCH GetSysArch()
UINT16
GetSysArch (
VOID
);
#endif
/** @file
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
//
// warning #175: subscript out of range
//
#pragma warning (disable: 175)
#define SYS_ARCH GetSysArch()
UINT16
GetSysArch (
VOID
);
#endif

View File

@ -1,43 +1,43 @@
/** @file
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name:
hton.h
Abstract:
Byte swapping macros.
**/
#ifndef _HTON_H_
#define _HTON_H_
//
// Only Intel order functions are defined at this time.
//
#define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
#define HTONL(v) \
(UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
#define HTONLL(v) swap64 (v)
#define U8PTR(na) ((UINT8 *) &(na))
#define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
#define NTOHL(ns) \
((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
#endif /* _HTON_H_ */
/* EOF - hton.h */
/** @file
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name:
hton.h
Abstract:
Byte swapping macros.
**/
#ifndef _HTON_H_
#define _HTON_H_
//
// Only Intel order functions are defined at this time.
//
#define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
#define HTONL(v) \
(UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
#define HTONLL(v) swap64 (v)
#define U8PTR(na) ((UINT8 *) &(na))
#define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
#define NTOHL(ns) \
((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
#endif /* _HTON_H_ */
/* EOF - hton.h */

View File

@ -1,26 +1,26 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x6
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x6
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x2
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x2
#endif

View File

@ -1,154 +1,154 @@
/** @file
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
tftp.h
Abstract:
**/
#ifndef __TFTP_H__
#define __TFTP_H__
//
// Definitions for trivial file transfer protocol functionality with IP v4
// Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
//
#pragma pack(1)
//
// max and min packet sizes
// (all data packets in transmission except last)
//
#define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
#define MIN_TFTP_PKT_SIZE 512
//
// TFTPv4 OpCodes
//
#define TFTP_RRQ 1 // read request
#define TFTP_WRQ 2 // write request
#define TFTP_DATA 3 // data
#define TFTP_ACK 4 // acknowledgement
#define TFTP_ERROR 5 // error packet
#define TFTP_OACK 6 // option acknowledge
#define TFTP_DIR 7 // read directory request
#define TFTP_DATA8 8
#define TFTP_ACK8 9
//
// request packet (read or write)
// Fields shown (except file name) are not to be referenced directly,
// since their placement is variable within a request packet.
// All are null terminated case insensitive ascii strings.
//
struct Tftpv4Req {
UINT16 OpCode; // TFTP Op code
UINT8 FileName[2]; // file name
UINT8 Mode[2]; // "netascii" or "octet"
struct { // optionally, one or more option requests
UINT8 Option[2]; // option name
UINT8 Value[2]; // value requested
} OpReq[1];
};
//
// modes
//
#define MODE_ASCII "netascii"
#define MODE_BINARY "octet"
//
// option strings
//
#define OP_BLKSIZE "blksize" // block size option
#define OP_TIMEOUT "timeout" // time to wait before retransmitting
#define OP_TFRSIZE "tsize" // total transfer size option
#define OP_OVERWRITE "overwrite" // overwrite file option
#define OP_BIGBLKNUM "bigblk#" // big block number
// See RFC 2347, 8, and 9 for more information on TFTP options
// option acknowledge packet (optional)
// options not acknowledged are rejected
//
struct Tftpv4Oack {
UINT16 OpCode; // TFTP Op code
struct { // optionally, one or more option acknowledgements
UINT8 Option[2]; // option name (of those requested)
UINT8 Value[2]; // value acknowledged
} OpAck[1];
};
//
// acknowledge packet
//
struct Tftpv4Ack {
UINT16 OpCode; // TFTP Op code
UINT16 BlockNum;
};
//
// data packet
//
struct Tftpv4Data {
struct Tftpv4Ack Header;
UINT8 Data[512];
};
//
// big block number ack packet
//
struct Tftpv4Ack8 {
UINT16 OpCode;
UINT64 BlockNum;
};
//
// big block number data packet
//
struct Tftpv4Data8 {
struct Tftpv4Ack8 Header;
UINT8 Data[506];
};
//
// error packet
//
struct Tftpv4Error {
UINT16 OpCode; // TFTP Op code
UINT16 ErrCode; // error code
UINT8 ErrMsg[1]; // error message (nul terminated)
};
#pragma pack()
//
// error codes
//
#define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
#define TFTP_ERR_NOT_FOUND 1 // File not found.
#define TFTP_ERR_ACCESS 2 // Access violation.
#define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
#define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
#define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
#define TFTP_ERR_EXISTS 6 // File already exists.
#define TFTP_ERR_NO_USER 7 // No such user.
#define TFTP_ERR_OPTION 8 // Option negotiation termination
//
// some defines
//
#define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
#define ACK_TIMEOUT 4 // Wait four seconds for ack response.
#define NUM_ACK_RETRIES 3
#define NUM_MTFTP_OPEN_RETRIES 3
#endif /* __TFTP_H__ */
/* EOF - tftp.h */
/** @file
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
tftp.h
Abstract:
**/
#ifndef __TFTP_H__
#define __TFTP_H__
//
// Definitions for trivial file transfer protocol functionality with IP v4
// Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
//
#pragma pack(1)
//
// max and min packet sizes
// (all data packets in transmission except last)
//
#define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
#define MIN_TFTP_PKT_SIZE 512
//
// TFTPv4 OpCodes
//
#define TFTP_RRQ 1 // read request
#define TFTP_WRQ 2 // write request
#define TFTP_DATA 3 // data
#define TFTP_ACK 4 // acknowledgement
#define TFTP_ERROR 5 // error packet
#define TFTP_OACK 6 // option acknowledge
#define TFTP_DIR 7 // read directory request
#define TFTP_DATA8 8
#define TFTP_ACK8 9
//
// request packet (read or write)
// Fields shown (except file name) are not to be referenced directly,
// since their placement is variable within a request packet.
// All are null terminated case insensitive ascii strings.
//
struct Tftpv4Req {
UINT16 OpCode; // TFTP Op code
UINT8 FileName[2]; // file name
UINT8 Mode[2]; // "netascii" or "octet"
struct { // optionally, one or more option requests
UINT8 Option[2]; // option name
UINT8 Value[2]; // value requested
} OpReq[1];
};
//
// modes
//
#define MODE_ASCII "netascii"
#define MODE_BINARY "octet"
//
// option strings
//
#define OP_BLKSIZE "blksize" // block size option
#define OP_TIMEOUT "timeout" // time to wait before retransmitting
#define OP_TFRSIZE "tsize" // total transfer size option
#define OP_OVERWRITE "overwrite" // overwrite file option
#define OP_BIGBLKNUM "bigblk#" // big block number
// See RFC 2347, 8, and 9 for more information on TFTP options
// option acknowledge packet (optional)
// options not acknowledged are rejected
//
struct Tftpv4Oack {
UINT16 OpCode; // TFTP Op code
struct { // optionally, one or more option acknowledgements
UINT8 Option[2]; // option name (of those requested)
UINT8 Value[2]; // value acknowledged
} OpAck[1];
};
//
// acknowledge packet
//
struct Tftpv4Ack {
UINT16 OpCode; // TFTP Op code
UINT16 BlockNum;
};
//
// data packet
//
struct Tftpv4Data {
struct Tftpv4Ack Header;
UINT8 Data[512];
};
//
// big block number ack packet
//
struct Tftpv4Ack8 {
UINT16 OpCode;
UINT64 BlockNum;
};
//
// big block number data packet
//
struct Tftpv4Data8 {
struct Tftpv4Ack8 Header;
UINT8 Data[506];
};
//
// error packet
//
struct Tftpv4Error {
UINT16 OpCode; // TFTP Op code
UINT16 ErrCode; // error code
UINT8 ErrMsg[1]; // error message (nul terminated)
};
#pragma pack()
//
// error codes
//
#define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
#define TFTP_ERR_NOT_FOUND 1 // File not found.
#define TFTP_ERR_ACCESS 2 // Access violation.
#define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
#define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
#define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
#define TFTP_ERR_EXISTS 6 // File already exists.
#define TFTP_ERR_NO_USER 7 // No such user.
#define TFTP_ERR_OPTION 8 // Option negotiation termination
//
// some defines
//
#define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
#define ACK_TIMEOUT 4 // Wait four seconds for ack response.
#define NUM_ACK_RETRIES 3
#define NUM_MTFTP_OPEN_RETRIES 3
#endif /* __TFTP_H__ */
/* EOF - tftp.h */

View File

@ -1,26 +1,26 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x7
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeArch.h
Abstract:
Defines PXE Arch type
**/
#ifndef _EFI_PXE_ARCH_H_
#define _EFI_PXE_ARCH_H_
#define SYS_ARCH 0x7
#endif

View File

@ -25,6 +25,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeDhcp4ComponentNameGetDriverName (
@ -33,6 +72,75 @@ PxeDhcp4ComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeDhcp4ComponentNameGetControllerName (
@ -43,20 +151,31 @@ PxeDhcp4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
PxeDhcp4ComponentNameGetDriverName,
PxeDhcp4ComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PxeDhcp4ComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PxeDhcp4ComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
{
"eng",
"eng;en",
L"PXE DHCPv4 Driver"
},
{
@ -65,7 +184,45 @@ static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
}
};
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeDhcp4ComponentNameGetDriverName (
@ -73,42 +230,84 @@ PxeDhcp4ComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gPxeDhcp4ComponentName.SupportedLanguages,
mPxeDhcp4DriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mPxeDhcp4DriverNameTable,
DriverName,
(BOOLEAN)(This == &gPxeDhcp4ComponentName)
);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
PxeDhcp4ComponentNameGetControllerName (
@ -118,50 +317,6 @@ PxeDhcp4ComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -94,15 +94,14 @@ PxeDhcp4DriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallAllDriverProtocols (
ImageHandle,
SystemTable,
&gPxeDhcp4DriverBinding,
NULL,
&gPxeDhcp4ComponentName,
NULL,
NULL
);
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gPxeDhcp4DriverBinding,
NULL,
&gPxeDhcp4ComponentName,
&gPxeDhcp4ComponentName2
);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

View File

@ -1,345 +1,346 @@
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeDhcp4.h
Abstract:
Common header for PxeDhcp4 protocol driver
**/
#ifndef _PXEDHCP4_H
#define _PXEDHCP4_H
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeDhcp4.h
Abstract:
Common header for PxeDhcp4 protocol driver
**/
#ifndef _PXEDHCP4_H
#define _PXEDHCP4_H
#include <PiDxe.h>
#include <Protocol/PxeBaseCode.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/PxeDhcp4.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/PxeDhcp4.h>
#include <Protocol/PxeDhcp4Callback.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// PxeDhcp4 protocol instance data
//
typedef struct {
//
// Signature field used to locate beginning of containment record.
//
UINTN Signature;
#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
//
// Device handle the protocol is bound to.
//
EFI_HANDLE Handle;
//
// Public PxeDhcp4 protocol interface.
//
EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
//
// Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
//
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
//
// PxeDhcp4 called function for PxeDhcp4Callback.
//
EFI_PXE_DHCP4_FUNCTION function;
//
// Timeout event and flag for PxeDhcp4Callback.
//
EFI_EVENT TimeoutEvent;
BOOLEAN TimeoutOccurred;
//
// Periodic event and flag for PxeDhcp4Callback.
//
EFI_EVENT PeriodicEvent;
BOOLEAN PeriodicOccurred;
//
// DHCP server IP address.
//
UINT32 ServerIp;
//
// DHCP renewal and rebinding times, in seconds.
//
UINT32 RenewTime;
UINT32 RebindTime;
UINT32 LeaseTime;
//
// Number of offers received & allocated offer list.
//
UINTN offers;
DHCP4_PACKET *offer_list;
//
//
//
BOOLEAN StopPxeBc;
} PXE_DHCP4_PRIVATE_DATA;
#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Protocol function prototypes.
//
extern
EFI_STATUS
EFIAPI
PxeDhcp4Run (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN OPTIONAL UINTN OpLen,
IN OPTIONAL VOID *OpList
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Setup (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN EFI_PXE_DHCP4_DATA *Data
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Init (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
OUT UINTN *offer_list_entries,
OUT DHCP4_PACKET **offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Select (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
IN DHCP4_PACKET *offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Renew (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Rebind (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Release (
IN EFI_PXE_DHCP4_PROTOCOL *This
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Support function prototypes.
//
extern
UINT16
htons (
UINTN n
)
;
extern
UINT32
htonl (
UINTN n
)
;
extern
VOID
EFIAPI
timeout_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
VOID
EFIAPI
periodic_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
EFI_STATUS
find_opt (
IN DHCP4_PACKET *Packet,
IN UINT8 OpCode,
IN UINTN Skip,
OUT DHCP4_OP **OpPtr
)
;
extern
EFI_STATUS
add_opt (
IN DHCP4_PACKET *Packet,
IN DHCP4_OP *OpPtr
)
;
extern
EFI_STATUS
start_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OPTIONAL EFI_IP_ADDRESS *station_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
)
;
extern
VOID
stop_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
start_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN UINTN seconds_timeout
)
;
extern
VOID
stop_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
tx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN EFI_IP_ADDRESS *dest_ip,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN EFI_IP_ADDRESS *src_ip,
IN VOID *buffer,
IN UINTN BufferSize
)
;
extern
EFI_STATUS
rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
OUT VOID *buffer,
OUT UINTN *BufferSize,
IN OUT EFI_IP_ADDRESS *dest_ip,
IN OUT EFI_IP_ADDRESS *src_ip,
IN UINT16 op_flags
)
;
extern
EFI_STATUS
tx_rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OUT EFI_IP_ADDRESS *ServerIp,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN OPTIONAL EFI_IP_ADDRESS *client_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
IN DHCP4_PACKET *tx_pkt,
OUT DHCP4_PACKET *rx_pkt,
IN INTN
(
*rx_vfy)
(
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN DHCP4_PACKET *tx_pkt,
IN DHCP4_PACKET *rx_pkt,
IN UINTN rx_pkt_size
),
IN UINTN seconds_timeout
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Global variable definitions.
//
extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
EFI_STATUS
EFIAPI
PxeDhcp4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Register Driver Binding protocol for this driver.
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
EFI_SUCCESS - Driver loaded.
other - Driver not loaded.
--*/
;
#endif /* _PXEDHCP4_H */
/* EOF - PxeDhcp4.h */
#include <Library/UefiLib.h>
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// PxeDhcp4 protocol instance data
//
typedef struct {
//
// Signature field used to locate beginning of containment record.
//
UINTN Signature;
#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
//
// Device handle the protocol is bound to.
//
EFI_HANDLE Handle;
//
// Public PxeDhcp4 protocol interface.
//
EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
//
// Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
//
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
//
// PxeDhcp4 called function for PxeDhcp4Callback.
//
EFI_PXE_DHCP4_FUNCTION function;
//
// Timeout event and flag for PxeDhcp4Callback.
//
EFI_EVENT TimeoutEvent;
BOOLEAN TimeoutOccurred;
//
// Periodic event and flag for PxeDhcp4Callback.
//
EFI_EVENT PeriodicEvent;
BOOLEAN PeriodicOccurred;
//
// DHCP server IP address.
//
UINT32 ServerIp;
//
// DHCP renewal and rebinding times, in seconds.
//
UINT32 RenewTime;
UINT32 RebindTime;
UINT32 LeaseTime;
//
// Number of offers received & allocated offer list.
//
UINTN offers;
DHCP4_PACKET *offer_list;
//
//
//
BOOLEAN StopPxeBc;
} PXE_DHCP4_PRIVATE_DATA;
#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Protocol function prototypes.
//
extern
EFI_STATUS
EFIAPI
PxeDhcp4Run (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN OPTIONAL UINTN OpLen,
IN OPTIONAL VOID *OpList
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Setup (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN EFI_PXE_DHCP4_DATA *Data
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Init (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
OUT UINTN *offer_list_entries,
OUT DHCP4_PACKET **offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Select (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
IN DHCP4_PACKET *offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Renew (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Rebind (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Release (
IN EFI_PXE_DHCP4_PROTOCOL *This
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Support function prototypes.
//
extern
UINT16
htons (
UINTN n
)
;
extern
UINT32
htonl (
UINTN n
)
;
extern
VOID
EFIAPI
timeout_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
VOID
EFIAPI
periodic_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
EFI_STATUS
find_opt (
IN DHCP4_PACKET *Packet,
IN UINT8 OpCode,
IN UINTN Skip,
OUT DHCP4_OP **OpPtr
)
;
extern
EFI_STATUS
add_opt (
IN DHCP4_PACKET *Packet,
IN DHCP4_OP *OpPtr
)
;
extern
EFI_STATUS
start_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OPTIONAL EFI_IP_ADDRESS *station_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
)
;
extern
VOID
stop_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
start_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN UINTN seconds_timeout
)
;
extern
VOID
stop_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
tx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN EFI_IP_ADDRESS *dest_ip,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN EFI_IP_ADDRESS *src_ip,
IN VOID *buffer,
IN UINTN BufferSize
)
;
extern
EFI_STATUS
rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
OUT VOID *buffer,
OUT UINTN *BufferSize,
IN OUT EFI_IP_ADDRESS *dest_ip,
IN OUT EFI_IP_ADDRESS *src_ip,
IN UINT16 op_flags
)
;
extern
EFI_STATUS
tx_rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OUT EFI_IP_ADDRESS *ServerIp,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN OPTIONAL EFI_IP_ADDRESS *client_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
IN DHCP4_PACKET *tx_pkt,
OUT DHCP4_PACKET *rx_pkt,
IN INTN
(
*rx_vfy)
(
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN DHCP4_PACKET *tx_pkt,
IN DHCP4_PACKET *rx_pkt,
IN UINTN rx_pkt_size
),
IN UINTN seconds_timeout
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Global variable definitions.
//
extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2;
EFI_STATUS
EFIAPI
PxeDhcp4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Register Driver Binding protocol for this driver.
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
EFI_SUCCESS - Driver loaded.
other - Driver not loaded.
--*/
;
#endif /* _PXEDHCP4_H */
/* EOF - PxeDhcp4.h */

View File

@ -25,6 +25,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
SimpleNetworkComponentNameGetDriverName (
@ -33,6 +72,75 @@ SimpleNetworkComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
SimpleNetworkComponentNameGetControllerName (
@ -43,18 +151,29 @@ SimpleNetworkComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
SimpleNetworkComponentNameGetDriverName,
SimpleNetworkComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SimpleNetworkComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SimpleNetworkComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
{
"eng",
"eng;en",
L"Simple Network Protocol Driver"
},
{
@ -63,6 +182,45 @@ static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
SimpleNetworkComponentNameGetDriverName (
@ -70,41 +228,84 @@ SimpleNetworkComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gSimpleNetworkComponentName.SupportedLanguages,
mSimpleNetworkDriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mSimpleNetworkDriverNameTable,
DriverName,
(BOOLEAN)(This == &gSimpleNetworkComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
SimpleNetworkComponentNameGetControllerName (
@ -114,50 +315,6 @@ SimpleNetworkComponentNameGetControllerName (
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1257,13 +1257,12 @@ InitializeSnpNiiDriver (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallAllDriverProtocols (
ImageHandle,
SystemTable,
&mSimpleNetworkDriverBinding,
NULL,
&gSimpleNetworkComponentName,
NULL,
NULL
);
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&mSimpleNetworkDriverBinding,
NULL,
&gSimpleNetworkComponentName,
&gSimpleNetworkComponentName2
);
}

View File

@ -1,27 +1,27 @@
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name:
snp.h
Abstract:
Revision history:
**/
#ifndef _SNP_H
#define _SNP_H
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name:
snp.h
Abstract:
Revision history:
**/
#ifndef _SNP_H
#define _SNP_H
#include <PiDxe.h>
#include <Protocol/SimpleNetwork.h>
@ -34,399 +34,400 @@ Revision history:
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <IndustryStandard/Pci22.h>
#define FOUR_GIGABYTES (UINT64) 0x100000000ULL
#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
#define MAX_MAP_LENGTH 100
#define PCI_BAR_IO_MASK 0x00000003
#define PCI_BAR_IO_MODE 0x00000001
#define PCI_BAR_MEM_MASK 0x0000000F
#define PCI_BAR_MEM_MODE 0x00000000
#define PCI_BAR_MEM_64BIT 0x00000004
typedef struct {
UINT32 Signature;
EFI_LOCK lock;
EFI_SIMPLE_NETWORK_PROTOCOL snp;
EFI_SIMPLE_NETWORK_MODE mode;
EFI_HANDLE device_handle;
EFI_DEVICE_PATH_PROTOCOL *device_path;
//
// Local instance data needed by SNP driver
//
// Pointer to S/W UNDI API entry point
// This will be NULL for H/W UNDI
//
EFI_STATUS (*issue_undi32_command) (UINT64 cdb);
BOOLEAN is_swundi;
//
// undi interface number, if one undi manages more nics
//
PXE_IFNUM if_num;
//
// Allocated tx/rx buffer that was passed to UNDI Initialize.
//
UINT32 tx_rx_bufsize;
VOID *tx_rx_buffer;
//
// mappable buffers for receive and fill header for undi3.0
// these will be used if the user buffers are above 4GB limit (instead of
// mapping the user buffers)
//
UINT8 *receive_buf;
VOID *ReceiveBufUnmap;
UINT8 *fill_hdr_buf;
VOID *FillHdrBufUnmap;
EFI_PCI_IO_PROTOCOL *IoFncs;
UINT8 IoBarIndex;
UINT8 MemoryBarIndex;
BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
//
// Buffers for command descriptor block, command parameter block
// and data block.
//
PXE_CDB cdb;
VOID *cpb;
VOID *CpbUnmap;
VOID *db;
//
// UNDI structure, we need to remember the init info for a long time!
//
PXE_DB_GET_INIT_INFO init_info;
VOID *SnpDriverUnmap;
//
// when ever we map an address, we must remember it's address and the un-map
// cookie so that we can unmap later
//
struct s_map_list {
EFI_PHYSICAL_ADDRESS virt;
VOID *map_cookie;
} map_list[MAX_MAP_LENGTH];
}
SNP_DRIVER;
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)
//
// Global Variables
//
extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
//
// Virtual to physical mapping for all UNDI 3.0s.
//
extern struct s_v2p {
struct s_v2p *next;
VOID *vaddr;
UINTN bsize;
EFI_PHYSICAL_ADDRESS paddr;
VOID *unmap;
}
*_v2p;
EFI_STATUS
add_v2p (
struct s_v2p **v2p,
EFI_PCI_IO_PROTOCOL_OPERATION type,
VOID *vaddr,
UINTN bsize
)
;
EFI_STATUS
find_v2p (
struct s_v2p **v2p,
VOID *vaddr
)
;
EFI_STATUS
del_v2p (
VOID *vaddr
)
;
extern
VOID
snp_undi32_callback_block_30 (
IN UINT32 Enable
)
;
extern
VOID
snp_undi32_callback_delay_30 (
IN UINT64 MicroSeconds
)
;
extern
VOID
snp_undi32_callback_memio_30 (
IN UINT8 ReadOrWrite,
IN UINT8 NumBytes,
IN UINT64 MemOrPortAddress,
IN OUT UINT64 BufferPtr
)
;
extern
VOID
snp_undi32_callback_v2p_30 (
IN UINT64 CpuAddr,
IN OUT UINT64 DeviceAddrPtr
)
;
extern
VOID
snp_undi32_callback_block (
IN UINT64 UniqueId,
IN UINT32 Enable
)
;
extern
VOID
snp_undi32_callback_delay (
IN UINT64 UniqueId,
IN UINT64 MicroSeconds
)
;
extern
VOID
snp_undi32_callback_memio (
IN UINT64 UniqueId,
IN UINT8 ReadOrWrite,
IN UINT8 NumBytes,
IN UINT64 MemOrPortAddr,
IN OUT UINT64 BufferPtr
)
;
extern
VOID
snp_undi32_callback_map (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN OUT UINT64 DeviceAddrPtr
)
;
extern
VOID
snp_undi32_callback_unmap (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN UINT64 DeviceAddr // not a pointer to device address
)
;
extern
VOID
snp_undi32_callback_sync (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN UINT64 DeviceAddr // not a pointer to device address
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_start (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_stop (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_initialize (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN UINTN extra_rx_buffer_size OPTIONAL,
IN UINTN extra_tx_buffer_size OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_reset (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN ExtendedVerification
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_shutdown (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_receive_filters (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN UINT32 enable,
IN UINT32 disable,
IN BOOLEAN reset_mcast_filter,
IN UINTN mcast_filter_count OPTIONAL,
IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_station_address (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN BOOLEAN reset,
IN EFI_MAC_ADDRESS *new OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_statistics (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN BOOLEAN reset,
IN OUT UINTN *statistics_size OPTIONAL,
IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_mcast_ip_to_mac (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN IPv6,
IN EFI_IP_ADDRESS *IP,
OUT EFI_MAC_ADDRESS *MAC
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_nvdata (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN read_write,
IN UINTN offset,
IN UINTN buffer_size,
IN OUT VOID *buffer
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_get_status (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
OUT UINT32 *interrupt_status OPTIONAL,
OUT VOID **tx_buffer OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_transmit (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN UINTN header_size,
IN UINTN buffer_size,
IN VOID *buffer,
IN EFI_MAC_ADDRESS * src_addr OPTIONAL,
IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,
IN UINT16 *protocol OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_receive (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
OUT UINTN *header_size OPTIONAL,
IN OUT UINTN *buffer_size,
OUT VOID *buffer,
OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,
OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,
OUT UINT16 *protocol OPTIONAL
)
;
typedef
EFI_STATUS
(*issue_undi32_command) (
UINT64 cdb
);
typedef
VOID
(*ptr) (
VOID
);
/**
Install all the driver protocol
@param ImageHandle Driver image handle
@param SystemTable System services table
@retval EFI_SUCEESS Initialization routine has found UNDI hardware, loaded it's
ROM, and installed a notify event for the Network
Indentifier Interface Protocol successfully.
@retval Other Return value from HandleProtocol for DeviceIoProtocol or
LoadedImageProtocol
**/
EFI_STATUS
EFIAPI
InitializeSnpNiiDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
;
#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
#endif /* _SNP_H */
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <IndustryStandard/Pci22.h>
#define FOUR_GIGABYTES (UINT64) 0x100000000ULL
#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
#define MAX_MAP_LENGTH 100
#define PCI_BAR_IO_MASK 0x00000003
#define PCI_BAR_IO_MODE 0x00000001
#define PCI_BAR_MEM_MASK 0x0000000F
#define PCI_BAR_MEM_MODE 0x00000000
#define PCI_BAR_MEM_64BIT 0x00000004
typedef struct {
UINT32 Signature;
EFI_LOCK lock;
EFI_SIMPLE_NETWORK_PROTOCOL snp;
EFI_SIMPLE_NETWORK_MODE mode;
EFI_HANDLE device_handle;
EFI_DEVICE_PATH_PROTOCOL *device_path;
//
// Local instance data needed by SNP driver
//
// Pointer to S/W UNDI API entry point
// This will be NULL for H/W UNDI
//
EFI_STATUS (*issue_undi32_command) (UINT64 cdb);
BOOLEAN is_swundi;
//
// undi interface number, if one undi manages more nics
//
PXE_IFNUM if_num;
//
// Allocated tx/rx buffer that was passed to UNDI Initialize.
//
UINT32 tx_rx_bufsize;
VOID *tx_rx_buffer;
//
// mappable buffers for receive and fill header for undi3.0
// these will be used if the user buffers are above 4GB limit (instead of
// mapping the user buffers)
//
UINT8 *receive_buf;
VOID *ReceiveBufUnmap;
UINT8 *fill_hdr_buf;
VOID *FillHdrBufUnmap;
EFI_PCI_IO_PROTOCOL *IoFncs;
UINT8 IoBarIndex;
UINT8 MemoryBarIndex;
BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
//
// Buffers for command descriptor block, command parameter block
// and data block.
//
PXE_CDB cdb;
VOID *cpb;
VOID *CpbUnmap;
VOID *db;
//
// UNDI structure, we need to remember the init info for a long time!
//
PXE_DB_GET_INIT_INFO init_info;
VOID *SnpDriverUnmap;
//
// when ever we map an address, we must remember it's address and the un-map
// cookie so that we can unmap later
//
struct s_map_list {
EFI_PHYSICAL_ADDRESS virt;
VOID *map_cookie;
} map_list[MAX_MAP_LENGTH];
}
SNP_DRIVER;
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)
//
// Global Variables
//
extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2;
//
// Virtual to physical mapping for all UNDI 3.0s.
//
extern struct s_v2p {
struct s_v2p *next;
VOID *vaddr;
UINTN bsize;
EFI_PHYSICAL_ADDRESS paddr;
VOID *unmap;
}
*_v2p;
EFI_STATUS
add_v2p (
struct s_v2p **v2p,
EFI_PCI_IO_PROTOCOL_OPERATION type,
VOID *vaddr,
UINTN bsize
)
;
EFI_STATUS
find_v2p (
struct s_v2p **v2p,
VOID *vaddr
)
;
EFI_STATUS
del_v2p (
VOID *vaddr
)
;
extern
VOID
snp_undi32_callback_block_30 (
IN UINT32 Enable
)
;
extern
VOID
snp_undi32_callback_delay_30 (
IN UINT64 MicroSeconds
)
;
extern
VOID
snp_undi32_callback_memio_30 (
IN UINT8 ReadOrWrite,
IN UINT8 NumBytes,
IN UINT64 MemOrPortAddress,
IN OUT UINT64 BufferPtr
)
;
extern
VOID
snp_undi32_callback_v2p_30 (
IN UINT64 CpuAddr,
IN OUT UINT64 DeviceAddrPtr
)
;
extern
VOID
snp_undi32_callback_block (
IN UINT64 UniqueId,
IN UINT32 Enable
)
;
extern
VOID
snp_undi32_callback_delay (
IN UINT64 UniqueId,
IN UINT64 MicroSeconds
)
;
extern
VOID
snp_undi32_callback_memio (
IN UINT64 UniqueId,
IN UINT8 ReadOrWrite,
IN UINT8 NumBytes,
IN UINT64 MemOrPortAddr,
IN OUT UINT64 BufferPtr
)
;
extern
VOID
snp_undi32_callback_map (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN OUT UINT64 DeviceAddrPtr
)
;
extern
VOID
snp_undi32_callback_unmap (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN UINT64 DeviceAddr // not a pointer to device address
)
;
extern
VOID
snp_undi32_callback_sync (
IN UINT64 UniqueId,
IN UINT64 CpuAddr,
IN UINT32 NumBytes,
IN UINT32 Direction,
IN UINT64 DeviceAddr // not a pointer to device address
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_start (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_stop (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_initialize (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN UINTN extra_rx_buffer_size OPTIONAL,
IN UINTN extra_tx_buffer_size OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_reset (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN ExtendedVerification
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_shutdown (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_receive_filters (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN UINT32 enable,
IN UINT32 disable,
IN BOOLEAN reset_mcast_filter,
IN UINTN mcast_filter_count OPTIONAL,
IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_station_address (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN BOOLEAN reset,
IN EFI_MAC_ADDRESS *new OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_statistics (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN BOOLEAN reset,
IN OUT UINTN *statistics_size OPTIONAL,
IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_mcast_ip_to_mac (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN IPv6,
IN EFI_IP_ADDRESS *IP,
OUT EFI_MAC_ADDRESS *MAC
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_nvdata (
IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
IN BOOLEAN read_write,
IN UINTN offset,
IN UINTN buffer_size,
IN OUT VOID *buffer
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_get_status (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
OUT UINT32 *interrupt_status OPTIONAL,
OUT VOID **tx_buffer OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_transmit (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
IN UINTN header_size,
IN UINTN buffer_size,
IN VOID *buffer,
IN EFI_MAC_ADDRESS * src_addr OPTIONAL,
IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,
IN UINT16 *protocol OPTIONAL
)
;
extern
EFI_STATUS
EFIAPI
snp_undi32_receive (
IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
OUT UINTN *header_size OPTIONAL,
IN OUT UINTN *buffer_size,
OUT VOID *buffer,
OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,
OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,
OUT UINT16 *protocol OPTIONAL
)
;
typedef
EFI_STATUS
(*issue_undi32_command) (
UINT64 cdb
);
typedef
VOID
(*ptr) (
VOID
);
/**
Install all the driver protocol
@param ImageHandle Driver image handle
@param SystemTable System services table
@retval EFI_SUCEESS Initialization routine has found UNDI hardware, loaded it's
ROM, and installed a notify event for the Network
Indentifier Interface Protocol successfully.
@retval Other Return value from HandleProtocol for DeviceIoProtocol or
LoadedImageProtocol
**/
EFI_STATUS
EFIAPI
InitializeSnpNiiDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
;
#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
#endif /* _SNP_H */

View File

@ -23,6 +23,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
TcpComponentNameGetDriverName (
@ -31,28 +70,108 @@ TcpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
TcpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {
TcpComponentNameGetDriverName,
TcpComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gTcp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TcpComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TcpComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
{
"eng",
"eng;en",
L"Tcp Network Service Driver"
},
{
@ -61,6 +180,45 @@ static EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
TcpComponentNameGetDriverName (
@ -68,102 +226,93 @@ TcpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages
specified in SupportedLanguages. The number of languages
supported by a driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode
string is the name of the driver specified by This in the
language specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gTcp4ComponentName.SupportedLanguages,
mTcpDriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mTcpDriverNameTable,
DriverName,
(BOOLEAN)(This == &gTcp4ComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
TcpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL.
It will be NULL for device drivers. It will also be
NULL for a bus drivers that wish to retrieve the name of
the bus controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a child
controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller
name that that the caller is requesting, and it must
match one of the languages specified in supported
languages. The number of languages supported by a driver
is up to the driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the
driver specified by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in
the language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1,84 +1,84 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
SockImpl.h
Abstract:
**/
#ifndef _SOCK_IMPL_H_
#define _SOCK_IMPL_H_
#include "Socket.h"
#define SOCK_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR("Sock", PrintArg)
#define SOCK_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING("Sock", PrintArg)
#define SOCK_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE("Sock", PrintArg)
#define SOCK_TRIM_RCV_BUFF(Sock, Len) \
(NetbufQueTrim ((Sock)->RcvBuffer.DataQueue, (Len)))
#define SIGNAL_TOKEN(Token, TokenStatus) \
do { \
(Token)->Status = (TokenStatus); \
gBS->SignalEvent ((Token)->Event); \
} while (0)
#define SOCK_HEADER_SPACE (60 + 60 + 72)
//
// Supporting function for both SockImpl and SockInterface
//
VOID
SockFreeFoo (
IN EFI_EVENT Event
);
EFI_STATUS
SockProcessTcpSndData (
IN SOCKET *Sock,
IN VOID *TcpTxData
);
VOID
SockSetTcpRxData (
IN SOCKET *Sock,
IN VOID *TcpRxData,
IN UINT32 RcvdBytes,
IN BOOLEAN IsOOB
);
UINT32
SockProcessRcvToken (
IN SOCKET *Sock,
IN SOCK_IO_TOKEN *RcvToken
);
VOID
SockConnFlush (
IN SOCKET *Sock
);
SOCKET *
SockCreate (
IN SOCK_INIT_DATA *SockInitData
);
VOID
SockDestroy (
IN SOCKET *Sock
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
SockImpl.h
Abstract:
**/
#ifndef _SOCK_IMPL_H_
#define _SOCK_IMPL_H_
#include "Socket.h"
#define SOCK_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR("Sock", PrintArg)
#define SOCK_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING("Sock", PrintArg)
#define SOCK_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE("Sock", PrintArg)
#define SOCK_TRIM_RCV_BUFF(Sock, Len) \
(NetbufQueTrim ((Sock)->RcvBuffer.DataQueue, (Len)))
#define SIGNAL_TOKEN(Token, TokenStatus) \
do { \
(Token)->Status = (TokenStatus); \
gBS->SignalEvent ((Token)->Event); \
} while (0)
#define SOCK_HEADER_SPACE (60 + 60 + 72)
//
// Supporting function for both SockImpl and SockInterface
//
VOID
SockFreeFoo (
IN EFI_EVENT Event
);
EFI_STATUS
SockProcessTcpSndData (
IN SOCKET *Sock,
IN VOID *TcpTxData
);
VOID
SockSetTcpRxData (
IN SOCKET *Sock,
IN VOID *TcpRxData,
IN UINT32 RcvdBytes,
IN BOOLEAN IsOOB
);
UINT32
SockProcessRcvToken (
IN SOCKET *Sock,
IN SOCK_IO_TOKEN *RcvToken
);
VOID
SockConnFlush (
IN SOCKET *Sock
);
SOCKET *
SockCreate (
IN SOCK_INIT_DATA *SockInitData
);
VOID
SockDestroy (
IN SOCKET *Sock
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,8 @@ Abstract:
UINT16 mTcp4RandomPort;
extern EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName;
extern EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gTcp4ComponentName2;
TCP4_HEARTBEAT_TIMER mTcp4Timer = {
NULL,
@ -176,14 +177,13 @@ Returns:
//
// Install the TCP4 Driver Binding Protocol
//
Status = EfiLibInstallAllDriverProtocols (
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&mTcp4DriverBinding,
ImageHandle,
&gTcp4ComponentName,
NULL,
NULL
&gTcp4ComponentName2
);
ASSERT_EFI_ERROR (Status);
//

View File

@ -1,141 +1,141 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Driver.h
Abstract:
**/
#ifndef _TCP4_DRIVER_H_
#define _TCP4_DRIVER_H_
#include <Protocol/ServiceBinding.h>
#include <Library/IpIoLib.h>
#define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
#define TCP4_PORT_KNOWN 1024
#define TCP4_PORT_USER_RESERVED 65535
typedef struct _TCP4_HEARTBEAT_TIMER {
EFI_EVENT TimerEvent;
INTN RefCnt;
} TCP4_HEARTBEAT_TIMER;
typedef struct _TCP4_SERVICE_DATA {
UINT32 Signature;
EFI_HANDLE ControllerHandle;
IP_IO *IpIo; // IP Io consumed by TCP4
EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
EFI_HANDLE DriverBindingHandle;
CHAR16 *MacString;
} TCP4_SERVICE_DATA;
//
// Prototype for TCP4 driver Rcv callback function registered to IP_IO
//
VOID
Tcp4RxCallback (
IN EFI_STATUS Status,
IN ICMP_ERROR IcmpErr,
IN EFI_NET_SESSION_DATA *NetSession,
IN NET_BUF *Pkt,
IN VOID *Context OPTIONAL
);
INTN
TcpSendIpPacket (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dest
);
EFI_STATUS
Tcp4Dispatcher (
IN SOCKET *Sock,
IN SOCK_REQUEST Request,
IN VOID *Data OPTIONAL
);
typedef struct _TCP4_PROTO_DATA {
TCP4_SERVICE_DATA *TcpService;
TCP_CB *TcpPcb;
} TCP4_PROTO_DATA;
#define TCP4_FROM_THIS(a) \
CR ( \
(a), \
TCP4_SERVICE_DATA, \
Tcp4ServiceBinding, \
TCP4_DRIVER_SIGNATURE \
)
//
// Function prototype for the driver's entry point
//
EFI_STATUS
EFIAPI
Tcp4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
//
// Function prototypes for the Drivr Binding Protocol
//
EFI_STATUS
EFIAPI
Tcp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Tcp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Tcp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// Function ptototypes for the ServiceBinding Prococol
//
EFI_STATUS
EFIAPI
Tcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Tcp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Driver.h
Abstract:
**/
#ifndef _TCP4_DRIVER_H_
#define _TCP4_DRIVER_H_
#include <Protocol/ServiceBinding.h>
#include <Library/IpIoLib.h>
#define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
#define TCP4_PORT_KNOWN 1024
#define TCP4_PORT_USER_RESERVED 65535
typedef struct _TCP4_HEARTBEAT_TIMER {
EFI_EVENT TimerEvent;
INTN RefCnt;
} TCP4_HEARTBEAT_TIMER;
typedef struct _TCP4_SERVICE_DATA {
UINT32 Signature;
EFI_HANDLE ControllerHandle;
IP_IO *IpIo; // IP Io consumed by TCP4
EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
EFI_HANDLE DriverBindingHandle;
CHAR16 *MacString;
} TCP4_SERVICE_DATA;
//
// Prototype for TCP4 driver Rcv callback function registered to IP_IO
//
VOID
Tcp4RxCallback (
IN EFI_STATUS Status,
IN ICMP_ERROR IcmpErr,
IN EFI_NET_SESSION_DATA *NetSession,
IN NET_BUF *Pkt,
IN VOID *Context OPTIONAL
);
INTN
TcpSendIpPacket (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dest
);
EFI_STATUS
Tcp4Dispatcher (
IN SOCKET *Sock,
IN SOCK_REQUEST Request,
IN VOID *Data OPTIONAL
);
typedef struct _TCP4_PROTO_DATA {
TCP4_SERVICE_DATA *TcpService;
TCP_CB *TcpPcb;
} TCP4_PROTO_DATA;
#define TCP4_FROM_THIS(a) \
CR ( \
(a), \
TCP4_SERVICE_DATA, \
Tcp4ServiceBinding, \
TCP4_DRIVER_SIGNATURE \
)
//
// Function prototype for the driver's entry point
//
EFI_STATUS
EFIAPI
Tcp4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
//
// Function prototypes for the Drivr Binding Protocol
//
EFI_STATUS
EFIAPI
Tcp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Tcp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Tcp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// Function ptototypes for the ServiceBinding Prococol
//
EFI_STATUS
EFIAPI
Tcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Tcp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,358 +1,358 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Func.h
Abstract:
**/
#ifndef _TCP4_FUNC_H_
#define _TCP4_FUNC_H_
//
// Declaration of all the functions in TCP
// protocol. It is intended to keep tcp.h
// clear.
//
//
// Functions in tcp.c
//
BOOLEAN
TcpFindTcbByPeer (
IN EFI_IPv4_ADDRESS *Addr,
IN TCP_PORTNO Port
);
TCP_CB *
TcpLocateTcb (
IN TCP_PORTNO LocalPort,
IN UINT32 LocalIp,
IN TCP_PORTNO RemotePort,
IN UINT32 RemoteIp,
IN BOOLEAN Syn
);
INTN
TcpInsertTcb (
IN TCP_CB *Tcb
);
TCP_CB *
TcpCloneTcb (
IN TCP_CB *Tcb
);
TCP_SEQNO
TcpGetIss (
VOID
);
VOID
TcpInitTcbLocal (
IN TCP_CB *Tcb
);
VOID
TcpInitTcbPeer (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg,
IN TCP_OPTION *Opt
);
UINT16
TcpGetRcvMss (
IN SOCKET *Sock
);
VOID
TcpSetState (
IN TCP_CB *Tcb,
IN UINT8 State
);
//
// Functions in Tcp4Output.c
//
INTN
TcpSendIpPacket (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpToSendData (
IN TCP_CB *Tcb,
IN INTN Force
);
VOID
TcpToSendAck (
IN TCP_CB *Tcb
);
VOID
TcpSendAck (
IN TCP_CB *Tcb
);
INTN
TcpSendZeroProbe (
IN TCP_CB *Tcb
);
INTN
TcpDeliverData (
IN TCP_CB *Tcb
);
INTN
TcpSendReset (
IN TCP_CB *Tcb,
IN TCP_HEAD *Head,
IN INT32 Len,
IN UINT32 Local,
IN UINT32 Remote
);
UINT32
TcpRcvWinOld (
IN TCP_CB *Tcb
);
UINT32
TcpRcvWinNow (
IN TCP_CB *Tcb
);
INTN
TcpRetransmit (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq
);
UINT32
TcpDataToSend (
IN TCP_CB *Tcb,
IN INTN Force
);
INTN
TcpVerifySegment (
IN NET_BUF *Nbuf
);
INTN
TcpCheckSndQue (
IN NET_LIST_ENTRY *Head
);
NET_BUF *
TcpGetSegmentSndQue (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
NET_BUF *
TcpGetSegmentSock (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
NET_BUF *
TcpGetSegment (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
TCP_SEQNO
TcpGetMaxSndNxt (
IN TCP_CB *Tcb
);
//
// Functions from Tcp4Input.c
//
VOID
TcpIcmpInput (
IN NET_BUF *Nbuf,
IN ICMP_ERROR IcmpErr,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpInput (
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpSeqAcceptable (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpFastRecover (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpFastLossRecover (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpComputeRtt (
IN TCP_CB *Tcb,
IN UINT32 Measure
);
INTN
TcpTrimInWnd (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
VOID
TcpQueueData (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf
);
VOID
TcpAdjustSndQue (
IN TCP_CB *Tcb,
IN TCP_SEQNO Ack
);
//
// Functions from Tcp4Misc.c
//
UINT16
TcpChecksum (
IN NET_BUF *Buf,
IN UINT16 HeadChecksum
);
TCP_SEG *
TcpFormatNetbuf (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf
);
VOID
TcpOnAppConnect (
IN TCP_CB *Tcb
);
INTN
TcpOnAppConsume (
IN TCP_CB *Tcb
);
VOID
TcpOnAppClose (
IN TCP_CB *Tcb
);
INTN
TcpOnAppSend (
IN TCP_CB *Tcb
);
VOID
TcpOnAppAbort (
IN TCP_CB *Tcb
);
VOID
TcpResetConnection (
IN TCP_CB *Tcb
);
//
// Functions in Tcp4Timer.c
//
VOID
TcpClose (
IN TCP_CB *Tcb
);
VOID
EFIAPI
TcpTicking (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
TcpSetTimer (
IN TCP_CB *Tcb,
IN UINT16 Timer,
IN UINT32 TimeOut
);
VOID
TcpClearTimer (
IN TCP_CB *Tcb,
IN UINT16 Timer
);
VOID
TcpClearAllTimer (
IN TCP_CB *Tcb
);
VOID
TcpSetProbeTimer (
IN TCP_CB *Tcb
);
VOID
TcpSetKeepaliveTimer (
IN TCP_CB *Tcb
);
VOID
TcpBackoffRto (
IN TCP_CB *Tcb
);
EFI_STATUS
TcpSetVariableData (
IN TCP4_SERVICE_DATA *Tcp4Service
);
VOID
TcpClearVariableData (
IN TCP4_SERVICE_DATA *Tcp4Service
);
EFI_STATUS
TcpInstallDevicePath (
IN SOCKET *Sock
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Func.h
Abstract:
**/
#ifndef _TCP4_FUNC_H_
#define _TCP4_FUNC_H_
//
// Declaration of all the functions in TCP
// protocol. It is intended to keep tcp.h
// clear.
//
//
// Functions in tcp.c
//
BOOLEAN
TcpFindTcbByPeer (
IN EFI_IPv4_ADDRESS *Addr,
IN TCP_PORTNO Port
);
TCP_CB *
TcpLocateTcb (
IN TCP_PORTNO LocalPort,
IN UINT32 LocalIp,
IN TCP_PORTNO RemotePort,
IN UINT32 RemoteIp,
IN BOOLEAN Syn
);
INTN
TcpInsertTcb (
IN TCP_CB *Tcb
);
TCP_CB *
TcpCloneTcb (
IN TCP_CB *Tcb
);
TCP_SEQNO
TcpGetIss (
VOID
);
VOID
TcpInitTcbLocal (
IN TCP_CB *Tcb
);
VOID
TcpInitTcbPeer (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg,
IN TCP_OPTION *Opt
);
UINT16
TcpGetRcvMss (
IN SOCKET *Sock
);
VOID
TcpSetState (
IN TCP_CB *Tcb,
IN UINT8 State
);
//
// Functions in Tcp4Output.c
//
INTN
TcpSendIpPacket (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpToSendData (
IN TCP_CB *Tcb,
IN INTN Force
);
VOID
TcpToSendAck (
IN TCP_CB *Tcb
);
VOID
TcpSendAck (
IN TCP_CB *Tcb
);
INTN
TcpSendZeroProbe (
IN TCP_CB *Tcb
);
INTN
TcpDeliverData (
IN TCP_CB *Tcb
);
INTN
TcpSendReset (
IN TCP_CB *Tcb,
IN TCP_HEAD *Head,
IN INT32 Len,
IN UINT32 Local,
IN UINT32 Remote
);
UINT32
TcpRcvWinOld (
IN TCP_CB *Tcb
);
UINT32
TcpRcvWinNow (
IN TCP_CB *Tcb
);
INTN
TcpRetransmit (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq
);
UINT32
TcpDataToSend (
IN TCP_CB *Tcb,
IN INTN Force
);
INTN
TcpVerifySegment (
IN NET_BUF *Nbuf
);
INTN
TcpCheckSndQue (
IN NET_LIST_ENTRY *Head
);
NET_BUF *
TcpGetSegmentSndQue (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
NET_BUF *
TcpGetSegmentSock (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
NET_BUF *
TcpGetSegment (
IN TCP_CB *Tcb,
IN TCP_SEQNO Seq,
IN UINT32 Len
);
TCP_SEQNO
TcpGetMaxSndNxt (
IN TCP_CB *Tcb
);
//
// Functions from Tcp4Input.c
//
VOID
TcpIcmpInput (
IN NET_BUF *Nbuf,
IN ICMP_ERROR IcmpErr,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpInput (
IN NET_BUF *Nbuf,
IN UINT32 Src,
IN UINT32 Dst
);
INTN
TcpSeqAcceptable (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpFastRecover (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpFastLossRecover (
IN TCP_CB *Tcb,
IN TCP_SEG *Seg
);
VOID
TcpComputeRtt (
IN TCP_CB *Tcb,
IN UINT32 Measure
);
INTN
TcpTrimInWnd (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
VOID
TcpQueueData (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf
);
VOID
TcpAdjustSndQue (
IN TCP_CB *Tcb,
IN TCP_SEQNO Ack
);
//
// Functions from Tcp4Misc.c
//
UINT16
TcpChecksum (
IN NET_BUF *Buf,
IN UINT16 HeadChecksum
);
TCP_SEG *
TcpFormatNetbuf (
IN TCP_CB *Tcb,
IN NET_BUF *Nbuf
);
VOID
TcpOnAppConnect (
IN TCP_CB *Tcb
);
INTN
TcpOnAppConsume (
IN TCP_CB *Tcb
);
VOID
TcpOnAppClose (
IN TCP_CB *Tcb
);
INTN
TcpOnAppSend (
IN TCP_CB *Tcb
);
VOID
TcpOnAppAbort (
IN TCP_CB *Tcb
);
VOID
TcpResetConnection (
IN TCP_CB *Tcb
);
//
// Functions in Tcp4Timer.c
//
VOID
TcpClose (
IN TCP_CB *Tcb
);
VOID
EFIAPI
TcpTicking (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
TcpSetTimer (
IN TCP_CB *Tcb,
IN UINT16 Timer,
IN UINT32 TimeOut
);
VOID
TcpClearTimer (
IN TCP_CB *Tcb,
IN UINT16 Timer
);
VOID
TcpClearAllTimer (
IN TCP_CB *Tcb
);
VOID
TcpSetProbeTimer (
IN TCP_CB *Tcb
);
VOID
TcpSetKeepaliveTimer (
IN TCP_CB *Tcb
);
VOID
TcpBackoffRto (
IN TCP_CB *Tcb
);
EFI_STATUS
TcpSetVariableData (
IN TCP4_SERVICE_DATA *Tcp4Service
);
VOID
TcpClearVariableData (
IN TCP4_SERVICE_DATA *Tcp4Service
);
EFI_STATUS
TcpInstallDevicePath (
IN SOCKET *Sock
);
#endif

View File

@ -1,175 +1,175 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Main.h
Abstract:
**/
#ifndef _TCP4_MAIN_H_
#define _TCP4_MAIN_H_
#include "Socket.h"
#include "Tcp4Proto.h"
#include "Tcp4Driver.h"
extern UINT16 mTcp4RandomPort;
//
// Driver Produced Protocol Prototypes
//
#define TCP4_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Tcp", PrintArg)
#define TCP4_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Tcp", PrintArg)
#define TCP4_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Tcp", PrintArg)
//
// Function prototype for the Tcp4 socket request handler
//
EFI_STATUS
Tcp4Dispatcher (
IN SOCKET *Sock,
IN SOCK_REQUEST Request,
IN VOID *Data OPTIONAL
);
typedef struct _TCP4_MODE_DATA {
EFI_TCP4_CONNECTION_STATE *Tcp4State;
EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
EFI_IP4_MODE_DATA *Ip4ModeData;
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
} TCP4_MODE_DATA;
typedef struct _TCP4_ROUTE_INFO {
BOOLEAN DeleteRoute;
EFI_IPv4_ADDRESS *SubnetAddress;
EFI_IPv4_ADDRESS *SubnetMask;
EFI_IPv4_ADDRESS *GatewayAddress;
} TCP4_ROUTE_INFO;
//
// Get the mode data of a TCP instance
//
EFI_STATUS
EFIAPI
Tcp4GetModeData (
IN CONST EFI_TCP4_PROTOCOL * This,
OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
);
//
// Initialize or reset a TCP instance
//
EFI_STATUS
EFIAPI
Tcp4Configure (
IN EFI_TCP4_PROTOCOL * This,
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
);
//
// Add a route entry to the route table
//
EFI_STATUS
EFIAPI
Tcp4Routes (
IN EFI_TCP4_PROTOCOL *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv4_ADDRESS *SubnetAddress,
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
//
// Issue an asynchronous connection establishment
// request to the peer
//
EFI_STATUS
EFIAPI
Tcp4Connect (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
);
//
// Issue an asynchronous listent token to accept an
// incoming connection reques
//
EFI_STATUS
EFIAPI
Tcp4Accept (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
);
//
// Issue an asynchronous IO token to transmit some data
// through this TCP instance
//
EFI_STATUS
EFIAPI
Tcp4Transmit (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_IO_TOKEN *Token
);
//
// Issue an asynchronous IO token to receive some data
// through this TCP instance
//
EFI_STATUS
Tcp4Receive (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_IO_TOKEN *Token
);
//
// Issue an asynchronous CloseToken to close a TCP
// connection represented by instance
//
EFI_STATUS
EFIAPI
Tcp4Close (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
);
//
// cancle an connect, listent or IO token
//
EFI_STATUS
EFIAPI
Tcp4Cancel (
IN EFI_TCP4_PROTOCOL * This,
IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
);
//
// poll data from NIC for receive
//
EFI_STATUS
EFIAPI
Tcp4Poll (
IN EFI_TCP4_PROTOCOL *This
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Main.h
Abstract:
**/
#ifndef _TCP4_MAIN_H_
#define _TCP4_MAIN_H_
#include "Socket.h"
#include "Tcp4Proto.h"
#include "Tcp4Driver.h"
extern UINT16 mTcp4RandomPort;
//
// Driver Produced Protocol Prototypes
//
#define TCP4_DEBUG_ERROR(PrintArg) NET_DEBUG_ERROR ("Tcp", PrintArg)
#define TCP4_DEBUG_WARN(PrintArg) NET_DEBUG_WARNING ("Tcp", PrintArg)
#define TCP4_DEBUG_TRACE(PrintArg) NET_DEBUG_TRACE ("Tcp", PrintArg)
//
// Function prototype for the Tcp4 socket request handler
//
EFI_STATUS
Tcp4Dispatcher (
IN SOCKET *Sock,
IN SOCK_REQUEST Request,
IN VOID *Data OPTIONAL
);
typedef struct _TCP4_MODE_DATA {
EFI_TCP4_CONNECTION_STATE *Tcp4State;
EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
EFI_IP4_MODE_DATA *Ip4ModeData;
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
} TCP4_MODE_DATA;
typedef struct _TCP4_ROUTE_INFO {
BOOLEAN DeleteRoute;
EFI_IPv4_ADDRESS *SubnetAddress;
EFI_IPv4_ADDRESS *SubnetMask;
EFI_IPv4_ADDRESS *GatewayAddress;
} TCP4_ROUTE_INFO;
//
// Get the mode data of a TCP instance
//
EFI_STATUS
EFIAPI
Tcp4GetModeData (
IN CONST EFI_TCP4_PROTOCOL * This,
OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
);
//
// Initialize or reset a TCP instance
//
EFI_STATUS
EFIAPI
Tcp4Configure (
IN EFI_TCP4_PROTOCOL * This,
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
);
//
// Add a route entry to the route table
//
EFI_STATUS
EFIAPI
Tcp4Routes (
IN EFI_TCP4_PROTOCOL *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv4_ADDRESS *SubnetAddress,
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
//
// Issue an asynchronous connection establishment
// request to the peer
//
EFI_STATUS
EFIAPI
Tcp4Connect (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
);
//
// Issue an asynchronous listent token to accept an
// incoming connection reques
//
EFI_STATUS
EFIAPI
Tcp4Accept (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
);
//
// Issue an asynchronous IO token to transmit some data
// through this TCP instance
//
EFI_STATUS
EFIAPI
Tcp4Transmit (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_IO_TOKEN *Token
);
//
// Issue an asynchronous IO token to receive some data
// through this TCP instance
//
EFI_STATUS
Tcp4Receive (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_IO_TOKEN *Token
);
//
// Issue an asynchronous CloseToken to close a TCP
// connection represented by instance
//
EFI_STATUS
EFIAPI
Tcp4Close (
IN EFI_TCP4_PROTOCOL *This,
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
);
//
// cancle an connect, listent or IO token
//
EFI_STATUS
EFIAPI
Tcp4Cancel (
IN EFI_TCP4_PROTOCOL * This,
IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
);
//
// poll data from NIC for receive
//
EFI_STATUS
EFIAPI
Tcp4Poll (
IN EFI_TCP4_PROTOCOL *This
);
#endif

View File

@ -1,107 +1,107 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Option.h
Abstract:
**/
#ifndef _TCP4_OPTION_H_
#define _TCP4_OPTION_H_
//
// The structure to store the parse option value.
// ParseOption only parse the options, don't process them.
//
typedef struct s_TCP_OPTION {
UINT8 Flag; // flag such as TCP_OPTION_RCVD_MSS
UINT8 WndScale; // the WndScale received
UINT16 Mss; // the Mss received
UINT32 TSVal; // the TSVal field in a timestamp option
UINT32 TSEcr; // the TSEcr field in a timestamp option
} TCP_OPTION;
enum {
//
// supported TCP option type and their length
//
TCP_OPTION_EOP = 0, // End Of oPtion
TCP_OPTION_NOP = 1, // No-Option.
TCP_OPTION_MSS = 2, // Maximum Segment Size
TCP_OPTION_WS = 3, // Window scale
TCP_OPTION_TS = 8, // Timestamp
TCP_OPTION_MSS_LEN = 4, // length of MSS option
TCP_OPTION_WS_LEN = 3, // length of window scale option
TCP_OPTION_TS_LEN = 10, // length of timestamp option
TCP_OPTION_WS_ALIGNED_LEN = 4, // length of window scale option, aligned
TCP_OPTION_TS_ALIGNED_LEN = 12, // length of timestamp option, aligned
//
// recommend format of timestamp window scale
// option for fast process.
//
TCP_OPTION_TS_FAST = ((TCP_OPTION_NOP << 24) |
(TCP_OPTION_NOP << 16) |
(TCP_OPTION_TS << 8) |
TCP_OPTION_TS_LEN),
TCP_OPTION_WS_FAST = ((TCP_OPTION_NOP << 24) |
(TCP_OPTION_WS << 16) |
(TCP_OPTION_WS_LEN << 8)),
TCP_OPTION_MSS_FAST = ((TCP_OPTION_MSS << 24) |
(TCP_OPTION_MSS_LEN << 16)),
//
// Other misc definations
//
TCP_OPTION_MAX_WS = 14, // Maxium window scale value
TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header
TCP_OPTION_RCVD_MSS = 0x01,
TCP_OPTION_RCVD_WS = 0x02,
TCP_OPTION_RCVD_TS = 0x04
};
UINT8
TcpComputeScale (
IN TCP_CB *Tcb
);
UINT16
TcpSynBuildOption (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
UINT16
TcpBuildOption (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
INTN
TcpParseOption (
IN TCP_HEAD *Tcp,
IN TCP_OPTION *Option
);
UINT32
TcpPawsOK (
IN TCP_CB *Tcb,
IN UINT32 TSVal
);
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Option.h
Abstract:
**/
#ifndef _TCP4_OPTION_H_
#define _TCP4_OPTION_H_
//
// The structure to store the parse option value.
// ParseOption only parse the options, don't process them.
//
typedef struct s_TCP_OPTION {
UINT8 Flag; // flag such as TCP_OPTION_RCVD_MSS
UINT8 WndScale; // the WndScale received
UINT16 Mss; // the Mss received
UINT32 TSVal; // the TSVal field in a timestamp option
UINT32 TSEcr; // the TSEcr field in a timestamp option
} TCP_OPTION;
enum {
//
// supported TCP option type and their length
//
TCP_OPTION_EOP = 0, // End Of oPtion
TCP_OPTION_NOP = 1, // No-Option.
TCP_OPTION_MSS = 2, // Maximum Segment Size
TCP_OPTION_WS = 3, // Window scale
TCP_OPTION_TS = 8, // Timestamp
TCP_OPTION_MSS_LEN = 4, // length of MSS option
TCP_OPTION_WS_LEN = 3, // length of window scale option
TCP_OPTION_TS_LEN = 10, // length of timestamp option
TCP_OPTION_WS_ALIGNED_LEN = 4, // length of window scale option, aligned
TCP_OPTION_TS_ALIGNED_LEN = 12, // length of timestamp option, aligned
//
// recommend format of timestamp window scale
// option for fast process.
//
TCP_OPTION_TS_FAST = ((TCP_OPTION_NOP << 24) |
(TCP_OPTION_NOP << 16) |
(TCP_OPTION_TS << 8) |
TCP_OPTION_TS_LEN),
TCP_OPTION_WS_FAST = ((TCP_OPTION_NOP << 24) |
(TCP_OPTION_WS << 16) |
(TCP_OPTION_WS_LEN << 8)),
TCP_OPTION_MSS_FAST = ((TCP_OPTION_MSS << 24) |
(TCP_OPTION_MSS_LEN << 16)),
//
// Other misc definations
//
TCP_OPTION_MAX_WS = 14, // Maxium window scale value
TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header
TCP_OPTION_RCVD_MSS = 0x01,
TCP_OPTION_RCVD_WS = 0x02,
TCP_OPTION_RCVD_TS = 0x04
};
UINT8
TcpComputeScale (
IN TCP_CB *Tcb
);
UINT16
TcpSynBuildOption (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
UINT16
TcpBuildOption (
IN TCP_CB *Tcb,
IN NET_BUF *Buf
);
INTN
TcpParseOption (
IN TCP_HEAD *Tcp,
IN TCP_OPTION *Option
);
UINT32
TcpPawsOK (
IN TCP_CB *Tcb,
IN UINT32 TSVal
);
#endif

View File

@ -1,355 +1,355 @@
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Proto.h
Abstract:
**/
#ifndef _TCP4_PROTO_H_
#define _TCP4_PROTO_H_
typedef struct _TCP_CB TCP_CB;
#include "Tcp4Driver.h"
#include "Socket.h"
#include "Tcp4Option.h"
//
// tcp states, Don't change their order, it is used as
// index to mTcpOutFlag and other macros
//
enum {
TCP_CLOSED = 0,
TCP_LISTEN,
TCP_SYN_SENT,
TCP_SYN_RCVD,
TCP_ESTABLISHED,
TCP_FIN_WAIT_1,
TCP_FIN_WAIT_2,
TCP_CLOSING,
TCP_TIME_WAIT,
TCP_CLOSE_WAIT,
TCP_LAST_ACK
};
//
// flags in the TCP header
//
enum {
TCP_FLG_FIN = 0x01,
TCP_FLG_SYN = 0x02,
TCP_FLG_RST = 0x04,
TCP_FLG_PSH = 0x08,
TCP_FLG_ACK = 0x10,
TCP_FLG_URG = 0x20,
TCP_FLG_FLAG = 0x3F // mask for all the flags
};
enum {
//
// TCP error status
//
TCP_CONNECT_REFUSED = -1,
TCP_CONNECT_RESET = -2,
TCP_CONNECT_CLOSED = -3,
//
// Current congestion status as suggested by RFC3782.
//
TCP_CONGEST_RECOVER = 1, // during the NewReno fast recovery
TCP_CONGEST_LOSS = 2, // retxmit because of retxmit time out
TCP_CONGEST_OPEN = 3, // TCP is opening its congestion window
//
// TCP control flags
//
TCP_CTRL_NO_NAGLE = 0x0001, // disable Nagle algorithm
TCP_CTRL_NO_KEEPALIVE = 0x0002, // disable keepalive timer
TCP_CTRL_NO_WS = 0x0004, // disable window scale option
TCP_CTRL_RCVD_WS = 0x0008, // rcvd a wnd scale option in syn
TCP_CTRL_NO_TS = 0x0010, // disable Timestamp option
TCP_CTRL_RCVD_TS = 0x0020, // rcvd a Timestamp option in syn
TCP_CTRL_SND_TS = 0x0040, // Send Timestamp option to remote
TCP_CTRL_SND_URG = 0x0080, // in urgent send mode
TCP_CTRL_RCVD_URG = 0x0100, // in urgent receive mode
TCP_CTRL_SND_PSH = 0x0200, // in PUSH send mode
TCP_CTRL_FIN_SENT = 0x0400, // FIN is sent
TCP_CTRL_FIN_ACKED = 0x0800, // FIN is ACKed.
TCP_CTRL_TIMER_ON = 0x1000, // At least one of the timer is on
TCP_CTRL_RTT_ON = 0x2000, // The RTT measurement is on
TCP_CTRL_ACK_NOW = 0x4000, // Send the ACK now, don't delay
//
// Timer related values
//
TCP_TIMER_CONNECT = 0, // Connection establishment timer
TCP_TIMER_REXMIT = 1, // retransmit timer
TCP_TIMER_PROBE = 2, // Window probe timer
TCP_TIMER_KEEPALIVE = 3, // Keepalive timer
TCP_TIMER_FINWAIT2 = 4, // FIN_WAIT_2 timer
TCP_TIMER_2MSL = 5, // TIME_WAIT tiemr
TCP_TIMER_NUMBER = 6, // the total number of TCP timer.
TCP_TICK = 200, // every TCP tick is 200ms
TCP_TICK_HZ = 5, // the frequence of TCP tick
TCP_RTT_SHIFT = 3, // SRTT & RTTVAR scaled by 8
TCP_RTO_MIN = TCP_TICK_HZ, // the minium value of RTO
TCP_RTO_MAX = TCP_TICK_HZ *60, // the maxium value of RTO
TCP_FOLD_RTT = 4, // timeout threshod to fold RTT
//
// default values for some timers
//
TCP_MAX_LOSS = 12, // default max times to retxmit
TCP_KEEPALIVE_IDLE_MIN = TCP_TICK_HZ *60 *60 *2, // First keep alive
TCP_KEEPALIVE_PERIOD = TCP_TICK_HZ *60,
TCP_MAX_KEEPALIVE = 8,
TCP_FIN_WAIT2_TIME = 2 *TCP_TICK_HZ, // * 60,
TCP_TIME_WAIT_TIME = 2 *TCP_TICK_HZ,
TCP_PAWS_24DAY = 24 *24 *60 *60 *TCP_TICK_HZ,
TCP_CONNECT_TIME = 75 *TCP_TICK_HZ,
//
// The header space to be reserved before TCP data to accomodate :
// 60byte IP head + 60byte TCP head + link layer head
//
TCP_MAX_HEAD = 192,
//
// value ranges for some control option
//
TCP_RCV_BUF_SIZE = 2 *1024 *1024,
TCP_RCV_BUF_SIZE_MIN = 8 *1024,
TCP_SND_BUF_SIZE = 2 *1024 *1024,
TCP_SND_BUF_SIZE_MIN = 8 *1024,
TCP_BACKLOG = 10,
TCP_BACKLOG_MIN = 5,
TCP_MAX_LOSS_MIN = 6,
TCP_CONNECT_TIME_MIN = 60 *TCP_TICK_HZ,
TCP_MAX_KEEPALIVE_MIN = 4,
TCP_KEEPALIVE_IDLE_MAX = TCP_TICK_HZ *60 *60 *4,
TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
};
typedef struct _TCP_SEG {
TCP_SEQNO Seq; // Starting sequence number
TCP_SEQNO End; // The sequence of the last byte + 1,
// include SYN/FIN. End-Seq = SEG.LEN
TCP_SEQNO Ack; // ACK fild in the segment
UINT8 Flag; // TCP header flags
UINT16 Urg; // Valid if URG flag is set.
UINT32 Wnd; // TCP window size field
} TCP_SEG;
typedef struct _TCP_PEER {
UINT32 Ip; // Network byte order
TCP_PORTNO Port; // Network byte order
} TCP_PEER;
//
// tcp control block, it includes various states
//
struct _TCP_CB {
NET_LIST_ENTRY List;
TCP_CB *Parent;
SOCKET *Sk;
TCP_PEER LocalEnd;
TCP_PEER RemoteEnd;
NET_LIST_ENTRY SndQue; // retxmission queue
NET_LIST_ENTRY RcvQue; // reassemble queue
UINT32 CtrlFlag; // control flags, such as NO_NAGLE
INT32 Error; // soft error status,TCP_CONNECT_RESET...
//
// RFC793 and RFC1122 defined variables
//
UINT8 State; // TCP state, such as SYN_SENT, LISTEN
UINT8 DelayedAck; // number of delayed ACKs
UINT16 HeadSum; // checksum of the fixed parts of pesudo
// header: Src IP, Dst IP, 0, Protocol,
// not include the TCP length.
TCP_SEQNO Iss; // Initial Sending Sequence
TCP_SEQNO SndUna; // first unacknowledged data
TCP_SEQNO SndNxt; // next data sequence to send.
TCP_SEQNO SndPsh; // Send PUSH point
TCP_SEQNO SndUp; // Send urgent point
UINT32 SndWnd; // Window advertised by the remote peer
UINT32 SndWndMax; // max send window advertised by the peer
TCP_SEQNO SndWl1; // Seq number used for last window update
TCP_SEQNO SndWl2; // ack no of last window update
UINT16 SndMss; // Max send segment size
TCP_SEQNO RcvNxt; // Next sequence no to receive
UINT32 RcvWnd; // Window advertised by the local peer
TCP_SEQNO RcvWl2; // The RcvNxt (or ACK) of last window update.
// It is necessary because of delayed ACK
TCP_SEQNO RcvUp; // urgent point;
TCP_SEQNO Irs; // Initial Receiving Sequence
UINT16 RcvMss; // Max receive segment size
UINT16 EnabledTimer; // which timer is currently enabled
UINT32 Timer[TCP_TIMER_NUMBER]; // when the timer will expire
INT32 NextExpire; // count down offset for the nearest timer
UINT32 Idle; // How long the connection is in idle
UINT32 ProbeTime; // the time out value for current window prober
//
// RFC1323 defined variables, about window scale,
// timestamp and PAWS
//
UINT8 SndWndScale; // Wndscale received from the peer
UINT8 RcvWndScale; // Wndscale used to scale local buffer
UINT32 TsRecent; // TsRecent to echo to the remote peer
UINT32 TsRecentAge; // When this TsRecent is updated
// TCP_SEQNO LastAckSent;
// It isn't necessary to add LastAckSent here,
// since it is the same as RcvWl2
//
// RFC2988 defined variables. about RTT measurement
//
TCP_SEQNO RttSeq; // the seq of measured segment now
UINT32 RttMeasure; // currently measured RTT in heart beats
UINT32 SRtt; // Smoothed RTT, scaled by 8
UINT32 RttVar; // RTT variance, scaled by 8
UINT32 Rto; // Current RTO, not scaled
//
// RFC2581, and 3782 variables.
// Congestion control + NewReno fast recovery.
//
UINT32 CWnd; // Sender's congestion window
UINT32 Ssthresh; // Slow start threshold.
TCP_SEQNO Recover; // recover point for NewReno
UINT16 DupAck; // number of duplicate ACKs
UINT8 CongestState; // the current congestion state(RFC3782)
UINT8 LossTimes; // number of retxmit timeouts in a row
TCP_SEQNO LossRecover; // recover point for retxmit
//
// configuration parameters, for EFI_TCP4_PROTOCOL specification
//
UINT32 KeepAliveIdle; // idle time before sending first probe
UINT32 KeepAlivePeriod; // interval for subsequent keep alive probe
UINT8 MaxKeepAlive; // Maxium keep alive probe times.
UINT8 KeepAliveProbes; // the number of keep alive probe.
UINT16 MaxRexmit; // The maxium number of retxmit before abort
UINT32 FinWait2Timeout; // The FIN_WAIT_2 time out
UINT32 TimeWaitTimeout; // The TIME_WAIT time out
UINT32 ConnectTimeout;
//
// configuration for tcp provided by user
//
BOOLEAN UseDefaultAddr;
UINT8 TOS;
UINT8 TTL;
EFI_IPv4_ADDRESS SubnetMask;
//
// pointer reference to Ip used to send pkt
//
IP_IO_IP_INFO *IpInfo;
};
extern NET_LIST_ENTRY mTcpRunQue;
extern NET_LIST_ENTRY mTcpListenQue;
extern TCP_SEQNO mTcpGlobalIss;
extern UINT32 mTcpTick;
//
// TCP_CONNECTED: both ends have synchronized their ISN.
//
#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
#define TCP_FIN_RCVD(State) \
(((State) == TCP_CLOSE_WAIT) || \
((State) == TCP_LAST_ACK) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT))
#define TCP_LOCAL_CLOSED(State) \
(((State) == TCP_FIN_WAIT_1) || \
((State) == TCP_FIN_WAIT_2) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT) || \
((State) == TCP_LAST_ACK))
//
// Get the TCP_SEG point from a net buffer's ProtoData
//
#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
//
// macros to compare sequence no
//
#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
//
// TCP_SEQ_BETWEEN return whether b <= m <= e
//
#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
//
// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
//
#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
#define TCP_SET_FLG(Value, Flag) ((Value) |= (Flag))
#define TCP_CLEAR_FLG(Value, Flag) ((Value) &= ~(Flag))
//
// test whether two peers are equal
//
#define TCP_PEER_EQUAL(Pa, Pb) \
(((Pa)->Ip == (Pb)->Ip) && ((Pa)->Port == (Pb)->Port))
//
// test whether Pa matches Pb, or Pa is more specific
// than pb. Zero means wildcard.
//
#define TCP_PEER_MATCH(Pa, Pb) \
((((Pb)->Ip == 0) || ((Pb)->Ip == (Pa)->Ip)) && \
(((Pb)->Port == 0) || ((Pb)->Port == (Pa)->Port)))
#define TCP_TIMER_ON(Flag, Timer) ((Flag) & (1 << (Timer)))
#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer))))
#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer)))))
#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
#define TCP_MAX_WIN 0xFFFFU
typedef
VOID
(*TCP_TIMER_HANDLER) (
IN TCP_CB * Tcb
);
#include "Tcp4Func.h"
#endif
/** @file
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Tcp4Proto.h
Abstract:
**/
#ifndef _TCP4_PROTO_H_
#define _TCP4_PROTO_H_
typedef struct _TCP_CB TCP_CB;
#include "Tcp4Driver.h"
#include "Socket.h"
#include "Tcp4Option.h"
//
// tcp states, Don't change their order, it is used as
// index to mTcpOutFlag and other macros
//
enum {
TCP_CLOSED = 0,
TCP_LISTEN,
TCP_SYN_SENT,
TCP_SYN_RCVD,
TCP_ESTABLISHED,
TCP_FIN_WAIT_1,
TCP_FIN_WAIT_2,
TCP_CLOSING,
TCP_TIME_WAIT,
TCP_CLOSE_WAIT,
TCP_LAST_ACK
};
//
// flags in the TCP header
//
enum {
TCP_FLG_FIN = 0x01,
TCP_FLG_SYN = 0x02,
TCP_FLG_RST = 0x04,
TCP_FLG_PSH = 0x08,
TCP_FLG_ACK = 0x10,
TCP_FLG_URG = 0x20,
TCP_FLG_FLAG = 0x3F // mask for all the flags
};
enum {
//
// TCP error status
//
TCP_CONNECT_REFUSED = -1,
TCP_CONNECT_RESET = -2,
TCP_CONNECT_CLOSED = -3,
//
// Current congestion status as suggested by RFC3782.
//
TCP_CONGEST_RECOVER = 1, // during the NewReno fast recovery
TCP_CONGEST_LOSS = 2, // retxmit because of retxmit time out
TCP_CONGEST_OPEN = 3, // TCP is opening its congestion window
//
// TCP control flags
//
TCP_CTRL_NO_NAGLE = 0x0001, // disable Nagle algorithm
TCP_CTRL_NO_KEEPALIVE = 0x0002, // disable keepalive timer
TCP_CTRL_NO_WS = 0x0004, // disable window scale option
TCP_CTRL_RCVD_WS = 0x0008, // rcvd a wnd scale option in syn
TCP_CTRL_NO_TS = 0x0010, // disable Timestamp option
TCP_CTRL_RCVD_TS = 0x0020, // rcvd a Timestamp option in syn
TCP_CTRL_SND_TS = 0x0040, // Send Timestamp option to remote
TCP_CTRL_SND_URG = 0x0080, // in urgent send mode
TCP_CTRL_RCVD_URG = 0x0100, // in urgent receive mode
TCP_CTRL_SND_PSH = 0x0200, // in PUSH send mode
TCP_CTRL_FIN_SENT = 0x0400, // FIN is sent
TCP_CTRL_FIN_ACKED = 0x0800, // FIN is ACKed.
TCP_CTRL_TIMER_ON = 0x1000, // At least one of the timer is on
TCP_CTRL_RTT_ON = 0x2000, // The RTT measurement is on
TCP_CTRL_ACK_NOW = 0x4000, // Send the ACK now, don't delay
//
// Timer related values
//
TCP_TIMER_CONNECT = 0, // Connection establishment timer
TCP_TIMER_REXMIT = 1, // retransmit timer
TCP_TIMER_PROBE = 2, // Window probe timer
TCP_TIMER_KEEPALIVE = 3, // Keepalive timer
TCP_TIMER_FINWAIT2 = 4, // FIN_WAIT_2 timer
TCP_TIMER_2MSL = 5, // TIME_WAIT tiemr
TCP_TIMER_NUMBER = 6, // the total number of TCP timer.
TCP_TICK = 200, // every TCP tick is 200ms
TCP_TICK_HZ = 5, // the frequence of TCP tick
TCP_RTT_SHIFT = 3, // SRTT & RTTVAR scaled by 8
TCP_RTO_MIN = TCP_TICK_HZ, // the minium value of RTO
TCP_RTO_MAX = TCP_TICK_HZ *60, // the maxium value of RTO
TCP_FOLD_RTT = 4, // timeout threshod to fold RTT
//
// default values for some timers
//
TCP_MAX_LOSS = 12, // default max times to retxmit
TCP_KEEPALIVE_IDLE_MIN = TCP_TICK_HZ *60 *60 *2, // First keep alive
TCP_KEEPALIVE_PERIOD = TCP_TICK_HZ *60,
TCP_MAX_KEEPALIVE = 8,
TCP_FIN_WAIT2_TIME = 2 *TCP_TICK_HZ, // * 60,
TCP_TIME_WAIT_TIME = 2 *TCP_TICK_HZ,
TCP_PAWS_24DAY = 24 *24 *60 *60 *TCP_TICK_HZ,
TCP_CONNECT_TIME = 75 *TCP_TICK_HZ,
//
// The header space to be reserved before TCP data to accomodate :
// 60byte IP head + 60byte TCP head + link layer head
//
TCP_MAX_HEAD = 192,
//
// value ranges for some control option
//
TCP_RCV_BUF_SIZE = 2 *1024 *1024,
TCP_RCV_BUF_SIZE_MIN = 8 *1024,
TCP_SND_BUF_SIZE = 2 *1024 *1024,
TCP_SND_BUF_SIZE_MIN = 8 *1024,
TCP_BACKLOG = 10,
TCP_BACKLOG_MIN = 5,
TCP_MAX_LOSS_MIN = 6,
TCP_CONNECT_TIME_MIN = 60 *TCP_TICK_HZ,
TCP_MAX_KEEPALIVE_MIN = 4,
TCP_KEEPALIVE_IDLE_MAX = TCP_TICK_HZ *60 *60 *4,
TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
};
typedef struct _TCP_SEG {
TCP_SEQNO Seq; // Starting sequence number
TCP_SEQNO End; // The sequence of the last byte + 1,
// include SYN/FIN. End-Seq = SEG.LEN
TCP_SEQNO Ack; // ACK fild in the segment
UINT8 Flag; // TCP header flags
UINT16 Urg; // Valid if URG flag is set.
UINT32 Wnd; // TCP window size field
} TCP_SEG;
typedef struct _TCP_PEER {
UINT32 Ip; // Network byte order
TCP_PORTNO Port; // Network byte order
} TCP_PEER;
//
// tcp control block, it includes various states
//
struct _TCP_CB {
NET_LIST_ENTRY List;
TCP_CB *Parent;
SOCKET *Sk;
TCP_PEER LocalEnd;
TCP_PEER RemoteEnd;
NET_LIST_ENTRY SndQue; // retxmission queue
NET_LIST_ENTRY RcvQue; // reassemble queue
UINT32 CtrlFlag; // control flags, such as NO_NAGLE
INT32 Error; // soft error status,TCP_CONNECT_RESET...
//
// RFC793 and RFC1122 defined variables
//
UINT8 State; // TCP state, such as SYN_SENT, LISTEN
UINT8 DelayedAck; // number of delayed ACKs
UINT16 HeadSum; // checksum of the fixed parts of pesudo
// header: Src IP, Dst IP, 0, Protocol,
// not include the TCP length.
TCP_SEQNO Iss; // Initial Sending Sequence
TCP_SEQNO SndUna; // first unacknowledged data
TCP_SEQNO SndNxt; // next data sequence to send.
TCP_SEQNO SndPsh; // Send PUSH point
TCP_SEQNO SndUp; // Send urgent point
UINT32 SndWnd; // Window advertised by the remote peer
UINT32 SndWndMax; // max send window advertised by the peer
TCP_SEQNO SndWl1; // Seq number used for last window update
TCP_SEQNO SndWl2; // ack no of last window update
UINT16 SndMss; // Max send segment size
TCP_SEQNO RcvNxt; // Next sequence no to receive
UINT32 RcvWnd; // Window advertised by the local peer
TCP_SEQNO RcvWl2; // The RcvNxt (or ACK) of last window update.
// It is necessary because of delayed ACK
TCP_SEQNO RcvUp; // urgent point;
TCP_SEQNO Irs; // Initial Receiving Sequence
UINT16 RcvMss; // Max receive segment size
UINT16 EnabledTimer; // which timer is currently enabled
UINT32 Timer[TCP_TIMER_NUMBER]; // when the timer will expire
INT32 NextExpire; // count down offset for the nearest timer
UINT32 Idle; // How long the connection is in idle
UINT32 ProbeTime; // the time out value for current window prober
//
// RFC1323 defined variables, about window scale,
// timestamp and PAWS
//
UINT8 SndWndScale; // Wndscale received from the peer
UINT8 RcvWndScale; // Wndscale used to scale local buffer
UINT32 TsRecent; // TsRecent to echo to the remote peer
UINT32 TsRecentAge; // When this TsRecent is updated
// TCP_SEQNO LastAckSent;
// It isn't necessary to add LastAckSent here,
// since it is the same as RcvWl2
//
// RFC2988 defined variables. about RTT measurement
//
TCP_SEQNO RttSeq; // the seq of measured segment now
UINT32 RttMeasure; // currently measured RTT in heart beats
UINT32 SRtt; // Smoothed RTT, scaled by 8
UINT32 RttVar; // RTT variance, scaled by 8
UINT32 Rto; // Current RTO, not scaled
//
// RFC2581, and 3782 variables.
// Congestion control + NewReno fast recovery.
//
UINT32 CWnd; // Sender's congestion window
UINT32 Ssthresh; // Slow start threshold.
TCP_SEQNO Recover; // recover point for NewReno
UINT16 DupAck; // number of duplicate ACKs
UINT8 CongestState; // the current congestion state(RFC3782)
UINT8 LossTimes; // number of retxmit timeouts in a row
TCP_SEQNO LossRecover; // recover point for retxmit
//
// configuration parameters, for EFI_TCP4_PROTOCOL specification
//
UINT32 KeepAliveIdle; // idle time before sending first probe
UINT32 KeepAlivePeriod; // interval for subsequent keep alive probe
UINT8 MaxKeepAlive; // Maxium keep alive probe times.
UINT8 KeepAliveProbes; // the number of keep alive probe.
UINT16 MaxRexmit; // The maxium number of retxmit before abort
UINT32 FinWait2Timeout; // The FIN_WAIT_2 time out
UINT32 TimeWaitTimeout; // The TIME_WAIT time out
UINT32 ConnectTimeout;
//
// configuration for tcp provided by user
//
BOOLEAN UseDefaultAddr;
UINT8 TOS;
UINT8 TTL;
EFI_IPv4_ADDRESS SubnetMask;
//
// pointer reference to Ip used to send pkt
//
IP_IO_IP_INFO *IpInfo;
};
extern NET_LIST_ENTRY mTcpRunQue;
extern NET_LIST_ENTRY mTcpListenQue;
extern TCP_SEQNO mTcpGlobalIss;
extern UINT32 mTcpTick;
//
// TCP_CONNECTED: both ends have synchronized their ISN.
//
#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
#define TCP_FIN_RCVD(State) \
(((State) == TCP_CLOSE_WAIT) || \
((State) == TCP_LAST_ACK) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT))
#define TCP_LOCAL_CLOSED(State) \
(((State) == TCP_FIN_WAIT_1) || \
((State) == TCP_FIN_WAIT_2) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT) || \
((State) == TCP_LAST_ACK))
//
// Get the TCP_SEG point from a net buffer's ProtoData
//
#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
//
// macros to compare sequence no
//
#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
//
// TCP_SEQ_BETWEEN return whether b <= m <= e
//
#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
//
// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
//
#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
#define TCP_SET_FLG(Value, Flag) ((Value) |= (Flag))
#define TCP_CLEAR_FLG(Value, Flag) ((Value) &= ~(Flag))
//
// test whether two peers are equal
//
#define TCP_PEER_EQUAL(Pa, Pb) \
(((Pa)->Ip == (Pb)->Ip) && ((Pa)->Port == (Pb)->Port))
//
// test whether Pa matches Pb, or Pa is more specific
// than pb. Zero means wildcard.
//
#define TCP_PEER_MATCH(Pa, Pb) \
((((Pb)->Ip == 0) || ((Pb)->Ip == (Pa)->Ip)) && \
(((Pb)->Port == 0) || ((Pb)->Port == (Pa)->Port)))
#define TCP_TIMER_ON(Flag, Timer) ((Flag) & (1 << (Timer)))
#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer))))
#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer)))))
#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
#define TCP_MAX_WIN 0xFFFFU
typedef
VOID
(*TCP_TIMER_HANDLER) (
IN TCP_CB * Tcb
);
#include "Tcp4Func.h"
#endif

View File

@ -24,6 +24,45 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
UdpComponentNameGetDriverName (
@ -32,28 +71,108 @@ UdpComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
UdpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = {
UdpComponentNameGetDriverName,
UdpComponentNameGetControllerName,
"eng"
};
};
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UdpComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UdpComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
{
"eng",
"eng;en",
L"UDP Network Service Driver"
},
{
@ -62,6 +181,45 @@ static EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
UdpComponentNameGetDriverName (
@ -69,100 +227,93 @@ UdpComponentNameGetDriverName (
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCES - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gUdp4ComponentName.SupportedLanguages,
mUdpDriverNameTable,
DriverName
);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mUdpDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUdp4ComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS
EFIAPI
UdpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -504,14 +504,13 @@ Returns:
//
// Install the Udp4DriverBinding and Udp4ComponentName protocols.
//
Status = EfiLibInstallAllDriverProtocols (
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gUdp4DriverBinding,
ImageHandle,
&gUdp4ComponentName,
NULL,
NULL
&gUdp4ComponentName2
);
if (!EFI_ERROR (Status)) {
//

View File

@ -1,70 +1,70 @@
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Udp4Driver.h
Abstract:
**/
#ifndef _UDP4_DRIVER_H_
#define _UDP4_DRIVER_H_
#include <PiDxe.h>
#include <Library/BaseLib.h>
#include <Library/NetLib.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/ServiceBinding.h>
EFI_STATUS
EFIAPI
Udp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
Udp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Udp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif
/** @file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Udp4Driver.h
Abstract:
**/
#ifndef _UDP4_DRIVER_H_
#define _UDP4_DRIVER_H_
#include <PiDxe.h>
#include <Library/BaseLib.h>
#include <Library/NetLib.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/ServiceBinding.h>
EFI_STATUS
EFIAPI
Udp4DriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4DriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
EFI_STATUS
EFIAPI
Udp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle
);
EFI_STATUS
EFIAPI
Udp4ServiceBindingDestroyChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
#endif

View File

@ -1,299 +1,300 @@
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Udp4Impl.h
Abstract:
EFI UDPv4 protocol implementation
**/
#ifndef _UDP4_IMPL_H_
#define _UDP4_IMPL_H_
/** @file
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Udp4Impl.h
Abstract:
EFI UDPv4 protocol implementation
**/
#ifndef _UDP4_IMPL_H_
#define _UDP4_IMPL_H_
#include <PiDxe.h>
#include <Protocol/IP4.h>
#include <Protocol/Udp4.h>
#include <Library/IpIoLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "Udp4Driver.h"
extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
extern EFI_UDP4_PROTOCOL mUdp4Protocol;
extern UINT16 mUdp4RandomPort;
#define ICMP_ERROR_PACKET_LENGTH 8
#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
#define UDP4_HEADER_SIZE sizeof (EFI_UDP4_HEADER)
#define UDP4_MAX_DATA_SIZE 65507
#define UDP4_PORT_KNOWN 1024
#define UDP4_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', '4')
#define UDP4_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
UDP4_SERVICE_DATA, \
ServiceBinding, \
UDP4_SERVICE_DATA_SIGNATURE \
)
typedef struct _UDP4_SERVICE_DATA_ {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_HANDLE ImageHandle;
EFI_HANDLE ControllerHandle;
NET_LIST_ENTRY ChildrenList;
UINTN ChildrenNumber;
IP_IO *IpIo;
EFI_EVENT TimeoutEvent;
CHAR16 *MacString;
} UDP4_SERVICE_DATA;
#define UDP4_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', 'I')
#define UDP4_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
UDP4_INSTANCE_DATA, \
Udp4Proto, \
UDP4_INSTANCE_DATA_SIGNATURE \
)
typedef struct _UDP4_INSTANCE_DATA_ {
UINT32 Signature;
NET_LIST_ENTRY Link;
UDP4_SERVICE_DATA *Udp4Service;
EFI_UDP4_PROTOCOL Udp4Proto;
EFI_UDP4_CONFIG_DATA ConfigData;
EFI_HANDLE ChildHandle;
BOOLEAN Configured;
BOOLEAN IsNoMapping;
NET_MAP TxTokens;
NET_MAP RxTokens;
NET_MAP McastIps;
NET_LIST_ENTRY RcvdDgramQue;
NET_LIST_ENTRY DeliveredDgramQue;
UINT16 HeadSum;
EFI_STATUS IcmpError;
IP_IO_IP_INFO *IpInfo;
BOOLEAN Destroyed;
} UDP4_INSTANCE_DATA;
typedef struct _UDP4_RXDATA_WRAP_ {
NET_LIST_ENTRY Link;
NET_BUF *Packet;
UINT32 TimeoutTick;
EFI_UDP4_RECEIVE_DATA RxData;
} UDP4_RXDATA_WRAP;
EFI_STATUS
EFIAPI
Udp4GetModeData (
IN EFI_UDP4_PROTOCOL *This,
OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Configure (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Groups (
IN EFI_UDP4_PROTOCOL *This,
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Routes (
IN EFI_UDP4_PROTOCOL *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv4_ADDRESS *SubnetAddress,
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
EFI_STATUS
EFIAPI
Udp4Transmit (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
Udp4Receive (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
Udp4Cancel (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Poll (
IN EFI_UDP4_PROTOCOL *This
);
EFI_STATUS
Udp4CreateService (
IN UDP4_SERVICE_DATA *Udp4Service,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle
);
VOID
Udp4CleanService (
IN UDP4_SERVICE_DATA *Udp4Service
);
VOID
Udp4InitInstance (
IN UDP4_SERVICE_DATA *Udp4Service,
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4CleanInstance (
IN UDP4_INSTANCE_DATA *Instance
);
EFI_STATUS
Udp4Bind (
IN NET_LIST_ENTRY *InstanceList,
IN EFI_UDP4_CONFIG_DATA *ConfigData
);
BOOLEAN
Udp4IsReconfigurable (
IN EFI_UDP4_CONFIG_DATA *OldConfigData,
IN EFI_UDP4_CONFIG_DATA *NewConfigData
);
VOID
Udp4BuildIp4ConfigData (
IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,
IN EFI_IP4_CONFIG_DATA *Ip4ConfigData
);
EFI_STATUS
Udp4ValidateTxToken (
IN UDP4_INSTANCE_DATA *Instance,
IN EFI_UDP4_COMPLETION_TOKEN *TxToken
);
EFI_STATUS
Udp4TokenExist (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Context
);
UINT16
Udp4Checksum (
IN NET_BUF *Packet,
IN UINT16 HeadSum
);
EFI_STATUS
Udp4RemoveToken (
IN NET_MAP *TokenMap,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
Udp4LeaveGroup (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg OPTIONAL
);
VOID
Udp4FlushRxData (
IN NET_LIST_ENTRY *RcvdDgramQue
);
EFI_STATUS
Udp4InstanceCancelToken (
IN UDP4_INSTANCE_DATA *Instance,
IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
);
VOID
Udp4InstanceDeliverDgram (
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4ReportIcmpError (
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4NetVectorExtFree (
VOID *Context
);
EFI_STATUS
Udp4SetVariableData (
IN UDP4_SERVICE_DATA *Udp4Service
);
VOID
Udp4ClearVariableData (
IN UDP4_SERVICE_DATA *Udp4Service
);
#endif
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "Udp4Driver.h"
extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2;
extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
extern EFI_UDP4_PROTOCOL mUdp4Protocol;
extern UINT16 mUdp4RandomPort;
#define ICMP_ERROR_PACKET_LENGTH 8
#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
#define UDP4_HEADER_SIZE sizeof (EFI_UDP4_HEADER)
#define UDP4_MAX_DATA_SIZE 65507
#define UDP4_PORT_KNOWN 1024
#define UDP4_SERVICE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', '4')
#define UDP4_SERVICE_DATA_FROM_THIS(a) \
CR ( \
(a), \
UDP4_SERVICE_DATA, \
ServiceBinding, \
UDP4_SERVICE_DATA_SIGNATURE \
)
typedef struct _UDP4_SERVICE_DATA_ {
UINT32 Signature;
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
EFI_HANDLE ImageHandle;
EFI_HANDLE ControllerHandle;
NET_LIST_ENTRY ChildrenList;
UINTN ChildrenNumber;
IP_IO *IpIo;
EFI_EVENT TimeoutEvent;
CHAR16 *MacString;
} UDP4_SERVICE_DATA;
#define UDP4_INSTANCE_DATA_SIGNATURE EFI_SIGNATURE_32('U', 'd', 'p', 'I')
#define UDP4_INSTANCE_DATA_FROM_THIS(a) \
CR ( \
(a), \
UDP4_INSTANCE_DATA, \
Udp4Proto, \
UDP4_INSTANCE_DATA_SIGNATURE \
)
typedef struct _UDP4_INSTANCE_DATA_ {
UINT32 Signature;
NET_LIST_ENTRY Link;
UDP4_SERVICE_DATA *Udp4Service;
EFI_UDP4_PROTOCOL Udp4Proto;
EFI_UDP4_CONFIG_DATA ConfigData;
EFI_HANDLE ChildHandle;
BOOLEAN Configured;
BOOLEAN IsNoMapping;
NET_MAP TxTokens;
NET_MAP RxTokens;
NET_MAP McastIps;
NET_LIST_ENTRY RcvdDgramQue;
NET_LIST_ENTRY DeliveredDgramQue;
UINT16 HeadSum;
EFI_STATUS IcmpError;
IP_IO_IP_INFO *IpInfo;
BOOLEAN Destroyed;
} UDP4_INSTANCE_DATA;
typedef struct _UDP4_RXDATA_WRAP_ {
NET_LIST_ENTRY Link;
NET_BUF *Packet;
UINT32 TimeoutTick;
EFI_UDP4_RECEIVE_DATA RxData;
} UDP4_RXDATA_WRAP;
EFI_STATUS
EFIAPI
Udp4GetModeData (
IN EFI_UDP4_PROTOCOL *This,
OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Configure (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Groups (
IN EFI_UDP4_PROTOCOL *This,
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Routes (
IN EFI_UDP4_PROTOCOL *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv4_ADDRESS *SubnetAddress,
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
EFI_STATUS
EFIAPI
Udp4Transmit (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
Udp4Receive (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
EFIAPI
Udp4Cancel (
IN EFI_UDP4_PROTOCOL *This,
IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
);
EFI_STATUS
EFIAPI
Udp4Poll (
IN EFI_UDP4_PROTOCOL *This
);
EFI_STATUS
Udp4CreateService (
IN UDP4_SERVICE_DATA *Udp4Service,
IN EFI_HANDLE ImageHandle,
IN EFI_HANDLE ControllerHandle
);
VOID
Udp4CleanService (
IN UDP4_SERVICE_DATA *Udp4Service
);
VOID
Udp4InitInstance (
IN UDP4_SERVICE_DATA *Udp4Service,
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4CleanInstance (
IN UDP4_INSTANCE_DATA *Instance
);
EFI_STATUS
Udp4Bind (
IN NET_LIST_ENTRY *InstanceList,
IN EFI_UDP4_CONFIG_DATA *ConfigData
);
BOOLEAN
Udp4IsReconfigurable (
IN EFI_UDP4_CONFIG_DATA *OldConfigData,
IN EFI_UDP4_CONFIG_DATA *NewConfigData
);
VOID
Udp4BuildIp4ConfigData (
IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,
IN EFI_IP4_CONFIG_DATA *Ip4ConfigData
);
EFI_STATUS
Udp4ValidateTxToken (
IN UDP4_INSTANCE_DATA *Instance,
IN EFI_UDP4_COMPLETION_TOKEN *TxToken
);
EFI_STATUS
Udp4TokenExist (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Context
);
UINT16
Udp4Checksum (
IN NET_BUF *Packet,
IN UINT16 HeadSum
);
EFI_STATUS
Udp4RemoveToken (
IN NET_MAP *TokenMap,
IN EFI_UDP4_COMPLETION_TOKEN *Token
);
EFI_STATUS
Udp4LeaveGroup (
IN NET_MAP *Map,
IN NET_MAP_ITEM *Item,
IN VOID *Arg OPTIONAL
);
VOID
Udp4FlushRxData (
IN NET_LIST_ENTRY *RcvdDgramQue
);
EFI_STATUS
Udp4InstanceCancelToken (
IN UDP4_INSTANCE_DATA *Instance,
IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
);
VOID
Udp4InstanceDeliverDgram (
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4ReportIcmpError (
IN UDP4_INSTANCE_DATA *Instance
);
VOID
Udp4NetVectorExtFree (
VOID *Context
);
EFI_STATUS
Udp4SetVariableData (
IN UDP4_SERVICE_DATA *Udp4Service
);
VOID
Udp4ClearVariableData (
IN UDP4_SERVICE_DATA *Udp4Service
);
#endif