We now support the ARM Versatile/PB platform, which means qemu-system-arm -M versatil...
[reactos.git] / reactos / boot / freeldr / freeldr / arch / arm / stubs.c
1 /*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: boot/freeldr/arch/arm/stubs.c
5 * PURPOSE: Non-completed ARM hardware-specific routines
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include <freeldr.h>
12
13 /* GLOBALS ********************************************************************/
14
15 ULONG PageDirectoryStart, PageDirectoryEnd;
16
17 /* FUNCTIONS ******************************************************************/
18
19 BOOLEAN
20 ArmDiskGetDriveGeometry(IN ULONG DriveNumber,
21 OUT PGEOMETRY Geometry)
22 {
23 ASSERT(gRamDiskBase == NULL);
24 return FALSE;
25 }
26
27 BOOLEAN
28 ArmDiskReadLogicalSectors(IN ULONG DriveNumber,
29 IN ULONGLONG SectorNumber,
30 IN ULONG SectorCount,
31 IN PVOID Buffer)
32 {
33 ASSERT(gRamDiskBase == NULL);
34 return FALSE;
35 }
36
37 ULONG
38 ArmDiskGetCacheableBlockCount(IN ULONG DriveNumber)
39 {
40 ASSERT(gRamDiskBase == NULL);
41 return FALSE;
42 }
43
44 VOID
45 ArmPrepareForReactOS(IN BOOLEAN Setup)
46 {
47 while (TRUE);
48 }
49
50 PCONFIGURATION_COMPONENT_DATA
51 ArmHwDetect(VOID)
52 {
53 PCONFIGURATION_COMPONENT_DATA RootNode;
54
55 //
56 // Create the root node
57 //
58 FldrCreateSystemKey(&RootNode);
59
60 //
61 // Write null component information
62 //
63 FldrSetComponentInformation(RootNode,
64 0x0,
65 0x0,
66 0xFFFFFFFF);
67
68 //
69 // TODO:
70 // There's no such thing as "PnP" on embedded hardware.
71 // The boot loader will send us a device tree, similar to ACPI
72 // or OpenFirmware device trees, and we will convert it to ARC.
73 //
74
75 //
76 // Return the root node
77 //
78 return RootNode;
79 }
80
81 ULONG
82 ArmMemGetMemoryMap(OUT PBIOS_MEMORY_MAP BiosMemoryMap,
83 IN ULONG MaxMemoryMapSize)
84 {
85 //
86 // Return whatever the board returned to us (CS0 Base + Size and FLASH0)
87 //
88 RtlCopyMemory(BiosMemoryMap,
89 ArmBoardBlock->MemoryMap,
90 ArmBoardBlock->MemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP));
91 return ArmBoardBlock->MemoryMapEntryCount;
92 }
93
94 VOID
95 MachInit(IN PCCH CommandLine)
96 {
97 //
98 // Setup board-specific ARM routines
99 //
100 switch (ArmBoardBlock->BoardType)
101 {
102 //
103 // Check for Feroceon-base boards
104 //
105 case MACH_TYPE_FEROCEON:
106
107 //
108 // These boards use a UART16550. Set us up for 115200 bps
109 //
110 ArmFeroSerialInit(115200);
111 MachVtbl.ConsPutChar = ArmFeroPutChar;
112 MachVtbl.ConsKbHit = ArmFeroKbHit;
113 MachVtbl.ConsGetCh = ArmFeroGetCh;
114 break;
115
116 //
117 // Check for ARM Versatile PB boards
118 //
119 case MACH_TYPE_VERSATILE_PB:
120
121 //
122 // These boards use a PrimeCell UART (PL011)
123 //
124 ArmVersaSerialInit(115200);
125 MachVtbl.ConsPutChar = ArmVersaPutChar;
126 MachVtbl.ConsKbHit = ArmVersaKbHit;
127 MachVtbl.ConsGetCh = ArmVersaGetCh;
128 break;
129
130 default:
131 ASSERT(FALSE);
132 }
133
134 //
135 // Setup generic ARM routines for all boards
136 //
137 MachVtbl.PrepareForReactOS = ArmPrepareForReactOS;
138 MachVtbl.GetMemoryMap = ArmMemGetMemoryMap;
139 MachVtbl.HwDetect = ArmHwDetect;
140
141 //
142 // Setup disk I/O routines, switch to ramdisk ones for non-NAND boot
143 //
144 MachVtbl.DiskReadLogicalSectors = ArmDiskReadLogicalSectors;
145 MachVtbl.DiskGetDriveGeometry = ArmDiskGetDriveGeometry;
146 MachVtbl.DiskGetCacheableBlockCount = ArmDiskGetCacheableBlockCount;
147 RamDiskSwitchFromBios();
148
149 //
150 // Now set default disk handling routines -- we don't need to override
151 //
152 MachVtbl.DiskGetBootVolume = DiskGetBootVolume;
153 MachVtbl.DiskGetSystemVolume = DiskGetSystemVolume;
154 MachVtbl.DiskGetBootPath = DiskGetBootPath;
155 MachVtbl.DiskGetBootDevice = DiskGetBootDevice;
156 MachVtbl.DiskBootingFromFloppy = DiskBootingFromFloppy;
157 MachVtbl.DiskNormalizeSystemPath = DiskNormalizeSystemPath;
158 MachVtbl.DiskGetPartitionEntry = DiskGetPartitionEntry;
159
160 //
161 // We can now print to the console
162 //
163 TuiPrintf("%s for ARM\n", GetFreeLoaderVersionString());
164 TuiPrintf("Bootargs: %s\n", CommandLine);
165 }
166
167 VOID
168 FrLdrStartup(IN ULONG Magic)
169 {
170 while (TRUE);
171 }