Author: fireball
Date: Mon Dec 10 01:09:37 2007
New Revision: 31115
URL:
http://svn.reactos.org/svn/reactos?rev=31115&view=rev
Log:
- Further refactor the code by completing getting rid of the registry key parameters and
work only with ARC configuration component nodes; the registry key is now hidden in an
opaque structure from the rest of the code.
- Fix some bugs in the ARC component node creation.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h
trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c
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 (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c Mon Dec 10 01:09:37 2007
@@ -234,12 +234,12 @@
}
static VOID
-DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PNP_BIOS_DEVICE_NODE DeviceNode;
PCM_PNP_BIOS_INSTALLATION_CHECK InstData;
- FRLDRHKEY BusKey;
+ PCONFIGURATION_COMPONENT_DATA BusKey;
ULONG x;
ULONG NodeSize = 0;
ULONG NodeCount = 0;
@@ -367,7 +367,7 @@
static VOID
-SetHarddiskConfigurationData(FRLDRHKEY DiskKey,
+SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
ULONG DriveNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
@@ -439,7 +439,7 @@
static VOID
-SetHarddiskIdentifier(FRLDRHKEY DiskKey,
+SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
ULONG DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
@@ -510,13 +510,13 @@
static VOID
-DetectBiosDisks(FRLDRHKEY SystemKey,
- FRLDRHKEY BusKey)
+DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
+ PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_INT13_DRIVE_PARAMETER Int13Drives;
GEOMETRY Geometry;
- FRLDRHKEY DiskKey;
+ PCONFIGURATION_COMPONENT_DATA DiskKey;
ULONG DiskCount;
ULONG Size;
ULONG i;
@@ -661,13 +661,13 @@
static VOID
-DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
+DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_FLOPPY_DEVICE_DATA FloppyData;
WCHAR Identifier[20];
- FRLDRHKEY PeripheralKey;
+ PCONFIGURATION_COMPONENT_DATA PeripheralKey;
ULONG Size;
ULONG FloppyNumber;
UCHAR FloppyType;
@@ -743,12 +743,12 @@
static VOID
-DetectBiosFloppyController(FRLDRHKEY SystemKey,
- FRLDRHKEY BusKey)
+DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey,
+ PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
- FRLDRHKEY ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
ULONG Size;
ULONG FloppyCount;
@@ -999,13 +999,13 @@
static VOID
-DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
+DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
ULONG Base)
{
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
char Buffer[256];
WCHAR Identifier[256];
- FRLDRHKEY PeripheralKey;
+ PCONFIGURATION_COMPONENT_DATA PeripheralKey;
ULONG MouseType;
ULONG Length;
ULONG i;
@@ -1173,7 +1173,7 @@
static VOID
-DetectSerialPorts(FRLDRHKEY BusKey)
+DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
@@ -1183,7 +1183,7 @@
WCHAR Buffer[80];
PUSHORT BasePtr;
ULONG ControllerNumber = 0;
- FRLDRHKEY ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
ULONG i;
ULONG Size;
@@ -1288,13 +1288,13 @@
static VOID
-DetectParallelPorts(FRLDRHKEY BusKey)
+DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
ULONG Irq[3] = {7, 5, (ULONG)-1};
WCHAR Buffer[80];
- FRLDRHKEY ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
PUSHORT BasePtr;
ULONG Base;
ULONG ControllerNumber;
@@ -1462,12 +1462,12 @@
static VOID
-DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
+DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_KEYBOARD_DEVICE_DATA KeyboardData;
- FRLDRHKEY PeripheralKey;
+ PCONFIGURATION_COMPONENT_DATA PeripheralKey;
ULONG Size;
/* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */
@@ -1530,11 +1530,11 @@
static VOID
-DetectKeyboardController(FRLDRHKEY BusKey)
+DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
- FRLDRHKEY ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
ULONG Size;
/* Create controller key */
@@ -1716,11 +1716,11 @@
static VOID
-DetectPS2Mouse(FRLDRHKEY BusKey)
+DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
{
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
- FRLDRHKEY ControllerKey;
- FRLDRHKEY PeripheralKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA PeripheralKey;
if (DetectPS2AuxPort())
{
@@ -1804,10 +1804,10 @@
static VOID
-DetectDisplayController(FRLDRHKEY BusKey)
+DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
{
WCHAR Buffer[80];
- FRLDRHKEY ControllerKey;
+ PCONFIGURATION_COMPONENT_DATA ControllerKey;
USHORT VesaVersion;
FldrCreateComponentKey(BusKey,
@@ -1859,10 +1859,10 @@
static VOID
-DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
- FRLDRHKEY BusKey;
+ PCONFIGURATION_COMPONENT_DATA BusKey;
ULONG Size;
/* Create new bus key */
@@ -1930,7 +1930,7 @@
VOID
PcHwDetect(VOID)
{
- FRLDRHKEY SystemKey;
+ PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n"));
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c Mon Dec 10 01:09:37 2007
@@ -49,9 +49,9 @@
VOID
-DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
- FRLDRHKEY BiosKey;
+ PCONFIGURATION_COMPONENT_DATA BiosKey;
if (FindAcpiBios())
{
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c Mon Dec 10 01:09:37 2007
@@ -54,9 +54,9 @@
VOID
-DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
- FRLDRHKEY BiosKey;
+ PCONFIGURATION_COMPONENT_DATA BiosKey;
if (FindApmBios())
{
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c Mon Dec 10 01:09:37 2007
@@ -140,12 +140,12 @@
static VOID
-DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
+DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PPCI_IRQ_ROUTING_TABLE Table;
- FRLDRHKEY TableKey;
+ PCONFIGURATION_COMPONENT_DATA TableKey;
ULONG Size;
Table = GetPciIrqRoutingTable();
@@ -211,14 +211,14 @@
VOID
-DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
+DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
CM_PCI_BUS_DATA BusData;
- FRLDRHKEY BiosKey;
+ PCONFIGURATION_COMPONENT_DATA BiosKey;
ULONG Size;
#if 0
- FRLDRHKEY BusKey;
+ PCONFIGURATION_COMPONENT_DATA BusKey;
ULONG i;
WCHAR szPci[] = L"PCI";
#endif
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h Mon Dec 10 01:09:37
2007
@@ -34,7 +34,7 @@
VOID
NTAPI
FldrSetComponentInformation(
- IN FRLDRHKEY ComponentKey,
+ IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity
@@ -43,31 +43,31 @@
VOID
NTAPI
FldrSetIdentifier(
- IN FRLDRHKEY ComponentKey,
+ IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PWCHAR Identifier
);
VOID
NTAPI
FldrCreateSystemKey(
- OUT FRLDRHKEY *SystemKey
+ OUT PCONFIGURATION_COMPONENT_DATA *SystemKey
);
VOID
NTAPI
FldrCreateComponentKey(
- IN FRLDRHKEY SystemKey,
+ IN PCONFIGURATION_COMPONENT_DATA SystemKey,
IN PWCHAR BusName,
IN ULONG BusNumber,
IN CONFIGURATION_CLASS Class,
IN CONFIGURATION_TYPE Type,
- OUT FRLDRHKEY *ComponentKey
+ OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
);
VOID
NTAPI
FldrSetConfigurationData(
- IN FRLDRHKEY ComponentKey,
+ IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PVOID ConfigurationData,
IN ULONG Size
);
@@ -82,16 +82,13 @@
VOID HalpCalibrateStallExecution(VOID);
/* hwacpi.c */
-VOID DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
+VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
/* hwapm.c */
-VOID DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
-
-/* hwcpu.c */
-VOID DetectCPUs(FRLDRHKEY SystemKey);
+VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
/* hwpci.c */
-VOID DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
+VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
/* i386cpu.S */
ULONG CpuidSupported(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c Mon Dec 10 01:09:37 2007
@@ -15,87 +15,28 @@
/* GLOBALS ********************************************************************/
PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
-ULONG FldrBusTypeCount[MaximumType + 1] = {0};
-const PWCHAR FldrBusTypeString[MaximumType + 1] =
-{
- L"System",
- L"CentralProcessor",
- L"FloatingPointProcessor",
- L"PrimaryICache",
- L"PrimaryDCache",
- L"SecondaryICache",
- L"SecondaryDCache",
- L"SecondaryCache",
- L"EisaAdapter",
- L"TcAdapter",
- L"ScsiAdapter",
- L"DtiAdapter",
- L"MultifunctionAdapter",
- L"DiskController",
- L"TapeController",
- L"CdRomController",
- L"WormController",
- L"SerialController",
- L"NetworkController",
- L"DisplayController",
- L"ParallelController",
- L"PointerController",
- L"KeyboardController",
- L"AudioController",
- L"OtherController",
- L"DiskPeripheral",
- L"FloppyDiskPeripheral",
- L"TapePeripheral",
- L"ModemPeripheral",
- L"MonitorPeripheral",
- L"PrinterPeripheral",
- L"PointerPeripheral",
- L"KeyboardPeripheral",
- L"TerminalPeripheral",
- L"OtherPeripheral",
- L"LinePeripheral",
- L"NetworkPeripheral",
- L"SystemMemory",
- L"DockingInformation",
- L"RealModeIrqRoutingTable",
- L"RealModePCIEnumeration",
- L"Undefined"
-};
-const PWCHAR FldrClassString[MaximumClass + 1] =
-{
- L"System",
- L"Processor",
- L"Cache",
- L"Adapter",
- L"Controller",
- L"Peripheral",
- L"MemoryClass",
- L"Undefined"
-};
/* FUNCTIONS ******************************************************************/
VOID
NTAPI
-FldrSetComponentInformation(IN FRLDRHKEY ComponentKey,
+FldrSetComponentInformation(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity)
{
LONG Error;
- CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey"
- PCONFIGURATION_COMPONENT_DATA ComponentData = &Data;
PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
-
+
/* Set component information */
Component->Flags = Flags;
Component->Version = 0;
Component->Revision = 0;
- Component->Key = Key;
+ //Component->Key = Key; // HACK: We store the registry key here
Component->AffinityMask = Affinity;
/* Set the value */
- Error = RegSetValue(ComponentKey,
+ Error = RegSetValue((FRLDRHKEY)Component->Key,
L"Component Information",
REG_BINARY,
(PVOID)&Component->Flags,
@@ -109,13 +50,11 @@
VOID
NTAPI
-FldrSetIdentifier(IN FRLDRHKEY ComponentKey,
+FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
IN PWCHAR Identifier)
{
LONG Error;
ULONG IdentifierLength = (wcslen(Identifier) + 1) * sizeof(WCHAR);
- CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey"
- PCONFIGURATION_COMPONENT_DATA ComponentData = &Data;
PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
/* Set component information */
@@ -123,7 +62,7 @@
Component->Identifier = (PCHAR)Identifier; // We need to use ASCII instead
/* Set the key */
- Error = RegSetValue(ComponentKey,
+ Error = RegSetValue((FRLDRHKEY)Component->Key,
L"Identifier",
REG_SZ,
(PCHAR)Identifier,
@@ -137,7 +76,7 @@
VOID
NTAPI
-FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey)
+FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
{
LONG Error;
PCONFIGURATION_COMPONENT Component;
@@ -157,10 +96,13 @@
Component->Identifier = 0;
Component->IdentifierLength = 0;
+ /* Return the node */
+ *SystemNode = FldrArcHwTreeRoot;
+
/* Create the key */
Error = RegCreateKey(NULL,
L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
- SystemKey);
+ (FRLDRHKEY*)&Component->Key);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
Error));
@@ -170,20 +112,18 @@
VOID
NTAPI
-FldrCreateComponentKey(IN FRLDRHKEY SystemKey,
+FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
IN PWCHAR BusName,
IN ULONG BusNumber,
IN CONFIGURATION_CLASS Class,
IN CONFIGURATION_TYPE Type,
- OUT FRLDRHKEY *ComponentKey)
+ OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
{
LONG Error;
WCHAR Buffer[80];
- CONFIGURATION_COMPONENT_DATA Root = {0}; // This would be "SystemKey"
- PCONFIGURATION_COMPONENT_DATA SystemNode = &Root;
PCONFIGURATION_COMPONENT_DATA ComponentData;
PCONFIGURATION_COMPONENT Component;
-
+
/* Allocate the node for this component */
ComponentData = MmAllocateMemory(sizeof(CONFIGURATION_COMPONENT_DATA));
if (!ComponentData) return;
@@ -203,18 +143,21 @@
SystemNode->Child = ComponentData;
}
- /* Set us up (need to use class/type instead of name/number) */
- Component = &FldrArcHwTreeRoot->ComponentEntry;
+ /* Set us up */
+ Component = &ComponentData->ComponentEntry;
Component->Class = Class;
Component->Type = Type;
- /* FIXME: Use Class/Type to build key name */
-
+ /* Return the child */
+ *ComponentKey = ComponentData;
+
/* Build the key name */
swprintf(Buffer, L"%s\\%u", BusName, BusNumber);
/* Create the key */
- Error = RegCreateKey(SystemKey, Buffer, ComponentKey);
+ Error = RegCreateKey((FRLDRHKEY)SystemNode->ComponentEntry.Key,
+ Buffer,
+ (FRLDRHKEY*)&Component->Key);
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
Error));
@@ -224,13 +167,11 @@
VOID
NTAPI
-FldrSetConfigurationData(IN FRLDRHKEY ComponentKey,
+FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
IN PVOID ConfigurationData,
IN ULONG Size)
{
LONG Error;
- CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey"
- PCONFIGURATION_COMPONENT_DATA ComponentData = &Data;
PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
/* Set component information */
@@ -238,7 +179,7 @@
Component->ConfigurationDataLength = Size;
/* Set 'Configuration Data' value */
- Error = RegSetValue(ComponentKey,
+ Error = RegSetValue((FRLDRHKEY)Component->Key,
L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
ConfigurationData,