]> code.delx.au - refind/commitdiff
Moved ExtractLegacyLoaderPaths() from lib.c to legacy.c
authorsrs5694 <srs5694@users.sourceforge.net>
Wed, 16 Sep 2015 15:34:08 +0000 (11:34 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Wed, 16 Sep 2015 15:34:08 +0000 (11:34 -0400)
refind/legacy.c
refind/lib.c
refind/lib.h
refind/main.c

index be79259b04066e2a5aec316429b1bd1637c642ec..10dfc5e2fc09d9bba94c8acfc7ac56eb6312d0f7 100644 (file)
 #include "syslinux_mbr.h"
 #include "../EfiLib/BdsHelper.h"
 #include "../EfiLib/legacy.h"
 #include "syslinux_mbr.h"
 #include "../EfiLib/BdsHelper.h"
 #include "../EfiLib/legacy.h"
+#include "Handle.h"
 
 extern REFIT_MENU_ENTRY MenuEntryReturn;
 extern REFIT_MENU_SCREEN MainMenu;
 
 
 extern REFIT_MENU_ENTRY MenuEntryReturn;
 extern REFIT_MENU_SCREEN MainMenu;
 
+#ifndef __MAKEWITH_GNUEFI
+#define LibLocateHandle gBS->LocateHandleBuffer
+#define DevicePathProtocol gEfiDevicePathProtocolGuid
+#endif
+
 static EFI_STATUS ActivateMbrPartition(IN EFI_BLOCK_IO *BlockIO, IN UINTN PartitionIndex)
 {
     EFI_STATUS          Status;
 static EFI_STATUS ActivateMbrPartition(IN EFI_BLOCK_IO *BlockIO, IN UINTN PartitionIndex)
 {
     EFI_STATUS          Status;
@@ -168,6 +174,82 @@ static EFI_STATUS WriteBootDiskHint(IN EFI_DEVICE_PATH *WholeDiskDevicePath)
    return EFI_SUCCESS;
 }
 
    return EFI_SUCCESS;
 }
 
+//
+// firmware device path discovery
+//
+
+static UINT8 LegacyLoaderMediaPathData[] = {
+    0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+    0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+    0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+static EFI_DEVICE_PATH *LegacyLoaderMediaPath = (EFI_DEVICE_PATH *)LegacyLoaderMediaPathData;
+
+static VOID ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, EFI_DEVICE_PATH **HardcodedPathList)
+{
+    EFI_STATUS          Status;
+    UINTN               HandleCount = 0;
+    UINTN               HandleIndex, HardcodedIndex;
+    EFI_HANDLE          *Handles;
+    EFI_HANDLE          Handle;
+    UINTN               PathCount = 0;
+    UINTN               PathIndex;
+    EFI_LOADED_IMAGE    *LoadedImage;
+    EFI_DEVICE_PATH     *DevicePath;
+    BOOLEAN             Seen;
+
+    MaxPaths--;  // leave space for the terminating NULL pointer
+
+    // get all LoadedImage handles
+    Status = LibLocateHandle(ByProtocol, &LoadedImageProtocol, NULL, &HandleCount, &Handles);
+    if (CheckError(Status, L"while listing LoadedImage handles")) {
+        if (HardcodedPathList) {
+            for (HardcodedIndex = 0; HardcodedPathList[HardcodedIndex] && PathCount < MaxPaths; HardcodedIndex++)
+                PathList[PathCount++] = HardcodedPathList[HardcodedIndex];
+        }
+        PathList[PathCount] = NULL;
+        return;
+    }
+    for (HandleIndex = 0; HandleIndex < HandleCount && PathCount < MaxPaths; HandleIndex++) {
+        Handle = Handles[HandleIndex];
+
+        Status = refit_call3_wrapper(BS->HandleProtocol, Handle, &LoadedImageProtocol, (VOID **) &LoadedImage);
+        if (EFI_ERROR(Status))
+            continue;  // This can only happen if the firmware scewed up, ignore it.
+
+        Status = refit_call3_wrapper(BS->HandleProtocol, LoadedImage->DeviceHandle, &DevicePathProtocol, (VOID **) &DevicePath);
+        if (EFI_ERROR(Status))
+            continue;  // This happens, ignore it.
+
+        // Only grab memory range nodes
+        if (DevicePathType(DevicePath) != HARDWARE_DEVICE_PATH || DevicePathSubType(DevicePath) != HW_MEMMAP_DP)
+            continue;
+
+        // Check if we have this device path in the list already
+        // WARNING: This assumes the first node in the device path is unique!
+        Seen = FALSE;
+        for (PathIndex = 0; PathIndex < PathCount; PathIndex++) {
+            if (DevicePathNodeLength(DevicePath) != DevicePathNodeLength(PathList[PathIndex]))
+                continue;
+            if (CompareMem(DevicePath, PathList[PathIndex], DevicePathNodeLength(DevicePath)) == 0) {
+                Seen = TRUE;
+                break;
+            }
+        }
+        if (Seen)
+            continue;
+
+        PathList[PathCount++] = AppendDevicePath(DevicePath, LegacyLoaderMediaPath);
+    }
+    MyFreePool(Handles);
+
+    if (HardcodedPathList) {
+        for (HardcodedIndex = 0; HardcodedPathList[HardcodedIndex] && PathCount < MaxPaths; HardcodedIndex++)
+            PathList[PathCount++] = HardcodedPathList[HardcodedIndex];
+    }
+    PathList[PathCount] = NULL;
+} /* VOID ExtractLegacyLoaderPaths() */
+
 // early 2006 Core Duo / Core Solo models
 static UINT8 LegacyLoaderDevicePath1Data[] = {
     0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
 // early 2006 Core Duo / Core Solo models
 static UINT8 LegacyLoaderDevicePath1Data[] = {
     0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
index 6bf2d5d2dc96c3d709818626cf33c288b880b7d7..15132ad9763ce66f65ec7ebd68948e09ba86eb0a 100644 (file)
@@ -339,82 +339,6 @@ VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount)
     }
 } // VOID FreeList()
 
     }
 } // VOID FreeList()
 
