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