need to assign IRQs for PCI and cPCI
Kartoz, Michael F <michael.f.kartoz <at> intel.com>
2001-04-26 00:14:14 GMT
How do I assign IRQs for inserted PCI boards?
I have been writing a very rough version of a hotplug system driver as a
module. I am specifically looking at how to get Linux 2.4.3 with the
hotplug package to assign resources (I/O, memory, IRQs) to the appropriate
places in the new board's PCI config space and in the kernel prior to
calling pci_insert_device. I seem to have gotten the I/O and memory regions
as well as some of the other registers such as cache line size initialized
(although I'm not sure whether bridges are being handled properly or not).
However, I could not find any way of assigning the IRQs. It seems that the
routines that exist for assigning the IRQs are only available during initial
boot. Specifically, one routine that seems to be necessary (if using
IOAPIC) is IO_APIC_get_PCI_irq_vector which provides the IRQ for use by the
driver instead of the one in config space when APICs are being used.
Does anyone know how I should go about doing this? Am I going about this
the wrong way? Is anyone else doing this same kind of work?
The basic flow of an insert in my hotplug system driver is:
1) Create and zero out new dev structure for device that was inserted.
2) Fill in the bus, sysdata, devfn, device, vendor, dma_mask and hdr_type
elements of dev.
3) Fill in cache line size in PCI config space.
4) Call pci_setup_device.
5) Call pci_assign_resource for each of the first six resource structures in
dev.
6) Set PCI command register in PCI config space.
7) Call IO_APIC_get_PCI_irq_vector to fill in IRQ element of dev (I hacked
the kernel to make this symbol visible to my module)
8) Call pci_insert_device.
(Continue reading)