Skip to content

Commit

Permalink
OcBootManagementLib: Workaround setting Boot0000 causing ASUS FW issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Dec 3, 2020
1 parent 1f2982b commit cc6aa31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Library/OcBootManagementLib/DefaultEntryChoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,12 @@ InternalRegisterBootstrapBootOption (
// Find the lowest unused Boot#### index. In the absolutely unrealistic case
// that all entries are occupied, always overwrite BootFFFF.
//
for (BootOptionIndex = 0; BootOptionIndex < 0xFFFF; ++BootOptionIndex) {
// Boot0000 is reserved on ASUS boards and is treated like a deleted entry.
// Setting Boot0000 will essentially cause entries to duplicate and eventual
// BIOS brick as ASUS boards simply zero removed boot entries instead of
// shrinking BootOrder size. Reproduced on ASUS ROG STRIX Z370-F GAMING.
//
for (BootOptionIndex = 1; BootOptionIndex < 0xFFFF; ++BootOptionIndex) {
for (OrderIndex = 0; OrderIndex < BootOrderSize / sizeof (*BootOrder); ++OrderIndex) {
if (BootOrder[OrderIndex + 1] == BootOptionIndex) {
break;
Expand Down
4 changes: 2 additions & 2 deletions Library/OcBootManagementLib/VariableManagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ OcDeleteVariables (
DeleteVariables ();

if ((BootProtect & OC_BOOT_PROTECT_VARIABLE_BOOTSTRAP) != 0) {
BootOptionIndex = 0;
BootOptionIndex = 1;
Status = gRT->SetVariable (
L"Boot0000",
L"Boot0001",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
BootOptionSize,
Expand Down

0 comments on commit cc6aa31

Please sign in to comment.