Module Name:    src
Committed By:   mrg
Date:           Wed Dec 23 00:11:36 UTC 2009

Modified Files:
        src/sys/dev/pci: viaide.c

Log Message:
enable mem space if it isn't already enabled.  several bioses leave
this not enabled, and viaide kind of depends upon it.

fixes viaide(4) on several machines.

idea from PR 38011, but reworked a little.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/viaide.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/dev/pci/viaide.c
diff -u src/sys/dev/pci/viaide.c:1.65 src/sys/dev/pci/viaide.c:1.66
--- src/sys/dev/pci/viaide.c:1.65	Tue Dec 22 16:32:41 2009
+++ src/sys/dev/pci/viaide.c	Wed Dec 23 00:11:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: viaide.c,v 1.65 2009/12/22 16:32:41 tsutsui Exp $	*/
+/*	$NetBSD: viaide.c,v 1.66 2009/12/23 00:11:36 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.65 2009/12/22 16:32:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.66 2009/12/23 00:11:36 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -851,6 +851,18 @@
 	pciide_mapreg_dma(sc, pa);
 	aprint_verbose("\n");
 
+	/*
+	 * Enable memory-space access if it isn't already there.
+	 */
+	if (pa->pa_memt && (pa->pa_flags & PCI_FLAGS_MEM_ENABLED) == 0) {
+		pcireg_t csr;
+
+		pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;
+		csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+		               csr | PCI_COMMAND_MEM_ENABLE);
+	}
+
 	if (sc->sc_dma_ok) {
 		sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA;
 		sc->sc_wdcdev.irqack = pciide_irqack;

Reply via email to