netxen_nic_phan_reg.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * Copyright (C) 2003 - 2006 NetXen, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  18. * MA 02111-1307, USA.
  19. *
  20. * The full GNU General Public License is included in this distribution
  21. * in the file called LICENSE.
  22. *
  23. * Contact Information:
  24. * info@netxen.com
  25. * NetXen,
  26. * 3965 Freedom Circle, Fourth floor,
  27. * Santa Clara, CA 95054
  28. */
  29. #ifndef __NIC_PHAN_REG_H_
  30. #define __NIC_PHAN_REG_H_
  31. /*
  32. * CRB Registers or queue message done only at initialization time.
  33. */
  34. #define NIC_CRB_BASE NETXEN_CAM_RAM(0x200)
  35. #define NETXEN_NIC_REG(X) (NIC_CRB_BASE+(X))
  36. #define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00)
  37. #define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04)
  38. #define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08)
  39. #define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c)
  40. #define CRB_PAUSE_ADDR_LO NETXEN_NIC_REG(0x10) /* C0 EPG BUG */
  41. #define CRB_PAUSE_ADDR_HI NETXEN_NIC_REG(0x14)
  42. #define CRB_HOST_CMD_ADDR_HI NETXEN_NIC_REG(0x18) /* host add:cmd ring */
  43. #define CRB_HOST_CMD_ADDR_LO NETXEN_NIC_REG(0x1c)
  44. #define CRB_CMD_INTR_LOOP NETXEN_NIC_REG(0x20) /* 4 regs for perf */
  45. #define CRB_CMD_DMA_LOOP NETXEN_NIC_REG(0x24)
  46. #define CRB_RCV_INTR_LOOP NETXEN_NIC_REG(0x28)
  47. #define CRB_RCV_DMA_LOOP NETXEN_NIC_REG(0x2c)
  48. #define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x30) /* phantom init status */
  49. #define CRB_MMAP_ADDR_3 NETXEN_NIC_REG(0x34)
  50. #define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x38)
  51. #define CRB_HOST_DUMMY_BUF_ADDR_HI NETXEN_NIC_REG(0x3c)
  52. #define CRB_HOST_DUMMY_BUF_ADDR_LO NETXEN_NIC_REG(0x40)
  53. #define CRB_MMAP_ADDR_0 NETXEN_NIC_REG(0x44)
  54. #define CRB_MMAP_ADDR_1 NETXEN_NIC_REG(0x48)
  55. #define CRB_MMAP_ADDR_2 NETXEN_NIC_REG(0x4c)
  56. #define CRB_CMDPEG_STATE NETXEN_NIC_REG(0x50)
  57. #define CRB_MMAP_SIZE_0 NETXEN_NIC_REG(0x54)
  58. #define CRB_MMAP_SIZE_1 NETXEN_NIC_REG(0x58)
  59. #define CRB_MMAP_SIZE_2 NETXEN_NIC_REG(0x5c)
  60. #define CRB_MMAP_SIZE_3 NETXEN_NIC_REG(0x60)
  61. #define CRB_GLOBAL_INT_COAL NETXEN_NIC_REG(0x64) /* interrupt coalescing */
  62. #define CRB_INT_COAL_MODE NETXEN_NIC_REG(0x68)
  63. #define CRB_MAX_RCV_BUFS NETXEN_NIC_REG(0x6c)
  64. #define CRB_TX_INT_THRESHOLD NETXEN_NIC_REG(0x70)
  65. #define CRB_RX_PKT_TIMER NETXEN_NIC_REG(0x74)
  66. #define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x78)
  67. #define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x7c)
  68. #define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x80)
  69. #define CRB_RX_LRO_TIMER NETXEN_NIC_REG(0x84)
  70. #define CRB_RX_LRO_MID_TIMER NETXEN_NIC_REG(0x88)
  71. #define CRB_DMA_MAX_RCV_BUFS NETXEN_NIC_REG(0x8c)
  72. #define CRB_MAX_DMA_ENTRIES NETXEN_NIC_REG(0x90)
  73. #define CRB_XG_STATE NETXEN_NIC_REG(0x94) /* XG Link status */
  74. #define CRB_AGENT_GO NETXEN_NIC_REG(0x98) /* NIC pkt gen agent */
  75. #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0x9c)
  76. #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xa0)
  77. #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xa4)
  78. #define CRB_AGENT_TX_MSS NETXEN_NIC_REG(0xa8)
  79. #define CRB_TX_STATE NETXEN_NIC_REG(0xac) /* Debug -performance */
  80. #define CRB_TX_COUNT NETXEN_NIC_REG(0xb0)
  81. #define CRB_RX_STATE NETXEN_NIC_REG(0xb4)
  82. #define CRB_RX_PERF_DEBUG_1 NETXEN_NIC_REG(0xb8)
  83. #define CRB_RX_LRO_CONTROL NETXEN_NIC_REG(0xbc) /* LRO On/OFF */
  84. #define CRB_RX_LRO_START_NUM NETXEN_NIC_REG(0xc0)
  85. #define CRB_MPORT_MODE NETXEN_NIC_REG(0xc4) /* Multiport Mode */
  86. #define CRB_CMD_RING_SIZE NETXEN_NIC_REG(0xc8)
  87. #define CRB_INT_VECTOR NETXEN_NIC_REG(0xd4)
  88. #define CRB_CTX_RESET NETXEN_NIC_REG(0xd8)
  89. #define CRB_HOST_STS_PROD NETXEN_NIC_REG(0xdc)
  90. #define CRB_HOST_STS_CONS NETXEN_NIC_REG(0xe0)
  91. #define CRB_PEG_CMD_PROD NETXEN_NIC_REG(0xe4)
  92. #define CRB_PEG_CMD_CONS NETXEN_NIC_REG(0xe8)
  93. #define CRB_HOST_BUFFER_PROD NETXEN_NIC_REG(0xec)
  94. #define CRB_HOST_BUFFER_CONS NETXEN_NIC_REG(0xf0)
  95. #define CRB_JUMBO_BUFFER_PROD NETXEN_NIC_REG(0xf4)
  96. #define CRB_JUMBO_BUFFER_CONS NETXEN_NIC_REG(0xf8)
  97. #define CRB_CMD_PRODUCER_OFFSET_1 NETXEN_NIC_REG(0x1ac)
  98. #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0)
  99. #define CRB_CMD_PRODUCER_OFFSET_2 NETXEN_NIC_REG(0x1b8)
  100. #define CRB_CMD_CONSUMER_OFFSET_2 NETXEN_NIC_REG(0x1bc)
  101. // 1c0 to 1cc used for signature reg
  102. #define CRB_CMD_PRODUCER_OFFSET_3 NETXEN_NIC_REG(0x1d0)
  103. #define CRB_CMD_CONSUMER_OFFSET_3 NETXEN_NIC_REG(0x1d4)
  104. #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4)
  105. #define CRB_V2P_0 NETXEN_NIC_REG(0x290)
  106. #define CRB_V2P_1 NETXEN_NIC_REG(0x294)
  107. #define CRB_V2P_2 NETXEN_NIC_REG(0x298)
  108. #define CRB_V2P_3 NETXEN_NIC_REG(0x29c)
  109. #define CRB_V2P(port) (CRB_V2P_0+((port)*4))
  110. #define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0)
  111. /* used for ethtool tests */
  112. #define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)
  113. /*
  114. * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
  115. * which can be read by the Phantom host to get producer/consumer indexes from
  116. * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
  117. * registers will be used for the addresses of the ring's shared memory
  118. * on the Phantom.
  119. */
  120. #define nx_get_temp_val(x) ((x) >> 16)
  121. #define nx_get_temp_state(x) ((x) & 0xffff)
  122. #define nx_encode_temp(val, state) (((val) << 16) | (state))
  123. /* CRB registers per Rcv Descriptor ring */
  124. struct netxen_rcv_desc_crb {
  125. u32 crb_rcv_producer_offset __attribute__ ((aligned(512)));
  126. u32 crb_rcv_consumer_offset;
  127. u32 crb_globalrcv_ring;
  128. u32 crb_rcv_ring_size;
  129. };
  130. /*
  131. * CRB registers used by the receive peg logic.
  132. */
  133. struct netxen_recv_crb {
  134. struct netxen_rcv_desc_crb rcv_desc_crb[NUM_RCV_DESC_RINGS];
  135. u32 crb_rcvstatus_ring;
  136. u32 crb_rcv_status_producer;
  137. u32 crb_rcv_status_consumer;
  138. u32 crb_rcvpeg_state;
  139. u32 crb_status_ring_size;
  140. };
  141. #if defined(DEFINE_GLOBAL_RECV_CRB)
  142. #else
  143. extern struct netxen_recv_crb recv_crb_registers[];
  144. extern u64 ctx_addr_sig_regs[][3];
  145. #endif /* DEFINE_GLOBAL_RECEIVE_CRB */
  146. #define CRB_CTX_ADDR_REG_LO(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][0])
  147. #define CRB_CTX_ADDR_REG_HI(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][2])
  148. #define CRB_CTX_SIGNATURE_REG(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][1])
  149. /*
  150. * Temperature control.
  151. */
  152. enum {
  153. NX_TEMP_NORMAL = 0x1, /* Normal operating range */
  154. NX_TEMP_WARN, /* Sound alert, temperature getting high */
  155. NX_TEMP_PANIC /* Fatal error, hardware has shut down. */
  156. };
  157. #endif /* __NIC_PHAN_REG_H_ */