X-Git-Url: https://code.delx.au/refind/blobdiff_plain/b8b1a02cc8cd3519503b2731af83231bdeed689c..346735a39ca8b64c8278ba342a633b5acce0159b:/EfiLib/BdsHelper.c diff --git a/EfiLib/BdsHelper.c b/EfiLib/BdsHelper.c index 40f4483..47ecf9a 100644 --- a/EfiLib/BdsHelper.c +++ b/EfiLib/BdsHelper.c @@ -8,6 +8,8 @@ #include "BdsHelper.h" #include "legacy.h" #include "../refind/screen.h" +#include "../refind/lib.h" +#include "../include/refit_call_wrapper.h" EFI_GUID gEfiLegacyBootProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d }}; @@ -38,13 +40,13 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { BBS_BBS_DEVICE_PATH *OptionBBS; CHAR16 Desc[100]; - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status) || (Option == NULL)) { return; } OptionBBS = (BBS_BBS_DEVICE_PATH *) Option->DevicePath; - Status = LegacyBios->GetBbsInfo (LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); + Status = refit_call5_wrapper(LegacyBios->GetBbsInfo, LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); // Print (L"\n"); // Print (L" NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"); @@ -59,7 +61,7 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { // Set devices of a particular type to BootPriority of 0 or 1. 0 is the highest priority. if (LocalBbsTable[Idx].DeviceType == OptionBBS->DeviceType) { - if (StriCmp(Desc, Option->Description) == 0) { + if (MyStriCmp(Desc, Option->Description)) { // This entry exactly matches what we're looking for; make it highest priority LocalBbsTable[Idx].BootPriority = 0; } else { @@ -67,7 +69,11 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { // in priority. Done mainly as a fallback in case of string-matching weirdness. LocalBbsTable[Idx].BootPriority = 1; } // if/else - } // if + } else if (LocalBbsTable[Idx].BootPriority <= 1) { + // Something's got a high enough boot priority to interfere with booting + // our chosen entry, so bump it down a bit.... + LocalBbsTable[Idx].BootPriority = 2; + } // if/else if // Print ( // L" %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n", @@ -88,6 +94,7 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { // Print(L"%s\n", Desc); } // for +// PauseForKey(); } /** @@ -108,13 +115,13 @@ BdsLibDoLegacyBoot ( EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } UpdateBbsTable(Option); - return LegacyBios->LegacyBoot(LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, + return refit_call4_wrapper(LegacyBios->LegacyBoot, LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, Option->LoadOptionsSize, Option->LoadOptions); }