mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 04:35:07 +00:00
- Pass ARC Hardware Tree in SetupLDR too.
- Zero-initialize memory from the Hardware Heap, just to be sure. - Don't set the Version/Key/Affinity when creating the system node, let the caller do this. - Fix the way components were added in the tree, it was busted. - Enable setting of component information for the APM and ACPI component nodes. This was #if'ed out because it crashed the kernel while PnP was getting bus information for ATAPI/SCSIPORT, since the nodes had no component data. Add some component data to remove the crash, and then enable component information. - The Real Mode IRQ Routing Table is a Peripheral Class, not a System Class. - Enable the code to create component nodes for each PCI Bus, it was #if'ed out ages ago. - Don't create any component data for the PCI BIOS, it doesn't have any. - Create component data for the first PCI Bus component node based on the PCI_REGISTRY_INFO strucutre. - Fix the way the BIOS Hard disk Peripheral nodes are created. - Always create the DiskController node with floppy disk information, but don't do actual floppy detection if no floppies are there. - Fix flags for Floppy Peripheral nodes. - Fix vector for Floppy Peripheral node. - Set component information for each BIOS hard disk peripheral node. - Fix component information for Serial Peripherals, they were being created on the Serial Controller node instead. - Set empty component information for the system node. - TODO: Setup ACPI and APM Bios descriptor information. - TODO: Setup ROM BIOS Block descriptor information. svn path=/trunk/; revision=31131
This commit is contained in:
parent
82b5e2eb8b
commit
a1c2403f66
|
@ -508,119 +508,6 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
|
|||
FldrSetIdentifier(DiskKey, Identifier);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||
PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||
{
|
||||
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
PCM_INT13_DRIVE_PARAMETER Int13Drives;
|
||||
GEOMETRY Geometry;
|
||||
PCONFIGURATION_COMPONENT_DATA DiskKey;
|
||||
ULONG DiskCount;
|
||||
ULONG Size;
|
||||
ULONG i;
|
||||
BOOLEAN Changed;
|
||||
|
||||
/* Count the number of visible drives */
|
||||
DiskReportError(FALSE);
|
||||
DiskCount = 0;
|
||||
|
||||
/* There are some really broken BIOSes out there. There are even BIOSes
|
||||
* that happily report success when you ask them to read from non-existent
|
||||
* harddisks. So, we set the buffer to known contents first, then try to
|
||||
* read. If the BIOS reports success but the buffer contents haven't
|
||||
* changed then we fail anyway */
|
||||
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
|
||||
while (MachDiskReadLogicalSectors(0x80 + DiskCount, 0ULL, 1, (PVOID)DISKREADBUFFER))
|
||||
{
|
||||
Changed = FALSE;
|
||||
for (i = 0; ! Changed && i < 512; i++)
|
||||
{
|
||||
Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
|
||||
}
|
||||
if (! Changed)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
|
||||
(int)DiskCount));
|
||||
break;
|
||||
}
|
||||
DiskCount++;
|
||||
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
|
||||
}
|
||||
DiskReportError(TRUE);
|
||||
DbgPrint((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
||||
(int)DiskCount, (DiskCount == 1) ? "": "s"));
|
||||
|
||||
/* Allocate resource descriptor */
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (FullResourceDescriptor == NULL)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = InterfaceTypeUndefined;
|
||||
FullResourceDescriptor->BusNumber = -1;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 1;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type =
|
||||
CmResourceTypeDeviceSpecific;
|
||||
// FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition =
|
||||
// FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Flags =
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize =
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
|
||||
/* Get harddisk Int13 geometry data */
|
||||
Int13Drives = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
|
||||
for (i = 0; i < DiskCount; i++)
|
||||
{
|
||||
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
|
||||
{
|
||||
Int13Drives[i].DriveSelect = 0x80 + i;
|
||||
Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
|
||||
Int13Drives[i].SectorsPerTrack = Geometry.Sectors;
|
||||
Int13Drives[i].MaxHeads = Geometry.Heads - 1;
|
||||
Int13Drives[i].NumberDrives = DiskCount;
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||
0x80 + i,
|
||||
Geometry.Cylinders - 1,
|
||||
Geometry.Heads -1,
|
||||
Geometry.Sectors,
|
||||
Geometry.BytesPerSector));
|
||||
}
|
||||
}
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
FldrSetConfigurationData(SystemKey, FullResourceDescriptor, Size);
|
||||
MmFreeMemory(FullResourceDescriptor);
|
||||
|
||||
/* Create and fill subkey for each harddisk */
|
||||
for (i = 0; i < DiskCount; i++)
|
||||
{
|
||||
/* Create disk key */
|
||||
FldrCreateComponentKey(BusKey,
|
||||
L"DiskController\\0\\DiskPeripheral",
|
||||
i,
|
||||
PeripheralClass,
|
||||
DiskPeripheral,
|
||||
&DiskKey);
|
||||
|
||||
/* Set disk values */
|
||||
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
|
||||
SetHarddiskIdentifier(DiskKey, 0x80 + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ULONG
|
||||
GetFloppyCount(VOID)
|
||||
{
|
||||
|
@ -694,7 +581,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|||
|
||||
/* Set 'ComponentInformation' value */
|
||||
FldrSetComponentInformation(PeripheralKey,
|
||||
0x0,
|
||||
Input | Output,
|
||||
FloppyNumber,
|
||||
0xFFFFFFFF);
|
||||
|
||||
|
@ -743,12 +630,11 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|||
|
||||
|
||||
static VOID
|
||||
DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||
PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||
DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey,
|
||||
PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
||||
{
|
||||
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
||||
PCONFIGURATION_COMPONENT_DATA ControllerKey;
|
||||
ULONG Size;
|
||||
ULONG FloppyCount;
|
||||
|
||||
|
@ -756,24 +642,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Floppy count: %u\n",
|
||||
FloppyCount));
|
||||
|
||||
if (FloppyCount == 0)
|
||||
return;
|
||||
|
||||
FldrCreateComponentKey(SystemKey,
|
||||
L"DiskController",
|
||||
0,
|
||||
ControllerClass,
|
||||
DiskController,
|
||||
&ControllerKey);
|
||||
DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
|
||||
|
||||
/* Set 'ComponentInformation' value */
|
||||
FldrSetComponentInformation(ControllerKey,
|
||||
Output | Input | Removable,
|
||||
0,
|
||||
0xFFFFFFFF);
|
||||
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
|
||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
|
@ -807,7 +676,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|||
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
|
||||
PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
PartialDescriptor->u.Interrupt.Level = 6;
|
||||
PartialDescriptor->u.Interrupt.Vector = 0;
|
||||
PartialDescriptor->u.Interrupt.Vector = 6;
|
||||
PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
|
||||
|
||||
/* Set DMA channel */
|
||||
|
@ -822,9 +691,140 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|||
FldrSetConfigurationData(ControllerKey, FullResourceDescriptor, Size);
|
||||
MmFreeMemory(FullResourceDescriptor);
|
||||
|
||||
DetectBiosFloppyPeripheral(ControllerKey);
|
||||
if (FloppyCount) DetectBiosFloppyPeripheral(ControllerKey);
|
||||
}
|
||||
|
||||
static VOID
|
||||
DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||
PCONFIGURATION_COMPONENT_DATA BusKey)
|
||||
{
|
||||
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
PCM_INT13_DRIVE_PARAMETER Int13Drives;
|
||||
GEOMETRY Geometry;
|
||||
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
|
||||
ULONG DiskCount;
|
||||
ULONG Size;
|
||||
ULONG i;
|
||||
BOOLEAN Changed;
|
||||
|
||||
/* Count the number of visible drives */
|
||||
DiskReportError(FALSE);
|
||||
DiskCount = 0;
|
||||
|
||||
/* There are some really broken BIOSes out there. There are even BIOSes
|
||||
* that happily report success when you ask them to read from non-existent
|
||||
* harddisks. So, we set the buffer to known contents first, then try to
|
||||
* read. If the BIOS reports success but the buffer contents haven't
|
||||
* changed then we fail anyway */
|
||||
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
|
||||
while (MachDiskReadLogicalSectors(0x80 + DiskCount, 0ULL, 1, (PVOID)DISKREADBUFFER))
|
||||
{
|
||||
Changed = FALSE;
|
||||
for (i = 0; ! Changed && i < 512; i++)
|
||||
{
|
||||
Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
|
||||
}
|
||||
if (! Changed)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
|
||||
(int)DiskCount));
|
||||
break;
|
||||
}
|
||||
DiskCount++;
|
||||
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
|
||||
}
|
||||
DiskReportError(TRUE);
|
||||
DbgPrint((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
|
||||
(int)DiskCount, (DiskCount == 1) ? "": "s"));
|
||||
|
||||
FldrCreateComponentKey(BusKey,
|
||||
L"DiskController",
|
||||
0,
|
||||
ControllerClass,
|
||||
DiskController,
|
||||
&ControllerKey);
|
||||
DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
|
||||
|
||||
/* Set 'ComponentInformation' value */
|
||||
FldrSetComponentInformation(ControllerKey,
|
||||
Output | Input | Removable,
|
||||
0,
|
||||
0xFFFFFFFF);
|
||||
|
||||
DetectBiosFloppyController(BusKey, ControllerKey);
|
||||
|
||||
/* Allocate resource descriptor */
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (FullResourceDescriptor == NULL)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = InterfaceTypeUndefined;
|
||||
FullResourceDescriptor->BusNumber = -1;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 1;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type = CmResourceTypeDeviceSpecific;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition = 0;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Flags = 0;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize =
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
|
||||
/* Get harddisk Int13 geometry data */
|
||||
Int13Drives = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
|
||||
for (i = 0; i < DiskCount; i++)
|
||||
{
|
||||
if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
|
||||
{
|
||||
Int13Drives[i].DriveSelect = 0x80 + i;
|
||||
Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
|
||||
Int13Drives[i].SectorsPerTrack = Geometry.Sectors;
|
||||
Int13Drives[i].MaxHeads = Geometry.Heads - 1;
|
||||
Int13Drives[i].NumberDrives = DiskCount;
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||
0x80 + i,
|
||||
Geometry.Cylinders - 1,
|
||||
Geometry.Heads -1,
|
||||
Geometry.Sectors,
|
||||
Geometry.BytesPerSector));
|
||||
}
|
||||
}
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
FldrSetConfigurationData(SystemKey, FullResourceDescriptor, Size);
|
||||
MmFreeMemory(FullResourceDescriptor);
|
||||
|
||||
/* Create and fill subkey for each harddisk */
|
||||
for (i = 0; i < DiskCount; i++)
|
||||
{
|
||||
/* Create disk key */
|
||||
FldrCreateComponentKey(ControllerKey,
|
||||
L"DiskPeripheral",
|
||||
i,
|
||||
PeripheralClass,
|
||||
DiskPeripheral,
|
||||
&DiskKey);
|
||||
|
||||
/* Set 'ComponentInformation' value */
|
||||
FldrSetComponentInformation(DiskKey,
|
||||
Output | Input,
|
||||
0,
|
||||
0xFFFFFFFF);
|
||||
|
||||
/* Set disk values */
|
||||
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
|
||||
SetHarddiskIdentifier(DiskKey, 0x80 + i);
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
InitializeSerialPort(ULONG Port,
|
||||
|
@ -1483,7 +1483,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|||
DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"));
|
||||
|
||||
/* Set 'ComponentInformation' value */
|
||||
FldrSetComponentInformation(ControllerKey,
|
||||
FldrSetComponentInformation(PeripheralKey,
|
||||
Input | ConsoleIn,
|
||||
0,
|
||||
0xFFFFFFFF);
|
||||
|
@ -1911,8 +1911,6 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* Detect ISA/BIOS devices */
|
||||
DetectBiosDisks(SystemKey, BusKey);
|
||||
|
||||
DetectBiosFloppyController(SystemKey, BusKey);
|
||||
|
||||
DetectSerialPorts(BusKey);
|
||||
|
||||
DetectParallelPorts(BusKey);
|
||||
|
@ -1937,6 +1935,12 @@ PcHwDetect(VOID)
|
|||
|
||||
/* Create the 'System' key */
|
||||
FldrCreateSystemKey(&SystemKey);
|
||||
|
||||
/* Set empty component information */
|
||||
FldrSetComponentInformation(SystemKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
|
||||
/* Detect buses */
|
||||
DetectPciBios(SystemKey, &BusNumber);
|
||||
|
|
|
@ -52,7 +52,8 @@ VOID
|
|||
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||
{
|
||||
PCONFIGURATION_COMPONENT_DATA BiosKey;
|
||||
|
||||
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
|
||||
if (FindAcpiBios())
|
||||
{
|
||||
AcpiPresent = TRUE;
|
||||
|
@ -65,14 +66,24 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
MultiFunctionAdapter,
|
||||
&BiosKey);
|
||||
|
||||
#if 0
|
||||
/* Set 'Component Information' */
|
||||
FldrSetComponentInformation(BiosKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
memset(&FullResourceDescriptor, 0, sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
|
||||
FullResourceDescriptor.InterfaceType = Internal;
|
||||
FullResourceDescriptor.BusNumber = *BusNumber;
|
||||
FullResourceDescriptor.PartialResourceList.Version = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Revision = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Count = 0;
|
||||
FldrSetConfigurationData(BiosKey,
|
||||
&FullResourceDescriptor,
|
||||
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
||||
|
||||
/* Increment bus number */
|
||||
(*BusNumber)++;
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ VOID
|
|||
DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||
{
|
||||
PCONFIGURATION_COMPONENT_DATA BiosKey;
|
||||
|
||||
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
|
||||
if (FindApmBios())
|
||||
{
|
||||
/* Create new bus key */
|
||||
|
@ -67,14 +68,24 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
AdapterClass,
|
||||
MultiFunctionAdapter,
|
||||
&BiosKey);
|
||||
|
||||
#if 0
|
||||
|
||||
/* Set 'Component Information' */
|
||||
FldrSetComponentInformation(BiosKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
memset(&FullResourceDescriptor, 0, sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
|
||||
FullResourceDescriptor.InterfaceType = Internal;
|
||||
FullResourceDescriptor.BusNumber = *BusNumber;
|
||||
FullResourceDescriptor.PartialResourceList.Version = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Revision = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Count = 0;
|
||||
FldrSetConfigurationData(BiosKey,
|
||||
&FullResourceDescriptor,
|
||||
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
|
||||
|
||||
/* Increment bus number */
|
||||
(*BusNumber)++;
|
||||
|
|
|
@ -54,13 +54,13 @@ typedef struct _PCI_IRQ_ROUTING_TABLE
|
|||
ROUTING_SLOT Slot[1];
|
||||
} __attribute__((packed)) PCI_IRQ_ROUTING_TABLE, *PPCI_IRQ_ROUTING_TABLE;
|
||||
|
||||
typedef struct _CM_PCI_BUS_DATA
|
||||
typedef struct _PCI_REGISTRY_INFO
|
||||
{
|
||||
UCHAR BusCount;
|
||||
USHORT PciVersion;
|
||||
UCHAR HardwareMechanism;
|
||||
} __attribute__((packed)) CM_PCI_BUS_DATA, *PCM_PCI_BUS_DATA;
|
||||
|
||||
UCHAR MajorRevision;
|
||||
UCHAR MinorRevision;
|
||||
UCHAR NoBuses;
|
||||
UCHAR HardwareMechanism;
|
||||
} PCI_REGISTRY_INFO, *PPCI_REGISTRY_INFO;
|
||||
|
||||
static PPCI_IRQ_ROUTING_TABLE
|
||||
GetPciIrqRoutingTable(VOID)
|
||||
|
@ -106,7 +106,7 @@ GetPciIrqRoutingTable(VOID)
|
|||
|
||||
|
||||
static BOOLEAN
|
||||
FindPciBios(PCM_PCI_BUS_DATA BusData)
|
||||
FindPciBios(PPCI_REGISTRY_INFO BusData)
|
||||
{
|
||||
REGS RegsIn;
|
||||
REGS RegsOut;
|
||||
|
@ -125,8 +125,9 @@ FindPciBios(PCM_PCI_BUS_DATA BusData)
|
|||
DbgPrint((DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl));
|
||||
DbgPrint((DPRINT_HWDETECT, "CL: %x\n", RegsOut.b.cl));
|
||||
|
||||
BusData->BusCount = RegsOut.b.cl + 1;
|
||||
BusData->PciVersion = RegsOut.w.bx;
|
||||
BusData->NoBuses = RegsOut.b.cl + 1;
|
||||
BusData->MajorRevision = RegsOut.b.bh;
|
||||
BusData->MinorRevision = RegsOut.b.bl;
|
||||
BusData->HardwareMechanism = RegsOut.b.cl;
|
||||
|
||||
return TRUE;
|
||||
|
@ -156,7 +157,7 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
FldrCreateComponentKey(BusKey,
|
||||
L"RealModeIrqRoutingTable",
|
||||
0,
|
||||
SystemClass,
|
||||
PeripheralClass,
|
||||
RealModeIrqRoutingTable,
|
||||
&TableKey);
|
||||
|
||||
|
@ -214,14 +215,13 @@ VOID
|
|||
DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||
{
|
||||
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
|
||||
CM_PCI_BUS_DATA BusData;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
||||
PCI_REGISTRY_INFO BusData;
|
||||
PCONFIGURATION_COMPONENT_DATA BiosKey;
|
||||
ULONG Size;
|
||||
#if 0
|
||||
PCONFIGURATION_COMPONENT_DATA BusKey;
|
||||
ULONG i;
|
||||
WCHAR szPci[] = L"PCI";
|
||||
#endif
|
||||
|
||||
/* Report the PCI BIOS */
|
||||
if (FindPciBios(&BusData))
|
||||
|
@ -247,26 +247,23 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
FldrSetIdentifier(BiosKey, L"PCI BIOS");
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
|
||||
Size = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR,
|
||||
PartialResourceList.PartialDescriptors);
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (FullResourceDescriptor == NULL)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = PCIBus;
|
||||
FullResourceDescriptor->BusNumber = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 1;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type = CmResourceTypeBusNumber;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Start = 0;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Length = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 0;
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
FldrSetConfigurationData(BiosKey, FullResourceDescriptor, Size);
|
||||
|
@ -274,36 +271,90 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
|
||||
DetectPciIrqRoutingTable(BiosKey);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* FIXME:
|
||||
* Enabling this piece of code will corrupt the boot sequence!
|
||||
* This is probably caused by a bug in the registry code!
|
||||
*/
|
||||
|
||||
/* Report PCI buses */
|
||||
for (i = 0; i < (ULONG)BusData.BusCount; i++)
|
||||
for (i = 0; i < (ULONG)BusData.NoBuses; i++)
|
||||
{
|
||||
/* Create the bus key */
|
||||
FldrCreateComponentKey(SystemKey,
|
||||
L"MultifunctionAdapter",
|
||||
*BusNumber,
|
||||
AdapterClass,
|
||||
MultiFunctionAdapter,
|
||||
&BiosKey);
|
||||
|
||||
&BusKey);
|
||||
|
||||
/* Set 'Component Information' */
|
||||
FldrSetComponentInformation(BusKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
|
||||
|
||||
/* Check if this is the first bus */
|
||||
if (i == 0)
|
||||
{
|
||||
/* Set 'Configuration Data' value */
|
||||
Size = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR,
|
||||
PartialResourceList.PartialDescriptors) +
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
|
||||
sizeof(PCI_REGISTRY_INFO);
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (!FullResourceDescriptor)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = PCIBus;
|
||||
FullResourceDescriptor->BusNumber = i;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 1;
|
||||
PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[0];
|
||||
PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
|
||||
PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
|
||||
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(PCI_REGISTRY_INFO);
|
||||
memcpy(&FullResourceDescriptor->PartialResourceList.PartialDescriptors[1],
|
||||
&BusData,
|
||||
sizeof(PCI_REGISTRY_INFO));
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
FldrSetConfigurationData(BusKey, FullResourceDescriptor, Size);
|
||||
MmFreeMemory(FullResourceDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set 'Configuration Data' value */
|
||||
Size = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR,
|
||||
PartialResourceList.PartialDescriptors);
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (!FullResourceDescriptor)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"Failed to allocate resource descriptor\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = PCIBus;
|
||||
FullResourceDescriptor->BusNumber = i;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 0;
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
FldrSetConfigurationData(BusKey, FullResourceDescriptor, Size);
|
||||
MmFreeMemory(FullResourceDescriptor);
|
||||
}
|
||||
|
||||
/* Increment bus number */
|
||||
(*BusNumber)++;
|
||||
|
||||
|
||||
/* Set 'Identifier' value */
|
||||
FldrSetIdentifier(BiosKey, szPci);
|
||||
FldrSetIdentifier(BusKey, szPci);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ FldrpHwHeapAlloc(IN ULONG Size)
|
|||
/* Return a block of memory from the ARC Hardware Heap */
|
||||
Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation];
|
||||
|
||||
/* Clear it */
|
||||
RtlZeroMemory(Buffer, Size);
|
||||
|
||||
/* Increment the heap location */
|
||||
FldrpHwHeapLocation += Size;
|
||||
if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL;
|
||||
|
@ -118,9 +121,6 @@ FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
|
|||
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;
|
||||
|
@ -139,6 +139,36 @@ FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
|
|||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
FldrLinkToParent(IN PCONFIGURATION_COMPONENT_DATA Parent,
|
||||
IN PCONFIGURATION_COMPONENT_DATA Child)
|
||||
{
|
||||
PCONFIGURATION_COMPONENT_DATA Sibling;
|
||||
|
||||
/* Get the first sibling */
|
||||
Sibling = Parent->Child;
|
||||
|
||||
/* If no sibling exists, then we are the first child */
|
||||
if (!Sibling)
|
||||
{
|
||||
/* Link us in */
|
||||
Parent->Child = Child;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Loop each sibling */
|
||||
do
|
||||
{
|
||||
/* This is now the parent */
|
||||
Parent = Sibling;
|
||||
} while ((Sibling = Sibling->Sibling));
|
||||
|
||||
/* Found the lowest sibling; mark us as its sibling too */
|
||||
Parent->Sibling = Child;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
||||
|
@ -160,17 +190,8 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
|||
/* 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;
|
||||
}
|
||||
/* Link us to the parent */
|
||||
FldrLinkToParent(SystemNode, ComponentData);
|
||||
|
||||
/* Set us up */
|
||||
Component = &ComponentData->ComponentEntry;
|
||||
|
|
|
@ -30,6 +30,7 @@ char reactos_kernel_cmdline[255]; // Command line passed to kernel
|
|||
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
reactos_mem_data_t reactos_mem_data;
|
||||
extern char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE];
|
||||
char szBootPath[256];
|
||||
char szHalName[256];
|
||||
CHAR SystemRoot[255];
|
||||
|
@ -186,6 +187,7 @@ VOID RunLoader(VOID)
|
|||
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
|
||||
LoaderBlock.ModsCount = 0;
|
||||
LoaderBlock.ModsAddr = reactos_modules;
|
||||
LoaderBlock.ArchExtra = (ULONG)reactos_arc_hardware_data;
|
||||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t);
|
||||
if (LoaderBlock.MmapLength)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue