]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c
BaseTools: Add python3-distutils Ubuntu package checking
[mirror_edk2.git] / NetworkPkg / WifiConnectionManagerDxe / WifiConnectionMgrDriver.c
CommitLineData
90b24889
WF
1/** @file\r
2 The driver binding protocol for the WiFi Connection Manager.\r
3\r
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "WifiConnectionMgrDxe.h"\r
17\r
18///\r
19/// Driver Binding Protocol instance\r
20///\r
21EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding = {\r
22 WifiMgrDxeDriverBindingSupported,\r
23 WifiMgrDxeDriverBindingStart,\r
24 WifiMgrDxeDriverBindingStop,\r
25 WIFI_MGR_DXE_VERSION,\r
26 NULL,\r
27 NULL\r
28};\r
29\r
30//\r
31//The private global data for WiFi Connection Manager\r
32//\r
33WIFI_MGR_PRIVATE_DATA *mPrivate = NULL;\r
34\r
35//\r
36//The private guid to identify WiFi Connection Manager\r
37//\r
38EFI_GUID mEfiWifiMgrPrivateGuid = EFI_WIFIMGR_PRIVATE_GUID;\r
39\r
40//\r
41//The Hii config guids\r
42//\r
43EFI_GUID gWifiConfigFormSetGuid = WIFI_CONNECTION_MANAGER_CONFIG_GUID;\r
44EFI_GUID mWifiConfigNetworkListRefreshGuid = WIFI_CONFIG_NETWORK_LIST_REFRESH_GUID;\r
45EFI_GUID mWifiConfigConnectFormRefreshGuid = WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID;\r
46EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;\r
47\r
48/**\r
49 Tests to see if this driver supports a given controller. If a child device is provided,\r
50 it further tests to see if this driver supports creating a handle for the specified child device.\r
51\r
52 This function checks to see if the driver specified by This supports the device specified by\r
53 ControllerHandle. Drivers will typically use the device path attached to\r
54 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
55 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
56 may be called many times during platform initialization. In order to reduce boot times, the tests\r
57 performed by this function must be very small, and take as little time as possible to execute. This\r
58 function must not change the state of any hardware devices, and this function must be aware that the\r
59 device specified by ControllerHandle may already be managed by the same driver or a\r
60 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
61 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
62 Because ControllerHandle may have been previously started by the same driver, if a protocol is\r
63 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
64 to guarantee the state of ControllerHandle is not modified by this function.\r
65\r
66 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
67 @param[in] ControllerHandle The handle of the controller to test. This handle\r
68 must support a protocol interface that supplies\r
69 an I/O abstraction to the driver.\r
70 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
71 parameter is ignored by device drivers, and is optional for bus\r
72 drivers. For bus drivers, if this parameter is not NULL, then\r
73 the bus driver must determine if the bus controller specified\r
74 by ControllerHandle and the child controller specified\r
75 by RemainingDevicePath are both supported by this\r
76 bus driver.\r
77\r
78 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
79 RemainingDevicePath is supported by the driver specified by This.\r
80 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
81 RemainingDevicePath is already being managed by the driver\r
82 specified by This.\r
83 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
84 RemainingDevicePath is already being managed by a different\r
85 driver or an application that requires exclusive access.\r
86 Currently not implemented.\r
87 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
88 RemainingDevicePath is not supported by the driver specified by This.\r
89\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93WifiMgrDxeDriverBindingSupported (\r
94 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
95 IN EFI_HANDLE ControllerHandle,\r
96 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
97 )\r
98{\r
99 EFI_STATUS Status;\r
100\r
101 Status = gBS->OpenProtocol (\r
102 ControllerHandle,\r
103 &mEfiWifiMgrPrivateGuid,\r
104 NULL,\r
105 This->DriverBindingHandle,\r
106 ControllerHandle,\r
107 EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
108 );\r
109 if (!EFI_ERROR (Status)) {\r
110 return EFI_ALREADY_STARTED;\r
111 }\r
112\r
113 //\r
114 // Test for the wireless MAC connection 2 protocol\r
115 //\r
116 return gBS->OpenProtocol (\r
117 ControllerHandle,\r
118 &gEfiWiFi2ProtocolGuid,\r
119 NULL,\r
120 This->DriverBindingHandle,\r
121 ControllerHandle,\r
122 EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
123 );\r
124}\r
125\r
126/**\r
127 Starts a device controller or a bus controller.\r
128\r
129 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
130 As a result, much of the error checking on the parameters to Start() has been moved into this\r
131 common boot service. It is legal to call Start() from other locations,\r
132 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
133 1. ControllerHandle must be a valid EFI_HANDLE.\r
134 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
135 EFI_DEVICE_PATH_PROTOCOL.\r
136 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
137 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
138\r
139 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
140 @param[in] ControllerHandle The handle of the controller to start. This handle\r
141 must support a protocol interface that supplies\r
142 an I/O abstraction to the driver.\r
143 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
144 parameter is ignored by device drivers, and is optional for bus\r
145 drivers. For a bus driver, if this parameter is NULL, then handles\r
146 for all the children of Controller are created by this driver.\r
147 If this parameter is not NULL and the first Device Path Node is\r
148 not the End of Device Path Node, then only the handle for the\r
149 child device specified by the first Device Path Node of\r
150 RemainingDevicePath is created by this driver.\r
151 If the first Device Path Node of RemainingDevicePath is\r
152 the End of Device Path Node, no child handle is created by this\r
153 driver.\r
154\r
155 @retval EFI_SUCCESS The device was started.\r
156 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
157 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
158 @retval Others The driver failded to start the device.\r
159\r
160**/\r
161EFI_STATUS\r
162EFIAPI\r
163WifiMgrDxeDriverBindingStart (\r
164 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
165 IN EFI_HANDLE ControllerHandle,\r
166 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
167 )\r
168{\r
169 EFI_STATUS Status;\r
170 EFI_TPL OldTpl;\r
171 UINTN AddressSize;\r
172 WIFI_MGR_DEVICE_DATA *Nic;\r
173 EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp;\r
174 EFI_SUPPLICANT_PROTOCOL *Supplicant;\r
175 EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;\r
176\r
177 Nic = NULL;\r
178\r
179 //\r
180 //Open Protocols\r
181 //\r
182 Status = gBS->OpenProtocol (\r
183 ControllerHandle,\r
184 &gEfiWiFi2ProtocolGuid,\r
185 (VOID**) &Wmp,\r
186 This->DriverBindingHandle,\r
187 ControllerHandle,\r
188 EFI_OPEN_PROTOCOL_BY_DRIVER\r
189 );\r
190 if (EFI_ERROR (Status)) {\r
191 return Status;\r
192 }\r
193\r
194 Status = gBS->OpenProtocol (\r
195 ControllerHandle,\r
196 &gEfiSupplicantProtocolGuid,\r
197 (VOID**) &Supplicant,\r
198 This->DriverBindingHandle,\r
199 ControllerHandle,\r
200 EFI_OPEN_PROTOCOL_BY_DRIVER\r
201 );\r
202 if (EFI_ERROR (Status)) {\r
203 Supplicant = NULL;\r
204 }\r
205\r
206 Status = gBS->OpenProtocol (\r
207 ControllerHandle,\r
208 &gEfiEapConfigurationProtocolGuid,\r
209 (VOID**) &EapConfig,\r
210 This->DriverBindingHandle,\r
211 ControllerHandle,\r
212 EFI_OPEN_PROTOCOL_BY_DRIVER\r
213 );\r
214 if (EFI_ERROR (Status)) {\r
215 EapConfig = NULL;\r
216 }\r
217\r
218 //\r
219 //Initialize Nic device data\r
220 //\r
221 Nic = AllocateZeroPool (sizeof (WIFI_MGR_DEVICE_DATA));\r
222 if (Nic == NULL) {\r
223 Status = EFI_OUT_OF_RESOURCES;\r
224 goto ERROR1;\r
225 }\r
226 Nic->Signature = WIFI_MGR_DEVICE_DATA_SIGNATURE;\r
227 Nic->DriverHandle = This->DriverBindingHandle;\r
228 Nic->ControllerHandle = ControllerHandle;\r
229 Nic->Private = mPrivate;\r
230 Nic->Wmp = Wmp;\r
231 Nic->Supplicant = Supplicant;\r
232 Nic->EapConfig = EapConfig;\r
233 Nic->UserSelectedProfile = NULL;\r
234 Nic->OneTimeScanRequest = FALSE;\r
235 Nic->ScanTickTime = WIFI_SCAN_FREQUENCY; //Initialize the first scan\r
236\r
237 if (Nic->Supplicant != NULL) {\r
238 WifiMgrGetSupportedSuites(Nic);\r
239 }\r
240\r
241 InitializeListHead (&Nic->ProfileList);\r
242\r
243 //\r
244 // Record the MAC address of the incoming NIC.\r
245 //\r
246 Status = NetLibGetMacAddress (\r
247 ControllerHandle,\r
248 (EFI_MAC_ADDRESS*) &Nic->MacAddress,\r
249 &AddressSize\r
250 );\r
251 if (EFI_ERROR (Status)) {\r
252 goto ERROR2;\r
253 }\r
254\r
255 //\r
256 // Create and start the timer for the status check\r
257 //\r
258 Status = gBS->CreateEvent (\r
259 EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
260 TPL_CALLBACK,\r
261 WifiMgrOnTimerTick,\r
262 Nic,\r
263 &Nic->TickTimer\r
264 );\r
265 if (EFI_ERROR (Status)) {\r
266 goto ERROR2;\r
267 }\r
268\r
269 Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS(500));\r
270 if (EFI_ERROR (Status)) {\r
271 goto ERROR3;\r
272 }\r
273\r
274 Nic->ConnectState = WifiMgrDisconnected;\r
275 Nic->ScanState = WifiMgrScanFinished;\r
276\r
277 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
278 InsertTailList (&mPrivate->NicList, &Nic->Link);\r
279 Nic->NicIndex = mPrivate->NicCount ++;\r
280 if (mPrivate->CurrentNic == NULL) {\r
281 mPrivate->CurrentNic = Nic;\r
282 }\r
283 gBS->RestoreTPL (OldTpl);\r
284\r
285 Status = gBS->InstallProtocolInterface (\r
286 &ControllerHandle,\r
287 &mEfiWifiMgrPrivateGuid,\r
288 EFI_NATIVE_INTERFACE,\r
289 &Nic->WifiMgrIdentifier\r
290 );\r
291 if (EFI_ERROR (Status)) {\r
292 goto ERROR4;\r
293 }\r
294\r
295 return EFI_SUCCESS;\r
296\r
297ERROR4:\r
298\r
299 gBS->SetTimer (Nic->TickTimer, TimerCancel, 0);\r
300 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
301 RemoveEntryList (&Nic->Link);\r
302 mPrivate->NicCount--;\r
303 gBS->RestoreTPL (OldTpl);\r
304\r
305ERROR3:\r
306\r
307 gBS->CloseEvent (Nic->TickTimer);\r
308\r
309ERROR2:\r
310\r
311 if (Nic->Supplicant != NULL) {\r
312 if (Nic->SupportedSuites.SupportedAKMSuites != NULL) {\r
313 FreePool (Nic->SupportedSuites.SupportedAKMSuites);\r
314 }\r
315 if (Nic->SupportedSuites.SupportedSwCipherSuites != NULL) {\r
316 FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);\r
317 }\r
318 if (Nic->SupportedSuites.SupportedHwCipherSuites != NULL) {\r
319 FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);\r
320 }\r
321 }\r
322 FreePool (Nic);\r
323\r
324ERROR1:\r
325\r
326 if (Supplicant != NULL) {\r
327 gBS->CloseProtocol (\r
328 ControllerHandle,\r
329 &gEfiSupplicantProtocolGuid,\r
330 This->DriverBindingHandle,\r
331 ControllerHandle\r
332 );\r
333 }\r
334\r
335 if (EapConfig != NULL) {\r
336 gBS->CloseProtocol (\r
337 ControllerHandle,\r
338 &gEfiEapConfigurationProtocolGuid,\r
339 This->DriverBindingHandle,\r
340 ControllerHandle\r
341 );\r
342 }\r
343\r
344 gBS->CloseProtocol (\r
345 ControllerHandle,\r
346 &gEfiWiFi2ProtocolGuid,\r
347 This->DriverBindingHandle,\r
348 ControllerHandle\r
349 );\r
350\r
351 return Status;\r
352}\r
353\r
354/**\r
355 Stops a device controller or a bus controller.\r
356\r
357 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
358 As a result, much of the error checking on the parameters to Stop() has been moved\r
359 into this common boot service. It is legal to call Stop() from other locations,\r
360 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
361 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
362 same driver's Start() function.\r
363 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
364 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
365 Start() function, and the Start() function must have called OpenProtocol() on\r
366 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
367\r
368 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
369 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
370 support a bus specific I/O protocol for the driver\r
371 to use to stop the device.\r
372 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
373 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
374 if NumberOfChildren is 0.\r
375\r
376 @retval EFI_SUCCESS The device was stopped.\r
377 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
378\r
379**/\r
380EFI_STATUS\r
381EFIAPI\r
382WifiMgrDxeDriverBindingStop (\r
383 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
384 IN EFI_HANDLE ControllerHandle,\r
385 IN UINTN NumberOfChildren,\r
386 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
387 )\r
388{\r
389 EFI_STATUS Status;\r
390 EFI_TPL OldTpl;\r
391 WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier;\r
392 WIFI_MGR_DEVICE_DATA *Nic;\r
393\r
394 Status = gBS->OpenProtocol (\r
395 ControllerHandle,\r
396 &mEfiWifiMgrPrivateGuid,\r
397 (VOID **) &WifiMgrIdentifier,\r
398 This->DriverBindingHandle,\r
399 ControllerHandle,\r
400 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
401 );\r
402 if (EFI_ERROR (Status)) {\r
403 return EFI_DEVICE_ERROR;\r
404 }\r
405\r
406 Nic = WIFI_MGR_DEVICE_DATA_FROM_IDENTIFIER (WifiMgrIdentifier);\r
407 if (Nic == NULL) {\r
408 return EFI_DEVICE_ERROR;\r
409 }\r
410\r
411 //\r
412 // Close Event\r
413 //\r
414 gBS->CloseEvent (Nic->TickTimer);\r
415\r
416 //\r
417 // Clean Supported Suites\r
418 //\r
419 if (Nic->Supplicant != NULL) {\r
420 if (Nic->SupportedSuites.SupportedAKMSuites != NULL) {\r
421 FreePool (Nic->SupportedSuites.SupportedAKMSuites);\r
422 }\r
423 if (Nic->SupportedSuites.SupportedSwCipherSuites != NULL) {\r
424 FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);\r
425 }\r
426 if (Nic->SupportedSuites.SupportedHwCipherSuites != NULL) {\r
427 FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);\r
428 }\r
429 }\r
430\r
431 //\r
432 // Close Protocols\r
433 //\r
434 Status = gBS->UninstallProtocolInterface (\r
435 ControllerHandle,\r
436 &mEfiWifiMgrPrivateGuid,\r
437 &Nic->WifiMgrIdentifier\r
438 );\r
439 if (EFI_ERROR (Status)) {\r
440 return Status;\r
441 }\r
442\r
443 Status = gBS->CloseProtocol (\r
444 ControllerHandle,\r
445 &gEfiWiFi2ProtocolGuid,\r
446 Nic->DriverHandle,\r
447 Nic->ControllerHandle\r
448 );\r
449 if (EFI_ERROR (Status)) {\r
450 return Status;\r
451 }\r
452\r
453 if (Nic->Supplicant != NULL) {\r
454 Status = gBS->CloseProtocol (\r
455 ControllerHandle,\r
456 &gEfiSupplicantProtocolGuid,\r
457 Nic->DriverHandle,\r
458 Nic->ControllerHandle\r
459 );\r
460 if (EFI_ERROR (Status)) {\r
461 return Status;\r
462 }\r
463 }\r
464\r
465 if (Nic->EapConfig != NULL) {\r
466 Status = gBS->CloseProtocol (\r
467 ControllerHandle,\r
468 &gEfiEapConfigurationProtocolGuid,\r
469 Nic->DriverHandle,\r
470 Nic->ControllerHandle\r
471 );\r
472 if (EFI_ERROR (Status)) {\r
473 return Status;\r
474 }\r
475 }\r
476\r
477 //\r
478 // Remove this Nic from Nic list\r
479 //\r
480 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
481\r
482 RemoveEntryList (&Nic->Link);\r
483 mPrivate->NicCount--;\r
484 if (mPrivate->CurrentNic == Nic) {\r
485 mPrivate->CurrentNic = NULL;\r
486 }\r
487\r
488 gBS->RestoreTPL (OldTpl);\r
489\r
490 WifiMgrFreeProfileList (&Nic->ProfileList);\r
491 FreePool (Nic);\r
492\r
493 DEBUG ((DEBUG_INFO, "[WiFi Connection Manager] Device Controller has been Disconnected!\n"));\r
494 return EFI_SUCCESS;\r
495}\r
496\r
497/**\r
498 This is the declaration of an EFI image entry point. This entry point is\r
499 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
500 both device drivers and bus drivers.\r
501\r
502 @param ImageHandle The firmware allocated handle for the UEFI image.\r
503 @param SystemTable A pointer to the EFI System Table.\r
504\r
505 @retval EFI_SUCCESS The operation completed successfully.\r
506 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
507 @retval Others An unexpected error occurred.\r
508\r
509**/\r
510EFI_STATUS\r
511EFIAPI\r
512WifiMgrDxeDriverEntryPoint (\r
513 IN EFI_HANDLE ImageHandle,\r
514 IN EFI_SYSTEM_TABLE *SystemTable\r
515 )\r
516{\r
517 EFI_STATUS Status;\r
518\r
519 Status = EfiLibInstallDriverBindingComponentName2 (\r
520 ImageHandle,\r
521 SystemTable,\r
522 &gWifiMgrDxeDriverBinding,\r
523 ImageHandle,\r
524 &gWifiMgrDxeComponentName,\r
525 &gWifiMgrDxeComponentName2\r
526 );\r
527 if (EFI_ERROR (Status)) {\r
528 return Status;\r
529 }\r
530\r
531 //\r
532 // Initialize the global private data structure.\r
533 //\r
534 mPrivate = AllocateZeroPool (sizeof (WIFI_MGR_PRIVATE_DATA));\r
535 if (mPrivate == NULL) {\r
536 Status = EFI_OUT_OF_RESOURCES;\r
537 goto ERROR1;\r
538 }\r
539 mPrivate->Signature = WIFI_MGR_PRIVATE_DATA_SIGNATURE;\r
540 mPrivate->DriverHandle = ImageHandle;\r
541 InitializeListHead (&mPrivate->NicList);\r
542 mPrivate->NicCount = 0;\r
543 mPrivate->CurrentNic = NULL;\r
544 InitializeListHead (&mPrivate->HiddenNetworkList);\r
545 mPrivate->HiddenNetworkCount = 0;\r
546\r
547 //\r
548 //Create events for page refresh\r
549 //\r
550 Status = gBS->CreateEventEx (\r
551 EVT_NOTIFY_SIGNAL,\r
552 TPL_CALLBACK,\r
553 WifiMgrInternalEmptyFunction,\r
554 NULL,\r
555 &mWifiConfigNetworkListRefreshGuid,\r
556 &mPrivate->NetworkListRefreshEvent\r
557 );\r
558 if (EFI_ERROR (Status)) {\r
559 goto ERROR2;\r
560 }\r
561\r
562 Status = gBS->CreateEventEx (\r
563 EVT_NOTIFY_SIGNAL,\r
564 TPL_CALLBACK,\r
565 WifiMgrInternalEmptyFunction,\r
566 NULL,\r
567 &mWifiConfigConnectFormRefreshGuid,\r
568 &mPrivate->ConnectFormRefreshEvent\r
569 );\r
570 if (EFI_ERROR (Status)) {\r
571 goto ERROR3;\r
572 }\r
573\r
574 Status = gBS->CreateEventEx (\r
575 EVT_NOTIFY_SIGNAL,\r
576 TPL_CALLBACK,\r
577 WifiMgrInternalEmptyFunction,\r
578 NULL,\r
579 &mWifiConfigMainFormRefreshGuid,\r
580 &mPrivate->MainPageRefreshEvent\r
581 );\r
582 if (EFI_ERROR (Status)) {\r
583 goto ERROR4;\r
584 }\r
585\r
586 Status = WifiMgrDxeConfigFormInit (mPrivate);\r
587 if (EFI_ERROR (Status)) {\r
588 goto ERROR5;\r
589 }\r
590\r
591 return Status;\r
592\r
593ERROR5:\r
594 gBS->CloseEvent (mPrivate->MainPageRefreshEvent);\r
595\r
596ERROR4:\r
597 gBS->CloseEvent (mPrivate->ConnectFormRefreshEvent);\r
598\r
599ERROR3:\r
600 gBS->CloseEvent (mPrivate->NetworkListRefreshEvent);\r
601\r
602ERROR2:\r
603 if (mPrivate != NULL) {\r
604 FreePool (mPrivate);\r
605 mPrivate = NULL;\r
606 }\r
607\r
608ERROR1:\r
609 gBS->UninstallMultipleProtocolInterfaces (\r
610 ImageHandle,\r
611 &gEfiDriverBindingProtocolGuid,\r
612 &gWifiMgrDxeDriverBinding,\r
613 &gEfiComponentNameProtocolGuid,\r
614 &gWifiMgrDxeComponentName,\r
615 &gEfiComponentName2ProtocolGuid,\r
616 &gWifiMgrDxeComponentName2,\r
617 NULL\r
618 );\r
619\r
620 return Status;\r
621}\r