summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-05-26 12:48:29 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-05-26 12:48:29 +0000
commit324a8693d3ce62f1b73d902110378f9a3efc2391 (patch)
tree9025921cc0edb24666f211c74aaa14b371d5b476 /sys
parent0970de82ea66901ffdb8e4f8f7fc3a154783f414 (diff)
On sparc64, fetch "scsi-initiator-id" property from the firmware, and use
it to tweak to SPI port configuration. Makes the PRIMEPOWER 250 happy when netbooting.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/mpi_pci.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/dev/pci/mpi_pci.c b/sys/dev/pci/mpi_pci.c
index 1fb70993670..d6639b8ec64 100644
--- a/sys/dev/pci/mpi_pci.c
+++ b/sys/dev/pci/mpi_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi_pci.c,v 1.18 2008/05/25 23:45:53 dlg Exp $ */
+/* $OpenBSD: mpi_pci.c,v 1.19 2008/05/26 12:48:28 kettenis Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -29,6 +29,10 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
+#ifdef __sparc64__
+#include <dev/ofw/openfirm.h>
+#endif
+
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -98,6 +102,9 @@ mpi_pci_attach(struct device *parent, struct device *self, void *aux)
int r;
pci_intr_handle_t ih;
const char *intrstr;
+#ifdef __sparc64__
+ int node;
+#endif
psc->psc_pc = pa->pa_pc;
psc->psc_tag = pa->pa_tag;
@@ -106,6 +113,21 @@ mpi_pci_attach(struct device *parent, struct device *self, void *aux)
sc->sc_ios = 0;
sc->sc_target = -1;
+#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", &sc->sc_target,
+ sizeof(sc->sc_target)) == sizeof(sc->sc_target))
+ break;
+
+ node = OF_parent(node);
+ }
+#endif
+
/* find the appropriate memory base */
for (r = PCI_MAPREG_START; r < PCI_MAPREG_END; r += sizeof(memtype)) {
memtype = pci_mapreg_type(psc->psc_pc, psc->psc_tag, r);