2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
2009-02-03 08:56:54 +01:00
|
|
|
Declaration of strctures and functions for MnpDxe driver.
|
2009-12-30 14:47:55 +01:00
|
|
|
|
2010-02-03 05:37:53 +01:00
|
|
|
Copyright (c) 2005 - 2010, Intel Corporation.<BR>
|
2009-12-30 14:47:55 +01:00
|
|
|
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<BR>
|
|
|
|
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-12-30 14:47:55 +01:00
|
|
|
|
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>
|
2009-12-30 14:47:55 +01:00
|
|
|
#include <Protocol/VlanConfig.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
|
2009-05-20 22:05:06 +02:00
|
|
|
#include <Library/BaseLib.h>
|
2009-05-21 01:15:47 +02:00
|
|
|
#include <Library/BaseMemoryLib.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
#include <Library/DebugLib.h>
|
2009-05-21 01:15:47 +02:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
2007-07-24 10:06:37 +02:00
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
2007-09-30 05:08:02 +02:00
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/NetLib.h>
|
2009-07-12 00:51:51 +02:00
|
|
|
#include <Library/DpcLib.h>
|
2009-12-30 14:47:55 +01:00
|
|
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
|
|
|
#include <Library/DevicePathLib.h>
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
#include "ComponentName.h"
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
#define MNP_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'D')
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
typedef struct {
|
2007-09-30 05:08:02 +02:00
|
|
|
UINT32 Signature;
|
|
|
|
|
|
|
|
EFI_HANDLE ControllerHandle;
|
2009-12-30 14:47:55 +01:00
|
|
|
EFI_HANDLE ImageHandle;
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
EFI_VLAN_CONFIG_PROTOCOL VlanConfig;
|
|
|
|
UINTN NumberOfVlan;
|
|
|
|
CHAR16 *MacString;
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
//
|
|
|
|
// List of MNP_SERVICE_DATA
|
|
|
|
//
|
|
|
|
LIST_ENTRY ServiceList;
|
|
|
|
//
|
|
|
|
// Number of configured MNP Service Binding child
|
|
|
|
//
|
2007-09-30 05:08:02 +02:00
|
|
|
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;
|
2010-02-03 05:37:53 +01:00
|
|
|
EFI_EVENT MediaDetectTimer;
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
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;
|
2009-12-30 14:47:55 +01:00
|
|
|
} MNP_DEVICE_DATA;
|
|
|
|
|
|
|
|
#define MNP_DEVICE_DATA_FROM_THIS(a) \
|
|
|
|
CR ( \
|
|
|
|
(a), \
|
|
|
|
MNP_DEVICE_DATA, \
|
|
|
|
VlanConfig, \
|
|
|
|
MNP_DEVICE_DATA_SIGNATURE \
|
|
|
|
)
|
|
|
|
|
|
|
|
#define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINT32 Signature;
|
|
|
|
|
|
|
|
LIST_ENTRY Link;
|
|
|
|
|
|
|
|
MNP_DEVICE_DATA *MnpDeviceData;
|
|
|
|
EFI_HANDLE ServiceHandle;
|
|
|
|
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
|
|
|
|
LIST_ENTRY ChildrenList;
|
|
|
|
UINTN ChildrenNumber;
|
|
|
|
|
|
|
|
UINT32 Mtu;
|
|
|
|
|
|
|
|
UINT16 VlanId;
|
|
|
|
UINT8 Priority;
|
2007-09-30 05:08:02 +02:00
|
|
|
} MNP_SERVICE_DATA;
|
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
|
2007-09-30 05:08:02 +02:00
|
|
|
#define MNP_SERVICE_DATA_FROM_THIS(a) \
|
|
|
|
CR ( \
|
|
|
|
(a), \
|
|
|
|
MNP_SERVICE_DATA, \
|
|
|
|
ServiceBinding, \
|
|
|
|
MNP_SERVICE_DATA_SIGNATURE \
|
|
|
|
)
|
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
#define MNP_SERVICE_DATA_FROM_LINK(a) \
|
|
|
|
CR ( \
|
|
|
|
(a), \
|
|
|
|
MNP_SERVICE_DATA, \
|
|
|
|
Link, \
|
|
|
|
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-02-03 08:56:54 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to test.
|
2009-12-30 14:47:55 +01:00
|
|
|
@param[in] RemainingDevicePath Optional parameter use to pick a specific
|
2009-02-03 08:56:54 +01:00
|
|
|
child device to start.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
@retval EFI_SUCCESS This driver supports this device.
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on this device.
|
|
|
|
@retval Others This driver does not support this device.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingSupported (
|
2009-12-30 14:47:55 +01:00
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
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
|
2009-12-30 14:47:55 +01:00
|
|
|
EFI boot service ConnectController(). In order to make drivers as small
|
2009-02-03 08:56:54 +01:00
|
|
|
as possible, there are a few calling restrictions for this service.
|
|
|
|
ConnectController() must follow these calling restrictions. If any other
|
|
|
|
agent wishes to call Start() it must also follow these calling restrictions.
|
|
|
|
|
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to bind driver to.
|
2009-12-30 14:47:55 +01:00
|
|
|
@param[in] RemainingDevicePath Optional parameter use to pick a specific
|
2009-02-03 08:56:54 +01:00
|
|
|
child device to start.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver is added to ControllerHandle.
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Mnp Service Data.
|
|
|
|
@retval Others This driver does not support this device.
|
2009-12-30 14:47:55 +01:00
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingStart (
|
2009-12-30 14:47:55 +01:00
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
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
|
2009-12-30 14:47:55 +01:00
|
|
|
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
|
2009-02-03 08:56:54 +01:00
|
|
|
agent wishes to call Stop() it must also follow these calling restrictions.
|
2009-12-30 14:47:55 +01:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in] ControllerHandle Handle of device to stop driver on.
|
2009-12-30 14:47:55 +01:00
|
|
|
@param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If
|
|
|
|
number of children is zero stop the entire
|
|
|
|
bus driver.
|
2009-02-03 08:56:54 +01:00
|
|
|
@param[in] ChildHandleBuffer List of Child Handles to Stop.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
@retval EFI_SUCCESS This driver is removed ControllerHandle.
|
|
|
|
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
MnpDriverBindingStop (
|
2009-12-30 14:47:55 +01:00
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN UINTN NumberOfChildren,
|
|
|
|
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
2009-02-03 08:56:54 +01:00
|
|
|
Creates a child handle with a set of I/O services.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-02-03 08:56:54 +01:00
|
|
|
@param[in] This Protocol instance pointer.
|
|
|
|
@param[in, out] ChildHandle Pointer to the handle of the child to create. If
|
|
|
|
it is NULL, then a new handle is created. If
|
2009-12-30 14:47:55 +01:00
|
|
|
it is not NULL, then the I/O services are added
|
|
|
|
to the existing child handle.
|
2008-11-18 05:52:51 +01:00
|
|
|
|
2009-12-30 14:47:55 +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
|
2009-02-03 08:56:54 +01:00
|
|
|
create the child.
|
|
|
|
@retval Others 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 (
|
2009-12-30 14:47:55 +01:00
|
|
|
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
|
|
|
IN OUT EFI_HANDLE *ChildHandle
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 05:52:51 +01:00
|
|
|
/**
|
2009-02-03 08:56:54 +01:00
|
|
|
Destroys a child handle with a set of I/O services.
|
2009-12-30 14:47:55 +01:00
|
|
|
|
|
|
|
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[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL
|
2009-02-03 08:56:54 +01:00
|
|
|
instance.
|
|
|
|
@param[in] ChildHandle Handle of the child to destroy.
|
|
|
|
|
2009-12-30 14:47:55 +01:00
|
|
|
@retval EFI_SUCCES The protocol was removed from ChildHandle.
|
2009-02-03 08:56:54 +01:00
|
|
|
@retval EFI_UNSUPPORTED ChildHandle does not support the protocol that
|
|
|
|
is being removed.
|
|
|
|
@retval EFI_INVALID_PARAMETER ChildHandle 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 Others 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 (
|
2009-12-30 14:47:55 +01:00
|
|
|
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ChildHandle
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|