bcm570x_mm.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /******************************************************************************/
  2. /* */
  3. /* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 Broadcom */
  4. /* Corporation. */
  5. /* All rights reserved. */
  6. /* */
  7. /* This program is free software; you can redistribute it and/or modify */
  8. /* it under the terms of the GNU General Public License as published by */
  9. /* the Free Software Foundation, located in the file LICENSE. */
  10. /* */
  11. /******************************************************************************/
  12. #ifndef MM_H
  13. #define MM_H
  14. #define __raw_readl readl
  15. #define __raw_writel writel
  16. #define BIG_ENDIAN_HOST 1
  17. #define readl(addr) (*(volatile unsigned int*)(addr))
  18. #define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
  19. /* Define memory barrier function here if needed */
  20. #define wmb()
  21. #define membar()
  22. #include <common.h>
  23. #include <asm/types.h>
  24. #include "bcm570x_lm.h"
  25. #include "bcm570x_queue.h"
  26. #include "tigon3.h"
  27. #include <pci.h>
  28. #define FALSE 0
  29. #define TRUE 1
  30. #define ERROR -1
  31. #if DBG
  32. #define STATIC
  33. #else
  34. #define STATIC static
  35. #endif
  36. extern int MM_Packet_Desc_Size;
  37. #define MM_PACKET_DESC_SIZE MM_Packet_Desc_Size
  38. DECLARE_QUEUE_TYPE(UM_RX_PACKET_Q, MAX_RX_PACKET_DESC_COUNT+1);
  39. #define MAX_MEM 16
  40. /* Synch */
  41. typedef int mutex_t;
  42. typedef int spinlock_t;
  43. /* Embedded device control */
  44. typedef struct _UM_DEVICE_BLOCK {
  45. LM_DEVICE_BLOCK lm_dev;
  46. pci_dev_t pdev;
  47. char *name;
  48. void *mem_list[MAX_MEM];
  49. dma_addr_t dma_list[MAX_MEM];
  50. int mem_size_list[MAX_MEM];
  51. int mem_list_num;
  52. int mtu;
  53. int index;
  54. int opened;
  55. int delayed_link_ind; /* Delay link status during initial load */
  56. int adapter_just_inited; /* the first few seconds after init. */
  57. int spurious_int; /* new -- unsupported */
  58. int timer_interval;
  59. int adaptive_expiry;
  60. int crc_counter_expiry; /* new -- unsupported */
  61. int poll_tib_expiry; /* new -- unsupported */
  62. int tx_full;
  63. int tx_queued;
  64. int line_speed; /* in Mbps, 0 if link is down */
  65. UM_RX_PACKET_Q rx_out_of_buf_q;
  66. int rx_out_of_buf;
  67. int rx_low_buf_thresh; /* changed to rx_buf_repl_thresh */
  68. int rx_buf_repl_panic_thresh;
  69. int rx_buf_align; /* new -- unsupported */
  70. int do_global_lock;
  71. mutex_t global_lock;
  72. mutex_t undi_lock;
  73. long undi_flags;
  74. volatile int interrupt;
  75. int tasklet_pending;
  76. int tasklet_busy; /* new -- unsupported */
  77. int rx_pkt;
  78. int tx_pkt;
  79. #ifdef NICE_SUPPORT /* unsupported, this is a linux ioctl */
  80. void (*nice_rx)(void*, void* );
  81. void* nice_ctx;
  82. #endif /* NICE_SUPPORT */
  83. int rx_adaptive_coalesce;
  84. unsigned int rx_last_cnt;
  85. unsigned int tx_last_cnt;
  86. unsigned int rx_curr_coalesce_frames;
  87. unsigned int rx_curr_coalesce_ticks;
  88. unsigned int tx_curr_coalesce_frames; /* new -- unsupported */
  89. #if TIGON3_DEBUG /* new -- unsupported */
  90. uint tx_zc_count;
  91. uint tx_chksum_count;
  92. uint tx_himem_count;
  93. uint rx_good_chksum_count;
  94. #endif
  95. unsigned int rx_bad_chksum_count; /* new -- unsupported */
  96. unsigned int rx_misc_errors; /* new -- unsupported */
  97. } UM_DEVICE_BLOCK, *PUM_DEVICE_BLOCK;
  98. /* Physical/PCI DMA address */
  99. typedef union {
  100. dma_addr_t dma_map;
  101. } dma_map_t;
  102. /* Packet */
  103. typedef struct
  104. _UM_PACKET {
  105. LM_PACKET lm_packet;
  106. void* skbuff; /* Address of packet buffer */
  107. } UM_PACKET, *PUM_PACKET;
  108. #define MM_ACQUIRE_UNDI_LOCK(_pDevice)
  109. #define MM_RELEASE_UNDI_LOCK(_pDevice)
  110. #define MM_ACQUIRE_INT_LOCK(_pDevice)
  111. #define MM_RELEASE_INT_LOCK(_pDevice)
  112. #define MM_UINT_PTR(_ptr) ((unsigned long) (_ptr))
  113. /* Macro for setting 64bit address struct */
  114. #define set_64bit_addr(paddr, low, high) \
  115. (paddr)->Low = low; \
  116. (paddr)->High = high;
  117. /* Assume that PCI controller's view of host memory is same as host */
  118. #define MEM_TO_PCI_PHYS(addr) (addr)
  119. extern void MM_SetAddr (LM_PHYSICAL_ADDRESS *paddr, dma_addr_t addr);
  120. extern void MM_SetT3Addr(T3_64BIT_HOST_ADDR *paddr, dma_addr_t addr);
  121. extern void MM_MapTxDma (PLM_DEVICE_BLOCK pDevice,
  122. struct _LM_PACKET *pPacket, T3_64BIT_HOST_ADDR *paddr,
  123. LM_UINT32 *len, int frag);
  124. extern void MM_MapRxDma ( PLM_DEVICE_BLOCK pDevice,
  125. struct _LM_PACKET *pPacket,
  126. T3_64BIT_HOST_ADDR *paddr);
  127. /* BSP needs to provide sysUsecDelay and sysSerialPrintString */
  128. extern void sysSerialPrintString (char *s);
  129. #define MM_Wait(usec) udelay(usec)
  130. /* Define memory barrier function here if needed */
  131. #define wmb()
  132. #if 0
  133. #define cpu_to_le32(val) LONGSWAP(val)
  134. #endif
  135. #endif /* MM_H */