Module Name: src Committed By: soren Date: Wed Jul 31 14:05:33 UTC 2013
Modified Files: src/sys/arch/amd64/amd64: mainbus.c src/sys/arch/i386/i386: mainbus.c src/sys/arch/x86/include: pci_machdep_common.h src/sys/arch/x86/pci: pci_machdep.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/mainbus.c cvs rdiff -u -r1.96 -r1.97 src/sys/arch/i386/i386/mainbus.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/pci_machdep_common.h cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/pci/pci_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/mainbus.c diff -u src/sys/arch/amd64/amd64/mainbus.c:1.33 src/sys/arch/amd64/amd64/mainbus.c:1.34 --- src/sys/arch/amd64/amd64/mainbus.c:1.33 Tue May 17 17:34:47 2011 +++ src/sys/arch/amd64/amd64/mainbus.c Wed Jul 31 14:05:33 2013 @@ -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 @@ mainbus_attach(device_t parent, device_t 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) Index: src/sys/arch/i386/i386/mainbus.c diff -u src/sys/arch/i386/i386/mainbus.c:1.96 src/sys/arch/i386/i386/mainbus.c:1.97 --- src/sys/arch/i386/i386/mainbus.c:1.96 Sun Sep 30 20:54:52 2012 +++ src/sys/arch/i386/i386/mainbus.c Wed Jul 31 14:05:33 2013 @@ -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 @@ mainbus_rescan(device_t self, const char 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, Index: src/sys/arch/x86/include/pci_machdep_common.h diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.11 src/sys/arch/x86/include/pci_machdep_common.h:1.12 --- src/sys/arch/x86/include/pci_machdep_common.h:1.11 Sun Dec 9 21:30:02 2012 +++ src/sys/arch/x86/include/pci_machdep_common.h Wed Jul 31 14:05:33 2013 @@ -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 @@ struct pci_chipset_tag { * 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); Index: src/sys/arch/x86/pci/pci_machdep.c diff -u src/sys/arch/x86/pci/pci_machdep.c:1.58 src/sys/arch/x86/pci/pci_machdep.c:1.59 --- src/sys/arch/x86/pci/pci_machdep.c:1.58 Mon Jul 22 13:40:36 2013 +++ src/sys/arch/x86/pci/pci_machdep.c Wed Jul 31 14:05:33 2013 @@ -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 @@ not2: 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)