Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/acpi Don't make assumptions about the order of ...



details:   https://anonhg.NetBSD.org/src/rev/97c9937db204
branches:  trunk
changeset: 445297:97c9937db204
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 21 13:34:33 2018 +0000

description:
Don't make assumptions about the order of MADT subtables. Ensure that we
attach CPUs before the interrupt controller driver.

diffstat:

 sys/arch/arm/acpi/acpi_machdep.c |  23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 30edf2a70b71 -r 97c9937db204 sys/arch/arm/acpi/acpi_machdep.c
--- a/sys/arch/arm/acpi/acpi_machdep.c  Sun Oct 21 12:47:33 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_machdep.c  Sun Oct 21 13:34:33 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.3 2018/10/16 16:38:22 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.3 2018/10/16 16:38:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -216,11 +216,23 @@
 }
 
 static ACPI_STATUS
-acpi_md_madt_probe(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
+acpi_md_madt_probe_cpu(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
 {
        struct acpi_softc * const sc = aux;
 
-       config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
+       if (hdrp->Type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+               config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
+
+       return AE_OK;
+}
+
+static ACPI_STATUS
+acpi_md_madt_probe_gic(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
+{
+       struct acpi_softc * const sc = aux;
+
+       if (hdrp->Type == ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR)
+               config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
 
        return AE_OK;
 }
@@ -244,7 +256,8 @@
 
        if (acpi_madt_map() != AE_OK)
                panic("Failed to map MADT");
-       acpi_madt_walk(acpi_md_madt_probe, sc);
+       acpi_madt_walk(acpi_md_madt_probe_cpu, sc);
+       acpi_madt_walk(acpi_md_madt_probe_gic, sc);
        acpi_madt_unmap();
 
        if (acpi_gtdt_map() != AE_OK)



Home | Main Index | Thread Index | Old Index