regs.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*******************************************************************************
  2. Intel(R) 82576 Virtual Function Linux driver
  3. Copyright(c) 2009 - 2010 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #ifndef _E1000_REGS_H_
  21. #define _E1000_REGS_H_
  22. #define E1000_CTRL 0x00000 /* Device Control - RW */
  23. #define E1000_STATUS 0x00008 /* Device Status - RO */
  24. #define E1000_ITR 0x000C4 /* Interrupt Throttling Rate - RW */
  25. #define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */
  26. #define E1000_EITR(_n) (0x01680 + (0x4 * (_n)))
  27. #define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */
  28. #define E1000_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */
  29. #define E1000_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */
  30. #define E1000_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */
  31. #define E1000_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */
  32. #define E1000_IVAR0 0x01700 /* Interrupt Vector Allocation (array) - RW */
  33. #define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */
  34. /*
  35. * Convenience macros
  36. *
  37. * Note: "_n" is the queue number of the register to be written to.
  38. *
  39. * Example usage:
  40. * E1000_RDBAL_REG(current_rx_queue)
  41. */
  42. #define E1000_RDBAL(_n) ((_n) < 4 ? (0x02800 + ((_n) * 0x100)) : \
  43. (0x0C000 + ((_n) * 0x40)))
  44. #define E1000_RDBAH(_n) ((_n) < 4 ? (0x02804 + ((_n) * 0x100)) : \
  45. (0x0C004 + ((_n) * 0x40)))
  46. #define E1000_RDLEN(_n) ((_n) < 4 ? (0x02808 + ((_n) * 0x100)) : \
  47. (0x0C008 + ((_n) * 0x40)))
  48. #define E1000_SRRCTL(_n) ((_n) < 4 ? (0x0280C + ((_n) * 0x100)) : \
  49. (0x0C00C + ((_n) * 0x40)))
  50. #define E1000_RDH(_n) ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \
  51. (0x0C010 + ((_n) * 0x40)))
  52. #define E1000_RDT(_n) ((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : \
  53. (0x0C018 + ((_n) * 0x40)))
  54. #define E1000_RXDCTL(_n) ((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : \
  55. (0x0C028 + ((_n) * 0x40)))
  56. #define E1000_TDBAL(_n) ((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : \
  57. (0x0E000 + ((_n) * 0x40)))
  58. #define E1000_TDBAH(_n) ((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : \
  59. (0x0E004 + ((_n) * 0x40)))
  60. #define E1000_TDLEN(_n) ((_n) < 4 ? (0x03808 + ((_n) * 0x100)) : \
  61. (0x0E008 + ((_n) * 0x40)))
  62. #define E1000_TDH(_n) ((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : \
  63. (0x0E010 + ((_n) * 0x40)))
  64. #define E1000_TDT(_n) ((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : \
  65. (0x0E018 + ((_n) * 0x40)))
  66. #define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : \
  67. (0x0E028 + ((_n) * 0x40)))
  68. #define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8))
  69. #define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8))
  70. #define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \
  71. (0x054E0 + ((_i - 16) * 8)))
  72. #define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \
  73. (0x054E4 + ((_i - 16) * 8)))
  74. /* Statistics registers */
  75. #define E1000_VFGPRC 0x00F10
  76. #define E1000_VFGORC 0x00F18
  77. #define E1000_VFMPRC 0x00F3C
  78. #define E1000_VFGPTC 0x00F14
  79. #define E1000_VFGOTC 0x00F34
  80. #define E1000_VFGOTLBC 0x00F50
  81. #define E1000_VFGPTLBC 0x00F44
  82. #define E1000_VFGORLBC 0x00F48
  83. #define E1000_VFGPRLBC 0x00F40
  84. /* These act per VF so an array friendly macro is used */
  85. #define E1000_V2PMAILBOX(_n) (0x00C40 + (4 * (_n)))
  86. #define E1000_VMBMEM(_n) (0x00800 + (64 * (_n)))
  87. /* Define macros for handling registers */
  88. #define er32(reg) readl(hw->hw_addr + E1000_##reg)
  89. #define ew32(reg, val) writel((val), hw->hw_addr + E1000_##reg)
  90. #define array_er32(reg, offset) \
  91. readl(hw->hw_addr + E1000_##reg + (offset << 2))
  92. #define array_ew32(reg, offset, val) \
  93. writel((val), hw->hw_addr + E1000_##reg + (offset << 2))
  94. #define e1e_flush() er32(STATUS)
  95. #endif