ReactOS  0.4.13-dev-249-gcba1a2f
macharm.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Boot Loader
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: boot/freeldr/freeldr/arch/arm/macharm.c
5  * PURPOSE: Provides abstraction between the ARM Boot Loader and FreeLDR
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <freeldr.h>
12 #include <internal/arm/intrin_i.h>
13 
14 /* GLOBALS ********************************************************************/
15 
20 
22 
31 
33 
35 {
36  -1, // INVALID
37  -1, // INVALID
38  1 << 12, // 4KB
39  1 << 13, // 8KB
40  1 << 14, // 16KB
41  1 << 15, // 32KB
42  1 << 16, // 64KB
43  1 << 17 // 128KB
44 };
45 
47 {
48  -1, // INVALID
49  -1, // INVALID
50  4 // 4-way associative
51 };
52 
54 {
55  -1, // INVALID
56  -1, // INVALID
57  8 // 8 words per line (32 bytes)
58 };
59 
60 /* FUNCTIONS ******************************************************************/
61 
63 {
64 }
65 
66 VOID
68 {
69  /* Nothing for now */
70 }
71 
72 VOID
74 {
75  /* Remember the pointer */
76  ArmBoardBlock = BootContext;
77 
78  /* Let's make sure we understand the LLB */
81 
82  /* This should probably go away once we support more boards */
87 
88  /* Call FreeLDR's portable entrypoint with our command-line */
90 }
91 
92 VOID
94 {
95  return;
96 }
97 
98 BOOLEAN
100 {
101  PCCH Path = "ramdisk(0)";
102 
103  /* Make sure enough space exists */
104  if (Size < sizeof(Path)) return FALSE;
105 
106  /* On ARM platforms, the loader is always in RAM */
107  strcpy(BootPath, Path);
108  return TRUE;
109 }
110 
113 {
114  ARM_CACHE_REGISTER CacheReg;
115 
116  /* Create the root node */
117  if (ArmHwDetectRan++) return RootNode;
119 
120  /*
121  * TODO:
122  * There's no such thing as "PnP" on embedded hardware.
123  * The boot loader will send us a device tree, similar to ACPI
124  * or OpenFirmware device trees, and we will convert it to ARC.
125  */
126 
127  /* Get cache information */
128  CacheReg = KeArmCacheRegisterGet();
129  FirstLevelDcacheSize = SizeBits[CacheReg.DSize];
132  FirstLevelIcacheSize = SizeBits[CacheReg.ISize];
139 
140  /* Register RAMDISK Device */
142 
143  /* Fill out the ARC disk block */
144  AddReactOSArcDiskInfo("ramdisk(0)", 0xBADAB00F, 0xDEADBABE, TRUE);
146 
147  /* Return the root node */
148  return RootNode;
149 }
150 
151 BOOLEAN
153 {
154  /* Emulate old behavior */
155  return (ArmHwDetect() != NULL);
156 }
157 
159 
161 ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize)
162 {
163  ULONG i;
165 
166  /* Return whatever the board returned to us (CS0 Base + Size and FLASH0) */
167  for (i = 0; i < ArmBoardBlock->MemoryMapEntryCount; i++)
168  {
173  else
175  }
176 
177  *MemoryMapSize = ArmBoardBlock->MemoryMapEntryCount;
178 
179  // FIXME
180  return NULL;
181 }
182 
183 VOID
185 {
186  /* UNIMPLEMENTED */
187 }
188 
189 VOID
190 MachInit(IN PCCH CommandLine)
191 {
192  /* Copy Machine Routines from Firmware Table */
201 
202  /* Setup board-specific ARM routines */
203  switch (ArmBoardBlock->BoardType)
204  {
205  /* Check for Feroceon-base boards */
206  case MACH_TYPE_FEROCEON:
207  TuiPrintf("Not implemented\n");
208  while (TRUE);
209  break;
210 
211  /* Check for TI OMAP3 ZOOM-II MDK */
213 
214  /* Setup the disk and file system buffers */
215  gDiskReadBuffer = 0x81094000;
216  gFileSysBuffer = 0x81094000;
217  break;
218 
219  /* Check for ARM Versatile PB boards */
221 
222  /* Setup the disk and file system buffers */
223  gDiskReadBuffer = 0x00090000;
224  gFileSysBuffer = 0x00090000;
225  break;
226 
227  /* Check for TI OMAP3 Beagleboard */
229  TuiPrintf("Not implemented\n");
230  while (TRUE);
231  break;
232 
233  default:
234  ASSERT(FALSE);
235  }
236 
237  /* Setup generic ARM routines for all boards */
244 }
signed char * PCHAR
Definition: retypes.h:7
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:62
#define IN
Definition: typedefs.h:38
FORCEINLINE ARM_CACHE_REGISTER KeArmCacheRegisterGet(VOID)
Definition: intrin_i.h:109
#define TRUE
Definition: types.h:120
int TuiPrintf(const char *format,...)
Definition: tui.c:31
ULONG FirstLevelIcacheSize
Definition: macharm.c:25
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:816
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PFREELDR_MEMORY_DESCRIPTOR ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize)
Definition: macharm.c:161
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:75
TYPE_OF_MEMORY MemoryType
Definition: mm.h:38
BOOLEAN(* DiskGetBootPath)(PCHAR BootPath, ULONG Size)
Definition: machine.h:64
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
ULONG FirstLevelDcacheSize
Definition: macharm.c:23
PARM_BOARD_CONFIGURATION_BLOCK ArmBoardBlock
Definition: macharm.c:16
#define ARM_BOARD_CONFIGURATION_MAJOR_VERSION
Definition: osloader.h:42
BOOLEAN ArmDiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size)
Definition: macharm.c:99
ULONG SecondLevelDcacheSize
Definition: macharm.c:27
FREELDR_MEMORY_DESCRIPTOR ArmMemoryMap[32]
Definition: macharm.c:158
void BootMain(LPSTR CmdLine)
VOID ArmHwIdle(VOID)
Definition: macharm.c:184
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONGLONG BaseAddress
Definition: osloader.h:33
ULONG SizeBits[]
Definition: macharm.c:34
#define ARM_BOARD_CONFIGURATION_MINOR_VERSION
Definition: osloader.h:43
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define MACH_TYPE_OMAP3_BEAGLE
Definition: machtype.h:25
ULONG SecondLevelDcacheFillSize
Definition: macharm.c:28
PCONFIGURATION_COMPONENT_DATA ArmHwDetect(VOID)
Definition: macharm.c:112
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:70
PFN_NUMBER BasePage
Definition: mm.h:39
#define MACH_TYPE_OMAP_ZOOM2
Definition: machtype.h:30
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:74
CONST CHAR * PCCH
Definition: ntbasedef.h:399
VOID FrLdrCheckCpuCompatibility(VOID)
Definition: macharm.c:67
BOOLEAN ArmHwDetectRan
Definition: macharm.c:18
VOID MachInit(IN PCCH CommandLine)
Definition: macharm.c:190
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG gFileSysBuffer
Definition: macharm.c:17
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:51
VOID NTAPI RamDiskInitialize(VOID)
Definition: ramdisk.c:113
#define MACH_TYPE_FEROCEON
Definition: machtype.h:13
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
Definition: archwsup.c:29
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID ArmPrepareForReactOS(IN BOOLEAN Setup)
Definition: macharm.c:93
ULONG FirstLevelDcacheFillSize
Definition: macharm.c:24
int(* ConsGetCh)(VOID)
Definition: machine.h:43
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
PRTL_UNICODE_STRING_BUFFER Path
VOID(* HwIdle)(VOID)
Definition: machine.h:76
PBIOS_MEMORY_MAP MemoryMap
Definition: osloader.h:53
ULONG SecondLevelIcacheSize
Definition: macharm.c:29
BOOLEAN ArmInitializeBootDevices(VOID)
Definition: macharm.c:152
ULONG reactos_disk_count
Definition: archwsup.c:20
#define OUT
Definition: typedefs.h:39
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
ULONG gDiskReadBuffer
Definition: macharm.c:17
unsigned int ULONG
Definition: retypes.h:1
ULONG AssocBits[]
Definition: macharm.c:46
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
BOOLEAN AcpiPresent
Definition: macharm.c:21
#define MACH_TYPE_VERSATILE_PB
Definition: machtype.h:19
MACHVTBL MachVtbl
Definition: machine.c:21
ULONG FirstLevelIcacheFillSize
Definition: macharm.c:26
LONGLONG Length
Definition: osloader.h:34
VOID ArmInit(IN PARM_BOARD_CONFIGURATION_BLOCK BootContext)
Definition: macharm.c:73
ULONG SecondLevelIcacheFillSize
Definition: macharm.c:30
ULONG LenBits[]
Definition: macharm.c:53
char BootPath[0x100]
Definition: mach.c:35
VOID(* PrepareForReactOS)(IN BOOLEAN Setup)
Definition: machine.h:58
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
PFN_NUMBER PageCount
Definition: mm.h:40
VOID DiskStopFloppyMotor(VOID)
Definition: macharm.c:62