Allow the OFW interrupt mapping code to work with PCI devices not enumerated
by Open Firmware, as in the case of FDT.
This commit is contained in:
parent
6dd028d8f8
commit
6064b6ac48
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256816
@ -208,7 +208,6 @@ ofw_bus_has_prop(device_t dev, const char *propname)
|
||||
return (OF_hasprop(node, propname));
|
||||
}
|
||||
|
||||
#ifndef FDT
|
||||
void
|
||||
ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iinfo *ii, int intrsz)
|
||||
{
|
||||
@ -246,9 +245,11 @@ ofw_bus_lookup_imap(phandle_t node, struct ofw_bus_iinfo *ii, void *reg,
|
||||
KASSERT(regsz >= ii->opi_addrc,
|
||||
("ofw_bus_lookup_imap: register size too small: %d < %d",
|
||||
regsz, ii->opi_addrc));
|
||||
if (node != -1) {
|
||||
rv = OF_getprop(node, "reg", reg, regsz);
|
||||
if (rv < regsz)
|
||||
panic("ofw_bus_lookup_imap: could not get reg property");
|
||||
panic("ofw_bus_lookup_imap: cannot get reg property");
|
||||
}
|
||||
return (ofw_bus_search_intrmap(pintr, pintrsz, reg, ii->opi_addrc,
|
||||
ii->opi_imap, ii->opi_imapsz, ii->opi_imapmsk, maskbuf, mintr,
|
||||
mintrsz, iparent));
|
||||
@ -328,4 +329,4 @@ ofw_bus_search_intrmap(void *intr, int intrsz, void *regs, int physsz,
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif /* !FDT */
|
||||
|
||||
|
@ -246,6 +246,13 @@ ofw_pci_route_interrupt(device_t bus, device_t dev, int pin)
|
||||
|
||||
sc = device_get_softc(bus);
|
||||
pintr = pin;
|
||||
|
||||
/* Fabricate imap information in case this isn't an OFW device */
|
||||
bzero(®, sizeof(reg));
|
||||
reg.phys_hi = (pci_get_bus(dev) << OFW_PCI_PHYS_HI_BUSSHIFT) |
|
||||
(pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) |
|
||||
(pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT);
|
||||
|
||||
if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, ®,
|
||||
sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
|
||||
&iparent, maskbuf))
|
||||
|
@ -29,6 +29,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -141,6 +142,13 @@ ofw_pcib_pci_route_interrupt(device_t bridge, device_t dev, int intpin)
|
||||
ii = &sc->ops_iinfo;
|
||||
if (ii->opi_imapsz > 0) {
|
||||
pintr = intpin;
|
||||
|
||||
/* Fabricate imap information if this isn't an OFW device */
|
||||
bzero(®, sizeof(reg));
|
||||
reg.phys_hi = (pci_get_bus(dev) << OFW_PCI_PHYS_HI_BUSSHIFT) |
|
||||
(pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) |
|
||||
(pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT);
|
||||
|
||||
if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), ii, ®,
|
||||
sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
|
||||
&iparent, maskbuf)) {
|
||||
|
@ -322,20 +322,9 @@ ofw_pcibus_assign_interrupt(device_t dev, device_t child)
|
||||
if (node == -1) {
|
||||
/* Non-firmware enumerated child, use standard routing */
|
||||
|
||||
/*
|
||||
* XXX: Right now we don't have anything sensible to do here,
|
||||
* since the ofw_imap stuff relies on nodes having a reg
|
||||
* property. There exist ways around this, so the ePAPR
|
||||
* spec will need to be studied.
|
||||
*/
|
||||
|
||||
return (PCI_INVALID_IRQ);
|
||||
|
||||
#ifdef NOTYET
|
||||
intr = pci_get_intpin(child);
|
||||
return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child,
|
||||
intr));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user