summaryrefslogtreecommitdiffstats
path: root/sys/dev/aic7xxx
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2002-11-30 19:11:44 +0000
committerscottl <scottl@FreeBSD.org>2002-11-30 19:11:44 +0000
commitcb560e25f1b7c8fc8443365cbdb73181d2d19225 (patch)
tree10951021843daf3a949a9b8ef4db2d8dbbbd2843 /sys/dev/aic7xxx
parentaa27818a435a1a01752da6e579547433147abbb1 (diff)
downloadFreeBSD-src-cb560e25f1b7c8fc8443365cbdb73181d2d19225.zip
FreeBSD-src-cb560e25f1b7c8fc8443365cbdb73181d2d19225.tar.gz
Always compile in the AHC_ALLOW_MEMIO code, but only try MEMIO if
AHC_ALLOW_MEMIO is set, or the hint hint.ahc.N.allow_memio=1 is set in the bootloader. Make use of ah?_pci_test_register_access(). Approved by: re (blanket)
Diffstat (limited to 'sys/dev/aic7xxx')
-rw-r--r--sys/dev/aic7xxx/ahc_pci.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c
index 192e22e..3a9a24e 100644
--- a/sys/dev/aic7xxx/ahc_pci.c
+++ b/sys/dev/aic7xxx/ahc_pci.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_pci.c#9 $
+ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_pci.c#11 $
*
* $FreeBSD$
*/
@@ -145,13 +145,31 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
u_int command;
int regs_type;
int regs_id;
+ int allow_memio;
command = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
regs = NULL;
regs_type = 0;
regs_id = 0;
+
+ /* Retrieve the per-device 'allow_memio' hint */
+ if (resource_int_value(device_get_name(ahc->dev_softc),
+ device_get_unit(ahc->dev_softc),
+ "allow_memio", &allow_memio) != 0) {
+ if (bootverbose)
+ device_printf(ahc->dev_softc, "Defaulting to MEMIO ");
#ifdef AHC_ALLOW_MEMIO
- if ((command & PCIM_CMD_MEMEN) != 0) {
+ if (bootverbose)
+ printf("on\n");
+ allow_memio = 1;
+#else
+ if (bootverbose)
+ printf("off\n");
+ allow_memio = 0;
+#endif
+ }
+
+ if ((allow_memio != 0) && (command & PCIM_CMD_MEMEN) != 0) {
regs_type = SYS_RES_MEMORY;
regs_id = AHC_PCI_MEMADDR;
@@ -165,7 +183,7 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
* Do a quick test to see if memory mapped
* I/O is functioning correctly.
*/
- if (ahc_inb(ahc, HCNTRL) == 0xFF) {
+ if (ahc_pci_test_register_access(ahc) != 0) {
device_printf(ahc->dev_softc,
"PCI Device %d:%d:%d failed memory "
"mapped test. Using PIO.\n",
@@ -183,7 +201,7 @@ ahc_pci_map_registers(struct ahc_softc *ahc)
}
}
}
-#endif
+
if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) {
regs_type = SYS_RES_IOPORT;
regs_id = AHC_PCI_IOADDR;
OpenPOWER on IntegriCloud