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