Author: evb
Date: Tue Feb 2 01:14:14 2010
New Revision: 45377
URL:
http://svn.reactos.org/svn/reactos?rev=45377&view=rev
Log:
- More fixes
- Plugin support for booting FreeLDR when used as initrd on QEMU command-line.
Modified:
trunk/reactos/boot/armllb/hw/serial.c
trunk/reactos/boot/armllb/hw/versatile/hwinfo.c
trunk/reactos/boot/armllb/hw/versatile/hwinit.c
trunk/reactos/boot/armllb/inc/hw.h
trunk/reactos/boot/armllb/inc/osloader.h
trunk/reactos/boot/armllb/main.c
trunk/reactos/boot/armllb/os/loader.c
Modified: trunk/reactos/boot/armllb/hw/serial.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/serial.c?re…
==============================================================================
--- trunk/reactos/boot/armllb/hw/serial.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/serial.c [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -13,7 +13,7 @@
LlbSerialPutChar(IN CHAR c)
{
/* Properly support new-lines */
- // if (c == '\n') LlbSerialPutChar('\r');
+ if (c == '\n') LlbSerialPutChar('\r');
/* Wait for ready */
while (!LlbHwUartTxReady());
Modified: trunk/reactos/boot/armllb/hw/versatile/hwinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/versatile/h…
==============================================================================
--- trunk/reactos/boot/armllb/hw/versatile/hwinfo.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/versatile/hwinfo.c [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -19,7 +19,7 @@
NTAPI
LlbHwGetPClk(VOID)
{
- return 0x24000000;
+ return 24000000;
}
ULONG
@@ -36,4 +36,26 @@
return 0;
}
+VOID
+NTAPI
+LlbHwBuildMemoryMap(IN PBIOS_MEMORY_MAP MemoryMap)
+{
+ /* For now, hard-code 128MB of RAM starting at 0x00000000 */
+ LlbAllocateMemoryEntry(BiosMemoryUsable, 0x00000000, 128 * 1024 * 1024);
+
+ /* Mark MMIO space as reserved */
+ LlbAllocateMemoryEntry(BiosMemoryReserved, 0x10000000, 128 * 1024 * 1024);
+}
+
+//
+// hwenv.c? or environment.c? or both?
+//
+PCHAR
+NTAPI
+LlbHwEnvRead(IN PCHAR Option)
+{
+ /* HACKFIX */
+ return "RAMDISK";
+}
+
/* EOF */
Modified: trunk/reactos/boot/armllb/hw/versatile/hwinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/versatile/h…
==============================================================================
--- trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -19,4 +19,16 @@
LlbHwVersaUartInitialize();
}
+//
+// Should go to hwdev.c
+//
+POSLOADER_INIT
+NTAPI
+LlbHwLoadOsLoaderFromRam(VOID)
+{
+ /* The OS Loader should have already been loaded by QEMU at the right place */
+ return (POSLOADER_INIT)0x800000;
+}
+
+
/* EOF */
Modified: trunk/reactos/boot/armllb/inc/hw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/inc/hw.h?rev=4…
==============================================================================
--- trunk/reactos/boot/armllb/inc/hw.h [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/inc/hw.h [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -80,6 +80,24 @@
VOID
);
+VOID
+NTAPI
+LlbHwBuildMemoryMap(
+ IN PBIOS_MEMORY_MAP MemoryMap
+);
+
+POSLOADER_INIT
+NTAPI
+LlbHwLoadOsLoaderFromRam(
+ VOID
+);
+
+PCHAR
+NTAPI
+LlbHwEnvRead(
+ IN PCHAR Option
+);
+
#ifdef _VERSATILE_
#include "versa.h"
#elif _OMAP3_
Modified: trunk/reactos/boot/armllb/inc/osloader.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/inc/osloader.h…
==============================================================================
--- trunk/reactos/boot/armllb/inc/osloader.h [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/inc/osloader.h [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -10,7 +10,7 @@
// OS Loader Main Routine
//
typedef
-VOID (*OSLOADER_INIT)(
+VOID (*POSLOADER_INIT)(
IN PVOID BoardInit
);
@@ -54,4 +54,42 @@
CHAR CommandLine[256];
} ARM_BOARD_CONFIGURATION_BLOCK, *PARM_BOARD_CONFIGURATION_BLOCK;
+VOID
+NTAPI
+LlbAllocateMemoryEntry(
+ IN BIOS_MEMORY_TYPE Type,
+ IN ULONG BaseAddress,
+ IN ULONG Length
+);
+
+VOID
+NTAPI
+LlbSetCommandLine(
+ IN PCHAR CommandLine
+);
+
+VOID
+NTAPI
+LlbBuildArmBlock(
+ VOID
+);
+
+VOID
+NTAPI
+LlbBuildMemoryMap(
+ VOID
+);
+
+VOID
+NTAPI
+LlbLoadOsLoader(
+ VOID
+);
+
+VOID
+NTAPI
+LlbBoot(
+ IN PCHAR CommandLine
+);
+
/* EOF */
Modified: trunk/reactos/boot/armllb/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/main.c?rev=453…
==============================================================================
--- trunk/reactos/boot/armllb/main.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/main.c [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -19,6 +19,9 @@
/* Print header */
printf("ReactOS ARM Low-Level Boot Loader [" __DATE__ " "__TIME__
"]\n");
+
+ /* Boot the OS Loader */
+ LlbBoot("");
while (TRUE);
}
Modified: trunk/reactos/boot/armllb/os/loader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/os/loader.c?re…
==============================================================================
--- trunk/reactos/boot/armllb/os/loader.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/os/loader.c [iso-8859-1] Tue Feb 2 01:14:14 2010
@@ -10,12 +10,13 @@
BIOS_MEMORY_MAP MemoryMap[32];
ARM_BOARD_CONFIGURATION_BLOCK ArmBlock;
-
+POSLOADER_INIT LoaderInit;
+
VOID
NTAPI
-AllocateMemoryEntry(IN BIOS_MEMORY_TYPE Type,
- IN ULONG BaseAddress,
- IN ULONG Length)
+LlbAllocateMemoryEntry(IN BIOS_MEMORY_TYPE Type,
+ IN ULONG BaseAddress,
+ IN ULONG Length)
{
PBIOS_MEMORY_MAP Entry;
@@ -37,6 +38,7 @@
LlbSetCommandLine(IN PCHAR CommandLine)
{
/* Copy the command line in the ARM block */
+ printf("Command Line %s\n", CommandLine);
strcpy(ArmBlock.CommandLine, CommandLine);
}
@@ -58,8 +60,76 @@
ArmBlock.TimerRegisterBase = LlbHwGetTmr0Base();
ArmBlock.UartRegisterBase = LlbHwGetUartBase(LlbHwGetSerialUart());
+ /* Debug */
+ printf("Machine Identifier: %lx\nPCLK: %d\nTIMER 0: %p\nSERIAL UART:
%p\n",
+ ArmBlock.BoardType,
+ ArmBlock.ClockRate,
+ ArmBlock.TimerRegisterBase,
+ ArmBlock.UartRegisterBase);
+
/* Now load the memory map */
ArmBlock.MemoryMap = MemoryMap;
}
+VOID
+NTAPI
+LlbBuildMemoryMap(VOID)
+{
+ /* Zero out the memory map */
+ memset(MemoryMap, 0, sizeof(MemoryMap));
+
+ /* Call the hardware-specific function */
+ LlbHwBuildMemoryMap(MemoryMap);
+}
+
+VOID
+NTAPI
+LlbLoadOsLoader(VOID)
+{
+ PCHAR BootDevice;
+
+ /* Read the current boot device */
+ BootDevice = LlbHwEnvRead("boot-device");
+ printf("Loading OS Loader from: %s...\n", BootDevice);
+ if (!strcmp(BootDevice, "NAND"))
+ {
+ // todo
+ }
+ else if (!strcmp(BootDevice, "RAMDISK"))
+ {
+ /* Call the hardware-specific function */
+ LoaderInit = LlbHwLoadOsLoaderFromRam();
+ }
+ else if (!strcmp(BootDevice, "MMC") ||
+ !strcmp(BootDevice, "SD"))
+ {
+ //todo
+ }
+ else if (!strcmp(BootDevice, "HDD"))
+ {
+ //todo
+ }
+ printf("OS Loader loaded at 0x%p...JUMP!\n", LoaderInit);
+}
+
+VOID
+NTAPI
+LlbBoot(IN PCHAR CommandLine)
+{
+ /* Setup the ARM block */
+ LlbBuildArmBlock();
+
+ /* Build the memory map */
+ LlbBuildMemoryMap();
+
+ /* Set the command-line */
+ LlbSetCommandLine(CommandLine);
+
+ /* Load the OS loader */
+ LlbLoadOsLoader();
+
+ /* Jump to the OS Loader (FreeLDR in this case) */
+ LoaderInit(&ArmBlock);
+}
+
/* EOF */