]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h
remove some internal functions and allocate some FIFO data structure instead of decla...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpDriver.h
CommitLineData
83cbd279 1/** @file\r
c57273b0 2 Declaration of strctures and functions for MnpDxe driver.\r
3 \r
3e8c18da 4Copyright (c) 2005 - 2007, Intel Corporation.<BR>\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
83cbd279 9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
83cbd279 13**/\r
14\r
15#ifndef _MNP_DRIVER_H_\r
16#define _MNP_DRIVER_H_\r
c57273b0 17#include <Uefi.h>\r
8a67d61d 18\r
19#include <Protocol/ManagedNetwork.h>\r
83cbd279 20#include <Protocol/SimpleNetwork.h>\r
8a67d61d 21#include <Protocol/ServiceBinding.h>\r
22\r
23#include <Library/DebugLib.h>\r
24#include <Library/UefiDriverEntryPoint.h>\r
25#include <Library/UefiBootServicesTableLib.h>\r
83cbd279 26#include <Library/UefiLib.h>\r
27#include <Library/NetLib.h>\r
8a67d61d 28#include <Library/BaseLib.h>\r
83cbd279 29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31\r
83cbd279 32//\r
33// Required Global Variables\r
34//\r
35extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;\r
36extern EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName;\r
37extern EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2;\r
38\r
f3f2e05d 39#define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')\r
83cbd279 40\r
41typedef struct _MNP_SERVICE_DATA {\r
42 UINT32 Signature;\r
43\r
44 EFI_HANDLE ControllerHandle;\r
45\r
46 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
47 EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r
48\r
49 UINT32 Mtu;\r
50\r
e48e37fc 51 LIST_ENTRY ChildrenList;\r
83cbd279 52 UINTN ChildrenNumber;\r
53 UINTN ConfiguredChildrenNumber;\r
54\r
e48e37fc 55 LIST_ENTRY GroupAddressList;\r
83cbd279 56 UINT32 GroupAddressCount;\r
57\r
58 EFI_EVENT TxTimeoutEvent;\r
59\r
60 NET_BUF_QUEUE FreeNbufQue;\r
61 INTN NbufCnt;\r
62\r
63 EFI_EVENT PollTimer;\r
64 BOOLEAN EnableSystemPoll;\r
65\r
66 EFI_EVENT TimeoutCheckTimer;\r
67\r
68 UINT32 UnicastCount;\r
69 UINT32 BroadcastCount;\r
70 UINT32 MulticastCount;\r
71 UINT32 PromiscuousCount;\r
72\r
73 //\r
74 // The size of the data buffer in the MNP_PACKET_BUFFER used to\r
75 // store a packet.\r
76 //\r
77 UINT32 BufferLength;\r
78 UINT32 PaddingSize;\r
79 NET_BUF *RxNbufCache;\r
80 UINT8 *TxBuf;\r
81} MNP_SERVICE_DATA;\r
82\r
83#define MNP_SERVICE_DATA_FROM_THIS(a) \\r
84 CR ( \\r
85 (a), \\r
86 MNP_SERVICE_DATA, \\r
87 ServiceBinding, \\r
88 MNP_SERVICE_DATA_SIGNATURE \\r
89 )\r
90\r
b6c4ecad 91/**\r
92 Test to see if this driver supports ControllerHandle. This service\r
93 is called by the EFI boot service ConnectController(). In\r
94 order to make drivers as small as possible, there are a few calling\r
95 restrictions for this service. ConnectController() must\r
96 follow these calling restrictions. If any other agent wishes to call\r
97 Supported() it must also follow these calling restrictions.\r
98\r
3e8c18da 99 @param[in] This Protocol instance pointer.\r
100 @param[in] ControllerHandle Handle of device to test\r
101 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
102 device to start.\r
b6c4ecad 103\r
104 @retval EFI_SUCCESS This driver supports this device\r
105 @retval EFI_ALREADY_STARTED This driver is already running on this device\r
106 @retval other This driver does not support this device\r
107\r
108**/\r
83cbd279 109EFI_STATUS\r
110EFIAPI\r
111MnpDriverBindingSupported (\r
b6c4ecad 112 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
83cbd279 113 IN EFI_HANDLE ControllerHandle,\r
b6c4ecad 114 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
83cbd279 115 );\r
116\r
b6c4ecad 117/**\r
118 Start this driver on ControllerHandle. This service is called by the\r
119 EFI boot service ConnectController(). In order to make\r
120 drivers as small as possible, there are a few calling restrictions for\r
121 this service. ConnectController() must follow these\r
122 calling restrictions. If any other agent wishes to call Start() it\r
123 must also follow these calling restrictions.\r
124\r
3e8c18da 125 @param[in] This Protocol instance pointer.\r
126 @param[in] ControllerHandle Handle of device to bind driver to.\r
127 @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r
128 device to start.\r
b6c4ecad 129\r
130 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
131 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
132 @retval other This driver does not support this device\r
133\r
134**/\r
83cbd279 135EFI_STATUS\r
136EFIAPI\r
137MnpDriverBindingStart (\r
b6c4ecad 138 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
83cbd279 139 IN EFI_HANDLE ControllerHandle,\r
b6c4ecad 140 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
83cbd279 141 );\r
142\r
b6c4ecad 143\r
144/**\r
145 Stop this driver on ControllerHandle. This service is called by the\r
146 EFI boot service DisconnectController(). In order to\r
147 make drivers as small as possible, there are a few calling\r
148 restrictions for this service. DisconnectController()\r
149 must follow these calling restrictions. If any other agent wishes\r
150 to call Stop() it must also follow these calling restrictions.\r
151 \r
3e8c18da 152 @param[in] This Protocol instance pointer.\r
153 @param[in] ControllerHandle Handle of device to stop driver on\r
154 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
155 children is zero stop the entire bus driver.\r
156 @param[in] ChildHandleBuffer List of Child Handles to Stop.\r
b6c4ecad 157\r
158 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
159 @retval other This driver was not removed from this device\r
160\r
161**/\r
83cbd279 162EFI_STATUS\r
163EFIAPI\r
164MnpDriverBindingStop (\r
165 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
166 IN EFI_HANDLE ControllerHandle,\r
167 IN UINTN NumberOfChildren,\r
168 IN EFI_HANDLE *ChildHandleBuffer\r
169 );\r
170\r
b6c4ecad 171/**\r
3e8c18da 172 Creates a child handle and installs a protocol.\r
173 \r
174 The CreateChild() function installs a protocol on ChildHandle. \r
175 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r
176 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
b6c4ecad 177\r
3e8c18da 178 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
179 @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
180 then a new handle is created. If it is a pointer to an existing UEFI handle, \r
181 then the protocol is added to the existing UEFI handle.\r
b6c4ecad 182\r
3e8c18da 183 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
184 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
185 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create\r
186 the child\r
187 @retval other The child handle was not created\r
b6c4ecad 188\r
189**/\r
83cbd279 190EFI_STATUS\r
191EFIAPI\r
192MnpServiceBindingCreateChild (\r
193 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
c57273b0 194 IN OUT EFI_HANDLE *ChildHandle\r
83cbd279 195 );\r
196\r
b6c4ecad 197/**\r
3e8c18da 198 Destroys a child handle with a protocol installed on it.\r
199 \r
200 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r
201 that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r
202 last protocol on ChildHandle, then ChildHandle is destroyed.\r
203\r
204 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
205 @param ChildHandle Handle of the child to destroy\r
206\r
207 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
208 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r
209 @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
210 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r
211 because its services are being used.\r
212 @retval other The child handle was not destroyed\r
b6c4ecad 213\r
214**/\r
83cbd279 215EFI_STATUS\r
216EFIAPI\r
217MnpServiceBindingDestroyChild (\r
218 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
219 IN EFI_HANDLE ChildHandle\r
220 );\r
221\r
222#endif\r