netxen_nic_phan_reg.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. /*
  35. * The following 2 are the base adresses for the CRB registers and their
  36. * offsets will be added to get addresses for the index addresses.
  37. */
  38. #define NIC_CRB_BASE_PORT1 NETXEN_CAM_RAM(0x200)
  39. #define NIC_CRB_BASE_PORT2 NETXEN_CAM_RAM(0x250)
  40. #define NETXEN_NIC_REG(X) (NIC_CRB_BASE_PORT1+(X))
  41. /*
  42. * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
  43. * which can be read by the Phantom host to get producer/consumer indexes from
  44. * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
  45. * registers will be used for the addresses of the ring's shared memory
  46. * on the Phantom.
  47. */
  48. #define CRB_PHAN_CNTRL_LO_OFFSET NETXEN_NIC_REG(0x00)
  49. #define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_NIC_REG(0x04)
  50. /* point to the indexes */
  51. #define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08)
  52. #define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c)
  53. /* address of command descriptors in the host memory */
  54. #define CRB_HOST_CMD_ADDR_HI NETXEN_NIC_REG(0x30)
  55. #define CRB_HOST_CMD_ADDR_LO NETXEN_NIC_REG(0x34)
  56. /* The following 4 CRB registers are for doing performance coal */
  57. #define CRB_CMD_INTR_LOOP NETXEN_NIC_REG(0x38)
  58. #define CRB_CMD_DMA_LOOP NETXEN_NIC_REG(0x3c)
  59. #define CRB_RCV_INTR_LOOP NETXEN_NIC_REG(0x40)
  60. #define CRB_RCV_DMA_LOOP NETXEN_NIC_REG(0x44)
  61. /* Needed by the host to find out the state of Phantom's initialization */
  62. #define CRB_ENABLE_TX_INTR NETXEN_NIC_REG(0x4c)
  63. #define CRB_CMDPEG_STATE NETXEN_NIC_REG(0x50)
  64. #define CRB_CMDPEG_CMDRING NETXEN_NIC_REG(0x54)
  65. /* Interrupt coalescing parameters */
  66. #define CRB_GLOBAL_INT_COAL NETXEN_NIC_REG(0x80)
  67. #define CRB_INT_COAL_MODE NETXEN_NIC_REG(0x84)
  68. #define CRB_MAX_RCV_BUFS NETXEN_NIC_REG(0x88)
  69. #define CRB_TX_INT_THRESHOLD NETXEN_NIC_REG(0x8c)
  70. #define CRB_RX_PKT_TIMER NETXEN_NIC_REG(0x90)
  71. #define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x94)
  72. #define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x98)
  73. #define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x9c)
  74. /* Register for communicating XG link status */
  75. #define CRB_XG_STATE NETXEN_NIC_REG(0xa0)
  76. /* Debug registers for controlling NIC pkt gen agent */
  77. #define CRB_AGENT_GO NETXEN_NIC_REG(0xb0)
  78. #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0xb4)
  79. #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xb8)
  80. #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xbc)
  81. #define CRB_AGENT_TX_MSS NETXEN_NIC_REG(0xc0)
  82. /* Debug registers for observing NIC performance */
  83. #define CRB_TX_STATE NETXEN_NIC_REG(0xd0)
  84. #define CRB_TX_COUNT NETXEN_NIC_REG(0xd4)
  85. #define CRB_RX_STATE NETXEN_NIC_REG(0xd8)
  86. /* CRB registers per Rcv Descriptor ring */
  87. struct netxen_rcv_desc_crb {
  88. u32 crb_rcv_producer_offset __attribute__ ((aligned(512)));
  89. u32 crb_rcv_consumer_offset;
  90. u32 crb_globalrcv_ring;
  91. };
  92. /*
  93. * CRB registers used by the receive peg logic. One instance of these
  94. * needs to be instantiated per instance of the receive peg.
  95. */
  96. struct netxen_recv_crb {
  97. struct netxen_rcv_desc_crb rcv_desc_crb[NUM_RCV_DESC_RINGS];
  98. u32 crb_rcvstatus_ring;
  99. u32 crb_rcv_status_producer;
  100. u32 crb_rcv_status_consumer;
  101. u32 crb_rcvpeg_state;
  102. };
  103. #if defined(DEFINE_GLOBAL_RECV_CRB)
  104. struct netxen_recv_crb recv_crb_registers[] = {
  105. /*
  106. * Instance 0.
  107. */
  108. {
  109. /* rcv_desc_crb: */
  110. {
  111. {
  112. /* crb_rcv_producer_offset: */
  113. NETXEN_NIC_REG(0x18),
  114. /* crb_rcv_consumer_offset: */
  115. NETXEN_NIC_REG(0x1c),
  116. /* crb_gloablrcv_ring: */
  117. NETXEN_NIC_REG(0x20),
  118. },
  119. /* Jumbo frames */
  120. {
  121. /* crb_rcv_producer_offset: */
  122. NETXEN_NIC_REG(0x100),
  123. /* crb_rcv_consumer_offset: */
  124. NETXEN_NIC_REG(0x104),
  125. /* crb_gloablrcv_ring: */
  126. NETXEN_NIC_REG(0x108),
  127. }
  128. },
  129. /* crb_rcvstatus_ring: */
  130. NETXEN_NIC_REG(0x24),
  131. /* crb_rcv_status_producer: */
  132. NETXEN_NIC_REG(0x28),
  133. /* crb_rcv_status_consumer: */
  134. NETXEN_NIC_REG(0x2c),
  135. /* crb_rcvpeg_state: */
  136. NETXEN_NIC_REG(0x48),
  137. },
  138. /*
  139. * Instance 1,
  140. */
  141. {
  142. /* rcv_desc_crb: */
  143. {
  144. {
  145. /* crb_rcv_producer_offset: */
  146. NETXEN_NIC_REG(0x80),
  147. /* crb_rcv_consumer_offset: */
  148. NETXEN_NIC_REG(0x84),
  149. /* crb_globalrcv_ring: */
  150. NETXEN_NIC_REG(0x88),
  151. },
  152. /* Jumbo frames */
  153. {
  154. /* crb_rcv_producer_offset: */
  155. NETXEN_NIC_REG(0x10C),
  156. /* crb_rcv_consumer_offset: */
  157. NETXEN_NIC_REG(0x110),
  158. /* crb_globalrcv_ring: */
  159. NETXEN_NIC_REG(0x114),
  160. }
  161. },
  162. /* crb_rcvstatus_ring: */
  163. NETXEN_NIC_REG(0x8c),
  164. /* crb_rcv_status_producer: */
  165. NETXEN_NIC_REG(0x90),
  166. /* crb_rcv_status_consumer: */
  167. NETXEN_NIC_REG(0x94),
  168. /* crb_rcvpeg_state: */
  169. NETXEN_NIC_REG(0x98),
  170. },
  171. };
  172. #else
  173. extern struct netxen_recv_crb recv_crb_registers[];
  174. #endif /* DEFINE_GLOBAL_RECEIVE_CRB */
  175. #endif /* __NIC_PHAN_REG_H_ */