summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2014-03-07 22:39:07 +0000
committerkettenis <kettenis@openbsd.org>2014-03-07 22:39:07 +0000
commit1d0a0664f742992abd345047059b3c729d661e47 (patch)
tree5f80ab198ab77a26a896e2051396db40753153be /sys/dev
parentReduce the number of ccbs by a factor three since we need up to three request (diff)
downloadwireguard-openbsd-1d0a0664f742992abd345047059b3c729d661e47.tar.xz
wireguard-openbsd-1d0a0664f742992abd345047059b3c729d661e47.zip
Make sure a SCSI initiator ID provided by Open Firmware overrides the value
read from nvram, just like we did for isp(4).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/qlw.c10
-rw-r--r--sys/dev/ic/qlwvar.h5
-rw-r--r--sys/dev/pci/qlw_pci.c7
3 files changed, 17 insertions, 5 deletions
diff --git a/sys/dev/ic/qlw.c b/sys/dev/ic/qlw.c
index ddf602a839f..ed76ab3895f 100644
--- a/sys/dev/ic/qlw.c
+++ b/sys/dev/ic/qlw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlw.c,v 1.3 2014/03/07 22:17:02 kettenis Exp $ */
+/* $OpenBSD: qlw.c,v 1.4 2014/03/07 22:39:07 kettenis Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -1432,7 +1432,9 @@ qlw_parse_nvram_1040(struct qlw_softc *sc, int bus)
KASSERT(bus == 0);
- sc->sc_initiator[0] = (nv->config1 >> 4);
+ if (!ISSET(sc->sc_flags, QLW_FLAG_INITIATOR))
+ sc->sc_initiator[0] = (nv->config1 >> 4);
+
sc->sc_retry_count[0] = nv->retry_count;
sc->sc_retry_delay[0] = nv->retry_delay;
sc->sc_reset_delay[0] = nv->reset_delay;
@@ -1459,7 +1461,9 @@ qlw_parse_nvram_1080(struct qlw_softc *sc, int bus)
struct qlw_nvram_bus *nv = &nvram->bus[bus];
int target;
- sc->sc_initiator[bus] = (nv->config1 & 0x0f);
+ if (!ISSET(sc->sc_flags, QLW_FLAG_INITIATOR))
+ sc->sc_initiator[bus] = (nv->config1 & 0x0f);
+
sc->sc_retry_count[bus] = nv->retry_count;
sc->sc_retry_delay[bus] = nv->retry_delay;
sc->sc_reset_delay[bus] = nv->reset_delay;
diff --git a/sys/dev/ic/qlwvar.h b/sys/dev/ic/qlwvar.h
index 1a306a64100..5a616f8cfe0 100644
--- a/sys/dev/ic/qlwvar.h
+++ b/sys/dev/ic/qlwvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlwvar.h,v 1.4 2014/03/07 22:17:03 kettenis Exp $ */
+/* $OpenBSD: qlwvar.h,v 1.5 2014/03/07 22:39:07 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -77,6 +77,9 @@ struct qlw_target {
struct qlw_softc {
struct device sc_dev;
+ int sc_flags;
+#define QLW_FLAG_INITIATOR 0x0001
+
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_size_t sc_ios;
diff --git a/sys/dev/pci/qlw_pci.c b/sys/dev/pci/qlw_pci.c
index a3afc83eca8..d5cbdf86b05 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.5 2014/03/07 12:45:49 kettenis Exp $ */
+/* $OpenBSD: qlw_pci.c,v 1.6 2014/03/07 22:39:08 kettenis Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -251,6 +251,11 @@ qlw_pci_attach(struct device *parent, struct device *self, void *aux)
while (node) {
if (OF_getprop(node, "scsi-initiator-id",
&initiator, sizeof(initiator)) == sizeof(initiator)) {
+ /*
+ * Override the SCSI initiator ID provided by
+ * the nvram.
+ */
+ sc->sc_flags |= QLW_FLAG_INITIATOR;
sc->sc_initiator[0] = sc->sc_initiator[1] = initiator;
break;
}