xref: /titanic_41/usr/src/uts/sun4/ml/cpc_hwreg.s (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
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 1999-2001,2003 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 * Routines for manipulating the UltraSPARC performance
31 * counter registers (%pcr and %pic)
32 */
33
34#include <sys/asm_linkage.h>
35
36#if defined(lint) || defined(__lint)
37
38#include <sys/cpc_ultra.h>
39
40/*ARGSUSED*/
41void
42ultra_setpcr(uint64_t pcr)
43{}
44
45/*ARGSUSED*/
46uint64_t
47ultra_getpcr(void)
48{ return (0); }
49
50/*ARGSUSED*/
51void
52ultra_setpic(uint64_t pic)
53{}
54
55uint64_t
56ultra_getpic(void)
57{ return (0); }
58
59uint64_t
60ultra_gettick(void)
61{ return (0); }
62
63#else	/* lint || __lint */
64
65	ENTRY(ultra_setpcr)
66	retl
67	wr	%o0, %pcr
68	SET_SIZE(ultra_setpcr)
69
70	ENTRY(ultra_getpcr)
71	retl
72	rd	%pcr, %o0
73	SET_SIZE(ultra_getpcr)
74
75	ENTRY(ultra_setpic)
76#if defined(BB_ERRATA_1)	/* Writes to %pic may fail */
77	ba	1f
78	nop
79	.align	16
801:	wr	%o0, %pic
81	rd	%pic, %g0
82	retl
83	nop
84#else
85	retl
86	wr	%o0, %pic
87#endif	/* BB_ERRATA_1 */
88	SET_SIZE(ultra_setpic)
89
90	ENTRY(ultra_getpic)
91	retl
92	rd	%pic, %o0
93	SET_SIZE(ultra_getpic)
94
95/*
96 * This isn't the routine you're looking for.
97 *
98 * The routine simply returns the value of %tick on the *current* processor.
99 * Most of the time, gettick() [which in turn maps to %stick on platforms
100 * that have different CPU %tick rates] is what you want.
101 */
102
103	ENTRY(ultra_gettick)
104	retl
105	rdpr	%tick, %o0
106	SET_SIZE(ultra_gettick)
107
108#endif	/* lint || __lint */
109