mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:35:43 +00:00
[freeldr] When creating a component, provide at the same time its configuration data
svn path=/trunk/; revision=42873
This commit is contained in:
parent
4abf644be8
commit
413dcab765
7 changed files with 366 additions and 275 deletions
|
@ -236,17 +236,6 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
DPRINTM(DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
|
DPRINTM(DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
|
||||||
DPRINTM(DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount);
|
DPRINTM(DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount);
|
||||||
|
|
||||||
/* Create component key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"PNP BIOS",
|
|
||||||
&BusKey);
|
|
||||||
(*BusNumber)++;
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + (NodeSize * NodeCount);
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + (NodeSize * NodeCount);
|
||||||
PartialResourceList = MmHeapAlloc(Size);
|
PartialResourceList = MmHeapAlloc(Size);
|
||||||
|
@ -312,16 +301,28 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize);
|
DPRINTM(DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize);
|
||||||
DPRINTM(DPRINT_HWDETECT, "Resource size: %u\n", Size);
|
DPRINTM(DPRINT_HWDETECT, "Resource size: %u\n", Size);
|
||||||
|
|
||||||
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
|
/* Create component key */
|
||||||
|
FldrCreateComponentKey(SystemKey,
|
||||||
|
AdapterClass,
|
||||||
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"PNP BIOS",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&BusKey);
|
||||||
|
|
||||||
|
(*BusNumber)++;
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static PCM_PARTIAL_RESOURCE_LIST
|
||||||
SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize)
|
||||||
ULONG DriveNumber)
|
|
||||||
{
|
{
|
||||||
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
||||||
|
@ -329,6 +330,11 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
GEOMETRY Geometry;
|
GEOMETRY Geometry;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize returned size
|
||||||
|
//
|
||||||
|
*pSize = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
||||||
|
@ -337,7 +343,7 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Failed to allocate a full resource descriptor\n");
|
"Failed to allocate a full resource descriptor\n");
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(PartialResourceList, 0, Size);
|
memset(PartialResourceList, 0, Size);
|
||||||
|
@ -374,7 +380,7 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
|
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||||
|
@ -384,8 +390,11 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
DiskGeometry->SectorsPerTrack,
|
DiskGeometry->SectorsPerTrack,
|
||||||
DiskGeometry->BytesPerSector);
|
DiskGeometry->BytesPerSector);
|
||||||
|
|
||||||
FldrSetConfigurationData(DiskKey, PartialResourceList, Size);
|
//
|
||||||
MmHeapFree(PartialResourceList);
|
// Return configuration data
|
||||||
|
//
|
||||||
|
*pSize = Size;
|
||||||
|
return PartialResourceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct tagDISKCONTEXT
|
typedef struct tagDISKCONTEXT
|
||||||
|
@ -640,15 +649,6 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
||||||
/* Set 'Identifier' value */
|
/* Set 'Identifier' value */
|
||||||
sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1);
|
sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1);
|
||||||
|
|
||||||
FldrCreateComponentKey(ControllerKey,
|
|
||||||
PeripheralClass,
|
|
||||||
FloppyDiskPeripheral,
|
|
||||||
Input | Output,
|
|
||||||
FloppyNumber,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
Identifier,
|
|
||||||
&PeripheralKey);
|
|
||||||
|
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
sizeof(CM_FLOPPY_DEVICE_DATA);
|
sizeof(CM_FLOPPY_DEVICE_DATA);
|
||||||
PartialResourceList = MmHeapAlloc(Size);
|
PartialResourceList = MmHeapAlloc(Size);
|
||||||
|
@ -680,17 +680,26 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
||||||
FloppyData->MaximumTrackValue = (FloppyType == 1) ? 39 : 79;
|
FloppyData->MaximumTrackValue = (FloppyType == 1) ? 39 : 79;
|
||||||
FloppyData->DataTransferRate = 0;
|
FloppyData->DataTransferRate = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
FldrCreateComponentKey(ControllerKey,
|
||||||
FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size);
|
PeripheralClass,
|
||||||
|
FloppyDiskPeripheral,
|
||||||
|
Input | Output,
|
||||||
|
FloppyNumber,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
Identifier,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&PeripheralKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey,
|
DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|
||||||
{
|
{
|
||||||
|
PCONFIGURATION_COMPONENT_DATA ControllerKey;
|
||||||
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
@ -743,26 +752,35 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey,
|
||||||
PartialDescriptor->u.Dma.Channel = 2;
|
PartialDescriptor->u.Dma.Channel = 2;
|
||||||
PartialDescriptor->u.Dma.Port = 0;
|
PartialDescriptor->u.Dma.Port = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create floppy disk controller */
|
||||||
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
|
FldrCreateComponentKey(BusKey,
|
||||||
|
ControllerClass,
|
||||||
|
DiskController,
|
||||||
|
Output | Input,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&ControllerKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
if (FloppyCount) DetectBiosFloppyPeripheral(ControllerKey);
|
if (FloppyCount) DetectBiosFloppyPeripheral(ControllerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static PCONFIGURATION_COMPONENT_DATA
|
||||||
DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
DetectSystem(VOID)
|
||||||
PCONFIGURATION_COMPONENT_DATA BusKey)
|
|
||||||
{
|
{
|
||||||
|
PCONFIGURATION_COMPONENT_DATA SystemKey;
|
||||||
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
PCM_INT13_DRIVE_PARAMETER Int13Drives;
|
PCM_INT13_DRIVE_PARAMETER Int13Drives;
|
||||||
GEOMETRY Geometry;
|
GEOMETRY Geometry;
|
||||||
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
|
|
||||||
ULONG DiskCount;
|
ULONG DiskCount;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
BOOLEAN Changed, BootDriveReported = FALSE;
|
BOOLEAN Changed;
|
||||||
CHAR BootPath[512];
|
|
||||||
|
|
||||||
/* Count the number of visible drives */
|
/* Count the number of visible drives */
|
||||||
DiskReportError(FALSE);
|
DiskReportError(FALSE);
|
||||||
|
@ -794,18 +812,6 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
||||||
(int)DiskCount, (DiskCount == 1) ? "": "s");
|
(int)DiskCount, (DiskCount == 1) ? "": "s");
|
||||||
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
ControllerClass,
|
|
||||||
DiskController,
|
|
||||||
Output | Input | Removable,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
NULL,
|
|
||||||
&ControllerKey);
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
|
|
||||||
|
|
||||||
DetectBiosFloppyController(BusKey, ControllerKey);
|
|
||||||
|
|
||||||
/* Allocate resource descriptor */
|
/* Allocate resource descriptor */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||||
|
@ -814,7 +820,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Failed to allocate resource descriptor\n");
|
"Failed to allocate resource descriptor\n");
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize resource descriptor */
|
/* Initialize resource descriptor */
|
||||||
|
@ -832,9 +838,6 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
|
Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||||
for (i = 0; i < DiskCount; i++)
|
for (i = 0; i < DiskCount; i++)
|
||||||
{
|
{
|
||||||
if (BootDrive == 0x80 + i)
|
|
||||||
BootDriveReported = TRUE;
|
|
||||||
|
|
||||||
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
|
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
|
||||||
{
|
{
|
||||||
Int13Drives[i].DriveSelect = 0x80 + i;
|
Int13Drives[i].DriveSelect = 0x80 + i;
|
||||||
|
@ -852,17 +855,91 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
Geometry.BytesPerSector);
|
Geometry.BytesPerSector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
FldrCreateComponentKey(NULL,
|
||||||
FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
|
SystemClass,
|
||||||
|
MaximumType,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&SystemKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
|
return SystemKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG
|
||||||
|
GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
|
{
|
||||||
|
PCONFIGURATION_COMPONENT_DATA System;
|
||||||
|
ULONG ConfigurationDataLength;
|
||||||
|
ULONG DiskCount = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get root component
|
||||||
|
//
|
||||||
|
System = BusKey;
|
||||||
|
while (System->Parent)
|
||||||
|
System = System->Parent;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get root configuration data length
|
||||||
|
//
|
||||||
|
ConfigurationDataLength = System->ComponentEntry.ConfigurationDataLength;
|
||||||
|
|
||||||
|
//
|
||||||
|
// We assume that nothing wrong happened, and that configuration
|
||||||
|
// only consists of one CM_PARTIAL_RESOURCE_LIST entry, followed
|
||||||
|
// by n entries of CM_INT13_DRIVE_PARAMETER
|
||||||
|
//
|
||||||
|
if (ConfigurationDataLength > 0)
|
||||||
|
DiskCount = (ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST))
|
||||||
|
/ sizeof(CM_INT13_DRIVE_PARAMETER);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return number of disks
|
||||||
|
//
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Retrieving %lu INT13 disks\\0\n");
|
||||||
|
return DiskCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
|
{
|
||||||
|
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
|
||||||
|
BOOLEAN BootDriveReported = FALSE;
|
||||||
|
ULONG i;
|
||||||
|
ULONG DiskCount = GetDiskCount(BusKey);
|
||||||
|
CHAR BootPath[512];
|
||||||
|
|
||||||
|
FldrCreateComponentKey(BusKey,
|
||||||
|
ControllerClass,
|
||||||
|
DiskController,
|
||||||
|
Output | Input,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&ControllerKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
|
||||||
|
|
||||||
/* Create and fill subkey for each harddisk */
|
/* Create and fill subkey for each harddisk */
|
||||||
for (i = 0; i < DiskCount; i++)
|
for (i = 0; i < DiskCount; i++)
|
||||||
{
|
{
|
||||||
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
|
ULONG Size;
|
||||||
CHAR Identifier[20];
|
CHAR Identifier[20];
|
||||||
|
|
||||||
|
if (BootDrive == 0x80 + i)
|
||||||
|
BootDriveReported = TRUE;
|
||||||
|
|
||||||
/* Get disk values */
|
/* Get disk values */
|
||||||
|
PartialResourceList = GetHarddiskConfigurationData(0x80 + i, &Size);
|
||||||
GetHarddiskIdentifier(Identifier, 0x80 + i);
|
GetHarddiskIdentifier(Identifier, 0x80 + i);
|
||||||
|
|
||||||
/* Create disk key */
|
/* Create disk key */
|
||||||
|
@ -873,10 +950,9 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
0x0,
|
0x0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
Identifier,
|
Identifier,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
&DiskKey);
|
&DiskKey);
|
||||||
|
|
||||||
/* Set disk values */
|
|
||||||
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the drive we're booting from */
|
/* Get the drive we're booting from */
|
||||||
|
@ -1202,6 +1278,12 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set 'Configuration Data' value */
|
||||||
|
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||||
|
PartialResourceList.Version = 1;
|
||||||
|
PartialResourceList.Revision = 1;
|
||||||
|
PartialResourceList.Count = 0;
|
||||||
|
|
||||||
/* Create 'PointerPeripheral' key */
|
/* Create 'PointerPeripheral' key */
|
||||||
FldrCreateComponentKey(ControllerKey,
|
FldrCreateComponentKey(ControllerKey,
|
||||||
PeripheralClass,
|
PeripheralClass,
|
||||||
|
@ -1210,20 +1292,13 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
|
||||||
0x0,
|
0x0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
Identifier,
|
Identifier,
|
||||||
|
&PartialResourceList,
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
|
||||||
&PeripheralKey);
|
&PeripheralKey);
|
||||||
|
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Created key: PointerPeripheral\\0\n");
|
"Created key: PointerPeripheral\\0\n");
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
|
||||||
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
|
||||||
PartialResourceList.Version = 1;
|
|
||||||
PartialResourceList.Revision = 1;
|
|
||||||
PartialResourceList.Count = 0;
|
|
||||||
|
|
||||||
FldrSetConfigurationData(PeripheralKey,
|
|
||||||
&PartialResourceList,
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1261,16 +1336,6 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
/* Set 'Identifier' value */
|
/* Set 'Identifier' value */
|
||||||
sprintf(Buffer, "COM%ld", i + 1);
|
sprintf(Buffer, "COM%ld", i + 1);
|
||||||
|
|
||||||
/* Create controller key */
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
ControllerClass,
|
|
||||||
SerialController,
|
|
||||||
Output | Input | ConsoleIn | ConsoleOut,
|
|
||||||
ControllerNumber,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
Buffer,
|
|
||||||
&ControllerKey);
|
|
||||||
|
|
||||||
/* Build full device descriptor */
|
/* Build full device descriptor */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
|
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
|
||||||
|
@ -1318,8 +1383,18 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
(PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
|
(PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
|
||||||
SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
|
SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create controller key */
|
||||||
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
|
FldrCreateComponentKey(BusKey,
|
||||||
|
ControllerClass,
|
||||||
|
SerialController,
|
||||||
|
Output | Input | ConsoleIn | ConsoleOut,
|
||||||
|
ControllerNumber,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
Buffer,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&ControllerKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
if (!Rs232PortInUse(Base))
|
if (!Rs232PortInUse(Base))
|
||||||
|
@ -1365,16 +1440,6 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
/* Set 'Identifier' value */
|
/* Set 'Identifier' value */
|
||||||
sprintf(Buffer, "PARALLEL%ld", i + 1);
|
sprintf(Buffer, "PARALLEL%ld", i + 1);
|
||||||
|
|
||||||
/* Create controller key */
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
ControllerClass,
|
|
||||||
ParallelController,
|
|
||||||
Output,
|
|
||||||
ControllerNumber,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
Buffer,
|
|
||||||
&ControllerKey);
|
|
||||||
|
|
||||||
/* Build full device descriptor */
|
/* Build full device descriptor */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST);
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST);
|
||||||
if (Irq[i] != (ULONG)-1)
|
if (Irq[i] != (ULONG)-1)
|
||||||
|
@ -1415,8 +1480,18 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
|
PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create controller key */
|
||||||
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
|
FldrCreateComponentKey(BusKey,
|
||||||
|
ControllerClass,
|
||||||
|
ParallelController,
|
||||||
|
Output,
|
||||||
|
ControllerNumber,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
Buffer,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&ControllerKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
ControllerNumber++;
|
ControllerNumber++;
|
||||||
|
@ -1509,17 +1584,6 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
||||||
/* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */
|
/* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */
|
||||||
if (TRUE || DetectKeyboardDevice())
|
if (TRUE || DetectKeyboardDevice())
|
||||||
{
|
{
|
||||||
/* Create controller key */
|
|
||||||
FldrCreateComponentKey(ControllerKey,
|
|
||||||
PeripheralClass,
|
|
||||||
KeyboardPeripheral,
|
|
||||||
Input | ConsoleIn,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"PCAT_ENHANCED",
|
|
||||||
&PeripheralKey);
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n");
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
sizeof(CM_KEYBOARD_DEVICE_DATA);
|
sizeof(CM_KEYBOARD_DEVICE_DATA);
|
||||||
|
@ -1549,8 +1613,19 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
||||||
KeyboardData->Subtype = 0;
|
KeyboardData->Subtype = 0;
|
||||||
KeyboardData->KeyboardFlags = 0x20;
|
KeyboardData->KeyboardFlags = 0x20;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create controller key */
|
||||||
FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size);
|
FldrCreateComponentKey(ControllerKey,
|
||||||
|
PeripheralClass,
|
||||||
|
KeyboardPeripheral,
|
||||||
|
Input | ConsoleIn,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"PCAT_ENHANCED",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&PeripheralKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n");
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1564,17 +1639,6 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
PCONFIGURATION_COMPONENT_DATA ControllerKey;
|
PCONFIGURATION_COMPONENT_DATA ControllerKey;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
/* Create controller key */
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
ControllerClass,
|
|
||||||
KeyboardController,
|
|
||||||
Input | ConsoleIn,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
NULL,
|
|
||||||
&ControllerKey);
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n");
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
|
@ -1619,8 +1683,19 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
PartialDescriptor->u.Port.Start.HighPart = 0x0;
|
PartialDescriptor->u.Port.Start.HighPart = 0x0;
|
||||||
PartialDescriptor->u.Port.Length = 1;
|
PartialDescriptor->u.Port.Length = 1;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create controller key */
|
||||||
FldrSetConfigurationData(ControllerKey, PartialResourceList, Size);
|
FldrCreateComponentKey(BusKey,
|
||||||
|
ControllerClass,
|
||||||
|
KeyboardController,
|
||||||
|
Input | ConsoleIn,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&ControllerKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n");
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
DetectKeyboardPeripheral(ControllerKey);
|
DetectKeyboardPeripheral(ControllerKey);
|
||||||
|
@ -1747,17 +1822,6 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT, "Detected PS2 port\n");
|
DPRINTM(DPRINT_HWDETECT, "Detected PS2 port\n");
|
||||||
|
|
||||||
/* Create controller key */
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
ControllerClass,
|
|
||||||
PointerController,
|
|
||||||
Input,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
NULL,
|
|
||||||
&ControllerKey);
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n");
|
|
||||||
|
|
||||||
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||||
|
|
||||||
/* Initialize resource descriptor */
|
/* Initialize resource descriptor */
|
||||||
|
@ -1773,15 +1837,29 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
PartialResourceList.PartialDescriptors[0].u.Interrupt.Vector = 0;
|
PartialResourceList.PartialDescriptors[0].u.Interrupt.Vector = 0;
|
||||||
PartialResourceList.PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
|
PartialResourceList.PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create controller key */
|
||||||
FldrSetConfigurationData(ControllerKey,
|
FldrCreateComponentKey(BusKey,
|
||||||
&PartialResourceList,
|
ControllerClass,
|
||||||
sizeof(CM_PARTIAL_RESOURCE_LIST));
|
PointerController,
|
||||||
|
Input,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
&PartialResourceList,
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_LIST),
|
||||||
|
&ControllerKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n");
|
||||||
|
|
||||||
if (DetectPS2AuxDevice())
|
if (DetectPS2AuxDevice())
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT, "Detected PS2 mouse\n");
|
DPRINTM(DPRINT_HWDETECT, "Detected PS2 mouse\n");
|
||||||
|
|
||||||
|
/* Initialize resource descriptor */
|
||||||
|
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||||
|
PartialResourceList.Version = 1;
|
||||||
|
PartialResourceList.Revision = 1;
|
||||||
|
PartialResourceList.Count = 0;
|
||||||
|
|
||||||
/* Create peripheral key */
|
/* Create peripheral key */
|
||||||
FldrCreateComponentKey(ControllerKey,
|
FldrCreateComponentKey(ControllerKey,
|
||||||
ControllerClass,
|
ControllerClass,
|
||||||
|
@ -1790,20 +1868,11 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
0x0,
|
0x0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
"MICROSOFT PS2 MOUSE",
|
"MICROSOFT PS2 MOUSE",
|
||||||
|
&PartialResourceList,
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
|
||||||
&PeripheralKey);
|
&PeripheralKey);
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n");
|
DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n");
|
||||||
|
|
||||||
/* Initialize resource descriptor */
|
|
||||||
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
|
||||||
PartialResourceList.Version = 1;
|
|
||||||
PartialResourceList.Revision = 1;
|
|
||||||
PartialResourceList.Count = 0;
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
|
||||||
FldrSetConfigurationData(PeripheralKey,
|
|
||||||
&PartialResourceList,
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1850,6 +1919,8 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
0x0,
|
0x0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
Buffer,
|
Buffer,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
&ControllerKey);
|
&ControllerKey);
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
|
DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
|
||||||
|
|
||||||
|
@ -1864,16 +1935,6 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
PCONFIGURATION_COMPONENT_DATA BusKey;
|
PCONFIGURATION_COMPONENT_DATA BusKey;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
/* Create new bus key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"ISA",
|
|
||||||
&BusKey);
|
|
||||||
|
|
||||||
/* Increment bus number */
|
/* Increment bus number */
|
||||||
(*BusNumber)++;
|
(*BusNumber)++;
|
||||||
|
|
||||||
|
@ -1894,12 +1955,24 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
PartialResourceList->Revision = 1;
|
PartialResourceList->Revision = 1;
|
||||||
PartialResourceList->Count = 0;
|
PartialResourceList->Count = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create new bus key */
|
||||||
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
|
FldrCreateComponentKey(SystemKey,
|
||||||
|
AdapterClass,
|
||||||
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"ISA",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&BusKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
/* Detect ISA/BIOS devices */
|
/* Detect ISA/BIOS devices */
|
||||||
DetectBiosDisks(SystemKey, BusKey);
|
DetectBiosDisks(BusKey);
|
||||||
|
|
||||||
|
DetectBiosFloppyController(BusKey);
|
||||||
|
|
||||||
DetectSerialPorts(BusKey);
|
DetectSerialPorts(BusKey);
|
||||||
|
|
||||||
|
@ -1924,7 +1997,7 @@ PcHwDetect(VOID)
|
||||||
DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
|
DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
|
||||||
|
|
||||||
/* Create the 'System' key */
|
/* Create the 'System' key */
|
||||||
FldrCreateSystemKey(&SystemKey);
|
SystemKey = DetectSystem();
|
||||||
|
|
||||||
/* Detect buses */
|
/* Detect buses */
|
||||||
DetectPciBios(SystemKey, &BusNumber);
|
DetectPciBios(SystemKey, &BusNumber);
|
||||||
|
|
|
@ -67,16 +67,6 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
AcpiPresent = TRUE;
|
AcpiPresent = TRUE;
|
||||||
LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
|
LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
|
||||||
|
|
||||||
/* Create new bus key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"ACPI BIOS",
|
|
||||||
&BiosKey);
|
|
||||||
|
|
||||||
/* Get BIOS memory map */
|
/* Get BIOS memory map */
|
||||||
RtlZeroMemory(BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32);
|
RtlZeroMemory(BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32);
|
||||||
BiosMemoryMapEntryCount = PcMemGetMemoryMap(BiosMemoryMap,
|
BiosMemoryMapEntryCount = PcMemGetMemoryMap(BiosMemoryMap,
|
||||||
|
@ -109,10 +99,17 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
DPRINTM(DPRINT_HWDETECT, "RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
|
DPRINTM(DPRINT_HWDETECT, "RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
|
||||||
TableSize);
|
TableSize);
|
||||||
|
|
||||||
FldrSetConfigurationData(BiosKey,
|
/* Create new bus key */
|
||||||
PartialResourceList,
|
FldrCreateComponentKey(SystemKey,
|
||||||
sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize
|
AdapterClass,
|
||||||
);
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"ACPI BIOS",
|
||||||
|
PartialResourceList,
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize,
|
||||||
|
&BiosKey);
|
||||||
|
|
||||||
/* Increment bus number */
|
/* Increment bus number */
|
||||||
(*BusNumber)++;
|
(*BusNumber)++;
|
||||||
|
|
|
@ -61,6 +61,12 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
|
|
||||||
if (FindApmBios())
|
if (FindApmBios())
|
||||||
{
|
{
|
||||||
|
/* Create 'Configuration Data' value */
|
||||||
|
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||||
|
PartialResourceList.Version = 0;
|
||||||
|
PartialResourceList.Revision = 0;
|
||||||
|
PartialResourceList.Count = 0;
|
||||||
|
|
||||||
/* Create new bus key */
|
/* Create new bus key */
|
||||||
FldrCreateComponentKey(SystemKey,
|
FldrCreateComponentKey(SystemKey,
|
||||||
AdapterClass,
|
AdapterClass,
|
||||||
|
@ -69,18 +75,11 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
0x0,
|
0x0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
"APM",
|
"APM",
|
||||||
|
&PartialResourceList,
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
|
||||||
&BiosKey);
|
&BiosKey);
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
|
||||||
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
|
||||||
PartialResourceList.Version = 0;
|
|
||||||
PartialResourceList.Revision = 0;
|
|
||||||
PartialResourceList.Count = 0;
|
|
||||||
FldrSetConfigurationData(BiosKey,
|
|
||||||
&PartialResourceList,
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
|
||||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
|
||||||
|
|
||||||
/* Increment bus number */
|
/* Increment bus number */
|
||||||
(*BusNumber)++;
|
(*BusNumber)++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,15 +154,6 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT, "Table size: %u\n", Table->Size);
|
DPRINTM(DPRINT_HWDETECT, "Table size: %u\n", Table->Size);
|
||||||
|
|
||||||
FldrCreateComponentKey(BusKey,
|
|
||||||
PeripheralClass,
|
|
||||||
RealModeIrqRoutingTable,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"PCI Real-mode IRQ Routing Table",
|
|
||||||
&TableKey);
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
|
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
|
||||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + Table->Size;
|
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + Table->Size;
|
||||||
|
@ -194,8 +185,17 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||||
memcpy(&PartialResourceList->PartialDescriptors[2],
|
memcpy(&PartialResourceList->PartialDescriptors[2],
|
||||||
Table, Table->Size);
|
Table, Table->Size);
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
FldrCreateComponentKey(BusKey,
|
||||||
FldrSetConfigurationData(TableKey, PartialResourceList, Size);
|
PeripheralClass,
|
||||||
|
RealModeIrqRoutingTable,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"PCI Real-mode IRQ Routing Table",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&TableKey);
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,19 +215,6 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* Report the PCI BIOS */
|
/* Report the PCI BIOS */
|
||||||
if (FindPciBios(&BusData))
|
if (FindPciBios(&BusData))
|
||||||
{
|
{
|
||||||
/* Create new bus key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"PCI BIOS",
|
|
||||||
&BiosKey);
|
|
||||||
|
|
||||||
/* Increment bus number */
|
|
||||||
(*BusNumber)++;
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
|
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
|
||||||
PartialDescriptors);
|
PartialDescriptors);
|
||||||
|
@ -242,8 +229,21 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* Initialize resource descriptor */
|
/* Initialize resource descriptor */
|
||||||
memset(PartialResourceList, 0, Size);
|
memset(PartialResourceList, 0, Size);
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create new bus key */
|
||||||
FldrSetConfigurationData(BiosKey, PartialResourceList, Size);
|
FldrCreateComponentKey(SystemKey,
|
||||||
|
AdapterClass,
|
||||||
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"PCI BIOS",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&BiosKey);
|
||||||
|
|
||||||
|
/* Increment bus number */
|
||||||
|
(*BusNumber)++;
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
DetectPciIrqRoutingTable(BiosKey);
|
DetectPciIrqRoutingTable(BiosKey);
|
||||||
|
@ -251,16 +251,6 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* Report PCI buses */
|
/* Report PCI buses */
|
||||||
for (i = 0; i < (ULONG)BusData.NoBuses; i++)
|
for (i = 0; i < (ULONG)BusData.NoBuses; i++)
|
||||||
{
|
{
|
||||||
/* Create the bus key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"PCI",
|
|
||||||
&BusKey);
|
|
||||||
|
|
||||||
/* Check if this is the first bus */
|
/* Check if this is the first bus */
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
@ -289,10 +279,6 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
memcpy(&PartialResourceList->PartialDescriptors[1],
|
memcpy(&PartialResourceList->PartialDescriptors[1],
|
||||||
&BusData,
|
&BusData,
|
||||||
sizeof(PCI_REGISTRY_INFO));
|
sizeof(PCI_REGISTRY_INFO));
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
|
||||||
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
|
|
||||||
MmHeapFree(PartialResourceList);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -309,12 +295,22 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
|
|
||||||
/* Initialize resource descriptor */
|
/* Initialize resource descriptor */
|
||||||
memset(PartialResourceList, 0, Size);
|
memset(PartialResourceList, 0, Size);
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
|
||||||
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
|
|
||||||
MmHeapFree(PartialResourceList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create the bus key */
|
||||||
|
FldrCreateComponentKey(SystemKey,
|
||||||
|
AdapterClass,
|
||||||
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"PCI",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&BusKey);
|
||||||
|
|
||||||
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
/* Increment bus number */
|
/* Increment bus number */
|
||||||
(*BusNumber)++;
|
(*BusNumber)++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,8 @@ extern ULONG reactos_disk_count;
|
||||||
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
|
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
|
||||||
extern char reactos_arc_strings[32][256];
|
extern char reactos_arc_strings[32][256];
|
||||||
|
|
||||||
static VOID
|
static PCM_PARTIAL_RESOURCE_LIST
|
||||||
SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize)
|
||||||
ULONG DriveNumber)
|
|
||||||
{
|
{
|
||||||
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
||||||
|
@ -39,6 +38,11 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
GEOMETRY Geometry;
|
GEOMETRY Geometry;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize returned size
|
||||||
|
//
|
||||||
|
*pSize = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
||||||
|
@ -47,7 +51,7 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Failed to allocate a full resource descriptor\n");
|
"Failed to allocate a full resource descriptor\n");
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(PartialResourceList, 0, Size);
|
memset(PartialResourceList, 0, Size);
|
||||||
|
@ -78,7 +82,7 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
{
|
{
|
||||||
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
|
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
DPRINTM(DPRINT_HWDETECT,
|
DPRINTM(DPRINT_HWDETECT,
|
||||||
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||||
|
@ -88,8 +92,11 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
||||||
DiskGeometry->SectorsPerTrack,
|
DiskGeometry->SectorsPerTrack,
|
||||||
DiskGeometry->BytesPerSector);
|
DiskGeometry->BytesPerSector);
|
||||||
|
|
||||||
FldrSetConfigurationData(DiskKey, PartialResourceList, Size);
|
//
|
||||||
MmHeapFree(PartialResourceList);
|
// Return configuration data
|
||||||
|
//
|
||||||
|
*pSize = Size;
|
||||||
|
return PartialResourceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -202,17 +209,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
||||||
(int)DiskCount, (DiskCount == 1) ? "": "s");
|
(int)DiskCount, (DiskCount == 1) ? "": "s");
|
||||||
|
|
||||||
FldrCreateComponentKey(BusKey,
|
//DetectBiosFloppyController(BusKey);
|
||||||
ControllerClass,
|
|
||||||
DiskController,
|
|
||||||
Output | Input | Removable,
|
|
||||||
0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
NULL,
|
|
||||||
&ControllerKey);
|
|
||||||
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
|
|
||||||
|
|
||||||
//DetectBiosFloppyController(BusKey, ControllerKey);
|
|
||||||
|
|
||||||
/* Allocate resource descriptor */
|
/* Allocate resource descriptor */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||||
|
@ -258,16 +255,29 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
FldrCreateComponentKey(BusKey,
|
||||||
FldrSetConfigurationData(SystemKey, PartialResourceList, Size);
|
ControllerClass,
|
||||||
|
DiskController,
|
||||||
|
Output | Input,
|
||||||
|
0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
NULL,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&ControllerKey);
|
||||||
|
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
|
||||||
|
|
||||||
MmHeapFree(PartialResourceList);
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
/* Create and fill subkey for each harddisk */
|
/* Create and fill subkey for each harddisk */
|
||||||
for (i = 0; i < DiskCount; i++)
|
for (i = 0; i < DiskCount; i++)
|
||||||
{
|
{
|
||||||
|
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||||
|
ULONG Size;
|
||||||
CHAR Identifier[20];
|
CHAR Identifier[20];
|
||||||
|
|
||||||
/* Get disk values */
|
/* Get disk values */
|
||||||
|
PartialResourceList = GetHarddiskConfigurationData(0x80 + i, &Size);
|
||||||
GetHarddiskIdentifier(Identifier, 0x80 + i);
|
GetHarddiskIdentifier(Identifier, 0x80 + i);
|
||||||
|
|
||||||
/* Create disk key */
|
/* Create disk key */
|
||||||
|
@ -278,10 +288,12 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
0,
|
0,
|
||||||
0xFFFFFFFF,
|
0xFFFFFFFF,
|
||||||
Identifier,
|
Identifier,
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
&DiskKey);
|
&DiskKey);
|
||||||
|
|
||||||
/* Set disk values */
|
if (PartialResourceList)
|
||||||
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
|
MmHeapFree(PartialResourceList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,19 +304,6 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
PCONFIGURATION_COMPONENT_DATA BusKey;
|
PCONFIGURATION_COMPONENT_DATA BusKey;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
/* Create new bus key */
|
|
||||||
FldrCreateComponentKey(SystemKey,
|
|
||||||
AdapterClass,
|
|
||||||
MultiFunctionAdapter,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0xFFFFFFFF,
|
|
||||||
"ISA",
|
|
||||||
&BusKey);
|
|
||||||
|
|
||||||
/* Increment bus number */
|
|
||||||
(*BusNumber)++;
|
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Set 'Configuration Data' value */
|
||||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
|
@ -322,10 +321,22 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
PartialResourceList->Revision = 1;
|
PartialResourceList->Revision = 1;
|
||||||
PartialResourceList->Count = 0;
|
PartialResourceList->Count = 0;
|
||||||
|
|
||||||
/* Set 'Configuration Data' value */
|
/* Create new bus key */
|
||||||
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
|
FldrCreateComponentKey(SystemKey,
|
||||||
MmHeapFree(PartialResourceList);
|
AdapterClass,
|
||||||
|
MultiFunctionAdapter,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xFFFFFFFF,
|
||||||
|
"ISA",
|
||||||
|
PartialResourceList,
|
||||||
|
Size,
|
||||||
|
&BusKey);
|
||||||
|
|
||||||
|
/* Increment bus number */
|
||||||
|
(*BusNumber)++;
|
||||||
|
|
||||||
|
MmHeapFree(PartialResourceList);
|
||||||
|
|
||||||
/* Detect ISA/BIOS devices */
|
/* Detect ISA/BIOS devices */
|
||||||
DetectBiosDisks(SystemKey, BusKey);
|
DetectBiosDisks(SystemKey, BusKey);
|
||||||
|
|
|
@ -394,6 +394,8 @@ VOID OfwCopyDeviceTree
|
||||||
0,
|
0,
|
||||||
(ULONG)-1,
|
(ULONG)-1,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
&NewKey);
|
&NewKey);
|
||||||
|
|
||||||
/* Add properties */
|
/* Add properties */
|
||||||
|
|
|
@ -20,6 +20,12 @@ PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
|
||||||
|
|
||||||
BOOLEAN UseRealHeap = FALSE;
|
BOOLEAN UseRealHeap = FALSE;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
|
||||||
|
IN PCM_PARTIAL_RESOURCE_LIST ResourceList,
|
||||||
|
IN ULONG Size);
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
|
@ -139,6 +145,8 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
||||||
IN ULONG Key,
|
IN ULONG Key,
|
||||||
IN ULONG Affinity,
|
IN ULONG Affinity,
|
||||||
IN PCHAR IdentifierString,
|
IN PCHAR IdentifierString,
|
||||||
|
IN PCM_PARTIAL_RESOURCE_LIST ResourceList,
|
||||||
|
IN ULONG Size,
|
||||||
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
|
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
|
||||||
{
|
{
|
||||||
PCONFIGURATION_COMPONENT_DATA ComponentData;
|
PCONFIGURATION_COMPONENT_DATA ComponentData;
|
||||||
|
@ -152,7 +160,8 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
||||||
ComponentData->Parent = SystemNode;
|
ComponentData->Parent = SystemNode;
|
||||||
|
|
||||||
/* Link us to the parent */
|
/* Link us to the parent */
|
||||||
FldrLinkToParent(SystemNode, ComponentData);
|
if (SystemNode)
|
||||||
|
FldrLinkToParent(SystemNode, ComponentData);
|
||||||
|
|
||||||
/* Set us up */
|
/* Set us up */
|
||||||
Component = &ComponentData->ComponentEntry;
|
Component = &ComponentData->ComponentEntry;
|
||||||
|
@ -166,6 +175,10 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
||||||
if (IdentifierString)
|
if (IdentifierString)
|
||||||
FldrSetIdentifier(ComponentData, IdentifierString);
|
FldrSetIdentifier(ComponentData, IdentifierString);
|
||||||
|
|
||||||
|
/* Set configuration data */
|
||||||
|
if (ResourceList)
|
||||||
|
FldrSetConfigurationData(ComponentData, ResourceList, Size);
|
||||||
|
|
||||||
/* Return the child */
|
/* Return the child */
|
||||||
*ComponentKey = ComponentData;
|
*ComponentKey = ComponentData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue