Merge FldrCreateComponentKey and FldrSetIdentifier

svn path=/trunk/; revision=42544
This commit is contained in:
Hervé Poussineau 2009-08-09 08:11:52 +00:00
parent d7ca524325
commit 661239c67e
11 changed files with 64 additions and 102 deletions

View file

@ -243,11 +243,9 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"PNP BIOS",
&BusKey);
(*BusNumber)++;
/* Set the identifier */
FldrSetIdentifier(BusKey, "PNP BIOS");
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + (NodeSize * NodeCount);
@ -492,7 +490,7 @@ static const DEVVTBL DiskVtbl = {
};
static VOID
SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
GetHarddiskIdentifier(PCHAR Identifier,
ULONG DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
@ -500,7 +498,6 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
ULONG i;
ULONG Checksum;
ULONG Signature;
CHAR Identifier[20];
CHAR ArcName[256];
PARTITION_TABLE_ENTRY PartitionTableEntry;
@ -574,9 +571,6 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
Identifier[18] = 'A';
Identifier[19] = 0;
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
/* Set identifier */
FldrSetIdentifier(DiskKey, Identifier);
}
static ULONG
@ -642,13 +636,17 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
DiskResetController(FloppyNumber);
Ptr = GetInt1eTable();
/* Set 'Identifier' value */
sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1);
FldrCreateComponentKey(ControllerKey,
PeripheralClass,
FloppyDiskPeripheral,
Input | Output,
FloppyNumber,
0xFFFFFFFF,
Identifier,
&PeripheralKey);
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
@ -685,10 +683,6 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
/* Set 'Configuration Data' value */
FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
/* Set 'Identifier' value */
sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1);
FldrSetIdentifier(PeripheralKey, Identifier);
}
}
@ -806,6 +800,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Output | Input | Removable,
0x0,
0xFFFFFFFF,
NULL,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
@ -865,6 +860,11 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
/* Create and fill subkey for each harddisk */
for (i = 0; i < DiskCount; i++)
{
CHAR Identifier[20];
/* Get disk values */
GetHarddiskIdentifier(Identifier, 0x80 + i);
/* Create disk key */
FldrCreateComponentKey(ControllerKey,
PeripheralClass,
@ -872,11 +872,11 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Output | Input,
0x0,
0xFFFFFFFF,
Identifier,
&DiskKey);
/* Set disk values */
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
SetHarddiskIdentifier(DiskKey, 0x80 + i);
}
/* Get the drive we're booting from */
@ -1209,6 +1209,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
Input,
0x0,
0xFFFFFFFF,
Identifier,
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT,
"Created key: PointerPeripheral\\0\n");
@ -1223,9 +1224,6 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
&PartialResourceList,
sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set 'Identifier' value */
FldrSetIdentifier(PeripheralKey, Identifier);
}
}
@ -1260,6 +1258,9 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
i + 1,
Base);
/* Set 'Identifier' value */
sprintf(Buffer, "COM%ld", i + 1);
/* Create controller key */
FldrCreateComponentKey(BusKey,
ControllerClass,
@ -1267,6 +1268,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Output | Input | ConsoleIn | ConsoleOut,
ControllerNumber,
0xFFFFFFFF,
Buffer,
&ControllerKey);
/* Build full device descriptor */
@ -1320,13 +1322,6 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
/* Set 'Identifier' value */
sprintf(Buffer, "COM%ld", i + 1);
FldrSetIdentifier(ControllerKey, Buffer);
DPRINTM(DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer);
if (!Rs232PortInUse(Base))
{
/* Detect serial mouse */
@ -1367,6 +1362,9 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
ControllerNumber,
Base);
/* Set 'Identifier' value */
sprintf(Buffer, "PARALLEL%ld", i + 1);
/* Create controller key */
FldrCreateComponentKey(BusKey,
ControllerClass,
@ -1374,6 +1372,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
Output,
ControllerNumber,
0xFFFFFFFF,
Buffer,
&ControllerKey);
/* Build full device descriptor */
@ -1420,13 +1419,6 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
/* Set 'Identifier' value */
sprintf(Buffer, "PARALLEL%ld", i + 1);
FldrSetIdentifier(ControllerKey, Buffer);
DPRINTM(DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer);
ControllerNumber++;
}
@ -1524,6 +1516,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Input | ConsoleIn,
0x0,
0xFFFFFFFF,
"PCAT_ENHANCED",
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n");
@ -1559,9 +1552,6 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
/* Set 'Configuration Data' value */
FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
/* Set 'Identifier' value */
FldrSetIdentifier(PeripheralKey, "PCAT_ENHANCED");
}
}
@ -1581,6 +1571,7 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
Input | ConsoleIn,
0x0,
0xFFFFFFFF,
NULL,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n");
@ -1763,6 +1754,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Input,
0x0,
0xFFFFFFFF,
NULL,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n");
@ -1797,6 +1789,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
Input,
0x0,
0xFFFFFFFF,
"MICROSOFT PS2 MOUSE",
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n");
@ -1811,9 +1804,6 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
&PartialResourceList,
sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set 'Identifier' value */
FldrSetIdentifier(PeripheralKey, "MICROSOFT PS2 MOUSE");
}
}
}
@ -1826,15 +1816,6 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
PCONFIGURATION_COMPONENT_DATA ControllerKey;
USHORT VesaVersion;
FldrCreateComponentKey(BusKey,
ControllerClass,
DisplayController,
0x0,
0x0,
0xFFFFFFFF,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
/* FIXME: Set 'ComponentInformation' value */
VesaVersion = BiosIsVesaSupported();
@ -1862,8 +1843,15 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
"VGA Display");
}
/* Set 'Identifier' value */
FldrSetIdentifier(ControllerKey, Buffer);
FldrCreateComponentKey(BusKey,
ControllerClass,
DisplayController,
0x0,
0x0,
0xFFFFFFFF,
Buffer,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
/* FIXME: Add display peripheral (monitor) data */
}
@ -1883,14 +1871,12 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"ISA",
&BusKey);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BusKey, "ISA");
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);

View file

@ -74,6 +74,7 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"ACPI BIOS",
&BiosKey);
/* Get BIOS memory map */
@ -116,8 +117,6 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BiosKey, "ACPI BIOS");
MmHeapFree(PartialResourceList);
}
}

View file

@ -68,6 +68,7 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"APM",
&BiosKey);
/* Set 'Configuration Data' value */
@ -82,9 +83,6 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BiosKey, "APM");
}
/* FIXME: Add configuration data */

View file

@ -160,11 +160,9 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
0x0,
0x0,
0xFFFFFFFF,
"PCI Real-mode IRQ Routing Table",
&TableKey);
/* Set 'Identifier' value */
FldrSetIdentifier(TableKey, "PCI Real-mode IRQ Routing Table");
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + Table->Size;
@ -213,7 +211,6 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
ULONG Size;
PCONFIGURATION_COMPONENT_DATA BusKey;
ULONG i;
CHAR szPci[] = "PCI";
/* Report the PCI BIOS */
if (FindPciBios(&BusData))
@ -225,14 +222,12 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"PCI BIOS"
&BiosKey);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BiosKey, "PCI BIOS");
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
PartialDescriptors);
@ -263,6 +258,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"PCI",
&BusKey);
/* Check if this is the first bus */
@ -321,9 +317,6 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BusKey, szPci);
}
}
}

View file

@ -94,7 +94,7 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
static VOID
SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
GetHarddiskIdentifier(PCHAR Identifier,
ULONG DriveNumber)
{
PMASTER_BOOT_RECORD Mbr;
@ -158,9 +158,6 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
Identifier[18] = 'A';
Identifier[19] = 0;
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
/* Set identifier */
FldrSetIdentifier(DiskKey, Identifier);
}
static VOID
@ -212,6 +209,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Output | Input | Removable,
0,
0xFFFFFFFF,
NULL,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
@ -268,6 +266,11 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
/* Create and fill subkey for each harddisk */
for (i = 0; i < DiskCount; i++)
{
CHAR Identifier[20];
/* Get disk values */
GetHarddiskIdentifier(Identifier, 0x80 + i);
/* Create disk key */
FldrCreateComponentKey(ControllerKey,
PeripheralClass,
@ -275,11 +278,11 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Output | Input,
0,
0xFFFFFFFF,
Identifier,
&DiskKey);
/* Set disk values */
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
SetHarddiskIdentifier(DiskKey, 0x80 + i);
}
}
@ -297,14 +300,12 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
0x0,
0x0,
0xFFFFFFFF,
"ISA",
&BusKey);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
FldrSetIdentifier(BusKey, "ISA");
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);

View file

@ -393,6 +393,7 @@ VOID OfwCopyDeviceTree
0,
0,
(ULONG)-1,
NULL,
&NewKey);
/* Add properties */

View file

@ -38,13 +38,6 @@
//
// ARC Component Configuration Routines
//
VOID
NTAPI
FldrSetIdentifier(
IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PCHAR Identifier
);
VOID
NTAPI
FldrCreateSystemKey(
@ -60,6 +53,7 @@ FldrCreateComponentKey(
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity,
IN PCHAR IdentifierString,
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
);

View file

@ -58,13 +58,6 @@ typedef struct _ARM_BOARD_CONFIGURATION_BLOCK
//
// ARC Component Configuration Routines
//
VOID
NTAPI
FldrSetIdentifier(
IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PCHAR Identifier
);
VOID
NTAPI
FldrCreateSystemKey(
@ -80,6 +73,7 @@ FldrCreateComponentKey(
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity,
IN PCHAR IdentifierString,
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
);

View file

@ -38,13 +38,6 @@
//
// ARC Component Configuration Routines
//
VOID
NTAPI
FldrSetIdentifier(
IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PCHAR Identifier
);
VOID
NTAPI
FldrCreateSystemKey(
@ -60,6 +53,7 @@ FldrCreateComponentKey(
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity,
IN PCHAR IdentifierString,
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
);

View file

@ -37,13 +37,6 @@
//
// ARC Component Configuration Routines
//
VOID
NTAPI
FldrSetIdentifier(
IN PCONFIGURATION_COMPONENT_DATA ComponentKey,
IN PCHAR Identifier
);
VOID
NTAPI
FldrCreateSystemKey(
@ -59,6 +52,7 @@ FldrCreateComponentKey(
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity,
IN PCHAR IdentifierString,
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
);

View file

@ -138,6 +138,7 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
IN IDENTIFIER_FLAG Flags,
IN ULONG Key,
IN ULONG Affinity,
IN PCHAR IdentifierString,
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
{
PCONFIGURATION_COMPONENT_DATA ComponentData;
@ -157,6 +158,13 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
Component = &ComponentData->ComponentEntry;
Component->Class = Class;
Component->Type = Type;
Component->Flags = Flags;
Component->Key = Key;
Component->Affinity = Affinity;
/* Set identifier */
if (Identifier)
FldrSetIdentifier(ComponentData, Identifier);
/* Return the child */
*ComponentKey = ComponentData;