summaryrefslogtreecommitdiff
path: root/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
blob: 0ecafb352200da8a1e0205c564a105e2f2770741 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#ifdef INLINE_ASM
#define FUNCTION_START(f,n)	.inline f,n
#define FUNCTION_END(f)		.end
#else
#define _ASM
#include <sys/asm_linkage.h>
#define FUNCTION_START(f,n)	ENTRY(f)
#define FUNCTION_END(f)		retl; nop; SET_SIZE(f)
#endif

/* Converted from common/compiler.h gcc inline format to Sun cc inline
 * format by Kenjiro Tsuji	
 *	
 *	The value 0x88 means ASI_PRIMARY_LITTLE.
 *	The store or load to/from the address space will be done
 *	as little-endian. In the original xrog code, the value
 *	is defined as the macro ASI_PL.
 *
 *	In the original xorg code, "membar #StoreStore|#StoreLoad"
 *	is directly implemented as an instruction "0x8143e00a".
 *
 */

	FUNCTION_START(outb, 0)
	stba	%o1, [%o0] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(outb)

	FUNCTION_START(outw, 0)
	stha	%o1, [%o0] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(outw)

	FUNCTION_START(outl, 0)
	sta	%o1, [%o0] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(outl)

	FUNCTION_START(inb, 0)
	lduba	[%o0] 0x88, %o0
	FUNCTION_END(inb)

	FUNCTION_START(inw, 0)
	lduha	[%o0] 0x88, %o0
	FUNCTION_END(inw)

	FUNCTION_START(inl, 0)
	lda	[%o0] 0x88, %o0
	FUNCTION_END(inl)

	FUNCTION_START(xf86ReadMmio8, 0)
	lduba	[%o0 + %o1] 0x88, %o0
	FUNCTION_END(xf86ReadMmio8)

	FUNCTION_START(xf86ReadMmio16Be, 0)
	lduh	[%o0 + %o1], %o0
	FUNCTION_END(xf86ReadMmio16Be)

	FUNCTION_START(xf86ReadMmio16Le, 0)
	lduha	[%o0 + %o1] 0x88, %o0
	FUNCTION_END(xf86ReadMmio16Le)

	FUNCTION_START(xf86ReadMmio32Be, 0)
	ld	[%o0 + %o1], %o0
	FUNCTION_END(xf86ReadMmio32Be)

	FUNCTION_START(xf86ReadMmio32Le, 0)
	lda	[%o0 + %o1] 0x88, %o0
	FUNCTION_END(xf86ReadMmio32Le)

	FUNCTION_START(xf86WriteMmio8, 0)
	stba	%o2, [%o0 + %o1] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(xf86WriteMmio8)

	FUNCTION_START(xf86WriteMmio16Be, 0)
	sth	%o2, [%o0 + %o1]
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(xf86WriteMmio16Be)

	FUNCTION_START(xf86WriteMmio16Le, 0)
	stha	%o2, [%o0 + %o1] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(xf86WriteMmio16Le)

	FUNCTION_START(xf86WriteMmio32Be, 0)
	st	%o2, [%o0 + %o1]
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(xf86WriteMmio32Be)

	FUNCTION_START(xf86WriteMmio32Le, 0)
	sta	%o2, [%o0 + %o1] 0x88
	membar	#StoreStore|#StoreLoad
	FUNCTION_END(xf86WriteMmio32Le)

	FUNCTION_START(xf86WriteMmio8NB, 0)
	add	%o0, %o1, %o0
	stba	%o2, [%o0] 0x88
	FUNCTION_END(xf86WriteMmio8NB)

	FUNCTION_START(xf86WriteMmio16BeNB, 0)
	sth	%o2, [%o0 + %o1]
	FUNCTION_END(xf86WriteMmio16BeNB)

	FUNCTION_START(xf86WriteMmio16LeNB, 0)
	stha	%o2, [%o0 + %o1] 0x88
	FUNCTION_END(xf86WriteMmio16LeNB)

	FUNCTION_START(xf86WriteMmio32BeNB, 0)
	st	%o2, [%o0 + %o1]
	FUNCTION_END(xf86WriteMmio32BeNB)

	FUNCTION_START(xf86WriteMmio32LeNB, 0)
	sta	%o2, [%o0 + %o1] 0x88
	FUNCTION_END(xf86WriteMmio32LeNB)