7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * Assembly language support for px driver
31 */
32
33 #include <sys/asm_linkage.h>
34 #include <sys/machthread.h>
35 #include <sys/privregs.h>
36
37 /*LINTLIBRARY*/
38
39 #if defined(lint)
40
41 /*ARGSUSED*/
42 int
43 px_phys_peek_4u(size_t size, uint64_t paddr, uint64_t *value, int type)
44 { return (0); }
45
46 /*ARGSUSED*/
47 int
48 px_phys_poke_4u(size_t size, uint64_t paddr, uint64_t *value, int type)
49 { return (0); }
50
51 #else /* lint */
52
53 ! px_phys_peek_4u: Do physical address read.
54 !
55 ! %o0 is size in bytes - Must be 8, 4, 2 or 1. Invalid sizes default to 1.
56 ! %o1 is address to read
57 ! %o2 is address to save value into
58 ! %o3 is 0 for little endian, non-zero for big endian
59 !
60 ! To be called from an on_trap environment.
61 ! Interrupts will be disabled for the duration of the read, to prevent
62 ! an interrupt from raising the trap level to 1 and then a possible
63 ! data access exception being delivered while the trap level > 0.
64 !
65 ! Always returns success (0) in %o0
66 !
67 ! Assumes alignment is correct and that on_trap handling has been installed
68
69 ENTRY(px_phys_peek_4u)
70
71 rdpr %pstate, %o4 ! Disable interrupts if not already
72 andcc %o4, PSTATE_IE, %g2 ! Save original state first
150 ba .pokedone
151 stuwa %g1, [%o1]%asi
152
153 .poke_half:
154 bne .poke_byte
155 nop
156 lduh [%o2], %g1
157 ba .pokedone
158 stuha %g1, [%o1]%asi
159
160 .poke_byte:
161 ldub [%o2], %g1 ! 8-bit!
162 stuba %g1, [%o1]%asi
163
164 .pokedone:
165 membar #Sync
166 retl
167 mov %g0, %o0
168 SET_SIZE(px_phys_poke_4u)
169
170 #endif
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Assembly language support for px driver
29 */
30
31 #include <sys/asm_linkage.h>
32 #include <sys/machthread.h>
33 #include <sys/privregs.h>
34
35 /*LINTLIBRARY*/
36
37 ! px_phys_peek_4u: Do physical address read.
38 !
39 ! %o0 is size in bytes - Must be 8, 4, 2 or 1. Invalid sizes default to 1.
40 ! %o1 is address to read
41 ! %o2 is address to save value into
42 ! %o3 is 0 for little endian, non-zero for big endian
43 !
44 ! To be called from an on_trap environment.
45 ! Interrupts will be disabled for the duration of the read, to prevent
46 ! an interrupt from raising the trap level to 1 and then a possible
47 ! data access exception being delivered while the trap level > 0.
48 !
49 ! Always returns success (0) in %o0
50 !
51 ! Assumes alignment is correct and that on_trap handling has been installed
52
53 ENTRY(px_phys_peek_4u)
54
55 rdpr %pstate, %o4 ! Disable interrupts if not already
56 andcc %o4, PSTATE_IE, %g2 ! Save original state first
134 ba .pokedone
135 stuwa %g1, [%o1]%asi
136
137 .poke_half:
138 bne .poke_byte
139 nop
140 lduh [%o2], %g1
141 ba .pokedone
142 stuha %g1, [%o1]%asi
143
144 .poke_byte:
145 ldub [%o2], %g1 ! 8-bit!
146 stuba %g1, [%o1]%asi
147
148 .pokedone:
149 membar #Sync
150 retl
151 mov %g0, %o0
152 SET_SIZE(px_phys_poke_4u)
153
|