2 Declaration of strctures and functions for MnpDxe driver.
4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
5 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>
36 #include <Library/PrintLib.h>
38 #include "ComponentName.h"
40 #define MNP_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'D')
45 extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding
;
50 EFI_HANDLE ControllerHandle
;
51 EFI_HANDLE ImageHandle
;
53 EFI_VLAN_CONFIG_PROTOCOL VlanConfig
;
56 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
59 // List of MNP_SERVICE_DATA
61 LIST_ENTRY ServiceList
;
63 // Number of configured MNP Service Binding child
65 UINTN ConfiguredChildrenNumber
;
67 LIST_ENTRY GroupAddressList
;
68 UINT32 GroupAddressCount
;
70 EFI_EVENT TxTimeoutEvent
;
72 NET_BUF_QUEUE FreeNbufQue
;
76 BOOLEAN EnableSystemPoll
;
78 EFI_EVENT TimeoutCheckTimer
;
79 EFI_EVENT MediaDetectTimer
;
82 UINT32 BroadcastCount
;
83 UINT32 MulticastCount
;
84 UINT32 PromiscuousCount
;
87 // The size of the data buffer in the MNP_PACKET_BUFFER used to
96 #define MNP_DEVICE_DATA_FROM_THIS(a) \
101 MNP_DEVICE_DATA_SIGNATURE \
104 #define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
111 MNP_DEVICE_DATA
*MnpDeviceData
;
112 EFI_HANDLE ServiceHandle
;
113 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
114 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
116 LIST_ENTRY ChildrenList
;
117 UINTN ChildrenNumber
;
126 #define MNP_SERVICE_DATA_FROM_THIS(a) \
131 MNP_SERVICE_DATA_SIGNATURE \
134 #define MNP_SERVICE_DATA_FROM_LINK(a) \
139 MNP_SERVICE_DATA_SIGNATURE \
144 Test to see if this driver supports ControllerHandle. This service
145 is called by the EFI boot service ConnectController(). In
146 order to make drivers as small as possible, there are a few calling
147 restrictions for this service. ConnectController() must
148 follow these calling restrictions. If any other agent wishes to call
149 Supported() it must also follow these calling restrictions.
151 @param[in] This Protocol instance pointer.
152 @param[in] ControllerHandle Handle of device to test.
153 @param[in] RemainingDevicePath Optional parameter use to pick a specific
154 child device to start.
156 @retval EFI_SUCCESS This driver supports this device.
157 @retval EFI_ALREADY_STARTED This driver is already running on this device.
158 @retval Others This driver does not support this device.
163 MnpDriverBindingSupported (
164 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
165 IN EFI_HANDLE ControllerHandle
,
166 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
170 Start this driver on ControllerHandle. This service is called by the
171 EFI boot service ConnectController(). In order to make drivers as small
172 as possible, there are a few calling restrictions for this service.
173 ConnectController() must follow these calling restrictions. If any other
174 agent wishes to call Start() it must also follow these calling restrictions.
176 @param[in] This Protocol instance pointer.
177 @param[in] ControllerHandle Handle of device to bind driver to.
178 @param[in] RemainingDevicePath Optional parameter use to pick a specific
179 child device to start.
181 @retval EFI_SUCCESS This driver is added to ControllerHandle.
182 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
183 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Mnp Service Data.
184 @retval Others This driver does not support this device.
189 MnpDriverBindingStart (
190 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
191 IN EFI_HANDLE ControllerHandle
,
192 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
197 Stop this driver on ControllerHandle. This service is called by the
198 EFI boot service DisconnectController(). In order to make drivers as
199 small as possible, there are a few calling restrictions for this service.
200 DisconnectController() must follow these calling restrictions. If any other
201 agent wishes to call Stop() it must also follow these calling restrictions.
203 @param[in] This Protocol instance pointer.
204 @param[in] ControllerHandle Handle of device to stop driver on.
205 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If
206 number of children is zero stop the entire
208 @param[in] ChildHandleBuffer List of Child Handles to Stop.
210 @retval EFI_SUCCESS This driver is removed ControllerHandle.
211 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
216 MnpDriverBindingStop (
217 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
218 IN EFI_HANDLE ControllerHandle
,
219 IN UINTN NumberOfChildren
,
220 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
224 Creates a child handle with a set of I/O services.
226 @param[in] This Protocol instance pointer.
227 @param[in, out] ChildHandle Pointer to the handle of the child to create. If
228 it is NULL, then a new handle is created. If
229 it is not NULL, then the I/O services are added
230 to the existing child handle.
232 @retval EFI_SUCCES The protocol was added to ChildHandle.
233 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
234 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to
236 @retval Others The child handle was not created.
241 MnpServiceBindingCreateChild (
242 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
243 IN OUT EFI_HANDLE
*ChildHandle
247 Destroys a child handle with a set of I/O services.
249 The DestroyChild() function does the opposite of CreateChild(). It removes a
250 protocol that was installed by CreateChild() from ChildHandle. If the removed
251 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.
253 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL
255 @param[in] ChildHandle Handle of the child to destroy.
257 @retval EFI_SUCCES The protocol was removed from ChildHandle.
258 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that
260 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
261 @retval EFI_ACCESS_DENIED The protocol could not be removed from the
262 ChildHandle because its services are being
264 @retval Others The child handle was not destroyed.
269 MnpServiceBindingDestroyChild (
270 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
271 IN EFI_HANDLE ChildHandle