Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Blocking memory space accesses on the SIS 85C496 ch...



details:   https://anonhg.NetBSD.org/src/rev/bf620759a56e
branches:  trunk
changeset: 788962:bf620759a56e
user:      soren <soren%NetBSD.org@localhost>
date:      Wed Jul 31 14:05:33 2013 +0000

description:
Blocking memory space accesses on the SIS 85C496 chipset turned out to be
a bit too heavy-handed and similar cases are unlikely to crop up again,
so simplify by eliminating pci_bus_flags().

Closes PR port-i386/20410.

diffstat:

 sys/arch/amd64/amd64/mainbus.c            |   9 +++-
 sys/arch/i386/i386/mainbus.c              |   9 +++-
 sys/arch/x86/include/pci_machdep_common.h |   3 +-
 sys/arch/x86/pci/pci_machdep.c            |  51 +-----------------------------
 4 files changed, 15 insertions(+), 57 deletions(-)

diffs (149 lines):

diff -r 76899c01f5f5 -r bf620759a56e sys/arch/amd64/amd64/mainbus.c
--- a/sys/arch/amd64/amd64/mainbus.c    Wed Jul 31 13:54:42 2013 +0000
+++ b/sys/arch/amd64/amd64/mainbus.c    Wed Jul 31 14:05:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.33 2011/05/17 17:34:47 dyoung Exp $      */
+/*     $NetBSD: mainbus.c,v 1.34 2013/07/31 14:05:33 soren Exp $       */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33 2011/05/17 17:34:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.34 2013/07/31 14:05:33 soren Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -262,7 +262,10 @@
                mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
                mba.mba_pba.pba_dmat64 = &pci_bus_dma64_tag;
                mba.mba_pba.pba_pc = NULL;
-               mba.mba_pba.pba_flags = pci_bus_flags();
+               mba.mba_pba.pba_flags =
+                   PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
+                   PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
+                   PCI_FLAGS_MWI_OKAY;
                mba.mba_pba.pba_bus = 0;
                mba.mba_pba.pba_bridgetag = NULL;
 #if NACPICA > 0 && defined(ACPI_SCANPCI)
diff -r 76899c01f5f5 -r bf620759a56e sys/arch/i386/i386/mainbus.c
--- a/sys/arch/i386/i386/mainbus.c      Wed Jul 31 13:54:42 2013 +0000
+++ b/sys/arch/i386/i386/mainbus.c      Wed Jul 31 14:05:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.96 2012/09/30 20:54:52 dsl Exp $ */
+/*     $NetBSD: mainbus.c,v 1.97 2013/07/31 14:05:33 soren Exp $       */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.96 2012/09/30 20:54:52 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.97 2013/07/31 14:05:33 soren Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -390,7 +390,10 @@
                mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
                mba.mba_pba.pba_dmat64 = NULL;
                mba.mba_pba.pba_pc = NULL;
-               mba.mba_pba.pba_flags = pci_bus_flags();
+               mba.mba_pba.pba_flags =
+                   PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
+                   PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
+                   PCI_FLAGS_MWI_OKAY;
                mba.mba_pba.pba_bus = 0;
                /* XXX On those machines with >1 Host-PCI bridge,
                 * XXX not every bus > pba_bus is subordinate to pba_bus,
diff -r 76899c01f5f5 -r bf620759a56e sys/arch/x86/include/pci_machdep_common.h
--- a/sys/arch/x86/include/pci_machdep_common.h Wed Jul 31 13:54:42 2013 +0000
+++ b/sys/arch/x86/include/pci_machdep_common.h Wed Jul 31 14:05:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep_common.h,v 1.11 2012/12/09 21:30:02 jakllsch Exp $ */
+/*     $NetBSD: pci_machdep_common.h,v 1.12 2013/07/31 14:05:33 soren Exp $    */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -93,7 +93,6 @@
  * x86-specific PCI variables and functions.
  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
  */
-int            pci_bus_flags(void);
 int            pci_mode_detect(void);
 void           pci_mode_set(int);
 
diff -r 76899c01f5f5 -r bf620759a56e sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c    Wed Jul 31 13:54:42 2013 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c    Wed Jul 31 14:05:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.58 2013/07/22 13:40:36 soren Exp $   */
+/*     $NetBSD: pci_machdep.c,v 1.59 2013/07/31 14:05:33 soren Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.58 2013/07/22 13:40:36 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.59 2013/07/31 14:05:33 soren Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -598,53 +598,6 @@
        return (pci_mode = 0);
 }
 
-/*
- * Determine which flags should be passed to the primary PCI bus's
- * autoconfiguration node.  We use this to detect broken chipsets
- * which cannot safely use memory-mapped device access.
- */
-int
-pci_bus_flags(void)
-{
-       int rval = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
-           PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
-       int device, maxndevs;
-       pcitag_t tag;
-       pcireg_t id;
-
-       maxndevs = pci_bus_maxdevs(NULL, 0);
-
-       for (device = 0; device < maxndevs; device++) {
-               tag = pci_make_tag(NULL, 0, device, 0);
-               id = pci_conf_read(NULL, tag, PCI_ID_REG);
-
-               /* Invalid vendor ID value? */
-               if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
-                       continue;
-               /* XXX Not invalid, but we've done this ~forever. */
-               if (PCI_VENDOR(id) == 0)
-                       continue;
-
-               switch (PCI_VENDOR(id)) {
-               case PCI_VENDOR_SIS:
-                       switch (PCI_PRODUCT(id)) {
-                       case PCI_PRODUCT_SIS_85C496:
-                               goto disable_mem;
-                       }
-                       break;
-               }
-       }
-
-       return (rval);
-
- disable_mem:
-       printf("Warning: broken PCI-Host bridge detected; "
-           "disabling memory-mapped access\n");
-       rval &= ~(PCI_FLAGS_MEM_OKAY|PCI_FLAGS_MRL_OKAY|PCI_FLAGS_MRM_OKAY|
-           PCI_FLAGS_MWI_OKAY);
-       return (rval);
-}
-
 void
 pci_device_foreach(pci_chipset_tag_t pc, int maxbus,
        void (*func)(pci_chipset_tag_t, pcitag_t, void *), void *context)



Home | Main Index | Thread Index | Old Index