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