I have a device (embedded in the chipset) but it is not visible in the PCI configuration space or as a device to Windows.
The device is capable of interrupt the processor using MSI but the resources are not visible to Windows. At some location (address and data), I have to write the values and enable interrupts and then the device starts interrupting.
When I write the windows driver for this device, how do I connect interrupts?. It seems I cannot use the IoConnectInterrupt or IoConnectInterruptEx because I need a CM_RESOURCE_LIST describing the interrupt resources and I do not have such a description (because this comes from IRP_MN_START_DEVICE) and Windows does not detect it.
Do I write a bus driver, create the PDO (by enumerating the device and resources) and then have my function driver use IoConnectInterrupt(Ex)?. I am not sure if this works or not. I have never written a bus driver before( I guess I could use the toaster bus driver sample).
Thanks,
Ram
The first piece of advise is change the HW if you can and report the
resource, your life will be much easier in the long run. Barring that,
try handling IRP_MN_QUERY_RESOURCE_REQUIREMENTS and adding the interrupt
resource requirements to the io resource requirements list (which is a
list of N io resource lists) in this IRP. You will have to remove these
added resources from the CM resource lists before sending the
IRP_MN_START_DEVICE irp down the stack (make a copy the lists and free
them when the IRP returns to your driver). In KMDF you would implement
EvtDeviceFilterAddResourceRequirements and EvtDeviceRemoveAddedResources
to achieve this functionality.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Friday, April 13, 2007 1:45 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to connect interrupts when resources are not
visible to Windows
I have a device (embedded in the chipset) but it is not visible in the
PCI configuration space or as a device to Windows.
The device is capable of interrupt the processor using MSI but the
resources are not visible to Windows. At some location (address and
data), I have to write the values and enable interrupts and then the
device starts interrupting.
When I write the windows driver for this device, how do I connect
interrupts?. It seems I cannot use the IoConnectInterrupt or
IoConnectInterruptEx because I need a CM_RESOURCE_LIST describing the
interrupt resources and I do not have such a description (because this
comes from IRP_MN_START_DEVICE) and Windows does not detect it.
Do I write a bus driver, create the PDO (by enumerating the device and
resources) and then have my function driver use IoConnectInterrupt(Ex)?.
I am not sure if this works or not. I have never written a bus driver
before( I guess I could use the toaster bus driver sample).
Thanks,
Ram
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Doron,
I have not done this before (Handling IRP_MN_RESOURCE_REQUIREMENTS). Can you point me to some sample code in a function driver (although I have no PDO, technically speaking) that shows me how to handle this?. Any samples in the WDK you can point me to would be greatly appreciated.
Thanks,
Ramakrishna Saripalli
Ram,
Doron’s advice is good, but a couple things to add.
- You don’t need a bus driver. You can “filter” the resource requirements produced by your bus driver (what bus are we talking about) by handling the IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP. Note that this isn’t *Query* resource requirements.
- You need IoConnectInterruptEx. This just takes your PDO and hands you back a “message table.” The message table will include the address and data to program into your device.
- There is a bug that prevents this from working on non-PCI devices in Vista. So if you have a PCI device that just doesn’t have the standard MSI registers, you’re okay. If the bus driver is anything but PCI, you will need Vista SP1 to pick up a few bug fixes.
Dave
Thanks for the correction dave :), my bad. As for a DDK example, look at src\input\pnpi8042\pnp.c, I8xFilterResourceRequirements(). This function adds or removes resources, so you have an example of both operations. Note that io resource requirements list manipulation is a bit of a pain (lots of pointer math) since it is an open ended array of open ended arrays, run the debugger extension !ioreslist on your final resource list to make sure you created it correctly. Like i previously said, KMDF makes this way easier. If you are writing a driver from scratch that does not require a port driver (like NDIS, scsiport, ks, avstream, etc), you should strongly consider KMDF, it will make your life much simpler.
d