From: Ron Mercer <ron.mercer@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ron.mercer@qlogic.com
Subject: [net-next PATCH 5/8] qlge: Add alternate function's reg dump to fw dump.
Date: Mon, 11 Jan 2010 17:13:02 -0800 [thread overview]
Message-ID: <1263258785-5112-6-git-send-email-ron.mercer@qlogic.com> (raw)
In-Reply-To: <1263258785-5112-1-git-send-email-ron.mercer@qlogic.com>
Get the 2nd (other) nic functions register values.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
drivers/net/qlge/qlge_dbg.c | 79 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/drivers/net/qlge/qlge_dbg.c b/drivers/net/qlge/qlge_dbg.c
index 48ff0fd..63822f7 100644
--- a/drivers/net/qlge/qlge_dbg.c
+++ b/drivers/net/qlge/qlge_dbg.c
@@ -1,5 +1,69 @@
#include "qlge.h"
+static u32 ql_get_other_func_num(struct ql_adapter *qdev)
+{
+ u32 other_function;
+ int status;
+ u32 test_logic;
+ u32 nic1_function_num = 0xffffffff;
+ u32 nic2_function_num = 0xffffffff;
+ u32 fc1_function_num = 0xffffffff;
+ u32 fc2_function_num = 0xffffffff;
+
+ status = ql_read_mpi_reg(qdev, TEST_LOGIC_FUNC_PORT_CONFIG,
+ &test_logic);
+ if (status)
+ return 0xffffffff;
+
+ /* First, establish the function number of the other PCI function */
+ if (test_logic & FC1_FUNCTION_ENABLE)
+ fc1_function_num = (test_logic & FC1_FUNCTION_MASK) >>
+ FC1_FUNCTION_SHIFT;
+ if (test_logic & FC2_FUNCTION_ENABLE)
+ fc2_function_num = (test_logic & FC2_FUNCTION_MASK) >>
+ FC2_FUNCTION_SHIFT;
+ if (test_logic & NIC1_FUNCTION_ENABLE)
+ nic1_function_num = (test_logic & NIC1_FUNCTION_MASK) >>
+ NIC1_FUNCTION_SHIFT;
+ if (test_logic & NIC2_FUNCTION_ENABLE)
+ nic2_function_num = (test_logic & NIC2_FUNCTION_MASK) >>
+ NIC2_FUNCTION_SHIFT;
+ if (qdev->func == nic1_function_num)
+ other_function = nic2_function_num;
+ else
+ other_function = nic1_function_num;
+
+ return other_function;
+}
+
+static u32 ql_read_other_func_reg(struct ql_adapter *qdev,
+ u32 reg)
+{
+ u32 other_function;
+ u32 register_to_read;
+ u32 reg_val;
+ unsigned int status = 0;
+
+ other_function = ql_get_other_func_num(qdev);
+
+ /* The other function is not enabled so we don't need
+ * to read anything out of it.
+ */
+ if (other_function == 0xffffffff)
+ return other_function;
+
+ /* The other function is there so now we need to
+ * read the requested register.
+ */
+ register_to_read = REG_BLOCK | MPI_READ |
+ (other_function << FUNCTION_SHIFT) | reg;
+ status = ql_read_mpi_reg(qdev, register_to_read, ®_val);
+ if (status != 0)
+ return 0xffffffff;
+
+ return reg_val;
+}
+
/* Read out the SERDES registers */
int ql_read_serdes_reg(struct ql_adapter *qdev, u32 reg, u32 * data)
{
@@ -521,16 +585,31 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump)
sizeof(struct mpi_coredump_segment_header) +
sizeof(mpi_coredump->nic_regs), "NIC1 Registers");
+ ql_build_coredump_seg_header(&mpi_coredump->nic2_regs_seg_hdr,
+ NIC2_CONTROL_SEG_NUM,
+ sizeof(struct mpi_coredump_segment_header) +
+ sizeof(mpi_coredump->nic2_regs), "NIC2 Registers");
+
if (qdev->func & 1) {
/* Odd means our function is NIC 2 */
for (i = 0; i < 64; i++)
mpi_coredump->nic2_regs[i] =
ql_read32(qdev, i * sizeof(u32));
+
+ for (i = 0; i < 64; i++)
+ mpi_coredump->nic_regs[i] =
+ ql_read_other_func_reg(qdev, (i * sizeof(u32)) / 4);
+
} else {
/* Even means our function is NIC 1 */
for (i = 0; i < 64; i++)
mpi_coredump->nic_regs[i] =
ql_read32(qdev, i * sizeof(u32));
+
+ for (i = 0; i < 64; i++)
+ mpi_coredump->nic2_regs[i] =
+ ql_read_other_func_reg(qdev, (i * sizeof(u32)) / 4);
+
}
ql_build_coredump_seg_header(&mpi_coredump->core_regs_seg_hdr,
--
1.6.0.2
next prev parent reply other threads:[~2010-01-12 1:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 1:12 [net-next PATCH 0/8] qlge: Add firmware coredump functionality Ron Mercer
2010-01-12 1:12 ` [net-next PATCH 1/8] qlge: Add data for firmware dump Ron Mercer
2010-01-12 6:20 ` David Miller
2010-01-12 1:12 ` [net-next PATCH 2/8] qlge: Add basic " Ron Mercer
2010-01-12 1:13 ` [net-next PATCH 3/8] qlge: Add probe regs to " Ron Mercer
2010-01-12 1:13 ` [net-next PATCH 4/8] qlge: Add RAM dump " Ron Mercer
2010-01-12 1:13 ` Ron Mercer [this message]
2010-01-12 1:13 ` [net-next PATCH 6/8] qlge: Add serdes reg " Ron Mercer
2010-01-12 1:13 ` [net-next PATCH 7/8] qlge: Add xgmac regs to firwmare dump Ron Mercer
2010-01-12 1:13 ` [net-next PATCH 8/8] qlge: Add option to force firmware core dump Ron Mercer
2010-01-12 6:22 ` [net-next PATCH 0/8] qlge: Add firmware coredump functionality David Miller
-- strict thread matches above, loose matches on Subject: below --
2010-01-15 23:31 Ron Mercer
2010-01-15 23:31 ` [net-next PATCH 5/8] qlge: Add alternate function's reg dump to fw dump Ron Mercer
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=1263258785-5112-6-git-send-email-ron.mercer@qlogic.com \
--to=ron.mercer@qlogic.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).