diff options
author | Tobias Heider <tobhe@cvs.openbsd.org> | 2022-08-22 12:34:56 +0000 |
---|---|---|
committer | Tobias Heider <tobhe@cvs.openbsd.org> | 2022-08-22 12:34:56 +0000 |
commit | dc64d5bf315a91c8d8bccd3a17f8a4c5b81f2b82 (patch) | |
tree | 499b7f92222619befb286f504652a64e5dd84989 /sys/arch | |
parent | c3e28892528080cbe52618387f0f2a885509701d (diff) |
Get number of interrupt cells from device tree instead of guessing based
on version. Fixes M2 Macbook Air 2022 which reports version 2 but only
uses 3 cells.
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm64/dev/aplintc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/arm64/dev/aplintc.c b/sys/arch/arm64/dev/aplintc.c index 02cca4c52f2..c663ed04cfc 100644 --- a/sys/arch/arm64/dev/aplintc.c +++ b/sys/arch/arm64/dev/aplintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplintc.c,v 1.12 2022/07/13 09:28:18 kettenis Exp $ */ +/* $OpenBSD: aplintc.c,v 1.13 2022/08/22 12:34:55 tobhe Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -118,6 +118,7 @@ struct aplintc_softc { struct intrhand **sc_irq_handler[AIC_MAXDIES]; int sc_nirq; int sc_ndie; + int sc_ncells; TAILQ_HEAD(, intrhand) sc_irq_list[NIPL]; uint32_t sc_cpuremap[AIC_MAXCPUS]; @@ -188,6 +189,12 @@ aplintc_attach(struct device *parent, struct device *self, void *aux) else sc->sc_version = 1; + sc->sc_ncells = OF_getpropint(faa->fa_node, "#interrupt-cells", 3); + if (sc->sc_ncells < 3 || sc->sc_ncells > 4) { + printf(": invalid number of cells\n"); + return; + } + /* * AIC2 has the event register specified separately. However * a preliminary device tree binding for AIC2 had it included @@ -507,7 +514,7 @@ aplintc_intr_establish(void *cookie, int *cell, int level, uint32_t type = cell[0]; uint32_t die, irq; - if (sc->sc_version == 1) { + if (sc->sc_ncells == 3) { die = 0; irq = cell[1]; } else { |