2 Declaration of strctures and functions for MnpDxe driver.
4 Copyright (c) 2005 - 2009, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions
7 of the BSD License which accompanies this distribution. The full
8 text of the license may be found at<BR>
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _MNP_DRIVER_H_
17 #define _MNP_DRIVER_H_
21 #include <Protocol/ManagedNetwork.h>
22 #include <Protocol/SimpleNetwork.h>
23 #include <Protocol/ServiceBinding.h>
24 #include <Protocol/VlanConfig.h>
26 #include <Library/BaseLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/UefiLib.h>
32 #include <Library/NetLib.h>
33 #include <Library/DpcLib.h>
34 #include <Library/UefiRuntimeServicesTableLib.h>
35 #include <Library/DevicePathLib.h>
37 #include "ComponentName.h"
39 #define MNP_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'D')
44 EFI_HANDLE ControllerHandle
;
45 EFI_HANDLE ImageHandle
;
47 EFI_VLAN_CONFIG_PROTOCOL VlanConfig
;
50 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
53 // List of MNP_SERVICE_DATA
55 LIST_ENTRY ServiceList
;
57 // Number of configured MNP Service Binding child
59 UINTN ConfiguredChildrenNumber
;
61 LIST_ENTRY GroupAddressList
;
62 UINT32 GroupAddressCount
;
64 EFI_EVENT TxTimeoutEvent
;
66 NET_BUF_QUEUE FreeNbufQue
;
70 BOOLEAN EnableSystemPoll
;
72 EFI_EVENT TimeoutCheckTimer
;
75 UINT32 BroadcastCount
;
76 UINT32 MulticastCount
;
77 UINT32 PromiscuousCount
;
80 // The size of the data buffer in the MNP_PACKET_BUFFER used to
89 #define MNP_DEVICE_DATA_FROM_THIS(a) \
94 MNP_DEVICE_DATA_SIGNATURE \
97 #define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
104 MNP_DEVICE_DATA
*MnpDeviceData
;
105 EFI_HANDLE ServiceHandle
;
106 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
107 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
109 LIST_ENTRY ChildrenList
;
110 UINTN ChildrenNumber
;
119 #define MNP_SERVICE_DATA_FROM_THIS(a) \
124 MNP_SERVICE_DATA_SIGNATURE \
127 #define MNP_SERVICE_DATA_FROM_LINK(a) \
132 MNP_SERVICE_DATA_SIGNATURE \
137 Test to see if this driver supports ControllerHandle. This service
138 is called by the EFI boot service ConnectController(). In
139 order to make drivers as small as possible, there are a few calling
140 restrictions for this service. ConnectController() must
141 follow these calling restrictions. If any other agent wishes to call
142 Supported() it must also follow these calling restrictions.
144 @param[in] This Protocol instance pointer.
145 @param[in] ControllerHandle Handle of device to test.
146 @param[in] RemainingDevicePath Optional parameter use to pick a specific
147 child device to start.
149 @retval EFI_SUCCESS This driver supports this device.
150 @retval EFI_ALREADY_STARTED This driver is already running on this device.
151 @retval Others This driver does not support this device.
156 MnpDriverBindingSupported (
157 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
158 IN EFI_HANDLE ControllerHandle
,
159 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
163 Start this driver on ControllerHandle. This service is called by the
164 EFI boot service ConnectController(). In order to make drivers as small
165 as possible, there are a few calling restrictions for this service.
166 ConnectController() must follow these calling restrictions. If any other
167 agent wishes to call Start() it must also follow these calling restrictions.
169 @param[in] This Protocol instance pointer.
170 @param[in] ControllerHandle Handle of device to bind driver to.
171 @param[in] RemainingDevicePath Optional parameter use to pick a specific
172 child device to start.
174 @retval EFI_SUCCESS This driver is added to ControllerHandle.
175 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
176 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Mnp Service Data.
177 @retval Others This driver does not support this device.
182 MnpDriverBindingStart (
183 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
184 IN EFI_HANDLE ControllerHandle
,
185 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
190 Stop this driver on ControllerHandle. This service is called by the
191 EFI boot service DisconnectController(). In order to make drivers as
192 small as possible, there are a few calling restrictions for this service.
193 DisconnectController() must follow these calling restrictions. If any other
194 agent wishes to call Stop() it must also follow these calling restrictions.
196 @param[in] This Protocol instance pointer.
197 @param[in] ControllerHandle Handle of device to stop driver on.
198 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If
199 number of children is zero stop the entire
201 @param[in] ChildHandleBuffer List of Child Handles to Stop.
203 @retval EFI_SUCCESS This driver is removed ControllerHandle.
204 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
209 MnpDriverBindingStop (
210 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
211 IN EFI_HANDLE ControllerHandle
,
212 IN UINTN NumberOfChildren
,
213 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
217 Creates a child handle with a set of I/O services.
219 @param[in] This Protocol instance pointer.
220 @param[in, out] ChildHandle Pointer to the handle of the child to create. If
221 it is NULL, then a new handle is created. If
222 it is not NULL, then the I/O services are added
223 to the existing child handle.
225 @retval EFI_SUCCES The protocol was added to ChildHandle.
226 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
227 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to
229 @retval Others The child handle was not created.
234 MnpServiceBindingCreateChild (
235 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
236 IN OUT EFI_HANDLE
*ChildHandle
240 Destroys a child handle with a set of I/O services.
242 The DestroyChild() function does the opposite of CreateChild(). It removes a
243 protocol that was installed by CreateChild() from ChildHandle. If the removed
244 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.
246 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL
248 @param[in] ChildHandle Handle of the child to destroy.
250 @retval EFI_SUCCES The protocol was removed from ChildHandle.
251 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that
253 @retval EFI_INVALID_PARAMETER ChildHandle is not a valid UEFI handle.
254 @retval EFI_ACCESS_DENIED The protocol could not be removed from the
255 ChildHandle because its services are being
257 @retval Others The child handle was not destroyed.
262 MnpServiceBindingDestroyChild (
263 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
264 IN EFI_HANDLE ChildHandle