Source-Changes-HG archive

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

[src/trunk]: src/sys Add a "cacheline_size" argument to pci_configure_bus(). ...



details:   https://anonhg.NetBSD.org/src/rev/7d215ae5b779
branches:  trunk
changeset: 518359:7d215ae5b779
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Nov 28 23:48:34 2001 +0000

description:
Add a "cacheline_size" argument to pci_configure_bus().  It is used
to set the cacheline size in the BHLC register.  This should be the
size of the largest D-cache line on a system.

diffstat:

 sys/arch/algor/dev/mainbus.c           |   6 ++++--
 sys/arch/arm/xscale/i80312_pci.c       |   5 +++--
 sys/arch/bebox/bebox/mainbus.c         |   4 ++--
 sys/arch/evbarm/ifpga/ifpga.c          |   8 ++++++--
 sys/arch/prep/prep/mainbus.c           |   4 ++--
 sys/arch/sandpoint/sandpoint/mainbus.c |   4 ++--
 sys/arch/walnut/walnut/mainbus.c       |   4 ++--
 sys/dev/pci/pciconf.c                  |  17 ++++++++++++-----
 sys/dev/pci/pciconf.h                  |   4 ++--
 9 files changed, 35 insertions(+), 21 deletions(-)

diffs (224 lines):

diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/algor/dev/mainbus.c
--- a/sys/arch/algor/dev/mainbus.c      Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/algor/dev/mainbus.c      Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.6 2001/11/09 19:29:12 thorpej Exp $      */
+/*     $NetBSD: mainbus.c,v 1.7 2001/11/28 23:48:35 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@
 #include <machine/bus.h>
 #include <machine/autoconf.h>
 
+#include <mips/cache.h>
+
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pciconf.h>
 
@@ -196,7 +198,7 @@
 #endif
 #endif /* ALGOR_P4032 || ALGOR_P5064 || ALGOR_P6032 */
 
-       pci_configure_bus(pc, ioext, memext, NULL, 0);
+       pci_configure_bus(pc, ioext, memext, NULL, 0, mips_sdcache_align);
        extent_destroy(ioext);
        extent_destroy(memext);
 
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/arm/xscale/i80312_pci.c
--- a/sys/arch/arm/xscale/i80312_pci.c  Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/arm/xscale/i80312_pci.c  Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i80312_pci.c,v 1.3 2001/11/09 19:48:35 thorpej Exp $   */
+/*     $NetBSD: i80312_pci.c,v 1.4 2001/11/28 23:48:35 thorpej Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -110,7 +110,8 @@
            M_DEVBUF, NULL, 0, EX_NOWAIT);
 
        printf("%s: configuring Secondary PCI bus\n", sc->sc_dev.dv_xname);
-       pci_configure_bus(pc, ioext, memext, NULL, sbus);
+       /* XXX Magic number; XScale has a 32-byte cache line. */
+       pci_configure_bus(pc, ioext, memext, NULL, sbus, 32);
 
        extent_destroy(ioext);
        extent_destroy(memext);
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/bebox/bebox/mainbus.c
--- a/sys/arch/bebox/bebox/mainbus.c    Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/bebox/bebox/mainbus.c    Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.9 2001/11/09 19:29:12 thorpej Exp $      */
+/*     $NetBSD: mainbus.c,v 1.10 2001/11/28 23:48:35 thorpej Exp $     */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -102,7 +102,7 @@
            NULL, 0, EX_NOWAIT);
        memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
            NULL, 0, EX_NOWAIT);
-       pci_configure_bus(0, ioext, memext, NULL, 0);
+       pci_configure_bus(0, ioext, memext, NULL, 0, 32);
        extent_destroy(ioext);
        extent_destroy(memext);
 #endif
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/evbarm/ifpga/ifpga.c
--- a/sys/arch/evbarm/ifpga/ifpga.c     Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/evbarm/ifpga/ifpga.c     Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifpga.c,v 1.2 2001/11/09 19:29:12 thorpej Exp $ */
+/*     $NetBSD: ifpga.c,v 1.3 2001/11/28 23:48:35 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 ARM Ltd
@@ -319,7 +319,11 @@
            IFPGA_PCI_APP1_BASE + IFPGA_PCI_APP1_SIZE,
            M_DEVBUF, NULL, 0, EX_NOWAIT);
        ifpga_pci_chipset.pc_conf_v = (void *)pci_sc;
-       pci_configure_bus(&ifpga_pci_chipset, ioext, memext, pmemext, 0);
+       /*
+        * XXX ARM920T has a 32-byte cache line; should probably fetch
+        * XXX this info from the cache type register.
+        */
+       pci_configure_bus(&ifpga_pci_chipset, ioext, memext, pmemext, 0, 32);
        extent_destroy(pmemext);
        extent_destroy(memext);
        extent_destroy(ioext);
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/prep/prep/mainbus.c
--- a/sys/arch/prep/prep/mainbus.c      Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/prep/prep/mainbus.c      Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.5 2001/11/09 19:29:13 thorpej Exp $      */
+/*     $NetBSD: mainbus.c,v 1.6 2001/11/28 23:48:35 thorpej Exp $      */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -108,7 +108,7 @@
        memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
            NULL, 0, EX_NOWAIT);
 
