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