mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[FREELDR]
Split HwDetect() into 2 functions. InitializeBootDevices() and HwDetect(). This way we don't do the stuff twice. svn path=/trunk/; revision=58334
This commit is contained in:
parent
a7931f3d82
commit
8701c51946
10 changed files with 51 additions and 27 deletions
|
@ -101,6 +101,13 @@ ArmDiskGetBootPath(OUT PCHAR BootPath,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ArmInitializeBootDevices(VOID)
|
||||
{
|
||||
/* Emulate old behavior */
|
||||
return ArmHwDetect != NULL;
|
||||
}
|
||||
|
||||
PCONFIGURATION_COMPONENT_DATA
|
||||
ArmHwDetect(VOID)
|
||||
{
|
||||
|
@ -221,6 +228,7 @@ MachInit(IN PCCH CommandLine)
|
|||
/* 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;
|
||||
|
|
|
@ -95,7 +95,7 @@ PCHAR
|
|||
GetHarddiskIdentifier(
|
||||
UCHAR DriveNumber);
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
HwInitializeBiosDisks(VOID);
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
@ -1721,6 +1721,11 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* FIXME: Detect more ISA devices */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
PcInitializeBootDevices(VOID)
|
||||
{
|
||||
return HwInitializeBiosDisks();
|
||||
}
|
||||
|
||||
PCONFIGURATION_COMPONENT_DATA
|
||||
PcHwDetect(VOID)
|
||||
|
@ -1730,8 +1735,6 @@ PcHwDetect(VOID)
|
|||
|
||||
TRACE("DetectHardware()\n");
|
||||
|
||||
HwInitializeBiosDisks();
|
||||
|
||||
/* Create the 'System' key */
|
||||
SystemKey = DetectSystem();
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ GetHarddiskInformation(
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
HwInitializeBiosDisks(VOID)
|
||||
{
|
||||
UCHAR DiskCount, DriveNumber;
|
||||
|
@ -331,7 +331,7 @@ HwInitializeBiosDisks(VOID)
|
|||
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER))
|
||||
{
|
||||
ERR("Reading MBR failed\n");
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Buffer = (ULONG*)DISKREADBUFFER;
|
||||
|
@ -352,4 +352,5 @@ HwInitializeBiosDisks(VOID)
|
|||
}
|
||||
|
||||
PcBiosDiskCount = DiskCount;
|
||||
return DiskCount != 0;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ PcMachInit(const char *CmdLine)
|
|||
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
|
||||
MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount;
|
||||
MachVtbl.GetTime = PcGetTime;
|
||||
MachVtbl.InitializeBootDevices = PcInitializeBootDevices;
|
||||
MachVtbl.HwDetect = PcHwDetect;
|
||||
MachVtbl.HwIdle = PcHwIdle;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ XboxMachInit(const char *CmdLine)
|
|||
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;
|
||||
MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount;
|
||||
MachVtbl.GetTime = XboxGetTime;
|
||||
MachVtbl.InitializeBootDevices = XboxInitializeBootDevices;
|
||||
MachVtbl.HwDetect = XboxHwDetect;
|
||||
MachVtbl.HwIdle = XboxHwIdle;
|
||||
|
||||
|
|
|
@ -509,6 +509,13 @@ XboxHwDetect(VOID)
|
|||
return SystemKey;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
XboxInitializeBootDevices(VOID)
|
||||
{
|
||||
// Emulate old behavior
|
||||
return XboxHwDetect() != NULL;
|
||||
}
|
||||
|
||||
VOID XboxHwIdle(VOID)
|
||||
{
|
||||
/* UNIMPLEMENTED */
|
||||
|
|
|
@ -197,8 +197,7 @@ VOID RunLoader(VOID)
|
|||
ULONG SelectedOperatingSystem;
|
||||
ULONG i;
|
||||
|
||||
// FIXME: if possible, only detect and register ARC devices...
|
||||
if (!MachHwDetect())
|
||||
if (!MachInitializeBootDevices())
|
||||
{
|
||||
UiMessageBoxCritical("Error when detecting hardware");
|
||||
return;
|
||||
|
|
|
@ -57,6 +57,7 @@ ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber);
|
|||
|
||||
TIMEINFO* XboxGetTime(VOID);
|
||||
|
||||
BOOLEAN XboxInitializeBootDevices(VOID);
|
||||
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID);
|
||||
VOID XboxHwIdle(VOID);
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber);
|
|||
|
||||
TIMEINFO* PcGetTime(VOID);
|
||||
|
||||
BOOLEAN PcInitializeBootDevices(VOID);
|
||||
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID);
|
||||
VOID PcHwIdle(VOID);
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef struct tagMACHVTBL
|
|||
TIMEINFO* (*GetTime)(VOID);
|
||||
ULONG (*GetRelativeTime)(VOID);
|
||||
|
||||
BOOLEAN (*InitializeBootDevices)(VOID);
|
||||
PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
|
||||
VOID (*HwIdle)(VOID);
|
||||
} MACHVTBL, *PMACHVTBL;
|
||||
|
@ -122,6 +123,7 @@ VOID MachHwIdle(VOID);
|
|||
#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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue