aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2008-08-13 18:50:45 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-13 19:02:33 -0400
commit3fcaf2e566b9cf8ccd16bcda3440717236de163d (patch)
tree5cbe0c1805cdedc603a47314829a9595349f1708
parent4a37fb660c5505e0ee7ae16d80a06e85affe3055 (diff)
bnx2x: HW attention lock
HW attention lock Making sure that only one function will handle the HW attention. This makes the device parameter aeu_mask redundant so it is removed Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x.h1
-rw-r--r--drivers/net/bnx2x_main.c42
-rw-r--r--drivers/net/bnx2x_reg.h1
3 files changed, 25 insertions, 19 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index b9aa6f48ae2e..3b09ae623359 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -774,7 +774,6 @@ struct bnx2x {
774 u16 def_att_idx; 774 u16 def_att_idx;
775 u32 attn_state; 775 u32 attn_state;
776 struct attn_route attn_group[MAX_DYNAMIC_ATTN_GRPS]; 776 struct attn_route attn_group[MAX_DYNAMIC_ATTN_GRPS];
777 u32 aeu_mask;
778 u32 nig_mask; 777 u32 nig_mask;
779 778
780 /* slow path ring */ 779 /* slow path ring */
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 3e86ff4f4d45..c8b61788abb8 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -2450,20 +2450,25 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
2450 MISC_REG_AEU_MASK_ATTN_FUNC_0; 2450 MISC_REG_AEU_MASK_ATTN_FUNC_0;
2451 u32 nig_int_mask_addr = port ? NIG_REG_MASK_INTERRUPT_PORT1 : 2451 u32 nig_int_mask_addr = port ? NIG_REG_MASK_INTERRUPT_PORT1 :
2452 NIG_REG_MASK_INTERRUPT_PORT0; 2452 NIG_REG_MASK_INTERRUPT_PORT0;
2453 u32 aeu_mask;
2453 2454
2454 if (~bp->aeu_mask & (asserted & 0xff))
2455 BNX2X_ERR("IGU ERROR\n");
2456 if (bp->attn_state & asserted) 2455 if (bp->attn_state & asserted)
2457 BNX2X_ERR("IGU ERROR\n"); 2456 BNX2X_ERR("IGU ERROR\n");
2458 2457
2458 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_PORT0_ATT_MASK + port);
2459 aeu_mask = REG_RD(bp, aeu_addr);
2460
2459 DP(NETIF_MSG_HW, "aeu_mask %x newly asserted %x\n", 2461 DP(NETIF_MSG_HW, "aeu_mask %x newly asserted %x\n",
2460 bp->aeu_mask, asserted); 2462 aeu_mask, asserted);
2461 bp->aeu_mask &= ~(asserted & 0xff); 2463 aeu_mask &= ~(asserted & 0xff);
2462 DP(NETIF_MSG_HW, "after masking: aeu_mask %x\n", bp->aeu_mask); 2464 DP(NETIF_MSG_HW, "new mask %x\n", aeu_mask);
2463 2465
2464 REG_WR(bp, aeu_addr, bp->aeu_mask); 2466 REG_WR(bp, aeu_addr, aeu_mask);
2467 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_PORT0_ATT_MASK + port);
2465 2468
2469 DP(NETIF_MSG_HW, "attn_state %x\n", bp->attn_state);
2466 bp->attn_state |= asserted; 2470 bp->attn_state |= asserted;
2471 DP(NETIF_MSG_HW, "new state %x\n", bp->attn_state);
2467 2472
2468 if (asserted & ATTN_HARD_WIRED_MASK) { 2473 if (asserted & ATTN_HARD_WIRED_MASK) {
2469 if (asserted & ATTN_NIG_FOR_FUNC) { 2474 if (asserted & ATTN_NIG_FOR_FUNC) {
@@ -2717,6 +2722,7 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
2717 int index; 2722 int index;
2718 u32 reg_addr; 2723 u32 reg_addr;
2719 u32 val; 2724 u32 val;
2725 u32 aeu_mask;
2720 2726
2721 /* need to take HW lock because MCP or other port might also 2727 /* need to take HW lock because MCP or other port might also
2722 try to handle this event */ 2728 try to handle this event */
@@ -2761,23 +2767,26 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
2761 reg_addr = (IGU_ADDR_ATTN_BITS_CLR + IGU_FUNC_BASE * BP_FUNC(bp)) * 8; 2767 reg_addr = (IGU_ADDR_ATTN_BITS_CLR + IGU_FUNC_BASE * BP_FUNC(bp)) * 8;
2762 2768
2763 val = ~deasserted; 2769 val = ~deasserted;
2764/* DP(NETIF_MSG_INTR, "write 0x%08x to IGU addr 0x%x\n", 2770 DP(NETIF_MSG_HW, "about to mask 0x%08x at HC addr 0x%x\n",
2765 val, BAR_IGU_INTMEM + reg_addr); */ 2771 val, reg_addr);
2766 REG_WR(bp, BAR_IGU_INTMEM + reg_addr, val); 2772 REG_WR(bp, BAR_IGU_INTMEM + reg_addr, val);
2767 2773
2768 if (bp->aeu_mask & (deasserted & 0xff))
2769 BNX2X_ERR("IGU BUG!\n");
2770 if (~bp->attn_state & deasserted) 2774 if (~bp->attn_state & deasserted)
2771 BNX2X_ERR("IGU BUG!\n"); 2775 BNX2X_ERR("IGU ERROR\n");
2772 2776
2773 reg_addr = port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 : 2777 reg_addr = port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 :
2774 MISC_REG_AEU_MASK_ATTN_FUNC_0; 2778 MISC_REG_AEU_MASK_ATTN_FUNC_0;
2775 2779
2776 DP(NETIF_MSG_HW, "aeu_mask %x\n", bp->aeu_mask); 2780 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_PORT0_ATT_MASK + port);
2777 bp->aeu_mask |= (deasserted & 0xff); 2781 aeu_mask = REG_RD(bp, reg_addr);
2782
2783 DP(NETIF_MSG_HW, "aeu_mask %x newly deasserted %x\n",
2784 aeu_mask, deasserted);
2785 aeu_mask |= (deasserted & 0xff);
2786 DP(NETIF_MSG_HW, "new mask %x\n", aeu_mask);
2778 2787
2779 DP(NETIF_MSG_HW, "new mask %x\n", bp->aeu_mask); 2788 REG_WR(bp, reg_addr, aeu_mask);
2780 REG_WR(bp, reg_addr, bp->aeu_mask); 2789 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_PORT0_ATT_MASK + port);
2781 2790
2782 DP(NETIF_MSG_HW, "attn_state %x\n", bp->attn_state); 2791 DP(NETIF_MSG_HW, "attn_state %x\n", bp->attn_state);
2783 bp->attn_state &= ~deasserted; 2792 bp->attn_state &= ~deasserted;
@@ -4083,9 +4092,6 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
4083 reg_offset + 0xc + 0x10*index); 4092 reg_offset + 0xc + 0x10*index);
4084 } 4093 }
4085 4094
4086 bp->aeu_mask = REG_RD(bp, (port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 :
4087 MISC_REG_AEU_MASK_ATTN_FUNC_0));
4088
4089 reg_offset = (port ? HC_REG_ATTN_MSG1_ADDR_L : 4095 reg_offset = (port ? HC_REG_ATTN_MSG1_ADDR_L :
4090 HC_REG_ATTN_MSG0_ADDR_L); 4096 HC_REG_ATTN_MSG0_ADDR_L);
4091 4097
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h
index 3f65dffb6d76..f72ffd29e379 100644
--- a/drivers/net/bnx2x_reg.h
+++ b/drivers/net/bnx2x_reg.h
@@ -5015,6 +5015,7 @@
5015#define HW_LOCK_MAX_RESOURCE_VALUE 31 5015#define HW_LOCK_MAX_RESOURCE_VALUE 31
5016#define HW_LOCK_RESOURCE_8072_MDIO 0 5016#define HW_LOCK_RESOURCE_8072_MDIO 0
5017#define HW_LOCK_RESOURCE_GPIO 1 5017#define HW_LOCK_RESOURCE_GPIO 1
5018#define HW_LOCK_RESOURCE_PORT0_ATT_MASK 3
5018#define HW_LOCK_RESOURCE_SPIO 2 5019#define HW_LOCK_RESOURCE_SPIO 2
5019#define HW_LOCK_RESOURCE_UNDI 5 5020#define HW_LOCK_RESOURCE_UNDI 5
5020#define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (1<<18) 5021#define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (1<<18)