2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/freeldr/arch/arm/marcharm.c
5 * PURPOSE: Provides abstraction between the ARM Boot Loader and FreeLDR
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
12 #include <internal/arm/intrin_i.h>
14 /* GLOBALS ********************************************************************/
16 PARM_BOARD_CONFIGURATION_BLOCK ArmBoardBlock
;
17 ULONG gDiskReadBuffer
, gFileSysBuffer
;
18 BOOLEAN ArmHwDetectRan
;
19 PCONFIGURATION_COMPONENT_DATA RootNode
;
21 ULONG FirstLevelDcacheSize
;
22 ULONG FirstLevelDcacheFillSize
;
23 ULONG FirstLevelIcacheSize
;
24 ULONG FirstLevelIcacheFillSize
;
25 ULONG SecondLevelDcacheSize
;
26 ULONG SecondLevelDcacheFillSize
;
27 ULONG SecondLevelIcacheSize
;
28 ULONG SecondLevelIcacheFillSize
;
30 ARC_DISK_SIGNATURE reactos_arc_disk_info
;
31 ULONG reactos_disk_count
;
32 CHAR reactos_arc_hardware_data
[256];
50 4 // 4-way associative
57 8 // 8 words per line (32 bytes)
60 /* FUNCTIONS ******************************************************************/
63 ArmInit(IN PARM_BOARD_CONFIGURATION_BLOCK BootContext
)
65 /* Remember the pointer */
66 ArmBoardBlock
= BootContext
;
68 /* Let's make sure we understand the LLB */
69 ASSERT(ArmBoardBlock
->MajorVersion
== ARM_BOARD_CONFIGURATION_MAJOR_VERSION
);
70 ASSERT(ArmBoardBlock
->MinorVersion
== ARM_BOARD_CONFIGURATION_MINOR_VERSION
);
72 /* This should probably go away once we support more boards */
73 ASSERT((ArmBoardBlock
->BoardType
== MACH_TYPE_FEROCEON
) ||
74 (ArmBoardBlock
->BoardType
== MACH_TYPE_VERSATILE_PB
) ||
75 (ArmBoardBlock
->BoardType
== MACH_TYPE_OMAP3_BEAGLE
));
77 /* Call FreeLDR's portable entrypoint with our command-line */
78 BootMain(ArmBoardBlock
->CommandLine
);
82 ArmPrepareForReactOS(IN BOOLEAN Setup
)
88 ArmDiskGetBootPath(OUT PCHAR BootPath
,
91 PCCH Path
= "ramdisk(0)";
93 /* Make sure enough space exists */
94 if (Size
< sizeof(Path
)) return FALSE
;
96 /* On ARM platforms, the loader is always in RAM */
97 strcpy(BootPath
, Path
);
101 PCONFIGURATION_COMPONENT_DATA
104 ARM_CACHE_REGISTER CacheReg
;
106 /* Create the root node */
107 if (ArmHwDetectRan
++) return RootNode
;
108 FldrCreateSystemKey(&RootNode
);
112 * There's no such thing as "PnP" on embedded hardware.
113 * The boot loader will send us a device tree, similar to ACPI
114 * or OpenFirmware device trees, and we will convert it to ARC.
117 /* Get cache information */
118 CacheReg
= KeArmCacheRegisterGet();
119 FirstLevelDcacheSize
= SizeBits
[CacheReg
.DSize
];
120 FirstLevelDcacheFillSize
= LenBits
[CacheReg
.DLength
];
121 FirstLevelDcacheFillSize
<<= 2;
122 FirstLevelIcacheSize
= SizeBits
[CacheReg
.ISize
];
123 FirstLevelIcacheFillSize
= LenBits
[CacheReg
.ILength
];
124 FirstLevelIcacheFillSize
<<= 2;
125 SecondLevelDcacheSize
=
126 SecondLevelDcacheFillSize
=
127 SecondLevelIcacheSize
=
128 SecondLevelIcacheFillSize
= 0;
130 /* Register RAMDISK Device */
133 /* Fill out the ARC disk block */
134 reactos_arc_disk_info
.Signature
= 0xBADAB00F;
135 reactos_arc_disk_info
.CheckSum
= 0xDEADBABE;
136 reactos_arc_disk_info
.ArcName
= "ramdisk(0)";
137 reactos_disk_count
= 1;
139 /* Return the root node */
144 ArmMemGetMemoryMap(OUT PBIOS_MEMORY_MAP BiosMemoryMap
,
145 IN ULONG MaxMemoryMapSize
)
147 /* Return whatever the board returned to us (CS0 Base + Size and FLASH0) */
148 memcpy(BiosMemoryMap
,
149 ArmBoardBlock
->MemoryMap
,
150 ArmBoardBlock
->MemoryMapEntryCount
* sizeof(BIOS_MEMORY_MAP
));
151 return ArmBoardBlock
->MemoryMapEntryCount
;
155 MachInit(IN PCCH CommandLine
)
157 /* Setup board-specific ARM routines */
158 switch (ArmBoardBlock
->BoardType
)
160 /* Check for Feroceon-base boards */
161 case MACH_TYPE_FEROCEON
:
162 TuiPrintf("Not implemented\n");
166 /* Check for ARM Versatile PB boards */
167 case MACH_TYPE_VERSATILE_PB
:
169 /* Copy Machine Routines from Firmware Table */
170 MachVtbl
.ConsPutChar
= ArmBoardBlock
->ConsPutChar
;
171 MachVtbl
.ConsKbHit
= ArmBoardBlock
->ConsKbHit
;
172 MachVtbl
.ConsGetCh
= ArmBoardBlock
->ConsGetCh
;
173 MachVtbl
.VideoClearScreen
= ArmBoardBlock
->VideoClearScreen
;
174 MachVtbl
.VideoSetDisplayMode
= ArmBoardBlock
->VideoSetDisplayMode
;
175 MachVtbl
.VideoGetDisplaySize
= ArmBoardBlock
->VideoGetDisplaySize
;
176 MachVtbl
.VideoPutChar
= ArmBoardBlock
->VideoPutChar
;
177 MachVtbl
.GetTime
= ArmBoardBlock
->GetTime
;
179 /* Setup the disk and file system buffers */
180 gDiskReadBuffer
= 0x00090000;
181 gFileSysBuffer
= 0x00090000;
185 * Check for TI OMAP3 boards
186 * For now that means only Beagle, but ZOOM and others should be ok too
188 case MACH_TYPE_OMAP3_BEAGLE
:
189 TuiPrintf("Not implemented\n");
197 /* Setup generic ARM routines for all boards */
198 MachVtbl
.PrepareForReactOS
= ArmPrepareForReactOS
;
199 MachVtbl
.GetMemoryMap
= ArmMemGetMemoryMap
;
200 MachVtbl
.HwDetect
= ArmHwDetect
;
201 MachVtbl
.DiskGetBootPath
= ArmDiskGetBootPath
;