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