addrs.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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. * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
  7. * Copyright (C) 1999, 2000 by Ralf Baechle
  8. */
  9. #ifndef _ASM_SN_ADDRS_H
  10. #define _ASM_SN_ADDRS_H
  11. #include <linux/config.h>
  12. #ifndef __ASSEMBLY__
  13. #include <linux/types.h>
  14. #endif /* !__ASSEMBLY__ */
  15. #include <asm/addrspace.h>
  16. #include <asm/sn/kldir.h>
  17. #if defined(CONFIG_SGI_IP27)
  18. #include <asm/sn/sn0/addrs.h>
  19. #elif defined(CONFIG_SGI_IP35)
  20. #include <asm/sn/sn1/addrs.h>
  21. #endif
  22. #ifndef __ASSEMBLY__
  23. #if defined(CONFIG_SGI_IO) /* FIXME */
  24. #define PS_UINT_CAST (__psunsigned_t)
  25. #define UINT64_CAST (__uint64_t)
  26. #else /* CONFIG_SGI_IO */
  27. #define PS_UINT_CAST (unsigned long)
  28. #define UINT64_CAST (unsigned long)
  29. #endif /* CONFIG_SGI_IO */
  30. #define HUBREG_CAST (volatile hubreg_t *)
  31. #else /* __ASSEMBLY__ */
  32. #define PS_UINT_CAST
  33. #define UINT64_CAST
  34. #define HUBREG_CAST
  35. #endif /* __ASSEMBLY__ */
  36. #define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
  37. #ifdef CONFIG_SGI_IP27
  38. #define NASID_GET_LOCAL(_n) ((_n) & 0xf)
  39. #endif
  40. #define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
  41. #define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
  42. #define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
  43. #define CHANGE_ADDR_NASID(_pa, _nasid) \
  44. ((UINT64_CAST (_pa) & ~NASID_MASK) | \
  45. (UINT64_CAST(_nasid) << NASID_SHFT))
  46. /*
  47. * The following macros are used to index to the beginning of a specific
  48. * node's address space.
  49. */
  50. #define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
  51. #define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
  52. #define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
  53. #define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
  54. #define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
  55. #define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
  56. #define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
  57. #define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
  58. #define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
  59. #define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
  60. #define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
  61. #define RAW_NODE_SWIN_BASE(nasid, widget) \
  62. (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS))
  63. #define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
  64. /*
  65. * The following definitions pertain to the IO special address
  66. * space. They define the location of the big and little windows
  67. * of any given node.
  68. */
  69. #define SWIN_SIZE_BITS 24
  70. #define SWIN_SIZE (UINT64_CAST 1 << 24)
  71. #define SWIN_SIZEMASK (SWIN_SIZE - 1)
  72. #define SWIN_WIDGET_MASK 0xF
  73. /*
  74. * Convert smallwindow address to xtalk address.
  75. *
  76. * 'addr' can be physical or virtual address, but will be converted
  77. * to Xtalk address in the range 0 -> SWINZ_SIZEMASK
  78. */
  79. #define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
  80. #define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
  81. /*
  82. * Verify if addr belongs to small window address on node with "nasid"
  83. *
  84. *
  85. * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
  86. * address
  87. *
  88. *
  89. */
  90. #define NODE_SWIN_ADDR(nasid, addr) \
  91. (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \
  92. ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\
  93. ))
  94. /*
  95. * The following define the major position-independent aliases used
  96. * in SN.
  97. * UALIAS -- 256MB in size, reads in the UALIAS result in
  98. * uncached references to the memory of the reader's node.
  99. * CPU_UALIAS -- 128kb in size, the bottom part of UALIAS is flipped
  100. * depending on which CPU does the access to provide
  101. * all CPUs with unique uncached memory at low addresses.
  102. * LBOOT -- 256MB in size, reads in the LBOOT area result in
  103. * uncached references to the local hub's boot prom and
  104. * other directory-bus connected devices.
  105. * IALIAS -- 8MB in size, reads in the IALIAS result in uncached
  106. * references to the local hub's registers.
  107. */
  108. #define UALIAS_BASE HSPEC_BASE
  109. #define UALIAS_SIZE 0x10000000 /* 256 Megabytes */
  110. #define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
  111. /*
  112. * The bottom of ualias space is flipped depending on whether you're
  113. * processor 0 or 1 within a node.
  114. */
  115. #ifdef CONFIG_SGI_IP27
  116. #define UALIAS_FLIP_BASE UALIAS_BASE
  117. #define UALIAS_FLIP_SIZE 0x20000
  118. #define UALIAS_FLIP_BIT 0x10000
  119. #define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \
  120. (_x) ^ UALIAS_FLIP_BIT : (_x))
  121. #define LBOOT_BASE (HSPEC_BASE + 0x10000000)
  122. #define LBOOT_SIZE 0x10000000
  123. #define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE)
  124. #define LBOOT_STRIDE 0 /* IP27 has only one CPU PROM */
  125. #endif
  126. #define HUB_REGISTER_WIDGET 1
  127. #define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
  128. #define IALIAS_SIZE 0x800000 /* 8 Megabytes */
  129. #define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \
  130. ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
  131. /*
  132. * Macro for referring to Hub's RBOOT space
  133. */
  134. #ifdef CONFIG_SGI_IP27
  135. #define RBOOT_SIZE 0x10000000 /* 256 Megabytes */
  136. #define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000)
  137. #define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE)
  138. #endif
  139. /*
  140. * Macros for referring the Hub's back door space
  141. *
  142. * These macros correctly process addresses in any node's space.
  143. * WARNING: They won't work in assembler.
  144. *
  145. * BDDIR_ENTRY_LO returns the address of the low double-word of the dir
  146. * entry corresponding to a physical (Cac or Uncac) address.
  147. * BDDIR_ENTRY_HI returns the address of the high double-word of the entry.
  148. * BDPRT_ENTRY returns the address of the double-word protection entry
  149. * corresponding to the page containing the physical address.
  150. * BDPRT_ENTRY_S Stores the value into the protection entry.
  151. * BDPRT_ENTRY_L Load the value from the protection entry.
  152. * BDECC_ENTRY returns the address of the ECC byte corresponding to a
  153. * double-word at a specified physical address.
  154. * BDECC_ENTRY_H returns the address of the two ECC bytes corresponding to a
  155. * quad-word at a specified physical address.
  156. */
  157. #define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
  158. #define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
  159. #define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
  160. #ifdef CONFIG_SGI_IP27
  161. #define BDDIR_ENTRY_LO(_pa) ((HSPEC_BASE + \
  162. NODE_ADDRSPACE_SIZE * 3 / 4 + \
  163. 0x200) | \
  164. UINT64_CAST (_pa) & NASID_MASK | \
  165. UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
  166. UINT64_CAST (_pa) >> 3 & 0x1f << 4)
  167. #define BDDIR_ENTRY_HI(_pa) ((HSPEC_BASE + \
  168. NODE_ADDRSPACE_SIZE * 3 / 4 + \
  169. 0x208) | \
  170. UINT64_CAST (_pa) & NASID_MASK | \
  171. UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
  172. UINT64_CAST (_pa) >> 3 & 0x1f << 4)
  173. #define BDPRT_ENTRY(_pa, _rgn) ((HSPEC_BASE + \
  174. NODE_ADDRSPACE_SIZE * 3 / 4) | \
  175. UINT64_CAST (_pa) & NASID_MASK | \
  176. UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
  177. (_rgn) << 3)
  178. #define BDPRT_ENTRY_ADDR(_pa,_rgn) (BDPRT_ENTRY((_pa),(_rgn)))
  179. #define BDPRT_ENTRY_S(_pa,_rgn,_val) (*(__psunsigned_t *)BDPRT_ENTRY((_pa),(_rgn))=(_val))
  180. #define BDPRT_ENTRY_L(_pa,_rgn) (*(__psunsigned_t *)BDPRT_ENTRY((_pa),(_rgn)))
  181. #define BDECC_ENTRY(_pa) ((HSPEC_BASE + \
  182. NODE_ADDRSPACE_SIZE / 2) | \
  183. UINT64_CAST (_pa) & NASID_MASK | \
  184. UINT64_CAST (_pa) >> 2 & BDECC_UPPER_MASK | \
  185. UINT64_CAST (_pa) >> 3 & 3)
  186. /*
  187. * Macro to convert a back door directory or protection address into the
  188. * raw physical address of the associated cache line or protection page.
  189. */
  190. #define BDADDR_IS_DIR(_ba) ((UINT64_CAST (_ba) & 0x200) != 0)
  191. #define BDADDR_IS_PRT(_ba) ((UINT64_CAST (_ba) & 0x200) == 0)
  192. #define BDDIR_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
  193. (UINT64_CAST (_ba) & BDDIR_UPPER_MASK)<<2 | \
  194. (UINT64_CAST (_ba) & 0x1f << 4) << 3)
  195. #define BDPRT_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
  196. (UINT64_CAST (_ba) & BDDIR_UPPER_MASK)<<2)
  197. #define BDECC_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
  198. (UINT64_CAST (_ba) & BDECC_UPPER_MASK)<<2 | \
  199. (UINT64_CAST (_ba) & 3) << 3)
  200. #endif /* CONFIG_SGI_IP27 */
  201. /*
  202. * The following macros produce the correct base virtual address for
  203. * the hub registers. The LOCAL_HUB_* macros produce the appropriate
  204. * address for the local registers. The REMOTE_HUB_* macro produce
  205. * the address for the specified hub's registers. The intent is
  206. * that the appropriate PI, MD, NI, or II register would be substituted
  207. * for _x.
  208. */
  209. #ifdef _STANDALONE
  210. /* DO NOT USE THESE DIRECTLY IN THE KERNEL. SEE BELOW. */
  211. #define LOCAL_HUB(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
  212. #define REMOTE_HUB(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
  213. 0x800000 + (_x)))
  214. #endif /* _STANDALONE */
  215. /*
  216. * WARNING:
  217. * When certain Hub chip workaround are defined, it's not sufficient
  218. * to dereference the *_HUB_ADDR() macros. You should instead use
  219. * HUB_L() and HUB_S() if you must deal with pointers to hub registers.
  220. * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
  221. * They're always safe.
  222. */
  223. #define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
  224. #define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
  225. 0x800000 + (_x)))
  226. #ifdef CONFIG_SGI_IP27
  227. #define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
  228. 0x800000 + (_x)))
  229. #endif /* CONFIG_SGI_IP27 */
  230. #ifndef __ASSEMBLY__
  231. #define HUB_L(_a) *(_a)
  232. #define HUB_S(_a, _d) *(_a) = (_d)
  233. #define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r))
  234. #define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d))
  235. #define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r)))
  236. #define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d))
  237. #define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)))
  238. #define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d))
  239. #endif /* !__ASSEMBLY__ */
  240. /*
  241. * The following macros are used to get to a hub/bridge register, given
  242. * the base of the register space.
  243. */
  244. #define HUB_REG_PTR(_base, _off) \
  245. (HUBREG_CAST ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
  246. #define HUB_REG_PTR_L(_base, _off) \
  247. HUB_L(HUB_REG_PTR((_base), (_off)))
  248. #define HUB_REG_PTR_S(_base, _off, _data) \
  249. HUB_S(HUB_REG_PTR((_base), (_off)), (_data))
  250. /*
  251. * Software structure locations -- permanently fixed
  252. * See diagram in kldir.h
  253. */
  254. #define PHYS_RAMBASE 0x0
  255. #define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
  256. #define EX_HANDLER_OFFSET(slice) ((slice) << 16)
  257. #define EX_HANDLER_ADDR(nasid, slice) \
  258. PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
  259. #define EX_HANDLER_SIZE 0x0400
  260. #define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
  261. #define EX_FRAME_ADDR(nasid, slice) \
  262. PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
  263. #define EX_FRAME_SIZE 0x0c00
  264. #define ARCS_SPB_OFFSET 0x1000
  265. #define ARCS_SPB_ADDR(nasid) \
  266. PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
  267. #define ARCS_SPB_SIZE 0x0400
  268. #ifdef _STANDALONE
  269. #define ARCS_TVECTOR_OFFSET 0x2800
  270. #define ARCS_PVECTOR_OFFSET 0x2c00
  271. /*
  272. * These addresses are used by the master CPU to install the transfer
  273. * and private vectors. All others use the SPB to find them.
  274. */
  275. #define TVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_TVECTOR_OFFSET)
  276. #define PVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_PVECTOR_OFFSET)
  277. #endif /* _STANDALONE */
  278. #define KLDIR_OFFSET 0x2000
  279. #define KLDIR_ADDR(nasid) \
  280. TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
  281. #define KLDIR_SIZE 0x0400
  282. /*
  283. * Software structure locations -- indirected through KLDIR
  284. * See diagram in kldir.h
  285. *
  286. * Important: All low memory structures must only be accessed
  287. * uncached, except for the symmon stacks.
  288. */
  289. #define KLI_LAUNCH 0 /* Dir. entries */
  290. #define KLI_KLCONFIG 1
  291. #define KLI_NMI 2
  292. #define KLI_GDA 3
  293. #define KLI_FREEMEM 4
  294. #define KLI_SYMMON_STK 5
  295. #define KLI_PI_ERROR 6
  296. #define KLI_KERN_VARS 7
  297. #define KLI_KERN_XP 8
  298. #define KLI_KERN_PARTID 9
  299. #ifndef __ASSEMBLY__
  300. #define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
  301. #define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
  302. #define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
  303. #define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
  304. #define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
  305. #define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
  306. #define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
  307. #define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
  308. #define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
  309. #define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
  310. #define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
  311. #define LAUNCH_OFFSET(nasid, slice) \
  312. (KLD_LAUNCH(nasid)->offset + \
  313. KLD_LAUNCH(nasid)->stride * (slice))
  314. #define LAUNCH_ADDR(nasid, slice) \
  315. TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
  316. #define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
  317. #define NMI_OFFSET(nasid, slice) \
  318. (KLD_NMI(nasid)->offset + \
  319. KLD_NMI(nasid)->stride * (slice))
  320. #define NMI_ADDR(nasid, slice) \
  321. TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice))
  322. #define NMI_SIZE(nasid) KLD_NMI(nasid)->size
  323. #define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
  324. #define KLCONFIG_ADDR(nasid) \
  325. TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
  326. #define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
  327. #define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
  328. #define GDA_SIZE(nasid) KLD_GDA(nasid)->size
  329. #define SYMMON_STK_OFFSET(nasid, slice) \
  330. (KLD_SYMMON_STK(nasid)->offset + \
  331. KLD_SYMMON_STK(nasid)->stride * (slice))
  332. #define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
  333. #define SYMMON_STK_ADDR(nasid, slice) \
  334. TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
  335. #define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
  336. #define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
  337. /* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a
  338. * relocatable program
  339. */
  340. #define UNIX_DEBUG_LOADADDR 0x300000
  341. #define SYMMON_LOADADDR(nasid) \
  342. TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000))
  343. #define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset
  344. #define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid)
  345. /*
  346. * XXX
  347. * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded.
  348. * Also, it should take into account what prom thinks to be a safe
  349. * address
  350. PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid))
  351. */
  352. #define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size
  353. #define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset
  354. #define PI_ERROR_ADDR(nasid) \
  355. TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid))
  356. #define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size
  357. #define NODE_OFFSET_TO_K0(_nasid, _off) \
  358. PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
  359. #define NODE_OFFSET_TO_K1(_nasid, _off) \
  360. TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
  361. #define K0_TO_NODE_OFFSET(_k0addr) \
  362. ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
  363. #define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
  364. #define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
  365. #define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer
  366. #define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size
  367. #define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET)
  368. #endif /* !__ASSEMBLY__ */
  369. #endif /* _ASM_SN_ADDRS_H */