summaryrefslogtreecommitdiff
path: root/realtek.c
diff options
context:
space:
mode:
authorAndrew Paprocki <andrew@ishiboo.com>2008-03-26 20:36:43 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-13 22:12:31 -0400
commit4eaac2cc32a43dcbecd329bff9824a7535a8808c (patch)
tree5bc64f15f2a14fc29f629a8ed60805eb0156c1f0 /realtek.c
parentc36a51cd7ee9a31981f904a7406b798f1f75ee8e (diff)
downloadethtool-4eaac2cc32a43dcbecd329bff9824a7535a8808c.tar.gz
ethtool: Add register dump support for all r8169 driver cards
This adds all MAC versions currently found in the r8169 to the RealTek table and modifies the dump logic to handle card versions >= RTL8169 instead of specifically looking at the few previously supported cards. Signed-off-by: Andrew Paprocki <andrew@ishiboo.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'realtek.c')
-rw-r--r--realtek.c110
1 files changed, 64 insertions, 46 deletions
diff --git a/realtek.c b/realtek.c
index c56b3f5..11ed835 100644
--- a/realtek.c
+++ b/realtek.c
@@ -5,8 +5,9 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#define HW_REVID(b30, b29, b28, b27, b26, b23, b22) \
- (b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22)
+#define HW_REVID(b31, b30, b29, b28, b27, b26, b23, b22) \
+ (b31<<31 | b30<<30 | b29<<29 | b28<<28 | \
+ b27<<27 | b26<<26 | b23<<23 | b22<<22)
enum chip_type {
RTLNONE,
@@ -22,34 +23,48 @@ enum chip_type {
RTL8139Cp,
RTL8101,
RTL8169,
- RTL8169s,
- RTL8110
+ RTL8169S,
+ RTL8110S,
+ RTL8169_8110SB,
+ RTL8169_8110SCd,
+ RTL8169_8110SCe,
+ RTL8168_8111Bb,
+ RTL8168_8111Bef,
+ RTL8101Ebc,
+ RTL8100E1,
+ RTL8100E2,
};
enum {
- chip_type_mask = HW_REVID(1, 1, 1, 1, 1, 1, 1)
+ chip_type_mask = HW_REVID(1, 1, 1, 1, 1, 1, 1, 1)
};
static struct chip_info {
const char *name;
u32 id_mask;
} rtl_info_tbl[] = {
- { "RTL-8139", HW_REVID(1, 0, 0, 0, 0, 0, 0) },
- { "RTL-8139-K", HW_REVID(1, 1, 0, 0, 0, 0, 0) },
- { "RTL-8139A", HW_REVID(1, 1, 1, 0, 0, 0, 0) },
- { "RTL-8139A-G", HW_REVID(1, 1, 1, 0, 0, 1, 0) },
- { "RTL-8139B", HW_REVID(1, 1, 1, 1, 0, 0, 0) },
- { "RTL-8130", HW_REVID(1, 1, 1, 1, 1, 0, 0) },
- { "RTL-8139C", HW_REVID(1, 1, 1, 0, 1, 0, 0) },
- { "RTL-8100", HW_REVID(1, 1, 1, 1, 0, 1, 0) },
- { "RTL-8100B/8139D", HW_REVID(1, 1, 1, 0, 1, 0, 1) },
- { "RTL-8139C+", HW_REVID(1, 1, 1, 0, 1, 1, 0) },
- { "RTL-8101", HW_REVID(1, 1, 1, 0, 1, 1, 1) },
- { "RTL-8168B/8111B", HW_REVID(0, 1, 1, 1, 0, 0, 0) },
- { "RTL-8101E", HW_REVID(0, 1, 1, 0, 1, 0, 0) },
- { "RTL-8169", HW_REVID(0, 0, 0, 0, 0, 0, 0) },
- { "RTL-8169s", HW_REVID(0, 0, 0, 0, 1, 0, 0) },
- { "RTL-8110", HW_REVID(0, 0, 1, 0, 0, 0, 0) },
+ { "RTL-8139", HW_REVID(0, 1, 0, 0, 0, 0, 0, 0) },
+ { "RTL-8139-K", HW_REVID(0, 1, 1, 0, 0, 0, 0, 0) },
+ { "RTL-8139A", HW_REVID(0, 1, 1, 1, 0, 0, 0, 0) },
+ { "RTL-8139A-G", HW_REVID(0, 1, 1, 1, 0, 0, 1, 0) },
+ { "RTL-8139B", HW_REVID(0, 1, 1, 1, 1, 0, 0, 0) },
+ { "RTL-8130", HW_REVID(0, 1, 1, 1, 1, 1, 0, 0) },
+ { "RTL-8139C", HW_REVID(0, 1, 1, 1, 0, 1, 0, 0) },
+ { "RTL-8100", HW_REVID(0, 1, 1, 1, 1, 0, 1, 0) },
+ { "RTL-8100B/8139D", HW_REVID(0, 1, 1, 1, 0, 1, 0, 1) },
+ { "RTL-8139C+", HW_REVID(0, 1, 1, 1, 0, 1, 1, 0) },
+ { "RTL-8101", HW_REVID(0, 1, 1, 1, 0, 1, 1, 1) },
+ { "RTL-8169", HW_REVID(0, 0, 0, 0, 0, 0, 0, 0) },
+ { "RTL-8169S", HW_REVID(0, 0, 0, 0, 0, 0, 1, 0) },
+ { "RTL-8110S", HW_REVID(0, 0, 0, 0, 0, 1, 0, 0) },
+ { "RTL-8169/8110SB", HW_REVID(0, 0, 0, 1, 0, 0, 0, 0) },
+ { "RTL-8169/8110SCd", HW_REVID(0, 0, 0, 1, 1, 0, 0, 0) },
+ { "RTL-8169/8110SCe", HW_REVID(1, 0, 0, 1, 1, 0, 0, 0) },
+ { "RTL-8168/8111Bb", HW_REVID(0, 0, 1, 1, 0, 0, 0, 0) },
+ { "RTL-8168/8111Bef", HW_REVID(0, 0, 1, 1, 1, 0, 0, 0) },
+ { "RTL-8101Ebc", HW_REVID(0, 0, 1, 1, 0, 1, 0, 0) },
+ { "RTL-8100E(1)", HW_REVID(0, 0, 1, 1, 0, 0, 1, 0) },
+ { "RTL-8100E(2)", HW_REVID(0, 0, 1, 1, 1, 0, 1, 0) },
{ }
};
@@ -89,7 +104,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
ci++;
}
if (v != ci->id_mask) {
- fprintf(stderr, "unknown RealTek chip\n");
+ fprintf(stderr, "Unknown RealTek chip (mask: 0x%08x)\n", v);
return 91;
}
for (i = 0; i < ARRAY_SIZE(rtl_info_tbl); i++) {
@@ -101,7 +116,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
fprintf(stdout,
"RealTek %s registers:\n"
- "------------------------------\n",
+ "--------------------------------------------------------\n",
ci->name);
fprintf(stdout,
@@ -118,10 +133,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
data[0x08 >> 2],
data[0x0c >> 2]);
- if (board_type == RTL8139Cp ||
- board_type == RTL8169 ||
- board_type == RTL8169s ||
- board_type == RTL8110) {
+ if (board_type == RTL8139Cp || board_type >= RTL8169) {
fprintf(stdout,
"0x10: Dump Tally Counter Command 0x%08x 0x%08x\n",
data[0x10 >> 2],
@@ -157,9 +169,8 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
data[0x2C >> 2]);
}
- if (board_type == RTL8169 ||
- board_type == RTL8169s ||
- board_type == RTL8110) {
+ if (board_type != RTL8168_8111Bb && board_type != RTL8168_8111Bef) {
+ if (board_type >= RTL8169) {
fprintf(stdout,
"0x30: Flash memory read/write 0x%08x\n",
data[0x30 >> 2]);
@@ -168,6 +179,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x30: Rx buffer addr (C mode) 0x%08x\n",
data[0x30 >> 2]);
}
+ }
v = data8[0x36];
fprintf(stdout,
@@ -194,9 +206,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
v & (1 << 2) ? "on" : "off",
v & (1 << 4) ? ", RESET" : "");
- if (board_type != RTL8169 &&
- board_type != RTL8169s &&
- board_type != RTL8110) {
+ if (board_type < RTL8169) {
fprintf(stdout,
"0x38: Current Address of Packet Read (C mode) 0x%04x\n"
"0x3A: Current Rx buffer address (C mode) 0x%04x\n",
@@ -231,9 +241,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
data8[0x51],
data8[0x52]);
- if (board_type == RTL8169 ||
- board_type == RTL8169s ||
- board_type == RTL8110) {
+ if (board_type >= RTL8169) {
fprintf(stdout,
"0x53: Config 2 0x%02x\n"
"0x54: Config 3 0x%02x\n"
@@ -272,20 +280,21 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x5C: Multiple Interrupt Select 0x%04x\n",
data[0x5c >> 2] & 0xffff);
- if (board_type == RTL8169 ||
- board_type == RTL8169s ||
- board_type == RTL8110) {
+ if (board_type >= RTL8169) {
+ fprintf(stdout,
+ "0x60: PHY access 0x%08x\n",
+ data[0x60 >> 2]);
+
+ if (board_type != RTL8168_8111Bb && board_type != RTL8168_8111Bef) {
fprintf(stdout,
- "0x60: PHY access 0x%08x\n"
"0x64: TBI control and status 0x%08x\n",
- data[0x60 >> 2],
data[0x64 >> 2]);
-
fprintf(stdout,
"0x68: TBI Autonegotiation advertisement (ANAR) 0x%04x\n"
"0x6A: TBI Link partner ability (LPAR) 0x%04x\n",
data[0x68 >> 2] & 0xffff,
data[0x68 >> 2] >> 16);
+ }
fprintf(stdout,
"0x6C: PHY status 0x%02x\n",
@@ -465,10 +474,7 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
}
}
- if (board_type == RTL8139Cp ||
- board_type == RTL8169 ||
- board_type == RTL8169s ||
- board_type == RTL8110) {
+ if (board_type == RTL8139Cp || board_type >= RTL8169) {
v = data[0xE0 >> 2] & 0xffff;
fprintf(stdout,
"0xE0: C+ Command 0x%04x\n",
@@ -512,6 +518,18 @@ realtek_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
fprintf(stdout,
"0xFC: External MII register 0x%08x\n",
data[0xFC >> 2]);
+ } else if (board_type >= RTL8169 &&
+ board_type != RTL8168_8111Bb &&
+ board_type != RTL8168_8111Bef) {
+ fprintf(stdout,
+ "0xF0: Func Event 0x%08x\n"
+ "0xF4: Func Event Mask 0x%08x\n"
+ "0xF8: Func Preset State 0x%08x\n"
+ "0xFC: Func Force Event 0x%08x\n",
+ data[0xF0 >> 2],
+ data[0xF4 >> 2],
+ data[0xF8 >> 2],
+ data[0xFC >> 2]);
}
}