fp@2386: /*******************************************************************************
fp@2386: 
fp@2386:   Intel PRO/1000 Linux driver
fp@2386:   Copyright(c) 1999 - 2006 Intel Corporation.
fp@2386: 
fp@2386:   This program is free software; you can redistribute it and/or modify it
fp@2386:   under the terms and conditions of the GNU General Public License,
fp@2386:   version 2, as published by the Free Software Foundation.
fp@2386: 
fp@2386:   This program is distributed in the hope it will be useful, but WITHOUT
fp@2386:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fp@2386:   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
fp@2386:   more details.
fp@2386: 
fp@2386:   You should have received a copy of the GNU General Public License along with
fp@2386:   this program; if not, write to the Free Software Foundation, Inc.,
fp@2386:   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
fp@2386: 
fp@2386:   The full GNU General Public License is included in this distribution in
fp@2386:   the file called "COPYING".
fp@2386: 
fp@2386:   Contact Information:
fp@2386:   Linux NICS <linux.nics@intel.com>
fp@2386:   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
fp@2386:   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
fp@2386: 
fp@2386: *******************************************************************************/
fp@2386: 
fp@2386: 
fp@2386: /* glue for the OS independent part of e1000
fp@2386:  * includes register access macros
fp@2386:  */
fp@2386: 
fp@2386: #ifndef _E1000_OSDEP_H_
fp@2386: #define _E1000_OSDEP_H_
fp@2386: 
fp@2386: #include <asm/io.h>
fp@2386: 
fp@2386: #define CONFIG_RAM_BASE         0x60000
fp@2386: #define GBE_CONFIG_OFFSET       0x0
fp@2386: 
fp@2386: #define GBE_CONFIG_RAM_BASE \
fp@2386: 	((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
fp@2386: 
fp@2386: #define GBE_CONFIG_BASE_VIRT \
fp@2386: 	((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE))
fp@2386: 
fp@2386: #define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
fp@2386: 	(iowrite16_rep(base + offset, data, count))
fp@2386: 
fp@2386: #define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
fp@2386: 	(ioread16_rep(base + (offset << 1), data, count))
fp@2386: 
fp@2386: #define er32(reg)							\
fp@2386: 	(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543)		\
fp@2386: 			       ? E1000_##reg : E1000_82542_##reg)))
fp@2386: 
fp@2386: #define ew32(reg, value)						\
fp@2386: 	(writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543)	\
fp@2386: 					 ? E1000_##reg : E1000_82542_##reg))))
fp@2386: 
fp@2386: #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
fp@2386:     writel((value), ((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         ((offset) << 2))))
fp@2386: 
fp@2386: #define E1000_READ_REG_ARRAY(a, reg, offset) ( \
fp@2386:     readl((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         ((offset) << 2)))
fp@2386: 
fp@2386: #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
fp@2386: #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
fp@2386: 
fp@2386: #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
fp@2386:     writew((value), ((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         ((offset) << 1))))
fp@2386: 
fp@2386: #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
fp@2386:     readw((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         ((offset) << 1)))
fp@2386: 
fp@2386: #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
fp@2386:     writeb((value), ((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         (offset))))
fp@2386: 
fp@2386: #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
fp@2386:     readb((a)->hw_addr + \
fp@2386:         (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
fp@2386:         (offset)))
fp@2386: 
fp@2386: #define E1000_WRITE_FLUSH() er32(STATUS)
fp@2386: 
fp@2386: #define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
fp@2386:     writel((value), ((a)->flash_address + reg)))
fp@2386: 
fp@2386: #define E1000_READ_ICH_FLASH_REG(a, reg) ( \
fp@2386:     readl((a)->flash_address + reg))
fp@2386: 
fp@2386: #define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
fp@2386:     writew((value), ((a)->flash_address + reg)))
fp@2386: 
fp@2386: #define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
fp@2386:     readw((a)->flash_address + reg))
fp@2386: 
fp@2386: #endif /* _E1000_OSDEP_H_ */