This replaces a nexus-level workaround (introduced in r305527 to
support INTRNG on non-FDT targets) that is incompatible with
implementing nested interrupt controllers on non-FDT MIPS INTRNG
targets.
The existing workaround assumes that all interrupts passed to
nexus_activate_resource() and nexus_setup_intr() are MIPS interrupts
managed by the root MIPS pic (mips/mips_pic.c).
Since non-FDT/OFW MIPS targets do not provide an equivalent to
OFW_BUS_MAP_INTR(), it is necessary to implicitly establish
interrupt mappings on behalf of consumers. The existing workaround:
- Assumes that all requests are for a MIPS CPU IRQ
- Calls mips_pic's cpu_create_intr_map() to allocate a new interrupt mapping on-demand in nexus_activate_resource(), and
- Calls mips_pic's cpu_get_irq_resource() to fetch a shared IRQ resource for the MIPS interrupt in nexus_setup_intr().
- Leaks that map entry in nexus_deactivate_resource()
This introduces some unexpected behavior; by allocating a new mapping implicitly
in bus_activate_resource, any child bus that use resource_list_alloc() to
implement BUS_ALLOC_RESOURCE() (or reimplements similar functionality) will
automatically update the child device's resource list entry to reference the newly
mapped IRQ -- but only if the resource is allocated with the RF_ACTIVE flag.
Otherwise, if bus_activate_resource() is called independently of bus_alloc_resource(),
the child's resource list entry will be left unmodified.
The IRQ mapping must be leaked in nexus_deactivate_resource(), as child references
to the mapping may remain in the child's resource_list_entry after
nexus_deactivate_resource() is called.
Rather than on-demand mapping, this diff adds support (on non-FDT targets) for
producing a fixed set of IRQ mappings for all MIPS IRQs in nexus_attach(), with
a known range of INTRNG IRQ assignments (0-7) that may be referenced by child
devices, used by the nexus/mips_pic to differentiate between IRQs managed by mips_pic,
and IRQs managed by a child interrupt controller.
In brief:
- On non-FDT targets, produce a set of fixed INTRNG MIPS irq map entries in nexus_attach().
- Always call mips_pic_activate_intr() from nexus_activate_resource(); this will either perform mips_pic-specific activation, or call intr_activate_irq() directly for IRQs not managed by mips_pic.
- Always call mips_pic_deactivate_intr() from nexus_deactivate_resource(); this will either perform mips_pic-specific deactivation, or call intr_deactivate_irq() directly for IRQs not managed by mips_pic.
Refer to D7692 for additional discussion on the original workaround.