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 | |
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')
-rw-r--r-- | sys/dev/buslogic/bt.c | 69 | ||||
-rw-r--r-- | sys/dev/buslogic/btreg.h | 33 |
2 files changed, 87 insertions, 15 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. diff --git a/sys/dev/buslogic/btreg.h b/sys/dev/buslogic/btreg.h index fa049bc..fd16f5c 100644 --- a/sys/dev/buslogic/btreg.h +++ b/sys/dev/buslogic/btreg.h @@ -6,7 +6,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 @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: btreg.h,v 1.2 1998/10/30 02:06:44 gibbs Exp $ + * $Id: btreg.h,v 1.3 1998/11/10 06:44:50 gibbs Exp $ */ #ifndef _BTREG_H_ @@ -504,6 +504,12 @@ typedef struct bt_mbox_in { u_int8_t comp_code; } bt_mbox_in_t; +/***************** Compiled Probe Information *******************************/ +struct bt_probe_info { + int drq; + int irq; +}; + /****************** Hardware CCB definition *********************************/ typedef enum { INITIATOR_CCB = 0x00, @@ -628,16 +634,17 @@ struct bt_softc { u_int max_sg; u_int unit; u_int scsi_id; - u_int32_t extended_trans :1, - wide_bus :1, - diff_bus :1, - ultra_scsi :1, - extended_lun :1, - strict_rr :1, - tag_capable :1, - wide_lun_ccb :1, - resource_shortage:1, - :23; + u_int32_t extended_trans :1, + wide_bus :1, + diff_bus :1, + ultra_scsi :1, + extended_lun :1, + strict_rr :1, + tag_capable :1, + wide_lun_ccb :1, + resource_shortage :1, + level_trigger_ints:1, + :22; u_int16_t tags_permitted; u_int16_t disc_permitted; u_int16_t sync_permitted; @@ -659,6 +666,8 @@ extern u_long bt_unit; struct bt_softc* bt_alloc(int unit, bus_space_tag_t tag, bus_space_handle_t bsh); void bt_free(struct bt_softc *bt); +int bt_port_probe(struct bt_softc *bt, + struct bt_probe_info *info); int bt_probe(struct bt_softc *bt); int bt_fetch_adapter_info(struct bt_softc *bt); int bt_init(struct bt_softc *bt); |