3 Copyright (c) 2005 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #ifndef _MNP_DRIVER_H_
22 #define _MNP_DRIVER_H_
25 #include <Protocol/ManagedNetwork.h>
26 #include <Protocol/SimpleNetwork.h>
27 #include <Protocol/ServiceBinding.h>
29 #include <Library/DebugLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiLib.h>
33 #include <Library/NetLib.h>
34 #include <Library/BaseLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/BaseMemoryLib.h>
39 // Required Global Variables
41 extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding
;
42 extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName
;
43 extern EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2
;
45 #define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')
47 typedef struct _MNP_SERVICE_DATA
{
50 EFI_HANDLE ControllerHandle
;
52 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
53 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
57 LIST_ENTRY ChildrenList
;
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_SERVICE_DATA_FROM_THIS(a) \
94 MNP_SERVICE_DATA_SIGNATURE \
98 Test to see if this driver supports ControllerHandle. This service
99 is called by the EFI boot service ConnectController(). In
100 order to make drivers as small as possible, there are a few calling
101 restrictions for this service. ConnectController() must
102 follow these calling restrictions. If any other agent wishes to call
103 Supported() it must also follow these calling restrictions.
105 @param This Protocol instance pointer.
106 @param ControllerHandle Handle of device to test
107 @param RemainingDevicePath Optional parameter use to pick a specific child
110 @retval EFI_SUCCESS This driver supports this device
111 @retval EFI_ALREADY_STARTED This driver is already running on this device
112 @retval other This driver does not support this device
117 MnpDriverBindingSupported (
118 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
119 IN EFI_HANDLE ControllerHandle
,
120 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
124 Start this driver on ControllerHandle. This service is called by the
125 EFI boot service ConnectController(). In order to make
126 drivers as small as possible, there are a few calling restrictions for
127 this service. ConnectController() must follow these
128 calling restrictions. If any other agent wishes to call Start() it
129 must also follow these calling restrictions.
131 @param This Protocol instance pointer.
132 @param ControllerHandle Handle of device to bind driver to.
133 @param RemainingDevicePath Optional parameter use to pick a specific child
136 @retval EFI_SUCCESS This driver is added to ControllerHandle
137 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
138 @retval other This driver does not support this device
143 MnpDriverBindingStart (
144 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
145 IN EFI_HANDLE ControllerHandle
,
146 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
151 Stop this driver on ControllerHandle. This service is called by the
152 EFI boot service DisconnectController(). In order to
153 make drivers as small as possible, there are a few calling
154 restrictions for this service. DisconnectController()
155 must follow these calling restrictions. If any other agent wishes
156 to call Stop() it must also follow these calling restrictions.
158 @param This Protocol instance pointer.
159 @param ControllerHandle Handle of device to stop driver on
160 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
161 children is zero stop the entire bus driver.
162 @param ChildHandleBuffer List of Child Handles to Stop.
164 @retval EFI_SUCCESS This driver is removed ControllerHandle
165 @retval other This driver was not removed from this device
170 MnpDriverBindingStop (
171 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
172 IN EFI_HANDLE ControllerHandle
,
173 IN UINTN NumberOfChildren
,
174 IN EFI_HANDLE
*ChildHandleBuffer
178 Creates a child handle with a set of I/O services.
180 @param This Protocol instance pointer.
181 @param ChildHandle Pointer to the handle of the child to create. If
182 it is NULL, then a new handle is created. If it is
183 not NULL, then the I/O services are added to the
184 existing child handle.
186 @retval EFI_SUCCES The child handle was created with the I/O
188 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
190 @retval other The child handle was not created.
195 MnpServiceBindingCreateChild (
196 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
197 IN EFI_HANDLE
*ChildHandle
201 Destroys a child handle with a set of I/O services.
203 @param This Protocol instance pointer.
204 @param ChildHandle Handle of the child to destroy.
206 @retval EFI_SUCCES The I/O services were removed from the child
208 @retval EFI_UNSUPPORTED The child handle does not support the I/O services
209 that are being removed.
210 @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
211 @retval EFI_ACCESS_DENIED The child handle could not be destroyed because
212 its I/O services are being used.
213 @retval other The child handle was not destroyed.
218 MnpServiceBindingDestroyChild (
219 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
220 IN EFI_HANDLE ChildHandle