Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/fdt gicv3: add support for mbi-alias property



details:   https://anonhg.NetBSD.org/src/rev/4d25311841ef
branches:  trunk
changeset: 1026306:4d25311841ef
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Nov 17 21:46:12 2021 +0000

description:
gicv3: add support for mbi-alias property

The mbi-alias property, if present, contains the base address of a GICD
alias frame that contains only SET/CLRSPI registers. Use this instead of
the GICD register frame if present.

diffstat:

 sys/arch/arm/fdt/gicv3_fdt.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 10c6a2824b34 -r 4d25311841ef sys/arch/arm/fdt/gicv3_fdt.c
--- a/sys/arch/arm/fdt/gicv3_fdt.c      Wed Nov 17 11:57:27 2021 +0000
+++ b/sys/arch/arm/fdt/gicv3_fdt.c      Wed Nov 17 21:46:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_fdt.c,v 1.15 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: gicv3_fdt.c,v 1.16 2021/11/17 21:46:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #define        _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.15 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.16 2021/11/17 21:46:12 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -273,14 +273,18 @@
        bus_addr_t addr;
        int len, frame_count;
 
-       if (of_hasprop(sc->sc_phandle, "mbi-alias")) {
-               aprint_error_dev(sc->sc_gic.sc_dev, "'mbi-alias' property not supported\n");
+       /*
+        * If a GICD alias frame containing only the SET/CLRSPI registers
+        * exists, the base address will be reported by the 'mbi-alias'
+        * property. If this doesn't exist, use the GICD register frame
+        * instead.
+        */
+       if (of_getprop_uint64(sc->sc_phandle, "mbi-alias", &addr) != 0 &&
+           fdtbus_get_reg(sc->sc_phandle, 0, &addr, NULL) != 0) {
+               aprint_error_dev(sc->sc_gic.sc_dev, "couldn't find MBI register frame\n");
                return;
        }
 
-       if (fdtbus_get_reg(sc->sc_phandle, 0, &addr, NULL) != 0)
-               return;
-
        ranges = fdtbus_get_prop(sc->sc_phandle, "mbi-ranges", &len);
        if (ranges == NULL) {
                aprint_error_dev(sc->sc_gic.sc_dev, "missing 'mbi-ranges' property\n");



Home | Main Index | Thread Index | Old Index