Source-Changes-HG archive

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

[src/trunk]: src/sys - Almost all ppbreg.h's definitions are also in pcireg.h...



details:   https://anonhg.NetBSD.org/src/rev/fddda59dd087
branches:  trunk
changeset: 449272:fddda59dd087
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Mar 01 09:25:59 2019 +0000

description:
- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
  definitions from ppbreg.h and move some definitions from ppbreg.h to
  pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
  and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
  "upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.

diffstat:

 sys/arch/arm/imx/imx6_pcie.c              |   15 +--
 sys/arch/arm/xscale/i80312.c              |   16 ++--
 sys/arch/arm/xscale/i80312_pci.c          |   16 ++--
 sys/arch/evbarm/iq80310/iq80310_machdep.c |   12 +-
 sys/arch/evbarm/iq80310/iq80310_pci.c     |   18 ++--
 sys/arch/macppc/pci/pci_machdep.c         |   10 +-
 sys/arch/sparc/sparc/pci_fixup.c          |   10 +-
 sys/arch/sparc64/sparc64/rbus_machdep.c   |    8 +-
 sys/arch/x86/pci/pci_bus_fixup.c          |   17 ++-
 sys/arch/x86/pci/pci_ranges.c             |   26 ++----
 sys/dev/acpi/acpi_pci.c                   |    8 +-
 sys/dev/cardbus/rbus_ppb.c                |   73 ++++++++---------
 sys/dev/pci/btvmeii.c                     |   12 +-
 sys/dev/pci/pccbb.c                       |   16 ++--
 sys/dev/pci/pci_subr.c                    |   66 ++++++++--------
 sys/dev/pci/pciconf.c                     |   67 ++++++++--------
 sys/dev/pci/pcireg.h                      |  120 +++++++++++++++++------------
 sys/dev/pci/ppb.c                         |   47 +++++------
 sys/dev/pci/ppbreg.h                      |   75 +------------------
 19 files changed, 282 insertions(+), 350 deletions(-)

diffs (truncated from 1359 to 300 lines):

diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/arm/imx/imx6_pcie.c
--- a/sys/arch/arm/imx/imx6_pcie.c      Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/arm/imx/imx6_pcie.c      Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imx6_pcie.c,v 1.7 2018/12/16 16:45:11 skrll Exp $      */
+/*     $NetBSD: imx6_pcie.c,v 1.8 2019/03/01 09:25:59 msaitoh Exp $    */
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.7 2018/12/16 16:45:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.8 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include "opt_pci.h"
 
@@ -688,12 +688,11 @@
 
        /* Bus number */
        v = PCIE_READ(sc, PCI_BRIDGE_BUS_REG);
-       v &= ~(PCI_BRIDGE_BUS_EACH_MASK << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT |
-           PCI_BRIDGE_BUS_EACH_MASK << PCI_BRIDGE_BUS_SECONDARY_SHIFT |
-           PCI_BRIDGE_BUS_EACH_MASK << PCI_BRIDGE_BUS_PRIMARY_SHIFT);
-       v |= PCI_BRIDGE_BUS_SUBORDINATE(1);
-       v |= PCI_BRIDGE_BUS_SECONDARY(1);
-       v |= PCI_BRIDGE_BUS_PRIMARY(0);
+       v &= ~(PCI_BRIDGE_BUS_SUBORDINATE | PCI_BRIDGE_BUS_SECONDARY |
+           PCI_BRIDGE_BUS_PRIMARY);
+       v |= PCI_BRIDGE_BUS_NUM_SUBORDINATE(1);
+       v |= PCI_BRIDGE_BUS_NUM_SECONDARY(1);
+       v |= PCI_BRIDGE_BUS_NUM_PRIMARY(0);
        PCIE_WRITE(sc, PCI_BRIDGE_BUS_REG, v);
 
        /* Command register */
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/arm/xscale/i80312.c
--- a/sys/arch/arm/xscale/i80312.c      Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/arm/xscale/i80312.c      Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i80312.c,v 1.23 2012/10/14 14:20:57 msaitoh Exp $      */
+/*     $NetBSD: i80312.c,v 1.24 2019/03/01 09:25:59 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80312.c,v 1.23 2012/10/14 14:20:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80312.c,v 1.24 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,10 +268,10 @@
         */
        if (sc->sc_is_host) {
                bus_space_write_4(sc->sc_st, sc->sc_ppb_sh,
-                   PPB_REG_BUSINFO,
-                   (0 << PCI_BRIDGE_BUS_PRIMARY_SHIFT) |
-                   (1 << PCI_BRIDGE_BUS_SECONDARY_SHIFT) |
-                   (1 << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
+                   PCI_BRIDGE_BUS_REG,
+                   __SHIFTIN(0, PCI_BRIDGE_BUS_PRIMARY) |
+                   __SHIFTIN(1, PCI_BRIDGE_BUS_SECONDARY) |
+                   __SHIFTIN(1, PCI_BRIDGE_BUS_SUBORDINATE));
        }
 
        /* Initialize the bus space tags. */
@@ -306,13 +306,13 @@
         * is the only bus on which we can have a private device
         * space.
         */
-       preg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PPB_REG_BUSINFO);
+       preg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PCI_BRIDGE_BUS_REG);
        pba.pba_iot = &sc->sc_pci_iot;
        pba.pba_memt = &sc->sc_pci_memt;
        pba.pba_dmat = &sc->sc_pci_dmat;
        pba.pba_dmat64 = NULL;
        pba.pba_pc = &sc->sc_pci_chipset;
