diff options
| author | Scott Long <scottl@FreeBSD.org> | 2002-11-30 19:11:44 +0000 |
|---|---|---|
| committer | Scott Long <scottl@FreeBSD.org> | 2002-11-30 19:11:44 +0000 |
| commit | 24dd01c6957d014b68883bae027f2f5cae33228d (patch) | |
| tree | 10951021843daf3a949a9b8ef4db2d8dbbbd2843 /sys | |
| parent | a3a33a2bcbaf9e0373a74c7c02f56027f165ada3 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/aic7xxx/ahc_pci.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c index 192e22ea5d20..3a9a24e323db 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; |
