Blame SOURCES/0001-ethtool-add-register-dump-support-for-fjes-driver.patch

efe3ca
From 1be465a88eb247b78ddbc3129f53cc547ce8687b Mon Sep 17 00:00:00 2001
efe3ca
From: Taku Izumi <izumi.taku@jp.fujitsu.com>
efe3ca
Date: Wed, 16 Nov 2016 09:55:32 +0900
efe3ca
Subject: [PATCH 1/3] ethtool: add register dump support for fjes driver
efe3ca
efe3ca
This patch adds the register dump format for FUJITSU Extended
efe3ca
Network device like the following:
efe3ca
efe3ca
   # ethtool -d es0
efe3ca
efe3ca
0x0000: OWNER_EPID    (Owner EPID)                       0x00000001
efe3ca
0x0004: MAX_EP        (Maximum EP)                       0x00000008
efe3ca
0x0010: DCTL          (Device Control)                   0x00000000
efe3ca
0x0020: CR            (Command request)                  0x80000002
efe3ca
0x0024: CS            (Command status)                   0x80000002
efe3ca
0x0028: SHSTSAL       (Share status address Low)         0xE8215304
efe3ca
0x002C: SHSTSAH       (Share status address High)        0x00000007
efe3ca
0x0034: REQBL         (Request Buffer length)            0x00008028
efe3ca
0x0038: REQBAL        (Request Buffer Address Low)       0xEB0A0000
efe3ca
0x003C: REQBAH        (Request Buffer Address High)      0x00000007
efe3ca
0x0044: RESPBL        (Response Buffer Length)           0x00000018
efe3ca
0x0048: RESPBAL       (Response Buffer Address Low)      0xE41E1220
efe3ca
0x004C: RESPBAH       (Response Buffer Address High)     0x00000007
efe3ca
0x0080: IS            (Interrupt status)                 0x00000000
efe3ca
0x0084: IMS           (Interrupt mask set)               0x7FE00000
efe3ca
0x0088: IMC           (Interrupt mask clear)             0x001F0000
efe3ca
0x008C: IG            (Interrupt generator)              0x00010000
efe3ca
0x0090: ICTL          (Interrupt control)                0x00000000
efe3ca
efe3ca
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
efe3ca
Signed-off-by: John W. Linville <linville@tuxdriver.com>
efe3ca
(cherry picked from commit acc3d3a32940cdd3325520d212fa94f44b86ed09)
efe3ca
---
efe3ca
 Makefile.am |  2 +-
efe3ca
 ethtool.c   |  1 +
efe3ca
 fjes.c      | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
efe3ca
 internal.h  |  2 ++
efe3ca
 4 files changed, 93 insertions(+), 1 deletion(-)
efe3ca
 create mode 100644 fjes.c
efe3ca
efe3ca
diff --git a/Makefile.am b/Makefile.am
efe3ca
index de2db2e..edbda57 100644
efe3ca
--- a/Makefile.am
efe3ca
+++ b/Makefile.am
efe3ca
@@ -14,7 +14,7 @@ ethtool_SOURCES += \
efe3ca
 		  pcnet32.c realtek.c tg3.c marvell.c vioc.c	\
efe3ca
 		  smsc911x.c at76c50x-usb.c sfc.c stmmac.c	\
efe3ca
 		  sff-common.c sff-common.h sfpid.c sfpdiag.c	\
efe3ca
-		  ixgbevf.c tse.c vmxnet3.c qsfp.c qsfp.h
efe3ca
+		  ixgbevf.c tse.c vmxnet3.c qsfp.c qsfp.h fjes.c
efe3ca
 endif
efe3ca
 
efe3ca
 TESTS = test-cmdline test-features
efe3ca
diff --git a/ethtool.c b/ethtool.c
efe3ca
index 49ac94e..75299c6 100644
efe3ca
--- a/ethtool.c
efe3ca
+++ b/ethtool.c
efe3ca
@@ -1136,6 +1136,7 @@ static const struct {
efe3ca
 	{ "et131x", et131x_dump_regs },
efe3ca
 	{ "altera_tse", altera_tse_dump_regs },
efe3ca
 	{ "vmxnet3", vmxnet3_dump_regs },
efe3ca
+	{ "fjes", fjes_dump_regs },
efe3ca
 #endif
efe3ca
 };
