reactos/drivers/bus/pcix/arb/ar_memio.c
Amine Khaldi c424146e2c Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
2010-07-24 18:52:44 +00:00

183 lines
4.5 KiB
C

/*
* 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;
}
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 */