VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / net / tg3.h
index c837e89..5c0c104 100644 (file)
@@ -1,8 +1,9 @@
 /* $Id: tg3.h,v 1.37.2.32 2002/03/11 12:18:18 davem Exp $
  * tg3.h: Definitions for Broadcom Tigon3 ethernet driver.
  *
- * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)
+ * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
  * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com)
+ * Copyright (C) 2004 Sun Microsystems Inc.
  */
 
 #ifndef _T3_H
 #define  CHIPREV_ID_5704_A0             0x2000
 #define  CHIPREV_ID_5704_A1             0x2001
 #define  CHIPREV_ID_5704_A2             0x2002
+#define  CHIPREV_ID_5704_A3             0x2003
 #define  CHIPREV_ID_5705_A0             0x3000
 #define  CHIPREV_ID_5705_A1             0x3001
+#define  CHIPREV_ID_5705_A2             0x3002
+#define  CHIPREV_ID_5705_A3             0x3003
+#define  CHIPREV_ID_5750_A0             0x4000
+#define  CHIPREV_ID_5750_A1             0x4001
 #define  GET_ASIC_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700                         0x07
 #define   ASIC_REV_5701                         0x00
 #define   ASIC_REV_5703                         0x01
 #define   ASIC_REV_5704                         0x02
 #define   ASIC_REV_5705                         0x03
+#define   ASIC_REV_5750                         0x04
 #define  GET_CHIP_REV(CHIP_REV_ID)     ((CHIP_REV_ID) >> 8)
 #define   CHIPREV_5700_AX               0x70
 #define   CHIPREV_5700_BX               0x71
 #define  DMA_RWCTRL_READ_BNDRY_MASK     0x00000700
 #define  DMA_RWCTRL_READ_BNDRY_DISAB    0x00000000
 #define  DMA_RWCTRL_READ_BNDRY_16       0x00000100
+#define  DMA_RWCTRL_READ_BNDRY_128_PCIX         0x00000100
 #define  DMA_RWCTRL_READ_BNDRY_32       0x00000200
+#define  DMA_RWCTRL_READ_BNDRY_256_PCIX         0x00000200
 #define  DMA_RWCTRL_READ_BNDRY_64       0x00000300
+#define  DMA_RWCTRL_READ_BNDRY_384_PCIX         0x00000300
 #define  DMA_RWCTRL_READ_BNDRY_128      0x00000400
 #define  DMA_RWCTRL_READ_BNDRY_256      0x00000500
 #define  DMA_RWCTRL_READ_BNDRY_512      0x00000600
 #define  DMA_RWCTRL_WRITE_BNDRY_MASK    0x00003800
 #define  DMA_RWCTRL_WRITE_BNDRY_DISAB   0x00000000
 #define  DMA_RWCTRL_WRITE_BNDRY_16      0x00000800
+#define  DMA_RWCTRL_WRITE_BNDRY_128_PCIX 0x00000800
 #define  DMA_RWCTRL_WRITE_BNDRY_32      0x00001000
+#define  DMA_RWCTRL_WRITE_BNDRY_256_PCIX 0x00001000
 #define  DMA_RWCTRL_WRITE_BNDRY_64      0x00001800
+#define  DMA_RWCTRL_WRITE_BNDRY_384_PCIX 0x00001800
 #define  DMA_RWCTRL_WRITE_BNDRY_128     0x00002000
 #define  DMA_RWCTRL_WRITE_BNDRY_256     0x00002800
 #define  DMA_RWCTRL_WRITE_BNDRY_512     0x00003000
 #define  DMA_RWCTRL_PCI_READ_CMD_SHIFT  24
 #define  DMA_RWCTRL_PCI_WRITE_CMD       0xf0000000
 #define  DMA_RWCTRL_PCI_WRITE_CMD_SHIFT         28
+#define  DMA_RWCTRL_WRITE_BNDRY_64_PCIE         0x10000000
+#define  DMA_RWCTRL_WRITE_BNDRY_128_PCIE 0x30000000
+#define  DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE 0x70000000
 #define TG3PCI_PCISTATE                        0x00000070
 #define  PCISTATE_FORCE_RESET           0x00000001
 #define  PCISTATE_INT_NOT_ACTIVE        0x00000002
 #define TG3PCI_STD_RING_PROD_IDX       0x00000098 /* 64-bit */
 #define TG3PCI_RCV_RET_RING_CON_IDX    0x000000a0 /* 64-bit */
 #define TG3PCI_SND_PROD_IDX            0x000000a8 /* 64-bit */
