2 Declaration of strctures and functions for MnpDxe driver.
4 Copyright (c) 2005 - 2007, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials are licensed
6 and made available under the terms and conditions of the BSD License which
7 accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _MNP_DRIVER_H_
16 #define _MNP_DRIVER_H_
19 #include <Protocol/ManagedNetwork.h>
20 #include <Protocol/SimpleNetwork.h>
21 #include <Protocol/ServiceBinding.h>
23 #include <Library/BaseLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/UefiLib.h>
29 #include <Library/NetLib.h>
31 #include "ComponentName.h"
33 #define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
38 EFI_HANDLE ControllerHandle
;
40 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
41 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
45 LIST_ENTRY ChildrenList
;
47 UINTN ConfiguredChildrenNumber
;
49 LIST_ENTRY GroupAddressList
;
50 UINT32 GroupAddressCount
;
52 EFI_EVENT TxTimeoutEvent
;
54 NET_BUF_QUEUE FreeNbufQue
;
58 BOOLEAN EnableSystemPoll
;
60 EFI_EVENT TimeoutCheckTimer
;
63 UINT32 BroadcastCount
;
64 UINT32 MulticastCount
;
65 UINT32 PromiscuousCount
;
68 // The size of the data buffer in the MNP_PACKET_BUFFER used to
77 #define MNP_SERVICE_DATA_FROM_THIS(a) \
82 MNP_SERVICE_DATA_SIGNATURE \
86 Test to see if this driver supports ControllerHandle. This service
87 is called by the EFI boot service ConnectController(). In
88 order to make drivers as small as possible, there are a few calling
89 restrictions for this service. ConnectController() must
90 follow these calling restrictions. If any other agent wishes to call
91 Supported() it must also follow these calling restrictions.
93 @param[in] This Protocol instance pointer.
94 @param[in] ControllerHandle Handle of device to test.
95 @param[in] RemainingDevicePath Optional parameter use to pick a specific
96 child device to start.
98 @retval EFI_SUCCESS This driver supports this device.
99 @retval EFI_ALREADY_STARTED This driver is already running on this device.
100 @retval Others This driver does not support this device.
105 MnpDriverBindingSupported (
106 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
107 IN EFI_HANDLE ControllerHandle
,
108 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
112 Start this driver on ControllerHandle. This service is called by the
113 EFI boot service ConnectController(). In order to make drivers as small
114 as possible, there are a few calling restrictions for this service.
115 ConnectController() must follow these calling restrictions. If any other
116 agent wishes to call Start() it must also follow these calling restrictions.
118 @param[in] This Protocol instance pointer.
119 @param[in] ControllerHandle Handle of device to bind driver to.
120 @param[in] RemainingDevicePath Optional parameter use to pick a specific
121 child device to start.
123 @retval EFI_SUCCESS This driver is added to ControllerHandle.
124 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
125 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Mnp Service Data.
126 @retval Others This driver does not support this device.
131 MnpDriverBindingStart (
132 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
133 IN EFI_HANDLE ControllerHandle
,
134 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
139 Stop this driver on ControllerHandle. This service is called by the
140 EFI boot service DisconnectController(). In order to make drivers as
141 small as possible, there are a few calling restrictions for this service.
142 DisconnectController() must follow these calling restrictions. If any other
143 agent wishes to call Stop() it must also follow these calling restrictions.
145 @param[in] This Protocol instance pointer.
146 @param[in] ControllerHandle Handle of device to stop driver on.
147 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If
148 number of children is zero stop the entire
150 @param[in] ChildHandleBuffer List of Child Handles to Stop.
152 @retval EFI_SUCCESS This driver is removed ControllerHandle.
153 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
158 MnpDriverBindingStop (
159 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
160 IN EFI_HANDLE ControllerHandle
,
161 IN UINTN NumberOfChildren
,
162 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
166 Creates a child handle with a set of I/O services.
168 @param[in] This Protocol instance pointer.
169 @param[in, out] ChildHandle Pointer to the handle of the child to create. If
170 it is NULL, then a new handle is created. If
171 it is not NULL, then the I/O services are added
172 to the existing child handle.
174 @retval EFI_SUCCES The protocol was added to ChildHandle.
175 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
176 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to
178 @retval Others The child handle was not created.
183 MnpServiceBindingCreateChild (
184 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
185 IN OUT EFI_HANDLE
*ChildHandle
189 Destroys a child handle with a set of I/O services.
191 The DestroyChild() function does the opposite of CreateChild(). It removes a
192 protocol that was installed by CreateChild() from ChildHandle. If the removed
193 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.
195 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL
197 @param[in] ChildHandle Handle of the child to destroy.
199 @retval EFI_SUCCES The protocol was removed from ChildHandle.
200 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that
202 @retval EFI_INVALID_PARAMETER ChildHandle is not a valid UEFI handle.
203 @retval EFI_ACCESS_DENIED The protocol could not be removed from the
204 ChildHandle because its services are being
206 @retval Others The child handle was not destroyed.
211 MnpServiceBindingDestroyChild (
212 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
213 IN EFI_HANDLE ChildHandle