pci_irq_routing_options()

Retrieve PCI IRQ routing information

Synopsis:

#include <hw/pci.h>

int pci_irq_routing_options( 
                    IRQRoutingOptionsBuffer * buf, 
                    uint32_t * irq );

Arguments:

buf
A pointer to a IRQRoutingOptionsBuffer structure where the function can store the IRQ routing information. For information about the layout of this buffer, see PCI BIOS SPECIFICATION Revision 2.1. You can get it from the PCI Special Interest Group at http://pcisig.com/.
irq
A pointer to a location where the function can store the current state of interrupts.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pci_irq_routing_options() function returns the following:

  • PCI interrupt routing options available on the system motherboard
  • the current state of interrupts that are currently exclusively assigned to PCI.

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.

Returns:

PCI_SUCCESS
Success.
-1
You haven't called pci_attach() , or the call to it failed.

Examples:

#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);
}

Classification:

QNX Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes