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