* [PATCH 1/3] ethtool: sky2 GMAC decode
@ 2006-10-18 17:46 Stephen Hemminger
2006-10-18 17:47 ` [PATCH 2/3] ethtool: sky2 more decode Stephen Hemminger
2006-10-18 17:50 ` [PATCH 3/3] ethtool: dump_registers post mortem Stephen Hemminger
0 siblings, 2 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-18 17:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Add decoding of GMAC bits.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
marvell.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/marvell.c b/marvell.c
index 16147a9..244bb69 100644
--- a/marvell.c
+++ b/marvell.c
@@ -113,6 +113,31 @@ static void dump_fifo(const char *name,
dump_timer("LED", p + 0x20);
}
+static void dump_gmac_fifo(const void *p)
+{
+ const u32 *r = p;
+ int i;
+ static const char *regs[] = {
+ "End Address",
+ "Almost Full Thresh",
+ "Control/Test",
+ "FIFO Flush Mask",
+ "FIFO Flush Threshold",
+ "Truncation Threshold",
+ "Upper Pause Threshold",
+ "Lower Pause Threshold",
+ "VLAN Tag",
+ "FIFO Write Pointer",
+ "FIFO Write Level",
+ "FIFO Read Pointer",
+ "FIFO Read Level",
+ };
+
+ for (i = 0; i < sizeof(regs)/sizeof(regs[0]); ++i)
+ printf("%-32s 0x%08X\n", regs[i], r[i]);
+
+}
+
static void dump_mac(const u8 *r)
{
printf("\nMAC Addresses\n");
@@ -143,6 +168,7 @@ static void dump_gma(const char *name, c
static void dump_gmac(const char *name, const u8 *data)
{
printf("\n%s\n", name);
+
printf("Status 0x%04X\n", *(u16 *) data);
printf("Control 0x%04X\n", *(u16 *) (data + 4));
printf("Transmit 0x%04X\n", *(u16 *) (data + 8));
@@ -294,6 +320,7 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_mac(regs->data);
dump_gmac("GMAC 1", regs->data + 0x2800);
+ dump_gmac_fifo(regs->data + 0xc40);
printf("\nStatus BMU:\n-----------\n");
printf("Control 0x%08X\n",
@@ -337,6 +364,7 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_ram("Sync Transmit RAMbuffer 2", regs->data+0xb00);
dump_ram("Async Transmit RAMbuffer 21", regs->data+0xb80);
dump_gmac("GMAC 2", regs->data + 0x3800);
+ dump_gmac_fifo(regs->data + 0xc40 + 128);
}
return 0;
--
1.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] ethtool: sky2 more decode
2006-10-18 17:46 [PATCH 1/3] ethtool: sky2 GMAC decode Stephen Hemminger
@ 2006-10-18 17:47 ` Stephen Hemminger
2006-10-18 17:50 ` [PATCH 3/3] ethtool: dump_registers post mortem Stephen Hemminger
1 sibling, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-18 17:47 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Dump even more GMAC/GPHY state
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
marvell.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/marvell.c b/marvell.c
index 244bb69..e867521 100644
--- a/marvell.c
+++ b/marvell.c
@@ -113,7 +113,7 @@ static void dump_fifo(const char *name,
dump_timer("LED", p + 0x20);
}
-static void dump_gmac_fifo(const void *p)
+static void dump_gmac_fifo(const char *name, const void *p)
{
const u32 *r = p;
int i;
@@ -133,6 +133,7 @@ static void dump_gmac_fifo(const void *p
"FIFO Read Level",
};
+ printf("\n%s\n", name);
for (i = 0; i < sizeof(regs)/sizeof(regs[0]); ++i)
printf("%-32s 0x%08X\n", regs[i], r[i]);
@@ -319,8 +320,6 @@ int sky2_dump_regs(struct ethtool_drvinf
}
dump_mac(regs->data);
- dump_gmac("GMAC 1", regs->data + 0x2800);
- dump_gmac_fifo(regs->data + 0xc40);
printf("\nStatus BMU:\n-----------\n");
printf("Control 0x%08X\n",
@@ -350,6 +349,14 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_timer("TX status", regs->data + 0xec0);
dump_timer("ISR", regs->data + 0xed0);
+ printf("\nGMAC control 0x%04X\n", *(u32 *)(regs->data + 0xf00));
+ printf("GPHY control 0x%04X\n", *(u32 *)(regs->data + 0xf04));
+ printf("LINK control 0x%02hX\n", *(u16 *)(regs->data + 0xf10));
+
+ dump_gmac("GMAC 1", regs->data + 0x2800);
+ dump_gmac_fifo("Rx GMAC 1", regs->data + 0xc40);
+ dump_gmac_fifo("Tx GMAC 1", regs->data + 0xd40);
+
dump_queue2("Receive Queue 1", regs->data +0x400, 1);
dump_queue("Sync Transmit Queue 1", regs->data +0x600, 0);
dump_queue2("Async Transmit Queue 1", regs->data +0x680, 0);
@@ -364,7 +371,8 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_ram("Sync Transmit RAMbuffer 2", regs->data+0xb00);
dump_ram("Async Transmit RAMbuffer 21", regs->data+0xb80);
dump_gmac("GMAC 2", regs->data + 0x3800);
- dump_gmac_fifo(regs->data + 0xc40 + 128);
+ dump_gmac_fifo("Rx GMAC 2", regs->data + 0xc40 + 128);
+ dump_gmac_fifo("Tx GMAC 2", regs->data + 0xd40 + 128);
}
return 0;
--
1.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] ethtool: dump_registers post mortem
2006-10-18 17:46 [PATCH 1/3] ethtool: sky2 GMAC decode Stephen Hemminger
2006-10-18 17:47 ` [PATCH 2/3] ethtool: sky2 more decode Stephen Hemminger
@ 2006-10-18 17:50 ` Stephen Hemminger
2006-10-19 21:53 ` [PATCH] ethtool: more sky2 decode Stephen Hemminger
2006-10-21 18:15 ` [PATCH 3/3] ethtool: dump_registers post mortem Jeff Garzik
1 sibling, 2 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-18 17:50 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
This patch allows:
ethtool -d eth0 raw on >saved_regs
and later
ethtool -d eth0 file saved_regs
Selfish motive is to be able to take register dumps from users and
and decode later, possibly adding more output as needed.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
ethtool.c | 39 ++++++++++++++++++++++++++++++++++-----
1 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index b783248..7861990 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -29,7 +29,9 @@ #endif
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -251,6 +253,7 @@ static int msglvl_wanted = -1;
static int phys_id_time = 0;
static int gregs_changed = 0;
static int gregs_dump_raw = 0;
+static char *gregs_dump_file = NULL;
static int geeprom_changed = 0;
static int geeprom_dump_raw = 0;
static int geeprom_offset = 0;
@@ -268,6 +271,7 @@ typedef enum {
CMDL_NONE,
CMDL_BOOL,
CMDL_INT,
+ CMDL_STR,
} cmdline_type_t;
struct cmdline_info {
@@ -279,6 +283,7 @@ struct cmdline_info {
static struct cmdline_info cmdline_gregs[] = {
{ "raw", CMDL_BOOL, &gregs_dump_raw, NULL },
+ { "file", CMDL_STR, &gregs_dump_file, NULL },
};
static struct cmdline_info cmdline_geeprom[] = {
@@ -355,20 +360,28 @@ static void parse_generic_cmdline(int ar
if (i >= argc)
show_usage(1);
p = info[idx].wanted_val;
- if (info[idx].type == CMDL_BOOL) {
+ switch (info[idx].type) {
+ case CMDL_BOOL:
if (!strcmp(argp[i], "on"))
*p = 1;
else if (!strcmp(argp[i], "off"))
*p = 0;
else
show_usage(1);
- } else if (info[idx].type == CMDL_INT) {
- long v;
- v = strtol(argp[i], NULL, 0);
+ break;
+ case CMDL_INT: {
+ long v = strtol(argp[i], NULL, 0);
if (v < 0)
show_usage(1);
*p = (int) v;
- } else {
+ break;
+ }
+ case CMDL_STR: {
+ char **s = info[idx].wanted_val;
+ *s = strdup(argp[i]);
+ break;
+ }
+ default:
show_usage(1);
}
}
@@ -969,6 +982,22 @@ static int dump_regs(struct ethtool_drvi
return 0;
}
+ if (gregs_dump_file) {
+ FILE *f = fopen(gregs_dump_file, "r");
+ struct stat st;
+
+ if (!f || fstat(fileno(f), &st) < 0) {
+ fprintf(stderr, "Can't open '%s': %s\n",
+ gregs_dump_file, strerror(errno));
+ return -1;
+ }
+
+ regs = realloc(regs, sizeof(*regs) + st.st_size);
+ regs->len = st.st_size;
+ fread(regs->data, regs->len, 1, f);
+ fclose(f);
+ }
+
for (i = 0; i < ARRAY_SIZE(driver_list); i++)
if (!strncmp(driver_list[i].name, info->driver,
ETHTOOL_BUSINFO_LEN))
--
1.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] ethtool: more sky2 decode
2006-10-18 17:50 ` [PATCH 3/3] ethtool: dump_registers post mortem Stephen Hemminger
@ 2006-10-19 21:53 ` Stephen Hemminger
2006-10-21 18:15 ` [PATCH 3/3] ethtool: dump_registers post mortem Jeff Garzik
1 sibling, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-19 21:53 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
More marvell register decode. Add chip table, pci config info
and other bits useful for debug.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
marvell.c | 80 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 59 insertions(+), 21 deletions(-)
diff --git a/marvell.c b/marvell.c
index e867521..9a14dd2 100644
--- a/marvell.c
+++ b/marvell.c
@@ -141,6 +141,8 @@ static void dump_gmac_fifo(const char *n
static void dump_mac(const u8 *r)
{
+ u8 id;
+
printf("\nMAC Addresses\n");
printf("---------------\n");
dump_addr(1, r + 0x100);
@@ -148,10 +150,30 @@ static void dump_mac(const u8 *r)
dump_addr(3, r + 0x110);
printf("\n");
- printf("Connector type 0x%02X\n", r[0x118]);
- printf("PMD type 0x%02X\n", r[0x119]);
- printf("Configuration 0x%02X\n", r[0x11a]);
- printf("Chip Revision 0x%02X\n", r[0x11b]);
+ printf("Connector type 0x%02X (%c)\n",
+ r[0x118], (char)r[0x118]);
+ printf("PMD type 0x%02X (%c)\n",
+ r[0x119], (char)r[0x119]);
+ printf("PHY type 0x%02X\n", r[0x11d]);
+
+ id = r[0x11b];
+ printf("Chip Id 0x%02X ", id);
+ switch (id) {
+ case 0x0a: puts("Genesis"); break;
+ case 0xb0: puts("Yukon"); break;
+ case 0xb1: puts("Yukon-Lite"); break;
+ case 0xb2: puts("Yukon-LP"); break;
+ case 0xb3: puts("Yukon-2 XL"); break;
+ case 0xb4: puts("Yukon-2 EC Ultra"); break;
+ case 0xb6: puts("Yukon-2 EC"); break;
+ case 0xb7: puts("Yukon-2 FE"); break;
+ default: puts("Unknown");
+ }
+
+ printf(" (rev %d)\n", r[0x11a] & 0xf);
+
+ printf("Ram Buffer 0x%02X\n", r[0x11c]);
+
}
static void dump_gma(const char *name, const u8 *r)
@@ -182,21 +204,43 @@ static void dump_gmac(const char *name,
dump_gma("Physical", data + 0x28);
}
+static void dump_pci(const u8 *cfg)
+{
+ int i;
+
+ printf("\nPCI config\n----------\n");
+ for(i = 0; i < 0x80; i++) {
+ if (!(i & 15))
+ printf("%02x:", i);
+ printf(" %02x", cfg[i]);
+ if ((i & 15) == 15)
+ putchar('\n');
+ }
+ putchar('\n');
+}
+
+static void dump_control(u8 *r)
+{
+ printf("Control Registers\n");
+ printf("-----------------\n");
+
+ printf("Register Access Port 0x%02X\n", *r);
+ printf("LED Control/Status 0x%08X\n", *(u32 *) (r + 4));
+
+ printf("Interrupt Source 0x%08X\n", *(u32 *) (r + 8));
+ printf("Interrupt Mask 0x%08X\n", *(u32 *) (r + 0xc));
+ printf("Interrupt Hardware Error Source 0x%08X\n", *(u32 *) (r + 0x10));
+ printf("Interrupt Hardware Error Mask 0x%08X\n", *(u32 *) (r + 0x14));
+}
+
int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
{
const u32 *r = (const u32 *) regs->data;
int dual = !(regs->data[0x11a] & 1);
- printf("Control Registers\n");
- printf("-----------------\n");
+ dump_pci(regs->data + 0x380);
- printf("Register Access Port 0x%08X\n", r[0]);
- printf("LED Control/Status 0x%08X\n", r[1]);
- printf("Interrupt Source 0x%08X\n", r[2]);
- printf("Interrupt Mask 0x%08X\n", r[3]);
- printf("Interrupt Hardware Error Source 0x%08X\n", r[4]);
- printf("Interrupt Hardware Error Mask 0x%08X\n", r[5]);
- printf("Special Interrupt Source 0x%08X\n", r[6]);
+ dump_control(regs->data);
printf("\nBus Management Unit\n");
printf("-------------------\n");
@@ -296,15 +340,9 @@ int sky2_dump_regs(struct ethtool_drvinf
const u32 *r = (const u32 *) regs->data;
int dual;
- printf("Control Registers\n");
- printf("-----------------\n");
+ dump_pci(regs->data + 0x1c00);
- printf("Control/Status 0x%08X\n", r[1]);
- printf("Interrupt Source 0x%08X\n", r[2]);
- printf("Interrupt Mask 0x%08X\n", r[3]);
- printf("Interrupt Hardware Error Source 0x%08X\n", r[4]);
- printf("Interrupt Hardware Error Mask 0x%08X\n", r[5]);
- printf("Special Interrupt Source 0x%08X\n", r[6]);
+ dump_control(regs->data);
printf("\nBus Management Unit\n");
printf("-------------------\n");
--
1.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] ethtool: dump_registers post mortem
2006-10-18 17:50 ` [PATCH 3/3] ethtool: dump_registers post mortem Stephen Hemminger
2006-10-19 21:53 ` [PATCH] ethtool: more sky2 decode Stephen Hemminger
@ 2006-10-21 18:15 ` Jeff Garzik
2006-10-23 17:51 ` [PATCH 1/3] ethtool: marvell register dump Stephen Hemminger
1 sibling, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2006-10-21 18:15 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Stephen Hemminger wrote:
> This patch allows:
> ethtool -d eth0 raw on >saved_regs
> and later
> ethtool -d eth0 file saved_regs
>
> Selfish motive is to be able to take register dumps from users and
> and decode later, possibly adding more output as needed.
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Would you be kind enough to roll your ethtool patches into two patches:
this patch, and 'more sky2 decode' patch. I now have three sky2
decode patches, two from 10/18 and one from 10/19.
Also, please update the man page, and possibly the -h help info, to
indicate this enhancement.
Jeff
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] ethtool: marvell register dump
2006-10-21 18:15 ` [PATCH 3/3] ethtool: dump_registers post mortem Jeff Garzik
@ 2006-10-23 17:51 ` Stephen Hemminger
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-23 17:51 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
This is a consolidation of earlier marvell register decode patches to ethtool.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
marvell.c | 106 ++++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 77 insertions(+), 29 deletions(-)
diff --git a/marvell.c b/marvell.c
index 244bb69..b73addc 100644
--- a/marvell.c
+++ b/marvell.c
@@ -88,10 +88,12 @@ static void dump_ram(const char *name, c
printf("End Address 0x%08X\n", r[1]);
printf("Write Pointer 0x%08X\n", r[2]);
printf("Read Pointer 0x%08X\n", r[3]);
- printf("Upper Threshold/Pause Packets 0x%08X\n", r[4]);
- printf("Lower Threshold/Pause Packets 0x%08X\n", r[5]);
- printf("Upper Threshold/High Priority 0x%08X\n", r[6]);
- printf("Lower Threshold/High Priority 0x%08X\n", r[7]);
+ if (*name == 'R') {
+ printf("Upper Threshold/Pause Packets 0x%08X\n", r[4]);
+ printf("Lower Threshold/Pause Packets 0x%08X\n", r[5]);
+ printf("Upper Threshold/High Priority 0x%08X\n", r[6]);
+ printf("Lower Threshold/High Priority 0x%08X\n", r[7]);
+ }
printf("Packet Counter 0x%08X\n", r[8]);
printf("Level 0x%08X\n", r[9]);
printf("Test 0x%08X\n", r[10]);
@@ -113,7 +115,7 @@ static void dump_fifo(const char *name,
dump_timer("LED", p + 0x20);
}
-static void dump_gmac_fifo(const void *p)
+static void dump_gmac_fifo(const char *name, const void *p)
{
const u32 *r = p;
int i;
@@ -133,6 +135,7 @@ static void dump_gmac_fifo(const void *p
"FIFO Read Level",
};
+ printf("\n%s\n", name);
for (i = 0; i < sizeof(regs)/sizeof(regs[0]); ++i)
printf("%-32s 0x%08X\n", regs[i], r[i]);
@@ -140,6 +143,8 @@ static void dump_gmac_fifo(const void *p
static void dump_mac(const u8 *r)
{
+ u8 id;
+
printf("\nMAC Addresses\n");
printf("---------------\n");
dump_addr(1, r + 0x100);
@@ -147,10 +152,30 @@ static void dump_mac(const u8 *r)
dump_addr(3, r + 0x110);
printf("\n");
- printf("Connector type 0x%02X\n", r[0x118]);
- printf("PMD type 0x%02X\n", r[0x119]);
- printf("Configuration 0x%02X\n", r[0x11a]);
- printf("Chip Revision 0x%02X\n", r[0x11b]);
+ printf("Connector type 0x%02X (%c)\n",
+ r[0x118], (char)r[0x118]);
+ printf("PMD type 0x%02X (%c)\n",
+ r[0x119], (char)r[0x119]);
+ printf("PHY type 0x%02X\n", r[0x11d]);
+
+ id = r[0x11b];
+ printf("Chip Id 0x%02X ", id);
+ switch (id) {
+ case 0x0a: puts("Genesis"); break;
+ case 0xb0: puts("Yukon"); break;
+ case 0xb1: puts("Yukon-Lite"); break;
+ case 0xb2: puts("Yukon-LP"); break;
+ case 0xb3: puts("Yukon-2 XL"); break;
+ case 0xb4: puts("Yukon-2 EC Ultra"); break;
+ case 0xb6: puts("Yukon-2 EC"); break;
+ case 0xb7: puts("Yukon-2 FE"); break;
+ default: puts("Unknown");
+ }
+
+ printf(" (rev %d)\n", r[0x11a] & 0xf);
+
+ printf("Ram Buffer 0x%02X\n", r[0x11c]);
+
}
static void dump_gma(const char *name, const u8 *r)
@@ -181,21 +206,43 @@ static void dump_gmac(const char *name,
dump_gma("Physical", data + 0x28);
}
+static void dump_pci(const u8 *cfg)
+{
+ int i;
+
+ printf("\nPCI config\n----------\n");
+ for(i = 0; i < 0x80; i++) {
+ if (!(i & 15))
+ printf("%02x:", i);
+ printf(" %02x", cfg[i]);
+ if ((i & 15) == 15)
+ putchar('\n');
+ }
+ putchar('\n');
+}
+
+static void dump_control(u8 *r)
+{
+ printf("Control Registers\n");
+ printf("-----------------\n");
+
+ printf("Register Access Port 0x%02X\n", *r);
+ printf("LED Control/Status 0x%08X\n", *(u32 *) (r + 4));
+
+ printf("Interrupt Source 0x%08X\n", *(u32 *) (r + 8));
+ printf("Interrupt Mask 0x%08X\n", *(u32 *) (r + 0xc));
+ printf("Interrupt Hardware Error Source 0x%08X\n", *(u32 *) (r + 0x10));
+ printf("Interrupt Hardware Error Mask 0x%08X\n", *(u32 *) (r + 0x14));
+}
+
int skge_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
{
const u32 *r = (const u32 *) regs->data;
int dual = !(regs->data[0x11a] & 1);
- printf("Control Registers\n");
- printf("-----------------\n");
+ dump_pci(regs->data + 0x380);
- printf("Register Access Port 0x%08X\n", r[0]);
- printf("LED Control/Status 0x%08X\n", r[1]);
- printf("Interrupt Source 0x%08X\n", r[2]);
- printf("Interrupt Mask 0x%08X\n", r[3]);
- printf("Interrupt Hardware Error Source 0x%08X\n", r[4]);
- printf("Interrupt Hardware Error Mask 0x%08X\n", r[5]);
- printf("Special Interrupt Source 0x%08X\n", r[6]);
+ dump_control(regs->data);
printf("\nBus Management Unit\n");
printf("-------------------\n");
@@ -295,15 +342,9 @@ int sky2_dump_regs(struct ethtool_drvinf
const u32 *r = (const u32 *) regs->data;
int dual;
- printf("Control Registers\n");
- printf("-----------------\n");
+ dump_pci(regs->data + 0x1c00);
- printf("Control/Status 0x%08X\n", r[1]);
- printf("Interrupt Source 0x%08X\n", r[2]);
- printf("Interrupt Mask 0x%08X\n", r[3]);
- printf("Interrupt Hardware Error Source 0x%08X\n", r[4]);
- printf("Interrupt Hardware Error Mask 0x%08X\n", r[5]);
- printf("Special Interrupt Source 0x%08X\n", r[6]);
+ dump_control(regs->data);
printf("\nBus Management Unit\n");
printf("-------------------\n");
@@ -319,8 +360,6 @@ int sky2_dump_regs(struct ethtool_drvinf
}
dump_mac(regs->data);
- dump_gmac("GMAC 1", regs->data + 0x2800);
- dump_gmac_fifo(regs->data + 0xc40);
printf("\nStatus BMU:\n-----------\n");
printf("Control 0x%08X\n",
@@ -350,6 +389,14 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_timer("TX status", regs->data + 0xec0);
dump_timer("ISR", regs->data + 0xed0);
+ printf("\nGMAC control 0x%04X\n", *(u32 *)(regs->data + 0xf00));
+ printf("GPHY control 0x%04X\n", *(u32 *)(regs->data + 0xf04));
+ printf("LINK control 0x%02hX\n", *(u16 *)(regs->data + 0xf10));
+
+ dump_gmac("GMAC 1", regs->data + 0x2800);
+ dump_gmac_fifo("Rx GMAC 1", regs->data + 0xc40);
+ dump_gmac_fifo("Tx GMAC 1", regs->data + 0xd40);
+
dump_queue2("Receive Queue 1", regs->data +0x400, 1);
dump_queue("Sync Transmit Queue 1", regs->data +0x600, 0);
dump_queue2("Async Transmit Queue 1", regs->data +0x680, 0);
@@ -364,7 +411,8 @@ int sky2_dump_regs(struct ethtool_drvinf
dump_ram("Sync Transmit RAMbuffer 2", regs->data+0xb00);
dump_ram("Async Transmit RAMbuffer 21", regs->data+0xb80);
dump_gmac("GMAC 2", regs->data + 0x3800);
- dump_gmac_fifo(regs->data + 0xc40 + 128);
+ dump_gmac_fifo("Rx GMAC 2", regs->data + 0xc40 + 128);
+ dump_gmac_fifo("Tx GMAC 2", regs->data + 0xd40 + 128);
}
return 0;
--
1.4.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] ethtool: flie option to register dump
2006-10-23 17:51 ` [PATCH 1/3] ethtool: marvell register dump Stephen Hemminger
@ 2006-10-23 17:57 ` Stephen Hemminger
2006-10-24 9:50 ` Ingo Oeser
2007-02-09 21:29 ` Jeff Garzik
2006-10-23 17:58 ` [PATCH 3/3] ethtool: allow force hex in " Stephen Hemminger
2006-11-07 9:34 ` [PATCH 1/3] ethtool: marvell " Jeff Garzik
2 siblings, 2 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-23 17:57 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Add ability to take old raw dumps from a file and decode them.
It is kind of limited because you still need to have same device
as the raw file, but useful for maintainers to decode raw dumps.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
ethtool.8 | 13 ++++++++++++-
ethtool.c | 43 +++++++++++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/ethtool.8 b/ethtool.8
index 679f6bc..bffde30 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -126,6 +126,8 @@ ethtool \- Display or change ethernet ca
.B ethtool \-d|\-\-register\-dump
.I ethX
.B2 raw on off
+.RB [ file
+.IR name ]
.B ethtool \-e|\-\-eeprom\-dump
.I ethX
@@ -244,7 +246,16 @@ queries the specified ethernet device fo
.TP
.B \-d \-\-register\-dump
retrieves and prints a register dump for the specified ethernet device.
-When raw is enabled, then it dumps the raw register data to stdout.
+The register format for some devices is known and decoded others
+are printed in hex.
+When
+.I raw
+is enabled, then it dumps the raw register data to stdout.
+If
+.I file
+is specified, then use contents of previous raw register dump, rather
+than reading from the device.
+
.TP
.B \-e \-\-eeprom\-dump
retrieves and prints an EEPROM dump for the specified ethernet device.
diff --git a/ethtool.c b/ethtool.c
index b783248..f004d54 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -29,7 +29,9 @@ #endif
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -150,7 +152,9 @@ static struct option {
" [ ufo on|off ]\n"
" [ gso on|off ]\n" },
{ "-i", "--driver", MODE_GDRV, "Show driver information" },
- { "-d", "--register-dump", MODE_GREGS, "Do a register dump" },
+ { "-d", "--register-dump", MODE_GREGS, "Do a register dump",
+ " [ raw on|off ]\n"
+ " [ file FILENAME ]\n" },
{ "-e", "--eeprom-dump", MODE_GEEPROM, "Do a EEPROM dump",
" [ raw on|off ]\n"
" [ offset N ]\n"
@@ -251,6 +255,7 @@ static int msglvl_wanted = -1;
static int phys_id_time = 0;
static int gregs_changed = 0;
static int gregs_dump_raw = 0;
+static char *gregs_dump_file = NULL;
static int geeprom_changed = 0;
static int geeprom_dump_raw = 0;
static int geeprom_offset = 0;
@@ -268,6 +273,7 @@ typedef enum {
CMDL_NONE,
CMDL_BOOL,
CMDL_INT,
+ CMDL_STR,
} cmdline_type_t;
struct cmdline_info {
@@ -279,6 +285,7 @@ struct cmdline_info {
static struct cmdline_info cmdline_gregs[] = {
{ "raw", CMDL_BOOL, &gregs_dump_raw, NULL },
+ { "file", CMDL_STR, &gregs_dump_file, NULL },
};
static struct cmdline_info cmdline_geeprom[] = {
@@ -355,20 +362,28 @@ static void parse_generic_cmdline(int ar
if (i >= argc)
show_usage(1);
p = info[idx].wanted_val;
- if (info[idx].type == CMDL_BOOL) {
+ switch (info[idx].type) {
+ case CMDL_BOOL:
if (!strcmp(argp[i], "on"))
*p = 1;
else if (!strcmp(argp[i], "off"))
*p = 0;
else
show_usage(1);
- } else if (info[idx].type == CMDL_INT) {
- long v;
- v = strtol(argp[i], NULL, 0);
+ break;
+ case CMDL_INT: {
+ long v = strtol(argp[i], NULL, 0);
if (v < 0)
show_usage(1);
*p = (int) v;
- } else {
+ break;
+ }
+ case CMDL_STR: {
+ char **s = info[idx].wanted_val;
+ *s = strdup(argp[i]);
+ break;
+ }
+ default:
show_usage(1);
}
}
@@ -969,6 +984,22 @@ static int dump_regs(struct ethtool_drvi
return 0;
}
+ if (gregs_dump_file) {
+ FILE *f = fopen(gregs_dump_file, "r");
+ struct stat st;
+
+ if (!f || fstat(fileno(f), &st) < 0) {
+ fprintf(stderr, "Can't open '%s': %s\n",
+ gregs_dump_file, strerror(errno));
+ return -1;
+ }
+
+ regs = realloc(regs, sizeof(*regs) + st.st_size);
+ regs->len = st.st_size;
+ fread(regs->data, regs->len, 1, f);
+ fclose(f);
+ }
+
for (i = 0; i < ARRAY_SIZE(driver_list); i++)
if (!strncmp(driver_list[i].name, info->driver,
ETHTOOL_BUSINFO_LEN))
--
1.4.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] ethtool: allow force hex in register dump
2006-10-23 17:51 ` [PATCH 1/3] ethtool: marvell register dump Stephen Hemminger
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
@ 2006-10-23 17:58 ` Stephen Hemminger
2006-11-07 9:34 ` [PATCH 1/3] ethtool: marvell " Jeff Garzik
2 siblings, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-23 17:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Sometimes the device decode logic just gets in the way
so add a "force hex" option to register dump.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
ethtool.8 | 1 +
ethtool.c | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/ethtool.8 b/ethtool.8
index bffde30..d247d51 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -126,6 +126,7 @@ ethtool \- Display or change ethernet ca
.B ethtool \-d|\-\-register\-dump
.I ethX
.B2 raw on off
+.B2 hex on off
.RB [ file
.IR name ]
diff --git a/ethtool.c b/ethtool.c
index f004d54..06e3675 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -255,6 +255,7 @@ static int msglvl_wanted = -1;
static int phys_id_time = 0;
static int gregs_changed = 0;
static int gregs_dump_raw = 0;
+static int gregs_dump_hex = 0;
static char *gregs_dump_file = NULL;
static int geeprom_changed = 0;
static int geeprom_dump_raw = 0;
@@ -285,6 +286,7 @@ struct cmdline_info {
static struct cmdline_info cmdline_gregs[] = {
{ "raw", CMDL_BOOL, &gregs_dump_raw, NULL },
+ { "hex", CMDL_BOOL, &gregs_dump_hex, NULL },
{ "file", CMDL_STR, &gregs_dump_file, NULL },
};
@@ -1000,10 +1002,11 @@ static int dump_regs(struct ethtool_drvi
fclose(f);
}
- for (i = 0; i < ARRAY_SIZE(driver_list); i++)
- if (!strncmp(driver_list[i].name, info->driver,
- ETHTOOL_BUSINFO_LEN))
- return driver_list[i].func(info, regs);
+ if (!gregs_dump_hex)
+ for (i = 0; i < ARRAY_SIZE(driver_list); i++)
+ if (!strncmp(driver_list[i].name, info->driver,
+ ETHTOOL_BUSINFO_LEN))
+ return driver_list[i].func(info, regs);
fprintf(stdout, "Offset\tValues\n");
fprintf(stdout, "--------\t-----");
--
1.4.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] ethtool: flie option to register dump
2006-10-24 9:50 ` Ingo Oeser
@ 2006-10-23 20:06 ` Stephen Hemminger
0 siblings, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2006-10-23 20:06 UTC (permalink / raw)
To: Ingo Oeser; +Cc: Jeff Garzik, netdev
On Tue, 24 Oct 2006 11:50:19 +0200
Ingo Oeser <netdev@axxeo.de> wrote:
> Hi Stephen,
>
> Stephen Hemminger schrieb:
> > Add ability to take old raw dumps from a file and decode them.
> > It is kind of limited because you still need to have same device
> > as the raw file, but useful for maintainers to decode raw dumps.
>
> What about putting the (Permanent) MAC into the first 4-6 octets
> of the hexdump and decode+check+warn using this info first
> to avoid mixing up files?
>
> Maybe only the first 4 octets to enhance privacy and still being able
> to detect known "bad" series.
>
> This might prevent user errors when sending such files
> to developers.
>
> Regards
>
> Ingo Oeser
The existing output format for raw is fine for piping into utilities
like hexdump
--
Stephen Hemminger <shemminger@osdl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] ethtool: flie option to register dump
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
@ 2006-10-24 9:50 ` Ingo Oeser
2006-10-23 20:06 ` Stephen Hemminger
2007-02-09 21:29 ` Jeff Garzik
1 sibling, 1 reply; 12+ messages in thread
From: Ingo Oeser @ 2006-10-24 9:50 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Jeff Garzik, netdev
Hi Stephen,
Stephen Hemminger schrieb:
> Add ability to take old raw dumps from a file and decode them.
> It is kind of limited because you still need to have same device
> as the raw file, but useful for maintainers to decode raw dumps.
What about putting the (Permanent) MAC into the first 4-6 octets
of the hexdump and decode+check+warn using this info first
to avoid mixing up files?
Maybe only the first 4 octets to enhance privacy and still being able
to detect known "bad" series.
This might prevent user errors when sending such files
to developers.
Regards
Ingo Oeser
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] ethtool: marvell register dump
2006-10-23 17:51 ` [PATCH 1/3] ethtool: marvell register dump Stephen Hemminger
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
2006-10-23 17:58 ` [PATCH 3/3] ethtool: allow force hex in " Stephen Hemminger
@ 2006-11-07 9:34 ` Jeff Garzik
2 siblings, 0 replies; 12+ messages in thread
From: Jeff Garzik @ 2006-11-07 9:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Stephen Hemminger wrote:
> This is a consolidation of earlier marvell register decode patches to ethtool.
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
applied patch 1 of 3
patches 2 and 3 still in the queue under consideration.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] ethtool: flie option to register dump
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
2006-10-24 9:50 ` Ingo Oeser
@ 2007-02-09 21:29 ` Jeff Garzik
1 sibling, 0 replies; 12+ messages in thread
From: Jeff Garzik @ 2007-02-09 21:29 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Jeff Garzik, netdev
Stephen Hemminger wrote:
> Add ability to take old raw dumps from a file and decode them.
> It is kind of limited because you still need to have same device
> as the raw file, but useful for maintainers to decode raw dumps.
>
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
> ---
> ethtool.8 | 13 ++++++++++++-
> ethtool.c | 43 +++++++++++++++++++++++++++++++++++++------
> 2 files changed, 49 insertions(+), 7 deletions(-)
applied 2-3
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-02-09 21:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 17:46 [PATCH 1/3] ethtool: sky2 GMAC decode Stephen Hemminger
2006-10-18 17:47 ` [PATCH 2/3] ethtool: sky2 more decode Stephen Hemminger
2006-10-18 17:50 ` [PATCH 3/3] ethtool: dump_registers post mortem Stephen Hemminger
2006-10-19 21:53 ` [PATCH] ethtool: more sky2 decode Stephen Hemminger
2006-10-21 18:15 ` [PATCH 3/3] ethtool: dump_registers post mortem Jeff Garzik
2006-10-23 17:51 ` [PATCH 1/3] ethtool: marvell register dump Stephen Hemminger
2006-10-23 17:57 ` [PATCH 2/3] ethtool: flie option to " Stephen Hemminger
2006-10-24 9:50 ` Ingo Oeser
2006-10-23 20:06 ` Stephen Hemminger
2007-02-09 21:29 ` Jeff Garzik
2006-10-23 17:58 ` [PATCH 3/3] ethtool: allow force hex in " Stephen Hemminger
2006-11-07 9:34 ` [PATCH 1/3] ethtool: marvell " Jeff Garzik
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).