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