1 /* 2 * IXP2000 MSF network device driver 3 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> 4 * Dedicated to Marija Kulikova. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 */ 11 12 #ifndef __IXPDEV_PRIV_H 13 #define __IXPDEV_PRIV_H 14 15 #define RX_BUF_DESC_BASE 0x00001000 16 #define RX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_rx_desc))) 17 #define TX_BUF_DESC_BASE 0x00002000 18 #define TX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_tx_desc))) 19 #define TX_BUF_COUNT_PER_CHAN (TX_BUF_COUNT / 4) 20 21 #define RING_RX_PENDING ((u32 *)IXP2000_SCRATCH_RING_VIRT_BASE) 22 #define RING_RX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 4)) 23 #define RING_TX_PENDING ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 8)) 24 #define RING_TX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 12)) 25 26 #define SCRATCH_REG(x) ((u32 *)(IXP2000_GLOBAL_REG_VIRT_BASE | 0x0800 | (x))) 27 #define RING_RX_PENDING_BASE SCRATCH_REG(0x00) 28 #define RING_RX_PENDING_HEAD SCRATCH_REG(0x04) 29 #define RING_RX_PENDING_TAIL SCRATCH_REG(0x08) 30 #define RING_RX_DONE_BASE SCRATCH_REG(0x10) 31 #define RING_RX_DONE_HEAD SCRATCH_REG(0x14) 32 #define RING_RX_DONE_TAIL SCRATCH_REG(0x18) 33 #define RING_TX_PENDING_BASE SCRATCH_REG(0x20) 34 #define RING_TX_PENDING_HEAD SCRATCH_REG(0x24) 35 #define RING_TX_PENDING_TAIL SCRATCH_REG(0x28) 36 #define RING_TX_DONE_BASE SCRATCH_REG(0x30) 37 #define RING_TX_DONE_HEAD SCRATCH_REG(0x34) 38 #define RING_TX_DONE_TAIL SCRATCH_REG(0x38) 39 40 struct ixpdev_rx_desc 41 { 42 u32 buf_addr; 43 u32 buf_length; 44 u32 channel; 45 u32 pkt_length; 46 }; 47 48 struct ixpdev_tx_desc 49 { 50 u32 buf_addr; 51 u32 pkt_length; 52 u32 channel; 53 u32 unused; 54 }; 55 56 57 #endif 58