2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
2009-01-08 05:47:41 +01:00
|
|
|
Declaration of strctures and functions for MnpDxe driver.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
Copyright (c) 2005 - 2007, Intel Corporation.<BR>
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef _MNP_DRIVER_H_
|
|
|
|
#define _MNP_DRIVER_H_
|
2009-01-08 05:47:41 +01:00
|
|
|
#include <Uefi.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
|
|
|
|
#include <Protocol/ManagedNetwork.h>
|
2007-09-30 05:08:02 +02:00
|
|
|
#include <Protocol/SimpleNetwork.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
#include <Protocol/ServiceBinding.h>
|
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
2007-09-30 05:08:02 +02:00
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/NetLib.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
#include <Library/BaseLib.h>
|
2007-09-30 05:08:02 +02:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
|
|
|
|
//
|
|
|
|
// Required Global Variables
|
|
|
|
//
|
|
|
|
extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;
|
|
|
|
extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;
|
|
|
|
extern EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2;
|
|
|
|
|
2008-12-16 16:34:21 +01:00
|
|
|
#define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
typedef struct _MNP_SERVICE_DATA {
|
|
|
|
UINT32 Signature;
|
|
|
|
|
|
|
|
EFI_HANDLE ControllerHandle;
|
|
|
|
|
|
|
|
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
|
|
|
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
|
|
|
|
|
|
|
UINT32 Mtu;
|
|
|
|
|
2008-02-14 10:40:22 +01:00
|
|
|
LIST_ENTRY ChildrenList;
|
2007-09-30 05:08:02 +02:00
|
|
|
UINTN ChildrenNumber;
|
|
|
|
UINTN ConfiguredChildrenNumber;
|
|
|
|
|
2008-02-14 10:40:22 +01:00
|
|
|
LIST_ENTRY GroupAddressList;
|
2007-09-30 05:08:02 +02:00
|
|
|
UINT32 GroupAddressCount;
|
|
|
|
|
|
|
|
EFI_EVENT TxTimeoutEvent;
|
|
|
|
|
|
|
|
NET_BUF_QUEUE FreeNbufQue;
|
|
|
|
INTN NbufCnt;
|
|
|
|
|
|
|
|
EFI_EVENT PollTimer;
|
|
|
|
BOOLEAN EnableSystemPoll;
|
|
|
|
|
|
|
|
EFI_EVENT TimeoutCheckTimer;
|
|
|
|
|
|
|
|
UINT32 UnicastCount;
|
|
|
|
UINT32 BroadcastCount;
|
|
|
|
UINT32 MulticastCount;
|
|
|
|
UINT32 PromiscuousCount;
|
|
|
|
|
|
|
|
//
|
|
|
|
// The size of the data buffer in the MNP_PACKET_BUFFER used to
|
|
|
|
// store a packet.
|
|
|
|
//
|
|
|
|
UINT32 BufferLength;
|
|
|
|
UINT32 PaddingSize;
|
|
|
|
NET_BUF *RxNbufCache;
|
|
|
|
UINT8 *TxBuf;
|
|
|
|
} MNP_SERVICE_DATA;
|
|
|
|
|
|
|
|
#define MNP_SERVICE_DATA_FROM_THIS(a) \
|
|
|
|
CR ( \
|
|
|
|
(a), \
|
|
|
|
MNP_SERVICE_DATA, \
|
|
|
|
ServiceBinding, \
|
|
|
|
MNP_SERVICE_DATA_SIGNATURE \
|
|
|
|
)
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
|
|
|
Test to see if this driver supports ControllerHandle. This service
|
|
|
|
is called by the EFI boot service ConnectController(). In
|
|
|
|
order to make drivers as small as possible, there are a few calling
|
|
|
|
restrictions for this service. ConnectController() must
|
|
|
|
follow these calling restrictions. If any other agent wishes to call
|
|
|
|
Supported() it must also follow these calling restrictions.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to test
|
|
|
|
@param[in] RemainingDevicePath Optional parameter use to pick a specific child
|
|
|
|
device to start.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver supports this device
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
|
|
|
@retval other This driver does not support this device
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingSupported (
|
2008-11-18 05:52:51 +01:00
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
2007-09-30 05:08:02 +02:00
|
|
|
IN EFI_HANDLE ControllerHandle,
|
2008-11-18 05:52:51 +01:00
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
|
|
|
Start this driver on ControllerHandle. This service is called by the
|
|
|
|
EFI boot service ConnectController(). In order to make
|
|
|
|
drivers as small as possible, there are a few calling restrictions for
|
|
|
|
this service. ConnectController() must follow these
|
|
|
|
calling restrictions. If any other agent wishes to call Start() it
|
|
|
|
must also follow these calling restrictions.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to bind driver to.
|
|
|
|
@param[in] RemainingDevicePath Optional parameter use to pick a specific child
|
|
|
|
device to start.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver is added to ControllerHandle
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
|
|
|
@retval other This driver does not support this device
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingStart (
|
2008-11-18 05:52:51 +01:00
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
2007-09-30 05:08:02 +02:00
|
|
|
IN EFI_HANDLE ControllerHandle,
|
2008-11-18 05:52:51 +01:00
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
Stop this driver on ControllerHandle. This service is called by the
|
|
|
|
EFI boot service DisconnectController(). In order to
|
|
|
|
make drivers as small as possible, there are a few calling
|
|
|
|
restrictions for this service. DisconnectController()
|
|
|
|
must follow these calling restrictions. If any other agent wishes
|
|
|
|
to call Stop() it must also follow these calling restrictions.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to stop driver on
|
|
|
|
@param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
|
|
|
children is zero stop the entire bus driver.
|
|
|
|
@param[in] ChildHandleBuffer List of Child Handles to Stop.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver is removed ControllerHandle
|
|
|
|
@retval other This driver was not removed from this device
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingStop (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN UINTN NumberOfChildren,
|
|
|
|
IN EFI_HANDLE *ChildHandleBuffer
|
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
2009-01-16 01:09:52 +01:00
|
|
|
Creates a child handle and installs a protocol.
|
|
|
|
|
|
|
|
The CreateChild() function installs a protocol on ChildHandle.
|
|
|
|
If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
|
|
|
|
If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
|
|
|
|
@param ChildHandle Pointer to the handle of the child to create. If it is NULL,
|
|
|
|
then a new handle is created. If it is a pointer to an existing UEFI handle,
|
|
|
|
then the protocol is added to the existing UEFI handle.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@retval EFI_SUCCES The protocol was added to ChildHandle.
|
|
|
|
@retval EFI_INVALID_PARAMETER ChildHandle is NULL.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
|
|
|
|
the child
|
|
|
|
@retval other The child handle was not created
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpServiceBindingCreateChild (
|
|
|
|
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
2009-01-08 05:47:41 +01:00
|
|
|
IN OUT EFI_HANDLE *ChildHandle
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
2009-01-16 01:09:52 +01:00
|
|
|
Destroys a child handle with a protocol installed on it.
|
|
|
|
|
|
|
|
The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
|
|
|
|
that was installed by CreateChild() from ChildHandle. If the removed protocol is the
|
|
|
|
last protocol on ChildHandle, then ChildHandle is destroyed.
|
|
|
|
|
|
|
|
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
|
|
|
|
@param ChildHandle Handle of the child to destroy
|
|
|
|
|
|
|
|
@retval EFI_SUCCES The protocol was removed from ChildHandle.
|
|
|
|
@retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
|
|
|
|
@retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.
|
|
|
|
@retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
|
|
|
|
because its services are being used.
|
|
|
|
@retval other The child handle was not destroyed
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpServiceBindingDestroyChild (
|
|
|
|
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ChildHandle
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|