aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-02-25 09:27:20 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-27 02:16:39 -0500
commit7fd764455a13f4d9b37c9b908f07d0758f11d3c5 (patch)
tree6a4c4b911c8fb1b7201e1b328e59486b72d22ed5
parentff3a7cb25217bddcefd20e72af08a65481db4096 (diff)
tg3: Add DASH firmware version reporting
This patch adds code to report the DASH firmware version. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c31
-rw-r--r--drivers/net/tg3.h8
2 files changed, 39 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 43859e4db2fe..bbf5fe3db3c8 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11606,6 +11606,34 @@ static void __devinit tg3_read_mgmtfw_ver(struct tg3 *tp)
11606 } 11606 }
11607} 11607}
11608 11608
11609static void __devinit tg3_read_dash_ver(struct tg3 *tp)
11610{
11611 int vlen;
11612 u32 apedata;
11613
11614 if (!(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) ||
11615 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF))
11616 return;
11617
11618 apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG);
11619 if (apedata != APE_SEG_SIG_MAGIC)
11620 return;
11621
11622 apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS);
11623 if (!(apedata & APE_FW_STATUS_READY))
11624 return;
11625
11626 apedata = tg3_ape_read32(tp, TG3_APE_FW_VERSION);
11627
11628 vlen = strlen(tp->fw_ver);
11629
11630 snprintf(&tp->fw_ver[vlen], TG3_VER_SIZE - vlen, " DASH v%d.%d.%d.%d",
11631 (apedata & APE_FW_VERSION_MAJMSK) >> APE_FW_VERSION_MAJSFT,
11632 (apedata & APE_FW_VERSION_MINMSK) >> APE_FW_VERSION_MINSFT,
11633 (apedata & APE_FW_VERSION_REVMSK) >> APE_FW_VERSION_REVSFT,
11634 (apedata & APE_FW_VERSION_BLDMSK));
11635}
11636
11609static void __devinit tg3_read_fw_ver(struct tg3 *tp) 11637static void __devinit tg3_read_fw_ver(struct tg3 *tp)
11610{ 11638{
11611 u32 val; 11639 u32 val;
@@ -13279,6 +13307,9 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13279 } 13307 }
13280 13308
13281 tg3_ape_lock_init(tp); 13309 tg3_ape_lock_init(tp);
13310
13311 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF)
13312 tg3_read_dash_ver(tp);
13282 } 13313 }
13283 13314
13284 /* 13315 /*
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 34dfaaaed3aa..2a75a60a6f1f 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1971,6 +1971,14 @@
1971/* APE shared memory. Accessible through BAR1 */ 1971/* APE shared memory. Accessible through BAR1 */
1972#define TG3_APE_FW_STATUS 0x400c 1972#define TG3_APE_FW_STATUS 0x400c
1973#define APE_FW_STATUS_READY 0x00000100 1973#define APE_FW_STATUS_READY 0x00000100
1974#define TG3_APE_FW_VERSION 0x4018
1975#define APE_FW_VERSION_MAJMSK 0xff000000
1976#define APE_FW_VERSION_MAJSFT 24
1977#define APE_FW_VERSION_MINMSK 0x00ff0000
1978#define APE_FW_VERSION_MINSFT 16
1979#define APE_FW_VERSION_REVMSK 0x0000ff00
1980#define APE_FW_VERSION_REVSFT 8
1981#define APE_FW_VERSION_BLDMSK 0x000000ff
1974#define TG3_APE_HOST_SEG_SIG 0x4200 1982#define TG3_APE_HOST_SEG_SIG 0x4200
1975#define APE_HOST_SEG_SIG_MAGIC 0x484f5354 1983#define APE_HOST_SEG_SIG_MAGIC 0x484f5354
1976#define TG3_APE_HOST_SEG_LEN 0x4204 1984#define TG3_APE_HOST_SEG_LEN 0x4204