efe3ca
 
efe3ca
diff --git a/fjes.c b/fjes.c
efe3ca
new file mode 100644
efe3ca
index 0000000..52f7c28
efe3ca
--- /dev/null
efe3ca
+++ b/fjes.c
efe3ca
@@ -0,0 +1,89 @@
efe3ca
+/* Copyright (c) 2016 FUJITSU LIMITED */
efe3ca
+#include <stdio.h>
efe3ca
+#include "internal.h"
efe3ca
+
efe3ca
+int fjes_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
efe3ca
+{
efe3ca
+	u32 *regs_buff = (u32 *)regs->data;
efe3ca
+
efe3ca
+	if (regs->version != 1)
efe3ca
+		return -1;
efe3ca
+
efe3ca
+	/* Information registers */
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0000: OWNER_EPID    (Owner EPID)                       0x%08X\n",
efe3ca
+		regs_buff[0]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0004: MAX_EP        (Maximum EP)                       0x%08X\n",
efe3ca
+		regs_buff[1]);
efe3ca
+
efe3ca
+	/* Device Control registers */
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0010: DCTL          (Device Control)                   0x%08X\n",
efe3ca
+		regs_buff[4]);
efe3ca
+
efe3ca
+	/* Command Control registers */
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0020: CR            (Command request)                  0x%08X\n",
efe3ca
+		regs_buff[8]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0024: CS            (Command status)                   0x%08X\n",
efe3ca
+		regs_buff[9]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0028: SHSTSAL       (Share status address Low)         0x%08X\n",
efe3ca
+		regs_buff[10]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x002C: SHSTSAH       (Share status address High)        0x%08X\n",
efe3ca
+		regs_buff[11]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0034: REQBL         (Request Buffer length)            0x%08X\n",
efe3ca
+		regs_buff[13]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0038: REQBAL        (Request Buffer Address Low)       0x%08X\n",
efe3ca
+		regs_buff[14]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x003C: REQBAH        (Request Buffer Address High)      0x%08X\n",
efe3ca
+		regs_buff[15]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0044: RESPBL        (Response Buffer Length)           0x%08X\n",
efe3ca
+		regs_buff[17]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0048: RESPBAL       (Response Buffer Address Low)      0x%08X\n",
efe3ca
+		regs_buff[18]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x004C: RESPBAH       (Response Buffer Address High)     0x%08X\n",
efe3ca
+		regs_buff[19]);
efe3ca
+
efe3ca
+	/* Interrupt Control registers */
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0080: IS            (Interrupt status)                 0x%08X\n",
efe3ca
+		regs_buff[32]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0084: IMS           (Interrupt mask set)               0x%08X\n",
efe3ca
+		regs_buff[33]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0088: IMC           (Interrupt mask clear)             0x%08X\n",
efe3ca
+		regs_buff[34]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x008C: IG            (Interrupt generator)              0x%08X\n",
efe3ca
+		regs_buff[35]);
efe3ca
+
efe3ca
+	fprintf(stdout,
efe3ca
+		"0x0090: ICTL          (Interrupt control)                0x%08X\n",
efe3ca
+		regs_buff[36]);
efe3ca
+
efe3ca
+	return 0;
efe3ca
+}
efe3ca
diff --git a/internal.h b/internal.h
efe3ca
index 3c08b74..4e658ea 100644
efe3ca
--- a/internal.h
efe3ca
+++ b/internal.h
efe3ca
@@ -348,4 +348,6 @@ void sff8472_show_all(const __u8 *id);
efe3ca
 /* QSFP Optics diagnostics */
efe3ca
 void sff8636_show_all(const __u8 *id, __u32 eeprom_len);
efe3ca
 
efe3ca
+/* FUJITSU Extended Socket network device */
efe3ca
+int fjes_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
efe3ca
 #endif /* ETHTOOL_INTERNAL_H__ */
efe3ca
-- 
efe3ca
1.8.3.1
efe3ca