40p: update interrupt routing code to match QEMU

Note that whilst guest OSs should be relying on residual data rather than the
OF device tree to determine the hardware, we still update the interrupt
properties to match the new code in QEMU for consistency.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland
2018-09-09 13:32:58 +01:00
parent a1280807a3
commit ce7fa4d29b
2 changed files with 24 additions and 5 deletions

View File

@ -130,7 +130,7 @@ static const pci_arch_t known_arch[] = {
{ .type = MEMORY_SPACE_32, .parentaddr = 0, .childaddr = 0xc0100000, .len = 0x10000000 },
{ .type = 0, .parentaddr = 0, .childaddr = 0, .len = 0 }
},
.irqs = { 9, 11, 9, 11 }
.irqs = { 15, 15, 15, 15 }
},
[ARCH_MAC99] = {
.name = "MAC99",

View File

@ -1986,10 +1986,29 @@ static phandle_t ob_pci_host_set_interrupt_map(phandle_t host)
static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 addr, u32 intno)
{
*ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
props[(*ncells)++] = intno;
props[(*ncells)++] = dnode;
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
props[(*ncells)++] = 1;
if (is_oldworld() || is_newworld()) {
/* Mac machines */
props[(*ncells)++] = intno;
props[(*ncells)++] = dnode;
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
props[(*ncells)++] = 1;
} else {
/* PReP machines */
props[(*ncells)++] = intno;
props[(*ncells)++] = dnode;
if (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0) {
/* LSI SCSI has fixed routing to IRQ 13 */
props[(*ncells)++] = 13;
} else {
/* Use the same "physical" routing as QEMU's raven_map_irq() although
ultimately all 4 PCI interrupts are ORd to IRQ 15 as indicated
by the PReP specification */
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 1];
}
props[(*ncells)++] = 1;
}
}
#elif defined(CONFIG_SPARC64)