1 /* 2 * PROJECT: ReactOS Boot Loader 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: boot/armllb/hw/versatile/hwinfo.c 5 * PURPOSE: LLB Hardware Info Routines 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 #include "precomp.h" 10 11 #define PL031_RTC_DR (LlbHwVersaRtcBase + 0x00) 12 static const ULONG LlbHwVersaRtcBase = 0x101E8000; 13 14 ULONG 15 NTAPI 16 LlbHwGetBoardType(VOID) 17 { 18 return MACH_TYPE_VERSATILE_PB; 19 } 20 21 ULONG 22 NTAPI 23 LlbHwGetPClk(VOID) 24 { 25 return 24000000; 26 } 27 28 ULONG 29 NTAPI 30 LlbHwGetTmr0Base(VOID) 31 { 32 return 0x101E2000; 33 } 34 35 ULONG 36 NTAPI 37 LlbHwGetSerialUart(VOID) 38 { 39 return 0; 40 } 41 42 // 43 // Versatile Memory Map 44 // 45 // 0x00000000 - 0x000000FF ARM Vectors [ 1 KB] 46 // 0x00000100 - 0x000001FF ATAG Structures [ 1 KB] 47 // 0x00000200 - 0x0000FFFF ARM STACK [ 62 KB] 48 // 0x00010000 - 0x0001FFFF ARM LLB [ 64 KB] 49 // 0x00020000 - 0x0009FFFF ARM OS LOADER [512 KB] 50 // 0x000A0000 - 0x0013FFFF ARM FRAMEBUFFER [640 KB] 51 // 0x00140000 - 0x007FFFFF OS LOADER FREE/UNUSED [ 6 MB] 52 // 0x00800000 - 0x017FFFFF KERNEL, HAL, INITIAL DRIVER LOAD ADDR [ 16 MB] 53 // 0x01800000 - 0x037FFFFF RAM DISK [ 32 MB] 54 // 0x03800000 - 0x07FFFFFF FREE RAM [ 72 MB] 55 // 0x08000000 - 0x0FFFFFFF FREE RAM IF 256MB DEVICE [128 MB] 56 // 0x10000000 - 0x1FFFFFFF MMIO DEVICES [256 MB] 57 BIOS_MEMORY_MAP LlbHwVersaMemoryMap[] = 58 { 59 {0x00000000, 0x00000100, BiosMemoryReserved, 0}, 60 {0x00000100, 0x00000100, BiosMemoryBootStrap, 0}, 61 {0x00000200, 0x0000FE00, BiosMemoryBootStrap, 0}, 62 {0x00010000, 0x00010000, BiosMemoryBootStrap, 0}, 63 {0x00020000, 0x00080000, BiosMemoryBootLoader, 0}, 64 {0x000A0000, 0x000A0000, BiosMemoryBootLoader, 0}, 65 {0x00140000, 0x016C0000, BiosMemoryUsable, 0}, 66 {0x01800000, 0x02000000, BiosMemoryReserved, 0}, 67 {0x10000000, 0x10000000, BiosMemoryReserved, 0}, 68 {0, 0, 0, 0} 69 }; 70 71 VOID 72 NTAPI 73 LlbHwBuildMemoryMap(IN PBIOS_MEMORY_MAP MemoryMap) 74 { 75 PBIOS_MEMORY_MAP MapEntry; 76 ULONG Base, Size, FsBase, FsSize; 77 78 /* Parse hardware memory map */ 79 MapEntry = LlbHwVersaMemoryMap; 80 while (MapEntry->Length) 81 { 82 /* Add this entry */ 83 LlbAllocateMemoryEntry(MapEntry->Type, MapEntry->BaseAddress, MapEntry->Length); 84 85 /* Move to the next one */ 86 MapEntry++; 87 } 88 89 /* Query memory and RAMDISK information */ 90 LlbEnvGetMemoryInformation(&Base, &Size); 91 LlbEnvGetRamDiskInformation(&FsBase, &FsSize); 92 93 /* Add-in the size of the ramdisk */ 94 Base = FsBase + FsSize; 95 96 /* Subtract size of ramdisk and anything else before it */ 97 Size -= Base; 98 99 /* Allocate an entry for it */ 100 LlbAllocateMemoryEntry(BiosMemoryUsable, Base, Size); 101 } 102 103 ULONG 104 LlbHwRtcRead(VOID) 105 { 106 /* Read RTC value */ 107 return READ_REGISTER_ULONG(PL031_RTC_DR); 108 } 109 /* EOF */ 110