diff options
author | gibbs <gibbs@FreeBSD.org> | 1999-03-08 21:36:34 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1999-03-08 21:36:34 +0000 |
commit | 984e3d8eedde15696cfb925871e51b12fed6b6d7 (patch) | |
tree | a387b9e77539955c4810af11039cbfac4fa9c034 /sys/dev/buslogic/bt.c | |
parent | 69aac6dea774fbf086c764ba5f0ffde13fede841 (diff) | |
download | FreeBSD-src-984e3d8eedde15696cfb925871e51b12fed6b6d7.zip FreeBSD-src-984e3d8eedde15696cfb925871e51b12fed6b6d7.tar.gz |
Add bt_port_probe() a routine shared by the EISA and ISA probe code to
determine IRQ and DRQ information.
Fix a bug that would cause us to attempt to retrieve extended sync
rate information on cards/firmware revs that do not support that command.
Diffstat (limited to 'sys/dev/buslogic/bt.c')
-rw-r--r-- | sys/dev/buslogic/bt.c | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/sys/dev/buslogic/bt.c b/sys/dev/buslogic/bt.c index 33ca81f..bafa819 100644 --- a/sys/dev/buslogic/bt.c +++ b/sys/dev/buslogic/bt.c @@ -5,7 +5,7 @@ * i386/eisa/bt_eisa.c BT-74x, BT-75x cards * pci/bt_pci.c BT-946, BT-948, BT-956, BT-958 cards * - * Copyright (c) 1998 Justin T. Gibbs. + * Copyright (c) 1998, 1999 Justin T. Gibbs. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bt.c,v 1.12 1998/12/04 22:54:44 archie Exp $ + * $Id: bt.c,v 1.13 1998/12/11 03:50:35 gibbs Exp $ */ /* @@ -296,6 +296,67 @@ bt_free(struct bt_softc *bt) free(bt, M_DEVBUF); } +int +bt_port_probe(struct bt_softc *bt, struct bt_probe_info *info) +{ + config_data_t config_data; + int error; + + /* See if there is really a card present */ + if (bt_probe(bt) || bt_fetch_adapter_info(bt)) + return(1); + + /* + * Determine our IRQ, and DMA settings and + * export them to the configuration system. + */ + error = bt_cmd(bt, BOP_INQUIRE_CONFIG, NULL, /*parmlen*/0, + (u_int8_t*)&config_data, sizeof(config_data), + DEFAULT_CMD_TIMEOUT); + if (error != 0) { + printf("bt_port_probe: Could not determine IRQ or DMA " + "settings for adapter.\n"); + return (1); + } + + if (bt->model[0] == '5') { + /* DMA settings only make sense for ISA cards */ + switch (config_data.dma_chan) { + case DMA_CHAN_5: + info->drq = 5; + break; + case DMA_CHAN_6: + info->drq = 6; + break; + case DMA_CHAN_7: + info->drq = 7; + break; + default: + printf("bt_port_probe: Invalid DMA setting " + "detected for adapter.\n"); + return (1); + } + } else { + /* VL/EISA/PCI DMA */ + info->drq = -1; + } + switch (config_data.irq) { + case IRQ_9: + case IRQ_10: + case IRQ_11: + case IRQ_12: + case IRQ_14: + case IRQ_15: + info->irq = ffs(config_data.irq) + 8; + break; + default: + printf("bt_port_probe: Invalid IRQ setting %x" + "detected for adapter.\n", config_data.irq); + return (1); + } + return (0); +} + /* * Probe the adapter and verify that the card is a BusLogic. */ @@ -479,6 +540,8 @@ bt_fetch_adapter_info(struct bt_softc *bt) bt->model[i] = '\0'; } + bt->level_trigger_ints = esetup_info.level_trigger_ints ? 1 : 0; + /* SG element limits */ bt->max_sg = esetup_info.max_sg; @@ -2082,7 +2145,7 @@ btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings* cts) cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT; } - if (bt->firmware_ver[0] >= 3) { + if (bt->firmware_ver[0] >= '3') { /* * For adapters that can do fast or ultra speeds, * use the more exact Target Sync Information command. |