-       pba.pba_bus = PPB_BUSINFO_SECONDARY(preg);
+       pba.pba_bus = PCI_BRIDGE_BUS_NUM_SECONDARY(preg);
        pba.pba_bridgetag = NULL;
        pba.pba_intrswiz = 3;
        pba.pba_intrtag = 0;
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/arm/xscale/i80312_pci.c
--- a/sys/arch/arm/xscale/i80312_pci.c  Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/arm/xscale/i80312_pci.c  Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i80312_pci.c,v 1.16 2015/10/02 05:22:50 msaitoh Exp $  */
+/*     $NetBSD: i80312_pci.c,v 1.17 2019/03/01 09:25:59 msaitoh Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80312_pci.c,v 1.16 2015/10/02 05:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80312_pci.c,v 1.17 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -106,9 +106,9 @@
         * the Secondary bus.
         */
 
-       binfo = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PPB_REG_BUSINFO);
-       /* pbus = PPB_BUSINFO_PRIMARY(binfo); */
-       sbus = PPB_BUSINFO_SECONDARY(binfo);
+       binfo = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PCI_BRIDGE_BUS_REG);
+       /* pbus = PCI_BRIDGE_BUS_NUM_PRIMARY(binfo); */
+       sbus = PCI_BRIDGE_BUS_NUM_SECONDARY(binfo);
 
        ioext  = extent_create("pciio", sc->sc_sioout_base,
            sc->sc_sioout_base + sc->sc_sioout_size - 1,
@@ -185,9 +185,9 @@
 
        i80312_pci_decompose_tag(sc, tag, &ps->ps_b, &ps->ps_d, &ps->ps_f);
 
-       binfo = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PPB_REG_BUSINFO);
-       pbus = PPB_BUSINFO_PRIMARY(binfo);
-       sbus = PPB_BUSINFO_SECONDARY(binfo);
+       binfo = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PCI_BRIDGE_BUS_REG);
+       pbus = PCI_BRIDGE_BUS_NUM_PRIMARY(binfo);
+       sbus = PCI_BRIDGE_BUS_NUM_SECONDARY(binfo);
 
        /*
         * If the bus # is the Primary bus #, use the Primary
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/evbarm/iq80310/iq80310_machdep.c
--- a/sys/arch/evbarm/iq80310/iq80310_machdep.c Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_machdep.c Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iq80310_machdep.c,v 1.89 2018/10/28 14:30:31 skrll Exp $       */
+/*     $NetBSD: iq80310_machdep.c,v 1.90 2019/03/01 09:25:59 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iq80310_machdep.c,v 1.89 2018/10/28 14:30:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iq80310_machdep.c,v 1.90 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -376,13 +376,13 @@
                printf("Resetting secondary PCI bus...\n");
 #endif
                reg = bus_space_read_4(&obio_bs_tag,
-                   I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL);
+                   I80312_PMMR_BASE + I80312_PPB_BASE, PCI_BRIDGE_CONTROL_REG);
                bus_space_write_4(&obio_bs_tag,
-                   I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL,
-                   reg | PPB_BC_SECONDARY_RESET);
+                   I80312_PMMR_BASE + I80312_PPB_BASE, PCI_BRIDGE_CONTROL_REG,
+                   reg | PCI_BRIDGE_CONTROL_SECBR);
                delay(10 * 1000);       /* 10ms enough? */
                bus_space_write_4(&obio_bs_tag,
-                   I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL,
+                   I80312_PMMR_BASE + I80312_PPB_BASE, PCI_BRIDGE_CONTROL_REG,
                    reg);
        }
 
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/evbarm/iq80310/iq80310_pci.c
--- a/sys/arch/evbarm/iq80310/iq80310_pci.c     Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_pci.c     Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iq80310_pci.c,v 1.15 2018/11/16 15:06:23 jmcneill Exp $        */
+/*     $NetBSD: iq80310_pci.c,v 1.16 2019/03/01 09:25:59 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iq80310_pci.c,v 1.15 2018/11/16 15:06:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iq80310_pci.c,v 1.16 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,8 +95,8 @@
         * the i80312.
         */
 
