summaryrefslogtreecommitdiffstats
path: root/arch/sparc/ap1000/apinline.h
blob: d8170b59ef19afdaa87489d45c88c47c9e559eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  /*
   * Copyright 1996 The Australian National University.
   * Copyright 1996 Fujitsu Laboratories Limited
   * 
   * This software may be distributed under the terms of the Gnu
   * Public License version 2 or later
  */
/* inline utilities to support the AP1000 code */

#if 0
/* MMU bypass access */

static inline unsigned long phys_9_in(unsigned long paddr)
{
	unsigned long word;

	__asm__ __volatile__("lda [%1] %2, %0\n\t" :
			     "=r" (word) :
			     "r" (paddr), "i" (0x29) :
			     "memory");
	return word;
}

static inline void phys_9_out(unsigned long paddr, unsigned long word)
{
	__asm__ __volatile__("sta %0, [%1] %2\n\t" : :
			     "r" (word), "r" (paddr), "i" (0x29) :
			     "memory");
}

static inline unsigned long phys_b_in(unsigned long paddr)
{
	unsigned long word;

	__asm__ __volatile__("lda [%1] %2, %0\n\t" :
			     "=r" (word) :
			     "r" (paddr), "i" (0x2b) :
			     "memory");
	return word;
}

static inline void phys_b_out(unsigned long paddr, unsigned long word)
{
	__asm__ __volatile__("sta %0, [%1] %2\n\t" : :
			     "r" (word), "r" (paddr), "i" (0x2b) :
			     "memory");
}

static inline unsigned long phys_c_in(unsigned long paddr)
{
	unsigned long word;

	__asm__ __volatile__("lda [%1] %2, %0\n\t" :
			     "=r" (word) :
			     "r" (paddr), "i" (0x2b) :
			     "memory");
	return word;
}

static inline void phys_c_out(unsigned long paddr, unsigned long word)
{
	__asm__ __volatile__("sta %0, [%1] %2\n\t" : :
			     "r" (word), "r" (paddr), "i" (0x2b) :
			     "memory");
}

#undef BIF_IN
#undef BIF_OUT
#undef DMA_IN
#undef DMA_OUT
#undef MSC_IN
#undef MSC_OUT
#undef MC_IN
#undef MC_OUT

#define BIF_IN(reg) phys_9_in(reg)
#define BIF_OUT(reg,v) phys_9_out(reg,v)
#define DMA_IN(reg) phys_9_in(reg)
#define DMA_OUT(reg,v) phys_9_out(reg,v)
#define MC_IN(reg) phys_b_in((reg) - MC_BASE0)
#define MC_OUT(reg,v) phys_b_out((reg) - MC_BASE0,v)
#define MSC_IN(reg) phys_c_in((reg) - MSC_BASE0)
#define MSC_OUT(reg,v) phys_c_out((reg) - MSC_BASE0,v)
#endif