-//
-// firmware device path discovery
-//
-
-static UINT8 LegacyLoaderMediaPathData[] = {
-    0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
-    0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
-    0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
-};
-static EFI_DEVICE_PATH *LegacyLoaderMediaPath = (EFI_DEVICE_PATH *)LegacyLoaderMediaPathData;
-
-VOID ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, EFI_DEVICE_PATH **HardcodedPathList)
-{
-    EFI_STATUS          Status;
-    UINTN               HandleCount = 0;
-    UINTN               HandleIndex, HardcodedIndex;
-    EFI_HANDLE          *Handles;
-    EFI_HANDLE          Handle;
-    UINTN               PathCount = 0;
-    UINTN               PathIndex;
-    EFI_LOADED_IMAGE    *LoadedImage;
-    EFI_DEVICE_PATH     *DevicePath;
-    BOOLEAN             Seen;
-
-    MaxPaths--;  // leave space for the terminating NULL pointer
-
-    // get all LoadedImage handles
-    Status = LibLocateHandle(ByProtocol, &LoadedImageProtocol, NULL, &HandleCount, &Handles);
-    if (CheckError(Status, L"while listing LoadedImage handles")) {
-        if (HardcodedPathList) {
-            for (HardcodedIndex = 0; HardcodedPathList[HardcodedIndex] && PathCount < MaxPaths; HardcodedIndex++)
-                PathList[PathCount++] = HardcodedPathList[HardcodedIndex];
-        }
-        PathList[PathCount] = NULL;
-        return;
-    }
-    for (HandleIndex = 0; HandleIndex < HandleCount && PathCount < MaxPaths; HandleIndex++) {
-        Handle = Handles[HandleIndex];
-
-        Status = refit_call3_wrapper(BS->HandleProtocol, Handle, &LoadedImageProtocol, (VOID **) &LoadedImage);
-        if (EFI_ERROR(Status))
-            continue;  // This can only happen if the firmware scewed up, ignore it.
-
-        Status = refit_call3_wrapper(BS->HandleProtocol, LoadedImage->DeviceHandle, &DevicePathProtocol, (VOID **) &DevicePath);
-        if (EFI_ERROR(Status))
-            continue;  // This happens, ignore it.
-
-        // Only grab memory range nodes
-        if (DevicePathType(DevicePath) != HARDWARE_DEVICE_PATH || DevicePathSubType(DevicePath) != HW_MEMMAP_DP)
-            continue;
-
-        // Check if we have this device path in the list already
-        // WARNING: This assumes the first node in the device path is unique!
-        Seen = FALSE;
-        for (PathIndex = 0; PathIndex < PathCount; PathIndex++) {
-            if (DevicePathNodeLength(DevicePath) != DevicePathNodeLength(PathList[PathIndex]))
-                continue;
-            if (CompareMem(DevicePath, PathList[PathIndex], DevicePathNodeLength(DevicePath)) == 0) {
-                Seen = TRUE;
-                break;
-            }
-        }
-        if (Seen)
-            continue;
-
-        PathList[PathCount++] = AppendDevicePath(DevicePath, LegacyLoaderMediaPath);
-    }
-    MyFreePool(Handles);
-
-    if (HardcodedPathList) {
-        for (HardcodedIndex = 0; HardcodedPathList[HardcodedIndex] && PathCount < MaxPaths; HardcodedIndex++)
-            PathList[PathCount++] = HardcodedPathList[HardcodedIndex];
-    }
-    PathList[PathCount] = NULL;
-}
-
 //
 // volume functions
 //
 //
 // volume functions
 //
index a148f6abf8b7db6cdcfa90e90061bb69fc6df7e7..841d1b93fc40edb6ba7316ed0045eae69a46b616 100644 (file)
@@ -101,8 +101,6 @@ VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialEl
 VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement);
 VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount);
 
 VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement);
 VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount);
 
-VOID ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, EFI_DEVICE_PATH **HardcodedPathList);
-
 VOID SetVolumeBadgeIcon(REFIT_VOLUME *Volume);
 VOID ScanVolumes(VOID);
 
 VOID SetVolumeBadgeIcon(REFIT_VOLUME *Volume);
 VOID ScanVolumes(VOID);
 
index f674ecf318cc891f1b3b7f265a8c36dfe1757675..a3c51519d349af8ab747cea43597b64393143d22 100644 (file)
@@ -173,7 +173,7 @@ static VOID AboutrEFInd(VOID)
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.9.1.1");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.9.1.2");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith");