/* * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 1992-1999,2001 Silicon Graphics, Inc. All rights reserved. */ #ifndef _ASM_IA64_SN_ADDRS_H #define _ASM_IA64_SN_ADDRS_H #include #if defined (CONFIG_IA64_SGI_SN1) #include #elif defined (CONFIG_IA64_SGI_SN2) #include #else #error <<>> #endif /* !SN1 && !SN2 */ #ifndef __ASSEMBLY__ #include #endif #ifndef __ASSEMBLY__ #define PS_UINT_CAST (__psunsigned_t) #define UINT64_CAST (uint64_t) #ifdef CONFIG_IA64_SGI_SN2 #define HUBREG_CAST (volatile mmr_t *) #else #define HUBREG_CAST (volatile hubreg_t *) #endif #elif __ASSEMBLY__ #define PS_UINT_CAST #define UINT64_CAST #define HUBREG_CAST #endif /* * The following macros are used to index to the beginning of a specific * node's address space. */ #ifdef CONFIG_IA64_SGI_SN2 /* SN2 has an extra AS field between node offset and node id (nasid) */ #define NODE_OFFSET(_n) (UINT64_CAST (_n) << NASID_SHFT) #else #define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS) #endif #define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n)) #define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n)) #define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n)) #define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n)) #define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n)) #define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) )) #define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK)) #define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK)) #define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK)) #define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK)) #define RAW_NODE_SWIN_BASE(nasid, widget) \ (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS)) #define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff)) /* * The following definitions pertain to the IO special address * space. They define the location of the big and little windows * of any given node. */ #define SWIN_SIZE_BITS 24 #define SWIN_SIZE (UINT64_CAST 1 << 24) #define SWIN_SIZEMASK (SWIN_SIZE - 1) #define SWIN_WIDGET_MASK 0xF /* * Convert smallwindow address to xtalk address. * * 'addr' can be physical or virtual address, but will be converted * to Xtalk address in the range 0 -> SWINZ_SIZEMASK */ #define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK) #define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK) /* * Verify if addr belongs to small window address on node with "nasid" * * * NOTE: "addr" is expected to be XKPHYS address, and NOT physical * address * * */ #define NODE_SWIN_ADDR(nasid, addr) \ (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \ ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\ )) /* * The following define the major position-independent aliases used * in SN. * LBOOT -- 256MB in size, reads in the LBOOT area result in * uncached references to the local hub's boot prom and * other directory-bus connected devices. * IALIAS -- 8MB in size, reads in the IALIAS result in uncached * references to the local hub's registers. */ #if defined CONFIG_IA64_SGI_SN1 #define LREG_BASE (HSPEC_BASE + 0x10000000) #define LREG_SIZE 0x8000000 /* 128 MB */ #define LREG_LIMIT (LREG_BASE + LREG_SIZE) #define LBOOT_BASE (LREG_LIMIT) #define LBOOT_SIZE 0x8000000 /* 128 MB */ #define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE) #define LBOOT_STRIDE 0x2000000 /* two PROMs, on 32M boundaries */ #endif #define HUB_REGISTER_WIDGET 1 #ifdef CONFIG_IA64_SGI_SN2 #define IALIAS_BASE LOCAL_SWIN_BASE(HUB_REGISTER_WIDGET) #else #define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET) #endif #define IALIAS_SIZE 0x800000 /* 8 Megabytes */ #define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \ ((_a) < (IALIAS_BASE + IALIAS_SIZE))) /* * Macro for referring to Hub's RBOOT space */ #if defined CONFIG_IA64_SGI_SN1 #define NODE_LREG_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000) #define NODE_LREG_LIMIT(_n) (NODE_LREG_BASE(_n) + LREG_SIZE) #define RREG_BASE(_n) (NODE_LREG_BASE(_n)) #define RREG_LIMIT(_n) (NODE_LREG_LIMIT(_n)) #define RBOOT_SIZE 0x8000000 /* 128 Megabytes */ #define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x38000000) #define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE) #endif /* * The following macros produce the correct base virtual address for * the hub registers. The LOCAL_HUB_* macros produce the appropriate * address for the local registers. The REMOTE_HUB_* macro produce * the address for the specified hub's registers. The intent is * that the appropriate PI, MD, NI, or II register would be substituted * for _x. */ #ifdef CONFIG_IA64_SGI_SN2 /* * SN2 has II mmr's located inside small window space like SN0 & SN1, * but has all other non-II mmr's located at the top of big window * space, unlike SN0 & SN1. */ #define LOCAL_HUB_BASE(_x) (LOCAL_MMR_ADDR(_x) | (((~(_x)) & BWIN_TOP)>>8)) #define REMOTE_HUB_BASE(_x) \ (UNCACHED | GLOBAL_MMR_SPACE | \ (((~(_x)) & BWIN_TOP)>>8) | \ (((~(_x)) & BWIN_TOP)>>9) | (_x)) #define LOCAL_HUB(_x) (HUBREG_CAST LOCAL_HUB_BASE(_x)) #define REMOTE_HUB(_n, _x) \ (HUBREG_CAST (REMOTE_HUB_BASE(_x) | ((((long)(_n))<offset #else #define KLCONFIG_OFFSET(nasid) \ ia64_sn_get_klconfig_addr(nasid) #endif /* CONFIG_IA64_SGI_SN2 */ #define KLCONFIG_ADDR(nasid) \ TO_NODE_CAC((nasid), KLCONFIG_OFFSET(nasid)) #define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size #define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer #define GDA_SIZE(nasid) KLD_GDA(nasid)->size #define NODE_OFFSET_TO_K0(_nasid, _off) \ (PAGE_OFFSET | NODE_OFFSET(_nasid) | (_off)) #endif /* __ASSEMBLY__ */ #endif /* _ASM_IA64_SN_ADDRS_H */