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