aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2005-12-14 00:08:21 -0500
committerDavid S. Miller <davem@davemloft.net>2005-12-14 00:08:21 -0500
commit381291b7d3e17ac966498312dc571dcca1b93efc (patch)
tree619ab88cbec0112674f72b3a8c6b3aae1bacd69a
parent65ab592dc5b34caebabfe1340e7c18f52a785079 (diff)
[TG3]: Fix nvram arbitration bugs.
The nvram arbitration rules were not strictly followed in a few places and this could lead to reading corrupted values from the nvram. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 47bd4a394420..dabc39befd3c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8533,6 +8533,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8533 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { 8533 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
8534 tp->tg3_flags |= TG3_FLAG_NVRAM; 8534 tp->tg3_flags |= TG3_FLAG_NVRAM;
8535 8535
8536 tg3_nvram_lock(tp);
8536 tg3_enable_nvram_access(tp); 8537 tg3_enable_nvram_access(tp);
8537 8538
8538 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 8539 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
@@ -8543,6 +8544,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8543 tg3_get_nvram_size(tp); 8544 tg3_get_nvram_size(tp);
8544 8545
8545 tg3_disable_nvram_access(tp); 8546 tg3_disable_nvram_access(tp);
8547 tg3_nvram_unlock(tp);
8546 8548
8547 } else { 8549 } else {
8548 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); 8550 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
@@ -8640,10 +8642,10 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
8640 if (ret == 0) 8642 if (ret == 0)
8641 *val = swab32(tr32(NVRAM_RDDATA)); 8643 *val = swab32(tr32(NVRAM_RDDATA));
8642 8644
8643 tg3_nvram_unlock(tp);
8644
8645 tg3_disable_nvram_access(tp); 8645 tg3_disable_nvram_access(tp);
8646 8646
8647 tg3_nvram_unlock(tp);
8648
8647 return ret; 8649 return ret;
8648} 8650}
8649 8651
@@ -8728,6 +8730,10 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
8728 8730
8729 offset = offset + (pagesize - page_off); 8731 offset = offset + (pagesize - page_off);
8730 8732
8733 /* Nvram lock released by tg3_nvram_read() above,
8734 * so need to get it again.
8735 */
8736 tg3_nvram_lock(tp);
8731 tg3_enable_nvram_access(tp); 8737 tg3_enable_nvram_access(tp);
8732 8738
8733 /* 8739 /*