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