summaryrefslogtreecommitdiffstats
path: root/tg3.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:34:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:34:36 +0000
commit74ebeae0b4c411df9900224b90a6072b16098458 (patch)
treefee8f5c9e37f1a9f0842e026876c8af541fa2e86 /tg3.c
parentInitial commit. (diff)
downloadethtool-74ebeae0b4c411df9900224b90a6072b16098458.tar.xz
ethtool-74ebeae0b4c411df9900224b90a6072b16098458.zip
Adding upstream version 1:6.7.upstream/1%6.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tg3.c')
-rw-r--r--tg3.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/tg3.c b/tg3.c
new file mode 100644
index 0000000..ebdef2d
--- /dev/null
+++ b/tg3.c
@@ -0,0 +1,42 @@
+#include <stdio.h>
+#include <string.h>
+#include "internal.h"
+
+#define TG3_MAGIC 0x669955aa
+
+int tg3_dump_eeprom(struct ethtool_drvinfo *info __maybe_unused,
+ struct ethtool_eeprom *ee)
+{
+ unsigned int i;
+
+ if (ee->magic != TG3_MAGIC) {
+ fprintf(stderr, "Magic number 0x%08x does not match 0x%08x\n",
+ ee->magic, TG3_MAGIC);
+ return -1;
+ }
+
+ fprintf(stdout, "Address \tData\n");
+ fprintf(stdout, "----------\t----\n");
+ for (i = 0; i < ee->len; i++)
+ fprintf(stdout, "0x%08x\t0x%02x\n", i + ee->offset, ee->data[i]);
+
+ return 0;
+}
+
+int tg3_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
+ struct ethtool_regs *regs)
+{
+ unsigned int i;
+ u32 reg;
+
+ fprintf(stdout, "Offset\tValue\n");
+ fprintf(stdout, "------\t----------\n");
+ for (i = 0; i < regs->len; i += sizeof(reg)) {
+ memcpy(&reg, &regs->data[i], sizeof(reg));
+ if (reg)
+ fprintf(stdout, "0x%04x\t0x%08x\n", i, reg);
+
+ }
+ fprintf(stdout, "\n");
+ return 0;
+}