diff options
-rw-r--r-- | sys/dev/aac/aac.c | 91 | ||||
-rw-r--r-- | sys/dev/aac/aac_pci.c | 11 | ||||
-rw-r--r-- | sys/dev/aac/aacreg.h | 15 | ||||
-rw-r--r-- | sys/dev/aac/aacvar.h | 4 |
4 files changed, 118 insertions, 3 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 60d4f1c..335359c 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -161,6 +161,27 @@ struct aac_interface aac_rx_interface = { aac_rx_set_interrupts }; +/* Rocket/MIPS interface */ +static int aac_rkt_get_fwstatus(struct aac_softc *sc); +static void aac_rkt_qnotify(struct aac_softc *sc, int qbit); +static int aac_rkt_get_istatus(struct aac_softc *sc); +static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask); +static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, + u_int32_t arg0, u_int32_t arg1, + u_int32_t arg2, u_int32_t arg3); +static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb); +static void aac_rkt_set_interrupts(struct aac_softc *sc, int enable); + +struct aac_interface aac_rkt_interface = { + aac_rkt_get_fwstatus, + aac_rkt_qnotify, + aac_rkt_get_istatus, + aac_rkt_clear_istatus, + aac_rkt_set_mailbox, + aac_rkt_get_mailbox, + aac_rkt_set_interrupts +}; + /* Debugging and Diagnostics */ static void aac_describe_controller(struct aac_softc *sc); static char *aac_describe_code(struct aac_code_lookup *table, @@ -1634,6 +1655,11 @@ aac_init(struct aac_softc *sc) case AAC_HWIF_I960RX: AAC_SETREG4(sc, AAC_RX_ODBR, ~0); break; + case AAC_HWIF_RKT: + AAC_SETREG4(sc, AAC_RKT_ODBR, ~0); + break; + default: + break; } /* @@ -2020,6 +2046,14 @@ aac_fa_get_fwstatus(struct aac_softc *sc) return (val); } +static int +aac_rkt_get_fwstatus(struct aac_softc *sc) +{ + debug_called(3); + + return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS)); +} + /* * Notify the controller of a change in a given queue */ @@ -2049,6 +2083,14 @@ aac_fa_qnotify(struct aac_softc *sc, int qbit) AAC_FA_HACK(sc); } +static void +aac_rkt_qnotify(struct aac_softc *sc, int qbit) +{ + debug_called(3); + + AAC_SETREG4(sc, AAC_RKT_IDBR, qbit); +} + /* * Get the interrupt reason bits */ @@ -2079,6 +2121,14 @@ aac_fa_get_istatus(struct aac_softc *sc) return (val); } +static int +aac_rkt_get_istatus(struct aac_softc *sc) +{ + debug_called(3); + + return(AAC_GETREG4(sc, AAC_RKT_ODBR)); +} + /* * Clear some interrupt reason bits */ @@ -2107,6 +2157,14 @@ aac_fa_clear_istatus(struct aac_softc *sc, int mask) AAC_FA_HACK(sc); } +static void +aac_rkt_clear_istatus(struct aac_softc *sc, int mask) +{ + debug_called(3); + + AAC_SETREG4(sc, AAC_RKT_ODBR, mask); +} + /* * Populate the mailbox and set the command word */ @@ -2154,6 +2212,19 @@ aac_fa_set_mailbox(struct aac_softc *sc, u_int32_t command, AAC_FA_HACK(sc); } +static void +aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0, + u_int32_t arg1, u_int32_t arg2, u_int32_t arg3) +{ + debug_called(4); + + AAC_SETREG4(sc, AAC_RKT_MAILBOX, command); + AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0); + AAC_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1); + AAC_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2); + AAC_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3); +} + /* * Fetch the immediate command status word */ @@ -2184,6 +2255,14 @@ aac_fa_get_mailbox(struct aac_softc *sc, int mb) return (val); } +static int +aac_rkt_get_mailbox(struct aac_softc *sc, int mb) +{ + debug_called(4); + + return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4))); +} + /* * Set/clear interrupt masks */ @@ -2225,6 +2304,18 @@ aac_fa_set_interrupts(struct aac_softc *sc, int enable) } } +static void +aac_rkt_set_interrupts(struct aac_softc *sc, int enable) +{ + debug(2, "%sable interrupts", enable ? "en" : "dis"); + + if (enable) { + AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS); + } else { + AAC_SETREG4(sc, AAC_RKT_OIMR, ~0); + } +} + /* * Debugging and Diagnostics */ diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index aebeeb6..582d0ef 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -132,6 +132,8 @@ struct aac_ident "Dell CERC SATA RAID 2"}, {0x9005, 0x0285, 0x9005, 0x0292, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB, "Adaptec SCSI RAID 2810SA"}, + {0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0, + "Adaptec SCSI RAID 2130S"}, {0, 0, 0, 0, 0, 0, 0} }; @@ -265,7 +267,6 @@ aac_pci_attach(device_t dev) * Detect the hardware interface version, set up the bus interface * indirection. */ - sc->aac_hwif = AAC_HWIF_UNKNOWN; for (i = 0; aac_identifiers[i].vendor != 0; i++) { if ((aac_identifiers[i].vendor == pci_get_vendor(dev)) && (aac_identifiers[i].device == pci_get_device(dev)) && @@ -277,7 +278,6 @@ aac_pci_attach(device_t dev) debug(2, "set hardware up for i960Rx"); sc->aac_if = aac_rx_interface; break; - case AAC_HWIF_STRONGARM: debug(2, "set hardware up for StrongARM"); sc->aac_if = aac_sa_interface; @@ -286,6 +286,13 @@ aac_pci_attach(device_t dev) debug(2, "set hardware up for Falcon/PPC"); sc->aac_if = aac_fa_interface; break; + case AAC_HWIF_RKT: + debug(2, "setu hardware up for Rocket/MIPS"); + sc->aac_if = aac_rkt_interface; + break; + default: + sc->aac_hwif = AAC_HWIF_UNKNOWN; + break; } /* Set up quirks */ diff --git a/sys/dev/aac/aacreg.h b/sys/dev/aac/aacreg.h index fe54487..426601b 100644 --- a/sys/dev/aac/aacreg.h +++ b/sys/dev/aac/aacreg.h @@ -1337,6 +1337,21 @@ enum { #define AAC_RX_FWSTATUS 0x6c /* + * Register definitions for the Adaptec 'Rocket' RAID-On-Chip adapters. + * Unsurprisingly, it's quite similar to the i960! + */ + +#define AAC_RKT_IDBR 0x20 /* inbound doorbell register */ +#define AAC_RKT_IISR 0x24 /* inbound interrupt status register */ +#define AAC_RKT_IIMR 0x28 /* inbound interrupt mask register */ +#define AAC_RKT_ODBR 0x2c /* outbound doorbell register */ +#define AAC_RKT_OISR 0x30 /* outbound interrupt status register */ +#define AAC_RKT_OIMR 0x34 /* outbound interrupt mask register */ + +#define AAC_RKT_MAILBOX 0x1000 /* mailbox */ +#define AAC_RKT_FWSTATUS 0x101c /* Firmware Status (mailbox 7) */ + +/* * Common bit definitions for the doorbell registers. */ diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index 8b7c4cd..87e3c9c 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -232,6 +232,7 @@ struct aac_interface extern struct aac_interface aac_rx_interface; extern struct aac_interface aac_sa_interface; extern struct aac_interface aac_fa_interface; +extern struct aac_interface aac_rkt_interface; #define AAC_GET_FWSTATUS(sc) ((sc)->aac_if.aif_get_fwstatus((sc))) #define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if.aif_qnotify((sc), (qbit))) @@ -293,7 +294,8 @@ struct aac_softc int aac_hwif; #define AAC_HWIF_I960RX 0 #define AAC_HWIF_STRONGARM 1 -#define AAC_HWIF_FALCON 2 +#define AAC_HWIF_FALCON 2 +#define AAC_HWIF_RKT 3 #define AAC_HWIF_UNKNOWN -1 bus_dma_tag_t aac_common_dmat; /* common structure * DMA tag */ |