Author: tkreuzer
Date: Sun Feb 17 14:46:42 2013
New Revision: 58334
URL:
http://svn.reactos.org/svn/reactos?rev=58334&view=rev
Log:
[FREELDR]
Split HwDetect() into 2 functions. InitializeBootDevices() and HwDetect(). This way we
don't do the stuff twice.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
trunk/reactos/boot/freeldr/freeldr/bootmgr.c
trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h
trunk/reactos/boot/freeldr/freeldr/include/machine.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Sun Feb 17 14:46:42
2013
@@ -28,7 +28,7 @@
ULONG SecondLevelDcacheFillSize;
ULONG SecondLevelIcacheSize;
ULONG SecondLevelIcacheFillSize;
-
+
ARC_DISK_SIGNATURE reactos_arc_disk_info;
ULONG reactos_disk_count;
CHAR reactos_arc_hardware_data[256];
@@ -66,11 +66,11 @@
{
/* Remember the pointer */
ArmBoardBlock = BootContext;
-
+
/* Let's make sure we understand the LLB */
ASSERT(ArmBoardBlock->MajorVersion == ARM_BOARD_CONFIGURATION_MAJOR_VERSION);
ASSERT(ArmBoardBlock->MinorVersion == ARM_BOARD_CONFIGURATION_MINOR_VERSION);
-
+
/* This should probably go away once we support more boards */
ASSERT((ArmBoardBlock->BoardType == MACH_TYPE_FEROCEON) ||
(ArmBoardBlock->BoardType == MACH_TYPE_VERSATILE_PB) ||
@@ -92,33 +92,40 @@
IN unsigned Size)
{
PCCH Path = "ramdisk(0)";
-
+
/* Make sure enough space exists */
if (Size < sizeof(Path)) return FALSE;
-
+
/* On ARM platforms, the loader is always in RAM */
strcpy(BootPath, Path);
return TRUE;
}
+BOOLEAN
+ArmInitializeBootDevices(VOID)
+{
+ /* Emulate old behavior */
+ return ArmHwDetect != NULL;
+}
+
PCONFIGURATION_COMPONENT_DATA
ArmHwDetect(VOID)
{
ARM_CACHE_REGISTER CacheReg;
-
+
/* Create the root node */
if (ArmHwDetectRan++) return RootNode;
FldrCreateSystemKey(&RootNode);
-
+
/*
* TODO:
* There's no such thing as "PnP" on embedded hardware.
* The boot loader will send us a device tree, similar to ACPI
* or OpenFirmware device trees, and we will convert it to ARC.
*/
-
+
/* Get cache information */
- CacheReg = KeArmCacheRegisterGet();
+ CacheReg = KeArmCacheRegisterGet();
FirstLevelDcacheSize = SizeBits[CacheReg.DSize];
FirstLevelDcacheFillSize = LenBits[CacheReg.DLength];
FirstLevelDcacheFillSize <<= 2;
@@ -129,16 +136,16 @@
SecondLevelDcacheFillSize =
SecondLevelIcacheSize =
SecondLevelIcacheFillSize = 0;
-
+
/* Register RAMDISK Device */
RamDiskInitialize();
-
+
/* Fill out the ARC disk block */
reactos_arc_disk_info.Signature = 0xBADAB00F;
reactos_arc_disk_info.CheckSum = 0xDEADBABE;
reactos_arc_disk_info.ArcName = "ramdisk(0)";
reactos_disk_count = 1;
-
+
/* Return the root node */
return RootNode;
}
@@ -182,7 +189,7 @@
MachVtbl.VideoGetDisplaySize = ArmBoardBlock->VideoGetDisplaySize;
MachVtbl.VideoPutChar = ArmBoardBlock->VideoPutChar;
MachVtbl.GetTime = ArmBoardBlock->GetTime;
-
+
/* Setup board-specific ARM routines */
switch (ArmBoardBlock->BoardType)
{
@@ -194,33 +201,34 @@
/* Check for TI OMAP3 ZOOM-II MDK */
case MACH_TYPE_OMAP_ZOOM2:
-
+
/* Setup the disk and file system buffers */
gDiskReadBuffer = 0x81094000;
gFileSysBuffer = 0x81094000;
break;
-
+
/* Check for ARM Versatile PB boards */
case MACH_TYPE_VERSATILE_PB:
-
+
/* Setup the disk and file system buffers */
gDiskReadBuffer = 0x00090000;
gFileSysBuffer = 0x00090000;
break;
-
+
/* Check for TI OMAP3 Beagleboard */
case MACH_TYPE_OMAP3_BEAGLE:
TuiPrintf("Not implemented\n");
while (TRUE);
break;
-
+
default:
ASSERT(FALSE);
}
-
+
/* Setup generic ARM routines for all boards */
MachVtbl.PrepareForReactOS = ArmPrepareForReactOS;
MachVtbl.GetMemoryMap = ArmMemGetMemoryMap;
+ MachVtbl.InitializeBootDevices = ArmInitializeBootDevices;
MachVtbl.HwDetect = ArmHwDetect;
MachVtbl.DiskGetBootPath = ArmDiskGetBootPath;
MachVtbl.HwIdle = ArmHwIdle;
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Feb 17
14:46:42 2013
@@ -95,7 +95,7 @@
GetHarddiskIdentifier(
UCHAR DriveNumber);
-VOID
+BOOLEAN
HwInitializeBiosDisks(VOID);
/* FUNCTIONS ****************************************************************/
@@ -1721,6 +1721,11 @@
/* FIXME: Detect more ISA devices */
}
+BOOLEAN
+PcInitializeBootDevices(VOID)
+{
+ return HwInitializeBiosDisks();
+}
PCONFIGURATION_COMPONENT_DATA
PcHwDetect(VOID)
@@ -1729,8 +1734,6 @@
ULONG BusNumber = 0;
TRACE("DetectHardware()\n");
-
- HwInitializeBiosDisks();
/* Create the 'System' key */
SystemKey = DetectSystem();
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] Sun Feb 17 14:46:42
2013
@@ -269,7 +269,7 @@
}
-VOID
+BOOLEAN
HwInitializeBiosDisks(VOID)
{
UCHAR DiskCount, DriveNumber;
@@ -331,7 +331,7 @@
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1,
(PVOID)DISKREADBUFFER))
{
ERR("Reading MBR failed\n");
- return;
+ return FALSE;
}
Buffer = (ULONG*)DISKREADBUFFER;
@@ -352,4 +352,5 @@
}
PcBiosDiskCount = DiskCount;
-}
+ return DiskCount != 0;
+}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] Sun Feb 17 14:46:42
2013
@@ -45,6 +45,7 @@
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount;
MachVtbl.GetTime = PcGetTime;
+ MachVtbl.InitializeBootDevices = PcInitializeBootDevices;
MachVtbl.HwDetect = PcHwDetect;
MachVtbl.HwIdle = PcHwIdle;
}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] Sun Feb 17
14:46:42 2013
@@ -51,6 +51,7 @@
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount;
MachVtbl.GetTime = XboxGetTime;
+ MachVtbl.InitializeBootDevices = XboxInitializeBootDevices;
MachVtbl.HwDetect = XboxHwDetect;
MachVtbl.HwIdle = XboxHwIdle;
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Sun Feb 17 14:46:42
2013
@@ -509,6 +509,13 @@
return SystemKey;
}
+BOOLEAN
+XboxInitializeBootDevices(VOID)
+{
+ // Emulate old behavior
+ return XboxHwDetect() != NULL;
+}
+
VOID XboxHwIdle(VOID)
{
/* UNIMPLEMENTED */
Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/bootm…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] Sun Feb 17 14:46:42 2013
@@ -197,8 +197,7 @@
ULONG SelectedOperatingSystem;
ULONG i;
- // FIXME: if possible, only detect and register ARC devices...
- if (!MachHwDetect())
+ if (!MachInitializeBootDevices())
{
UiMessageBoxCritical("Error when detecting hardware");
return;
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] Sun Feb
17 14:46:42 2013
@@ -57,6 +57,7 @@
TIMEINFO* XboxGetTime(VOID);
+BOOLEAN XboxInitializeBootDevices(VOID);
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID);
VOID XboxHwIdle(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] Sun Feb 17
14:46:42 2013
@@ -57,6 +57,7 @@
TIMEINFO* PcGetTime(VOID);
+BOOLEAN PcInitializeBootDevices(VOID);
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID);
VOID PcHwIdle(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Sun Feb 17 14:46:42
2013
@@ -1,4 +1,4 @@
-/*
+/*
* FreeLoader
*
* This program is free software; you can redistribute it and/or modify
@@ -68,6 +68,7 @@
TIMEINFO* (*GetTime)(VOID);
ULONG (*GetRelativeTime)(VOID);
+ BOOLEAN (*InitializeBootDevices)(VOID);
PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
VOID (*HwIdle)(VOID);
} MACHVTBL, *PMACHVTBL;
@@ -122,6 +123,7 @@
#define MachDiskReadLogicalSectors(Drive, Start, Count,
Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive),
(Geom))
#define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
+#define MachInitializeBootDevices() MachVtbl.InitializeBootDevices()
#define MachHwDetect() MachVtbl.HwDetect()
#define MachHwIdle() MachVtbl.HwIdle()