diff options
author | luoqi <luoqi@FreeBSD.org> | 2002-03-15 21:30:41 +0000 |
---|---|---|
committer | luoqi <luoqi@FreeBSD.org> | 2002-03-15 21:30:41 +0000 |
commit | 01796e3f815d0752dae6e725256ca893398be9d5 (patch) | |
tree | 5c02e3f0d606c80fe9442f7684d2c800a55ab51b /sys | |
parent | 85d610d6a16113794e9e4b9345e80187e84e059d (diff) | |
download | FreeBSD-src-01796e3f815d0752dae6e725256ca893398be9d5.zip FreeBSD-src-01796e3f815d0752dae6e725256ca893398be9d5.tar.gz |
Support for LG GM82C700, an AIC6360 clone.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/aic/aic.c | 43 | ||||
-rw-r--r-- | sys/dev/aic/aic6360reg.h | 4 | ||||
-rw-r--r-- | sys/dev/aic/aicvar.h | 3 |
3 files changed, 39 insertions, 11 deletions
diff --git a/sys/dev/aic/aic.c b/sys/dev/aic/aic.c index 94529a1..9b60cf8 100644 --- a/sys/dev/aic/aic.c +++ b/sys/dev/aic/aic.c @@ -1403,12 +1403,26 @@ aic_reset(struct aic_softc *aic, int initiate_reset) aic_outb(aic, DMACNTRL0, INTEN); } +static char *aic_chip_names[] = { + "AIC6260", "AIC6360", "AIC6370", "GM82C700", +}; + +static struct { + int type; + char *idstring; +} aic_chip_ids[] = { + { AIC6360, IDSTRING_AIC6360 }, + { AIC6370, IDSTRING_AIC6370 }, + { GM82C700, IDSTRING_GM82C700 }, +}; + static void aic_init(struct aic_softc *aic) { struct aic_scb *scb; struct aic_tinfo *ti; u_int8_t porta, portb; + char chip_id[33]; int i; TAILQ_INIT(&aic->pending_ccbs); @@ -1421,6 +1435,17 @@ aic_init(struct aic_softc *aic) aic_chip_reset(aic); aic_scsi_reset(aic); + /* determine the chip type from its ID string */ + aic->chip_type = AIC6260; + aic_insb(aic, ID, chip_id, sizeof(chip_id) - 1); + chip_id[sizeof(chip_id) - 1] = '\0'; + for (i = 0; i < sizeof(aic_chip_ids) / sizeof(aic_chip_ids[0]); i++) { + if (!strcmp(chip_id, aic_chip_ids[i].idstring)) { + aic->chip_type = aic_chip_ids[i].type; + break; + } + } + porta = aic_inb(aic, PORTA); portb = aic_inb(aic, PORTB); @@ -1437,17 +1462,16 @@ aic_init(struct aic_softc *aic) * is set and we've got a 6360. The 6260 can only do standard * 5MHz SCSI. */ - if (aic_inb(aic, REV)) { - if (PORTB_FSYNC(portb)) { - aic->max_period = AIC_FAST_SYNC_PERIOD; + if (aic->chip_type > AIC6260 || aic_inb(aic, REV)) { + if (PORTB_FSYNC(portb)) aic->flags |= AIC_FAST_ENABLE; - } else - aic->max_period = AIC_SYNC_PERIOD; - aic->flags |= AIC_DWIO_ENABLE; - } else - aic->max_period = AIC_SYNC_PERIOD; + } + if (aic->flags & AIC_FAST_ENABLE) + aic->max_period = AIC_FAST_SYNC_PERIOD; + else + aic->max_period = AIC_SYNC_PERIOD; aic->min_period = AIC_MIN_SYNC_PERIOD; free_scbs = NULL; @@ -1533,8 +1557,7 @@ aic_attach(struct aic_softc *aic) aic_init(aic); - printf("aic%d: %s", aic->unit, - aic_inb(aic, REV) > 0 ? "aic6360" : "aic6260"); + printf("aic%d: %s", aic->unit, aic_chip_names[aic->chip_type]); if (aic->flags & AIC_DMA_ENABLE) printf(", dma"); if (aic->flags & AIC_DISC_ENABLE) diff --git a/sys/dev/aic/aic6360reg.h b/sys/dev/aic/aic6360reg.h index 7e14f14..d08a665 100644 --- a/sys/dev/aic/aic6360reg.h +++ b/sys/dev/aic/aic6360reg.h @@ -72,7 +72,9 @@ #define TEST 0x1e /* Test register */ #define ID 0x1f /* ID register */ -#define IDSTRING "(C)1991ADAPTECAIC6360 " +#define IDSTRING_AIC6360 "(C)1991ADAPTECAIC6360 " +#define IDSTRING_AIC6370 "(C)1994ADAPTECAIC6370" +#define IDSTRING_GM82C700 "(C)1993 GoldStarGM82C700 " /* What all the bits do */ diff --git a/sys/dev/aic/aicvar.h b/sys/dev/aic/aicvar.h index d86e49f..cddb027 100644 --- a/sys/dev/aic/aicvar.h +++ b/sys/dev/aic/aicvar.h @@ -66,6 +66,8 @@ struct aic_scb { #define SCB_DEVICE_RESET 0x04 #define SCB_SENSE 0x08 +enum { AIC6260, AIC6360, AIC6370, GM82C700 }; + struct aic_softc { int unit; bus_space_tag_t tag; @@ -94,6 +96,7 @@ struct aic_softc { int min_period; int max_period; + int chip_type; }; #define AIC_DISC_ENABLE 0x01 |