summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-06-01 15:49:26 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-06-01 15:49:26 +0000
commite36e9b532a339d0c6ec3ad4de0ce9f8b080d240c (patch)
tree39fa2dd6d7f107d6d9571f55bdda5557d86b012e /sys/dev
parentea2b13562c5d2ee5ccf734f7ce9336d4bf9a5bd1 (diff)
Make SCSI isp(4) use the same SCSI initiator ID as the prom on sparc/sparc64.
ok marco@, krw@, deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/isp_openbsd.h5
-rw-r--r--sys/dev/pci/isp_pci.c24
-rw-r--r--sys/dev/sbus/isp_sbus.c5
3 files changed, 29 insertions, 5 deletions
diff --git a/sys/dev/ic/isp_openbsd.h b/sys/dev/ic/isp_openbsd.h
index f08f1a95968..719f1ca600c 100644
--- a/sys/dev/ic/isp_openbsd.h
+++ b/sys/dev/ic/isp_openbsd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_openbsd.h,v 1.27 2008/01/21 20:00:33 sobrado Exp $ */
+/* $OpenBSD: isp_openbsd.h,v 1.28 2008/06/01 15:49:25 kettenis Exp $ */
/*
* OpenBSD Specific definitions for the QLogic ISP Host Adapter
*/
@@ -89,6 +89,7 @@ struct isposinfo {
rtpend : 1,
no_mbox_ints : 1,
blocked : 2;
+ int _iid;
union {
u_int64_t _wwn;
u_int16_t _discovered[2];
@@ -246,7 +247,7 @@ default: \
#define XS_SET_STATE_STAT(a, b, c)
-#define DEFAULT_IID(x) 7
+#define DEFAULT_IID(isp) (isp)->isp_osinfo._iid
#define DEFAULT_LOOPID(x) 107
#define DEFAULT_NODEWWN(isp) (isp)->isp_osinfo.un._wwn
#define DEFAULT_PORTWWN(isp) (isp)->isp_osinfo.un._wwn
diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c
index 4524d4c3ef5..5c74cddab84 100644
--- a/sys/dev/pci/isp_pci.c
+++ b/sys/dev/pci/isp_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_pci.c,v 1.43 2008/05/28 18:46:56 kettenis Exp $ */
+/* $OpenBSD: isp_pci.c,v 1.44 2008/06/01 15:49:25 kettenis Exp $ */
/*
* PCI specific probe and attach routines for QLogic ISP SCSI adapters.
*
@@ -404,6 +404,28 @@ isp_pci_attach(struct device *parent, struct device *self, void *aux)
int ioh_valid, memh_valid;
bus_size_t iosize, msize;
u_int32_t confopts = 0;
+#ifdef __sparc64__
+ int node, iid;
+#endif
+
+ DEFAULT_IID(isp) = 7;
+#ifdef __sparc64__
+ /*
+ * Walk up the Open Firmware device tree until we find a
+ * "scsi-initiator-id" property.
+ */
+ node = PCITAG_NODE(pa->pa_tag);
+ while (node) {
+ if (OF_getprop(node, "scsi-initiator-id",
+ &iid, sizeof(iid)) == sizeof(iid)) {
+ DEFAULT_IID(isp) = iid;
+ confopts |= ISP_CFG_OWNLOOPID;
+ break;
+ }
+
+ node = OF_parent(node);
+ }
+#endif
ioh_valid = memh_valid = 0;
diff --git a/sys/dev/sbus/isp_sbus.c b/sys/dev/sbus/isp_sbus.c
index 0abb1879d31..1d5007770cd 100644
--- a/sys/dev/sbus/isp_sbus.c
+++ b/sys/dev/sbus/isp_sbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_sbus.c,v 1.11 2008/01/21 20:00:33 sobrado Exp $ */
+/* $OpenBSD: isp_sbus.c,v 1.12 2008/06/01 15:49:25 kettenis Exp $ */
/* $NetBSD: isp_sbus.c,v 1.46 2001/09/26 20:53:14 eeh Exp $ */
/*
@@ -76,7 +76,6 @@
#include <dev/microcode/isp/asm_sbus.h>
#endif
#include <dev/sbus/sbusvar.h>
-#include <sys/reboot.h>
static int isp_sbus_intr(void *);
static int
@@ -197,6 +196,8 @@ isp_sbus_attach(struct device *parent, struct device *self, void *aux)
}
sbc->sbus_mdvec.dv_clock = freq;
+ DEFAULT_IID(isp) = getpropint(sa->sa_node, "scsi-initiator-id", 7);
+
/*
* Now figure out what the proper burst sizes, etc., to use.
* Unfortunately, there is no ddi_dma_burstsizes here which