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