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.
This commit is contained in:
Justin T. Gibbs 1999-03-08 21:36:34 +00:00
parent e01902feb4
commit 49529072c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44581
2 changed files with 87 additions and 15 deletions

View File

@ -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.

View File

@ -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);