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