lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220714095206.168187-1-Raju.Lakkaraju@microchip.com>
Date:   Thu, 14 Jul 2022 15:22:06 +0530
From:   Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
To:     <netdev@...r.kernel.org>
CC:     <davem@...emloft.net>, <mkubecek@...e.cz>,
        <UNGLinuxDriver@...rochip.com>
Subject: [PATCH ethtool] ethtool: add register dump support for lan743x chiptes

Add LAN743x register dump

Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
---
 Makefile.am |  2 +-
 ethtool.c   |  1 +
 internal.h  |  3 +++
 lan743x.c   | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 lan743x.c

diff --git a/Makefile.am b/Makefile.am
index dc5fbec..b90bb9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@ ethtool_SOURCES += \
 		  smsc911x.c at76c50x-usb.c sfc.c stmmac.c	\
 		  sff-common.c sff-common.h sfpid.c sfpdiag.c	\
 		  ixgbevf.c tse.c vmxnet3.c qsfp.c qsfp.h fjes.c lan78xx.c \
-		  igc.c cmis.c cmis.h bnxt.c
+		  igc.c cmis.c cmis.h bnxt.c lan743x.c
 endif
 
 if ENABLE_BASH_COMPLETION
diff --git a/ethtool.c b/ethtool.c
index 911f26b..0eff9da 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1129,6 +1129,7 @@ static const struct {
 	{ "fec", fec_dump_regs },
 	{ "igc", igc_dump_regs },
 	{ "bnxt_en", bnxt_dump_regs },
+	{ "lan743x", lan743x_dump_regs },
 };
 #endif
 
diff --git a/internal.h b/internal.h
index 0d9d816..54ae4c6 100644
--- a/internal.h
+++ b/internal.h
@@ -412,4 +412,7 @@ int igc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 /* Broadcom Ethernet Controller */
 int bnxt_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 
+/* Microchip Ethernet Controller */
+int lan743x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
 #endif /* ETHTOOL_INTERNAL_H__ */
diff --git a/lan743x.c b/lan743x.c
new file mode 100644
index 0000000..f430ee8
--- /dev/null
+++ b/lan743x.c
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries. */
+
+#include <stdio.h>
+#include <string.h>
+#include "internal.h"
+
+#define LAN743X_ETH_REG_VERSION		1
+
+enum {
+	ETH_PRIV_FLAGS,
+	ETH_ID_REV,
+	ETH_FPGA_REV,
+	ETH_STRAP_READ,
+	ETH_INT_STS,
+	ETH_HW_CFG,
+	ETH_PMT_CTL,
+	ETH_E2P_CMD,
+	ETH_E2P_DATA,
+	ETH_MAC_CR,
+	ETH_MAC_RX,
+	ETH_MAC_TX,
+	ETH_FLOW,
+	ETH_MII_ACC,
+	ETH_MII_DATA,
+	ETH_EEE_TX_LPI_REQ_DLY,
+	ETH_WUCSR,
+	ETH_WK_SRC,
+
+	/* Add new registers above */
+	MAX_LAN743X_ETH_REGS
+};
+
+void lan743x_comm_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
+			    struct ethtool_regs *regs)
+{
+	u32 *lan743x_reg = (u32 *)regs->data;
+
+	fprintf(stdout, "LAN743x Registers:\n");
+	fprintf(stdout, "------------------\n");
+	fprintf(stdout, "CHIP_ID_REV  = 0x%08X\n", lan743x_reg[ETH_ID_REV]);
+	fprintf(stdout, "FPGA_REV     = 0x%08X\n", lan743x_reg[ETH_FPGA_REV]);
+	fprintf(stdout, "STRAP_READ   = 0x%08X\n", lan743x_reg[ETH_STRAP_READ]);
+	fprintf(stdout, "INT_STS      = 0x%08X\n", lan743x_reg[ETH_INT_STS]);
+	fprintf(stdout, "HW_CFG       = 0x%08X\n", lan743x_reg[ETH_HW_CFG]);
+	fprintf(stdout, "PMT_CTRL     = 0x%08X\n", lan743x_reg[ETH_PMT_CTL]);
+	fprintf(stdout, "E2P_CMD      = 0x%08X\n", lan743x_reg[ETH_E2P_CMD]);
+	fprintf(stdout, "E2P_DATA     = 0x%08X\n", lan743x_reg[ETH_E2P_DATA]);
+	fprintf(stdout, "\n");
+
+	fprintf(stdout, "MAC Registers:\n");
+	fprintf(stdout, "--------------\n");
+	fprintf(stdout, "MAC_CR       = 0x%08X\n", lan743x_reg[ETH_MAC_CR]);
+	fprintf(stdout, "MAC_RX       = 0x%08X\n", lan743x_reg[ETH_MAC_RX]);
+	fprintf(stdout, "MAC_TX       = 0x%08X\n", lan743x_reg[ETH_MAC_TX]);
+	fprintf(stdout, "FLOW         = 0x%08X\n", lan743x_reg[ETH_FLOW]);
+	fprintf(stdout, "MII_ACC      = 0x%08X\n", lan743x_reg[ETH_MII_ACC]);
+	fprintf(stdout, "MII_DATA     = 0x%08X\n", lan743x_reg[ETH_MII_DATA]);
+	fprintf(stdout, "WUCSR        = 0x%08X\n", lan743x_reg[ETH_WUCSR]);
+	fprintf(stdout, "WK_SRC       = 0x%08X\n", lan743x_reg[ETH_WK_SRC]);
+	fprintf(stdout, "EEE_TX_LPI_REQ_DLY = 0x%08X\n",
+					lan743x_reg[ETH_EEE_TX_LPI_REQ_DLY]);
+	fprintf(stdout, "\n");
+}
+
+int lan743x_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
+		      struct ethtool_regs *regs)
+{
+
+	lan743x_comm_dump_regs(info, regs);
+
+	return 0;
+}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