Hi guys, I?m having trouble caused by a new motherboard that no longer supports the legacy PCI configuration. Everything is now PCIe so manufacturers like Intel are dropping legacy PCI support from their BIOS. This is causing a problem with my driver because the device is connected to a PCI Express-to-PCI Bridge card. The problem is the BIOS is not setting certain PCI config values (like CacheLineSize and LatencyTimer). Now I can fix the PCI config values from my driver by getting the bus interface (see below). The problem is that the PCI config on the bridge is also not correct. How would I get the bus interface of the bridge I?m connected to?
Thanks,
Rob
BUS_INTERFACE_STANDARD busInterface;
UCHAR tmpU8;
status = GetBusInterface(deviceExtension->pDeviceObject, &busInterface);
if (NT_SUCCESS(status))
{
/* Get the Cache Line Size. */
busInterface.GetBusData(busInterface.Context, PCI_WHICHSPACE_CONFIG, &tmpU8,
FIELD_OFFSET(PCI_COMMON_HEADER, CacheLineSize), sizeof(tmpU8));
}
NTSTATUS GetBusInterface(IN PDEVICE_OBJECT pDeviceObject, OUT PBUS_INTERFACE_STANDARD pBusInterface)
{
NTSTATUS status;
PIRP pIrp = NULL;
KEVENT event;
PDEVICE_OBJECT pTargetObject = NULL;
IO_STATUS_BLOCK ioStatus;
PIO_STACK_LOCATION stack = NULL;
KeInitializeEvent(&event, NotificationEvent, FALSE);
pTargetObject = IoGetAttachedDeviceReference(pDeviceObject);
pIrp = IoBuildSynchronousFsdRequest(
IRP_MJ_PNP,
pTargetObject,
NULL,
0,
NULL,
&event,
&ioStatus
);
if (pIrp == NULL)
{
ObDereferenceObject(pTargetObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
stack = IoGetNextIrpStackLocation(pIrp);
stack->MajorFunction = IRP_MJ_PNP;
stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
stack->Parameters.QueryInterface.InterfaceType = &GUID_BUS_INTERFACE_STANDARD;
stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
stack->Parameters.QueryInterface.Version = PCI_BUS_INTERFACE_STANDARD_VERSION;
stack->Parameters.QueryInterface.Interface = (PINTERFACE)pBusInterface;
stack->Parameters.QueryInterface.InterfaceSpecificData = NULL;
pIrp->IoStatus.Status = STATUS_NOT_SUPPORTED;
status = IoCallDriver(pTargetObject, pIrp);
if (status == STATUS_PENDING)
{
status = KeWaitForSingleObject(
&event,
Executive,
KernelMode,
FALSE,
NULL
);
status = ioStatus.Status;
}
ObDereferenceObject(pTargetObject);
return status;
}