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