/** Constructor for the Shell Network1 Commands library. Install the handlers for Network1 UEFI Shell 2.0 profile commands. @param ImageHandle The image handle of the process. @param SystemTable The EFI System Table pointer. @retval EFI_SUCCESS The shell command handlers were installed sucessfully. @retval EFI_UNSUPPORTED The shell level required was not found. **/ EFI_STATUS EFIAPI ShellNetwork1CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { gShellNetwork1HiiHandle = NULL; // // check our bit of the profiles mask // if ((PcdGet8(PcdShellProfileMask) & BIT3) == 0) { return (EFI_SUCCESS); } gShellNetwork1HiiHandle = HiiAddPackages (&gShellNetwork1HiiGuid, gImageHandle, UefiShellNetwork1CommandsLibStrings, NULL); if (gShellNetwork1HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers // ShellCommandRegisterCommandName(L"ping", ShellCommandRunPing , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_PING)); ShellCommandRegisterCommandName(L"ifconfig",ShellCommandRunIfconfig , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG)); return (EFI_SUCCESS); }
EFI_STATUS ShellDynCmdRunAxfInstall ( IN EFI_HANDLE ImageHandle ) { EFI_STATUS Status; // Register our shell command Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle, &gEfiShellDynamicCommandProtocolGuid, &mShellDynCmdProtocolRunAxf, NULL); if (EFI_ERROR (Status)) { return Status; } // Load the manual page for our command // // 3rd parameter 'HII strings array' must be name of .uni strings file // followed by 'Strings', e.g. mycommands.uni must be specified as // 'mycommandsStrings' because the build Autogen process defines this as a // string array for the strings in your .uni file. Examine your Build folder // under your package's DEBUG folder and you will find it defined in a // xxxStrDefs.h file. // gRunAxfHiiHandle = HiiAddPackages (&gRunAxfHiiGuid, ImageHandle, ArmShellCmdRunAxfStrings, NULL); if (gRunAxfHiiHandle == NULL) { return EFI_UNSUPPORTED; } return EFI_SUCCESS; }
/** Constructor for the Shell Level 1 Commands library. Install the handlers for level 1 UEFI Shell 2.0 commands. @param ImageHandle the image handle of the process @param SystemTable the EFI System Table pointer @retval EFI_SUCCESS the shell command handlers were installed sucessfully @retval EFI_UNSUPPORTED the shell level required was not found. **/ EFI_STATUS EFIAPI ShellInstall1CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // check our bit of the profiles mask // if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) { return (EFI_SUCCESS); } gShellInstall1HiiHandle = HiiAddPackages (&gShellInstall1HiiGuid, gImageHandle, UefiShellInstall1CommandsLibStrings, NULL); if (gShellInstall1HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers that are always installed // ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfgInstall , ShellCommandGetManFileNameInstall1, 0, L"Install", FALSE, gShellInstall1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG)); return (EFI_SUCCESS); }
/** Install Boot Manager Menu driver. @param ImageHandle The image handle. @param SystemTable The system table. @retval EFI_SUCEESS Install Boot manager menu success. @retval Other Return error status. **/ EFI_STATUS EFIAPI LegacyBootMaintUiLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; LEGACY_BOOT_OPTION_CALLBACK_DATA *LegacyBootOptionData; Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios); if (!EFI_ERROR (Status)) { // // Create LegacyBootOptionData structures for Driver Callback // LegacyBootOptionData = AllocateZeroPool (sizeof (LEGACY_BOOT_OPTION_CALLBACK_DATA)); ASSERT (LegacyBootOptionData != NULL); LegacyBootOptionData->MaintainMapData = AllocateZeroPool (sizeof (LEGACY_BOOT_MAINTAIN_DATA)); ASSERT (LegacyBootOptionData->MaintainMapData != NULL); LegacyBootOptionData->ConfigAccess.ExtractConfig = LegacyBootOptionExtractConfig; LegacyBootOptionData->ConfigAccess.RouteConfig = LegacyBootOptionRouteConfig; LegacyBootOptionData->ConfigAccess.Callback = LegacyBootOptionCallback; // // Install Device Path Protocol and Config Access protocol to driver handle // Status = gBS->InstallMultipleProtocolInterfaces ( &LegacyBootOptionData->DriverHandle, &gEfiDevicePathProtocolGuid, &mLegacyBootOptionHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &LegacyBootOptionData->ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data // LegacyBootOptionData->HiiHandle = HiiAddPackages ( &mLegacyBootOptionGuid, LegacyBootOptionData->DriverHandle, LegacyBootMaintUiVfrBin, LegacyBootMaintUiLibStrings, NULL ); ASSERT (LegacyBootOptionData->HiiHandle != NULL); mLegacyBootOptionPrivate = LegacyBootOptionData; GetLegacyOptions (); GetLegacyOptionsOrder(); } return EFI_SUCCESS; }
STATIC EFI_STATUS InstallHiiPages ( VOID ) { EFI_STATUS Status; EFI_HII_HANDLE HiiHandle; EFI_HANDLE DriverHandle; DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces (&DriverHandle, &gEfiDevicePathProtocolGuid, &m96BoardsDxeVendorDevicePath, NULL); if (EFI_ERROR (Status)) { return Status; } HiiHandle = HiiAddPackages (&g96BoardsFormsetGuid, DriverHandle, LsConnectorDxeStrings, LsConnectorHiiBin, NULL); if (HiiHandle == NULL) { gBS->UninstallMultipleProtocolInterfaces (DriverHandle, &gEfiDevicePathProtocolGuid, &m96BoardsDxeVendorDevicePath, NULL); return EFI_OUT_OF_RESOURCES; } return EFI_SUCCESS; }
/** Constructor for the Shell Level 1 Commands library. Install the handlers for level 1 UEFI Shell 2.0 commands. @param ImageHandle the image handle of the process @param SystemTable the EFI System Table pointer @retval EFI_SUCCESS the shell command handlers were installed sucessfully @retval EFI_UNSUPPORTED the shell level required was not found. **/ EFI_STATUS EFIAPI ShellLevel1CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // if shell level is less than 2 do nothing // if (PcdGet8(PcdShellSupportLevel) < 1) { return (EFI_SUCCESS); } gShellLevel1HiiHandle = HiiAddPackages (&gShellLevel1HiiGuid, gImageHandle, UefiShellLevel1CommandsLibStrings, NULL); if (gShellLevel1HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers that are always installed // ShellCommandRegisterCommandName(L"stall", ShellCommandRunStall , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_STALL) )); ShellCommandRegisterCommandName(L"for", ShellCommandRunFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_FOR) )); ShellCommandRegisterCommandName(L"goto", ShellCommandRunGoto , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_GOTO) )); ShellCommandRegisterCommandName(L"if", ShellCommandRunIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_IF) )); ShellCommandRegisterCommandName(L"shift", ShellCommandRunShift , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_SHIFT) )); ShellCommandRegisterCommandName(L"exit", ShellCommandRunExit , ShellCommandGetManFileNameLevel1, 1, L"", TRUE , gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_EXIT) )); ShellCommandRegisterCommandName(L"else", ShellCommandRunElse , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ELSE) )); ShellCommandRegisterCommandName(L"endif", ShellCommandRunEndIf , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDIF) )); ShellCommandRegisterCommandName(L"endfor", ShellCommandRunEndFor , ShellCommandGetManFileNameLevel1, 1, L"", FALSE, gShellLevel1HiiHandle, (EFI_STRING_ID)(PcdGet8(PcdShellSupportLevel) < 3 ? 0 : STRING_TOKEN(STR_GET_HELP_ENDFOR))); return (EFI_SUCCESS); }
/** Constructor for the Shell Tftp Command library. Install the handlers for Tftp UEFI Shell command. @param ImageHandle The image handle of the process. @param SystemTable The EFI System Table pointer. @retval EFI_SUCCESS The Shell command handlers were installed sucessfully. @retval EFI_UNSUPPORTED The Shell level required was not found. **/ EFI_STATUS EFIAPI ShellTftpCommandLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { gShellTftpHiiHandle = NULL; // // check our bit of the profiles mask // if ((PcdGet8 (PcdShellProfileMask) & BIT3) == 0) { return EFI_SUCCESS; } gShellTftpHiiHandle = HiiAddPackages ( &gShellTftpHiiGuid, gImageHandle, UefiShellTftpCommandLibStrings, NULL ); if (gShellTftpHiiHandle == NULL) { return EFI_DEVICE_ERROR; } // // Install our Shell command handler // ShellCommandRegisterCommandName ( L"tftp", ShellCommandRunTftp, ShellCommandGetManFileNameTftp, 0, L"tftp", TRUE , gShellTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP) ); return EFI_SUCCESS; }
/** The constructor function register UNI strings into imageHandle. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. @param ImageHandle The firmware allocated handle for the EFI image. @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The constructor successfully added string package. @retval Other value The constructor can't add string package. **/ EFI_STATUS EFIAPI TcgPhysicalPresenceLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { mPpStringPackHandle = HiiAddPackages (&gEfiPhysicalPresenceGuid, ImageHandle, DxeTcgPhysicalPresenceLibStrings, NULL); ASSERT (mPpStringPackHandle != NULL); return EFI_SUCCESS; }
VOID GpioE6xxGetHiiHandle ( VOID ) { if ( NULL == gGpioE6xxHiiHandle ) { gGpioE6xxHiiHandle = HiiAddPackages ( &mGpioE6xxGuid, gImageHandle, STRING_ARRAY_NAME, NULL ); } }
/** Initialize HII information for the FrontPage @retval EFI_SUCCESS The operation is successful. @retval EFI_DEVICE_ERROR If the dynamic opcode creation failed. **/ EFI_STATUS InitializeFrontPage ( VOID ) { EFI_STATUS Status; // // Locate Hii relative protocols // Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &gFormBrowser2); if (EFI_ERROR (Status)) { return Status; } // // Install Device Path Protocol and Config Access protocol to driver handle // gFrontPagePrivate.DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &gFrontPagePrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mFrontPageHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &gFrontPagePrivate.ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data // gFrontPagePrivate.HiiHandle = HiiAddPackages ( &mFrontPageGuid, gFrontPagePrivate.DriverHandle, FrontPageVfrBin, UiAppStrings, NULL ); ASSERT (gFrontPagePrivate.HiiHandle != NULL); // //Updata Front Page strings // UpdateFrontPageStrings (); // // Initialize laguage options // InitializeLanguage (); return Status; }
/** This function publish the TREE configuration Form for TPM device. @param[in, out] PrivateData Points to TREE configuration private data. @retval EFI_SUCCESS HII Form is installed for this network device. @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation. @retval Others Other errors as indicated. **/ EFI_STATUS InstallTrEEConfigForm ( IN OUT TREE_CONFIG_PRIVATE_DATA *PrivateData ) { EFI_STATUS Status; EFI_HII_HANDLE HiiHandle; EFI_HANDLE DriverHandle; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; DriverHandle = NULL; ConfigAccess = &PrivateData->ConfigAccess; Status = gBS->InstallMultipleProtocolInterfaces ( &DriverHandle, &gEfiDevicePathProtocolGuid, &mTrEEHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, ConfigAccess, NULL ); if (EFI_ERROR (Status)) { return Status; } PrivateData->DriverHandle = DriverHandle; // // Publish the HII package list // HiiHandle = HiiAddPackages ( &gTrEEConfigFormSetGuid, DriverHandle, TrEEConfigDxeStrings, TrEEConfigBin, NULL ); if (HiiHandle == NULL) { gBS->UninstallMultipleProtocolInterfaces ( DriverHandle, &gEfiDevicePathProtocolGuid, &mTrEEHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, ConfigAccess, NULL ); return EFI_OUT_OF_RESOURCES; } PrivateData->HiiHandle = HiiHandle; return EFI_SUCCESS; }
VOID GetHiiHandle ( VOID ) { if ( NULL == mHiiHandle ) { mHiiHandle = HiiAddPackages ( &mAppGuid, gImageHandle, STRING_ARRAY_NAME, NULL ); } }
/** Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver. **/ EFI_HII_HANDLE ExportFonts ( VOID ) { return HiiAddPackages ( &mFontPackageGuid, gImageHandle, &mFontBin, NULL ); }
EFI_HII_HANDLE EFIAPI OemGetPackages ( ) { return HiiAddPackages ( &gEfiCallerIdGuid, NULL, OemMiscLib2PStrings, NULL, NULL ); }
/** Initialize HII global accessor for string support. **/ VOID InitializeStringSupport ( VOID ) { gStringPackHandle = HiiAddPackages ( &mBdsStringPackGuid, gImageHandle, BdsDxeStrings, NULL ); ASSERT (gStringPackHandle != NULL); }
/** Constructor of Customized Display Library Instance. @param ImageHandle The firmware allocated handle for the EFI image. @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. **/ EFI_STATUS EFIAPI CustomizedDisplayLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { mCDLStringPackHandle = HiiAddPackages (&gCustomizedDisplayLibGuid, ImageHandle, CustomizedDisplayLibStrings, NULL); ASSERT (mCDLStringPackHandle != NULL); InitializeLibStrings(); return EFI_SUCCESS; }
EFI_STATUS EFIAPI SmbiosGenEntrypoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; VOID *Smbios; Smbios = GetSmbiosTablesFromHob (); if (Smbios == NULL) { return EFI_NOT_FOUND; } Status = gBS->LocateProtocol ( &gEfiSmbiosProtocolGuid, NULL, (VOID**)&gSmbios ); if (EFI_ERROR (Status)) { return Status; } Status = gBS->LocateProtocol ( &gEfiHiiDatabaseProtocolGuid, NULL, (VOID**)&gHiiDatabase ); if (EFI_ERROR (Status)) { return Status; } gStringHandle = HiiAddPackages ( &gEfiCallerIdGuid, NULL, SmbiosGenDxeStrings, NULL ); ASSERT (gStringHandle != NULL); InstallMiscSmbios (Smbios); InstallBaseBoardSmbios (Smbios); InstallProcessorSmbios (Smbios); InstallMemorySmbios (Smbios); InstallCacheSmbios (Smbios); return EFI_SUCCESS; }
/** Constructor for the Shell Debug1 Commands library. @param ImageHandle the image handle of the process @param SystemTable the EFI System Table pointer @retval EFI_SUCCESS the shell command handlers were installed sucessfully @retval EFI_UNSUPPORTED the shell level required was not found. **/ EFI_STATUS EFIAPI UefiShellDebug1CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // check our bit of the profiles mask // if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) { return (EFI_SUCCESS); } // // install the HII stuff. // gShellDebug1HiiHandle = HiiAddPackages (&gShellDebug1HiiGuid, gImageHandle, UefiShellDebug1CommandsLibStrings, NULL); if (gShellDebug1HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers that are always installed // ShellCommandRegisterCommandName(L"setsize", ShellCommandRunSetSize , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETSIZE) ); ShellCommandRegisterCommandName(L"comp", ShellCommandRunComp , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_COMP) ); ShellCommandRegisterCommandName(L"mode", ShellCommandRunMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MODE) ); ShellCommandRegisterCommandName(L"memmap", ShellCommandRunMemMap , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MEMMAP) ); ShellCommandRegisterCommandName(L"eficompress", ShellCommandRunEfiCompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFICOMPRESS) ); ShellCommandRegisterCommandName(L"efidecompress", ShellCommandRunEfiDecompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFIDCOMPRESS) ); ShellCommandRegisterCommandName(L"dmem", ShellCommandRunDmem , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMEM) ); ShellCommandRegisterCommandName(L"loadpcirom", ShellCommandRunLoadPciRom , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD_PCI_ROM) ); ShellCommandRegisterCommandName(L"mm", ShellCommandRunMm , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MM) ); ShellCommandRegisterCommandName(L"setvar", ShellCommandRunSetVar , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETVAR) ); ShellCommandRegisterCommandName(L"sermode", ShellCommandRunSerMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SERMODE) ); ShellCommandRegisterCommandName(L"pci", ShellCommandRunPci , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_PCI) ); ShellCommandRegisterCommandName(L"smbiosview", ShellCommandRunSmbiosView , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SMBIOSVIEW) ); ShellCommandRegisterCommandName(L"dmpstore", ShellCommandRunDmpStore , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMPSTORE) ); ShellCommandRegisterCommandName(L"dblk", ShellCommandRunDblk , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DBLK) ); ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) ); ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) ); ShellCommandRegisterAlias(L"dmem", L"mem"); BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1"); return (EFI_SUCCESS); }
/** Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver. **/ VOID ExportFonts ( VOID ) { EFI_HII_HANDLE HiiHandle; HiiHandle = HiiAddPackages ( &mFontPackageGuid, gImageHandle, &mFontBin, NULL ); ASSERT (HiiHandle != NULL); }
/** Standard EFI driver point. This driver parses the mSmbiosMiscDataTable structure and reports any generated data using SMBIOS protocol. @param ImageHandle Handle for the image of this driver @param SystemTable Pointer to the EFI System Table @retval EFI_SUCCESS The data was successfully stored. **/ EFI_STATUS EFIAPI SmbiosMiscEntryPoint( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { UINTN Index; EFI_STATUS EfiStatus; EFI_SMBIOS_PROTOCOL *Smbios; mImageHandle = ImageHandle; EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios); if (EFI_ERROR(EfiStatus)) { DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus)); return EfiStatus; } mHiiHandle = HiiAddPackages ( &gEfiCallerIdGuid, mImageHandle, SmbiosMiscStrings, NULL ); ASSERT (mHiiHandle != NULL); for (Index = 0; Index < mSmbiosMiscDataTableEntries; ++Index) { // // If the entry have a function pointer, just log the data. // if (mSmbiosMiscDataTable[Index].Function != NULL) { EfiStatus = (*mSmbiosMiscDataTable[Index].Function)( mSmbiosMiscDataTable[Index].RecordData, Smbios ); if (EFI_ERROR(EfiStatus)) { DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus)); return EfiStatus; } } } return EfiStatus; }
INTN EFIAPI ShellAppMain ( IN UINTN Argc, IN CHAR16 **Argv ) { EFI_GUID mStrPackageGuid = { 0xedd31def, 0xf262, 0xc24e, 0xa2, 0xe4, 0xde, 0xf7, 0xde, 0xcd, 0xcd, 0xee }; //首先注册字符串资源文件:将我们的字符串package加入到Hii数据库中 EFI_HANDLE HiiHandle = HiiAddPackages (&mStrPackageGuid , gImageHandle, exampleStrings, NULL); //通过字符串标识符访问字符串。 InitShellLib(); ShellPrintHiiEx(-1,-1,(const CHAR8*)"en-US",STRING_TOKEN (STR_LANGUAGE_SELECT), HiiHandle); TestString(HiiHandle); TestLang(HiiHandle); return 0; }
/** Constructor for the Shell AcpiView Command library. Install the handlers for acpiview UEFI Shell command. @param ImageHandle The image handle of the process. @param SystemTable The EFI System Table pointer. @retval EFI_SUCCESS The Shell command handlers were installed successfully. @retval EFI_DEVICE_ERROR Hii package failed to install. */ EFI_STATUS EFIAPI UefiShellAcpiViewCommandLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gShellAcpiViewHiiHandle = NULL; // Check Shell Profile Debug1 bit of the profiles mask if ((FixedPcdGet8 (PcdShellProfileMask) & BIT1) == 0) { return EFI_SUCCESS; } Status = RegisterAllParsers (); if (EFI_ERROR (Status)) { Print (L"acpiview: Error failed to register parser.\n"); return Status; } gShellAcpiViewHiiHandle = HiiAddPackages ( &gShellAcpiViewHiiGuid, gImageHandle, UefiShellAcpiViewCommandLibStrings, NULL ); if (gShellAcpiViewHiiHandle == NULL) { return EFI_DEVICE_ERROR; } // Install our Shell command handler ShellCommandRegisterCommandName ( L"acpiview", ShellCommandRunAcpiView, ShellCommandGetManFileNameAcpiView, 0, L"acpiview", TRUE, gShellAcpiViewHiiHandle, STRING_TOKEN (STR_GET_HELP_ACPIVIEW) ); return EFI_SUCCESS; }
/** Install the health manager forms. One will be used by BDS core to configure the Configured Required driver health instances, the other will be automatically included by firmware setup (UI). @param ImageHandle The image handle. @param SystemTable The system table. @retval EFI_SUCEESS The health manager forms are successfully installed. **/ EFI_STATUS EFIAPI InitializeDriverHealthManager ( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; EFI_HANDLE Handle; Status = gBS->LocateProtocol ( &gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mDriverHealthManagerDatabase ); ASSERT_EFI_ERROR (Status); Handle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, &gEfiDevicePathProtocolGuid, &mDriverHealthManagerFormDevicePath, &gEfiHiiConfigAccessProtocolGuid, &mDriverHealthManagerConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish Driver Health HII data. // mDriverHealthManagerHiiHandle = HiiAddPackages ( &gEfiCallerIdGuid, Handle, DriverHealthManagerVfrBin, DriverHealthConfigureVfrBin, STRING_ARRAY_NAME, NULL ); ASSERT (mDriverHealthManagerHiiHandle != NULL); return EFI_SUCCESS; }
/** Install Boot Manager Menu driver. @param ImageHandle The image handle. @param SystemTable The system table. @retval EFI_SUCEESS Install Boot manager menu success. @retval Other Return error status. **/ EFI_STATUS EFIAPI BootManagerLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; // // 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, BootManagerLibStrings, NULL ); ASSERT (gBootManagerPrivate.HiiHandle != NULL); // // Update boot manager page // UpdateBootManager (); return EFI_SUCCESS; }
EFI_STATUS EFIAPI ShellFUpdateCommandConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gShellFUpdateHiiHandle = NULL; gShellFUpdateHiiHandle = HiiAddPackages ( &gShellFUpdateHiiGuid, gImageHandle, UefiShellFUpdateCommandLibStrings, NULL ); if (gShellFUpdateHiiHandle == NULL) { Print (L"%s: Cannot add Hii package\n", CMD_NAME_STRING); return EFI_DEVICE_ERROR; } Status = ShellCommandRegisterCommandName ( CMD_NAME_STRING, ShellCommandRunFUpdate, ShellCommandGetManFileNameFUpdate, 0, CMD_NAME_STRING, TRUE, gShellFUpdateHiiHandle, STRING_TOKEN (STR_GET_HELP_FUPDATE) ); if (EFI_ERROR(Status)) { Print (L"%s: Error while registering command\n", CMD_NAME_STRING); return SHELL_ABORTED; } return EFI_SUCCESS; }
/** Constructor for the Shell Driver1 Commands library. @param ImageHandle the image handle of the process @param SystemTable the EFI System Table pointer @retval EFI_SUCCESS the shell command handlers were installed sucessfully @retval EFI_UNSUPPORTED the shell level required was not found. **/ EFI_STATUS EFIAPI UefiShellDriver1CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // check our bit of the profiles mask // if ((PcdGet8(PcdShellProfileMask) & BIT0) == 0) { return (EFI_SUCCESS); } // // install the HII stuff. // gShellDriver1HiiHandle = HiiAddPackages (&gShellDriver1HiiGuid, gImageHandle, UefiShellDriver1CommandsLibStrings, NULL); if (gShellDriver1HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers that are always installed // ShellCommandRegisterCommandName(L"connect", ShellCommandRunConnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_CONNECT) ); ShellCommandRegisterCommandName(L"devices", ShellCommandRunDevices , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVICES) ); ShellCommandRegisterCommandName(L"openinfo", ShellCommandRunOpenInfo , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_OPENINFO) ); ShellCommandRegisterCommandName(L"disconnect", ShellCommandRunDisconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DISCONNECT)); ShellCommandRegisterCommandName(L"reconnect", ShellCommandRunReconnect , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_RECONNECT) ); ShellCommandRegisterCommandName(L"unload", ShellCommandRunUnload , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_UNLOAD) ); ShellCommandRegisterCommandName(L"drvdiag", ShellCommandRunDrvDiag , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVDIAG) ); ShellCommandRegisterCommandName(L"dh", ShellCommandRunDh , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DH) ); ShellCommandRegisterCommandName(L"drivers", ShellCommandRunDrivers , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRIVERS) ); ShellCommandRegisterCommandName(L"devtree", ShellCommandRunDevTree , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DEVTREE) ); ShellCommandRegisterCommandName(L"drvcfg", ShellCommandRunDrvCfg , ShellCommandGetManFileNameDriver1, 0, L"Driver1", TRUE, gShellDriver1HiiHandle, STRING_TOKEN(STR_GET_HELP_DRVCFG) ); return (EFI_SUCCESS); }
/** Install Boot Manager Menu driver. @param ImageHandle The image handle. @param SystemTable The system table. @retval EFI_SUCEESS Install Boot manager menu success. @retval Other Return error status. **/ EFI_STATUS EFIAPI DeviceManagerUiLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gDeviceManagerPrivate.DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &gDeviceManagerPrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mDeviceManagerHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &gDeviceManagerPrivate.ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data. // gDeviceManagerPrivate.HiiHandle = HiiAddPackages ( &mDeviceManagerGuid, gDeviceManagerPrivate.DriverHandle, DeviceManagerVfrBin, DeviceManagerUiLibStrings, NULL ); ASSERT (gDeviceManagerPrivate.HiiHandle != NULL); // // Update boot manager page // CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID); return EFI_SUCCESS; }
/** 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); }
/** Constructor for the Shell Level 3 Commands library. Install the handlers for level 3 UEFI Shell 2.0 commands. @param ImageHandle the image handle of the process @param SystemTable the EFI System Table pointer @retval EFI_SUCCESS the shell command handlers were installed sucessfully @retval EFI_UNSUPPORTED the shell level required was not found. **/ EFI_STATUS EFIAPI ShellLevel3CommandsLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { gShellLevel3HiiHandle = NULL; // // if shell level is less than 3 do nothing // if (PcdGet8(PcdShellSupportLevel) < 3) { return (EFI_SUCCESS); } gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL); if (gShellLevel3HiiHandle == NULL) { return (EFI_DEVICE_ERROR); } // // install our shell command handlers that are always installed // // Note: that Time, Timezone, and Date are part of level 2 library // ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE)); ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH)); ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER)); ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS)); ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS)); ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO)); ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE)); ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC)); ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP)); ShellCommandRegisterAlias(L"type", L"cat"); return (EFI_SUCCESS); }
/** Registers HII packages for the Boot Manger to HII Database. It also registers the browser call back function. @retval EFI_SUCCESS HII packages for the Boot Manager were registered successfully. @retval EFI_OUT_OF_RESOURCES HII packages for the Boot Manager failed to be registered. **/ EFI_STATUS InitializeBootManager ( VOID ) { EFI_STATUS Status; // // Install Device Path Protocol and Config Access protocol to driver handle // Status = gBS->InstallMultipleProtocolInterfaces ( &gBootManagerPrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mBootManagerHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &gBootManagerPrivate.ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data // gBootManagerPrivate.HiiHandle = HiiAddPackages ( &gBootManagerFormSetGuid, gBootManagerPrivate.DriverHandle, BootManagerVfrBin, BdsDxeStrings, NULL ); if (gBootManagerPrivate.HiiHandle == NULL) { Status = EFI_OUT_OF_RESOURCES; } else { Status = EFI_SUCCESS; } return Status; }