Retrieve PCI IRQ routing information
#include <hw/pci.h> int pci_irq_routing_options( IRQRoutingOptionsBuffer * buf, uint32_t * irq );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pci_irq_routing_options() function returns the following:
Routing information is returned in a data buffer that contains an IRQ routing for each PCI device or slot.
You must successfully call pci_attach() before calling any of the other PCI functions. The pci_irq_routing_options() function is for x86 only. |
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <inttypes.h> #include <hw/pci.h> #include <sys/neutrino.h> struct { IRQRoutingOptionsBuffer buf; uint8_t databuf [2048]; } route_buf; int main (void) { int phdl; uint32_t irq; if ((phdl = pci_attach (0)) == -1) { printf ("Unable to attach - errno %s\n", strerror (errno)); exit (1); } memset (route_buf.databuf, 0, sizeof (route_buf.databuf)); route_buf.buf.BufferSize = sizeof (route_buf.databuf); if (pci_irq_routing_options (&route_buf.buf, &irq) != PCI_SUCCESS) { printf ("Routing option failed - errno %s\n", strerror (errno)); exit (1); } printf ("PCI Irq Map = %x\n", irq); pci_detach (phdl); return (0); }
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
pci_attach(), pci_attach_device(), pci_detach(), pci_detach_device(), pci_find_class(), pci_find_device(), pci_present(), pci_read_config(), pci_read_config8(), pci_read_config16(), pci_read_config32(), pci_rescan_bus(), pci_write_config(), pci_write_config8(), pci_write_config16(), pci_write_config32()