-       pci_configure_bus(0, ioext, memext, NULL, 0);
+       pci_configure_bus(0, ioext, memext, NULL, 0, 32);
 
        extent_destroy(ioext);
        extent_destroy(memext);
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/sandpoint/sandpoint/mainbus.c
--- a/sys/arch/sandpoint/sandpoint/mainbus.c    Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/sandpoint/sandpoint/mainbus.c    Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.6 2001/11/09 19:29:13 thorpej Exp $      */
+/*     $NetBSD: mainbus.c,v 1.7 2001/11/28 23:48:36 thorpej Exp $      */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -110,7 +110,7 @@
        memext = extent_create("pcimem", 0x80000000, 0x8fffffff, M_DEVBUF,
            NULL, 0, EX_NOWAIT);
 
-       pci_configure_bus(0, ioext, memext, NULL, 0);
+       pci_configure_bus(0, ioext, memext, NULL, 0, 32);
 
        extent_destroy(ioext);
        extent_destroy(memext);
diff -r 72fb981d5284 -r 7d215ae5b779 sys/arch/walnut/walnut/mainbus.c
--- a/sys/arch/walnut/walnut/mainbus.c  Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/arch/walnut/walnut/mainbus.c  Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.7 2001/11/09 19:29:13 thorpej Exp $      */
+/*     $NetBSD: mainbus.c,v 1.8 2001/11/28 23:48:36 thorpej Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -227,7 +227,7 @@
            EX_NOWAIT);
        ioext = extent_create("pciio", MIN_PCI_PCI_IOADDR,
            MIN_PCI_PCI_IOADDR + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT);
-       pci_configure_bus(0, ioext, memext, NULL, 0);
+       pci_configure_bus(0, ioext, memext, NULL, 0, 32);
        extent_destroy(memext);
 #endif /* PCI_NETBSD_CONFIGURE */
 
diff -r 72fb981d5284 -r 7d215ae5b779 sys/dev/pci/pciconf.c
--- a/sys/dev/pci/pciconf.c     Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/dev/pci/pciconf.c     Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciconf.c,v 1.13 2001/11/13 07:48:48 lukem Exp $       */
+/*     $NetBSD: pciconf.c,v 1.14 2001/11/28 23:48:34 thorpej Exp $     */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.13 2001/11/13 07:48:48 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.14 2001/11/28 23:48:34 thorpej Exp $");
 
 #include "opt_pci.h"
 
@@ -122,6 +122,7 @@
        int             busno_spacing;
        int             max_mingnt;
        int             min_maxlat;
+       int             cacheline_size;
        int             prefetch;
        int             fast_b2b;
        int             freq_66;
@@ -316,6 +317,7 @@
        if (!pb)
                panic("Unable to allocate memory for PCI configuration.");
 
+       pb->cacheline_size = parent->cacheline_size;
        pb->parent_bus = parent;
        alloc_busno(parent, pb);
        if (pci_conf_debug)
@@ -978,8 +980,11 @@
                }
                pci_conf_write(pd->pc, pd->tag, PCI_COMMAND_STATUS_REG, cmd);
 
-               misc = (misc & ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT))
-                   | ((ltim & 0xff) << PCI_LATTIMER_SHIFT);
+               misc &= ~((PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT) |
+                   (PCI_CACHELINE_MASK << PCI_CACHELINE_SHIFT));
+               misc |= (ltim & PCI_LATTIMER_MASK) << PCI_LATTIMER_SHIFT;
+               misc |= (pb->cacheline_size & PCI_CACHELINE_MASK) <<
+                   PCI_CACHELINE_SHIFT;
                pci_conf_write(pd->pc, pd->tag, PCI_BHLC_REG, misc);
 
                if (pd->ppb) {
@@ -1025,7 +1030,8 @@
  */
 int
 pci_configure_bus(pci_chipset_tag_t pc, struct extent *ioext,
-    struct extent *memext, struct extent *pmemext, int firstbus)
+    struct extent *memext, struct extent *pmemext, int firstbus,
+    int cacheline_size)
 {
        pciconf_bus_t   *pb;
        int             rv;
@@ -1035,6 +1041,7 @@
        pb->busno_spacing = PCI_BUSNO_SPACING;
        pb->next_busno = pb->busno + 1;
        pb->last_busno = 255;
+       pb->cacheline_size = cacheline_size;
        pb->parent_bus = NULL;
        pb->swiz = 0;
        pb->io_32bit = 1;
diff -r 72fb981d5284 -r 7d215ae5b779 sys/dev/pci/pciconf.h
--- a/sys/dev/pci/pciconf.h     Wed Nov 28 23:46:42 2001 +0000
+++ b/sys/dev/pci/pciconf.h     Wed Nov 28 23:48:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciconf.h,v 1.4 2001/11/09 19:29:12 thorpej Exp $      */
+/*     $NetBSD: pciconf.h,v 1.5 2001/11/28 23:48:34 thorpej Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
  * be used for both
  */
 int    pci_configure_bus __P((pci_chipset_tag_t, struct extent *,
-           struct extent *, struct extent *, int));
+           struct extent *, struct extent *, int, int));
 
 /* Defined in machdep code.  Returns the interrupt line to set */
 /* args: chipset_tag, bus, dev, ipin, ptr to interrupt line */



Home | Main Index | Thread Index | Old Index