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