iPXE
igbvf_osdep.h
Go to the documentation of this file.
1/*******************************************************************************
2
3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 1999 - 2008 Intel Corporation.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28
29FILE_LICENCE ( GPL2_ONLY );
30
31/* glue for the OS-dependent part of igbvf
32 * includes register access macros
33 */
34
35#ifndef _IGBVF_OSDEP_H_
36#define _IGBVF_OSDEP_H_
37
38#include <stdbool.h>
39
40#define u8 unsigned char
41#define dma_addr_t unsigned long
42#define __le16 uint16_t
43#define __le32 uint32_t
44#define __le64 uint64_t
45
46#define __iomem
47#define __devinit
48#define ____cacheline_aligned_in_smp
49
50#define msleep(x) mdelay(x)
51
52#define ETH_FCS_LEN 4
53
54typedef int spinlock_t;
55
56#define usec_delay(x) udelay(x)
57#define msec_delay(x) mdelay(x)
58#define msec_delay_irq(x) mdelay(x)
59
60#define PCI_COMMAND_REGISTER PCI_COMMAND
61#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
62#define ETH_ADDR_LEN ETH_ALEN
63
64
65#define DEBUGOUT(S) if (0) { printf(S); }
66#define DEBUGOUT1(S, A...) if (0) { printf(S, A); }
67
68#define DEBUGFUNC(F) DEBUGOUT(F "\n")
69#define DEBUGOUT2 DEBUGOUT1
70#define DEBUGOUT3 DEBUGOUT2
71#define DEBUGOUT7 DEBUGOUT3
72
73#define E1000_WRITE_REG(a, reg, value) do { \
74 writel((value), ((a)->hw_addr + reg)); } while (0)
75
76#define E1000_READ_REG(a, reg) (readl((a)->hw_addr + reg))
77
78#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) do { \
79 writel((value), ((a)->hw_addr + reg + ((offset) << 2))); } while (0)
80
81#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
82 readl((a)->hw_addr + reg + ((offset) << 2)))
83
84#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
85#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
86
87#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
88 writew((value), ((a)->hw_addr + reg + ((offset) << 1))))
89
90#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
91 readw((a)->hw_addr + reg + ((offset) << 1)))
92
93#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
94 writeb((value), ((a)->hw_addr + reg + (offset))))
95
96#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
97 readb((a)->hw_addr + reg + (offset)))
98
99#define E1000_WRITE_REG_IO(a, reg, offset) do { \
100 outl(reg, ((a)->io_base)); \
101 outl(offset, ((a)->io_base + 4)); } while(0)
102
103#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, E1000_STATUS)
104
105#define E1000_WRITE_FLASH_REG(a, reg, value) ( \
106 writel((value), ((a)->flash_address + reg)))
107
108#define E1000_WRITE_FLASH_REG16(a, reg, value) ( \
109 writew((value), ((a)->flash_address + reg)))
110
111#define E1000_READ_FLASH_REG(a, reg) (readl((a)->flash_address + reg))
112
113#define E1000_READ_FLASH_REG16(a, reg) (readw((a)->flash_address + reg))
114
115#endif /* _IGBVF_OSDEP_H_ */
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
int spinlock_t
Definition igbvf_osdep.h:54