reactos/drivers/bus/pcix/arb/ar_memio.c

184 lines
4.5 KiB
C
Raw Normal View History

/*
* PROJECT: ReactOS PCI Bus Driver
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: drivers/bus/pci/arb/ar_memiono.c
* PURPOSE: Memory and I/O Port Resource Arbitration
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <pci.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
PCI_INTERFACE ArbiterInterfaceMemory =
{
&GUID_ARBITER_INTERFACE_STANDARD,
sizeof(ARBITER_INTERFACE),
0,
0,
PCI_INTERFACE_FDO,
0,
PciArb_Memory,
armem_Constructor,
armem_Initializer
};
PCI_INTERFACE ArbiterInterfaceIo =
{
&GUID_ARBITER_INTERFACE_STANDARD,
sizeof(ARBITER_INTERFACE),
0,
0,
PCI_INTERFACE_FDO,
0,
PciArb_Io,
ario_Constructor,
ario_Initializer
};
/* FUNCTIONS ******************************************************************/
NTSTATUS
NTAPI
ario_Initializer(IN PVOID Instance)
{
/* Not yet implemented */
UNIMPLEMENTED;
//while (TRUE);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
ario_Constructor(IN PVOID DeviceExtension,
IN PVOID PciInterface,
IN PVOID InterfaceData,
IN USHORT Version,
IN USHORT Size,
IN PINTERFACE Interface)
{
PPCI_FDO_EXTENSION FdoExtension = (PPCI_FDO_EXTENSION)DeviceExtension;
NTSTATUS Status;
PAGED_CODE();
/* Make sure it's the expected interface */
if ((ULONG)InterfaceData != CmResourceTypePort)
{
/* Arbiter support must have been initialized first */
if (FdoExtension->ArbitersInitialized)
{
/* Not yet implemented */
UNIMPLEMENTED;
while (TRUE);
}
else
{
/* No arbiters for this FDO */
Status = STATUS_NOT_SUPPORTED;
}
}
else
{
/* Not the right interface */
Status = STATUS_INVALID_PARAMETER_5;
}
/* Return the status */
return Status;
}
Joint patch By sir_richard: [PCIX]: - Implement PciIsSlotPresentInParentMethod for ACPI query, and PcoDecodeEnable utility function. - Implement PciConfigureIdeController based on WDHC Whitepaper "How Windows Switches a Controller to Native Mode". Check for PciEanbleNativeModeATA in registry, InitSafeBootMode, and call the ACPI driver to evaluate if NATA is present on the slot. Only configure the controller if both channels support native mode, as this is a Windows restriction. - Implement PciApplyHacks for enumeration and resource update cases. In the first case, we handle legacy DEC Alpha Intel i82375 and i82378 PCI-to-(E)ISA bridges with invalid class codes. In the second, we configure IDE controllers for Native mode, except the OPTi Viper-M, which is known to cause issues. We also support cards with legacy VGA decodes by telling the arbiter to enable full access to the rangesm and finally we completely disable the decodes on Compaq PCI Hotplug Controllers (Revision 17) on PAE systems, as they have bugs handling 64-bit addresses. Finally, on resource updates, we apply a vendor-specific errata to the IBM 20H2999 PCI Docking Bridge (Hotplug) used on Thinkpad 600 Series laptops, and we attempt to avoid issues that can happen on certain devices that are plugged into an ICH1/2/3/4 Intel Hub when it has been configured to do subtractive decode. Full information on these workarounds can be seen in the comments. Finally, we also enable CardBUS devices for ACPI-compliant mode, by crossing out the LegacyBaseAddress in the CardBUS Type 2 PCI Configuration Header. - Miscelleaneous code cleanups. By eVb: More PciScanBus support, for debug PCI caps that driver use are dump, and detect nonBIOS configure device (spec is said that CacheLineSize != 0, LatencyTimer != 0 (on PCI-X, != 64)), if found NeedsHotPlugConfiguration to be set By eVb: Support PCI_HACK_VIDEO_LEGACY_DECODE (call ario_ApplyBrokenVideoHack, but no arb support to do work) svn path=/trunk/; revision=48116
2010-07-19 15:15:39 +00:00
VOID
NTAPI
ario_ApplyBrokenVideoHack(IN PPCI_FDO_EXTENSION FdoExtension)
{
PPCI_ARBITER_INSTANCE PciArbiter;
//PARBITER_INSTANCE CommonInstance;
NTSTATUS Status;
/* Only valid for root FDOs who are being applied the hack for the first time */
ASSERT(!FdoExtension->BrokenVideoHackApplied);
ASSERT(PCI_IS_ROOT_FDO(FdoExtension));
/* Find the I/O arbiter */
PciArbiter = (PVOID)PciFindNextSecondaryExtension(FdoExtension->
SecondaryExtension.Next,
PciArb_Io);
ASSERT(PciArbiter);
#if 0 // when arb exist
/* Get the Arb instance */
CommonInstance = &PciArbiter->CommonInstance;
/* Free the two lists, enabling full VGA access */
ArbFreeOrderingList(&CommonInstance->OrderingList);
ArbFreeOrderingList(&CommonInstance->ReservedList);
/* Build the ordering for broken video PCI access */
Status = ArbBuildAssignmentOrdering(CommonInstance,
L"Pci",
L"BrokenVideo",
NULL);
ASSERT(NT_SUCCESS(Status));
#else
Status = STATUS_SUCCESS;
UNIMPLEMENTED;
while (TRUE);
#endif
/* Now the hack has been applied */
FdoExtension->BrokenVideoHackApplied = TRUE;
}
NTSTATUS
NTAPI
armem_Initializer(IN PVOID Instance)
{
/* Not yet implemented */
UNIMPLEMENTED;
//while (TRUE);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
armem_Constructor(IN PVOID DeviceExtension,
IN PVOID PciInterface,
IN PVOID InterfaceData,
IN USHORT Version,
IN USHORT Size,
IN PINTERFACE Interface)
{
PPCI_FDO_EXTENSION FdoExtension = (PPCI_FDO_EXTENSION)DeviceExtension;
NTSTATUS Status;
PAGED_CODE();
/* Make sure it's the expected interface */
if ((ULONG)InterfaceData != CmResourceTypeMemory)
{
/* Arbiter support must have been initialized first */
if (FdoExtension->ArbitersInitialized)
{
/* Not yet implemented */
UNIMPLEMENTED;
while (TRUE);
}
else
{
/* No arbiters for this FDO */
Status = STATUS_NOT_SUPPORTED;
}
}
else
{
/* Not the right interface */
Status = STATUS_INVALID_PARAMETER_5;
}
/* Return the status */
return Status;
}
/* EOF */