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