public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rolandd@cisco.com>
To: linux-kernel@vger.kernel.org, linuxppc64-dev@ozlabs.org,
	openib-general@openib.org
Cc: SCHICKHJ@de.ibm.com, RAISCH@de.ibm.com, HNGUYEN@de.ibm.com,
	MEDER@de.ibm.com
Subject: [PATCH 04/22] OF adapter probing
Date: Fri, 17 Feb 2006 16:57:14 -0800	[thread overview]
Message-ID: <20060218005712.13620.82908.stgit@localhost.localdomain> (raw)
In-Reply-To: <20060218005532.13620.79663.stgit@localhost.localdomain>

From: Roland Dreier <rolandd@cisco.com>

hipz_probe_adapters() looks a little funny -- it seems to bail out
of all the remaining adapters if one of them isn't quite right.
---

 drivers/infiniband/hw/ehca/hcp_sense.c |  144 ++++++++++++++++++++++++++++++++
 drivers/infiniband/hw/ehca/hcp_sense.h |  136 ++++++++++++++++++++++++++++++
 2 files changed, 280 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/hcp_sense.c b/drivers/infiniband/hw/ehca/hcp_sense.c
new file mode 100644
index 0000000..83fa4a3
--- /dev/null
+++ b/drivers/infiniband/hw/ehca/hcp_sense.c
@@ -0,0 +1,144 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  ehca detection and query code for POWER
+ *
+ *  Authors: Heiko J Schick <schickhj@de.ibm.com>
+ *
+ *  Copyright (c) 2005 IBM Corporation
+ *
+ *  All rights reserved.
+ *
+ *  This source code is distributed under a dual license of GPL v2.0 and OpenIB
+ *  BSD.
+ *
+ * OpenIB BSD License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id: hcp_sense.c,v 1.10 2006/02/06 10:17:34 schickhj Exp $
+ */
+
+#define DEB_PREFIX "snse"
+
+#include "ehca_kernel.h"
+#include "ehca_tools.h"
+
+int hipz_count_adapters(void)
+{
+	int num = 0;
+	struct device_node *dn = NULL;
+
+	EDEB_EN(7, "");
+
+	while ((dn = of_find_node_by_name(dn, "lhca"))) {
+		num++;
+	}
+
+	of_node_put(dn);
+
+	if (num == 0) {
+		EDEB_ERR(4, "No lhca node name was found in the"
+			 " Open Firmware device tree.");
+		return -ENODEV;
+	}
+
+	EDEB(6, " ... found %x adapter(s)", num);
+
+	EDEB_EX(7, "num=%x", num);
+
+	return num;
+}
+
+int hipz_probe_adapters(char **adapter_list)
+{
+	int ret = 0;
+	int num = 0;
+	struct device_node *dn = NULL;
+	char *loc;
+
+	EDEB_EN(7, "adapter_list=%p", adapter_list);
+
+	while ((dn = of_find_node_by_name(dn, "lhca"))) {
+		loc = get_property(dn, "ibm,loc-code", NULL);
+		if (loc == NULL) {
+			EDEB_ERR(4, "No ibm,loc-code property for"
+				 " lhca Open Firmware device tree node.");
+			ret = -ENODEV;
+			goto probe_adapters0;
+		}
+
+		adapter_list[num] = loc;
+		EDEB(6, " ... found adapter[%x] with loc-code: %s", num, loc);
+		num++;
+	}
+
+      probe_adapters0:
+	of_node_put(dn);
+
+	EDEB_EX(7, "ret=%x", ret);
+
+	return ret;
+}
+
+u64 hipz_get_adapter_handle(char *adapter)
+{
+	struct device_node *dn = NULL;
+	char *loc;
+	u64 *u64data = NULL;
+	u64 ret = 0;
+
+	EDEB_EN(7, "adapter=%p", adapter);
+
+	while ((dn = of_find_node_by_name(dn, "lhca"))) {
+		loc = get_property(dn, "ibm,loc-code", NULL);
+		if (loc == NULL) {
+			EDEB_ERR(4, "No ibm,loc-code property for"
+				 " lhca Open Firmware device tree node.");
+			goto get_adapter_handle0;
+		}
+
+		if (strcmp(loc, adapter) == 0) {
+			u64data =
+			    (u64 *) get_property(dn, "ibm,hca-handle", NULL);
+			break;
+		}
+	}
+
+	if (u64data == NULL) {
+		EDEB_ERR(4, "No ibm,hca-handle property for"
+			 " lhca Open Firmware device tree node with"
+			 " ibm,loc-code: %s.", adapter);
+		goto get_adapter_handle0;
+	}
+
+	ret = *u64data;
+
+      get_adapter_handle0:
+	of_node_put(dn);
+
+	EDEB_EX(7, "ret=%lx",ret);
+
+	return ret;
+}
diff --git a/drivers/infiniband/hw/ehca/hcp_sense.h b/drivers/infiniband/hw/ehca/hcp_sense.h
new file mode 100644
index 0000000..a49040b
--- /dev/null
+++ b/drivers/infiniband/hw/ehca/hcp_sense.h
@@ -0,0 +1,136 @@
+/*
+ *  IBM eServer eHCA Infiniband device driver for Linux on POWER
+ *
+ *  ehca detection and query code for POWER
+ *
+ *  Authors: Heiko J Schick <schickhj@de.ibm.com>
+ *
+ *  Copyright (c) 2005 IBM Corporation
+ *
+ *  All rights reserved.
+ *
+ *  This source code is distributed under a dual license of GPL v2.0 and OpenIB
+ *  BSD.
+ *
+ * OpenIB BSD License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id: hcp_sense.h,v 1.11 2006/02/06 10:17:34 schickhj Exp $
+ */
+
+#ifndef HCP_SENSE_H
+#define HCP_SENSE_H
+
+int hipz_count_adapters(void);
+int hipz_probe_adapters(char **adapter_list);
+u64 hipz_get_adapter_handle(char *adapter);
+
+/* query hca response block */
+struct query_hca_rblock {
+	u32 cur_reliable_dg;
+	u32 cur_qp;
+	u32 cur_cq;
+	u32 cur_eq;
+	u32 cur_mr;
+	u32 cur_mw;
+	u32 cur_ee_context;
+	u32 cur_mcast_grp;
+	u32 cur_qp_attached_mcast_grp;
+	u32 reserved1;
+	u32 cur_ipv6_qp;
+	u32 cur_eth_qp;
+	u32 cur_hp_mr;
+	u32 reserved2[3];
+	u32 max_rd_domain;
+	u32 max_qp;
+	u32 max_cq;
+	u32 max_eq;
+	u32 max_mr;
+	u32 max_hp_mr;
+	u32 max_mw;
+	u32 max_mrwpte;
+	u32 max_special_mrwpte;
+	u32 max_rd_ee_context;
+	u32 max_mcast_grp;
+	u32 max_qps_attached_all_mcast_grp;
+	u32 max_qps_attached_mcast_grp;
+	u32 max_raw_ipv6_qp;
+	u32 max_raw_ethy_qp;
+	u32 internal_clock_frequency;
+	u32 max_pd;
+	u32 max_ah;
+	u32 max_cqe;
+	u32 max_wqes_wq;
+	u32 max_partitions;
+	u32 max_rr_ee_context;
+	u32 max_rr_qp;
+	u32 max_rr_hca;
+	u32 max_act_wqs_ee_context;
+	u32 max_act_wqs_qp;
+	u32 max_sge;
+	u32 max_sge_rd;
+	u32 memory_page_size_supported;
+	u64 max_mr_size;
+	u32 local_ca_ack_delay;
+	u32 num_ports;
+	u32 vendor_id;
+	u32 vendor_part_id;
+	u32 hw_ver;
+	u64 node_guid;
+	u64 hca_cap_indicators;
+	u32 data_counter_register_size;
+	u32 max_shared_rq;
+	u32 max_isns_eq;
+	u32 max_neq;
+} __attribute__ ((packed));
+
+/* query port response block */
+struct query_port_rblock {
+	u32 state;
+	u32 bad_pkey_cntr;
+	u32 lmc;
+	u32 lid;
+	u32 subnet_timeout;
+	u32 qkey_viol_cntr;
+	u32 sm_sl;
+	u32 sm_lid;
+	u32 capability_mask;
+	u32 init_type_reply;
+	u32 pkey_tbl_len;
+	u32 gid_tbl_len;
+	u64 gid_prefix;
+	u32 port_nr;
+	u16 pkey_entries[16];
+	u8  reserved1[32];
+	u32 trent_size;
+	u32 trbuf_size;
+	u64 max_msg_sz;
+	u32 max_mtu;
+	u32 vl_cap;
+	u8  reserved2[1900];
+	u64 guid_entries[255];
+} __attribute__ ((packed));
+
+#endif

  parent reply	other threads:[~2006-02-18  0:58 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-18  0:55 [PATCH 00/22] [RFC] IBM eHCA InfiniBand adapter driver Roland Dreier
2006-02-18  0:57 ` [PATCH 01/22] Add powerpc-specific clear_cacheline(), which just compiles to "dcbz" Roland Dreier
2006-02-18 12:17   ` Christoph Hellwig
2006-02-20 14:59   ` Anton Blanchard
2006-02-18  0:57 ` [PATCH 02/22] Firmware interface code for IB device Roland Dreier
2006-02-18  1:58   ` Greg KH
2006-02-18  2:04     ` Roland Dreier
2006-02-18 12:20       ` Christoph Hellwig
2006-02-18 12:26         ` Muli Ben-Yehuda
2006-02-18 12:29           ` Christoph Hellwig
2006-02-18 12:32           ` Arjan van de Ven
2006-02-18 16:32             ` Roland Dreier
2006-02-18 17:02               ` Arjan van de Ven
2006-02-18 18:15               ` Greg KH
2006-02-18 18:19                 ` Christoph Hellwig
2006-02-18 18:52                 ` Roland Dreier
2006-02-18 19:53                   ` Greg KH
2006-02-18 21:31                     ` Roland Dreier
2006-02-18 23:29                       ` Greg KH
2006-02-19  0:09                         ` Roland Dreier
2006-02-18 10:59     ` Heiko Carstens
2006-02-18 12:19   ` Christoph Hellwig
2006-02-18  0:57 ` [PATCH 03/22] pHype specific stuff Roland Dreier
2006-02-18 12:23   ` Christoph Hellwig
2006-02-20 15:09   ` Anton Blanchard
2006-02-18  0:57 ` Roland Dreier [this message]
2006-02-18  1:54   ` [PATCH 04/22] OF adapter probing Greg KH
2006-02-18 12:46   ` [openib-general] " Heiko J Schick
2006-02-18 16:02     ` Roland Dreier
2006-02-18  0:57 ` [PATCH 05/22] HW register abstractions Roland Dreier
2006-02-18  0:57 ` [PATCH 06/22] Queue handling Roland Dreier
2006-02-18  0:57 ` [PATCH 07/22] Hypercall definitions Roland Dreier
2006-02-20 15:12   ` Anton Blanchard
2006-02-18  0:57 ` [PATCH 08/22] Generic ehca headers Roland Dreier
2006-02-18 15:09   ` [openib-general] " Christoph Hellwig
2006-02-18  0:57 ` [PATCH 09/22] ehca classes Roland Dreier
2006-02-18  0:57 ` [PATCH 11/22] ehca event queues Roland Dreier
2006-02-18  0:57 ` [PATCH 12/22] ehca low-level verbs Roland Dreier
2006-02-18  0:57 ` [PATCH 13/22] HCA query functions Roland Dreier
2006-02-18  0:57 ` [PATCH 14/22] ehca completion queue handling Roland Dreier
2006-02-18  0:57 ` [PATCH 15/22] ehca queue pair handling Roland Dreier
2006-02-18  0:57 ` [PATCH 16/22] ehca post send/receive and poll CQ Roland Dreier
2006-02-18  0:57 ` [PATCH 17/22] Special QP functions Roland Dreier
2006-02-18  0:57 ` [PATCH 18/22] ehca address vectors, multicast groups, protection domains Roland Dreier
2006-02-18  0:57 ` [PATCH 19/22] ehca memory regions Roland Dreier
2006-02-18  0:57 ` [PATCH 20/22] ehca userspace verbs Roland Dreier
2006-02-18  0:57 ` [PATCH 21/22] ehca main file Roland Dreier
2006-02-20 15:22   ` Anton Blanchard
2006-02-20 16:52     ` Roland Dreier
2006-02-21  2:09     ` [openib-general] " Heiko J Schick
2006-02-20 18:32       ` Arnd Bergmann
2006-02-18  0:58 ` [PATCH 22/22] ehca Makefile/Kconfig changes Roland Dreier
2006-02-20 15:06 ` [PATCH 00/22] [RFC] IBM eHCA InfiniBand adapter driver Christoph Raisch
2006-02-20 16:55   ` Roland Dreier
2006-02-20 17:43   ` [openib-general] " Stephen Poole

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060218005712.13620.82908.stgit@localhost.localdomain \
    --to=rolandd@cisco.com \
    --cc=HNGUYEN@de.ibm.com \
    --cc=MEDER@de.ibm.com \
    --cc=RAISCH@de.ibm.com \
    --cc=SCHICKHJ@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@ozlabs.org \
    --cc=openib-general@openib.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox