addrs.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Derived from IRIX <sys/SN/SN0/addrs.h>, revision 1.126.
  7. *
  8. * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
  9. * Copyright (C) 1999 by Ralf Baechle
  10. */
  11. #ifndef _ASM_SN_SN0_ADDRS_H
  12. #define _ASM_SN_SN0_ADDRS_H
  13. /*
  14. * SN0 (on a T5) Address map
  15. *
  16. * This file contains a set of definitions and macros which are used
  17. * to reference into the major address spaces (CAC, HSPEC, IO, MSPEC,
  18. * and UNCAC) used by the SN0 architecture. It also contains addresses
  19. * for "major" statically locatable PROM/Kernel data structures, such as
  20. * the partition table, the configuration data structure, etc.
  21. * We make an implicit assumption that the processor using this file
  22. * follows the R10K's provisions for specifying uncached attributes;
  23. * should this change, the base registers may very well become processor-
  24. * dependent.
  25. *
  26. * For more information on the address spaces, see the "Local Resources"
  27. * chapter of the Hub specification.
  28. *
  29. * NOTE: This header file is included both by C and by assembler source
  30. * files. Please bracket any language-dependent definitions
  31. * appropriately.
  32. */
  33. /*
  34. * Some of the macros here need to be casted to appropriate types when used
  35. * from C. They definitely must not be casted from assembly language so we
  36. * use some new ANSI preprocessor stuff to paste these on where needed.
  37. */
  38. /*
  39. * The following couple of definitions will eventually need to be variables,
  40. * since the amount of address space assigned to each node depends on
  41. * whether the system is running in N-mode (more nodes with less memory)
  42. * or M-mode (fewer nodes with more memory). We expect that it will
  43. * be a while before we need to make this decision dynamically, though,
  44. * so for now we just use defines bracketed by an ifdef.
  45. */
  46. #ifdef CONFIG_SGI_SN_N_MODE
  47. #define NODE_SIZE_BITS 31
  48. #define BWIN_SIZE_BITS 28
  49. #define NASID_BITS 9
  50. #define NASID_BITMASK (0x1ffLL)
  51. #define NASID_SHFT 31
  52. #define NASID_META_BITS 5
  53. #define NASID_LOCAL_BITS 4
  54. #define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
  55. #define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
  56. #else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
  57. #define NODE_SIZE_BITS 32
  58. #define BWIN_SIZE_BITS 29
  59. #define NASID_BITMASK (0xffLL)
  60. #define NASID_BITS 8
  61. #define NASID_SHFT 32
  62. #define NASID_META_BITS 4
  63. #define NASID_LOCAL_BITS 4
  64. #define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
  65. #define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
  66. #endif /* !defined(CONFIG_SGI_SN_N_MODE) */
  67. #define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
  68. #define NASID_MASK (UINT64_CAST NASID_BITMASK << NASID_SHFT)
  69. #define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
  70. NASID_SHFT) & NASID_BITMASK)
  71. #if !defined(__ASSEMBLY__)
  72. #define NODE_SWIN_BASE(nasid, widget) \
  73. ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
  74. : RAW_NODE_SWIN_BASE(nasid, widget))
  75. #else /* __ASSEMBLY__ */
  76. #define NODE_SWIN_BASE(nasid, widget) \
  77. (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
  78. #endif /* __ASSEMBLY__ */
  79. /*
  80. * The following definitions pertain to the IO special address
  81. * space. They define the location of the big and little windows
  82. * of any given node.
  83. */
  84. #define BWIN_INDEX_BITS 3
  85. #define BWIN_SIZE (UINT64_CAST 1 << BWIN_SIZE_BITS)
  86. #define BWIN_SIZEMASK (BWIN_SIZE - 1)
  87. #define BWIN_WIDGET_MASK 0x7
  88. #define NODE_BWIN_BASE0(nasid) (NODE_IO_BASE(nasid) + BWIN_SIZE)
  89. #define NODE_BWIN_BASE(nasid, bigwin) (NODE_BWIN_BASE0(nasid) + \
  90. (UINT64_CAST(bigwin) << BWIN_SIZE_BITS))
  91. #define BWIN_WIDGETADDR(addr) ((addr) & BWIN_SIZEMASK)
  92. #define BWIN_WINDOWNUM(addr) (((addr) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
  93. /*
  94. * Verify if addr belongs to large window address of node with "nasid"
  95. *
  96. *
  97. * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
  98. * address
  99. *
  100. *
  101. */
  102. #define NODE_BWIN_ADDR(nasid, addr) \
  103. (((addr) >= NODE_BWIN_BASE0(nasid)) && \
  104. ((addr) < (NODE_BWIN_BASE(nasid, HUB_NUM_BIG_WINDOW) + \
  105. BWIN_SIZE)))
  106. /*
  107. * The following define the major position-independent aliases used
  108. * in SN0.
  109. * CALIAS -- Varies in size, points to the first n bytes of memory
  110. * on the reader's node.
  111. */
  112. #define CALIAS_BASE CAC_BASE
  113. #define BRIDGE_REG_PTR(_base, _off) ((volatile bridgereg_t *) \
  114. ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
  115. #define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
  116. /* Turn on sable logging for the processors whose bits are set. */
  117. #define SABLE_LOG_TRIGGER(_map)
  118. #ifndef __ASSEMBLY__
  119. #define KERN_NMI_ADDR(nasid, slice) \
  120. TO_NODE_UNCAC((nasid), IP27_NMI_KREGS_OFFSET + \
  121. (IP27_NMI_KREGS_CPU_SIZE * (slice)))
  122. #endif /* !__ASSEMBLY__ */
  123. #ifdef PROM
  124. #define MISC_PROM_BASE PHYS_TO_K0(0x01300000)
  125. #define MISC_PROM_SIZE 0x200000
  126. #define DIAG_BASE PHYS_TO_K0(0x01500000)
  127. #define DIAG_SIZE 0x300000
  128. #define ROUTE_BASE PHYS_TO_K0(0x01800000)
  129. #define ROUTE_SIZE 0x200000
  130. #define IP27PROM_FLASH_HDR PHYS_TO_K0(0x01300000)
  131. #define IP27PROM_FLASH_DATA PHYS_TO_K0(0x01301000)
  132. #define IP27PROM_CORP_MAX 32
  133. #define IP27PROM_CORP PHYS_TO_K0(0x01800000)
  134. #define IP27PROM_CORP_SIZE 0x10000
  135. #define IP27PROM_CORP_STK PHYS_TO_K0(0x01810000)
  136. #define IP27PROM_CORP_STKSIZE 0x2000
  137. #define IP27PROM_DECOMP_BUF PHYS_TO_K0(0x01900000)
  138. #define IP27PROM_DECOMP_SIZE 0xfff00
  139. #define IP27PROM_BASE PHYS_TO_K0(0x01a00000)
  140. #define IP27PROM_BASE_MAPPED (UNCAC_BASE | 0x1fc00000)
  141. #define IP27PROM_SIZE_MAX 0x100000
  142. #define IP27PROM_PCFG PHYS_TO_K0(0x01b00000)
  143. #define IP27PROM_PCFG_SIZE 0xd0000
  144. #define IP27PROM_ERRDMP PHYS_TO_K1(0x01bd0000)
  145. #define IP27PROM_ERRDMP_SIZE 0xf000
  146. #define IP27PROM_INIT_START PHYS_TO_K1(0x01bd0000)
  147. #define IP27PROM_CONSOLE PHYS_TO_K1(0x01bdf000)
  148. #define IP27PROM_CONSOLE_SIZE 0x200
  149. #define IP27PROM_NETUART PHYS_TO_K1(0x01bdf200)
  150. #define IP27PROM_NETUART_SIZE 0x100
  151. #define IP27PROM_UNUSED1 PHYS_TO_K1(0x01bdf300)
  152. #define IP27PROM_UNUSED1_SIZE 0x500
  153. #define IP27PROM_ELSC_BASE_A PHYS_TO_K0(0x01bdf800)
  154. #define IP27PROM_ELSC_BASE_B PHYS_TO_K0(0x01bdfc00)
  155. #define IP27PROM_STACK_A PHYS_TO_K0(0x01be0000)
  156. #define IP27PROM_STACK_B PHYS_TO_K0(0x01bf0000)
  157. #define IP27PROM_STACK_SHFT 16
  158. #define IP27PROM_STACK_SIZE (1 << IP27PROM_STACK_SHFT)
  159. #define IP27PROM_INIT_END PHYS_TO_K0(0x01c00000)
  160. #define SLAVESTACK_BASE PHYS_TO_K0(0x01580000)
  161. #define SLAVESTACK_SIZE 0x40000
  162. #define ENETBUFS_BASE PHYS_TO_K0(0x01f80000)
  163. #define ENETBUFS_SIZE 0x20000
  164. #define IO6PROM_BASE PHYS_TO_K0(0x01c00000)
  165. #define IO6PROM_SIZE 0x400000
  166. #define IO6PROM_BASE_MAPPED (UNCAC_BASE | 0x11c00000)
  167. #define IO6DPROM_BASE PHYS_TO_K0(0x01c00000)
  168. #define IO6DPROM_SIZE 0x200000
  169. #define NODEBUGUNIX_ADDR PHYS_TO_K0(0x00019000)
  170. #define DEBUGUNIX_ADDR PHYS_TO_K0(0x00100000)
  171. #define IP27PROM_INT_LAUNCH 10 /* and 11 */
  172. #define IP27PROM_INT_NETUART 12 /* through 17 */
  173. #endif /* PROM */
  174. /*
  175. * needed by symmon so it needs to be outside #if PROM
  176. */
  177. #define IP27PROM_ELSC_SHFT 10
  178. #define IP27PROM_ELSC_SIZE (1 << IP27PROM_ELSC_SHFT)
  179. /*
  180. * This address is used by IO6PROM to build MemoryDescriptors of
  181. * free memory. This address is important since unix gets loaded
  182. * at this address, and this memory has to be FREE if unix is to
  183. * be loaded.
  184. */
  185. #define FREEMEM_BASE PHYS_TO_K0(0x2000000)
  186. #define IO6PROM_STACK_SHFT 14 /* stack per cpu */
  187. #define IO6PROM_STACK_SIZE (1 << IO6PROM_STACK_SHFT)
  188. /*
  189. * IP27 PROM vectors
  190. */
  191. #define IP27PROM_ENTRY PHYS_TO_COMPATK1(0x1fc00000)
  192. #define IP27PROM_RESTART PHYS_TO_COMPATK1(0x1fc00008)
  193. #define IP27PROM_SLAVELOOP PHYS_TO_COMPATK1(0x1fc00010)
  194. #define IP27PROM_PODMODE PHYS_TO_COMPATK1(0x1fc00018)
  195. #define IP27PROM_IOC3UARTPOD PHYS_TO_COMPATK1(0x1fc00020)
  196. #define IP27PROM_FLASHLEDS PHYS_TO_COMPATK1(0x1fc00028)
  197. #define IP27PROM_REPOD PHYS_TO_COMPATK1(0x1fc00030)
  198. #define IP27PROM_LAUNCHSLAVE PHYS_TO_COMPATK1(0x1fc00038)
  199. #define IP27PROM_WAITSLAVE PHYS_TO_COMPATK1(0x1fc00040)
  200. #define IP27PROM_POLLSLAVE PHYS_TO_COMPATK1(0x1fc00048)
  201. #define KL_UART_BASE LOCAL_HUB_ADDR(MD_UREG0_0) /* base of UART regs */
  202. #define KL_UART_CMD LOCAL_HUB_ADDR(MD_UREG0_0) /* UART command reg */
  203. #define KL_UART_DATA LOCAL_HUB_ADDR(MD_UREG0_1) /* UART data reg */
  204. #define KL_I2C_REG MD_UREG0_0 /* I2C reg */
  205. #ifndef __ASSEMBLY__
  206. /* Address 0x400 to 0x1000 ualias points to cache error eframe + misc
  207. * CACHE_ERR_SP_PTR could either contain an address to the stack, or
  208. * the stack could start at CACHE_ERR_SP_PTR
  209. */
  210. #if defined(HUB_ERR_STS_WAR)
  211. #define CACHE_ERR_EFRAME 0x480
  212. #else /* HUB_ERR_STS_WAR */
  213. #define CACHE_ERR_EFRAME 0x400
  214. #endif /* HUB_ERR_STS_WAR */
  215. #define CACHE_ERR_ECCFRAME (CACHE_ERR_EFRAME + EF_SIZE)
  216. #define CACHE_ERR_SP_PTR (0x1000 - 32) /* why -32? TBD */
  217. #define CACHE_ERR_IBASE_PTR (0x1000 - 40)
  218. #define CACHE_ERR_SP (CACHE_ERR_SP_PTR - 16)
  219. #define CACHE_ERR_AREA_SIZE (ARCS_SPB_OFFSET - CACHE_ERR_EFRAME)
  220. #endif /* !__ASSEMBLY__ */
  221. #define _ARCSPROM
  222. #if defined(HUB_ERR_STS_WAR)
  223. #define ERR_STS_WAR_REGISTER IIO_IIBUSERR
  224. #define ERR_STS_WAR_ADDR LOCAL_HUB_ADDR(IIO_IIBUSERR)
  225. #define ERR_STS_WAR_PHYSADDR TO_PHYS((__psunsigned_t)ERR_STS_WAR_ADDR)
  226. /* Used to match addr in error reg. */
  227. #define OLD_ERR_STS_WAR_OFFSET ((MD_MEM_BANKS * MD_BANK_SIZE) - 0x100)
  228. #endif /* HUB_ERR_STS_WAR */
  229. #endif /* _ASM_SN_SN0_ADDRS_H */