]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.h
MdeModulePkg: Fix typos in comments and variables
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpDriver.h
... / ...
CommitLineData
1/** @file\r
2 Declaration of strctures and functions for MnpDxe driver.\r
3\r
4Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions\r
7of the BSD License which accompanies this distribution. The full\r
8text of the license may be found at<BR>\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _MNP_DRIVER_H_\r
17#define _MNP_DRIVER_H_\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Protocol/ManagedNetwork.h>\r
22#include <Protocol/SimpleNetwork.h>\r
23#include <Protocol/ServiceBinding.h>\r
24#include <Protocol/VlanConfig.h>\r
25\r
26#include <Library/BaseLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/NetLib.h>\r
33#include <Library/DpcLib.h>\r
34#include <Library/UefiRuntimeServicesTableLib.h>\r
35#include <Library/DevicePathLib.h>\r
36#include <Library/PrintLib.h>\r
37\r
38#include "ComponentName.h"\r
39\r
40#define MNP_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'D')\r
41\r
42//\r
43// Global Variables\r
44//\r
45extern EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding;\r
46\r
47typedef struct {\r
48 UINT32 Signature;\r
49\r
50 EFI_HANDLE ControllerHandle;\r
51 EFI_HANDLE ImageHandle;\r
52\r
53 EFI_VLAN_CONFIG_PROTOCOL VlanConfig;\r
54 UINTN NumberOfVlan;\r
55 CHAR16 *MacString;\r
56 EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r
57\r
58 //\r
59 // List of MNP_SERVICE_DATA\r
60 //\r
61 LIST_ENTRY ServiceList;\r
62 //\r
63 // Number of configured MNP Service Binding child\r
64 //\r
65 UINTN ConfiguredChildrenNumber;\r
66\r
67 LIST_ENTRY GroupAddressList;\r
68 UINT32 GroupAddressCount;\r
69\r
70 LIST_ENTRY FreeTxBufList;\r
71 LIST_ENTRY AllTxBufList;\r
72 UINT32 TxBufCount;\r
73\r
74 NET_BUF_QUEUE FreeNbufQue;\r
75 INTN NbufCnt;\r
76\r
77 EFI_EVENT PollTimer;\r
78 BOOLEAN EnableSystemPoll;\r
79\r
80 EFI_EVENT TimeoutCheckTimer;\r
81 EFI_EVENT MediaDetectTimer;\r
82\r
83 UINT32 UnicastCount;\r
84 UINT32 BroadcastCount;\r
85 UINT32 MulticastCount;\r
86 UINT32 PromiscuousCount;\r
87\r
88 //\r
89 // The size of the data buffer in the MNP_PACKET_BUFFER used to\r
90 // store a packet.\r
91 //\r
92 UINT32 BufferLength;\r
93 UINT32 PaddingSize;\r
94 NET_BUF *RxNbufCache;\r
95} MNP_DEVICE_DATA;\r
96\r
97#define MNP_DEVICE_DATA_FROM_THIS(a) \\r
98 CR ( \\r
99 (a), \\r
100 MNP_DEVICE_DATA, \\r
101 VlanConfig, \\r
102 MNP_DEVICE_DATA_SIGNATURE \\r
103 )\r
104\r
105#define MNP_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'S')\r
106\r
107typedef struct {\r
108 UINT32 Signature;\r
109\r
110 LIST_ENTRY Link;\r
111\r
112 MNP_DEVICE_DATA *MnpDeviceData;\r
113 EFI_HANDLE ServiceHandle;\r
114 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
115 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
116\r
117 LIST_ENTRY ChildrenList;\r
118 UINTN ChildrenNumber;\r
119\r
120 UINT32 Mtu;\r
121\r
122 UINT16 VlanId;\r
123 UINT8 Priority;\r
124} MNP_SERVICE_DATA;\r
125\r
126\r
127#define MNP_SERVICE_DATA_FROM_THIS(a) \\r
128 CR ( \\r
129 (a), \\r
130 MNP_SERVICE_DATA, \\r
131 ServiceBinding, \\r
132 MNP_SERVICE_DATA_SIGNATURE \\r
133 )\r
134\r
135#define MNP_SERVICE_DATA_FROM_LINK(a) \\r
136 CR ( \\r
137 (a), \\r
138 MNP_SERVICE_DATA, \\r
139 Link, \\r
140 MNP_SERVICE_DATA_SIGNATURE \\r
141 )\r
142\r
143\r
144/**\r
145 Test to see if this driver supports ControllerHandle. This service\r
146 is called by the EFI boot service ConnectController(). In\r
147 order to make drivers as small as possible, there are a few calling\r
148 restrictions for this service. ConnectController() must\r
149 follow these calling restrictions. If any other agent wishes to call\r
150 Supported() it must also follow these calling restrictions.\r
151\r
152 @param[in] This Protocol instance pointer.\r
153 @param[in] ControllerHandle Handle of device to test.\r
154 @param[in] RemainingDevicePath Optional parameter use to pick a specific\r
155 child device to start.\r
156\r
157 @retval EFI_SUCCESS This driver supports this device.\r
158 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
159 @retval Others This driver does not support this device.\r
160\r
161**/\r
162EFI_STATUS\r
163EFIAPI\r
164MnpDriverBindingSupported (\r
165 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
166 IN EFI_HANDLE ControllerHandle,\r
167 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
168 );\r
169\r
170/**\r
171 Start this driver on ControllerHandle. This service is called by the\r
172 EFI boot service ConnectController(). In order to make drivers as small\r
173 as possible, there are a few calling restrictions for this service.\r
174 ConnectController() must follow these calling restrictions. If any other\r
175 agent wishes to call Start() it must also follow these calling restrictions.\r
176\r
177 @param[in] This Protocol instance pointer.\r
178 @param[in] ControllerHandle Handle of device to bind driver to.\r
179 @param[in] RemainingDevicePath Optional parameter use to pick a specific\r
180 child device to start.\r
181\r
182 @retval EFI_SUCCESS This driver is added to ControllerHandle.\r
183 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.\r
184 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Mnp Service Data.\r
185 @retval Others This driver does not support this device.\r
186\r
187**/\r
188EFI_STATUS\r
189EFIAPI\r
190MnpDriverBindingStart (\r
191 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
192 IN EFI_HANDLE ControllerHandle,\r
193 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
194 );\r
195\r
196\r
197/**\r
198 Stop this driver on ControllerHandle. This service is called by the\r
199 EFI boot service DisconnectController(). In order to make drivers as\r
200 small as possible, there are a few calling restrictions for this service.\r
201 DisconnectController() must follow these calling restrictions. If any other\r
202 agent wishes to call Stop() it must also follow these calling restrictions.\r
203\r
204 @param[in] This Protocol instance pointer.\r
205 @param[in] ControllerHandle Handle of device to stop driver on.\r
206 @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If\r
207 number of children is zero stop the entire\r
208 bus driver.\r
209 @param[in] ChildHandleBuffer List of Child Handles to Stop.\r
210\r
211 @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
212 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
213\r
214**/\r
215EFI_STATUS\r
216EFIAPI\r
217MnpDriverBindingStop (\r
218 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
219 IN EFI_HANDLE ControllerHandle,\r
220 IN UINTN NumberOfChildren,\r
221 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
222 );\r
223\r
224/**\r
225 Creates a child handle with a set of I/O services.\r
226\r
227 @param[in] This Protocol instance pointer.\r
228 @param[in, out] ChildHandle Pointer to the handle of the child to create. If\r
229 it is NULL, then a new handle is created. If\r
230 it is not NULL, then the I/O services are added\r
231 to the existing child handle.\r
232\r
233 @retval EFI_SUCCES The protocol was added to ChildHandle.\r
234 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
235 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to\r
236 create the child.\r
237 @retval Others The child handle was not created.\r
238\r
239**/\r
240EFI_STATUS\r
241EFIAPI\r
242MnpServiceBindingCreateChild (\r
243 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
244 IN OUT EFI_HANDLE *ChildHandle\r
245 );\r
246\r
247/**\r
248 Destroys a child handle with a set of I/O services.\r
249\r
250 The DestroyChild() function does the opposite of CreateChild(). It removes a\r
251 protocol that was installed by CreateChild() from ChildHandle. If the removed\r
252 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.\r
253\r
254 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL\r
255 instance.\r
256 @param[in] ChildHandle Handle of the child to destroy.\r
257\r
258 @retval EFI_SUCCES The protocol was removed from ChildHandle.\r
259 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that\r
260 is being removed.\r
261 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
262 @retval EFI_ACCESS_DENIED The protocol could not be removed from the\r
263 ChildHandle because its services are being\r
264 used.\r
265 @retval Others The child handle was not destroyed.\r
266\r
267**/\r
268EFI_STATUS\r
269EFIAPI\r
270MnpServiceBindingDestroyChild (\r
271 IN EFI_SERVICE_BINDING_PROTOCOL *This,\r
272 IN EFI_HANDLE ChildHandle\r
273 );\r
274\r
275#endif\r