ab@2298: /******************************************************************************* ab@2298: ab@2298: Intel PRO/1000 Linux driver ab@2298: Copyright(c) 1999 - 2006 Intel Corporation. ab@2298: ab@2298: This program is free software; you can redistribute it and/or modify it ab@2298: under the terms and conditions of the GNU General Public License, ab@2298: version 2, as published by the Free Software Foundation. ab@2298: ab@2298: This program is distributed in the hope it will be useful, but WITHOUT ab@2298: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ab@2298: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ab@2298: more details. ab@2298: ab@2298: You should have received a copy of the GNU General Public License along with ab@2298: this program; if not, write to the Free Software Foundation, Inc., ab@2298: 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. ab@2298: ab@2298: The full GNU General Public License is included in this distribution in ab@2298: the file called "COPYING". ab@2298: ab@2298: Contact Information: ab@2298: Linux NICS ab@2298: e1000-devel Mailing List ab@2298: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 ab@2298: ab@2298: *******************************************************************************/ ab@2298: ab@2298: ab@2298: /* glue for the OS independent part of e1000 ab@2298: * includes register access macros ab@2298: */ ab@2298: ab@2298: #ifndef _E1000_OSDEP_H_ ab@2298: #define _E1000_OSDEP_H_ ab@2298: ab@2298: #include ab@2298: #include ab@2298: #include ab@2298: #include ab@2298: #include ab@2298: #include ab@2298: ab@2298: #ifdef DBG ab@2298: #define DEBUGOUT(S) printk(KERN_DEBUG S "\n") ab@2298: #define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A) ab@2298: #else ab@2298: #define DEBUGOUT(S) ab@2298: #define DEBUGOUT1(S, A...) ab@2298: #endif ab@2298: ab@2298: #define DEBUGFUNC(F) DEBUGOUT(F "\n") ab@2298: #define DEBUGOUT2 DEBUGOUT1 ab@2298: #define DEBUGOUT3 DEBUGOUT2 ab@2298: #define DEBUGOUT7 DEBUGOUT3 ab@2298: ab@2298: ab@2298: #define er32(reg) \ ab@2298: (readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \ ab@2298: ? E1000_##reg : E1000_82542_##reg))) ab@2298: ab@2298: #define ew32(reg, value) \ ab@2298: (writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543) \ ab@2298: ? E1000_##reg : E1000_82542_##reg)))) ab@2298: ab@2298: #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \ ab@2298: writel((value), ((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: ((offset) << 2)))) ab@2298: ab@2298: #define E1000_READ_REG_ARRAY(a, reg, offset) ( \ ab@2298: readl((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: ((offset) << 2))) ab@2298: ab@2298: #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY ab@2298: #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY ab@2298: ab@2298: #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \ ab@2298: writew((value), ((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: ((offset) << 1)))) ab@2298: ab@2298: #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \ ab@2298: readw((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: ((offset) << 1))) ab@2298: ab@2298: #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \ ab@2298: writeb((value), ((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: (offset)))) ab@2298: ab@2298: #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \ ab@2298: readb((a)->hw_addr + \ ab@2298: (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \ ab@2298: (offset))) ab@2298: ab@2298: #define E1000_WRITE_FLUSH() er32(STATUS) ab@2298: ab@2298: #define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \ ab@2298: writel((value), ((a)->flash_address + reg))) ab@2298: ab@2298: #define E1000_READ_ICH_FLASH_REG(a, reg) ( \ ab@2298: readl((a)->flash_address + reg)) ab@2298: ab@2298: #define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \ ab@2298: writew((value), ((a)->flash_address + reg))) ab@2298: ab@2298: #define E1000_READ_ICH_FLASH_REG16(a, reg) ( \ ab@2298: readw((a)->flash_address + reg)) ab@2298: ab@2298: #endif /* _E1000_OSDEP_H_ */