diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/qla.c | 30 | ||||
-rw-r--r-- | sys/dev/ic/qlavar.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/qla_pci.c | 14 |
3 files changed, 31 insertions, 17 deletions
diff --git a/sys/dev/ic/qla.c b/sys/dev/ic/qla.c index ba50dd6c780..c45baa16159 100644 --- a/sys/dev/ic/qla.c +++ b/sys/dev/ic/qla.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qla.c,v 1.11 2014/01/30 23:58:41 jmatthew Exp $ */ +/* $OpenBSD: qla.c,v 1.12 2014/02/01 09:11:30 kettenis Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -325,8 +325,16 @@ qla_attach(struct qla_softc *sc) return (ENXIO); } - if (qla_read_nvram(sc) == 0) + if (qla_read_nvram(sc) == 0) { sc->sc_nvram_valid = 1; + if (sc->sc_port_name == 0) + sc->sc_port_name = betoh64(sc->sc_nvram.port_name); + if (sc->sc_node_name == 0) + sc->sc_node_name = betoh64(sc->sc_nvram.node_name); + } + + if (sc->sc_port_name == 0) + sc->sc_port_name = QLA_DEFAULT_PORT_NAME; switch (sc->sc_isp_gen) { case QLA_GEN_ISP2100: @@ -406,6 +414,9 @@ qla_attach(struct qla_softc *sc) icb = (struct qla_init_cb *)QLA_DMA_KVA(sc->sc_scratch); memset(icb, 0, sizeof(*icb)); icb->icb_version = QLA_ICB_VERSION; + /* port and node names are big-endian in the icb */ + icb->icb_portname = htobe64(sc->sc_port_name); + icb->icb_nodename = htobe64(sc->sc_node_name); if (sc->sc_nvram_valid) { icb->icb_fw_options = sc->sc_nvram.fw_options; icb->icb_max_frame_len = sc->sc_nvram.frame_payload_size; @@ -413,11 +424,9 @@ qla_attach(struct qla_softc *sc) icb->icb_exec_throttle = sc->sc_nvram.execution_throttle; icb->icb_retry_count = sc->sc_nvram.retry_count; icb->icb_retry_delay = sc->sc_nvram.retry_delay; - icb->icb_portname = sc->sc_nvram.port_name; icb->icb_hardaddr = sc->sc_nvram.hard_address; icb->icb_inquiry_data = sc->sc_nvram.inquiry_data; icb->icb_login_timeout = sc->sc_nvram.login_timeout; - icb->icb_nodename = sc->sc_nvram.node_name; icb->icb_xfwoptions = sc->sc_nvram.add_fw_options; icb->icb_zfwoptions = sc->sc_nvram.special_options; } else { @@ -427,10 +436,6 @@ qla_attach(struct qla_softc *sc) icb->icb_exec_throttle = htole16(16); icb->icb_max_alloc = htole16(256); icb->icb_max_frame_len = htole16(1024); - /* port name is big-endian in the icb */ - icb->icb_portname = htobe64(QLA_DEFAULT_PORT_NAME); - icb->icb_nodename = 0; - icb->icb_fw_options = htole16(QLA_ICB_FW_FAIRNESS | QLA_ICB_FW_ENABLE_PDB_CHANGED | QLA_ICB_FW_HARD_ADDR | QLA_ICB_FW_FULL_DUPLEX); @@ -723,13 +728,8 @@ qla_attach(struct qla_softc *sc) sc->sc_link.adapter_buswidth = QLA_MAX_TARGETS; sc->sc_link.openings = sc->sc_maxcmds; /* / sc->sc_buswidth? */ sc->sc_link.pool = &sc->sc_iopool; - if (sc->sc_nvram_valid) { - sc->sc_link.port_wwn = betoh64(sc->sc_nvram.port_name); - sc->sc_link.node_wwn = betoh64(sc->sc_nvram.node_name); - } else { - sc->sc_link.port_wwn = QLA_DEFAULT_PORT_NAME; - sc->sc_link.node_wwn = 0; - } + sc->sc_link.port_wwn = sc->sc_port_name; + sc->sc_link.node_wwn = sc->sc_node_name; if (sc->sc_link.node_wwn == 0) { /* * mask out the port number from the port name to get diff --git a/sys/dev/ic/qlavar.h b/sys/dev/ic/qlavar.h index 43598f4d1d7..136628624ef 100644 --- a/sys/dev/ic/qlavar.h +++ b/sys/dev/ic/qlavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: qlavar.h,v 1.1 2014/01/19 06:04:03 jmatthew Exp $ */ +/* $OpenBSD: qlavar.h,v 1.2 2014/02/01 09:11:30 kettenis Exp $ */ /* * Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org> @@ -168,6 +168,8 @@ struct qla_softc { struct qla_nvram sc_nvram; int sc_nvram_valid; + u_int64_t sc_node_name; + u_int64_t sc_port_name; }; #define DEVNAME(_sc) ((_sc)->sc_dev.dv_xname) diff --git a/sys/dev/pci/qla_pci.c b/sys/dev/pci/qla_pci.c index 25c7f55a8df..214dc63de84 100644 --- a/sys/dev/pci/qla_pci.c +++ b/sys/dev/pci/qla_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qla_pci.c,v 1.3 2014/01/22 02:31:44 jmatthew Exp $ */ +/* $OpenBSD: qla_pci.c,v 1.4 2014/02/01 09:11:30 kettenis Exp $ */ /* * Copyright (c) 2011 David Gwynne <dlg@openbsd.org> @@ -91,6 +91,10 @@ qla_pci_attach(struct device *parent, struct device *self, void *aux) struct pci_attach_args *pa = aux; pci_intr_handle_t ih; u_int32_t pcictl; +#ifdef __sparc64__ + u_int64_t wwn; + int node; +#endif pcireg_t bars[] = { QLA_PCI_MEM_BAR, QLA_PCI_IO_BAR }; pcireg_t memtype; @@ -180,6 +184,14 @@ qla_pci_attach(struct device *parent, struct device *self, void *aux) return; } +#ifdef __sparc64__ + node = PCITAG_NODE(pa->pa_tag); + if (OF_getprop(node, "port-wwn", &wwn, sizeof(wwn)) == sizeof(wwn)) + sc->sc_port_name = wwn; + if (OF_getprop(node, "node-wwn", &wwn, sizeof(wwn)) == sizeof(wwn)) + sc->sc_node_name = wwn; +#endif + sc->sc_port = pa->pa_function; if (qla_attach(sc) != 0) { |