-/* 0xb0 --> 0x100 unused */
+/* 0xb0 --> 0xb8 unused */
+#define TG3PCI_DUAL_MAC_CTRL           0x000000b8
+#define  DUAL_MAC_CTRL_CH_MASK          0x00000003
+#define  DUAL_MAC_CTRL_ID               0x00000004
+/* 0xbc --> 0x100 unused */
 
 /* 0x100 --> 0x200 unused */
 
 #define  LED_CTRL_100MBPS_STATUS        0x00000100
 #define  LED_CTRL_10MBPS_STATUS                 0x00000200
 #define  LED_CTRL_TRAFFIC_STATUS        0x00000400
-#define  LED_CTRL_MAC_MODE              0x00000000
-#define  LED_CTRL_PHY_MODE_1            0x00000800
-#define  LED_CTRL_PHY_MODE_2            0x00001000
+#define  LED_CTRL_MODE_MAC              0x00000000
+#define  LED_CTRL_MODE_PHY_1            0x00000800
+#define  LED_CTRL_MODE_PHY_2            0x00001000
+#define  LED_CTRL_MODE_SHASTA_MAC       0x00002000
+#define  LED_CTRL_MODE_SHARED           0x00004000
+#define  LED_CTRL_MODE_COMBO            0x00008000
 #define  LED_CTRL_BLINK_RATE_MASK       0x7ff80000
 #define  LED_CTRL_BLINK_RATE_SHIFT      19
 #define  LED_CTRL_BLINK_PER_OVERRIDE    0x00080000
 #define MAC_EXTADDR_11_HIGH            0x00000588
 #define MAC_EXTADDR_11_LOW             0x0000058c
 #define MAC_SERDES_CFG                 0x00000590
+#define  MAC_SERDES_CFG_EDGE_SELECT     0x00001000
 #define MAC_SERDES_STAT                        0x00000594
-/* 0x598 --> 0x600 unused */
+/* 0x598 --> 0x5b0 unused */
+#define SG_DIG_CTRL                    0x000005b0
+#define  SG_DIG_USING_HW_AUTONEG        0x80000000
+#define  SG_DIG_SOFT_RESET              0x40000000
+#define  SG_DIG_DISABLE_LINKRDY                 0x20000000
+#define  SG_DIG_CRC16_CLEAR_N           0x01000000
+#define  SG_DIG_EN10B                   0x00800000
+#define  SG_DIG_CLEAR_STATUS            0x00400000
+#define  SG_DIG_LOCAL_DUPLEX_STATUS     0x00200000
+#define  SG_DIG_LOCAL_LINK_STATUS       0x00100000
+#define  SG_DIG_SPEED_STATUS_MASK       0x000c0000
+#define  SG_DIG_SPEED_STATUS_SHIFT      18
+#define  SG_DIG_JUMBO_PACKET_DISABLE    0x00020000
+#define  SG_DIG_RESTART_AUTONEG                 0x00010000
+#define  SG_DIG_FIBER_MODE              0x00008000
+#define  SG_DIG_REMOTE_FAULT_MASK       0x00006000
+#define  SG_DIG_PAUSE_MASK              0x00001800
+#define  SG_DIG_GBIC_ENABLE             0x00000400
+#define  SG_DIG_CHECK_END_ENABLE        0x00000200
+#define  SG_DIG_SGMII_AUTONEG_TIMER     0x00000100
+#define  SG_DIG_CLOCK_PHASE_SELECT      0x00000080
+#define  SG_DIG_GMII_INPUT_SELECT       0x00000040
+#define  SG_DIG_MRADV_CRC16_SELECT      0x00000020
+#define  SG_DIG_COMMA_DETECT_ENABLE     0x00000010
+#define  SG_DIG_AUTONEG_TIMER_REDUCE    0x00000008
+#define  SG_DIG_AUTONEG_LOW_ENABLE      0x00000004
+#define  SG_DIG_REMOTE_LOOPBACK                 0x00000002
+#define  SG_DIG_LOOPBACK                0x00000001
+#define SG_DIG_STATUS                  0x000005b4
+#define  SG_DIG_CRC16_BUS_MASK          0xffff0000
+#define  SG_DIG_PARTNER_FAULT_MASK      0x00600000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_PARTNER_ASYM_PAUSE      0x00100000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_PARTNER_PAUSE_CAPABLE   0x00080000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_PARTNER_HALF_DUPLEX     0x00040000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_PARTNER_FULL_DUPLEX     0x00020000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_PARTNER_NEXT_PAGE       0x00010000 /* If !MRADV_CRC16_SELECT */
+#define  SG_DIG_AUTONEG_STATE_MASK      0x00000ff0
+#define  SG_DIG_COMMA_DETECTOR          0x00000008
+#define  SG_DIG_MAC_ACK_STATUS          0x00000004
+#define  SG_DIG_AUTONEG_COMPLETE        0x00000002
+#define  SG_DIG_AUTONEG_ERROR           0x00000001
+/* 0x5b8 --> 0x600 unused */
 #define MAC_TX_MAC_STATE_BASE          0x00000600 /* 16 bytes */
 #define MAC_RX_MAC_STATE_BASE          0x00000610 /* 20 bytes */
 /* 0x624 --> 0x800 unused */
 #define  SWARB_REQ3                     0x00008000
 #define    NVRAM_BUFFERED_PAGE_SIZE       264
 #define    NVRAM_BUFFERED_PAGE_POS        9
