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.

igbvf_osdep.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*******************************************************************************
  2. Intel(R) 82576 Virtual Function Linux driver
  3. Copyright(c) 1999 - 2008 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-dependent part of igbvf
  23. * includes register access macros
  24. */
  25. #ifndef _IGBVF_OSDEP_H_
  26. #define _IGBVF_OSDEP_H_
  27. #define u8 unsigned char
  28. #define bool boolean_t
  29. #define dma_addr_t unsigned long
  30. #define __le16 uint16_t
  31. #define __le32 uint32_t
  32. #define __le64 uint64_t
  33. #define __iomem
  34. #define __devinit
  35. #define ____cacheline_aligned_in_smp
  36. #define msleep(x) mdelay(x)
  37. #define ETH_FCS_LEN 4
  38. typedef int spinlock_t;
  39. typedef enum {
  40. false = 0,
  41. true = 1
  42. } boolean_t;
  43. #define usec_delay(x) udelay(x)
  44. #define msec_delay(x) mdelay(x)
  45. #define msec_delay_irq(x) mdelay(x)
  46. #define PCI_COMMAND_REGISTER PCI_COMMAND
  47. #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
  48. #define ETH_ADDR_LEN ETH_ALEN
  49. #define DEBUGOUT(S) if (0) { printf(S); }
  50. #define DEBUGOUT1(S, A...) if (0) { printf(S, A); }
  51. #define DEBUGFUNC(F) DEBUGOUT(F "\n")
  52. #define DEBUGOUT2 DEBUGOUT1
  53. #define DEBUGOUT3 DEBUGOUT2
  54. #define DEBUGOUT7 DEBUGOUT3
  55. #define E1000_WRITE_REG(a, reg, value) do { \
  56. writel((value), ((a)->hw_addr + reg)); } while (0)
  57. #define E1000_READ_REG(a, reg) (readl((a)->hw_addr + reg))
  58. #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) do { \
  59. writel((value), ((a)->hw_addr + reg + ((offset) << 2))); } while (0)
  60. #define E1000_READ_REG_ARRAY(a, reg, offset) ( \
  61. readl((a)->hw_addr + reg + ((offset) << 2)))
  62. #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
  63. #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
  64. #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
  65. writew((value), ((a)->hw_addr + reg + ((offset) << 1))))
  66. #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
  67. readw((a)->hw_addr + reg + ((offset) << 1)))
  68. #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
  69. writeb((value), ((a)->hw_addr + reg + (offset))))
  70. #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
  71. readb((a)->hw_addr + reg + (offset)))
  72. #define E1000_WRITE_REG_IO(a, reg, offset) do { \
  73. outl(reg, ((a)->io_base)); \
  74. outl(offset, ((a)->io_base + 4)); } while(0)
  75. #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, E1000_STATUS)
  76. #define E1000_WRITE_FLASH_REG(a, reg, value) ( \
  77. writel((value), ((a)->flash_address + reg)))
  78. #define E1000_WRITE_FLASH_REG16(a, reg, value) ( \
  79. writew((value), ((a)->flash_address + reg)))
  80. #define E1000_READ_FLASH_REG(a, reg) (readl((a)->flash_address + reg))
  81. #define E1000_READ_FLASH_REG16(a, reg) (readw((a)->flash_address + reg))
  82. #endif /* _IGBVF_OSDEP_H_ */