| .. | .. |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | #ifndef __ASSEMBLY__ |
|---|
| 29 | 29 | |
|---|
| 30 | | -#define PS_UINT_CAST (unsigned long) |
|---|
| 31 | 30 | #define UINT64_CAST (unsigned long) |
|---|
| 32 | | - |
|---|
| 33 | | -#define HUBREG_CAST (volatile hubreg_t *) |
|---|
| 34 | 31 | |
|---|
| 35 | 32 | #else /* __ASSEMBLY__ */ |
|---|
| 36 | 33 | |
|---|
| 37 | | -#define PS_UINT_CAST |
|---|
| 38 | 34 | #define UINT64_CAST |
|---|
| 39 | | -#define HUBREG_CAST |
|---|
| 40 | 35 | |
|---|
| 41 | 36 | #endif /* __ASSEMBLY__ */ |
|---|
| 42 | 37 | |
|---|
| .. | .. |
|---|
| 256 | 251 | * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S(). |
|---|
| 257 | 252 | * They're always safe. |
|---|
| 258 | 253 | */ |
|---|
| 259 | | -#define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x))) |
|---|
| 260 | | -#define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ |
|---|
| 261 | | - 0x800000 + (_x))) |
|---|
| 262 | | -#ifdef CONFIG_SGI_IP27 |
|---|
| 263 | | -#define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ |
|---|
| 264 | | - 0x800000 + (_x))) |
|---|
| 265 | | -#endif /* CONFIG_SGI_IP27 */ |
|---|
| 254 | +#define LOCAL_HUB_ADDR(_x) (IALIAS_BASE + (_x)) |
|---|
| 255 | +#define REMOTE_HUB_ADDR(_n, _x) ((NODE_SWIN_BASE(_n, 1) + 0x800000 + (_x))) |
|---|
| 266 | 256 | |
|---|
| 267 | 257 | #ifndef __ASSEMBLY__ |
|---|
| 268 | 258 | |
|---|
| 269 | | -#define HUB_L(_a) *(_a) |
|---|
| 270 | | -#define HUB_S(_a, _d) *(_a) = (_d) |
|---|
| 259 | +#define LOCAL_HUB_PTR(_x) ((u64 *)LOCAL_HUB_ADDR((_x))) |
|---|
| 260 | +#define REMOTE_HUB_PTR(_n, _x) ((u64 *)REMOTE_HUB_ADDR((_n), (_x))) |
|---|
| 271 | 261 | |
|---|
| 272 | | -#define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r)) |
|---|
| 273 | | -#define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d)) |
|---|
| 274 | | -#define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r))) |
|---|
| 275 | | -#define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d)) |
|---|
| 276 | | -#define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r))) |
|---|
| 277 | | -#define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d)) |
|---|
| 262 | +#define LOCAL_HUB_L(_r) __raw_readq(LOCAL_HUB_PTR(_r)) |
|---|
| 263 | +#define LOCAL_HUB_S(_r, _d) __raw_writeq((_d), LOCAL_HUB_PTR(_r)) |
|---|
| 264 | +#define REMOTE_HUB_L(_n, _r) __raw_readq(REMOTE_HUB_PTR((_n), (_r))) |
|---|
| 265 | +#define REMOTE_HUB_S(_n, _r, _d) __raw_writeq((_d), \ |
|---|
| 266 | + REMOTE_HUB_PTR((_n), (_r))) |
|---|
| 278 | 267 | |
|---|
| 279 | 268 | #endif /* !__ASSEMBLY__ */ |
|---|
| 280 | | - |
|---|
| 281 | | -/* |
|---|
| 282 | | - * The following macros are used to get to a hub/bridge register, given |
|---|
| 283 | | - * the base of the register space. |
|---|
| 284 | | - */ |
|---|
| 285 | | -#define HUB_REG_PTR(_base, _off) \ |
|---|
| 286 | | - (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off))) |
|---|
| 287 | | - |
|---|
| 288 | | -#define HUB_REG_PTR_L(_base, _off) \ |
|---|
| 289 | | - HUB_L(HUB_REG_PTR((_base), (_off))) |
|---|
| 290 | | - |
|---|
| 291 | | -#define HUB_REG_PTR_S(_base, _off, _data) \ |
|---|
| 292 | | - HUB_S(HUB_REG_PTR((_base), (_off)), (_data)) |
|---|
| 293 | 269 | |
|---|
| 294 | 270 | /* |
|---|
| 295 | 271 | * Software structure locations -- permanently fixed |
|---|
| .. | .. |
|---|
| 387 | 363 | |
|---|
| 388 | 364 | #define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size) |
|---|
| 389 | 365 | |
|---|
| 390 | | -/* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a |
|---|
| 391 | | - * relocatable program |
|---|
| 392 | | - */ |
|---|
| 393 | | -#define UNIX_DEBUG_LOADADDR 0x300000 |
|---|
| 394 | | -#define SYMMON_LOADADDR(nasid) \ |
|---|
| 395 | | - TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000)) |
|---|
| 396 | | - |
|---|
| 397 | | -#define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset |
|---|
| 398 | | -#define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid) |
|---|
| 399 | | -/* |
|---|
| 400 | | - * XXX |
|---|
| 401 | | - * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded. |
|---|
| 402 | | - * Also, it should take into account what prom thinks to be a safe |
|---|
| 403 | | - * address |
|---|
| 404 | | - PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid)) |
|---|
| 405 | | - */ |
|---|
| 406 | | -#define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size |
|---|
| 407 | | - |
|---|
| 408 | | -#define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset |
|---|
| 409 | | -#define PI_ERROR_ADDR(nasid) \ |
|---|
| 410 | | - TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid)) |
|---|
| 411 | | -#define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size |
|---|
| 412 | | - |
|---|
| 413 | 366 | #define NODE_OFFSET_TO_K0(_nasid, _off) \ |
|---|
| 414 | 367 | PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE) |
|---|
| 415 | 368 | #define NODE_OFFSET_TO_K1(_nasid, _off) \ |
|---|
| 416 | 369 | TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE) |
|---|
| 417 | | -#define K0_TO_NODE_OFFSET(_k0addr) \ |
|---|
| 418 | | - ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK) |
|---|
| 419 | 370 | |
|---|
| 420 | 371 | #define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer |
|---|
| 421 | 372 | #define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size |
|---|
| 422 | | - |
|---|
| 423 | | -#define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer |
|---|
| 424 | | -#define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size |
|---|
| 425 | | - |
|---|
| 426 | | -#define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET) |
|---|
| 427 | 373 | |
|---|
| 428 | 374 | #endif /* !__ASSEMBLY__ */ |
|---|
| 429 | 375 | |
|---|