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