xref: /illumos-gate/usr/src/uts/i86pc/io/cbe.c (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #include <sys/systm.h>
29*7c478bd9Sstevel@tonic-gate #include <sys/cyclic.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/cyclic_impl.h>
31*7c478bd9Sstevel@tonic-gate #include <sys/spl.h>
32*7c478bd9Sstevel@tonic-gate #include <sys/x_call.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/machsystm.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/smp_impldefs.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/psm_types.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/atomic.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/clock.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/ddi_intr.h>
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate static int cbe_vector;
43*7c478bd9Sstevel@tonic-gate static int cbe_ticks = 0;
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate static cyc_func_t volatile cbe_xcall_func;
46*7c478bd9Sstevel@tonic-gate static cpu_t *volatile cbe_xcall_cpu;
47*7c478bd9Sstevel@tonic-gate static void *cbe_xcall_farg;
48*7c478bd9Sstevel@tonic-gate static cpuset_t cbe_enabled;
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate static ddi_softint_hdl_impl_t cbe_low_hdl =
51*7c478bd9Sstevel@tonic-gate 	{0, NULL, NULL, 0, 0, NULL, NULL, NULL};
52*7c478bd9Sstevel@tonic-gate static ddi_softint_hdl_impl_t cbe_clock_hdl =
53*7c478bd9Sstevel@tonic-gate 	{0, NULL, NULL, 0, 0, NULL, NULL, NULL};
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate cyclic_id_t cbe_hres_cyclic;
56*7c478bd9Sstevel@tonic-gate int cbe_psm_timer_mode = TIMER_ONESHOT;
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate void cbe_hres_tick(void);
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate int
61*7c478bd9Sstevel@tonic-gate cbe_softclock(void)
62*7c478bd9Sstevel@tonic-gate {
63*7c478bd9Sstevel@tonic-gate 	cyclic_softint(CPU, CY_LOCK_LEVEL);
64*7c478bd9Sstevel@tonic-gate 	return (1);
65*7c478bd9Sstevel@tonic-gate }
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate int
68*7c478bd9Sstevel@tonic-gate cbe_low_level(void)
69*7c478bd9Sstevel@tonic-gate {
70*7c478bd9Sstevel@tonic-gate 	cpu_t *cpu = CPU;
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate 	cyclic_softint(cpu, CY_LOW_LEVEL);
73*7c478bd9Sstevel@tonic-gate 	return (1);
74*7c478bd9Sstevel@tonic-gate }
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /*
77*7c478bd9Sstevel@tonic-gate  * We can be in cbe_fire() either due to a cyclic-induced cross call, or due
78*7c478bd9Sstevel@tonic-gate  * to the timer firing at level-14.  Because cyclic_fire() can tolerate
79*7c478bd9Sstevel@tonic-gate  * spurious calls, it would not matter if we called cyclic_fire() in both
80*7c478bd9Sstevel@tonic-gate  * cases.
81*7c478bd9Sstevel@tonic-gate  *
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate int
84*7c478bd9Sstevel@tonic-gate cbe_fire(void)
85*7c478bd9Sstevel@tonic-gate {
86*7c478bd9Sstevel@tonic-gate 	cpu_t *cpu = CPU;
87*7c478bd9Sstevel@tonic-gate 	processorid_t me = cpu->cpu_id, i;
88*7c478bd9Sstevel@tonic-gate 	int cross_call = (cbe_xcall_func != NULL && cbe_xcall_cpu == cpu);
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate 	cyclic_fire(cpu);
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 	if (cbe_psm_timer_mode != TIMER_ONESHOT && me == 0 && !cross_call) {
93*7c478bd9Sstevel@tonic-gate 		for (i = 1; i < NCPU; i++) {
94*7c478bd9Sstevel@tonic-gate 			if (CPU_IN_SET(cbe_enabled, i))
95*7c478bd9Sstevel@tonic-gate 				send_dirint(i, CBE_HIGH_PIL);
96*7c478bd9Sstevel@tonic-gate 		}
97*7c478bd9Sstevel@tonic-gate 	}
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate 	if (cross_call) {
100*7c478bd9Sstevel@tonic-gate 		ASSERT(cbe_xcall_func != NULL && cbe_xcall_cpu == cpu);
101*7c478bd9Sstevel@tonic-gate 		(*cbe_xcall_func)(cbe_xcall_farg);
102*7c478bd9Sstevel@tonic-gate 		cbe_xcall_func = NULL;
103*7c478bd9Sstevel@tonic-gate 		cbe_xcall_cpu = NULL;
104*7c478bd9Sstevel@tonic-gate 	}
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate 	return (1);
107*7c478bd9Sstevel@tonic-gate }
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
110*7c478bd9Sstevel@tonic-gate void
111*7c478bd9Sstevel@tonic-gate cbe_softint(void *arg, cyc_level_t level)
112*7c478bd9Sstevel@tonic-gate {
113*7c478bd9Sstevel@tonic-gate 	switch (level) {
114*7c478bd9Sstevel@tonic-gate 	case CY_LOW_LEVEL:
115*7c478bd9Sstevel@tonic-gate 		cbe_low_hdl.ih_pending = 1;
116*7c478bd9Sstevel@tonic-gate 		(*setsoftint)(CBE_LOW_PIL);
117*7c478bd9Sstevel@tonic-gate 		break;
118*7c478bd9Sstevel@tonic-gate 	case CY_LOCK_LEVEL:
119*7c478bd9Sstevel@tonic-gate 		cbe_clock_hdl.ih_pending = 1;
120*7c478bd9Sstevel@tonic-gate 		(*setsoftint)(CBE_LOCK_PIL);
121*7c478bd9Sstevel@tonic-gate 		break;
122*7c478bd9Sstevel@tonic-gate 	default:
123*7c478bd9Sstevel@tonic-gate 		panic("cbe_softint: unexpected soft level %d", level);
124*7c478bd9Sstevel@tonic-gate 	}
125*7c478bd9Sstevel@tonic-gate }
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
128*7c478bd9Sstevel@tonic-gate void
129*7c478bd9Sstevel@tonic-gate cbe_reprogram(void *arg, hrtime_t time)
130*7c478bd9Sstevel@tonic-gate {
131*7c478bd9Sstevel@tonic-gate 	if (cbe_psm_timer_mode == TIMER_ONESHOT)
132*7c478bd9Sstevel@tonic-gate 		(*psm_timer_reprogram)(time);
133*7c478bd9Sstevel@tonic-gate }
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
136*7c478bd9Sstevel@tonic-gate cyc_cookie_t
137*7c478bd9Sstevel@tonic-gate cbe_set_level(void *arg, cyc_level_t level)
138*7c478bd9Sstevel@tonic-gate {
139*7c478bd9Sstevel@tonic-gate 	int ipl;
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate 	switch (level) {
142*7c478bd9Sstevel@tonic-gate 	case CY_LOW_LEVEL:
143*7c478bd9Sstevel@tonic-gate 		ipl = CBE_LOW_PIL;
144*7c478bd9Sstevel@tonic-gate 		break;
145*7c478bd9Sstevel@tonic-gate 	case CY_LOCK_LEVEL:
146*7c478bd9Sstevel@tonic-gate 		ipl = CBE_LOCK_PIL;
147*7c478bd9Sstevel@tonic-gate 		break;
148*7c478bd9Sstevel@tonic-gate 	case CY_HIGH_LEVEL:
149*7c478bd9Sstevel@tonic-gate 		ipl = CBE_HIGH_PIL;
150*7c478bd9Sstevel@tonic-gate 		break;
151*7c478bd9Sstevel@tonic-gate 	default:
152*7c478bd9Sstevel@tonic-gate 		panic("cbe_set_level: unexpected level %d", level);
153*7c478bd9Sstevel@tonic-gate 	}
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 	return (splr(ipltospl(ipl)));
156*7c478bd9Sstevel@tonic-gate }
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
159*7c478bd9Sstevel@tonic-gate void
160*7c478bd9Sstevel@tonic-gate cbe_restore_level(void *arg, cyc_cookie_t cookie)
161*7c478bd9Sstevel@tonic-gate {
162*7c478bd9Sstevel@tonic-gate 	splx(cookie);
163*7c478bd9Sstevel@tonic-gate }
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
166*7c478bd9Sstevel@tonic-gate void
167*7c478bd9Sstevel@tonic-gate cbe_xcall(void *arg, cpu_t *dest, cyc_func_t func, void *farg)
168*7c478bd9Sstevel@tonic-gate {
169*7c478bd9Sstevel@tonic-gate 	kpreempt_disable();
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate 	if (dest == CPU) {
172*7c478bd9Sstevel@tonic-gate 		(*func)(farg);
173*7c478bd9Sstevel@tonic-gate 		kpreempt_enable();
174*7c478bd9Sstevel@tonic-gate 		return;
175*7c478bd9Sstevel@tonic-gate 	}
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	ASSERT(cbe_xcall_func == NULL);
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate 	cbe_xcall_farg = farg;
180*7c478bd9Sstevel@tonic-gate 	membar_producer();
181*7c478bd9Sstevel@tonic-gate 	cbe_xcall_cpu = dest;
182*7c478bd9Sstevel@tonic-gate 	cbe_xcall_func = func;
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate 	send_dirint(dest->cpu_id, CBE_HIGH_PIL);
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate 	while (cbe_xcall_func != NULL || cbe_xcall_cpu != NULL)
187*7c478bd9Sstevel@tonic-gate 		continue;
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate 	kpreempt_enable();
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate 	ASSERT(cbe_xcall_func == NULL && cbe_xcall_cpu == NULL);
192*7c478bd9Sstevel@tonic-gate }
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate void *
195*7c478bd9Sstevel@tonic-gate cbe_configure(cpu_t *cpu)
196*7c478bd9Sstevel@tonic-gate {
197*7c478bd9Sstevel@tonic-gate 	return (cpu);
198*7c478bd9Sstevel@tonic-gate }
199*7c478bd9Sstevel@tonic-gate 
200*7c478bd9Sstevel@tonic-gate void
201*7c478bd9Sstevel@tonic-gate cbe_enable(void *arg)
202*7c478bd9Sstevel@tonic-gate {
203*7c478bd9Sstevel@tonic-gate 	processorid_t me = ((cpu_t *)arg)->cpu_id;
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate 	if ((cbe_psm_timer_mode != TIMER_ONESHOT) && (me == 0))
206*7c478bd9Sstevel@tonic-gate 		return;
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate 	ASSERT(!CPU_IN_SET(cbe_enabled, me));
209*7c478bd9Sstevel@tonic-gate 	CPUSET_ADD(cbe_enabled, me);
210*7c478bd9Sstevel@tonic-gate 	if (cbe_psm_timer_mode == TIMER_ONESHOT)
211*7c478bd9Sstevel@tonic-gate 		(*psm_timer_enable)();
212*7c478bd9Sstevel@tonic-gate }
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate void
215*7c478bd9Sstevel@tonic-gate cbe_disable(void *arg)
216*7c478bd9Sstevel@tonic-gate {
217*7c478bd9Sstevel@tonic-gate 	processorid_t me = ((cpu_t *)arg)->cpu_id;
218*7c478bd9Sstevel@tonic-gate 
219*7c478bd9Sstevel@tonic-gate 	if (me == 0) {
220*7c478bd9Sstevel@tonic-gate 		/*
221*7c478bd9Sstevel@tonic-gate 		 * If this is the boot CPU, we'll quietly refuse to disable
222*7c478bd9Sstevel@tonic-gate 		 * our clock interrupt.
223*7c478bd9Sstevel@tonic-gate 		 */
224*7c478bd9Sstevel@tonic-gate 		return;
225*7c478bd9Sstevel@tonic-gate 	}
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate 	ASSERT(CPU_IN_SET(cbe_enabled, me));
228*7c478bd9Sstevel@tonic-gate 	CPUSET_DEL(cbe_enabled, me);
229*7c478bd9Sstevel@tonic-gate 	if (cbe_psm_timer_mode == TIMER_ONESHOT)
230*7c478bd9Sstevel@tonic-gate 		(*psm_timer_disable)();
231*7c478bd9Sstevel@tonic-gate }
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate /*
234*7c478bd9Sstevel@tonic-gate  * Called only on CPU 0. This is done since TSCs can have deltas between
235*7c478bd9Sstevel@tonic-gate  * different cpus see tsc_tick()
236*7c478bd9Sstevel@tonic-gate  */
237*7c478bd9Sstevel@tonic-gate void
238*7c478bd9Sstevel@tonic-gate cbe_hres_tick(void)
239*7c478bd9Sstevel@tonic-gate {
240*7c478bd9Sstevel@tonic-gate 	int s;
241*7c478bd9Sstevel@tonic-gate 
242*7c478bd9Sstevel@tonic-gate 	dtrace_hres_tick();
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate 	/*
245*7c478bd9Sstevel@tonic-gate 	 * Because hres_tick effectively locks hres_lock, we must be at the
246*7c478bd9Sstevel@tonic-gate 	 * same PIL as that used for CLOCK_LOCK.
247*7c478bd9Sstevel@tonic-gate 	 */
248*7c478bd9Sstevel@tonic-gate 	s = splr(ipltospl(XC_HI_PIL));
249*7c478bd9Sstevel@tonic-gate 	hres_tick();
250*7c478bd9Sstevel@tonic-gate 	splx(s);
251*7c478bd9Sstevel@tonic-gate 
252*7c478bd9Sstevel@tonic-gate 	if ((cbe_ticks % hz) == 0)
253*7c478bd9Sstevel@tonic-gate 		(*hrtime_tick)();
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate 	cbe_ticks++;
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate }
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate void
260*7c478bd9Sstevel@tonic-gate cbe_init(void)
261*7c478bd9Sstevel@tonic-gate {
262*7c478bd9Sstevel@tonic-gate 	cyc_backend_t cbe = {
263*7c478bd9Sstevel@tonic-gate 		cbe_configure,		/* cyb_configure */
264*7c478bd9Sstevel@tonic-gate 		NULL,			/* cyb_unconfigure */
265*7c478bd9Sstevel@tonic-gate 		cbe_enable,		/* cyb_enable */
266*7c478bd9Sstevel@tonic-gate 		cbe_disable,		/* cyb_disable */
267*7c478bd9Sstevel@tonic-gate 		cbe_reprogram,		/* cyb_reprogram */
268*7c478bd9Sstevel@tonic-gate 		cbe_softint,		/* cyb_softint */
269*7c478bd9Sstevel@tonic-gate 		cbe_set_level,		/* cyb_set_level */
270*7c478bd9Sstevel@tonic-gate 		cbe_restore_level,	/* cyb_restore_level */
271*7c478bd9Sstevel@tonic-gate 		cbe_xcall,		/* cyb_xcall */
272*7c478bd9Sstevel@tonic-gate 		NULL,			/* cyb_suspend */
273*7c478bd9Sstevel@tonic-gate 		NULL			/* cyb_resume */
274*7c478bd9Sstevel@tonic-gate 	};
275*7c478bd9Sstevel@tonic-gate 	hrtime_t resolution;
276*7c478bd9Sstevel@tonic-gate 	cyc_handler_t hdlr;
277*7c478bd9Sstevel@tonic-gate 	cyc_time_t when;
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate 	cbe_vector = (*psm_get_clockirq)(CBE_HIGH_PIL);
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate 	CPUSET_ZERO(cbe_enabled);
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate 	resolution = (*clkinitf)(TIMER_ONESHOT, &cbe_psm_timer_mode);
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate 	mutex_enter(&cpu_lock);
286*7c478bd9Sstevel@tonic-gate 	cyclic_init(&cbe, resolution);
287*7c478bd9Sstevel@tonic-gate 	mutex_exit(&cpu_lock);
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate 	(void) add_avintr(NULL, CBE_HIGH_PIL, (avfunc)cbe_fire,
290*7c478bd9Sstevel@tonic-gate 	    "cbe_fire_master", cbe_vector, 0, NULL, NULL);
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate 	if (psm_get_ipivect != NULL) {
293*7c478bd9Sstevel@tonic-gate 		(void) add_avintr(NULL, CBE_HIGH_PIL, (avfunc)cbe_fire,
294*7c478bd9Sstevel@tonic-gate 		    "cbe_fire_slave",
295*7c478bd9Sstevel@tonic-gate 		    (*psm_get_ipivect)(CBE_HIGH_PIL, PSM_INTR_IPI_HI),
296*7c478bd9Sstevel@tonic-gate 		    0, NULL, NULL);
297*7c478bd9Sstevel@tonic-gate 	}
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate 	(void) add_avsoftintr((void *)&cbe_clock_hdl, CBE_LOCK_PIL,
300*7c478bd9Sstevel@tonic-gate 	    (avfunc)cbe_softclock, "softclock", NULL, NULL);
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate 	(void) add_avsoftintr((void *)&cbe_low_hdl, CBE_LOW_PIL,
303*7c478bd9Sstevel@tonic-gate 	    (avfunc)cbe_low_level, "low level", NULL, NULL);
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate 	mutex_enter(&cpu_lock);
306*7c478bd9Sstevel@tonic-gate 
307*7c478bd9Sstevel@tonic-gate 	hdlr.cyh_level = CY_HIGH_LEVEL;
308*7c478bd9Sstevel@tonic-gate 	hdlr.cyh_func = (cyc_func_t)cbe_hres_tick;
309*7c478bd9Sstevel@tonic-gate 	hdlr.cyh_arg = NULL;
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate 	when.cyt_when = 0;
312*7c478bd9Sstevel@tonic-gate 	when.cyt_interval = nsec_per_tick;
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate 	cbe_hres_cyclic = cyclic_add(&hdlr, &when);
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate 	/* bind to cpu 0, which is also the boot cpu */
317*7c478bd9Sstevel@tonic-gate 	cyclic_bind(cbe_hres_cyclic, CPU, NULL);
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate 	if (psm_post_cyclic_setup != NULL)
320*7c478bd9Sstevel@tonic-gate 		(*psm_post_cyclic_setup)(NULL);
321*7c478bd9Sstevel@tonic-gate 
322*7c478bd9Sstevel@tonic-gate 	mutex_exit(&cpu_lock);
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate }
325