mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 22:42:10 +00:00
[BNX2]: Add indirect spinlock.
The indirect register access method will be used by more than one caller in BH context (NAPI poll and timer), so a spinlock is required. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
27a005b883
commit
1b8227c48e
2 changed files with 12 additions and 1 deletions
|
@ -234,21 +234,29 @@ static inline u32 bnx2_tx_avail(struct bnx2 *bp)
|
||||||
static u32
|
static u32
|
||||||
bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset)
|
bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset)
|
||||||
{
|
{
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
spin_lock_bh(&bp->indirect_lock);
|
||||||
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
|
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
|
||||||
return (REG_RD(bp, BNX2_PCICFG_REG_WINDOW));
|
val = REG_RD(bp, BNX2_PCICFG_REG_WINDOW);
|
||||||
|
spin_unlock_bh(&bp->indirect_lock);
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
|
bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
|
||||||
{
|
{
|
||||||
|
spin_lock_bh(&bp->indirect_lock);
|
||||||
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
|
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
|
||||||
REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val);
|
REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val);
|
||||||
|
spin_unlock_bh(&bp->indirect_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
|
bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
|
||||||
{
|
{
|
||||||
offset += cid_addr;
|
offset += cid_addr;
|
||||||
|
spin_lock_bh(&bp->indirect_lock);
|
||||||
if (CHIP_NUM(bp) == CHIP_NUM_5709) {
|
if (CHIP_NUM(bp) == CHIP_NUM_5709) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -266,6 +274,7 @@ bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
|
||||||
REG_WR(bp, BNX2_CTX_DATA_ADR, offset);
|
REG_WR(bp, BNX2_CTX_DATA_ADR, offset);
|
||||||
REG_WR(bp, BNX2_CTX_DATA, val);
|
REG_WR(bp, BNX2_CTX_DATA, val);
|
||||||
}
|
}
|
||||||
|
spin_unlock_bh(&bp->indirect_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -6039,6 +6048,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
|
||||||
bp->pdev = pdev;
|
bp->pdev = pdev;
|
||||||
|
|
||||||
spin_lock_init(&bp->phy_lock);
|
spin_lock_init(&bp->phy_lock);
|
||||||
|
spin_lock_init(&bp->indirect_lock);
|
||||||
INIT_WORK(&bp->reset_task, bnx2_reset_task);
|
INIT_WORK(&bp->reset_task, bnx2_reset_task);
|
||||||
|
|
||||||
dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
|
dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
|
||||||
|
|
|
@ -6522,6 +6522,7 @@ struct bnx2 {
|
||||||
|
|
||||||
/* Used to synchronize phy accesses. */
|
/* Used to synchronize phy accesses. */
|
||||||
spinlock_t phy_lock;
|
spinlock_t phy_lock;
|
||||||
|
spinlock_t indirect_lock;
|
||||||
|
|
||||||
u32 phy_flags;
|
u32 phy_flags;
|
||||||
#define PHY_SERDES_FLAG 1
|
#define PHY_SERDES_FLAG 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue