mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 14:03:02 +00:00
- IRP_MN_QUERY_RESOURCE_REQUIREMENTS half support now, PciQueryRequirements, PciAllocateIoRequrementsList, full implement, but PciBuildRequirementsList return 0 always for now
- Debug helpers: PciDebugPrintIoResReqList, PciDebugPrintIoResource, PciDebugCmResourceTypeToText Now hit assert Assertion '(DeviceNode->Flags & DNF_ADDED)' failed at ntoskrnl/io/pnpmgr/pnpmgr.c line 201, too night to debug, maybe tomorow svn path=/trunk/; revision=48550
This commit is contained in:
parent
d9bd0072a1
commit
fd24107d7d
3 changed files with 204 additions and 4 deletions
|
@ -251,4 +251,94 @@ PciDebugDumpQueryCapabilities(IN PDEVICE_CAPABILITIES DeviceCaps)
|
||||||
DbgPrint(" ]\n");
|
DbgPrint(" ]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PCHAR
|
||||||
|
NTAPI
|
||||||
|
PciDebugCmResourceTypeToText(IN UCHAR Type)
|
||||||
|
{
|
||||||
|
/* What kind of resource it this? */
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
/* Pick the correct identifier string based on the type */
|
||||||
|
case CmResourceTypeDeviceSpecific: return "CmResourceTypeDeviceSpecific";
|
||||||
|
case CmResourceTypePort: return "CmResourceTypePort";
|
||||||
|
case CmResourceTypeInterrupt: return "CmResourceTypeInterrupt";
|
||||||
|
case CmResourceTypeMemory: return "CmResourceTypeMemory";
|
||||||
|
case CmResourceTypeDma: return "CmResourceTypeDma";
|
||||||
|
case CmResourceTypeBusNumber: return "CmResourceTypeBusNumber";
|
||||||
|
case CmResourceTypeConfigData: return "CmResourceTypeConfigData";
|
||||||
|
case CmResourceTypeDevicePrivate: return "CmResourceTypeDevicePrivate";
|
||||||
|
case CmResourceTypePcCardConfig: return "CmResourceTypePcCardConfig";
|
||||||
|
default: return "*** INVALID RESOURCE TYPE ***";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PciDebugPrintIoResource(IN PIO_RESOURCE_DESCRIPTOR Descriptor)
|
||||||
|
{
|
||||||
|
ULONG i;
|
||||||
|
PULONG Data;
|
||||||
|
|
||||||
|
/* Print out the header */
|
||||||
|
DPRINT1(" IoResource Descriptor dump: Descriptor @0x%x\n", Descriptor);
|
||||||
|
DPRINT1(" Option = 0x%x\n", Descriptor->Option);
|
||||||
|
DPRINT1(" Type = %d (%s)\n", Descriptor->Type, PciDebugCmResourceTypeToText(Descriptor->Type));
|
||||||
|
DPRINT1(" ShareDisposition = %d\n", Descriptor->ShareDisposition);
|
||||||
|
DPRINT1(" Flags = 0x%04X\n", Descriptor->Flags);
|
||||||
|
|
||||||
|
/* Loop private data */
|
||||||
|
Data = (PULONG)&Descriptor->u.DevicePrivate;
|
||||||
|
for (i = 0; i < 6; i += 3)
|
||||||
|
{
|
||||||
|
/* Dump it in 32-bit triplets */
|
||||||
|
DPRINT1(" Data[%d] = %08x %08x %08x\n", i, Data[0], Data[1], Data[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PciDebugPrintIoResReqList(IN PIO_RESOURCE_REQUIREMENTS_LIST Requirements)
|
||||||
|
{
|
||||||
|
ULONG AlternativeLists;
|
||||||
|
PIO_RESOURCE_LIST List;
|
||||||
|
ULONG Count;
|
||||||
|
PIO_RESOURCE_DESCRIPTOR Descriptor;
|
||||||
|
|
||||||
|
/* Make sure there's a list */
|
||||||
|
if (!Requirements) return;
|
||||||
|
|
||||||
|
/* Grab the main list and the alternates as well */
|
||||||
|
AlternativeLists = Requirements->AlternativeLists;
|
||||||
|
List = Requirements->List;
|
||||||
|
|
||||||
|
/* Print out the initial header*/
|
||||||
|
DPRINT1(" IO_RESOURCE_REQUIREMENTS_LIST (PCI Bus Driver)\n");
|
||||||
|
DPRINT1(" InterfaceType %d\n", Requirements->InterfaceType);
|
||||||
|
DPRINT1(" BusNumber 0x%x\n", Requirements->BusNumber);
|
||||||
|
DPRINT1(" SlotNumber %d (0x%x), (d/f = 0x%x/0x%x)\n",
|
||||||
|
Requirements->SlotNumber,
|
||||||
|
Requirements->SlotNumber,
|
||||||
|
((PCI_SLOT_NUMBER*)&Requirements->SlotNumber)->u.bits.DeviceNumber,
|
||||||
|
((PCI_SLOT_NUMBER*)&Requirements->SlotNumber)->u.bits.FunctionNumber);
|
||||||
|
DPRINT1(" AlternativeLists %d\n", AlternativeLists);
|
||||||
|
|
||||||
|
/* Scan alternative lists */
|
||||||
|
while (AlternativeLists--)
|
||||||
|
{
|
||||||
|
/* Get the descriptor array, and the count of descriptors */
|
||||||
|
Descriptor = List->Descriptors;
|
||||||
|
Count = List->Count;
|
||||||
|
|
||||||
|
/* Print out each descriptor */
|
||||||
|
DPRINT1("\n List[%d].Count = %d\n", AlternativeLists, Count);
|
||||||
|
while (Count--) PciDebugPrintIoResource(Descriptor++);
|
||||||
|
|
||||||
|
/* Should've reached a new list now */
|
||||||
|
List = (PIO_RESOURCE_LIST)Descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Terminate the dump */
|
||||||
|
DPRINT1("\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -49,6 +49,39 @@ PCI_CONFIGURATOR PciConfigurators[] =
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
PIO_RESOURCE_REQUIREMENTS_LIST
|
||||||
|
NTAPI
|
||||||
|
PciAllocateIoRequirementsList(IN ULONG Count,
|
||||||
|
IN ULONG BusNumber,
|
||||||
|
IN ULONG SlotNumber)
|
||||||
|
{
|
||||||
|
SIZE_T Size;
|
||||||
|
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
|
||||||
|
|
||||||
|
/* Calculate the final size of the list, including each descriptor */
|
||||||
|
Size = sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
|
||||||
|
if (Count > 1) Size = sizeof(IO_RESOURCE_DESCRIPTOR) * (Count - 1) +
|
||||||
|
sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
|
||||||
|
|
||||||
|
/* Allocate the list */
|
||||||
|
RequirementsList = ExAllocatePoolWithTag(PagedPool, Size, 'BicP');
|
||||||
|
if (!RequirementsList) return NULL;
|
||||||
|
|
||||||
|
/* Initialize it */
|
||||||
|
RtlZeroMemory(RequirementsList, Size);
|
||||||
|
RequirementsList->AlternativeLists = 1;
|
||||||
|
RequirementsList->BusNumber = BusNumber;
|
||||||
|
RequirementsList->SlotNumber = SlotNumber;
|
||||||
|
RequirementsList->InterfaceType = PCIBus;
|
||||||
|
RequirementsList->ListSize = Size;
|
||||||
|
RequirementsList->List[0].Count = Count;
|
||||||
|
RequirementsList->List[0].Version = 1;
|
||||||
|
RequirementsList->List[0].Revision = 1;
|
||||||
|
|
||||||
|
/* Return it */
|
||||||
|
return RequirementsList;
|
||||||
|
}
|
||||||
|
|
||||||
PCM_RESOURCE_LIST
|
PCM_RESOURCE_LIST
|
||||||
NTAPI
|
NTAPI
|
||||||
PciAllocateCmResourceList(IN ULONG Count,
|
PciAllocateCmResourceList(IN ULONG Count,
|
||||||
|
@ -273,14 +306,85 @@ PciQueryEjectionRelations(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||||
while (TRUE);
|
while (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PciBuildRequirementsList(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||||
|
IN PPCI_COMMON_HEADER PciData,
|
||||||
|
OUT PIO_RESOURCE_REQUIREMENTS_LIST* Buffer)
|
||||||
|
{
|
||||||
|
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
|
||||||
|
{
|
||||||
|
/* There aren't, so use the zero descriptor */
|
||||||
|
RequirementsList = PciZeroIoResourceRequirements;
|
||||||
|
|
||||||
|
/* Does it actually exist yet? */
|
||||||
|
if (!PciZeroIoResourceRequirements)
|
||||||
|
{
|
||||||
|
/* Allocate it, and use it for future use */
|
||||||
|
RequirementsList = PciAllocateIoRequirementsList(0, 0, 0);
|
||||||
|
PciZeroIoResourceRequirements = RequirementsList;
|
||||||
|
if (!PciZeroIoResourceRequirements) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the zero requirements list to the caller */
|
||||||
|
*Buffer = RequirementsList;
|
||||||
|
DPRINT1("PCI - build resource reqs - early out, 0 resources\n");
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PciQueryRequirements(IN PPCI_PDO_EXTENSION PdoExtension,
|
PciQueryRequirements(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||||
IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *RequirementsList)
|
IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *RequirementsList)
|
||||||
{
|
{
|
||||||
/* Not yet implemented */
|
NTSTATUS Status;
|
||||||
UNIMPLEMENTED;
|
PCI_COMMON_HEADER PciHeader;
|
||||||
while (TRUE);
|
PAGED_CODE();
|
||||||
|
|
||||||
|
/* Check if the PDO has any resources, or at least an interrupt pin */
|
||||||
|
if ((PdoExtension->Resources) || (PdoExtension->InterruptPin))
|
||||||
|
{
|
||||||
|
/* Read the current PCI header */
|
||||||
|
PciReadDeviceConfig(PdoExtension, &PciHeader, 0, PCI_COMMON_HDR_LENGTH);
|
||||||
|
|
||||||
|
/* Use it to build a list of requirements */
|
||||||
|
Status = PciBuildRequirementsList(PdoExtension, &PciHeader, RequirementsList);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
/* Is this a Compaq PCI Hotplug Controller (r17) on a PAE system ? */
|
||||||
|
if ((PciHeader.VendorID == 0xE11) &&
|
||||||
|
(PciHeader.DeviceID == 0xA0F7) &&
|
||||||
|
(PciHeader.RevisionID == 17) &&
|
||||||
|
(ExIsProcessorFeaturePresent(PF_PAE_ENABLED)))
|
||||||
|
{
|
||||||
|
/* Have not tested this on eVb's machine yet */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
while (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the requirements are actually the zero list */
|
||||||
|
if (*RequirementsList == PciZeroIoResourceRequirements)
|
||||||
|
{
|
||||||
|
/* A simple NULL will sufficie for the PnP Manager */
|
||||||
|
*RequirementsList = NULL;
|
||||||
|
DPRINT1("Returning NULL requirements list\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Otherwise, print out the requirements list */
|
||||||
|
PciDebugPrintIoResReqList(*RequirementsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* There aren't any resources, so simply return NULL */
|
||||||
|
DPRINT1("PciQueryRequirements returning NULL requirements list\n");
|
||||||
|
*RequirementsList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This call always succeeds (but maybe with no requirements) */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1255,6 +1255,12 @@ PciDebugDumpQueryCapabilities(
|
||||||
IN PDEVICE_CAPABILITIES DeviceCaps
|
IN PDEVICE_CAPABILITIES DeviceCaps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PciDebugPrintIoResReqList(
|
||||||
|
IN PIO_RESOURCE_REQUIREMENTS_LIST Requirements
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Interface Support
|
// Interface Support
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue