Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Support building kernels with ACPI and no PCI.



details:   https://anonhg.NetBSD.org/src/rev/02846b78a0b4
branches:  trunk
changeset: 836916:02846b78a0b4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Nov 12 12:56:05 2018 +0000

description:
Support building kernels with ACPI and no PCI.

diffstat:

 sys/arch/arm/acpi/acpi_machdep.c |  10 ++++++++--
 sys/arch/arm/acpi/files.acpi     |   4 ++--
 sys/arch/arm/acpi/gic_acpi.c     |  16 ++++++++++++----
 sys/arch/arm/acpi/gicv3_acpi.c   |  12 ++++++++++--
 sys/arch/arm/cortex/files.cortex |   4 ++--
 sys/arch/arm/fdt/acpi_fdt.c      |  18 +++++++++++-------
 6 files changed, 45 insertions(+), 19 deletions(-)

diffs (252 lines):

diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/acpi/acpi_machdep.c
--- a/sys/arch/arm/acpi/acpi_machdep.c  Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_machdep.c  Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,7 +46,9 @@
 
 #include <dev/acpi/acpica.h>
 #include <dev/acpi/acpivar.h>
+#if NPCI > 0
 #include <dev/acpi/acpi_mcfg.h>
+#endif
 
 #include <arm/pic/picvar.h>
 
