Author: sir_richard
Date: Tue Sep 21 17:07:40 2010
New Revision: 48844
URL:
http://svn.reactos.org/svn/reactos?rev=48844&view=rev
Log:
[HAL]: Partly implement HalpAdjustPCIResourceList required for legacy HAL. No actual
adjustment is done yet, since the Range package is not implemented.
[HAL]: Implement most of HalpGetISAFixedPCIIrq, other than the legacy PCI IRQ Routing
Miniport callbacks, which aren't yet implemented by ReactOS.
The Windows PCI Bus Driver seems to work now.
Modified:
trunk/reactos/hal/halx86/generic/legacy/bus/pcibus.c
Modified: trunk/reactos/hal/halx86/generic/legacy/bus/pcibus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bus/pcibus.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bus/pcibus.c [iso-8859-1] Tue Sep 21 17:07:40
2010
@@ -14,6 +14,7 @@
/* GLOBALS *******************************************************************/
+extern BOOLEAN HalpPciLockSettings;
ULONG HalpBusType;
PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2] = {{{{0}}}};
@@ -558,8 +559,42 @@
IN PCI_SLOT_NUMBER PciSlot,
OUT PSUPPORTED_RANGE *Range)
{
- UNIMPLEMENTED;
- while (TRUE);
+ PCI_COMMON_HEADER PciData;
+
+ /* Read PCI configuration data */
+ HalGetBusData(PCIConfiguration,
+ BusHandler->BusNumber,
+ PciSlot.u.AsULONG,
+ &PciData,
+ PCI_COMMON_HDR_LENGTH);
+
+ /* Make sure it's a real device */
+ if (PciData.VendorID == PCI_INVALID_VENDORID) return STATUS_UNSUCCESSFUL;
+
+ /* Allocate the supported range structure */
+ *Range = ExAllocatePoolWithTag(PagedPool, sizeof(SUPPORTED_RANGE), 'Hal ');
+ if (!*Range) return STATUS_INSUFFICIENT_RESOURCES;
+
+ /* Set it up */
+ RtlZeroMemory(*Range, sizeof(SUPPORTED_RANGE));
+ (*Range)->Base = 1;
+
+ /* If the PCI device has no IRQ, nothing to do */
+ if (!PciData.u.type0.InterruptPin) return STATUS_SUCCESS;
+
+ /* FIXME: The PCI IRQ Routing Miniport should be called */
+
+ /* Also if the INT# seems bogus, nothing to do either */
+ if ((PciData.u.type0.InterruptLine == 0) ||
+ (PciData.u.type0.InterruptLine == 255))
+ {
+ /* Fake success */
+ return STATUS_SUCCESS;
+ }
+
+ /* Otherwise, the INT# should be valid, return it to the caller */
+ (*Range)->Base = PciData.u.type0.InterruptLine;
+ (*Range)->Limit = PciData.u.type0.InterruptLine;
return STATUS_SUCCESS;
}
@@ -622,10 +657,40 @@
IN PBUS_HANDLER RootHandler,
IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
{
- /* Not yet supported */
- DbgPrint("HAL: PCI Resource List Adjustment not implemented!");
- while (TRUE);
- return STATUS_UNSUCCESSFUL;
+ PPCIPBUSDATA BusData;
+ PCI_SLOT_NUMBER SlotNumber;
+ PSUPPORTED_RANGE Interrupt;
+ NTSTATUS Status;
+
+ /* Get PCI bus data */
+ BusData = BusHandler->BusData;
+ SlotNumber.u.AsULONG = (*pResourceList)->SlotNumber;
+
+ /* Get the IRQ supported range */
+ Status = BusData->GetIrqRange(BusHandler, RootHandler, SlotNumber,
&Interrupt);
+ if (!NT_SUCCESS(Status)) return Status;
+#ifndef _MINIHAL_
+ /* Handle the /PCILOCK feature */
+ if (HalpPciLockSettings)
+ {
+ /* /PCILOCK is not yet supported */
+ UNIMPLEMENTED;
+ while (TRUE);
+ }
+#endif
+ /* Now create the correct resource list based on the supported bus ranges */
+#if 0
+ Status = HaliAdjustResourceListRange(BusHandler->BusAddresses,
+ Interrupt,
+ pResourceList);
+#else
+ DPRINT1("HAL: No PCI Resource Adjustment done! Hardware may
malfunction\n");
+ Status = STATUS_SUCCESS;
+#endif
+
+ /* Return to caller */
+ ExFreePool(Interrupt);
+ return Status;
}
NTSTATUS