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