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 physical big/little endian access of pcitool
31 * in the PCI drivers.
32 */
33
34 #include <sys/asm_linkage.h>
35 #include <sys/machthread.h>
36 #include <sys/privregs.h>
37
38 /*LINTLIBRARY*/
39
40 #if defined(lint)
41
42 /*ARGSUSED*/
43 int pci_do_phys_peek(size_t size, uint64_t paddr, uint64_t *value, int type)
44 { return (0); }
45
46 int pci_do_phys_poke(size_t size, uint64_t paddr, uint64_t *value, int type)
47 { return (0); }
48
49 #else /* lint */
50
51 ! pci_do_phys_peek: Do physical address read.
52 !
53 ! %o0 is size in bytes - Must be 8, 4, 2 or 1. Invalid sizes default to 1.
54 ! %o1 is address to read
55 ! %o2 is address to save value into
56 ! %o3 is 0 for little endian, non-zero for big endian
57 !
58 ! To be called from an on_trap environment.
59 ! Interrupts will be disabled for the duration of the read, to prevent
60 ! an interrupt from raising the trap level to 1 and then a possible
61 ! data access exception being delivered while the trap level > 0.
62 !
63 ! Assumes alignment is correct.
64
65 ENTRY(pci_do_phys_peek)
66
67 rdpr %pstate, %o4 ! Disable interrupts if not already
68 andcc %o4, PSTATE_IE, %g2 ! Save original state first
69 bz .peek_ints_disabled
70 nop
147 ba .pokedone
148 stuwa %g1, [%o1]%asi
149
150 .poke_half:
151 bne .poke_byte
152 nop
153 lduh [%o2], %g1
154 ba .pokedone
155 stuha %g1, [%o1]%asi
156
157 .poke_byte:
158 ldub [%o2], %g1 ! 8-bit!
159 stuba %g1, [%o1]%asi
160
161 .pokedone:
162 membar #Sync
163 retl
164 mov %g0, %o0
165 SET_SIZE(pci_do_phys_poke)
166
167 #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 physical big/little endian access of pcitool
29 * in the PCI drivers.
30 */
31
32 #include <sys/asm_linkage.h>
33 #include <sys/machthread.h>
34 #include <sys/privregs.h>
35
36 /*LINTLIBRARY*/
37
38 ! pci_do_phys_peek: Do physical address read.
39 !
40 ! %o0 is size in bytes - Must be 8, 4, 2 or 1. Invalid sizes default to 1.
41 ! %o1 is address to read
42 ! %o2 is address to save value into
43 ! %o3 is 0 for little endian, non-zero for big endian
44 !
45 ! To be called from an on_trap environment.
46 ! Interrupts will be disabled for the duration of the read, to prevent
47 ! an interrupt from raising the trap level to 1 and then a possible
48 ! data access exception being delivered while the trap level > 0.
49 !
50 ! Assumes alignment is correct.
51
52 ENTRY(pci_do_phys_peek)
53
54 rdpr %pstate, %o4 ! Disable interrupts if not already
55 andcc %o4, PSTATE_IE, %g2 ! Save original state first
56 bz .peek_ints_disabled
57 nop
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(pci_do_phys_poke)
153
|