We now return memory map.
authorReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Wed, 6 Feb 2008 15:47:02 +0000 (15:47 +0000)
committerReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Wed, 6 Feb 2008 15:47:02 +0000 (15:47 +0000)
We added a new member to the ARM board configuration block that specifies the number of memory map entries.
Board boot loaders are responsible for sending the base and size of all DRAM and FLASH banks. FLASH banks should be marked as Reserved so we don't try using them as RAM.

svn path=/trunk/; revision=32162

reactos/boot/freeldr/freeldr/arch/arm/stubs.c
reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h
reactos/boot/freeldr/freeldr/mm/meminit.c

index 9ac1be9..37aa9da 100644 (file)
@@ -127,8 +127,13 @@ ULONG
 ArmMemGetMemoryMap(OUT PBIOS_MEMORY_MAP BiosMemoryMap,
                    IN ULONG MaxMemoryMapSize)
 {
 ArmMemGetMemoryMap(OUT PBIOS_MEMORY_MAP BiosMemoryMap,
                    IN ULONG MaxMemoryMapSize)
 {
-    while (TRUE);
-    return FALSE;
+    //
+    // Return whatever the board returned to us (CS0 Base + Size and FLASH0)
+    //
+    RtlCopyMemory(BiosMemoryMap,
+                  ArmBoardBlock->MemoryMap,
+                  ArmBoardBlock->MemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP));
+    return ArmBoardBlock->MemoryMapEntryCount;
 }
 
 VOID
 }
 
 VOID
index 973f7e5..0118c12 100644 (file)
@@ -38,6 +38,7 @@ typedef struct _ARM_BOARD_CONFIGURATION_BLOCK
     ULONG ClockRate;
     ULONG TimerRegisterBase;
     ULONG UartRegisterBase;
     ULONG ClockRate;
     ULONG TimerRegisterBase;
     ULONG UartRegisterBase;
+    ULONG MemoryMapEntryCount;
     PBIOS_MEMORY_MAP MemoryMap;
     CHAR CommandLine[256];
 } ARM_BOARD_CONFIGURATION_BLOCK, *PARM_BOARD_CONFIGURATION_BLOCK;
     PBIOS_MEMORY_MAP MemoryMap;
     CHAR CommandLine[256];
 } ARM_BOARD_CONFIGURATION_BLOCK, *PARM_BOARD_CONFIGURATION_BLOCK;
index e6b8f00..bb87a9a 100644 (file)
@@ -106,6 +106,10 @@ BOOLEAN MmInitializeMemoryManager(VOID)
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0x90, 0x10, LoaderOsloaderHeap); // Disk read buffer for int 13h. DISKREADBUFFER
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0xA0, 0x60, LoaderFirmwarePermanent); // ROM / Video
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0xFFF, 1, LoaderSpecialMemory); // unusable memory
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0x90, 0x10, LoaderOsloaderHeap); // Disk read buffer for int 13h. DISKREADBUFFER
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0xA0, 0x60, LoaderFirmwarePermanent); // ROM / Video
        MmMarkPagesInLookupTable(PageLookupTableAddress, 0xFFF, 1, LoaderSpecialMemory); // unusable memory
+#elif __arm__
+       MmMarkPagesInLookupTable(PageLookupTableAddress, 0x00, 1, LoaderFirmwarePermanent); // arm exception handlers
+       MmMarkPagesInLookupTable(PageLookupTableAddress, 0x01, 7, LoaderFirmwareTemporary); // arm board block + freeldr stack + cmdline
+       MmMarkPagesInLookupTable(PageLookupTableAddress, 0x08, 0x70, LoaderLoadedProgram); // freeldr image (roughly max. 0x64 pages)
 #endif
 
        FreePagesInLookupTable = MmCountFreePagesInLookupTable(PageLookupTableAddress, TotalPagesInLookupTable);
 #endif
 
        FreePagesInLookupTable = MmCountFreePagesInLookupTable(PageLookupTableAddress, TotalPagesInLookupTable);