Skip to content

Commit

Permalink
Loader: call BmSetMemoryTypeInformationVariable
Browse files Browse the repository at this point in the history
Note that BmSetMemoryTypeInformationVariable() is told by the loader that the image being loaded is *not* a boot application, which is a blatant lie. The reason for doing this is to prevent BmSetMemoryTypeInformationVariable() from performing a warm reset of the system due to a change in the memory type info. (Again, and again, and again...)

This is an attempt to fix S4 (hibernate) entry/resume issues; see #12.
  • Loading branch information
Mattiwatti committed May 28, 2020
1 parent b5d0353 commit 0256353
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Application/Loader/Loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ STATIC CHAR16* mDriverPaths[] = {
};


extern
EFI_STATUS
EFIAPI
BmSetMemoryTypeInformationVariable(
IN BOOLEAN Boot
);


STATIC
BOOLEAN
EFIAPI
Expand Down Expand Up @@ -511,6 +519,10 @@ TryBootOptionsInOrder(

// So again, DO NOT call this abortion:
//BmSetMemoryTypeInformationVariable((BOOLEAN)((BootOptions[Index].Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_BOOT));
//
// OK, maybe call it after all, but pretend this is *not* a boot entry, so that the system will not go into an infinite boot (reset) loop.
// This may or may not fix hibernation related issues (S4 entry/resume). See https://github.com/Mattiwatti/EfiGuard/issues/12
BmSetMemoryTypeInformationVariable(FALSE);

// Ensure the image path is connected end-to-end by Dispatch()ing any required drivers through DXE services
EfiBootManagerConnectDevicePath(BootOptions[Index].FilePath, NULL);
Expand Down

0 comments on commit 0256353

Please sign in to comment.