+#define NVRAM_ACCESS                   0x00007024
+#define  ACCESS_ENABLE                  0x00000001
+#define  ACCESS_WR_ENABLE               0x00000002
 /* 0x7024 --> 0x7400 unused */
 
 /* 0x7400 --> 0x8000 unused */
 
 #define NIC_SRAM_DATA_CFG                      0x00000b58
 #define  NIC_SRAM_DATA_CFG_LED_MODE_MASK        0x0000000c
-#define  NIC_SRAM_DATA_CFG_LED_MODE_UNKNOWN     0x00000000
-#define  NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD       0x00000004
-#define  NIC_SRAM_DATA_CFG_LED_OPEN_DRAIN       0x00000004
-#define  NIC_SRAM_DATA_CFG_LED_LINK_SPD                 0x00000008
-#define  NIC_SRAM_DATA_CFG_LED_OUTPUT           0x00000008
+#define  NIC_SRAM_DATA_CFG_LED_MODE_MAC                 0x00000000
+#define  NIC_SRAM_DATA_CFG_LED_MODE_PHY_1       0x00000004
+#define  NIC_SRAM_DATA_CFG_LED_MODE_PHY_2       0x00000008
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_MASK        0x00000030
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_UNKNOWN     0x00000000
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_COPPER      0x00000010
 #define NIC_SRAM_FW_ASF_STATUS_MBOX    0x00000c00
 #define NIC_SRAM_FW_DRV_STATE_MBOX     0x00000c04
 #define  DRV_STATE_START                0x00000001
+#define  DRV_STATE_START_DONE           0x80000001
 #define  DRV_STATE_UNLOAD               0x00000002
+#define  DRV_STATE_UNLOAD_DONE          0x80000002
 #define  DRV_STATE_WOL                  0x00000003
 #define  DRV_STATE_SUSPEND              0x00000004
 
 #define NIC_SRAM_MAC_ADDR_HIGH_MBOX    0x00000c14
 #define NIC_SRAM_MAC_ADDR_LOW_MBOX     0x00000c18
 
+#define NIC_SRAM_DATA_CFG_2            0x00000d38
+
+#define  SHASTA_EXT_LED_MODE_MASK       0x00018000
+#define  SHASTA_EXT_LED_LEGACY          0x00000000
+#define  SHASTA_EXT_LED_SHARED          0x00008000
+#define  SHASTA_EXT_LED_MAC             0x00010000
+#define  SHASTA_EXT_LED_COMBO           0x00018000
+
 #define NIC_SRAM_RX_MINI_BUFFER_DESC   0x00001000
 
 #define NIC_SRAM_DMA_DESC_POOL_BASE    0x00002000
@@ -1756,12 +1832,6 @@ struct tg3_hw_stats {
        u8                              __reserved4[0xb00-0x9c0];
 };
 
-enum phy_led_mode {
-       led_mode_auto,
-       led_mode_three_link,
-       led_mode_link10
-};
-
 /* 'mapping' is superfluous as the chip does not write into
  * the tx/rx post rings so we could just fetch it from there.
  * But the cache behavior is better how we are doing it now.
@@ -1819,10 +1889,13 @@ struct tg3_bufmgr_config {
 
 struct tg3_ethtool_stats {
        /* Statistics maintained by Receive MAC. */
+       u64             rx_octets;
        u64             rx_fragments;
        u64             rx_ucast_packets;
+       u64             rx_mcast_packets;
        u64             rx_bcast_packets;
        u64             rx_fcs_errors;
