xref: /titanic_44/usr/src/uts/common/sys/cyclic.h (revision 0cd13cbfb4270b840b4bd22ec5f673b2b6a2c02b)
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 (c) 1999-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_CYCLIC_H
28 #define	_SYS_CYCLIC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef _ASM
37 #include <sys/time.h>
38 #include <sys/cpuvar.h>
39 #include <sys/cpupart.h>
40 #endif /* !_ASM */
41 
42 #define	CY_LOW_LEVEL		0
43 #define	CY_LOCK_LEVEL		1
44 #define	CY_HIGH_LEVEL		2
45 #define	CY_SOFT_LEVELS		2
46 #define	CY_LEVELS		3
47 
48 #ifndef _ASM
49 
50 typedef uintptr_t cyclic_id_t;
51 typedef int cyc_index_t;
52 typedef int cyc_cookie_t;
53 typedef uint16_t cyc_level_t;
54 typedef void (*cyc_func_t)(void *);
55 typedef void *cyb_arg_t;
56 
57 #define	CYCLIC_NONE		((cyclic_id_t)0)
58 
59 typedef struct cyc_handler {
60 	cyc_func_t cyh_func;
61 	void *cyh_arg;
62 	cyc_level_t cyh_level;
63 } cyc_handler_t;
64 
65 typedef struct cyc_time {
66 	hrtime_t cyt_when;
67 	hrtime_t cyt_interval;
68 } cyc_time_t;
69 
70 typedef struct cyc_omni_handler {
71 	void (*cyo_online)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *);
72 	void (*cyo_offline)(void *, cpu_t *, void *);
73 	void *cyo_arg;
74 } cyc_omni_handler_t;
75 
76 #ifdef _KERNEL
77 
78 extern cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *);
79 extern cyclic_id_t cyclic_add_omni(cyc_omni_handler_t *);
80 extern void cyclic_remove(cyclic_id_t);
81 extern void cyclic_bind(cyclic_id_t, cpu_t *, cpupart_t *);
82 extern hrtime_t cyclic_getres();
83 
84 extern int cyclic_offline(cpu_t *cpu);
85 extern void cyclic_online(cpu_t *cpu);
86 extern int cyclic_juggle(cpu_t *cpu);
87 extern void cyclic_move_in(cpu_t *);
88 extern int cyclic_move_out(cpu_t *);
89 extern void cyclic_suspend();
90 extern void cyclic_resume();
91 
92 extern void cyclic_fire(cpu_t *cpu);
93 extern void cyclic_softint(cpu_t *cpu, cyc_level_t level);
94 
95 #endif /* _KERNEL */
96 
97 #endif /* !_ASM */
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif /* _SYS_CYCLIC_H */
104