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