summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-04-22 02:36:29 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-04-22 02:36:29 +0000
commit359475550a15311cd16e2a0f31ffc172ea0ca6f5 (patch)
tree55f7460067a85c1127e13d94e0f6805e90fad359 /sys/dev
parenta58ae6c4545dff70e7d21f25585f9ed4bad78349 (diff)
Add support for the Adaptec RAID-On-Chip architecture. This in turn
provides support for the Adaptec 2130S and 2230SLP adapters. From FreeBSD ok dlg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/aac.c81
-rw-r--r--sys/dev/ic/aacreg.h17
-rw-r--r--sys/dev/ic/aacvar.h6
-rw-r--r--sys/dev/pci/aac_pci.c19
4 files changed, 117 insertions, 6 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index 3994250c7a6..cf56a969d9a 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac.c,v 1.29 2006/04/20 20:31:12 miod Exp $ */
+/* $OpenBSD: aac.c,v 1.30 2006/04/22 02:36:26 brad Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -199,6 +199,27 @@ struct aac_interface aac_rx_interface = {
aac_rx_set_interrupts
};
+/* Rocket/MIPS interface */
+int aac_rkt_get_fwstatus(struct aac_softc *);
+void aac_rkt_qnotify(struct aac_softc *, int);
+int aac_rkt_get_istatus(struct aac_softc *);
+void aac_rkt_clear_istatus(struct aac_softc *, int);
+void aac_rkt_set_mailbox(struct aac_softc *, u_int32_t,
+ u_int32_t, u_int32_t,
+ u_int32_t, u_int32_t);
+int aac_rkt_get_mailbox(struct aac_softc *, int);
+void aac_rkt_set_interrupts(struct aac_softc *, int);
+
+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
+};
+
#ifdef AAC_DEBUG
int aac_debug = AAC_DEBUG;
#endif
@@ -1670,6 +1691,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;
}
/*
@@ -2132,6 +2158,12 @@ aac_fa_get_fwstatus(struct aac_softc *sc)
return (AAC_GETREG4(sc, AAC_FA_FWSTATUS));
}
+int
+aac_rkt_get_fwstatus(struct aac_softc *sc)
+{
+ return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS));
+}
+
/*
* Notify the controller of a change in a given queue
*/
@@ -2155,6 +2187,12 @@ aac_fa_qnotify(struct aac_softc *sc, int qbit)
AAC_FA_HACK(sc);
}
+void
+aac_rkt_qnotify(struct aac_softc *sc, int qbit)
+{
+ AAC_SETREG4(sc, AAC_RKT_IDBR, qbit);
+}
+
/*
* Get the interrupt reason bits
*/
@@ -2176,6 +2214,12 @@ aac_fa_get_istatus(struct aac_softc *sc)
return (AAC_GETREG2(sc, AAC_FA_DOORBELL0));
}
+int
+aac_rkt_get_istatus(struct aac_softc *sc)
+{
+ return(AAC_GETREG4(sc, AAC_RKT_ODBR));
+}
+
/*
* Clear some interrupt reason bits
*/
@@ -2198,6 +2242,12 @@ aac_fa_clear_istatus(struct aac_softc *sc, int mask)
AAC_FA_HACK(sc);
}
+void
+aac_rkt_clear_istatus(struct aac_softc *sc, int mask)
+{
+ AAC_SETREG4(sc, AAC_RKT_ODBR, mask);
+}
+
/*
* Populate the mailbox and set the command word
*/
@@ -2239,6 +2289,17 @@ aac_fa_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0,
AAC_FA_HACK(sc);
}
+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)
+{
+ 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
*/
@@ -2260,6 +2321,12 @@ aac_fa_get_mailbox(struct aac_softc *sc, int mb)
return (AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4)));
}
+int
+aac_rkt_get_mailbox(struct aac_softc *sc, int mb)
+{
+ return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
+}
+
/*
* Set/clear interrupt masks
*/
@@ -2303,6 +2370,18 @@ aac_fa_set_interrupts(struct aac_softc *sc, int enable)
}
void
+aac_rkt_set_interrupts(struct aac_softc *sc, int enable)
+{
+ AAC_DPRINTF(AAC_D_INTR, ("%s: %sable interrupts",
+ sc->aac_dev.dv_xname, enable ? "en" : "dis"));
+
+ if (enable)
+ AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
+ else
+ AAC_SETREG4(sc, AAC_RKT_OIMR, ~0);
+}
+
+void
aac_eval_mapping(size, cyls, heads, secs)
u_int32_t size;
int *cyls, *heads, *secs;
diff --git a/sys/dev/ic/aacreg.h b/sys/dev/ic/aacreg.h
index 4557e1485e4..073b118885d 100644
--- a/sys/dev/ic/aacreg.h
+++ b/sys/dev/ic/aacreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aacreg.h,v 1.7 2005/11/18 05:39:10 nate Exp $ */
+/* $OpenBSD: aacreg.h,v 1.8 2006/04/22 02:36:26 brad Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -1343,6 +1343,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/ic/aacvar.h b/sys/dev/ic/aacvar.h
index 2be60aba46a..4a9dbf3c660 100644
--- a/sys/dev/ic/aacvar.h
+++ b/sys/dev/ic/aacvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aacvar.h,v 1.5 2005/11/18 05:39:10 nate Exp $ */
+/* $OpenBSD: aacvar.h,v 1.6 2006/04/22 02:36:26 brad Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -182,6 +182,7 @@ struct aac_interface {
extern struct aac_interface aac_fa_interface;
extern struct aac_interface aac_sa_interface;
extern struct aac_interface aac_rx_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) \
@@ -334,7 +335,8 @@ struct aac_softc
int aac_hwif; /* controller hardware interface */
#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
struct aac_common *aac_common;
diff --git a/sys/dev/pci/aac_pci.c b/sys/dev/pci/aac_pci.c
index 51a793886ba..82426428090 100644
--- a/sys/dev/pci/aac_pci.c
+++ b/sys/dev/pci/aac_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac_pci.c,v 1.17 2005/11/21 20:11:47 deraadt Exp $ */
+/* $OpenBSD: aac_pci.c,v 1.18 2006/04/22 02:36:28 brad Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -68,6 +68,8 @@ void aac_pci_attach(struct device *, struct device *, void *);
#define PCI_PRODUCT_ADP2_AACASR2200S 0x0285
#define PCI_PRODUCT_ADP2_AACASR2120S 0x0286
#define PCI_PRODUCT_ADP2_AACADPSATA2C 0x0289
+#define PCI_PRODUCT_ADP2_AACASR2230S 0x028c
+#define PCI_PRODUCT_ADP2_AACASR2130S 0x028d
#define PCI_PRODUCT_ADP2_AACADPSATA4C 0x0290
#define PCI_PRODUCT_ADP2_AACADPSATA6C 0x0291
#define PCI_PRODUCT_ADP2_AACADPSATA8C 0x0292
@@ -83,6 +85,8 @@ struct aac_sub_ident {
char *desc;
} aac_sub_identifiers[] = {
{ PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACADPSATA2C, "Adaptec 1210SA" }, /* guess */
+ { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACASR2130S, "Adaptec 2130S" },
+ { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACASR2230S, "Adaptec 2230S" },
{ PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACADPSATA4C, "Adaptec 2410SA" },
{ PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACADPSATA6C, "Adaptec 2610SA" },
{ PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACADPSATA8C, "Adaptec 2810SA" }, /* guess */
@@ -168,6 +172,10 @@ struct aac_ident {
PCI_PRODUCT_ADP2_ASR2120S, AAC_HWIF_I960RX },
{ PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_ASR2200S, PCI_VENDOR_ADP2,
PCI_PRODUCT_ADP2_ASR2200S, AAC_HWIF_I960RX },
+ { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACASR2120S, PCI_VENDOR_ADP2,
+ PCI_PRODUCT_ADP2_AACASR2130S, AAC_HWIF_RKT },
+ { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AACASR2120S, PCI_VENDOR_ADP2,
+ PCI_PRODUCT_ADP2_AACASR2230S, AAC_HWIF_RKT },
{ 0, 0, 0, 0 }
};
@@ -289,7 +297,6 @@ aac_pci_attach(parent, self, aux)
("set hardware up for i960Rx"));
sc->aac_if = aac_rx_interface;
break;
-
case AAC_HWIF_STRONGARM:
AAC_DPRINTF(AAC_D_MISC,
("set hardware up for StrongARM"));
@@ -300,6 +307,14 @@ aac_pci_attach(parent, self, aux)
("set hardware up for Falcon/PPC"));
sc->aac_if = aac_fa_interface;
break;
+ case AAC_HWIF_RKT:
+ AAC_DPRINTF(AAC_D_MISC,
+ ("set hardware up for Rocket/MIPS"));
+ sc->aac_if = aac_rkt_interface;
+ break;
+ default:
+ sc->aac_hwif = AAC_HWIF_UNKNOWN;
+ break;
}
break;
}