-       reg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PPB_REG_BUSINFO);
-       sbus = PPB_BUSINFO_SECONDARY(reg);
+       reg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PCI_BRIDGE_BUS_REG);
+       sbus = PCI_BRIDGE_BUS_NUM_SECONDARY(reg);
 
        if (pa->pa_bus != sbus) {
                printf("iq80310_pci_intr_map: %d/%d/%d not on Secondary bus\n",
@@ -149,9 +149,9 @@
         * and can determine if we're looking at that device.
         */
 
-       reg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PPB_REG_BUSINFO);
-       pbus = PPB_BUSINFO_PRIMARY(reg);
-       sbus = PPB_BUSINFO_SECONDARY(reg);
+       reg = bus_space_read_4(sc->sc_st, sc->sc_ppb_sh, PCI_BRIDGE_BUS_REG);
+       pbus = PCI_BRIDGE_BUS_NUM_PRIMARY(reg);
+       sbus = PCI_BRIDGE_BUS_NUM_SECONDARY(reg);
 
        /*
         * XXX We don't know how to map interrupts on the Primary
@@ -192,8 +192,8 @@
        }
 
        /* Now read the PPB's secondary bus number. */
-       reg = pci_conf_read(pa->pa_pc, tag, PPB_REG_BUSINFO);
-       sbus = PPB_BUSINFO_SECONDARY(reg);
+       reg = pci_conf_read(pa->pa_pc, tag, PCI_BRIDGE_BUS_REG);
+       sbus = PCI_BRIDGE_BUS_NUM_SECONDARY(reg);
 
        if (pa->pa_bus == sbus && pa->pa_device == 0 &&
            pa->pa_function == 0) {
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/macppc/pci/pci_machdep.c
--- a/sys/arch/macppc/pci/pci_machdep.c Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/macppc/pci/pci_machdep.c Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.41 2016/10/19 00:08:41 nonaka Exp $  */
+/*     $NetBSD: pci_machdep.c,v 1.42 2019/03/01 09:25:59 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.41 2016/10/19 00:08:41 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.42 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -318,7 +318,7 @@
                         * we found a CardBus bridge. Check if the bus number
                         * is sane
                         */
-                       bi = pci_conf_read(pc, tag, PPB_REG_BUSINFO);
+                       bi = pci_conf_read(pc, tag, PCI_BRIDGE_BUS_REG);
                        busid = bi & 0xff;
                        if (busid == 0) {
                                fix_cardbus_bridge(node, pc, tag);
@@ -360,11 +360,11 @@
                path[len] = 0;
                aprint_verbose("\n%s: fixing bus number to %d", path, bus_number);
                pci_decompose_tag(pc, tag, &bus, &dev, &fn);
-               bi = pci_conf_read(pc, tag, PPB_REG_BUSINFO);
+               bi = pci_conf_read(pc, tag, PCI_BRIDGE_BUS_REG);
                bi &= 0xff000000;
                /* XXX subordinate is always 32 here */
                bi |= (bus & 0xff) | (bus_number << 8) | 0x200000;
-               pci_conf_write(pc, tag, PPB_REG_BUSINFO, bi);
+               pci_conf_write(pc, tag, PCI_BRIDGE_BUS_REG, bi);
        }
 }
 
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/sparc/sparc/pci_fixup.c
--- a/sys/arch/sparc/sparc/pci_fixup.c  Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/sparc/sparc/pci_fixup.c  Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_fixup.c,v 1.1 2013/04/16 06:57:06 jdc Exp $        */
+/*     $NetBSD: pci_fixup.c,v 1.2 2019/03/01 09:25:59 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -479,10 +479,10 @@
        /* 64-bit prefetchable range (if supported) - set it to 0 */
        val = pci_conf_read(NULL, starttag, PCI_BRIDGE_PREFETCHMEM_REG);
        if (val & 0x01) {
-               pci_conf_write(NULL, starttag, PCI_BRIDGE_PREFETCHBASE32_REG,
-                   (pcireg_t) ~0);
-               pci_conf_write(NULL, starttag, PCI_BRIDGE_PREFETCHLIMIT32_REG,
-                   (pcireg_t) 0);
+               pci_conf_write(NULL, starttag,
+                   PCI_BRIDGE_PREFETCHBASEUP32_REG, (pcireg_t) ~0);
+               pci_conf_write(NULL, starttag,
+                   PCI_BRIDGE_PREFETCHLIMITUP32_REG, (pcireg_t) 0);
        }
 
 #ifdef SPARC_PCI_FIXUP_DEBUG
diff -r 380fa5e934c4 -r fddda59dd087 sys/arch/sparc64/sparc64/rbus_machdep.c
--- a/sys/arch/sparc64/sparc64/rbus_machdep.c   Fri Mar 01 09:21:06 2019 +0000
+++ b/sys/arch/sparc64/sparc64/rbus_machdep.c   Fri Mar 01 09:25:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rbus_machdep.c,v 1.16 2011/07/01 18:49:24 dyoung Exp $ */
+/*     $NetBSD: rbus_machdep.c,v 1.17 2019/03/01 09:25:59 msaitoh Exp $        */
 
 /*
  * Copyright (c) 2003 Takeshi Nakayama.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.16 2011/07/01 18:49:24 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.17 2019/03/01 09:25:59 msaitoh Exp $");
 
 #include <sys/param.h>



Home | Main Index | Thread Index | Old Index