diff options
Diffstat (limited to 'drivers/net/e1000/e1000_osdep.h')
-rw-r--r-- | drivers/net/e1000/e1000_osdep.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h index 970c656a517c..aac64de61437 100644 --- a/drivers/net/e1000/e1000_osdep.h +++ b/drivers/net/e1000/e1000_osdep.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | 3 | ||
4 | Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. | 4 | Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms of the GNU General Public License as published by the Free | 7 | under the terms of the GNU General Public License as published by the Free |
@@ -42,7 +42,12 @@ | |||
42 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
43 | 43 | ||
44 | #ifndef msec_delay | 44 | #ifndef msec_delay |
45 | #define msec_delay(x) msleep(x) | 45 | #define msec_delay(x) do { if(in_interrupt()) { \ |
46 | /* Don't mdelay in interrupt context! */ \ | ||
47 | BUG(); \ | ||
48 | } else { \ | ||
49 | msleep(x); \ | ||
50 | } } while(0) | ||
46 | 51 | ||
47 | /* Some workarounds require millisecond delays and are run during interrupt | 52 | /* Some workarounds require millisecond delays and are run during interrupt |
48 | * context. Most notably, when establishing link, the phy may need tweaking | 53 | * context. Most notably, when establishing link, the phy may need tweaking |
@@ -96,6 +101,29 @@ typedef enum { | |||
96 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ | 101 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ |
97 | ((offset) << 2))) | 102 | ((offset) << 2))) |
98 | 103 | ||
104 | #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY | ||
105 | #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY | ||
106 | |||
107 | #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \ | ||
108 | writew((value), ((a)->hw_addr + \ | ||
109 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ | ||
110 | ((offset) << 1)))) | ||
111 | |||
112 | #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \ | ||
113 | readw((a)->hw_addr + \ | ||
114 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ | ||
115 | ((offset) << 1))) | ||
116 | |||
117 | #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \ | ||
118 | writeb((value), ((a)->hw_addr + \ | ||
119 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ | ||
120 | (offset)))) | ||
121 | |||
122 | #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \ | ||
123 | readb((a)->hw_addr + \ | ||
124 | (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ | ||
125 | (offset))) | ||
126 | |||
99 | #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS) | 127 | #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS) |
100 | 128 | ||
101 | #endif /* _E1000_OSDEP_H_ */ | 129 | #endif /* _E1000_OSDEP_H_ */ |