Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pci_intr_map(9) oddity



(I'm not subscribed to port-xen, please CC me on replies.)

In my local tree, I made const the pci_attach_args argument to
pci_intr_map(9).  Xen seems to be the lone port that writes to
the pci_attach_args, any ideas why?  Before any PCI device is
probed/attached, pci_probe_device() initialized pa_intrline.  Relevant
fragments of pci_intr_map() and pci_probe_device(), below:

int
pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
        pcireg_t intr;
        int pin;
        int line;

#if NIOAPIC > 0
        int rawpin = pa->pa_rawintrpin;
        pci_chipset_tag_t pc = pa->pa_pc;
        int bus, dev, func;
#endif  

        intr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_INTERRUPT_REG);
        pin = pa->pa_intrpin;
/* pa written here: */
        pa->pa_intrline = line = PCI_INTERRUPT_LINE(intr);
/* snip snip */

int
pci_probe_device(struct pci_softc *sc, pcitag_t tag,
    int (*match)(const struct pci_attach_args *),
    struct pci_attach_args *pap)
{
        pci_chipset_tag_t pc = sc->sc_pc;
        struct pci_attach_args pa;
        pcireg_t id, csr, class, intr, bhlcr;
        int ret, pin, bus, device, function;
        int locs[PCICF_NLOCS];

/* snip snip */
        intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);

        pin = PCI_INTERRUPT_PIN(intr);
        pa.pa_rawintrpin = pin;
        if (pin == PCI_INTERRUPT_PIN_NONE) {
                /* no interrupt */
                pa.pa_intrpin = 0;
        } else {
                /*
                 * swizzle it based on the number of busses we're
                 * behind and our device number.
                 */
                pa.pa_intrpin =         /* XXX */
                    ((pin + pa.pa_intrswiz - 1) % 4) + 1;
        }
/* pa.pa_intrline initialized here */
        pa.pa_intrline = PCI_INTERRUPT_LINE(intr);

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index