Change #defines of bios memory types to a proper enum. Makes it easier to distinguish...
authorAleksey Bragin <aleksey@reactos.org>
Sat, 23 Sep 2006 16:50:39 +0000 (16:50 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Sat, 23 Sep 2006 16:50:39 +0000 (16:50 +0000)
svn path=/trunk/; revision=24238

reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c
reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
reactos/boot/freeldr/freeldr/include/mm.h
reactos/boot/freeldr/freeldr/mm/meminit.c
reactos/boot/freeldr/freeldr/mm/mm.c
reactos/boot/freeldr/freeldr/reactos/reactos.c
reactos/boot/freeldr/freeldr/reactos/setupldr.c

index 9a85fee..a0c4d35 100644 (file)
@@ -235,11 +235,11 @@ PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
       /* Conventional memory */
       BiosMemoryMap[0].BaseAddress = 0;
       BiosMemoryMap[0].Length = PcMemGetConventionalMemorySize() * 1024;
-      BiosMemoryMap[0].Type = MEMTYPE_USABLE;
+      BiosMemoryMap[0].Type = BiosMemoryUsable;
       /* Extended memory */
       BiosMemoryMap[1].BaseAddress = 1024 * 1024;
       BiosMemoryMap[1].Length = PcMemGetExtendedMemorySize() * 1024;
-      BiosMemoryMap[1].Type = MEMTYPE_USABLE;
+      BiosMemoryMap[1].Type = BiosMemoryUsable;
       EntryCount = 2;
     }
 
index 5c19934..9efa0d3 100644 (file)
@@ -86,7 +86,7 @@ XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
       /* Available RAM block */
       BiosMemoryMap[0].BaseAddress = 0;
       BiosMemoryMap[0].Length = AvailableMemoryMb * 1024 * 1024;
-      BiosMemoryMap[0].Type = MEMTYPE_USABLE;
+      BiosMemoryMap[0].Type = BiosMemoryUsable;
       EntryCount = 1;
     }
 
@@ -95,7 +95,7 @@ XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
       /* Video memory */
       BiosMemoryMap[1].BaseAddress = AvailableMemoryMb * 1024 * 1024;
       BiosMemoryMap[1].Length = (InstalledMemoryMb - AvailableMemoryMb) * 1024 * 1024;
-      BiosMemoryMap[1].Type = MEMTYPE_RESERVED;
+      BiosMemoryMap[1].Type = BiosMemoryReserved;
       EntryCount = 2;
     }
 
