summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-03-15 13:08:53 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-03-15 13:08:53 +0000
commitc21f43c2774fc089e91ae1bb2e11ece956417b7c (patch)
tree947df3abca9b78262cb55d2b2e9d4365ca0c78b6 /sys/dev
parent5812f75c6c47c929c934283ecea3828bb21236d9 (diff)
More ISP1000 (SBus) bits.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/qlw.c32
-rw-r--r--sys/dev/ic/qlwreg.h23
-rw-r--r--sys/dev/ic/qlwvar.h10
-rw-r--r--sys/dev/pci/qlw_pci.c7
4 files changed, 54 insertions, 18 deletions
diff --git a/sys/dev/ic/qlw.c b/sys/dev/ic/qlw.c
index be14288375d..35d5eabd78c 100644
--- a/sys/dev/ic/qlw.c
+++ b/sys/dev/ic/qlw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlw.c,v 1.15 2014/03/15 12:28:47 kettenis Exp $ */
+/* $OpenBSD: qlw.c,v 1.16 2014/03/15 13:08:52 kettenis Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -123,8 +123,17 @@ qlw_xs_bus(struct qlw_softc *sc, struct scsi_xfer *xs)
return ((xs->sc_link->scsibus == sc->sc_link[0].scsibus) ? 0 : 1);
}
-#define qlw_queue_read(_sc, _r) qlw_read((_sc), (_r))
-#define qlw_queue_write(_sc, _r, _v) qlw_write((_sc), (_r), (_v))
+static inline u_int16_t
+qlw_queue_read(struct qlw_softc *sc, bus_size_t offset)
+{
+ return qlw_read(sc, sc->sc_mbox_base + offset);
+}
+
+static inline void
+qlw_queue_write(struct qlw_softc *sc, bus_size_t offset, u_int16_t value)
+{
+ qlw_write(sc, sc->sc_mbox_base + offset, value);
+}
struct scsi_adapter qlw_switch = {
qlw_scsi_cmd,
@@ -145,6 +154,9 @@ qlw_attach(struct qlw_softc *sc)
task_set(&sc->sc_update_task, qlw_update_task, sc, NULL);
switch (sc->sc_isp_gen) {
+ case QLW_GEN_ISP1000:
+ sc->sc_nvram_size = 0;
+ break;
case QLW_GEN_ISP1040:
sc->sc_nvram_size = 128;
sc->sc_nvram_minversion = 2;
@@ -940,19 +952,19 @@ u_int16_t
qlw_read_mbox(struct qlw_softc *sc, int mbox)
{
/* could range-check mboxes according to chip type? */
- return (qlw_read(sc, QLW_MBOX_BASE + (mbox * 2)));
+ return (qlw_read(sc, sc->sc_mbox_base + (mbox * 2)));
}
void
qlw_write_mbox(struct qlw_softc *sc, int mbox, u_int16_t value)
{
- qlw_write(sc, QLW_MBOX_BASE + (mbox * 2), value);
+ qlw_write(sc, sc->sc_mbox_base + (mbox * 2), value);
}
void
qlw_host_cmd(struct qlw_softc *sc, u_int16_t cmd)
{
- qlw_write(sc, QLW_HOST_CMD_CTRL, cmd << QLW_HOST_CMD_SHIFT);
+ qlw_write(sc, sc->sc_host_cmd_ctrl, cmd << QLW_HOST_CMD_SHIFT);
}
#define MBOX_COMMAND_TIMEOUT 4000
@@ -1131,7 +1143,8 @@ qlw_softreset(struct qlw_softc *sc)
void
qlw_dma_burst_enable(struct qlw_softc *sc)
{
- if (sc->sc_isp_gen == QLW_GEN_ISP1040) {
+ if (sc->sc_isp_gen == QLW_GEN_ISP1000 ||
+ sc->sc_isp_gen == QLW_GEN_ISP1040) {
qlw_write(sc, QLW_CDMA_CFG,
qlw_read(sc, QLW_CDMA_CFG) | QLW_DMA_BURST_ENABLE);
qlw_write(sc, QLW_DDMA_CFG,
@@ -1384,6 +1397,9 @@ qlw_read_nvram(struct qlw_softc *sc)
int reqcmd;
int nbits;
+ if (sc->sc_nvram_size == 0)
+ return (1);
+
if (sc->sc_nvram_size == 128) {
reqcmd = (QLW_NVRAM_CMD_READ << 6);
nbits = 8;
@@ -1532,6 +1548,8 @@ qlw_init_defaults(struct qlw_softc *sc, int bus)
int target;
switch (sc->sc_isp_gen) {
+ case QLW_GEN_ISP1000:
+ break;
case QLW_GEN_ISP1040:
sc->sc_isp_config = QLW_BURST_ENABLE | QLW_PCI_FIFO_64;
break;
diff --git a/sys/dev/ic/qlwreg.h b/sys/dev/ic/qlwreg.h
index 07d78c0ff0d..b3602dbb139 100644
--- a/sys/dev/ic/qlwreg.h
+++ b/sys/dev/ic/qlwreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlwreg.h,v 1.5 2014/03/15 12:28:47 kettenis Exp $ */
+/* $OpenBSD: qlwreg.h,v 1.6 2014/03/15 13:08:52 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -37,17 +37,20 @@
#define QLW_FLASH_BIOS_ADDR 0x12
#define QLW_CDMA_CFG 0x20
#define QLW_DDMA_CFG 0x40
-#define QLW_MBOX_BASE 0x70
+#define QLW_MBOX_BASE_PCI 0x70
+#define QLW_MBOX_BASE_SBUS 0x80
#define QLW_CDMA_CFG_1080 0x80
#define QLW_DDMA_CFG_1080 0xa0
-#define QLW_HOST_CMD_CTRL 0xc0
+#define QLW_HOST_CMD_CTRL_PCI 0xc0
#define QLW_GPIO_DATA 0xcc
#define QLW_GPIO_ENABLE 0xce
-#define QLW_REQ_IN QLW_MBOX_BASE + 0x8
-#define QLW_REQ_OUT QLW_MBOX_BASE + 0x8
-#define QLW_RESP_IN QLW_MBOX_BASE + 0xa
-#define QLW_RESP_OUT QLW_MBOX_BASE + 0xa
+#define QLW_HOST_CMD_CTRL_SBUS 0x440
+
+#define QLW_REQ_IN 0x08
+#define QLW_REQ_OUT 0x08
+#define QLW_RESP_IN 0x0a
+#define QLW_RESP_OUT 0x0a
/* QLW_CFG1 */
#define QLW_BURST_ENABLE 0x0004
@@ -56,6 +59,12 @@
#define QLW_PCI_FIFO_64 0x0030
#define QLW_PCI_FIFO_128 0x0040
#define QLW_PCI_FIFO_MASK 0x0070
+#define QLW_SBUS_FIFO_64 0x0003
+#define QLW_SBUS_FIFO_32 0x0002
+#define QLW_SBUS_FIFO_16 0x0001
+#define QLW_SBUS_FIFO_8 0x0000
+#define QLW_SBUS_FIFO_MASK 0x0003
+#define QLW_SBUS_BURST_8 0x0008
#define QLW_DMA_BANK 0x0300
/* QLW_INT_CTRL */
diff --git a/sys/dev/ic/qlwvar.h b/sys/dev/ic/qlwvar.h
index beefc58ba9d..6c6c3aab21a 100644
--- a/sys/dev/ic/qlwvar.h
+++ b/sys/dev/ic/qlwvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlwvar.h,v 1.9 2014/03/13 10:31:53 kettenis Exp $ */
+/* $OpenBSD: qlwvar.h,v 1.10 2014/03/15 13:08:52 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -28,13 +28,15 @@
struct qlw_softc;
enum qlw_isp_gen {
- QLW_GEN_ISP1040 = 1,
+ QLW_GEN_ISP1000 = 1,
+ QLW_GEN_ISP1040,
QLW_GEN_ISP1080,
QLW_GEN_ISP12160,
};
enum qlw_isp_type {
- QLW_ISP1020 = 1,
+ QLW_ISP1000 = 1,
+ QLW_ISP1020,
QLW_ISP1020A,
QLW_ISP1040,
QLW_ISP1040A,
@@ -101,6 +103,8 @@ struct qlw_softc {
int sc_numbusses;
int sc_clock;
+ int sc_host_cmd_ctrl;
+ int sc_mbox_base;
u_int16_t sc_mbox[8];
int sc_mbox_pending;
diff --git a/sys/dev/pci/qlw_pci.c b/sys/dev/pci/qlw_pci.c
index ab7fad86781..ef15e7c81df 100644
--- a/sys/dev/pci/qlw_pci.c
+++ b/sys/dev/pci/qlw_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlw_pci.c,v 1.8 2014/03/09 20:23:43 kettenis Exp $ */
+/* $OpenBSD: qlw_pci.c,v 1.9 2014/03/15 13:08:52 kettenis Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -249,6 +249,8 @@ qlw_pci_attach(struct device *parent, struct device *self, void *aux)
case QLW_GEN_ISP12160:
sc->sc_firmware = isp_12160_risc_code;
break;
+ default:
+ break;
}
#endif
@@ -285,6 +287,9 @@ qlw_pci_attach(struct device *parent, struct device *self, void *aux)
}
#endif
+ sc->sc_host_cmd_ctrl = QLW_HOST_CMD_CTRL_PCI;
+ sc->sc_mbox_base = QLW_MBOX_BASE_PCI;
+
if (qlw_attach(sc) != 0) {
/* error printed by qlw_attach */
goto deintr;