]> code.delx.au - refind/blobdiff - EfiLib/BdsHelper.c
Properly initialise variable to fix detection of non-Arch kernel versions
[refind] / EfiLib / BdsHelper.c
index b5958580e4fe52b36c52e670bfe797249263ca14..a890f7d6f627bbdc78304649f1f5ae6b9d372e60 100644 (file)
@@ -3,12 +3,25 @@
  * Functions to call legacy BIOS API.
  *
  */
+/**
+
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
 
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
 
 #include "BdsHelper.h"
 #include "legacy.h"
+#include "mystrings.h"
 #include "../refind/screen.h"
-#include "refit_call_wrapper.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 }};
 
@@ -60,7 +73,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 {
@@ -68,7 +81,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",
@@ -89,6 +106,7 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) {
 //          Print(L"%s\n", Desc);
 
    } // for
+//    PauseForKey();
 }
 
 /**