index 0f33944..c79d506 100644 (file)
@@ -256,7 +256,7 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
                        ULONG MaxMemoryMapSize ) {
     printf("GetMemoryMap(chosen=%x)\n", chosen_package);
 
-    BiosMemoryMap[0].Type = MEMTYPE_USABLE;
+    BiosMemoryMap[0].Type = BiosMemoryUsable;
     BiosMemoryMap[0].BaseAddress = 0;
     BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
 
index 24fce2d..813bf2c 100644 (file)
 #ifndef __MEMORY_H
 #define __MEMORY_H
 
-
-#define        MEMTYPE_USABLE                  0x01
-#define        MEMTYPE_RESERVED                0x02
-#define MEMTYPE_ACPI_RECLAIM   0x03
-#define MEMTYPE_ACPI_NVS               0x04
+typedef enum
+{
+       BiosMemoryUsable=1,
+       BiosMemoryReserved,
+       BiosMemoryAcpiReclaim,
+       BiosMemoryAcpiNvs
+} BIOS_MEMORY_TYPE;
 
 typedef struct
 {
index 8f3668a..9fe607d 100644 (file)
@@ -27,16 +27,16 @@ typedef struct
 {
        ULONG           Type;
        UCHAR   TypeString[20];
-} MEMORY_TYPE, *PMEMORY_TYPE;
+} FREELDR_MEMORY_TYPE, *PFREELDR_MEMORY_TYPE;
 
 ULONG                          MemoryTypeCount = 5;
-MEMORY_TYPE            MemoryTypeArray[] =
+FREELDR_MEMORY_TYPE            MemoryTypeArray[] =
 {
        { 0, "Unknown Memory" },
-       { MEMTYPE_USABLE, "Usable Memory" },
-       { MEMTYPE_RESERVED, "Reserved Memory" },
-       { MEMTYPE_ACPI_RECLAIM, "ACPI Reclaim Memory" },
-       { MEMTYPE_ACPI_NVS, "ACPI NVS Memory" },
+       { BiosMemoryUsable, "Usable Memory" },
+       { BiosMemoryReserved, "Reserved Memory" },
+       { BiosMemoryAcpiReclaim, "ACPI Reclaim Memory" },
+       { BiosMemoryAcpiNvs, "ACPI NVS Memory" },
 };
 #endif
 
@@ -192,7 +192,7 @@ PVOID MmFindLocationForPageLookupTable(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG Map
        {
                // If this is usable memory with a big enough length
                // then we'll put our page lookup table here
-               if (TempBiosMemoryMap[Index].Type == MEMTYPE_USABLE && TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
+               if (TempBiosMemoryMap[Index].Type == BiosMemoryUsable && TempBiosMemoryMap[Index].Length >= PageLookupTableSize)
                {
                        PageLookupTableMemAddress = (PVOID)(ULONG)(TempBiosMemoryMap[Index].BaseAddress + (TempBiosMemoryMap[Index].Length - PageLookupTableSize));
                        break;
@@ -248,20 +248,20 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, PBIOS_ME
                MemoryMapStartPage = MmGetPageNumberFromAddress((PVOID)(ULONG)BiosMemoryMap[Index].BaseAddress);
                MemoryMapEndPage = MmGetPageNumberFromAddress((PVOID)(ULONG)(BiosMemoryMap[Index].BaseAddress + BiosMemoryMap[Index].Length - 1));
                MemoryMapPageCount = (MemoryMapEndPage - MemoryMapStartPage) + 1;
-               MemoryMapPageAllocated = (BiosMemoryMap[Index].Type == MEMTYPE_USABLE) ? 0 : BiosMemoryMap[Index].Type;
+               MemoryMapPageAllocated = (BiosMemoryMap[Index].Type == BiosMemoryUsable) ? 0 : BiosMemoryMap[Index].Type;
                DbgPrint((DPRINT_MEMORY, "Marking pages as type %d: StartPage: %d PageCount: %d\n", MemoryMapPageAllocated, MemoryMapStartPage, MemoryMapPageCount));
                MmMarkPagesInLookupTable(PageLookupTable, MemoryMapStartPage, MemoryMapPageCount, MemoryMapPageAllocated);
        }
 
        // Mark the low memory region below 1MB as reserved (256 pages in region)
        DbgPrint((DPRINT_MEMORY, "Marking the low 1MB region as reserved.\n"));
-       MmMarkPagesInLookupTable(PageLookupTable, 0, 256, MEMTYPE_RESERVED);
+       MmMarkPagesInLookupTable(PageLookupTable, 0, 256, BiosMemoryReserved);
 
        // Mark the pages that the lookup tabel occupies as reserved
        PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
        PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
        DbgPrint((DPRINT_MEMORY, "Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount));
-       MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, MEMTYPE_RESERVED);
+       MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, BiosMemoryReserved);
 }
 
 VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, ULONG PageAllocated)
@@ -414,7 +414,7 @@ VOID MmFixupSystemMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG* MapCount)
                // If the entry type isn't usable then remove
                // it from the memory map (this will help reduce
                // the size of our lookup table)
-               if (BiosMemoryMap[Index].Type != MEMTYPE_USABLE)
+               if (BiosMemoryMap[Index].Type != BiosMemoryUsable)
                {
                        // Slide every entry after this down one
                        for (Index2=Index; Index2<(*MapCount - 1); Index2++)
index d5ad60f..e1d7fcc 100644 (file)
@@ -392,13 +392,13 @@ VOID DumpMemoryAllocMap(VOID)
                case 1:
                        DbgPrint((DPRINT_MEMORY, "A"));
                        break;
-               case MEMTYPE_RESERVED:
+               case BiosMemoryReserved:
                        DbgPrint((DPRINT_MEMORY, "R"));
                        break;
-               case MEMTYPE_ACPI_RECLAIM:
+               case BiosMemoryAcpiReclaim:
                        DbgPrint((DPRINT_MEMORY, "M"));
                        break;
-               case MEMTYPE_ACPI_NVS:
+               case BiosMemoryAcpiNvs:
                        DbgPrint((DPRINT_MEMORY, "N"));
                        break;
                default:
index f76d8d2..15f0e90 100644 (file)
@@ -615,7 +615,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
                DbgPrint((DPRINT_REACTOS, "dumping memory map:\n"));
                for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
                {
-                       if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
+                       if (BiosMemoryUsable == reactos_memory_map[i].type &&
                            0 == reactos_memory_map[i].base_addr_low)
                        {
                                LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
@@ -624,7 +624,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
                                        LoaderBlock.MemLower = 640;
                                }
                        }
-                       if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
+                       if (BiosMemoryUsable == reactos_memory_map[i].type &&
                            reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
                            1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
                        {
index 369d9b8..a03b648 100644 (file)
@@ -325,7 +325,7 @@ VOID RunLoader(VOID)
       reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
       for (i = 0; i < (LoaderBlock.MmapLength / sizeof(memory_map_t)); i++)
         {
-          if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
+          if (BiosMemoryUsable == reactos_memory_map[i].type &&
               0 == reactos_memory_map[i].base_addr_low)
             {
               LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
@@ -334,7 +334,7 @@ VOID RunLoader(VOID)
                   LoaderBlock.MemLower = 640;
                 }
             }
-          if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
+          if (BiosMemoryUsable == reactos_memory_map[i].type &&
               reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
               1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
             {