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

View File

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

View File

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

View File

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

View File

@ -23,6 +23,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
ArpComponentNameGetDriverName ( ArpComponentNameGetDriverName (
@ -31,16 +70,86 @@ ArpComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
ArpComponentNameGetControllerName ( ArpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
@ -48,13 +157,62 @@ EFI_COMPONENT_NAME_PROTOCOL gArpComponentName = {
ArpComponentNameGetDriverName, ArpComponentNameGetDriverName,
ArpComponentNameGetControllerName, ArpComponentNameGetControllerName,
"eng" "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[] = { STATIC EFI_UNICODE_STRING_TABLE mArpDriverNameTable[] = {
{ "eng", L"ARP Network Service Driver" }, { "eng;en", L"ARP Network Service Driver" },
{ NULL, NULL } { 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 EFI_STATUS
EFIAPI EFIAPI
ArpComponentNameGetDriverName ( ArpComponentNameGetDriverName (
@ -62,94 +220,93 @@ ArpComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gArpComponentName.SupportedLanguages, This->SupportedLanguages,
mArpDriverNameTable, 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 EFI_STATUS
EFIAPI EFIAPI
ArpComponentNameGetControllerName ( ArpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

@ -24,6 +24,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
DhcpComponentNameGetDriverName ( DhcpComponentNameGetDriverName (
@ -32,6 +71,75 @@ DhcpComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
DhcpComponentNameGetControllerName ( DhcpComponentNameGetControllerName (
@ -42,18 +150,29 @@ DhcpComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gDhcp4ComponentName = {
DhcpComponentNameGetDriverName, DhcpComponentNameGetDriverName,
DhcpComponentNameGetControllerName, DhcpComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
{ {
"eng", "eng;en",
L"DHCP Protocol Driver" 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 EFI_STATUS
EFIAPI EFIAPI
DhcpComponentNameGetDriverName ( DhcpComponentNameGetDriverName (
@ -69,41 +227,84 @@ DhcpComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gDhcp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mDhcpDriverNameTable, mDhcpDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
DhcpComponentNameGetControllerName ( DhcpComponentNameGetControllerName (
@ -113,50 +314,6 @@ DhcpComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ConfigComponentNameGetDriverName ( Ip4ConfigComponentNameGetDriverName (
@ -32,6 +71,75 @@ Ip4ConfigComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ConfigComponentNameGetControllerName ( Ip4ConfigComponentNameGetControllerName (
@ -42,21 +150,71 @@ Ip4ConfigComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName = {
Ip4ConfigComponentNameGetDriverName, Ip4ConfigComponentNameGetDriverName,
Ip4ConfigComponentNameGetControllerName, Ip4ConfigComponentNameGetControllerName,
"eng" "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 STATIC
EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable[] = { EFI_UNICODE_STRING_TABLE mIp4ConfigDriverNameTable[] = {
{"eng", L"IP4 CONFIG Network Service Driver"}, {"eng;en", L"IP4 CONFIG Network Service Driver"},
{NULL, NULL} {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 EFI_STATUS
EFIAPI EFIAPI
Ip4ConfigComponentNameGetDriverName ( Ip4ConfigComponentNameGetDriverName (
@ -64,94 +222,93 @@ Ip4ConfigComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gIp4ConfigComponentName.SupportedLanguages, This->SupportedLanguages,
mIp4ConfigDriverNameTable, 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ConfigComponentNameGetControllerName ( Ip4ConfigComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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

View File

@ -24,6 +24,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ComponentNameGetDriverName ( Ip4ComponentNameGetDriverName (
@ -32,6 +71,75 @@ Ip4ComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ComponentNameGetControllerName ( Ip4ComponentNameGetControllerName (
@ -42,18 +150,29 @@ Ip4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
Ip4ComponentNameGetDriverName, Ip4ComponentNameGetDriverName,
Ip4ComponentNameGetControllerName, Ip4ComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
{ {
"eng", "eng;en",
L"IP4 Network Service Driver" 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ComponentNameGetDriverName ( Ip4ComponentNameGetDriverName (
@ -69,44 +227,85 @@ Ip4ComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gIp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mIp4DriverNameTable, mIp4DriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
Ip4ComponentNameGetControllerName ( Ip4ComponentNameGetControllerName (
@ -116,51 +315,6 @@ Ip4ComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
MnpComponentNameGetDriverName ( MnpComponentNameGetDriverName (
@ -32,6 +71,75 @@ MnpComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
MnpComponentNameGetControllerName ( MnpComponentNameGetControllerName (
@ -42,18 +150,29 @@ MnpComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = { EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {
MnpComponentNameGetDriverName, MnpComponentNameGetDriverName,
MnpComponentNameGetControllerName, MnpComponentNameGetControllerName,
"eng" "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[] = { STATIC EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {
{ {
"eng", "eng;en",
L"MNP Network Service Driver" 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 EFI_STATUS
EFIAPI EFIAPI
MnpComponentNameGetDriverName ( MnpComponentNameGetDriverName (
@ -69,41 +227,84 @@ MnpComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gMnpComponentName.SupportedLanguages, This->SupportedLanguages,
mMnpDriverNameTable, mMnpDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
MnpComponentNameGetControllerName ( MnpComponentNameGetControllerName (
@ -113,50 +314,6 @@ MnpComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -23,6 +23,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
Mtftp4ComponentNameGetDriverName ( Mtftp4ComponentNameGetDriverName (
@ -31,6 +70,75 @@ Mtftp4ComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
Mtftp4ComponentNameGetControllerName ( Mtftp4ComponentNameGetControllerName (
@ -41,18 +149,29 @@ Mtftp4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gMtftp4ComponentName = {
Mtftp4ComponentNameGetDriverName, Mtftp4ComponentNameGetDriverName,
Mtftp4ComponentNameGetControllerName, Mtftp4ComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mMtftp4DriverNameTable[] = {
{ {
"eng", "eng;en",
L"MTFTP4 Network Service" 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 EFI_STATUS
EFIAPI EFIAPI
Mtftp4ComponentNameGetDriverName ( Mtftp4ComponentNameGetDriverName (
@ -68,41 +226,84 @@ Mtftp4ComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gMtftp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mMtftp4DriverNameTable, mMtftp4DriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
Mtftp4ComponentNameGetControllerName ( Mtftp4ComponentNameGetControllerName (
@ -112,50 +313,6 @@ Mtftp4ComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
PxeBcComponentNameGetDriverName ( PxeBcComponentNameGetDriverName (
@ -30,6 +69,75 @@ PxeBcComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
PxeBcComponentNameGetControllerName ( PxeBcComponentNameGetControllerName (
@ -40,18 +148,29 @@ PxeBcComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = { EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
PxeBcComponentNameGetDriverName, PxeBcComponentNameGetDriverName,
PxeBcComponentNameGetControllerName, PxeBcComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
{ {
"eng", "eng;en",
L"PXE Base Code Driver" 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 EFI_STATUS
EFIAPI EFIAPI
PxeBcComponentNameGetDriverName ( PxeBcComponentNameGetDriverName (
@ -67,41 +225,84 @@ PxeBcComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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 ( return LookupUnicodeString2 (
Language, Language,
gPxeBcComponentName.SupportedLanguages, This->SupportedLanguages,
mPxeBcDriverNameTable, mPxeBcDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
PxeBcComponentNameGetControllerName ( PxeBcComponentNameGetControllerName (
@ -111,50 +312,6 @@ PxeBcComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -25,6 +25,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
PxeDhcp4ComponentNameGetDriverName ( PxeDhcp4ComponentNameGetDriverName (
@ -33,6 +72,75 @@ PxeDhcp4ComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
PxeDhcp4ComponentNameGetControllerName ( PxeDhcp4ComponentNameGetControllerName (
@ -43,20 +151,31 @@ PxeDhcp4ComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
PxeDhcp4ComponentNameGetDriverName, PxeDhcp4ComponentNameGetDriverName,
PxeDhcp4ComponentNameGetControllerName, PxeDhcp4ComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
{ {
"eng", "eng;en",
L"PXE DHCPv4 Driver" 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 EFI_STATUS
EFIAPI EFIAPI
PxeDhcp4ComponentNameGetDriverName ( PxeDhcp4ComponentNameGetDriverName (
@ -73,42 +230,84 @@ PxeDhcp4ComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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 ( return LookupUnicodeString2 (
Language, Language,
gPxeDhcp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mPxeDhcp4DriverNameTable, mPxeDhcp4DriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
PxeDhcp4ComponentNameGetControllerName ( PxeDhcp4ComponentNameGetControllerName (
@ -118,50 +317,6 @@ PxeDhcp4ComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

@ -25,6 +25,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
SimpleNetworkComponentNameGetDriverName ( SimpleNetworkComponentNameGetDriverName (
@ -33,6 +72,75 @@ SimpleNetworkComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
SimpleNetworkComponentNameGetControllerName ( SimpleNetworkComponentNameGetControllerName (
@ -43,18 +151,29 @@ SimpleNetworkComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = { EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
SimpleNetworkComponentNameGetDriverName, SimpleNetworkComponentNameGetDriverName,
SimpleNetworkComponentNameGetControllerName, SimpleNetworkComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
{ {
"eng", "eng;en",
L"Simple Network Protocol Driver" 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 EFI_STATUS
EFIAPI EFIAPI
SimpleNetworkComponentNameGetDriverName ( SimpleNetworkComponentNameGetDriverName (
@ -70,41 +228,84 @@ SimpleNetworkComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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 ( return LookupUnicodeString2 (
Language, Language,
gSimpleNetworkComponentName.SupportedLanguages, This->SupportedLanguages,
mSimpleNetworkDriverNameTable, mSimpleNetworkDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
SimpleNetworkComponentNameGetControllerName ( SimpleNetworkComponentNameGetControllerName (
@ -114,50 +315,6 @@ SimpleNetworkComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

@ -23,6 +23,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
TcpComponentNameGetDriverName ( TcpComponentNameGetDriverName (
@ -31,28 +70,108 @@ TcpComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
TcpComponentNameGetControllerName ( TcpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {
TcpComponentNameGetDriverName, TcpComponentNameGetDriverName,
TcpComponentNameGetControllerName, TcpComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
{ {
"eng", "eng;en",
L"Tcp Network Service Driver" 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 EFI_STATUS
EFIAPI EFIAPI
TcpComponentNameGetDriverName ( TcpComponentNameGetDriverName (
@ -68,102 +226,93 @@ TcpComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gTcp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mTcpDriverNameTable, mTcpDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
TcpComponentNameGetControllerName ( TcpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,45 @@ Abstract:
// //
// EFI Component Name Functions // 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 EFI_STATUS
EFIAPI EFIAPI
UdpComponentNameGetDriverName ( UdpComponentNameGetDriverName (
@ -32,28 +71,108 @@ UdpComponentNameGetDriverName (
OUT CHAR16 **DriverName 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 EFI_STATUS
EFIAPI EFIAPI
UdpComponentNameGetControllerName ( UdpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = { EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName = {
UdpComponentNameGetDriverName, UdpComponentNameGetDriverName,
UdpComponentNameGetControllerName, UdpComponentNameGetControllerName,
"eng" "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[] = { static EFI_UNICODE_STRING_TABLE mUdpDriverNameTable[] = {
{ {
"eng", "eng;en",
L"UDP Network Service Driver" 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 EFI_STATUS
EFIAPI EFIAPI
UdpComponentNameGetDriverName ( UdpComponentNameGetDriverName (
@ -69,100 +227,93 @@ UdpComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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, Language,
gUdp4ComponentName.SupportedLanguages, This->SupportedLanguages,
mUdpDriverNameTable, mUdpDriverNameTable,
DriverName 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 EFI_STATUS
EFIAPI EFIAPI
UdpComponentNameGetControllerName ( UdpComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

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

View File

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

View File

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