Skip to content

Commit db0e7d4

Browse files
Thomas Bogendoerferpaulburton
authored andcommitted
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
1 parent 72faa7a commit db0e7d4

File tree

8 files changed

+19
-75
lines changed

8 files changed

+19
-75
lines changed

arch/mips/include/asm/sn/addrs.h

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,11 @@
2727

2828
#ifndef __ASSEMBLY__
2929

30-
#define PS_UINT_CAST (unsigned long)
3130
#define UINT64_CAST (unsigned long)
3231

33-
#define HUBREG_CAST (volatile hubreg_t *)
34-
3532
#else /* __ASSEMBLY__ */
3633

37-
#define PS_UINT_CAST
3834
#define UINT64_CAST
39-
#define HUBREG_CAST
4035

4136
#endif /* __ASSEMBLY__ */
4237

@@ -256,41 +251,22 @@
256251
* Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
257252
* They're always safe.
258253
*/
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)))
266256

267257
#ifndef __ASSEMBLY__
268258

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)))
271261

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)))
278267

279268
#endif /* !__ASSEMBLY__ */
280269

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-
294270
/*
295271
* Software structure locations -- permanently fixed
296272
* See diagram in kldir.h
@@ -387,44 +363,14 @@
387363

388364
#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
389365

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-
413366
#define NODE_OFFSET_TO_K0(_nasid, _off) \
414367
PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
415368
#define NODE_OFFSET_TO_K1(_nasid, _off) \
416369
TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
417-
#define K0_TO_NODE_OFFSET(_k0addr) \
418-
((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
419370

420371
#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
421372
#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
422373

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-
428374
#endif /* !__ASSEMBLY__ */
429375

430376

arch/mips/include/asm/sn/arch.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <asm/sn/sn0/arch.h>
1818
#endif
1919

20-
typedef u64 hubreg_t;
21-
2220
#define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
2321
#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
2422
#define makespnum(_nasid, _slice) \

arch/mips/include/asm/sn/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \
4545
(bigwin), IIO_ITTE_INVALID_WIDGET, 0)
4646

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))
4848

4949
/*
5050
* Macro which takes the widget number, and returns the

arch/mips/sgi-ip27/ip27-hubio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
6363
* after we write it.
6464
*/
6565
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));
6767

6868
return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE);
6969
}
@@ -135,7 +135,7 @@ static void hub_setup_prb(nasid_t nasid, int prbnum, int credits)
135135
**/
136136
static void hub_set_piomode(nasid_t nasid)
137137
{
138-
hubreg_t ii_iowa;
138+
u64 ii_iowa;
139139
hubii_wcr_t ii_wcr;
140140
unsigned i;
141141

arch/mips/sgi-ip27/ip27-init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ extern void ip27_reboot_setup(void);
177177

178178
void __init plat_mem_setup(void)
179179
{
180-
hubreg_t p, e, n_mode;
180+
u64 p, e, n_mode;
181181
nasid_t nid;
182182

183183
ip27_reboot_setup();

arch/mips/sgi-ip27/ip27-irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int ms1bit(unsigned long x)
8585
static void ip27_do_irq_mask0(void)
8686
{
8787
int irq, swlevel;
88-
hubreg_t pend0, mask0;
88+
u64 pend0, mask0;
8989
cpuid_t cpu = smp_processor_id();
9090
int pi_int_mask0 =
9191
(cputoslice(cpu) == 0) ? PI_INT_MASK0_A : PI_INT_MASK0_B;
@@ -132,7 +132,7 @@ static void ip27_do_irq_mask0(void)
132132
static void ip27_do_irq_mask1(void)
133133
{
134134
int irq, swlevel;
135-
hubreg_t pend1, mask1;
135+
u64 pend1, mask1;
136136
cpuid_t cpu = smp_processor_id();
137137
int pi_int_mask1 = (cputoslice(cpu) == 0) ? PI_INT_MASK1_A : PI_INT_MASK1_B;
138138
struct slice_data *si = cpu_data[cpu].data;

arch/mips/sgi-ip27/ip27-memory.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ static int is_fine_dirmode(void)
4444
return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE;
4545
}
4646

47-
static hubreg_t get_region(cnodeid_t cnode)
47+
static u64 get_region(cnodeid_t cnode)
4848
{
4949
if (fine_mode)
5050
return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_FINEREG_SHFT;
5151
else
5252
return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_COARSEREG_SHFT;
5353
}
5454

55-
static hubreg_t region_mask;
55+
static u64 region_mask;
5656

57-
static void gen_region_mask(hubreg_t *region_mask)
57+
static void gen_region_mask(u64 *region_mask)
5858
{
5959
cnodeid_t cnode;
6060

arch/mips/sgi-ip27/ip27-nmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void nmi_cpu_eframe_save(nasid_t nasid, int slice)
130130

131131
void nmi_dump_hub_irq(nasid_t nasid, int slice)
132132
{
133-
hubreg_t mask0, mask1, pend0, pend1;
133+
u64 mask0, mask1, pend0, pend1;
134134

135135
if (slice == 0) { /* Slice A */
136136
mask0 = REMOTE_HUB_L(nasid, PI_INT_MASK0_A);

0 commit comments

Comments
 (0)