Source-Changes-HG archive

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

[src/trunk]: src/sys PCI_NETBSD_CONFIGURE should allocate (but not map) addre...



details:   https://anonhg.NetBSD.org/src/rev/4f516bfd7bfa
branches:  trunk
changeset: 588168:4f516bfd7bfa
user:      gdamore <gdamore%NetBSD.org@localhost>
date:      Fri Feb 10 20:52:56 2006 +0000

description:
PCI_NETBSD_CONFIGURE should allocate (but not map) address space expansion
ROMS by default.   Full discussion at
http://mail-index.netbsd.org/tech-kern/2005/12/16/0023.html
Closes PR kern/32467
Reviewed by briggs@

diffstat:

 sys/arch/cobalt/pci/pci_machdep.c         |   8 ++++----
 sys/arch/evbppc/ev64260/gt_mainbus.c      |   6 +++---
 sys/arch/evbppc/walnut/pci/pci_machdep.c  |   6 +++---
 sys/arch/ibmnws/pci/pci_machdep.c         |   2 +-
 sys/arch/iyonix/iyonix/iyonix_pci.c       |   6 +++---
 sys/arch/powerpc/ibm4xx/pci/pci_machdep.c |   6 +++---
 sys/arch/prep/pci/pci_machdep.c           |   6 +++---
 sys/dev/pci/pciconf.c                     |  16 +++++++++++-----
 sys/dev/pci/pciconf.h                     |  23 ++++++++++++-----------
 9 files changed, 43 insertions(+), 36 deletions(-)

diffs (251 lines):

diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/cobalt/pci/pci_machdep.c
--- a/sys/arch/cobalt/pci/pci_machdep.c Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/cobalt/pci/pci_machdep.c Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.18 2005/12/11 12:17:06 christos Exp $        */
+/*     $NetBSD: pci_machdep.c,v 1.19 2006/02/10 20:52:56 gdamore Exp $ */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.18 2005/12/11 12:17:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.19 2006/02/10 20:52:56 gdamore Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -248,6 +248,6 @@
        if (dev == 9)
                return 0;
 
-       return PCI_CONF_ALL & ~(PCI_CONF_MAP_ROM |
-           PCI_COMMAND_SERR_ENABLE | PCI_COMMAND_PARITY_ENABLE);
+       return PCI_CONF_DEFAULT & ~(PCI_COMMAND_SERR_ENABLE |
+           PCI_COMMAND_PARITY_ENABLE);
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/evbppc/ev64260/gt_mainbus.c
--- a/sys/arch/evbppc/ev64260/gt_mainbus.c      Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/evbppc/ev64260/gt_mainbus.c      Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gt_mainbus.c,v 1.12 2005/12/11 12:17:12 christos Exp $ */
+/*     $NetBSD: gt_mainbus.c,v 1.13 2006/02/10 20:52:57 gdamore Exp $  */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.12 2005/12/11 12:17:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.13 2006/02/10 20:52:57 gdamore Exp $");
 
 #include "opt_ev64260.h"
 
@@ -240,7 +240,7 @@
        if (bus == 0 && dev == 0)       /* don't configure GT */
                return 0;
 
-       return PCI_CONF_ALL;
+       return PCI_CONF_DEFAULT;
 }
 
 int
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/evbppc/walnut/pci/pci_machdep.c
--- a/sys/arch/evbppc/walnut/pci/pci_machdep.c  Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/evbppc/walnut/pci/pci_machdep.c  Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.5 2005/12/11 12:17:13 christos Exp $ */
+/*     $NetBSD: pci_machdep.c,v 1.6 2006/02/10 20:52:57 gdamore 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.5 2005/12/11 12:17:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.6 2006/02/10 20:52:57 gdamore Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -267,5 +267,5 @@
                /* Don't configure the bridge and PCI probe. */
                return 0;
        }
-       return PCI_CONF_ALL & ~PCI_CONF_MAP_ROM;
+       return PCI_CONF_DEFAULT;
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/ibmnws/pci/pci_machdep.c
--- a/sys/arch/ibmnws/pci/pci_machdep.c Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/ibmnws/pci/pci_machdep.c Fri Feb 10 20:52:56 2006 +0000
@@ -201,5 +201,5 @@
            PCI_PRODUCT(id) == PCI_PRODUCT_WEITEK_P9100)
                return 0;
 
-       return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);
+       return (PCI_CONF_DEFAULT);
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/iyonix/iyonix/iyonix_pci.c
--- a/sys/arch/iyonix/iyonix/iyonix_pci.c       Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/iyonix/iyonix/iyonix_pci.c       Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iyonix_pci.c,v 1.2 2005/12/11 12:17:51 christos Exp $  */
+/*     $NetBSD: iyonix_pci.c,v 1.3 2006/02/10 20:52:57 gdamore Exp $   */
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iyonix_pci.c,v 1.2 2005/12/11 12:17:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iyonix_pci.c,v 1.3 2006/02/10 20:52:57 gdamore Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -222,5 +222,5 @@
                pci_conf_write_byte(pc, tag, 0x78, 1 << 7);
        }
 
