You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

e1000_osdep.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*******************************************************************************
  2. Intel PRO/1000 Linux driver
  3. Copyright(c) 1999 - 2006 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. Linux NICS <linux.nics@intel.com>
  18. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  19. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  20. *******************************************************************************/
  21. FILE_LICENCE ( GPL2_ONLY );
  22. /* glue for the OS independent part of e1000
  23. * includes register access macros
  24. */
  25. #ifndef _E1000_OSDEP_H_
  26. #define _E1000_OSDEP_H_
  27. #include <stdint.h>
  28. #include <stdlib.h>
  29. #include <stdio.h>
  30. #include <gpxe/io.h>
  31. #include <errno.h>
  32. #include <unistd.h>
  33. #include <byteswap.h>
  34. #include <gpxe/pci.h>
  35. #include <gpxe/if_ether.h>
  36. #include <gpxe/ethernet.h>
  37. #include <gpxe/iobuf.h>
  38. #include <gpxe/netdevice.h>
  39. typedef enum {
  40. #undef FALSE
  41. FALSE = 0,
  42. #undef TRUE
  43. TRUE = 1
  44. } boolean_t;
  45. /* Debugging #defines */
  46. #if 1
  47. #define DEBUGFUNC(F) DBG(F "\n")
  48. #else
  49. #define DEBUGFUNC(F)
  50. #endif
  51. #if 1
  52. #define DEBUGOUT(S) DBG(S)
  53. #define DEBUGOUT1(S, A...) DBG(S, A)
  54. #else
  55. #define DEBUGOUT(S)
  56. #define DEBUGOUT1(S, A...)
  57. #endif
  58. #define DEBUGOUT2 DEBUGOUT1
  59. #define DEBUGOUT3 DEBUGOUT1
  60. #define DEBUGOUT7 DEBUGOUT1
  61. #define E1000_WRITE_REG(a, reg, value) \
  62. writel((value), ((a)->hw_addr + \
  63. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg)))
  64. #define E1000_READ_REG(a, reg) \
  65. readl((a)->hw_addr + \
  66. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg))
  67. #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \
  68. writel((value), ((a)->hw_addr + \
  69. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  70. ((offset) << 2)))
  71. #define E1000_READ_REG_ARRAY(a, reg, offset) \
  72. readl((a)->hw_addr + \
  73. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  74. ((offset) << 2))
  75. #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
  76. #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
  77. #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) \
  78. writew((value), ((a)->hw_addr + \
  79. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  80. ((offset) << 1)))
  81. #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) \
  82. readw((a)->hw_addr + \
  83. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  84. ((offset) << 1))
  85. #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) \
  86. writeb((value), ((a)->hw_addr + \
  87. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  88. (offset)))
  89. #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) \
  90. readb((a)->hw_addr + \
  91. (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
  92. (offset))
  93. #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS)
  94. #define E1000_WRITE_ICH_FLASH_REG(a, reg, value) \
  95. writel((value), ((a)->flash_address + reg))
  96. #define E1000_READ_ICH_FLASH_REG(a, reg) \
  97. readl((a)->flash_address + reg)
  98. #define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) \
  99. writew((value), ((a)->flash_address + reg))
  100. #define E1000_READ_ICH_FLASH_REG16(a, reg) \
  101. readw((a)->flash_address + reg)
  102. #define msleep(n) mdelay(n)
  103. #endif /* _E1000_OSDEP_H_ */
  104. /*
  105. * Local variables:
  106. * c-basic-offset: 8
  107. * c-indent-level: 8
  108. * tab-width: 8
  109. * End:
  110. */