]>
Commit | Line | Data |
---|---|---|
8a67d61d | 1 | /** @file\r |
c57273b0 | 2 | Implementation of driver entry point and driver binding protocol.\r |
8a67d61d | 3 | \r |
3e8c18da | 4 | Copyright (c) 2005 - 2008, Intel Corporation.<BR>\r |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
8a67d61d | 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 | |
8a67d61d | 13 | **/\r |
14 | \r | |
15 | #include "MnpDriver.h"\r | |
8a67d61d | 16 | #include "MnpImpl.h"\r |
17 | \r | |
18 | \r | |
19 | EFI_DRIVER_BINDING_PROTOCOL gMnpDriverBinding = {\r | |
20 | MnpDriverBindingSupported,\r | |
21 | MnpDriverBindingStart,\r | |
22 | MnpDriverBindingStop,\r | |
23 | 0xa,\r | |
24 | NULL,\r | |
25 | NULL\r | |
26 | };\r | |
27 | \r | |
8a67d61d | 28 | /**\r |
b6c4ecad | 29 | Test to see if this driver supports ControllerHandle. This service\r |
30 | is called by the EFI boot service ConnectController(). In\r | |
31 | order to make drivers as small as possible, there are a few calling\r | |
32 | restrictions for this service. ConnectController() must\r | |
33 | follow these calling restrictions. If any other agent wishes to call\r | |
34 | Supported() it must also follow these calling restrictions.\r | |
35 | \r | |
3e8c18da | 36 | @param[in] This Protocol instance pointer.\r |
37 | @param[in] ControllerHandle Handle of device to test\r | |
38 | @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r | |
39 | device to start.\r | |
b6c4ecad | 40 | \r |
41 | @retval EFI_SUCCESS This driver supports this device\r | |
42 | @retval EFI_ALREADY_STARTED This driver is already running on this device\r | |
43 | @retval other This driver does not support this device\r | |
8a67d61d | 44 | \r |
45 | **/\r | |
46 | EFI_STATUS\r | |
47 | EFIAPI\r | |
48 | MnpDriverBindingSupported (\r | |
49 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
50 | IN EFI_HANDLE ControllerHandle,\r | |
51 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
52 | )\r | |
53 | {\r | |
b58baf6b | 54 | EFI_STATUS Status;\r |
55 | EFI_SIMPLE_NETWORK_PROTOCOL *Snp;\r | |
8a67d61d | 56 | \r |
57 | //\r | |
58 | // Test to see if MNP is already installed.\r | |
59 | //\r | |
60 | Status = gBS->OpenProtocol (\r | |
61 | ControllerHandle,\r | |
62 | &gEfiManagedNetworkServiceBindingProtocolGuid,\r | |
63 | NULL,\r | |
64 | This->DriverBindingHandle,\r | |
65 | ControllerHandle,\r | |
66 | EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r | |
67 | );\r | |
68 | if (!EFI_ERROR (Status)) {\r | |
8a67d61d | 69 | return EFI_ALREADY_STARTED;\r |
70 | }\r | |
71 | \r | |
72 | //\r | |
b58baf6b | 73 | // Test to open the Simple Network protocol BY_DRIVER.\r |
8a67d61d | 74 | //\r |
75 | Status = gBS->OpenProtocol (\r | |
76 | ControllerHandle,\r | |
77 | &gEfiSimpleNetworkProtocolGuid,\r | |
b58baf6b | 78 | (VOID **) &Snp,\r |
8a67d61d | 79 | This->DriverBindingHandle,\r |
80 | ControllerHandle,\r | |
b58baf6b | 81 | EFI_OPEN_PROTOCOL_BY_DRIVER\r |
8a67d61d | 82 | );\r |
83 | \r | |
b58baf6b | 84 | if (EFI_ERROR (Status)) {\r |
85 | return Status;\r | |
86 | }\r | |
87 | \r | |
88 | //\r | |
89 | // Close the openned SNP protocol.\r | |
90 | //\r | |
91 | gBS->CloseProtocol (\r | |
92 | ControllerHandle,\r | |
93 | &gEfiSimpleNetworkProtocolGuid,\r | |
94 | This->DriverBindingHandle,\r | |
95 | ControllerHandle\r | |
96 | );\r | |
97 | \r | |
98 | return EFI_SUCCESS;\r | |
8a67d61d | 99 | }\r |
100 | \r | |
101 | \r | |
102 | /**\r | |
b6c4ecad | 103 | Start this driver on ControllerHandle. This service is called by the\r |
104 | EFI boot service ConnectController(). In order to make\r | |
105 | drivers as small as possible, there are a few calling restrictions for\r | |
106 | this service. ConnectController() must follow these\r | |
107 | calling restrictions. If any other agent wishes to call Start() it\r | |
108 | must also follow these calling restrictions.\r | |
109 | \r | |
3e8c18da | 110 | @param[in] This Protocol instance pointer.\r |
111 | @param[in] ControllerHandle Handle of device to bind driver to.\r | |
112 | @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r | |
113 | device to start.\r | |
b6c4ecad | 114 | \r |
115 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
116 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
117 | @retval other This driver does not support this device\r | |
8a67d61d | 118 | \r |
119 | **/\r | |
120 | EFI_STATUS\r | |
121 | EFIAPI\r | |
122 | MnpDriverBindingStart (\r | |
123 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
124 | IN EFI_HANDLE ControllerHandle,\r | |
125 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
126 | )\r | |
127 | {\r | |
128 | EFI_STATUS Status;\r | |
129 | MNP_SERVICE_DATA *MnpServiceData;\r | |
130 | BOOLEAN MnpInitialized;\r | |
131 | \r | |
132 | MnpInitialized = FALSE;\r | |
133 | \r | |
e48e37fc | 134 | MnpServiceData = AllocateZeroPool (sizeof (MNP_SERVICE_DATA));\r |
8a67d61d | 135 | if (MnpServiceData == NULL) {\r |
e48e37fc | 136 | DEBUG ((EFI_D_ERROR, "MnpDriverBindingStart(): Failed to allocate the Mnp Service Data.\n"));\r |
8a67d61d | 137 | \r |
138 | return EFI_OUT_OF_RESOURCES;\r | |
139 | }\r | |
140 | \r | |
141 | //\r | |
142 | // Initialize the Mnp Service Data.\r | |
143 | //\r | |
144 | Status = MnpInitializeServiceData (MnpServiceData, This->DriverBindingHandle, ControllerHandle);\r | |
145 | if (EFI_ERROR (Status)) {\r | |
146 | \r | |
e48e37fc | 147 | DEBUG ((EFI_D_ERROR, "MnpDriverBindingStart: MnpInitializeServiceData failed, %r.\n",Status));\r |
8a67d61d | 148 | goto ErrorExit;\r |
149 | }\r | |
150 | \r | |
151 | MnpInitialized = TRUE;\r | |
152 | \r | |
153 | //\r | |
154 | // Install the MNP Service Binding Protocol.\r | |
155 | //\r | |
156 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
157 | &ControllerHandle,\r | |
158 | &gEfiManagedNetworkServiceBindingProtocolGuid,\r | |
159 | &MnpServiceData->ServiceBinding,\r | |
160 | NULL\r | |
161 | );\r | |
162 | \r | |
163 | ErrorExit:\r | |
164 | \r | |
165 | if (EFI_ERROR (Status)) {\r | |
166 | \r | |
167 | if (MnpInitialized) {\r | |
168 | //\r | |
169 | // Flush the Mnp Service Data.\r | |
170 | //\r | |
3ec64ac5 | 171 | MnpFlushServiceData (MnpServiceData, This->DriverBindingHandle);\r |
8a67d61d | 172 | }\r |
173 | \r | |
e48e37fc | 174 | gBS->FreePool (MnpServiceData);\r |
8a67d61d | 175 | }\r |
176 | \r | |
177 | return Status;\r | |
178 | }\r | |
179 | \r | |
8a67d61d | 180 | /**\r |
b6c4ecad | 181 | Stop this driver on ControllerHandle. This service is called by the\r |
182 | EFI boot service DisconnectController(). In order to\r | |
183 | make drivers as small as possible, there are a few calling\r | |
184 | restrictions for this service. DisconnectController()\r | |
185 | must follow these calling restrictions. If any other agent wishes\r | |
186 | to call Stop() it must also follow these calling restrictions.\r | |
187 | \r | |
3e8c18da | 188 | @param[in] This Protocol instance pointer.\r |
189 | @param[in] ControllerHandle Handle of device to stop driver on\r | |
190 | @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
191 | children is zero stop the entire bus driver.\r | |
192 | @param[in] ChildHandleBuffer List of Child Handles to Stop.\r | |
b6c4ecad | 193 | \r |
194 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
195 | @retval other This driver was not removed from this device\r | |
8a67d61d | 196 | \r |
197 | **/\r | |
198 | EFI_STATUS\r | |
199 | EFIAPI\r | |
200 | MnpDriverBindingStop (\r | |
201 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
202 | IN EFI_HANDLE ControllerHandle,\r | |
203 | IN UINTN NumberOfChildren,\r | |
204 | IN EFI_HANDLE *ChildHandleBuffer\r | |
205 | )\r | |
206 | {\r | |
207 | EFI_STATUS Status;\r | |
208 | EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r | |
209 | MNP_SERVICE_DATA *MnpServiceData;\r | |
210 | MNP_INSTANCE_DATA *Instance;\r | |
211 | \r | |
212 | //\r | |
213 | // Retrieve the MNP service binding protocol from the ControllerHandle.\r | |
214 | //\r | |
215 | Status = gBS->OpenProtocol (\r | |
216 | ControllerHandle,\r | |
217 | &gEfiManagedNetworkServiceBindingProtocolGuid,\r | |
218 | (VOID **) &ServiceBinding,\r | |
219 | This->DriverBindingHandle,\r | |
220 | ControllerHandle,\r | |
221 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
222 | );\r | |
223 | if (EFI_ERROR (Status)) {\r | |
224 | \r | |
e48e37fc | 225 | DEBUG (\r |
226 | (EFI_D_ERROR,\r | |
227 | "MnpDriverBindingStop: Locate MNP Service Binding Protocol failed, %r.\n",\r | |
8a67d61d | 228 | Status)\r |
229 | );\r | |
c4a62a12 | 230 | return EFI_DEVICE_ERROR;\r |
8a67d61d | 231 | }\r |
232 | \r | |
233 | MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (ServiceBinding);\r | |
234 | \r | |
c4a62a12 | 235 | if (NumberOfChildren == 0) {\r |
8a67d61d | 236 | //\r |
c4a62a12 | 237 | // Uninstall the MNP Service Binding Protocol.\r |
8a67d61d | 238 | //\r |
c4a62a12 | 239 | gBS->UninstallMultipleProtocolInterfaces (\r |
240 | ControllerHandle,\r | |
241 | &gEfiManagedNetworkServiceBindingProtocolGuid,\r | |
242 | ServiceBinding,\r | |
243 | NULL\r | |
244 | );\r | |
8a67d61d | 245 | \r |
c4a62a12 | 246 | //\r |
247 | // Flush the Mnp service data.\r | |
248 | //\r | |
3ec64ac5 | 249 | MnpFlushServiceData (MnpServiceData, This->DriverBindingHandle);\r |
8a67d61d | 250 | \r |
e48e37fc | 251 | gBS->FreePool (MnpServiceData);\r |
c4a62a12 | 252 | } else {\r |
e48e37fc | 253 | while (!IsListEmpty (&MnpServiceData->ChildrenList)) {\r |
c4a62a12 | 254 | //\r |
255 | // Don't use NetListRemoveHead here, the remove opreration will be done\r | |
256 | // in ServiceBindingDestroyChild.\r | |
257 | //\r | |
258 | Instance = NET_LIST_HEAD (\r | |
259 | &MnpServiceData->ChildrenList,\r | |
260 | MNP_INSTANCE_DATA,\r | |
261 | InstEntry\r | |
262 | );\r | |
8a67d61d | 263 | \r |
c4a62a12 | 264 | ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);\r |
265 | }\r | |
8a67d61d | 266 | }\r |
267 | \r | |
8a67d61d | 268 | return Status;\r |
269 | }\r | |
270 | \r | |
271 | \r | |
272 | /**\r | |
3e8c18da | 273 | Creates a child handle and installs a protocol.\r |
274 | \r | |
275 | The CreateChild() function installs a protocol on ChildHandle. \r | |
276 | If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r | |
277 | If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r | |
8a67d61d | 278 | \r |
3e8c18da | 279 | @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r |
280 | @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r | |
281 | then a new handle is created. If it is a pointer to an existing UEFI handle, \r | |
282 | then the protocol is added to the existing UEFI handle.\r | |
8a67d61d | 283 | \r |
3e8c18da | 284 | @retval EFI_SUCCES The protocol was added to ChildHandle.\r |
285 | @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r | |
286 | @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create\r | |
287 | the child\r | |
288 | @retval other The child handle was not created\r | |
8a67d61d | 289 | \r |
290 | **/\r | |
291 | EFI_STATUS\r | |
292 | EFIAPI\r | |
293 | MnpServiceBindingCreateChild (\r | |
294 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
c57273b0 | 295 | IN OUT EFI_HANDLE *ChildHandle\r |
8a67d61d | 296 | )\r |
297 | {\r | |
298 | EFI_STATUS Status;\r | |
299 | MNP_SERVICE_DATA *MnpServiceData;\r | |
300 | MNP_INSTANCE_DATA *Instance;\r | |
301 | VOID *Snp;\r | |
302 | EFI_TPL OldTpl;\r | |
303 | \r | |
304 | if ((This == NULL) || (ChildHandle == NULL)) {\r | |
305 | \r | |
306 | return EFI_INVALID_PARAMETER;\r | |
307 | }\r | |
308 | \r | |
309 | MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (This);\r | |
310 | \r | |
311 | //\r | |
312 | // Allocate buffer for the new instance.\r | |
313 | //\r | |
e48e37fc | 314 | Instance = AllocateZeroPool (sizeof (MNP_INSTANCE_DATA));\r |
8a67d61d | 315 | if (Instance == NULL) {\r |
316 | \r | |
e48e37fc | 317 | DEBUG ((EFI_D_ERROR, "MnpServiceBindingCreateChild: Faild to allocate memory for the new instance.\n"));\r |
8a67d61d | 318 | return EFI_OUT_OF_RESOURCES;\r |
319 | }\r | |
320 | \r | |
321 | //\r | |
322 | // Init the instance data.\r | |
323 | //\r | |
324 | MnpInitializeInstanceData (MnpServiceData, Instance);\r | |
325 | \r | |
326 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
327 | ChildHandle,\r | |
328 | &gEfiManagedNetworkProtocolGuid,\r | |
329 | &Instance->ManagedNetwork,\r | |
330 | NULL\r | |
331 | );\r | |
332 | if (EFI_ERROR (Status)) {\r | |
333 | \r | |
e48e37fc | 334 | DEBUG (\r |
335 | (EFI_D_ERROR,\r | |
336 | "MnpServiceBindingCreateChild: Failed to install the MNP protocol, %r.\n",\r | |
8a67d61d | 337 | Status)\r |
338 | );\r | |
339 | goto ErrorExit;\r | |
340 | }\r | |
341 | \r | |
342 | //\r | |
343 | // Save the instance's childhandle.\r | |
344 | //\r | |
345 | Instance->Handle = *ChildHandle;\r | |
346 | \r | |
347 | Status = gBS->OpenProtocol (\r | |
348 | MnpServiceData->ControllerHandle,\r | |
349 | &gEfiSimpleNetworkProtocolGuid,\r | |
350 | (VOID **) &Snp,\r | |
351 | gMnpDriverBinding.DriverBindingHandle,\r | |
352 | Instance->Handle,\r | |
353 | EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r | |
354 | );\r | |
355 | if (EFI_ERROR (Status)) {\r | |
356 | goto ErrorExit;\r | |
357 | }\r | |
358 | \r | |
359 | //\r | |
360 | // Add the child instance into ChildrenList.\r | |
361 | //\r | |
e48e37fc | 362 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r |
8a67d61d | 363 | \r |
e48e37fc | 364 | InsertTailList (&MnpServiceData->ChildrenList, &Instance->InstEntry);\r |
8a67d61d | 365 | MnpServiceData->ChildrenNumber++;\r |
366 | \r | |
e48e37fc | 367 | gBS->RestoreTPL (OldTpl);\r |
8a67d61d | 368 | \r |
369 | ErrorExit:\r | |
370 | \r | |
371 | if (EFI_ERROR (Status)) {\r | |
372 | \r | |
373 | if (Instance->Handle != NULL) {\r | |
374 | \r | |
375 | gBS->UninstallMultipleProtocolInterfaces (\r | |
376 | &gEfiManagedNetworkProtocolGuid,\r | |
377 | &Instance->ManagedNetwork,\r | |
378 | NULL\r | |
379 | );\r | |
380 | }\r | |
381 | \r | |
e48e37fc | 382 | gBS->FreePool (Instance);\r |
8a67d61d | 383 | }\r |
384 | \r | |
385 | return Status;\r | |
386 | }\r | |
387 | \r | |
388 | \r | |
389 | /**\r | |
3e8c18da | 390 | Destroys a child handle with a protocol installed on it.\r |
391 | \r | |
392 | The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r | |
393 | that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r | |
394 | last protocol on ChildHandle, then ChildHandle is destroyed.\r | |
395 | \r | |
396 | @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r | |
397 | @param ChildHandle Handle of the child to destroy\r | |
398 | \r | |
399 | @retval EFI_SUCCES The protocol was removed from ChildHandle.\r | |
400 | @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r | |
401 | @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r | |
402 | @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r | |
403 | because its services are being used.\r | |
404 | @retval other The child handle was not destroyed\r | |
8a67d61d | 405 | \r |
406 | **/\r | |
407 | EFI_STATUS\r | |
408 | EFIAPI\r | |
409 | MnpServiceBindingDestroyChild (\r | |
410 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
411 | IN EFI_HANDLE ChildHandle\r | |
412 | )\r | |
413 | {\r | |
414 | EFI_STATUS Status;\r | |
415 | MNP_SERVICE_DATA *MnpServiceData;\r | |
416 | EFI_MANAGED_NETWORK_PROTOCOL *ManagedNetwork;\r | |
417 | MNP_INSTANCE_DATA *Instance;\r | |
418 | EFI_TPL OldTpl;\r | |
419 | \r | |
420 | if ((This == NULL) || (ChildHandle == NULL)) {\r | |
421 | \r | |
422 | return EFI_INVALID_PARAMETER;\r | |
423 | }\r | |
424 | \r | |
425 | MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (This);\r | |
426 | \r | |
427 | //\r | |
428 | // Try to retrieve ManagedNetwork Protocol from ChildHandle.\r | |
429 | //\r | |
430 | Status = gBS->OpenProtocol (\r | |
431 | ChildHandle,\r | |
432 | &gEfiManagedNetworkProtocolGuid,\r | |
433 | (VOID **) &ManagedNetwork,\r | |
434 | gMnpDriverBinding.DriverBindingHandle,\r | |
435 | ChildHandle,\r | |
436 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
437 | );\r | |
438 | if (EFI_ERROR (Status)) {\r | |
439 | \r | |
440 | return EFI_UNSUPPORTED;\r | |
441 | }\r | |
442 | \r | |
443 | Instance = MNP_INSTANCE_DATA_FROM_THIS (ManagedNetwork);\r | |
444 | \r | |
445 | //\r | |
446 | // MnpServiceBindingDestroyChild may be called twice: first called by\r | |
447 | // MnpServiceBindingStop, second called by uninstalling the MNP protocol\r | |
448 | // in this ChildHandle. Use destroyed to make sure the resource clean code\r | |
449 | // will only excecute once.\r | |
450 | //\r | |
451 | if (Instance->Destroyed) {\r | |
452 | \r | |
453 | return EFI_SUCCESS;\r | |
454 | }\r | |
455 | \r | |
456 | Instance->Destroyed = TRUE;\r | |
457 | \r | |
458 | //\r | |
459 | // Close the Simple Network protocol.\r | |
460 | //\r | |
461 | gBS->CloseProtocol (\r | |
462 | MnpServiceData->ControllerHandle,\r | |
463 | &gEfiSimpleNetworkProtocolGuid,\r | |
464 | gMnpDriverBinding.DriverBindingHandle,\r | |
465 | ChildHandle\r | |
466 | );\r | |
467 | \r | |
468 | //\r | |
469 | // Uninstall the ManagedNetwork protocol.\r | |
470 | //\r | |
471 | Status = gBS->UninstallMultipleProtocolInterfaces (\r | |
472 | ChildHandle,\r | |
473 | &gEfiManagedNetworkProtocolGuid,\r | |
474 | &Instance->ManagedNetwork,\r | |
475 | NULL\r | |
476 | );\r | |
477 | if (EFI_ERROR (Status)) {\r | |
478 | \r | |
e48e37fc | 479 | DEBUG (\r |
480 | (EFI_D_ERROR,\r | |
481 | "MnpServiceBindingDestroyChild: Failed to uninstall the ManagedNetwork protocol, %r.\n",\r | |
8a67d61d | 482 | Status)\r |
483 | );\r | |
484 | \r | |
485 | Instance->Destroyed = FALSE;\r | |
486 | return Status;\r | |
487 | }\r | |
488 | \r | |
e48e37fc | 489 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r |
8a67d61d | 490 | \r |
491 | //\r | |
492 | // Reset the configuration.\r | |
493 | //\r | |
494 | ManagedNetwork->Configure (ManagedNetwork, NULL);\r | |
495 | \r | |
496 | //\r | |
497 | // Try to flush the RcvdPacketQueue.\r | |
498 | //\r | |
499 | MnpFlushRcvdDataQueue (Instance);\r | |
500 | \r | |
501 | //\r | |
502 | // Clean the RxTokenMap.\r | |
503 | //\r | |
504 | NetMapClean (&Instance->RxTokenMap);\r | |
505 | \r | |
506 | //\r | |
507 | // Remove this instance from the ChildrenList.\r | |
508 | //\r | |
e48e37fc | 509 | RemoveEntryList (&Instance->InstEntry);\r |
8a67d61d | 510 | MnpServiceData->ChildrenNumber--;\r |
511 | \r | |
e48e37fc | 512 | gBS->RestoreTPL (OldTpl);\r |
8a67d61d | 513 | \r |
e48e37fc | 514 | gBS->FreePool (Instance);\r |
8a67d61d | 515 | \r |
516 | return Status;\r | |
517 | }\r | |
518 | \r | |
b6c4ecad | 519 | /**\r |
520 | The entry point for Mnp driver which installs the driver binding and component\r | |
521 | name protocol on its ImageHandle.\r | |
522 | \r | |
3e8c18da | 523 | @param[in] ImageHandle The image handle of the driver.\r |
524 | @param[in] SystemTable The system table.\r | |
b6c4ecad | 525 | \r |
c57273b0 | 526 | @retval EFI_SUCCES The driver binding and component name protocols are \r |
b6c4ecad | 527 | successfully installed.\r |
528 | @retval other failed.\r | |
8a67d61d | 529 | \r |
b6c4ecad | 530 | **/\r |
8a67d61d | 531 | EFI_STATUS\r |
532 | EFIAPI\r | |
533 | MnpDriverEntryPoint (\r | |
534 | IN EFI_HANDLE ImageHandle,\r | |
535 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
536 | )\r | |
8a67d61d | 537 | {\r |
83cbd279 | 538 | return EfiLibInstallDriverBindingComponentName2 (\r |
da1d0201 | 539 | ImageHandle,\r |
540 | SystemTable,\r | |
541 | &gMnpDriverBinding,\r | |
542 | ImageHandle,\r | |
543 | &gMnpComponentName,\r | |
83cbd279 | 544 | &gMnpComponentName2\r |
da1d0201 | 545 | );\r |
8a67d61d | 546 | }\r |