+       u64             rx_align_errors;
        u64             rx_xon_pause_rcvd;
        u64             rx_xoff_pause_rcvd;
        u64             rx_mac_ctrl_rcvd;
@@ -1832,8 +1905,20 @@ struct tg3_ethtool_stats {
        u64             rx_undersize_packets;
        u64             rx_in_length_errors;
        u64             rx_out_length_errors;
+       u64             rx_64_or_less_octet_packets;
+       u64             rx_65_to_127_octet_packets;
+       u64             rx_128_to_255_octet_packets;
+       u64             rx_256_to_511_octet_packets;
+       u64             rx_512_to_1023_octet_packets;
+       u64             rx_1024_to_1522_octet_packets;
+       u64             rx_1523_to_2047_octet_packets;
+       u64             rx_2048_to_4095_octet_packets;
+       u64             rx_4096_to_8191_octet_packets;
+       u64             rx_8192_to_9022_octet_packets;
 
        /* Statistics maintained by Transmit MAC. */
+       u64             tx_octets;
+       u64             tx_collisions;
        u64             tx_xon_sent;
        u64             tx_xoff_sent;
        u64             tx_flow_control;
@@ -1843,9 +1928,46 @@ struct tg3_ethtool_stats {
        u64             tx_deferred;
        u64             tx_excessive_collisions;
        u64             tx_late_collisions;
+       u64             tx_collide_2times;
+       u64             tx_collide_3times;
+       u64             tx_collide_4times;
+       u64             tx_collide_5times;
+       u64             tx_collide_6times;
+       u64             tx_collide_7times;
+       u64             tx_collide_8times;
+       u64             tx_collide_9times;
+       u64             tx_collide_10times;
+       u64             tx_collide_11times;
+       u64             tx_collide_12times;
+       u64             tx_collide_13times;
+       u64             tx_collide_14times;
+       u64             tx_collide_15times;
        u64             tx_ucast_packets;
        u64             tx_mcast_packets;
        u64             tx_bcast_packets;
+       u64             tx_carrier_sense_errors;
+       u64             tx_discards;
+       u64             tx_errors;
+
+       /* Statistics maintained by Receive List Placement. */
+       u64             dma_writeq_full;
+       u64             dma_write_prioq_full;
+       u64             rxbds_empty;
+       u64             rx_discards;
+       u64             rx_errors;
+       u64             rx_threshold_hit;
+
+       /* Statistics maintained by Send Data Initiator. */
+       u64             dma_readq_full;
+       u64             dma_read_prioq_full;
+       u64             tx_comp_queue_full;
+
+       /* Statistics maintained by Host Coalescing. */
+       u64             ring_set_send_prod_index;
+       u64             ring_status_update;
+       u64             nic_irqs;
+       u64             nic_avoided_irqs;
+       u64             nic_tx_threshold_hit;
 };
 
 struct tg3 {
@@ -1964,6 +2086,9 @@ struct tg3 {
 #define TG3_FLG2_PHY_ADC_BUG           0x00000040
 #define TG3_FLG2_PHY_5704_A0_BUG       0x00000080
 #define TG3_FLG2_PHY_BER_BUG           0x00000100
+#define TG3_FLG2_PCI_EXPRESS           0x00000200
+#define TG3_FLG2_ASF_NEW_HANDSHAKE     0x00000400
+#define TG3_FLG2_HW_AUTONEG            0x00000800
 
        u32                             split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ                3
@@ -2009,6 +2134,7 @@ struct tg3 {
 #define PHY_ID_BCM5703                 0x60008160
 #define PHY_ID_BCM5704                 0x60008190
 #define PHY_ID_BCM5705                 0x600081a0
+#define PHY_ID_BCM5750                 0x60008180
 #define PHY_ID_BCM8002                 0x60010140
 #define PHY_ID_SERDES                  0xfeedbee0
 #define PHY_ID_INVALID                 0xffffffff
@@ -2018,7 +2144,7 @@ struct tg3 {
 #define PHY_REV_BCM5401_C0             0x6
 #define PHY_REV_BCM5411_X0             0x1 /* Found on Netgear GA302T */
 
-       enum phy_led_mode               led_mode;
+       u32                             led_ctrl;
 
        char                            board_part_number[24];
        u32                             nic_sram_data_cfg;
@@ -2032,7 +2158,7 @@ struct tg3 {
        ((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \
         (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
         (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
-        (X) == PHY_ID_BCM5705 || \
+        (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
         (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES)
 
        struct tg3_hw_stats             *hw_stats;