Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: SGI-IP27: get rid of volatile and hubreg_t

Replace hub register access with __raw_readq/__raw_writeq and get
rid of hubreg_t completely. Also remove no longer (probably never
used) used defines

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

authored by

Thomas Bogendoerfer and committed by
Paul Burton
db0e7d4e 72faa7a7

+19 -75
+9 -63
arch/mips/include/asm/sn/addrs.h
··· 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 ··· 251 256 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S(). 252 257 * They're always safe. 253 258 */ 254 - #define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x))) 255 - #define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ 256 - 0x800000 + (_x))) 257 - #ifdef CONFIG_SGI_IP27 258 - #define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \ 259 - 0x800000 + (_x))) 260 - #endif /* CONFIG_SGI_IP27 */ 259 + #define LOCAL_HUB_ADDR(_x) (IALIAS_BASE + (_x)) 260 + #define REMOTE_HUB_ADDR(_n, _x) ((NODE_SWIN_BASE(_n, 1) + 0x800000 + (_x))) 261 261 262 262 #ifndef __ASSEMBLY__ 263 263 264 - #define HUB_L(_a) *(_a) 265 - #define HUB_S(_a, _d) *(_a) = (_d) 264 + #define LOCAL_HUB_PTR(_x) ((u64 *)LOCAL_HUB_ADDR((_x))) 265 + #define REMOTE_HUB_PTR(_n, _x) ((u64 *)REMOTE_HUB_ADDR((_n), (_x))) 266 266 267 - #define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r)) 268 - #define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d)) 269 - #define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r))) 270 - #define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d)) 271 - #define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r))) 272 - #define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d)) 267 + #define LOCAL_HUB_L(_r) __raw_readq(LOCAL_HUB_PTR(_r)) 268 + #define LOCAL_HUB_S(_r, _d) __raw_writeq((_d), LOCAL_HUB_PTR(_r)) 269 + #define REMOTE_HUB_L(_n, _r) __raw_readq(REMOTE_HUB_PTR((_n), (_r))) 270 + #define REMOTE_HUB_S(_n, _r, _d) __raw_writeq((_d), \ 271 + REMOTE_HUB_PTR((_n), (_r))) 273 272 274 273 #endif /* !__ASSEMBLY__ */ 275 - 276 - /* 277 - * The following macros are used to get to a hub/bridge register, given 278 - * the base of the register space. 279 - */ 280 - #define HUB_REG_PTR(_base, _off) \ 281 - (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off))) 282 - 283 - #define HUB_REG_PTR_L(_base, _off) \ 284 - HUB_L(HUB_REG_PTR((_base), (_off))) 285 - 286 - #define HUB_REG_PTR_S(_base, _off, _data) \ 287 - HUB_S(HUB_REG_PTR((_base), (_off)), (_data)) 288 274 289 275 /* 290 276 * Software structure locations -- permanently fixed ··· 363 387 364 388 #define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size) 365 389 366 - /* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a 367 - * relocatable program 368 - */ 369 - #define UNIX_DEBUG_LOADADDR 0x300000 370 - #define SYMMON_LOADADDR(nasid) \ 371 - TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000)) 372 - 373 - #define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset 374 - #define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid) 375 - /* 376 - * XXX 377 - * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded. 378 - * Also, it should take into account what prom thinks to be a safe 379 - * address 380 - PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid)) 381 - */ 382 - #define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size 383 - 384 - #define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset 385 - #define PI_ERROR_ADDR(nasid) \ 386 - TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid)) 387 - #define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size 388 - 389 390 #define NODE_OFFSET_TO_K0(_nasid, _off) \ 390 391 PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE) 391 392 #define NODE_OFFSET_TO_K1(_nasid, _off) \ 392 393 TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE) 393 - #define K0_TO_NODE_OFFSET(_k0addr) \ 394 - ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK) 395 394 396 395 #define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer 397 396 #define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size 398 - 399 - #define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer 400 - #define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size 401 - 402 - #define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET) 403 397 404 398 #endif /* !__ASSEMBLY__ */ 405 399
-2
arch/mips/include/asm/sn/arch.h
··· 17 17 #include <asm/sn/sn0/arch.h> 18 18 #endif 19 19 20 - typedef u64 hubreg_t; 21 - 22 20 #define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid) 23 21 #define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice) 24 22 #define makespnum(_nasid, _slice) \
+1 -1
arch/mips/include/asm/sn/io.h
··· 44 44 IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \ 45 45 (bigwin), IIO_ITTE_INVALID_WIDGET, 0) 46 46 47 - #define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_ADDR((nasid), IIO_ITTE(bigwin)) 47 + #define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_PTR((nasid), IIO_ITTE(bigwin)) 48 48 49 49 /* 50 50 * Macro which takes the widget number, and returns the
+2 -2
arch/mips/sgi-ip27/ip27-hubio.c
··· 63 63 * after we write it. 64 64 */ 65 65 IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr); 66 - (void) HUB_L(IIO_ITTE_GET(nasid, i)); 66 + __raw_readq(IIO_ITTE_GET(nasid, i)); 67 67 68 68 return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE); 69 69 } ··· 135 135 **/ 136 136 static void hub_set_piomode(nasid_t nasid) 137 137 { 138 - hubreg_t ii_iowa; 138 + u64 ii_iowa; 139 139 hubii_wcr_t ii_wcr; 140 140 unsigned i; 141 141
+1 -1
arch/mips/sgi-ip27/ip27-init.c
··· 177 177 178 178 void __init plat_mem_setup(void) 179 179 { 180 - hubreg_t p, e, n_mode; 180 + u64 p, e, n_mode; 181 181 nasid_t nid; 182 182 183 183 ip27_reboot_setup();
+2 -2
arch/mips/sgi-ip27/ip27-irq.c
··· 85 85 static void ip27_do_irq_mask0(void) 86 86 { 87 87 int irq, swlevel; 88 - hubreg_t pend0, mask0; 88 + u64 pend0, mask0; 89 89 cpuid_t cpu = smp_processor_id(); 90 90 int pi_int_mask0 = 91 91 (cputoslice(cpu) == 0) ? PI_INT_MASK0_A : PI_INT_MASK0_B; ··· 132 132 static void ip27_do_irq_mask1(void) 133 133 { 134 134 int irq, swlevel; 135 - hubreg_t pend1, mask1; 135 + u64 pend1, mask1; 136 136 cpuid_t cpu = smp_processor_id(); 137 137 int pi_int_mask1 = (cputoslice(cpu) == 0) ? PI_INT_MASK1_A : PI_INT_MASK1_B; 138 138 struct slice_data *si = cpu_data[cpu].data;
+3 -3
arch/mips/sgi-ip27/ip27-memory.c
··· 44 44 return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE; 45 45 } 46 46 47 - static hubreg_t get_region(cnodeid_t cnode) 47 + static u64 get_region(cnodeid_t cnode) 48 48 { 49 49 if (fine_mode) 50 50 return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_FINEREG_SHFT; ··· 52 52 return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_COARSEREG_SHFT; 53 53 } 54 54 55 - static hubreg_t region_mask; 55 + static u64 region_mask; 56 56 57 - static void gen_region_mask(hubreg_t *region_mask) 57 + static void gen_region_mask(u64 *region_mask) 58 58 { 59 59 cnodeid_t cnode; 60 60
+1 -1
arch/mips/sgi-ip27/ip27-nmi.c
··· 130 130 131 131 void nmi_dump_hub_irq(nasid_t nasid, int slice) 132 132 { 133 - hubreg_t mask0, mask1, pend0, pend1; 133 + u64 mask0, mask1, pend0, pend1; 134 134 135 135 if (slice == 0) { /* Slice A */ 136 136 mask0 = REMOTE_HUB_L(nasid, PI_INT_MASK0_A);