@@ -252,7 +256,9 @@
 {
        ACPI_TABLE_HEADER *hdrp;
 
+#if NPCI > 0
        acpimcfg_init(&arm_generic_bs_tag, NULL);
+#endif
 
        if (acpi_madt_map() != AE_OK)
                panic("Failed to map MADT");
diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/acpi/files.acpi
--- a/sys/arch/arm/acpi/files.acpi      Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/acpi/files.acpi      Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.acpi,v 1.4 2018/10/24 11:01:47 jmcneill Exp $
+#      $NetBSD: files.acpi,v 1.5 2018/11/12 12:56:05 jmcneill Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -11,7 +11,7 @@
 include "dev/acpi/files.acpi"
 
 file   arch/arm/acpi/acpi_machdep.c            acpi
-file   arch/arm/acpi/acpi_pci_machdep.c        acpi
+file   arch/arm/acpi/acpi_pci_machdep.c        acpi & pci
 file   arch/arm/acpi/acpi_platform.c           acpi
 file   arch/arm/acpi/acpi_table.c              acpi
 
diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/acpi/gic_acpi.c
--- a/sys/arch/arm/acpi/gic_acpi.c      Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/acpi/gic_acpi.c      Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_acpi.c,v 1.2 2018/10/21 00:42:05 jmcneill Exp $ */
+/* $NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.2 2018/10/21 00:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -59,7 +61,9 @@
 static void    gic_acpi_attach(device_t, device_t, void *);
 
 static ACPI_STATUS gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER *, void *);
+#if NPCI > 0
 static ACPI_STATUS gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *, void *);
+#endif
 
 CFATTACH_DECL_NEW(gic_acpi, 0, gic_acpi_match, gic_acpi_attach, NULL, NULL);
 
@@ -122,10 +126,12 @@
        };
 
        armgic = config_found(self, &mpcaa, NULL);
+       if (armgic != NULL)
+               arm_fdt_irq_set_handler(armgic_irq_handler);
 
-       arm_fdt_irq_set_handler(armgic_irq_handler);
-
+#if NPCI > 0
        acpi_madt_walk(gic_acpi_find_msi_frame, armgic);
+#endif
 }
 
 static ACPI_STATUS
@@ -141,6 +147,7 @@
        return AE_LIMIT;
 }
 
+#if NPCI > 0
 static ACPI_STATUS
 gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
 {
@@ -181,3 +188,4 @@
 
        return AE_OK;
 }
+#endif
diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/acpi/gicv3_acpi.c
--- a/sys/arch/arm/acpi/gicv3_acpi.c    Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/acpi/gicv3_acpi.c    Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_acpi.c,v 1.2 2018/11/09 23:36:58 jmcneill Exp $ */
+/* $NetBSD: gicv3_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,10 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #define        _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_acpi.c,v 1.2 2018/11/09 23:36:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -68,7 +70,9 @@
 
 static int     gicv3_acpi_map_dist(struct gicv3_acpi_softc *);
 static int     gicv3_acpi_map_redist(struct gicv3_acpi_softc *);
+#if NPCI > 0
 static int     gicv3_acpi_map_its(struct gicv3_acpi_softc *);
+#endif
 
 CFATTACH_DECL_NEW(gicv3_acpi, sizeof(struct gicv3_acpi_softc), gicv3_acpi_match, gicv3_acpi_attach, NULL, NULL);
 
@@ -127,7 +131,9 @@
                return;
        }
 
+#if NPCI > 0
        gicv3_acpi_map_its(sc);
+#endif
 
        arm_fdt_irq_set_handler(gicv3_irq_handler);
 }
@@ -272,6 +278,7 @@
        return 0;
 }
 
+#if NPCI > 0
 static ACPI_STATUS
 gicv3_acpi_map_gits(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
 {
@@ -304,3 +311,4 @@
 
        return 0;
 }
+#endif
diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/cortex/files.cortex
--- a/sys/arch/arm/cortex/files.cortex  Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/cortex/files.cortex  Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.cortex,v 1.10 2018/11/09 23:36:24 jmcneill Exp $
+# $NetBSD: files.cortex,v 1.11 2018/11/12 12:56:05 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h                     NEON_IN_CKSUM
 
@@ -20,7 +20,7 @@
 # ARM Generic Interrupt Controller v3+
 device gicvthree: pic, pic_splfuncs
 file   arch/arm/cortex/gicv3.c                 gicvthree
-file   arch/arm/cortex/gicv3_its.c             gicvthree
+file   arch/arm/cortex/gicv3_its.c             gicvthree & pci & __have_pci_msi_msix
 
 # ARM PL310 L2 Cache Controller(initially on Cortex-A9)
 device arml2cc
diff -r adf4303164ec -r 02846b78a0b4 sys/arch/arm/fdt/acpi_fdt.c
--- a/sys/arch/arm/fdt/acpi_fdt.c       Mon Nov 12 12:41:03 2018 +0000
+++ b/sys/arch/arm/fdt/acpi_fdt.c       Mon Nov 12 12:56:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_fdt.c,v 1.8 2018/10/31 15:42:54 jmcneill Exp $ */
+/* $NetBSD: acpi_fdt.c,v 1.9 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -26,10 +26,11 @@
  * SUCH DAMAGE.
  */
 
+#include "pci.h"
 #include "opt_efi.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.8 2018/10/31 15:42:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.9 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -69,7 +70,9 @@
 
 static void    acpi_fdt_sysctl_init(void);
 
+#if NPCI > 0
 static struct acpi_pci_context acpi_fdt_pci_context;
+#endif
 
 static uint64_t smbios_table = 0;
 
@@ -115,13 +118,11 @@
        if (!acpi_probe())
                aprint_error_dev(self, "failed to probe ACPI\n");
 
+       memset(&aa, 0, sizeof(aa));
+#if NPCI > 0
        acpi_fdt_pci_context.ap_pc = arm_acpi_pci_chipset;
        acpi_fdt_pci_context.ap_pc.pc_conf_v = &acpi_fdt_pci_context;
        acpi_fdt_pci_context.ap_seg = 0;
-
-       aa.aa_iot = 0;
-       aa.aa_memt = faa->faa_bst;
-       aa.aa_pc = &acpi_fdt_pci_context.ap_pc;
        aa.aa_pciflags =
            /*PCI_FLAGS_IO_OKAY |*/ PCI_FLAGS_MEM_OKAY |
            PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | 
@@ -129,7 +130,10 @@
 #ifdef __HAVE_PCI_MSI_MSIX
        aa.aa_pciflags |= PCI_FLAGS_MSI_OKAY | PCI_FLAGS_MSIX_OKAY;
 #endif
-       aa.aa_ic = 0;
+       aa.aa_pc = &acpi_fdt_pci_context.ap_pc;
+#endif
+
+       aa.aa_memt = faa->faa_bst;
        aa.aa_dmat = faa->faa_dmat;
 #ifdef _PCI_HAVE_DMA64
        aa.aa_dmat64 = faa->faa_dmat;



Home | Main Index | Thread Index | Old Index