diff options
Diffstat (limited to 'Core/EM/RestoreSpecialBootOptions')
-rw-r--r-- | Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c | 178 | ||||
-rw-r--r-- | Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.chm | bin | 0 -> 34662 bytes | |||
-rw-r--r-- | Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.cif | 11 | ||||
-rw-r--r-- | Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak | 73 | ||||
-rw-r--r-- | Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.sdl | 39 |
5 files changed, 301 insertions, 0 deletions
diff --git a/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c new file mode 100644 index 0000000..c34848d --- /dev/null +++ b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c @@ -0,0 +1,178 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2013, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/BIN/Modules/BootOptionPolicies/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c 3 9/10/13 8:14a Dukeyeh $ +// +// $Revision: 3 $ +// +// $Date: 9/10/13 8:14a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/BIN/Modules/BootOptionPolicies/RestoreSpecialBootOptions/RestoreSpecialBootOptions.c $ +// +// 3 9/10/13 8:14a Dukeyeh +// [TAG] EIP135544 +// [Category] Bug Fix +// [RootCause] RestoreSpecialOrphanBootOptions don't compare multi ELINK +// names +// [Solution] Change to be able to compare multi ELINKs for target boot +// options +// [Files] RestoreSpecialBootOptions.sdl +// RestoreSpecialBootOptions.chm +// RestoreSpecialBootOptions.c +// +// 2 7/12/13 12:40a Dukeyeh +// [TAG] EIP127111 +// [Category] New Feature +// [Description] 1. Initial Release +// 2. This module restores some special +// boot options that have been applied orphan boot options policy on. +// [Files] RestoreSpecialBootOptions.c +// +//********************************************************************** +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: RestoreSpecialBootOptions.c +// +// Description: Restore some special boot options. +// +//<AMI_FHDR_END> +//********************************************************************** + +#include <AmiDxeLib.h> +#include <RestoreSpecialBootOptions.h> +#include <BootOptions.h> + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: UnMaskFilePathList +// +// Description: Unmask the file path that was masked before. +// +// Input: BOOT_OPTION *Option - the boot option's file path to be unmasked +// +// Output: none +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID UnMaskFilePathList(BOOT_OPTION *Option) { + VENDOR_DEVICE_PATH *MaskedDp; + UINTN MaskedDpLength; + + MaskedDp = (VENDOR_DEVICE_PATH*)Option->FilePathList; + MaskedDpLength = DPLength(&MaskedDp->Header); + if (Option->FilePathListLength <= MaskedDpLength) return; + Option->FilePathListLength -=MaskedDpLength; + MemCpy( + Option->FilePathList, (UINT8*)Option->FilePathList+MaskedDpLength, + Option->FilePathListLength + ); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: RestoreBootOptionByPolicy +// +// Description: Restore the orphan boot option by policy. +// +// Input: DLIST *BootOptionList - the master boot option list +// BOOT_OPTION *Option - The orphaned boot option +// UINTN Policy - the policy to follow, valid values are +// ORPHAN_BOOT_OPTIONS_POLICY_DELETE +// ORPHAN_BOOT_OPTIONS_POLICY_DISABLE +// ORPHAN_BOOT_OPTIONS_POLICY_KEEP +// +// Output: none +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID RestoreBootOptionByPolicy( + DLIST *BootOptionList, BOOT_OPTION *Option, const int Policy +) { + /*if (Policy==ORPHAN_BOOT_OPTIONS_POLICY_DELETE){ + }else*/ + if (Policy==ORPHAN_BOOT_OPTIONS_POLICY_DISABLE) { + Option->Attributes |= LOAD_OPTION_ACTIVE; + } else if (Policy==ORPHAN_BOOT_OPTIONS_POLICY_HIDE) { + Option->Attributes &= ~LOAD_OPTION_HIDDEN; + UnMaskFilePathList(Option); + } +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: RestoreSpecialOrphanBootOptions +// +// Description: This function restores the target orphan boot options that +// have been applied policy on. +// +// Input: none +// +// Output: none +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID RestoreSpecialOrphanBootOptions() { + DLINK *Link; + BOOT_OPTION *Option; + CHAR16 *RestoreBootOptionsByName[] = {RESTORED_BOOT_OPTION_NAMES NULL}; + UINT8 RegisteredBootOptionNames = sizeof(RestoreBootOptionsByName)/sizeof(CHAR16*) - 1; // minus NULL + UINT8 NameIndex; + + if (0 == RegisteredBootOptionNames) + return; + + FOR_EACH_BOOT_OPTION(BootOptionList,Link,Option) { + + if (RegisteredBootOptionNames) { + + for (NameIndex = 0; NULL != RestoreBootOptionsByName[NameIndex]; NameIndex++) { + + if (!Wcscmp(Option->Description, RestoreBootOptionsByName[NameIndex])) { + + if (Option->FwBootOption) { + RestoreBootOptionByPolicy( + BootOptionList, Option, FW_ORPHAN_BOOT_OPTIONS_POLICY + ); + } + else { + RestoreBootOptionByPolicy( + BootOptionList, Option, NON_FW_ORPHAN_BOOT_OPTIONS_POLICY + ); + } + + --RegisteredBootOptionNames; + if (0 == RegisteredBootOptionNames) + return; + + break; + } + } + } + } +} + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2013, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.chm b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.chm Binary files differnew file mode 100644 index 0000000..d040ff5 --- /dev/null +++ b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.chm diff --git a/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.cif b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.cif new file mode 100644 index 0000000..eeb7736 --- /dev/null +++ b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.cif @@ -0,0 +1,11 @@ +<component> + name = "RestoreSpecialBootOptions" + category = eModule + LocalRoot = "Core\Em\RestoreSpecialBootOptions\" + RefName = "RestoreSpecialBootOptions" +[files] +"RestoreSpecialBootOptions.sdl" +"RestoreSpecialBootOptions.mak" +"RestoreSpecialBootOptions.chm" +"RestoreSpecialBootOptions.c" +<endComponent> diff --git a/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak new file mode 100644 index 0000000..c0a560e --- /dev/null +++ b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak @@ -0,0 +1,73 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2013, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/BIN/Modules/BootOptionPolicies/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak 2 7/12/13 12:42a Dukeyeh $ +# +# $Revision: 2 $ +# +# $Date: 7/12/13 12:42a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Modules/BootOptionPolicies/RestoreSpecialBootOptions/RestoreSpecialBootOptions.mak $ +# +# 2 7/12/13 12:42a Dukeyeh +# [TAG] EIP127111 +# [Category] New Feature +# [Description] Initial Release. +# [Files] RestoreSpecialBootOptions.mak +# +#********************************************************************** +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: RestoerSpecialBootOptions.mak +# +# Description: Makefile for the RestoreSpecialBootOptions component. +# +#<AMI_FHDR_END> +#********************************************************************** + +CORE_DXEBin : $(BUILD_DIR)\RestoreSpecialBootOptions.obj + +OBJ_DEPENDENCIES = \ + $(RestoreSpecialBootOptions_DIR)\RestoreSpecialBootOptions.c\ + $(BUILD_DIR)\RestoreSpecialBootOptions.h + +$(BUILD_DIR)\RestoreSpecialBootOptions.obj : $(OBJ_DEPENDENCIES) + $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(RestoreSpecialBootOptions_DIR)\RestoreSpecialBootOptions.c + +H_DEPENDENCIES = \ + $(BUILD_DIR)\Token.h\ + $(RestoreSpecialBootOptions_DIR)\RestoreSpecialBootOptions.mak + +$(BUILD_DIR)\RestoreSpecialBootOptions.h : $(H_DEPENDENCIES) + $(SILENT)type << >$(BUILD_DIR)\RestoreSpecialBootOptions.h +#define RESTORED_BOOT_OPTION_NAMES $(RESTORED_BOOT_OPTION_NAMES) +<< + +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2013, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** diff --git a/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.sdl b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.sdl new file mode 100644 index 0000000..cb6a89e --- /dev/null +++ b/Core/EM/RestoreSpecialBootOptions/RestoreSpecialBootOptions.sdl @@ -0,0 +1,39 @@ +TOKEN + Name = RestoreSpecialBootOptions_SUPPORT + Value = "1" + TokenType = Boolean + Master = Yes + Help = "Main switch to enable RestoreSpecialBootOptions support in Project" +End + +PATH + Name = "RestoreSpecialBootOptions_DIR" +End + +MODULE + Help = "Includes RestoreSpecialBootOptions.mak to Project" + File = "RestoreSpecialBootOptions.mak" +End + +ELINK + Name = "RestoreSpecialOrphanBootOptions," + Parent = "PreProcessBootOptions," + InvokeOrder = AfterParent +End + +ELINK + Name = "RESTORED_BOOT_OPTION_NAMES" + InvokeOrder = ReplaceParent +End + +ELINK + Name = 'L"USB Entry for Windows To Go",' + Parent = "RESTORED_BOOT_OPTION_NAMES" + InvokeOrder = AfterParent +End + +ELINK + Name = 'L"USB Entry for Windows To Go Logo Test",' + Parent = "RESTORED_BOOT_OPTION_NAMES" + InvokeOrder = AfterParent +End |