/** This function invokes Boot Manager. If all devices have not a chance to be connected, the connect all will be triggered. It then enumerate all boot options. If a boot option from the Boot Manager page is selected, Boot Manager will boot from this boot option. **/ VOID UpdateBootManager ( VOID ) { UINTN Index; EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; UINTN BootOptionCount; EFI_STRING_ID Token; CHAR16 *HelpString; EFI_STRING_ID HelpToken; UINT16 *TempStr; EFI_HII_HANDLE HiiHandle; UINTN TempSize; VOID *StartOpCodeHandle; VOID *EndOpCodeHandle; EFI_IFR_GUID_LABEL *StartLabel; EFI_IFR_GUID_LABEL *EndLabel; UINT16 DeviceType; BOOLEAN IsLegacyOption; BOOLEAN NeedEndOp; UINTN MaxLen; DeviceType = (UINT16) -1; EfiBootManagerConnectAll (); // // for better user experience // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option // EfiBootManagerRefreshAllBootOption (); // // BdsDxe doesn't group the legacy boot options for the same device type // It's UI's choice. // GroupMultipleLegacyBootOption4SameType (); BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); HiiHandle = gBootManagerPrivate.HiiHandle; // // Allocate space for creation of UpdateData Buffer // StartOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (StartOpCodeHandle != NULL); EndOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (EndOpCodeHandle != NULL); // // Create Hii Extend Label OpCode as the start opcode // StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; StartLabel->Number = LABEL_BOOT_OPTION; // // Create Hii Extend Label OpCode as the end opcode // EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; EndLabel->Number = LABEL_BOOT_OPTION_END; mKeyInput = 0; NeedEndOp = FALSE; for (Index = 0; Index < BootOptionCount; Index++) { // // At this stage we are creating a menu entry, thus the Keys are reproduceable // mKeyInput++; // // Don't display the hidden/inactive boot option // if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) { continue; } // // Group the legacy boot option in the sub title created dynamically // IsLegacyOption = (BOOLEAN) ( (DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) && (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP) ); if (!IsLegacyOption && NeedEndOp) { NeedEndOp = FALSE; HiiCreateEndOpCode (StartOpCodeHandle); } if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) { if (NeedEndOp) { HiiCreateEndOpCode (StartOpCodeHandle); } DeviceType = ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType; Token = HiiSetString ( HiiHandle, 0, mDeviceTypeStr[ MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1) ], NULL ); HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1); NeedEndOp = TRUE; } ASSERT (BootOption[Index].Description != NULL); Token = HiiSetString (HiiHandle, 0, BootOption[Index].Description, NULL); TempStr = BmDevicePathToStr (BootOption[Index].FilePath); TempSize = StrSize (TempStr); HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : ")); MaxLen = (TempSize + StrSize (L"Device Path : "))/sizeof(CHAR16); ASSERT (HelpString != NULL); StrCatS (HelpString, MaxLen, L"Device Path : "); StrCatS (HelpString, MaxLen, TempStr); HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL); HiiCreateActionOpCode ( StartOpCodeHandle, mKeyInput, Token, HelpToken, EFI_IFR_FLAG_CALLBACK, 0 ); } if (NeedEndOp) { HiiCreateEndOpCode (StartOpCodeHandle); } HiiUpdateForm ( HiiHandle, &mBootManagerGuid, BOOT_MANAGER_FORM_ID, StartOpCodeHandle, EndOpCodeHandle ); HiiFreeOpCodeHandle (StartOpCodeHandle); HiiFreeOpCodeHandle (EndOpCodeHandle); EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount); }
/** Connect a device path following the platforms EFI Boot Manager policy. The ConnectDevicePath() function allows the caller to connect a DevicePath using the same policy as the EFI Boot Manger. @param[in] This A pointer to the EFI_BOOT_MANAGER_POLICY_PROTOCOL instance. @param[in] DevicePath Points to the start of the EFI device path to connect. If DevicePath is NULL then all the controllers in the system will be connected using the platforms EFI Boot Manager policy. @param[in] Recursive If TRUE, then ConnectController() is called recursively until the entire tree of controllers below the controller specified by DevicePath have been created. If FALSE, then the tree of controllers is only expanded one level. If DevicePath is NULL then Recursive is ignored. @retval EFI_SUCCESS The DevicePath was connected. @retval EFI_NOT_FOUND The DevicePath was not found. @retval EFI_NOT_FOUND No driver was connected to DevicePath. @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device drivers on the DevicePath. @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION. **/ EFI_STATUS EFIAPI BootManagerPolicyConnectDevicePath ( IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, IN EFI_DEVICE_PATH *DevicePath, IN BOOLEAN Recursive ) { EFI_STATUS Status; EFI_HANDLE Controller; if (EfiGetCurrentTpl () != TPL_APPLICATION) { return EFI_UNSUPPORTED; } if (DevicePath == NULL) { EfiBootManagerConnectAll (); return EFI_SUCCESS; } if (Recursive) { Status = EfiBootManagerConnectDevicePath (DevicePath, NULL); } else { Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &Controller); if (!EFI_ERROR (Status)) { Status = gBS->ConnectController (Controller, NULL, DevicePath, FALSE); } } return Status; }
/** Do the platform specific action after the console is ready Possible things that can be done in PlatformBootManagerAfterConsole: > Console post action: > Dynamically switch output mode from 100x31 to 80x25 for certain senarino > Signal console ready platform customized event > Run diagnostics like memory testing > Connect certain devices > Dispatch aditional option roms > Special boot: e.g.: USB boot, enter UI **/ VOID EFIAPI PlatformBootManagerAfterConsole ( VOID ) { EFI_STATUS Status; // // Show the splash screen. // Status = BootLogoEnableLogo (); if (EFI_ERROR (Status)) { Print (L"Press ESCAPE for boot options "); } // // Connect the rest of the devices. // EfiBootManagerConnectAll (); // // Enumerate all possible boot options. // EfiBootManagerRefreshAllBootOption (); // // Register UEFI Shell // PlatformRegisterFvBootOption ( &gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE ); }
/** This function is the main entry of the UI entry. The function will present the main menu of the system UI. @param ConnectAllHappened Caller passes the value to UI to avoid unnecessary connect-all. **/ VOID EFIAPI UiEntry ( IN BOOLEAN ConnectAllHappened ) { EFI_STATUS Status; EFI_BOOT_LOGO_PROTOCOL *BootLogo; // // Enter Setup page. // REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP) ); // // Indicate if the connect all has been performed before. // If has not been performed before, do here. // if (!ConnectAllHappened) { EfiBootManagerConnectAll (); } // // The boot option enumeration time is acceptable in Ui driver // EfiBootManagerRefreshAllBootOption (); // // Boot Logo is corrupted, report it using Boot Logo protocol. // Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo); if (!EFI_ERROR (Status) && (BootLogo != NULL)) { BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0); } InitializeFrontPage (); CallFrontPage (); FreeFrontPage (); if (mLanguageString != NULL) { FreePool (mLanguageString); mLanguageString = NULL; } // //Will leave browser, check any reset required change is applied? if yes, reset system // SetupResetReminder (); }
/** Do the platform specific action after the console is connected. Such as: Dynamically switch output mode; Signal console ready platform customized event; Run diagnostics like memory testing; Connect certain devices; Dispatch aditional option roms. **/ VOID EFIAPI PlatformBootManagerAfterConsole ( VOID ) { EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black; EFI_GRAPHICS_OUTPUT_BLT_PIXEL White; EFI_INPUT_KEY Enter; EFI_INPUT_KEY F2; EFI_INPUT_KEY F7; EFI_BOOT_MANAGER_LOAD_OPTION BootOption; UINTN OptionNumber; Black.Blue = Black.Green = Black.Red = Black.Reserved = 0; White.Blue = White.Green = White.Red = White.Reserved = 0xFF; EfiBootManagerConnectAll (); EfiBootManagerRefreshAllBootOption (); // // Register ENTER as CONTINUE key // Enter.ScanCode = SCAN_NULL; Enter.UnicodeChar = CHAR_CARRIAGE_RETURN; EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL); // // Map F2 to Boot Manager Menu // F2.ScanCode = SCAN_F2; F2.UnicodeChar = CHAR_NULL; EfiBootManagerGetBootManagerMenu (&BootOption); EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL); // // 3. Boot Device List menu // F7.ScanCode = SCAN_F7; F7.UnicodeChar = CHAR_NULL; OptionNumber = GetBootManagerMenuAppOption (); EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)OptionNumber, 0, &F7, NULL); // // Make Shell as the first boot option // EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, (SORT_COMPARE) CompareBootOption); PlatformBootManagerDiagnostics (QUICK, TRUE); PrintXY (10, 10, &White, &Black, L"F2 to enter Setup. "); PrintXY (10, 30, &White, &Black, L"F7 to enter Boot Manager Menu."); PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); }
/** This function attempts to boot per the boot order specified by platform policy. If the boot via Boot#### returns with a status of EFI_SUCCESS the boot manager will stop processing the BootOrder variable and present a boot manager menu to the user. If a boot via Boot#### returns a status other than EFI_SUCCESS, the boot has failed and the next Boot#### in the BootOrder variable will be tried until all possibilities are exhausted. -- Chapter 3.1.1 Boot Manager Programming, the 4th paragraph **/ VOID DefaultBootBehavior ( VOID ) { UINTN BootOptionCount; EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu; EfiBootManagerGetBootManagerMenu (&BootManagerMenu); // // BootManagerMenu always contains the correct information even the above function returns failure. // BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); if (BootAllBootOptions (BootOptions, BootOptionCount)) { // // Follow generic rule, Call BdsDxeOnConnectConInCallBack to connect ConIn before enter UI // if (PcdGetBool (PcdConInConnectOnDemand)) { BdsDxeOnConnectConInCallBack (NULL, NULL); } // // Show the Boot Manager Menu after successful boot // EfiBootManagerBoot (&BootManagerMenu); } else { EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); // // Re-scan all EFI boot options in case all the boot#### are deleted or failed to boot // // If no valid boot options exist, the boot manager will enumerate all removable media // devices followed by all fixed media devices. The order within each group is undefined. // These new default boot options are not saved to non volatile storage.The boot manger // will then attempt toboot from each boot option. // -- Chapter 3.3 Boot Manager Programming, the 2nd paragraph // EfiBootManagerConnectAll (); BootOptions = BdsEnumerateBootOptions (&BootOptionCount); if (!BootAllBootOptions (BootOptions, BootOptionCount)) { DEBUG ((EFI_D_ERROR, "[Bds]No bootable device!\n")); EfiBootManagerBoot (&BootManagerMenu); } } EfiBootManagerFreeLoadOption (&BootManagerMenu); EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); }
/** Connect all the system drivers to controllers and create the network device list in NV storage. @retval EFI_SUCCESS Network devices are connected. @retval EFI_DEVICE_ERROR No network device is connected. **/ EFI_STATUS ConnectAllAndCreateNetworkDeviceList ( VOID ) { EFI_STATUS Status; EFI_HANDLE *Handles; UINTN HandleCount; EFI_DEVICE_PATH_PROTOCOL *SingleDevice; EFI_DEVICE_PATH_PROTOCOL *Devices; EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; EfiBootManagerConnectAll (); Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiManagedNetworkServiceBindingProtocolGuid, NULL, &HandleCount, &Handles); if (EFI_ERROR (Status)) { Handles = NULL; HandleCount = 0; } Devices = NULL; while (HandleCount-- != 0) { Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **) &SingleDevice); if (EFI_ERROR (Status) || (SingleDevice == NULL)) { continue; } TempDevicePath = Devices; Devices = AppendDevicePathInstance (Devices, SingleDevice); if (TempDevicePath != NULL) { FreePool (TempDevicePath); } } if (Devices != NULL) { Status = gRT->SetVariable ( mNetworkDeviceList, &gEfiCallerIdGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, GetDevicePathSize (Devices), Devices ); // // Fails to save the network device list to NV storage is not a fatal error. // Only impact is performance. // FreePool (Devices); } return (Devices == NULL) ? EFI_DEVICE_ERROR : EFI_SUCCESS; }
/** Do the platform specific action after the console is connected. Such as: Dynamically switch output mode; Signal console ready platform customized event; Run diagnostics like memory testing; Connect certain devices; Dispatch aditional option roms. **/ VOID EFIAPI PlatformBootManagerAfterConsole ( VOID ) { EfiBootManagerConnectAll (); EfiBootManagerRefreshAllBootOption (); Print ( L"\n" L"F2 to enter Boot Manager Menu.\n" L"Enter to boot directly.\n" L"\n" ); }
/** The function will load and start every Driver####/SysPrep####. @param LoadOptions Load option array. @param LoadOptionCount Load option count. **/ VOID ProcessLoadOptions ( IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions, IN UINTN LoadOptionCount ) { EFI_STATUS Status; UINTN Index; BOOLEAN ReconnectAll; EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType; ReconnectAll = FALSE; LoadOptionType = LoadOptionTypeMax; // // Process the driver option // for (Index = 0; Index < LoadOptionCount; Index++) { // // All the load options in the array should be of the same type. // if (LoadOptionType == LoadOptionTypeMax) { LoadOptionType = LoadOptions[Index].OptionType; } ASSERT (LoadOptionType == LoadOptions[Index].OptionType); ASSERT (LoadOptionType == LoadOptionTypeDriver || LoadOptionType == LoadOptionTypeSysPrep); Status = EfiBootManagerProcessLoadOption (&LoadOptions[Index]); if (!EFI_ERROR (Status) && ((LoadOptions[Index].Attributes & LOAD_OPTION_FORCE_RECONNECT) != 0)) { ReconnectAll = TRUE; } } // // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT, // then all of the EFI drivers in the system will be disconnected and // reconnected after the last driver load option is processed. // if (ReconnectAll && LoadOptionType == LoadOptionTypeDriver) { EfiBootManagerDisconnectAll (); EfiBootManagerConnectAll (); } }
VOID ConnectSequence ( VOID ) /*++ Routine Description: Connect with predeined platform connect sequence, the OEM/IBV can customize with their own connect sequence. Arguments: None. Returns: None. --*/ { UINTN Index; // // Here we can get the customized platform connect sequence // Notes: we can connect with new variable which record the // last time boots connect device path sequence // for (Index = 0; gPlatformConnectSequence[Index] != NULL; Index++) { // // Build the platform boot option // EfiBootManagerConnectDevicePath (gPlatformConnectSequence[Index], NULL); } // // For the debug tip, just use the simple policy to connect all devices // EfiBootManagerConnectAll (); }
/** Register HII packages to HII database. **/ VOID InitializeBootManager ( VOID ) { EFI_STATUS Status; if (!gConnectAllHappened){ EfiBootManagerConnectAll(); gConnectAllHappened = TRUE; } // // Install Device Path Protocol and Config Access protocol to driver handle // gBootManagerPrivate.DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &gBootManagerPrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mBootManagerHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &gBootManagerPrivate.ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data // gBootManagerPrivate.HiiHandle = HiiAddPackages ( &mBootManagerGuid, gBootManagerPrivate.DriverHandle, BootManagerVfrBin, UiAppStrings, NULL ); ASSERT(gBootManagerPrivate.HiiHandle != NULL); }
/** Do the platform specific action after the console is ready Possible things that can be done in PlatformBootManagerAfterConsole: > Console post action: > Dynamically switch output mode from 100x31 to 80x25 for certain senarino > Signal console ready platform customized event > Run diagnostics like memory testing > Connect certain devices > Dispatch aditional option roms > Special boot: e.g.: USB boot, enter UI **/ VOID EFIAPI PlatformBootManagerAfterConsole ( VOID ) { // // Show the splash screen. // BootLogoEnableLogo ( ImageFormatBmp, // ImageFormat PcdGetPtr (PcdLogoFile), // Logo EdkiiPlatformLogoDisplayAttributeCenter, // Attribute 0, // OffsetX 0 // OffsetY ); // // Connect the rest of the devices. // EfiBootManagerConnectAll (); // // Process QEMU's -kernel command line option. Note that the kernel booted // this way should receive ACPI tables, which is why we connect all devices // first (see above) -- PCI enumeration blocks ACPI table installation, if // there is a PCI host. // TryRunningQemuKernel (); // // Enumerate all possible boot options, then filter and reorder them based on // the QEMU configuration. // EfiBootManagerRefreshAllBootOption (); SetBootOrderFromQemu (); }
/** Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo(). **/ VOID GetLegacyOptions ( VOID ) { LEGACY_MENU_ENTRY *NewMenuEntry; LEGACY_DEVICE_CONTEXT *NewLegacyDevContext; EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; UINTN BootOptionCount; UINT16 Index; UINTN FDNum; UINTN HDNum; UINTN CDNum; UINTN NETNum; UINTN BEVNum; // // Initialize Bbs Table Context from BBS info data // InitializeListHead (&LegacyFDMenu.Head); InitializeListHead (&LegacyHDMenu.Head); InitializeListHead (&LegacyCDMenu.Head); InitializeListHead (&LegacyNETMenu.Head); InitializeListHead (&LegacyBEVMenu.Head); FDNum = 0; HDNum = 0; CDNum = 0; NETNum = 0; BEVNum = 0; EfiBootManagerConnectAll (); // // for better user experience // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option // EfiBootManagerRefreshAllBootOption (); BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); for (Index = 0; Index < BootOptionCount; Index++) { if ((DevicePathType (BootOption[Index].FilePath) != BBS_DEVICE_PATH) || (DevicePathSubType (BootOption[Index].FilePath) != BBS_BBS_DP) ) { continue; } ASSERT (BootOption[Index].OptionalDataSize == sizeof (LEGACY_BOOT_OPTION_BBS_DATA)); NewMenuEntry = CreateMenuEntry (); ASSERT (NewMenuEntry != NULL); NewLegacyDevContext = (LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext; NewLegacyDevContext->BbsIndex = ((LEGACY_BOOT_OPTION_BBS_DATA *) BootOption[Index].OptionalData)->BbsIndex; NewLegacyDevContext->Description = AllocateCopyPool (StrSize (BootOption[Index].Description), BootOption[Index].Description); ASSERT (NewLegacyDevContext->Description != NULL); NewMenuEntry->DisplayString = NewLegacyDevContext->Description; NewMenuEntry->HelpString = NULL; switch (((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) { case BBS_TYPE_FLOPPY: InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link); FDNum++; break; case BBS_TYPE_HARDDRIVE: InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link); HDNum++; break; case BBS_TYPE_CDROM: InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link); CDNum++; break; case BBS_TYPE_EMBEDDED_NETWORK: InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link); NETNum++; break; case BBS_TYPE_BEV: InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link); BEVNum++; break; } } EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount); LegacyFDMenu.MenuNumber = FDNum; LegacyHDMenu.MenuNumber = HDNum; LegacyCDMenu.MenuNumber = CDNum; LegacyNETMenu.MenuNumber = NETNum; LegacyBEVMenu.MenuNumber = BEVNum; }
/** Install BootMaint and FileExplorer HiiPackages. **/ VOID InitBootMaintenance( VOID ) { BMM_CALLBACK_DATA *BmmCallbackInfo; EFI_STATUS Status; UINT8 *Ptr; Status = EFI_SUCCESS; if (!gConnectAllHappened){ EfiBootManagerConnectAll(); gConnectAllHappened = TRUE; } EfiBootManagerRefreshAllBootOption (); // // Create CallbackData structures for Driver Callback // BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA)); ASSERT (BmmCallbackInfo != NULL); // // Create LoadOption in BmmCallbackInfo for Driver Callback // Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY)); ASSERT (Ptr != NULL); // // Initialize Bmm callback data. // BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr; Ptr += sizeof (BM_LOAD_CONTEXT); BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr; Ptr += sizeof (BM_FILE_CONTEXT); BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr; Ptr += sizeof (BM_HANDLE_CONTEXT); BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr; BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE; BmmCallbackInfo->BmmConfigAccess.ExtractConfig = BootMaintExtractConfig; BmmCallbackInfo->BmmConfigAccess.RouteConfig = BootMaintRouteConfig; BmmCallbackInfo->BmmConfigAccess.Callback = BootMaintCallback; BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID; BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID; BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig; BmmCallbackInfo->FeConfigAccess.RouteConfig = FakeRouteConfig; BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback; BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive; BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown; // // Install Device Path Protocol and Config Access protocol to driver handle // Status = gBS->InstallMultipleProtocolInterfaces ( &BmmCallbackInfo->BmmDriverHandle, &gEfiDevicePathProtocolGuid, &mBmmHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &BmmCallbackInfo->BmmConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Install Device Path Protocol and Config Access protocol to driver handle // Status = gBS->InstallMultipleProtocolInterfaces ( &BmmCallbackInfo->FeDriverHandle, &gEfiDevicePathProtocolGuid, &mFeHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &BmmCallbackInfo->FeConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Post our Boot Maint VFR binary to the HII database. // BmmCallbackInfo->BmmHiiHandle = HiiAddPackages ( &mBootMaintGuid, BmmCallbackInfo->BmmDriverHandle, BmBin, UiAppStrings, NULL ); ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL); // // Post our File Explorer VFR binary to the HII database. // BmmCallbackInfo->FeHiiHandle = HiiAddPackages ( &mFileExplorerGuid, BmmCallbackInfo->FeDriverHandle, FEBin, UiAppStrings, NULL ); ASSERT (BmmCallbackInfo->FeHiiHandle != NULL); // // Init OpCode Handle and Allocate space for creation of Buffer // mStartOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (mStartOpCodeHandle != NULL); mEndOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (mEndOpCodeHandle != NULL); // // Create Hii Extend Label OpCode as the start opcode // mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; // // Create Hii Extend Label OpCode as the end opcode // mEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mEndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; mEndLabel->Number = LABEL_END; mBmmCallbackInfo = BmmCallbackInfo; InitializeStringDepository (); }