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 Add support for PCI Segment Groups.



details:   https://anonhg.NetBSD.org/src/rev/c45ba9679165
branches:  trunk
changeset: 836478:c45ba9679165
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Oct 19 11:40:27 2018 +0000

description:
Add support for PCI Segment Groups.

diffstat:

 sys/arch/arm/acpi/acpi_pci_machdep.c |  16 +++++++++++-----
 sys/arch/arm/acpi/acpi_pci_machdep.h |   7 ++++++-
 sys/arch/arm/acpi/acpipchb.c         |  28 +++++++++++++++++++---------
 3 files changed, 36 insertions(+), 15 deletions(-)

diffs (178 lines):

diff -r c7a4046322c5 -r c45ba9679165 sys/arch/arm/acpi/acpi_pci_machdep.c
--- a/sys/arch/arm/acpi/acpi_pci_machdep.c      Fri Oct 19 11:11:03 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_pci_machdep.c      Fri Oct 19 11:40:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.1 2018/10/15 11:35:03 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.1 2018/10/15 11:35:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -55,6 +55,8 @@
 #include <dev/acpi/acpi_mcfg.h>
 #include <dev/acpi/acpi_pci.h>
 
+#include <arm/acpi/acpi_pci_machdep.h>
+
 #define        IH_INDEX_MASK                   0x0000ffff
 #define        IH_MPSAFE                       0x80000000
 
@@ -150,12 +152,13 @@
 acpi_pci_md_attach_hook(device_t parent, device_t self,
     struct pcibus_attach_args *pba)
 {
+       struct acpi_pci_context *ap = pba->pba_pc->pc_conf_v;
        struct acpi_pci_prt *prt, *prtp;
        struct acpi_devnode *ad;
        ACPI_HANDLE handle;
        int seg, bus, dev, func;
 
-       seg = 0;        /* XXX segment */
+       seg = ap->ap_seg;
        handle = NULL;
 
        if (pba->pba_bridgetag) {
@@ -228,12 +231,13 @@
 static pcireg_t
 acpi_pci_md_conf_read(void *v, pcitag_t tag, int offset)
 {
+       struct acpi_pci_context * const ap = v;
        pcireg_t val;
 
        if (offset < 0 || offset >= PCI_EXTCONF_SIZE)
                return (pcireg_t) -1;
 
-       acpimcfg_conf_read(&arm_acpi_pci_chipset, tag, offset, &val);
+       acpimcfg_conf_read(&ap->ap_pc, tag, offset, &val);
 
        return val;
 }
@@ -241,10 +245,12 @@
 static void
 acpi_pci_md_conf_write(void *v, pcitag_t tag, int offset, pcireg_t val)
 {
+       struct acpi_pci_context * const ap = v;
+
        if (offset < 0 || offset >= PCI_EXTCONF_SIZE)
                return;
 
-       acpimcfg_conf_write(&arm_acpi_pci_chipset, tag, offset, val);
+       acpimcfg_conf_write(&ap->ap_pc, tag, offset, val);
 }
 
 static int
diff -r c7a4046322c5 -r c45ba9679165 sys/arch/arm/acpi/acpi_pci_machdep.h
--- a/sys/arch/arm/acpi/acpi_pci_machdep.h      Fri Oct 19 11:11:03 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_pci_machdep.h      Fri Oct 19 11:40:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.h,v 1.1 2018/10/15 11:35:03 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.h,v 1.2 2018/10/19 11:40:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,4 +34,9 @@
 
 extern struct arm32_pci_chipset arm_acpi_pci_chipset;
 
+struct acpi_pci_context {
+       struct arm32_pci_chipset ap_pc;
+       u_int ap_seg;
+};
+
 #endif /* !_ARM_ACPI_PCI_MACHDEP_H */
diff -r c7a4046322c5 -r c45ba9679165 sys/arch/arm/acpi/acpipchb.c
--- a/sys/arch/arm/acpi/acpipchb.c      Fri Oct 19 11:11:03 2018 +0000
+++ b/sys/arch/arm/acpi/acpipchb.c      Fri Oct 19 11:40:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.1 2018/10/15 11:35:03 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.1 2018/10/15 11:35:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -54,12 +54,15 @@
 #include <dev/acpi/acpivar.h>
 #include <dev/acpi/acpi_mcfg.h>
 
+#include <arm/acpi/acpi_pci_machdep.h>
+
 #define        PCIHOST_CACHELINE_SIZE          arm_dcache_align
 
 struct acpipchb_softc {
        device_t                sc_dev;
 
        struct arm32_bus_dma_tag sc_dmat;
+       struct acpi_pci_context sc_ap;
 
        ACPI_HANDLE             sc_handle;
        ACPI_INTEGER            sc_bus;
@@ -102,7 +105,7 @@
        struct acpipchb_softc * const sc = device_private(self);
        struct acpi_attach_args *aa = aux;
        struct pcibus_attach_args pba;
-       ACPI_INTEGER cca;
+       ACPI_INTEGER cca, seg;
 
        sc->sc_dev = self;
        sc->sc_handle = aa->aa_node->ad_handle;
@@ -110,23 +113,30 @@
        if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_BBN", &sc->sc_bus)))
                sc->sc_bus = 0;
 
+       if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_SEG", &seg)))
+               seg = 0;
+
        if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_CCA", &cca)))
                cca = 0;
 
        aprint_naive("\n");
        aprint_normal(": PCI Express Host Bridge\n");
 
-       if (acpimcfg_configure_bus(self, aa->aa_pc, sc->sc_handle, sc->sc_bus, PCIHOST_CACHELINE_SIZE) != 0) {
-               aprint_error_dev(self, "failed to configure PCI bus\n");
-               return;
-       }
-
        sc->sc_dmat = *aa->aa_dmat;
        if (cca) {
                sc->sc_dmat._ranges = ahcipchb_coherent_ranges;
                sc->sc_dmat._nranges = __arraycount(ahcipchb_coherent_ranges);
        }
 
+       sc->sc_ap.ap_pc = *aa->aa_pc;
+       sc->sc_ap.ap_pc.pc_conf_v = &sc->sc_ap;
+       sc->sc_ap.ap_seg = seg;
+
+       if (acpimcfg_configure_bus(self, &sc->sc_ap.ap_pc, sc->sc_handle, sc->sc_bus, PCIHOST_CACHELINE_SIZE) != 0) {
+               aprint_error_dev(self, "failed to configure PCI bus\n");
+               return;
+       }
+
        memset(&pba, 0, sizeof(pba));
        pba.pba_flags = aa->aa_pciflags;
        pba.pba_iot = aa->aa_iot;
@@ -135,7 +145,7 @@
 #ifdef _PCI_HAVE_DMA64
        pba.pba_dmat64 = &sc->sc_dmat;
 #endif
-       pba.pba_pc = aa->aa_pc;
+       pba.pba_pc = &sc->sc_ap.ap_pc;
        pba.pba_bus = sc->sc_bus;
 
        config_found_ia(self, "pcibus", &pba, pcibusprint);



Home | Main Index | Thread Index | Old Index