32EFI_GUID mEfiWifiMgrPrivateGuid = EFI_WIFIMGR_PRIVATE_GUID;
37EFI_GUID gWifiConfigFormSetGuid = WIFI_CONNECTION_MANAGER_CONFIG_GUID;
38EFI_GUID mWifiConfigNetworkListRefreshGuid = WIFI_CONFIG_NETWORK_LIST_REFRESH_GUID;
39EFI_GUID mWifiConfigConnectFormRefreshGuid = WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID;
40EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;
45extern UINT8 mWifiConnectionCount;
100 Status =
gBS->OpenProtocol (
102 &mEfiWifiMgrPrivateGuid,
104 This->DriverBindingHandle,
106 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
108 if (!EFI_ERROR (Status)) {
109 return EFI_ALREADY_STARTED;
115 return gBS->OpenProtocol (
117 &gEfiWiFi2ProtocolGuid,
119 This->DriverBindingHandle,
121 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
177 mWifiConnectionCount = 0;
183 Status =
gBS->OpenProtocol (
185 &gEfiWiFi2ProtocolGuid,
187 This->DriverBindingHandle,
189 EFI_OPEN_PROTOCOL_BY_DRIVER
191 if (EFI_ERROR (Status)) {
195 Status =
gBS->OpenProtocol (
197 &gEfiSupplicantProtocolGuid,
198 (VOID **)&Supplicant,
199 This->DriverBindingHandle,
201 EFI_OPEN_PROTOCOL_BY_DRIVER
203 if (EFI_ERROR (Status)) {
207 Status =
gBS->OpenProtocol (
209 &gEfiEapConfigurationProtocolGuid,
211 This->DriverBindingHandle,
213 EFI_OPEN_PROTOCOL_BY_DRIVER
215 if (EFI_ERROR (Status)) {
224 Status = EFI_OUT_OF_RESOURCES;
228 Nic->Signature = WIFI_MGR_DEVICE_DATA_SIGNATURE;
229 Nic->DriverHandle = This->DriverBindingHandle;
230 Nic->ControllerHandle = ControllerHandle;
231 Nic->Private = mPrivate;
233 Nic->Supplicant = Supplicant;
234 Nic->EapConfig = EapConfig;
235 Nic->UserSelectedProfile =
NULL;
236 Nic->OneTimeScanRequest =
FALSE;
237 Nic->ScanTickTime = WIFI_SCAN_FREQUENCY;
239 if (Nic->Supplicant !=
NULL) {
248 Status =
gBS->LocateProtocol (
249 &gEdkiiWiFiProfileSyncProtocolGuid,
251 (VOID **)&WiFiProfileSyncProtocol
253 if (!EFI_ERROR (Status)) {
255 if (Nic->ConnectPendingNetwork ==
NULL) {
256 Status = EFI_OUT_OF_RESOURCES;
260 WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic->MacAddress);
261 if (Nic->ConnectPendingNetwork !=
NULL) {
263 if (!EFI_ERROR (Status)) {
267 WiFiProfileSyncProtocol->SetConnectState (Status);
278 if (EFI_ERROR (Status)) {
285 Status =
gBS->CreateEvent (
286 EVT_NOTIFY_SIGNAL | EVT_TIMER,
292 if (EFI_ERROR (Status)) {
297 if (EFI_ERROR (Status)) {
301 Nic->ConnectState = WifiMgrDisconnected;
302 Nic->ScanState = WifiMgrScanFinished;
304 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
306 Nic->NicIndex = mPrivate->NicCount++;
307 if (mPrivate->CurrentNic ==
NULL) {
308 mPrivate->CurrentNic = Nic;
311 gBS->RestoreTPL (OldTpl);
314 Status =
gBS->InstallProtocolInterface (
316 &mEfiWifiMgrPrivateGuid,
318 &Nic->WifiMgrIdentifier
320 if (EFI_ERROR (Status)) {
329 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
331 mPrivate->NicCount--;
332 gBS->RestoreTPL (OldTpl);
336 gBS->CloseEvent (Nic->TickTimer);
340 if (Nic->Supplicant !=
NULL) {
341 if (Nic->SupportedSuites.SupportedAKMSuites !=
NULL) {
342 FreePool (Nic->SupportedSuites.SupportedAKMSuites);
345 if (Nic->SupportedSuites.SupportedSwCipherSuites !=
NULL) {
346 FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);
349 if (Nic->SupportedSuites.SupportedHwCipherSuites !=
NULL) {
350 FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);
358 if (Supplicant !=
NULL) {
361 &gEfiSupplicantProtocolGuid,
362 This->DriverBindingHandle,
367 if (EapConfig !=
NULL) {
370 &gEfiEapConfigurationProtocolGuid,
371 This->DriverBindingHandle,
378 &gEfiWiFi2ProtocolGuid,
379 This->DriverBindingHandle,
427 Status =
gBS->OpenProtocol (
429 &mEfiWifiMgrPrivateGuid,
430 (VOID **)&WifiMgrIdentifier,
431 This->DriverBindingHandle,
433 EFI_OPEN_PROTOCOL_GET_PROTOCOL
435 if (EFI_ERROR (Status)) {
436 return EFI_DEVICE_ERROR;
439 Nic = WIFI_MGR_DEVICE_DATA_FROM_IDENTIFIER (WifiMgrIdentifier);
441 return EFI_DEVICE_ERROR;
448 gBS->CloseEvent (Nic->TickTimer);
453 if (Nic->Supplicant !=
NULL) {
454 if (Nic->SupportedSuites.SupportedAKMSuites !=
NULL) {
455 FreePool (Nic->SupportedSuites.SupportedAKMSuites);
458 if (Nic->SupportedSuites.SupportedSwCipherSuites !=
NULL) {
459 FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);
462 if (Nic->SupportedSuites.SupportedHwCipherSuites !=
NULL) {
463 FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);
470 Status =
gBS->UninstallProtocolInterface (
472 &mEfiWifiMgrPrivateGuid,
473 &Nic->WifiMgrIdentifier
475 if (EFI_ERROR (Status)) {
479 Status =
gBS->CloseProtocol (
481 &gEfiWiFi2ProtocolGuid,
483 Nic->ControllerHandle
485 if (EFI_ERROR (Status)) {
489 if (Nic->Supplicant !=
NULL) {
490 Status =
gBS->CloseProtocol (
492 &gEfiSupplicantProtocolGuid,
494 Nic->ControllerHandle
496 if (EFI_ERROR (Status)) {
501 if (Nic->EapConfig !=
NULL) {
502 Status =
gBS->CloseProtocol (
504 &gEfiEapConfigurationProtocolGuid,
506 Nic->ControllerHandle
508 if (EFI_ERROR (Status)) {
516 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
518 Status =
gBS->LocateProtocol (
519 &gEdkiiWiFiProfileSyncProtocolGuid,
521 (VOID **)&WiFiProfileSyncProtocol
523 if (EFI_ERROR (Status)) {
527 mPrivate->NicCount--;
528 if (mPrivate->CurrentNic == Nic) {
529 mPrivate->CurrentNic =
NULL;
532 gBS->RestoreTPL (OldTpl);
537 DEBUG ((DEBUG_INFO,
"[WiFi Connection Manager] Device Controller has been Disconnected!\n"));
571 if (EFI_ERROR (Status)) {
579 if (mPrivate ==
NULL) {
580 Status = EFI_OUT_OF_RESOURCES;
584 mPrivate->Signature = WIFI_MGR_PRIVATE_DATA_SIGNATURE;
585 mPrivate->DriverHandle = ImageHandle;
587 mPrivate->NicCount = 0;
588 mPrivate->CurrentNic =
NULL;
590 mPrivate->HiddenNetworkCount = 0;
595 Status =
gBS->CreateEventEx (
600 &mWifiConfigNetworkListRefreshGuid,
601 &mPrivate->NetworkListRefreshEvent
603 if (EFI_ERROR (Status)) {
607 Status =
gBS->CreateEventEx (
612 &mWifiConfigConnectFormRefreshGuid,
613 &mPrivate->ConnectFormRefreshEvent
615 if (EFI_ERROR (Status)) {
619 Status =
gBS->CreateEventEx (
624 &mWifiConfigMainFormRefreshGuid,
625 &mPrivate->MainPageRefreshEvent
627 if (EFI_ERROR (Status)) {
632 if (EFI_ERROR (Status)) {
639 gBS->CloseEvent (mPrivate->MainPageRefreshEvent);
642 gBS->CloseEvent (mPrivate->ConnectFormRefreshEvent);
645 gBS->CloseEvent (mPrivate->NetworkListRefreshEvent);
648 if (mPrivate !=
NULL) {
654 gBS->UninstallMultipleProtocolInterfaces (
656 &gEfiDriverBindingProtocolGuid,
658 &gEfiComponentNameProtocolGuid,
660 &gEfiComponentName2ProtocolGuid,
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibGetMacAddress(IN EFI_HANDLE ServiceHandle, OUT EFI_MAC_ADDRESS *MacAddress, OUT UINTN *AddressSize)
#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2
EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding
EFI_STATUS EFIAPI WifiMgrDxeDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI WifiMgrDxeDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS EFIAPI WifiMgrDxeDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI WifiMgrDxeDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS WifiMgrDxeConfigFormInit(WIFI_MGR_PRIVATE_DATA *Private)
VOID EFIAPI WifiMgrOnTimerTick(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS WifiMgrConnectToNetwork(IN WIFI_MGR_DEVICE_DATA *Nic, IN WIFI_MGR_NETWORK_PROFILE *Profile)
VOID WifiMgrFreeProfileList(IN LIST_ENTRY *ProfileList)
VOID EFIAPI WifiMgrInternalEmptyFunction(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS WifiMgrGetSupportedSuites(IN WIFI_MGR_DEVICE_DATA *Nic)