-       return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);
+       return (PCI_CONF_DEFAULT);
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/powerpc/ibm4xx/pci/pci_machdep.c
--- a/sys/arch/powerpc/ibm4xx/pci/pci_machdep.c Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/powerpc/ibm4xx/pci/pci_machdep.c Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.2 2005/12/11 12:18:43 christos Exp $ */
+/*     $NetBSD: pci_machdep.c,v 1.3 2006/02/10 20:52:57 gdamore 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.2 2005/12/11 12:18:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.3 2006/02/10 20:52:57 gdamore Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -267,5 +267,5 @@
                /* Don't configure the bridge and PCI probe. */
                return 0;
        }
-       return PCI_CONF_ALL & ~PCI_CONF_MAP_ROM;
+       return PCI_CONF_DEFAULT;
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/arch/prep/pci/pci_machdep.c
--- a/sys/arch/prep/pci/pci_machdep.c   Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/arch/prep/pci/pci_machdep.c   Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.21 2005/12/11 12:18:47 christos Exp $        */
+/*     $NetBSD: pci_machdep.c,v 1.22 2006/02/10 20:52:57 gdamore Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.21 2005/12/11 12:18:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.22 2006/02/10 20:52:57 gdamore Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -207,5 +207,5 @@
            PCI_PRODUCT(id) == PCI_PRODUCT_WEITEK_P9100)
                return 0;
 
-       return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);
+       return (PCI_CONF_DEFAULT);
 }
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/dev/pci/pciconf.c
--- a/sys/dev/pci/pciconf.c     Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/dev/pci/pciconf.c     Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciconf.c,v 1.27 2005/12/11 12:22:50 christos Exp $    */
+/*     $NetBSD: pciconf.c,v 1.28 2006/02/10 20:52:57 gdamore Exp $     */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.27 2005/12/11 12:22:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.28 2006/02/10 20:52:57 gdamore Exp $");
 
 #include "opt_pci.h"
 
@@ -283,7 +283,7 @@
                                 * when not needed will cause all sorts of
                                 * lossage.
                                 */
-                               confmode = PCI_CONF_ALL & ~PCI_CONF_MAP_ROM;
+                               confmode = PCI_CONF_DEFAULT;
 #endif
                                if (pci_do_device_query(pb, tag, device,
                                    function, confmode))
@@ -654,10 +654,14 @@
                        pb->pmem_total += size;
                }
        } else {
+               /* Don't enable ROMs if we aren't going to map them. */
+               mode &= ~PCI_CONF_ENABLE_ROM;
+               pd->enable &= ~PCI_CONF_ENABLE_ROM;
+       }
+
+       if (!(mode & PCI_CONF_ENABLE_ROM)) {
                /* Ensure ROM is disabled */
                bar = pci_conf_read(pb->pc, tag, PCI_MAPREG_ROM);
-               pci_conf_write(pb->pc, tag, PCI_MAPREG_ROM, 0xfffffffe);
-               mask = pci_conf_read(pb->pc, tag, PCI_MAPREG_ROM);
                pci_conf_write(pb->pc, tag, PCI_MAPREG_ROM,
                    bar & ~PCI_MAPREG_ROM_ENABLE);
        }
@@ -804,6 +808,8 @@
        for (pm=pb->pcimemwin; pm < &pb->pcimemwin[pb->nmemwin] ; pm++) {
                if (pm->reg == PCI_MAPREG_ROM && pm->address != -1) {
                        pd = pm->dev;
+                       if (!(pd->enable & PCI_CONF_ENABLE_ROM))
+                               continue;
                        if (pci_conf_debug) {
                                print_tag(pd->pc, pd->tag);
                                printf(
diff -r 71313ac2e32c -r 4f516bfd7bfa sys/dev/pci/pciconf.h
--- a/sys/dev/pci/pciconf.h     Fri Feb 10 20:49:14 2006 +0000
+++ b/sys/dev/pci/pciconf.h     Fri Feb 10 20:52:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciconf.h,v 1.10 2005/12/11 12:22:50 christos Exp $    */
+/*     $NetBSD: pciconf.h,v 1.11 2006/02/10 20:52:57 gdamore Exp $     */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -49,13 +49,14 @@
 void   pci_conf_interrupt(pci_chipset_tag_t, int, int, int, int, int *);
 #endif
 
-#define PCI_CONF_MAP_IO                0x01
-#define PCI_CONF_MAP_MEM       0x02
-#define PCI_CONF_MAP_ROM       0x04
-#define PCI_CONF_ENABLE_IO     0x08
-#define PCI_CONF_ENABLE_MEM    0x10
-#define PCI_CONF_ENABLE_BM     0x20
-#define PCI_CONF_ENABLE_PARITY 0x40
-#define PCI_CONF_ENABLE_SERR   0x80
-
-#define PCI_CONF_ALL           0xff
+#define PCI_CONF_MAP_IO                0x0001
+#define PCI_CONF_MAP_MEM       0x0002
+#define PCI_CONF_MAP_ROM       0x0004
+#define PCI_CONF_ENABLE_IO     0x0008
+#define PCI_CONF_ENABLE_MEM    0x0010
+#define PCI_CONF_ENABLE_BM     0x0020
+#define PCI_CONF_ENABLE_PARITY 0x0040
+#define PCI_CONF_ENABLE_SERR   0x0080
+#define PCI_CONF_ENABLE_ROM    0x0100
+#define PCI_CONF_DEFAULT       0x00ff
+#define PCI_CONF_ALL           0x01ff



Home | Main Index | Thread Index | Old Index