1633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 2633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * This file is subject to the terms and conditions of the GNU General Public 3633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * License. See the file "COPYING" in the main directory of this archive 4633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * for more details. 5633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 6633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc. 7633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1999, 2000 by Ralf Baechle 8633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 9633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef _ASM_SN_ADDRS_H 10633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define _ASM_SN_ADDRS_H 11633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 12633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 13633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASSEMBLY__ 14633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <linux/types.h> 15633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* !__ASSEMBLY__ */ 16633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 17633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/addrspace.h> 18633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/sn/kldir.h> 19633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 20633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#if defined(CONFIG_SGI_IP27) 21633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/sn/sn0/addrs.h> 22633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#elif defined(CONFIG_SGI_IP35) 23633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/sn/sn1/addrs.h> 24633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif 25633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 26633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 27633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASSEMBLY__ 28633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 29633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PS_UINT_CAST (unsigned long) 30633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UINT64_CAST (unsigned long) 31633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 32633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUBREG_CAST (volatile hubreg_t *) 33633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 34633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#else /* __ASSEMBLY__ */ 35633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 36633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PS_UINT_CAST 37633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UINT64_CAST 38633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUBREG_CAST 39633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 40633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* __ASSEMBLY__ */ 41633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 42633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 43633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS) 44633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_SGI_IP27 45633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NASID_GET_LOCAL(_n) ((_n) & 0xf) 46633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif 47633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l)) 48633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 49633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1) 50633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK) 51633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 52633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define CHANGE_ADDR_NASID(_pa, _nasid) \ 53633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham ((UINT64_CAST(_pa) & ~NASID_MASK) | \ 54633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_nasid) << NASID_SHFT)) 55633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 56633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 57633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 58633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The following macros are used to index to the beginning of a specific 59633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * node's address space. 60633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 61633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 62633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS) 63633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 64633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n)) 65633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n)) 66633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n)) 67633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n)) 68633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n)) 69633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 70633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) )) 71633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK)) 72633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK)) 73633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK)) 74633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK)) 75633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 76633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 77633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define RAW_NODE_SWIN_BASE(nasid, widget) \ 78633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS)) 79633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 80633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff)) 81633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 82633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 83633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The following definitions pertain to the IO special address 84633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * space. They define the location of the big and little windows 85633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * of any given node. 86633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 87633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 88633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_SIZE_BITS 24 89633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_SIZE (UINT64_CAST 1 << 24) 90633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_SIZEMASK (SWIN_SIZE - 1) 91633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_WIDGET_MASK 0xF 92633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 93633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 94633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Convert smallwindow address to xtalk address. 95633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 96633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 'addr' can be physical or virtual address, but will be converted 97633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * to Xtalk address in the range 0 -> SWINZ_SIZEMASK 98633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 99633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK) 100633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK) 101633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 102633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Verify if addr belongs to small window address on node with "nasid" 103633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 104633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 105633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * NOTE: "addr" is expected to be XKPHYS address, and NOT physical 106633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * address 107633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 108633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 109633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 110633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_SWIN_ADDR(nasid, addr) \ 111633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \ 112633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\ 113633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham )) 114633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 115633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 116633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The following define the major position-independent aliases used 117633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * in SN. 118633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * UALIAS -- 256MB in size, reads in the UALIAS result in 119633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * uncached references to the memory of the reader's node. 120633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * CPU_UALIAS -- 128kb in size, the bottom part of UALIAS is flipped 121633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * depending on which CPU does the access to provide 122633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * all CPUs with unique uncached memory at low addresses. 123633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * LBOOT -- 256MB in size, reads in the LBOOT area result in 124633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * uncached references to the local hub's boot prom and 125633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * other directory-bus connected devices. 126633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * IALIAS -- 8MB in size, reads in the IALIAS result in uncached 127633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * references to the local hub's registers. 128633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 129633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 130633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_BASE HSPEC_BASE 131633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_SIZE 0x10000000 /* 256 Megabytes */ 132633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE) 133633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 134633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 135633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The bottom of ualias space is flipped depending on whether you're 136633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * processor 0 or 1 within a node. 137633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 138633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_SGI_IP27 139633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_FLIP_BASE UALIAS_BASE 140633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_FLIP_SIZE 0x20000 141633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_FLIP_BIT 0x10000 142633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \ 143633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (_x) ^ UALIAS_FLIP_BIT : (_x)) 144633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 145633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LBOOT_BASE (HSPEC_BASE + 0x10000000) 146633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LBOOT_SIZE 0x10000000 147633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE) 148633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LBOOT_STRIDE 0 /* IP27 has only one CPU PROM */ 149633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 150633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif 151633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 152633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_REGISTER_WIDGET 1 153633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET) 154633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define IALIAS_SIZE 0x800000 /* 8 Megabytes */ 155633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \ 156633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham ((_a) < (IALIAS_BASE + IALIAS_SIZE))) 157633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 158633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 159633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Macro for referring to Hub's RBOOT space 160633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 161633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 162633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_SGI_IP27 163633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define RBOOT_SIZE 0x10000000 /* 256 Megabytes */ 164633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000) 165633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE) 166633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 167633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif 168633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 169633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 170633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Macros for referring the Hub's back door space 171633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 172633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * These macros correctly process addresses in any node's space. 173633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * WARNING: They won't work in assembler. 174633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 175633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDDIR_ENTRY_LO returns the address of the low double-word of the dir 176633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * entry corresponding to a physical (Cac or Uncac) address. 177633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDDIR_ENTRY_HI returns the address of the high double-word of the entry. 178633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDPRT_ENTRY returns the address of the double-word protection entry 179633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * corresponding to the page containing the physical address. 180633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDPRT_ENTRY_S Stores the value into the protection entry. 181633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDPRT_ENTRY_L Load the value from the protection entry. 182633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDECC_ENTRY returns the address of the ECC byte corresponding to a 183633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * double-word at a specified physical address. 184633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * BDECC_ENTRY_H returns the address of the two ECC bytes corresponding to a 185633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * quad-word at a specified physical address. 186633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 187633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2)) 188633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 189633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n)) 190633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4)) 191633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_SGI_IP27 192633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDDIR_ENTRY_LO(_pa) ((HSPEC_BASE + \ 193633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham NODE_ADDRSPACE_SIZE * 3 / 4 + \ 194633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 0x200) | \ 195633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) & NASID_MASK | \ 196633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \ 197633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 3 & 0x1f << 4) 198633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 199633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDDIR_ENTRY_HI(_pa) ((HSPEC_BASE + \ 200633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham NODE_ADDRSPACE_SIZE * 3 / 4 + \ 201633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 0x208) | \ 202633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) & NASID_MASK | \ 203633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \ 204633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 3 & 0x1f << 4) 205633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 206633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDPRT_ENTRY(_pa, _rgn) ((HSPEC_BASE + \ 207633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham NODE_ADDRSPACE_SIZE * 3 / 4) | \ 208633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) & NASID_MASK | \ 209633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \ 210633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (_rgn) << 3) 211633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDPRT_ENTRY_ADDR(_pa, _rgn) (BDPRT_ENTRY((_pa), (_rgn))) 212633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDPRT_ENTRY_S(_pa, _rgn, _val) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn))=(_val)) 213633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDPRT_ENTRY_L(_pa, _rgn) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn))) 214633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 215633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDECC_ENTRY(_pa) ((HSPEC_BASE + \ 216633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham NODE_ADDRSPACE_SIZE / 2) | \ 217633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) & NASID_MASK | \ 218633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 2 & BDECC_UPPER_MASK | \ 219633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham UINT64_CAST(_pa) >> 3 & 3) 220633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 221633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 222633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Macro to convert a back door directory or protection address into the 223633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * raw physical address of the associated cache line or protection page. 224633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 225633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDADDR_IS_DIR(_ba) ((UINT64_CAST (_ba) & 0x200) != 0) 226633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDADDR_IS_PRT(_ba) ((UINT64_CAST (_ba) & 0x200) == 0) 227633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 228633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDDIR_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \ 229633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2 | \ 230633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_ba) & 0x1f << 4) << 3) 231633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 232633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDPRT_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \ 233633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2) 234633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 235633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define BDECC_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \ 236633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_ba) & BDECC_UPPER_MASK)<<2 | \ 237633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (UINT64_CAST(_ba) & 3) << 3) 238633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* CONFIG_SGI_IP27 */ 239633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 240633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 241633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 242633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The following macros produce the correct base virtual address for 243633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * the hub registers. The LOCAL_HUB_* macros produce the appropriate 244633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * address for the local registers. The REMOTE_HUB_* macro produce 245633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * the address for the specified hub's registers. The intent is 246633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * that the appropriate PI, MD, NI, or II register would be substituted 247633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * for _x. 248633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 249633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 250633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 251633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * WARNING: 252633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * When certain Hub chip workaround are defined, it's not sufficient 253633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * to dereference the *_HUB_ADDR() macros. You should instead use 254633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * HUB_L() and HUB_S() if you must deal with pointers to hub registers. 255633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S(). 256633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * They're always safe. 257633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 258633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x))) 259633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ 260633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 0x800000 + (_x))) 261633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_SGI_IP27 262633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ 263633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 0x800000 + (_x))) 264633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* CONFIG_SGI_IP27 */ 265633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 266633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASSEMBLY__ 267633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 268633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_L(_a) *(_a) 269633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_S(_a, _d) *(_a) = (_d) 270633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 271633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r)) 272633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d)) 273633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r))) 274633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d)) 275633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r))) 276633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d)) 277633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 278633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* !__ASSEMBLY__ */ 279633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 280633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 281633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * The following macros are used to get to a hub/bridge register, given 282633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * the base of the register space. 283633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 284633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_REG_PTR(_base, _off) \ 285633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off))) 286633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 287633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_REG_PTR_L(_base, _off) \ 288633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham HUB_L(HUB_REG_PTR((_base), (_off))) 289633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 290633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HUB_REG_PTR_S(_base, _off, _data) \ 291633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham HUB_S(HUB_REG_PTR((_base), (_off)), (_data)) 292633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 293633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 294633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Software structure locations -- permanently fixed 295633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * See diagram in kldir.h 296633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 297633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 298633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PHYS_RAMBASE 0x0 299633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE) 300633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 301633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_HANDLER_OFFSET(slice) ((slice) << 16) 302633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_HANDLER_ADDR(nasid, slice) \ 303633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice)) 304633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_HANDLER_SIZE 0x0400 305633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 306633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400) 307633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_FRAME_ADDR(nasid, slice) \ 308633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice)) 309633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define EX_FRAME_SIZE 0x0c00 310633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 311633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define ARCS_SPB_OFFSET 0x1000 312633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define ARCS_SPB_ADDR(nasid) \ 313633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET) 314633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define ARCS_SPB_SIZE 0x0400 315633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 316633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLDIR_OFFSET 0x2000 317633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLDIR_ADDR(nasid) \ 318633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_UNCAC((nasid), KLDIR_OFFSET) 319633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLDIR_SIZE 0x0400 320633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 321633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 322633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 323633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Software structure locations -- indirected through KLDIR 324633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * See diagram in kldir.h 325633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 326633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Important: All low memory structures must only be accessed 327633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * uncached, except for the symmon stacks. 328633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 329633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 330633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_LAUNCH 0 /* Dir. entries */ 331633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_KLCONFIG 1 332633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_NMI 2 333633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_GDA 3 334633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_FREEMEM 4 335633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_SYMMON_STK 5 336633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_PI_ERROR 6 337633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_KERN_VARS 7 338633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_KERN_XP 8 339633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLI_KERN_PARTID 9 340633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 341633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASSEMBLY__ 342633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 343633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid)) 344633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH) 345633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI) 346633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG) 347633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR) 348633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA) 349633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK) 350633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM) 351633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS) 352633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP) 353633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID) 354633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 355633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LAUNCH_OFFSET(nasid, slice) \ 356633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (KLD_LAUNCH(nasid)->offset + \ 357633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham KLD_LAUNCH(nasid)->stride * (slice)) 358633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LAUNCH_ADDR(nasid, slice) \ 359633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice)) 360633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size 361633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 362633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NMI_OFFSET(nasid, slice) \ 363633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (KLD_NMI(nasid)->offset + \ 364633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham KLD_NMI(nasid)->stride * (slice)) 365633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NMI_ADDR(nasid, slice) \ 366633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice)) 367633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NMI_SIZE(nasid) KLD_NMI(nasid)->size 368633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 369633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset 370633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLCONFIG_ADDR(nasid) \ 371633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid)) 372633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size 373633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 374633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer 375633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define GDA_SIZE(nasid) KLD_GDA(nasid)->size 376633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 377633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_STK_OFFSET(nasid, slice) \ 378633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham (KLD_SYMMON_STK(nasid)->offset + \ 379633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham KLD_SYMMON_STK(nasid)->stride * (slice)) 380633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride 381633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 382633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_STK_ADDR(nasid, slice) \ 383633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice)) 384633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 385633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride 386633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 387633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size) 388633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 389633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a 390633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * relocatable program 391633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 392633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UNIX_DEBUG_LOADADDR 0x300000 393633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SYMMON_LOADADDR(nasid) \ 394633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000)) 395633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 396633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset 397633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid) 398633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 399633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * XXX 400633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded. 401633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Also, it should take into account what prom thinks to be a safe 402633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * address 403633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid)) 404633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 405633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size 406633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 407633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset 408633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PI_ERROR_ADDR(nasid) \ 409633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid)) 410633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size 411633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 412633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_OFFSET_TO_K0(_nasid, _off) \ 413633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE) 414633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NODE_OFFSET_TO_K1(_nasid, _off) \ 415633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE) 416633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define K0_TO_NODE_OFFSET(_k0addr) \ 417633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK) 418633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 419633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer 420633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size 421633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 422633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer 423633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size 424633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 425633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET) 426633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 427633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* !__ASSEMBLY__ */ 428633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 429633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 430633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* _ASM_SN_ADDRS_H */ 431