ixpdev_priv.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef __IXPDEV_PRIV_H
  12. #define __IXPDEV_PRIV_H
  13. #define RX_BUF_DESC_BASE 0x00001000
  14. #define RX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_rx_desc)))
  15. #define TX_BUF_DESC_BASE 0x00002000
  16. #define TX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_tx_desc)))
  17. #define TX_BUF_COUNT_PER_CHAN (TX_BUF_COUNT / 4)
  18. #define RING_RX_PENDING ((u32 *)IXP2000_SCRATCH_RING_VIRT_BASE)
  19. #define RING_RX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 4))
  20. #define RING_TX_PENDING ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 8))
  21. #define RING_TX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 12))
  22. #define SCRATCH_REG(x) ((u32 *)(IXP2000_GLOBAL_REG_VIRT_BASE | 0x0800 | (x)))
  23. #define RING_RX_PENDING_BASE SCRATCH_REG(0x00)
  24. #define RING_RX_PENDING_HEAD SCRATCH_REG(0x04)
  25. #define RING_RX_PENDING_TAIL SCRATCH_REG(0x08)
  26. #define RING_RX_DONE_BASE SCRATCH_REG(0x10)
  27. #define RING_RX_DONE_HEAD SCRATCH_REG(0x14)
  28. #define RING_RX_DONE_TAIL SCRATCH_REG(0x18)
  29. #define RING_TX_PENDING_BASE SCRATCH_REG(0x20)
  30. #define RING_TX_PENDING_HEAD SCRATCH_REG(0x24)
  31. #define RING_TX_PENDING_TAIL SCRATCH_REG(0x28)
  32. #define RING_TX_DONE_BASE SCRATCH_REG(0x30)
  33. #define RING_TX_DONE_HEAD SCRATCH_REG(0x34)
  34. #define RING_TX_DONE_TAIL SCRATCH_REG(0x38)
  35. struct ixpdev_rx_desc
  36. {
  37. u32 buf_addr;
  38. u32 buf_length;
  39. u32 channel;
  40. u32 pkt_length;
  41. };
  42. struct ixpdev_tx_desc
  43. {
  44. u32 buf_addr;
  45. u32 pkt_length;
  46. u32 channel;
  47. u32 unused;
  48. };
  49. #endif