aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bnx2x.h')
-rw-r--r--drivers/net/bnx2x.h99
1 files changed, 74 insertions, 25 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 2a13defda8ab..0979ca0ae408 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -557,25 +557,37 @@ struct bnx2x {
557 557
558 u32 shmem_base; 558 u32 shmem_base;
559 559
560 u32 chip_id; 560 u32 chip_id;
561/* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ 561/* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */
562#define CHIP_ID(bp) (((bp)->chip_id) & 0xfffffff0) 562#define CHIP_ID(bp) (bp->chip_id & 0xfffffff0)
563 563
564#define CHIP_NUM(bp) (((bp)->chip_id) & 0xffff0000) 564#define CHIP_NUM(bp) (bp->chip_id >> 16)
565 565#define CHIP_NUM_57710 0x164e
566#define CHIP_REV(bp) (((bp)->chip_id) & 0x0000f000) 566#define CHIP_NUM_57711 0x164f
567#define CHIP_REV_Ax 0x00000000 567#define CHIP_NUM_57711E 0x1650
568#define CHIP_REV_Bx 0x00001000 568#define CHIP_IS_E1(bp) (CHIP_NUM(bp) == CHIP_NUM_57710)
569#define CHIP_REV_Cx 0x00002000 569#define CHIP_IS_57711(bp) (CHIP_NUM(bp) == CHIP_NUM_57711)
570#define CHIP_REV_EMUL 0x0000e000 570#define CHIP_IS_57711E(bp) (CHIP_NUM(bp) == CHIP_NUM_57711E)
571#define CHIP_REV_FPGA 0x0000f000 571#define CHIP_IS_E1H(bp) (CHIP_IS_57711(bp) || \
572#define CHIP_REV_IS_SLOW(bp) ((CHIP_REV(bp) == CHIP_REV_EMUL) || \ 572 CHIP_IS_57711E(bp))
573 (CHIP_REV(bp) == CHIP_REV_FPGA)) 573#define IS_E1H_OFFSET CHIP_IS_E1H(bp)
574#define CHIP_REV_IS_EMUL(bp) (CHIP_REV(bp) == CHIP_REV_EMUL) 574
575#define CHIP_REV_IS_FPGA(bp) (CHIP_REV(bp) == CHIP_REV_FPGA) 575#define CHIP_REV(bp) (bp->chip_id & 0x0000f000)
576 576#define CHIP_REV_Ax 0x00000000
577#define CHIP_METAL(bp) (((bp)->chip_id) & 0x00000ff0) 577/* assume maximum 5 revisions */
578#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0x0000000f) 578#define CHIP_REV_IS_SLOW(bp) (CHIP_REV(bp) > 0x00005000)
579/* Emul versions are A=>0xe, B=>0xc, C=>0xa, D=>8, E=>6 */
580#define CHIP_REV_IS_EMUL(bp) ((CHIP_REV_IS_SLOW(bp)) && \
581 !(CHIP_REV(bp) & 0x00001000))
582/* FPGA versions are A=>0xf, B=>0xd, C=>0xb, D=>9, E=>7 */
583#define CHIP_REV_IS_FPGA(bp) ((CHIP_REV_IS_SLOW(bp)) && \
584 (CHIP_REV(bp) & 0x00001000))
585
586#define CHIP_TIME(bp) ((CHIP_REV_IS_EMUL(bp)) ? 2000 : \
587 ((CHIP_REV_IS_FPGA(bp)) ? 200 : 1))
588
589#define CHIP_METAL(bp) (bp->chip_id & 0x00000ff0)
590#define CHIP_BOND_ID(bp) (bp->chip_id & 0x0000000f)
579 591
580 u16 fw_seq; 592 u16 fw_seq;
581 u16 fw_drv_pulse_wr_seq; 593 u16 fw_drv_pulse_wr_seq;
@@ -678,6 +690,13 @@ struct bnx2x {
678 struct dmae_command dmae; 690 struct dmae_command dmae;
679 int executer_idx; 691 int executer_idx;
680 692
693 int dmae_ready;
694 /* used to synchronize dmae accesses */
695 struct mutex dmae_mutex;
696 struct dmae_command init_dmae;
697
698
699
681 u32 old_brb_discard; 700 u32 old_brb_discard;
682 struct bmac_stats old_bmac; 701 struct bmac_stats old_bmac;
683 struct tstorm_per_client_stats old_tclient; 702 struct tstorm_per_client_stats old_tclient;
@@ -685,7 +704,7 @@ struct bnx2x {
685 void *gunzip_buf; 704 void *gunzip_buf;
686 dma_addr_t gunzip_mapping; 705 dma_addr_t gunzip_mapping;
687 int gunzip_outlen; 706 int gunzip_outlen;
688#define FW_BUF_SIZE 0x8000 707#define FW_BUF_SIZE 0x8000
689 708
690}; 709};
691 710
@@ -774,12 +793,6 @@ int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode);
774#define STROM_ASSERT_ARRAY_SIZE 50 793#define STROM_ASSERT_ARRAY_SIZE 50
775 794
776 795
777#define MDIO_INDIRECT_REG_ADDR 0x1f
778#define MDIO_SET_REG_BANK(bp, reg_bank) \
779 bnx2x_mdio22_write(bp, MDIO_INDIRECT_REG_ADDR, reg_bank)
780
781#define MDIO_ACCESS_TIMEOUT 1000
782
783 796
784/* must be used on a CID before placing it on a HW ring */ 797/* must be used on a CID before placing it on a HW ring */
785#define HW_CID(bp, x) (x | (bp->port << 23)) 798#define HW_CID(bp, x) (x | (bp->port << 23))
@@ -818,6 +831,42 @@ int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode);
818 DPM_TRIGER_TYPE); \ 831 DPM_TRIGER_TYPE); \
819 } while (0) 832 } while (0)
820 833
834/* DMAE command defines */
835#define DMAE_CMD_SRC_PCI 0
836#define DMAE_CMD_SRC_GRC DMAE_COMMAND_SRC
837
838#define DMAE_CMD_DST_PCI (1 << DMAE_COMMAND_DST_SHIFT)
839#define DMAE_CMD_DST_GRC (2 << DMAE_COMMAND_DST_SHIFT)
840
841#define DMAE_CMD_C_DST_PCI 0
842#define DMAE_CMD_C_DST_GRC (1 << DMAE_COMMAND_C_DST_SHIFT)
843
844#define DMAE_CMD_C_ENABLE DMAE_COMMAND_C_TYPE_ENABLE
845
846#define DMAE_CMD_ENDIANITY_NO_SWAP (0 << DMAE_COMMAND_ENDIANITY_SHIFT)
847#define DMAE_CMD_ENDIANITY_B_SWAP (1 << DMAE_COMMAND_ENDIANITY_SHIFT)
848#define DMAE_CMD_ENDIANITY_DW_SWAP (2 << DMAE_COMMAND_ENDIANITY_SHIFT)
849#define DMAE_CMD_ENDIANITY_B_DW_SWAP (3 << DMAE_COMMAND_ENDIANITY_SHIFT)
850
851#define DMAE_CMD_PORT_0 0
852#define DMAE_CMD_PORT_1 DMAE_COMMAND_PORT
853
854#define DMAE_CMD_SRC_RESET DMAE_COMMAND_SRC_RESET
855#define DMAE_CMD_DST_RESET DMAE_COMMAND_DST_RESET
856#define DMAE_CMD_E1HVN_SHIFT DMAE_COMMAND_E1HVN_SHIFT
857
858#define DMAE_LEN32_RD_MAX 0x80
859#define DMAE_LEN32_WR_MAX 0x400
860
861#define DMAE_COMP_VAL 0xe0d0d0ae
862
863#define MAX_DMAE_C_PER_PORT 8
864#define INIT_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \
865 BP_E1HVN(bp))
866#define PMF_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \
867 E1HVN_MAX)
868
869
821/* PCIE link and speed */ 870/* PCIE link and speed */
822#define PCICFG_LINK_WIDTH 0x1f00000 871#define PCICFG_LINK_WIDTH 0x1f00000
823#define PCICFG_LINK_WIDTH_SHIFT 20 872#define PCICFG_LINK_WIDTH_SHIFT 20