- Start filling out ARC component data nodes for all the new refactored hardware node APIs (these are just dummies for now).

svn path=/trunk/; revision=31114
This commit is contained in:
Aleksey Bragin 2007-12-09 21:49:17 +00:00
parent 0e2f7faae4
commit 35d35bd7e9
6 changed files with 177 additions and 11 deletions

View file

@ -275,7 +275,12 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
DbgPrint((DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount));
/* Create component key */
FldrCreateComponentKey(SystemKey, L"MultifunctionAdapter", *BusNumber, &BusKey);
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BusKey);
(*BusNumber)++;
/* Set the component information */
@ -605,6 +610,8 @@ DetectBiosDisks(FRLDRHKEY SystemKey,
FldrCreateComponentKey(BusKey,
L"DiskController\\0\\DiskPeripheral",
i,
PeripheralClass,
DiskPeripheral,
&DiskKey);
/* Set disk values */
@ -681,6 +688,8 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
FldrCreateComponentKey(ControllerKey,
L"FloppyDiskPeripheral",
FloppyNumber,
PeripheralClass,
FloppyDiskPeripheral,
&PeripheralKey);
/* Set 'ComponentInformation' value */
@ -754,6 +763,8 @@ DetectBiosFloppyController(FRLDRHKEY SystemKey,
FldrCreateComponentKey(SystemKey,
L"DiskController",
0,
ControllerClass,
DiskController,
&ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
@ -1130,6 +1141,8 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
FldrCreateComponentKey(ControllerKey,
L"PointerPeripheral",
0,
PeripheralClass,
PointerPeripheral,
&PeripheralKey);
DbgPrint((DPRINT_HWDETECT,
"Created key: PointerPeripheral\\0\n"));
@ -1193,6 +1206,8 @@ DetectSerialPorts(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"SerialController",
ControllerNumber,
ControllerClass,
SerialController,
&ControllerKey);
/* Set 'ComponentInformation' value */
@ -1305,6 +1320,8 @@ DetectParallelPorts(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"ParallelController",
ControllerNumber,
ControllerClass,
ParallelController,
&ControllerKey);
/* Set 'ComponentInformation' value */
@ -1460,6 +1477,8 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
FldrCreateComponentKey(ControllerKey,
L"KeyboardPeripheral",
0,
PeripheralClass,
KeyboardPeripheral,
&PeripheralKey);
DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"));
@ -1522,6 +1541,8 @@ DetectKeyboardController(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"KeyboardController",
0,
ControllerClass,
KeyboardController,
&ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"));
@ -1709,6 +1730,8 @@ DetectPS2Mouse(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"PointerController",
0,
ControllerClass,
PointerController,
&ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: PointerController\\0\n"));
@ -1746,8 +1769,10 @@ DetectPS2Mouse(FRLDRHKEY BusKey)
/* Create peripheral key */
FldrCreateComponentKey(ControllerKey,
L"PointerController",
L"PointerPeripheral",
0,
ControllerClass,
PointerPeripheral,
&PeripheralKey);
DbgPrint((DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"));
@ -1788,6 +1813,8 @@ DetectDisplayController(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"DisplayController",
0,
ControllerClass,
DisplayController,
&ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: DisplayController\\0\n"));
@ -1842,6 +1869,8 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BusKey);
/* Set 'Component Information' value similar to my NT4 box */

View file

@ -61,6 +61,8 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BiosKey);
#if 0

View file

@ -64,6 +64,8 @@ DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BiosKey);
#if 0

View file

@ -156,6 +156,8 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
FldrCreateComponentKey(BusKey,
L"RealModeIrqRoutingTable",
0,
SystemClass,
RealModeIrqRoutingTable,
&TableKey);
/* Set 'Component Information' */
@ -228,6 +230,8 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BiosKey);
/* Set 'Component Information' */
@ -283,6 +287,8 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
FldrCreateComponentKey(SystemKey,
L"MultifunctionAdapter",
*BusNumber,
AdapterClass,
MultiFunctionAdapter,
&BiosKey);
/* Set 'Component Information' */

View file

@ -59,6 +59,8 @@ FldrCreateComponentKey(
IN FRLDRHKEY SystemKey,
IN PWCHAR BusName,
IN ULONG BusNumber,
IN CONFIGURATION_CLASS Class,
IN CONFIGURATION_TYPE Type,
OUT FRLDRHKEY *ComponentKey
);

View file

@ -12,6 +12,67 @@
#define NDEBUG
#include <debug.h>
/* 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
@ -21,21 +82,23 @@ FldrSetComponentInformation(IN FRLDRHKEY ComponentKey,
IN ULONG Key,
IN ULONG Affinity)
{
CONFIGURATION_COMPONENT ConfigurationComponent;
LONG Error;
CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey"
PCONFIGURATION_COMPONENT_DATA ComponentData = &Data;
PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
/* Build the component information */
ConfigurationComponent.Flags = Flags;
ConfigurationComponent.Version = 0;
ConfigurationComponent.Revision = 0;
ConfigurationComponent.Key = Key;
ConfigurationComponent.AffinityMask = Affinity;
/* Set component information */
Component->Flags = Flags;
Component->Version = 0;
Component->Revision = 0;
Component->Key = Key;
Component->AffinityMask = Affinity;
/* Set the value */
Error = RegSetValue(ComponentKey,
L"Component Information",
REG_BINARY,
(PVOID)&ConfigurationComponent.Flags,
(PVOID)&Component->Flags,
FIELD_OFFSET(CONFIGURATION_COMPONENT, ConfigurationDataLength) -
FIELD_OFFSET(CONFIGURATION_COMPONENT, Flags));
if (Error != ERROR_SUCCESS)
@ -51,7 +114,14 @@ FldrSetIdentifier(IN FRLDRHKEY ComponentKey,
{
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 */
Component->IdentifierLength = IdentifierLength;
Component->Identifier = (PCHAR)Identifier; // We need to use ASCII instead
/* Set the key */
Error = RegSetValue(ComponentKey,
L"Identifier",
@ -70,6 +140,22 @@ NTAPI
FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey)
{
LONG Error;
PCONFIGURATION_COMPONENT Component;
/* Allocate the root */
FldrArcHwTreeRoot = MmAllocateMemory(sizeof(CONFIGURATION_COMPONENT_DATA));
if (!FldrArcHwTreeRoot) return;
/* Set it up */
Component = &FldrArcHwTreeRoot->ComponentEntry;
Component->Class = SystemClass;
Component->Type = MaximumType;
Component->Version = 0;
Component->Key = 0;
Component->AffinityMask = 0;
Component->ConfigurationDataLength = 0;
Component->Identifier = 0;
Component->IdentifierLength = 0;
/* Create the key */
Error = RegCreateKey(NULL,
@ -79,7 +165,7 @@ FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey)
{
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", Error));
return;
}
}
}
VOID
@ -87,10 +173,42 @@ NTAPI
FldrCreateComponentKey(IN FRLDRHKEY SystemKey,
IN PWCHAR BusName,
IN ULONG BusNumber,
IN CONFIGURATION_CLASS Class,
IN CONFIGURATION_TYPE Type,
OUT FRLDRHKEY *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;
/* Now save our parent */
ComponentData->Parent = SystemNode;
/* Now we need to figure out if the parent already has a child entry */
if (SystemNode->Child)
{
/* It does, so we'll be a sibling of the child instead */
SystemNode->Child->Sibling = ComponentData;
}
else
{
/* It doesn't, so we will be the first child */
SystemNode->Child = ComponentData;
}
/* Set us up (need to use class/type instead of name/number) */
Component = &FldrArcHwTreeRoot->ComponentEntry;
Component->Class = Class;
Component->Type = Type;
/* FIXME: Use Class/Type to build key name */
/* Build the key name */
swprintf(Buffer, L"%s\\%u", BusName, BusNumber);
@ -111,6 +229,13 @@ FldrSetConfigurationData(IN FRLDRHKEY ComponentKey,
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 */
ComponentData->ConfigurationData = ConfigurationData;
Component->ConfigurationDataLength = Size;
/* Set 'Configuration Data' value */
Error = RegSetValue(ComponentKey,