6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
26 */
27
28 #ifndef _SYS_CPUVAR_H
29 #define _SYS_CPUVAR_H
30
31 #include <sys/thread.h>
32 #include <sys/sysinfo.h> /* has cpu_stat_t definition */
33 #include <sys/disp.h>
34 #include <sys/processor.h>
35
36 #include <sys/loadavg.h>
37 #if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
38 #include <sys/machcpuvar.h>
39 #endif
40
41 #include <sys/types.h>
42 #include <sys/file.h>
43 #include <sys/bitmap.h>
44 #include <sys/rwlock.h>
45 #include <sys/msacct.h>
46 #if defined(__GNUC__) && defined(_ASM_INLINES) && defined(_KERNEL) && \
47 (defined(__i386) || defined(__amd64))
48 #include <asm/cpuvar.h>
49 #endif
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
597 uint64_t *, cpu_t *); \
598 uint64_t *stataddr = &((cp)->cpu_stats.class.stat); \
599 __dtrace_probe___cpu_##class##info_##stat((amount), \
600 stataddr, cp); \
601 *(stataddr) += (amount); \
602 }
603
604 #define CPU_STATS(cp, stat) \
605 ((cp)->cpu_stats.stat)
606
607 /*
608 * Increment CPU generation value.
609 * This macro should be called whenever CPU goes on-line or off-line.
610 * Updates to cpu_generation should be protected by cpu_lock.
611 */
612 #define CPU_NEW_GENERATION(cp) ((cp)->cpu_generation++)
613
614 #endif /* _KERNEL || _KMEMUSER */
615
616 /*
617 * CPU support routines.
618 */
619 #if defined(_KERNEL) && defined(__STDC__) /* not for genassym.c */
620
621 struct zone;
622
623 void cpu_list_init(cpu_t *);
624 void cpu_add_unit(cpu_t *);
625 void cpu_del_unit(int cpuid);
626 void cpu_add_active(cpu_t *);
627 void cpu_kstat_init(cpu_t *);
628 void cpu_visibility_add(cpu_t *, struct zone *);
629 void cpu_visibility_remove(cpu_t *, struct zone *);
630 void cpu_visibility_configure(cpu_t *, struct zone *);
631 void cpu_visibility_unconfigure(cpu_t *, struct zone *);
632 void cpu_visibility_online(cpu_t *, struct zone *);
633 void cpu_visibility_offline(cpu_t *, struct zone *);
634 void cpu_create_intrstat(cpu_t *);
635 void cpu_delete_intrstat(cpu_t *);
636 int cpu_kstat_intrstat_update(kstat_t *, int);
637 void cpu_intr_swtch_enter(kthread_t *);
638 void cpu_intr_swtch_exit(kthread_t *);
639
806 extern void cpu_state_change_notify(int, cpu_setup_t);
807
808 /*
809 * Call specified function on the given CPU
810 */
811 typedef void (*cpu_call_func_t)(uintptr_t, uintptr_t);
812 extern void cpu_call(cpu_t *, cpu_call_func_t, uintptr_t, uintptr_t);
813
814
815 /*
816 * Create various strings that describe the given CPU for the
817 * processor_info system call and configuration-related kstats.
818 */
819 #define CPU_IDSTRLEN 100
820
821 extern void init_cpu_info(struct cpu *);
822 extern void populate_idstr(struct cpu *);
823 extern void cpu_vm_data_init(struct cpu *);
824 extern void cpu_vm_data_destroy(struct cpu *);
825
826 #endif /* _KERNEL */
827
828 #ifdef __cplusplus
829 }
830 #endif
831
832 #endif /* _SYS_CPUVAR_H */
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
26 * Copyright 2017 RackTop Systems.
27 */
28
29 #ifndef _SYS_CPUVAR_H
30 #define _SYS_CPUVAR_H
31
32 #include <sys/thread.h>
33 #include <sys/sysinfo.h> /* has cpu_stat_t definition */
34 #include <sys/disp.h>
35 #include <sys/processor.h>
36 #include <sys/kcpc.h> /* has kcpc_ctx_t definition */
37
38 #include <sys/loadavg.h>
39 #if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
40 #include <sys/machcpuvar.h>
41 #endif
42
43 #include <sys/types.h>
44 #include <sys/file.h>
45 #include <sys/bitmap.h>
46 #include <sys/rwlock.h>
47 #include <sys/msacct.h>
48 #if defined(__GNUC__) && defined(_ASM_INLINES) && defined(_KERNEL) && \
49 (defined(__i386) || defined(__amd64))
50 #include <asm/cpuvar.h>
51 #endif
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
599 uint64_t *, cpu_t *); \
600 uint64_t *stataddr = &((cp)->cpu_stats.class.stat); \
601 __dtrace_probe___cpu_##class##info_##stat((amount), \
602 stataddr, cp); \
603 *(stataddr) += (amount); \
604 }
605
606 #define CPU_STATS(cp, stat) \
607 ((cp)->cpu_stats.stat)
608
609 /*
610 * Increment CPU generation value.
611 * This macro should be called whenever CPU goes on-line or off-line.
612 * Updates to cpu_generation should be protected by cpu_lock.
613 */
614 #define CPU_NEW_GENERATION(cp) ((cp)->cpu_generation++)
615
616 #endif /* _KERNEL || _KMEMUSER */
617
618 /*
619 * CPU support routines (not for genassym.c)
620 */
621 #if defined(_KERNEL) || defined(_FAKE_KERNEL) && defined(__STDC__)
622
623 struct zone;
624
625 void cpu_list_init(cpu_t *);
626 void cpu_add_unit(cpu_t *);
627 void cpu_del_unit(int cpuid);
628 void cpu_add_active(cpu_t *);
629 void cpu_kstat_init(cpu_t *);
630 void cpu_visibility_add(cpu_t *, struct zone *);
631 void cpu_visibility_remove(cpu_t *, struct zone *);
632 void cpu_visibility_configure(cpu_t *, struct zone *);
633 void cpu_visibility_unconfigure(cpu_t *, struct zone *);
634 void cpu_visibility_online(cpu_t *, struct zone *);
635 void cpu_visibility_offline(cpu_t *, struct zone *);
636 void cpu_create_intrstat(cpu_t *);
637 void cpu_delete_intrstat(cpu_t *);
638 int cpu_kstat_intrstat_update(kstat_t *, int);
639 void cpu_intr_swtch_enter(kthread_t *);
640 void cpu_intr_swtch_exit(kthread_t *);
641
808 extern void cpu_state_change_notify(int, cpu_setup_t);
809
810 /*
811 * Call specified function on the given CPU
812 */
813 typedef void (*cpu_call_func_t)(uintptr_t, uintptr_t);
814 extern void cpu_call(cpu_t *, cpu_call_func_t, uintptr_t, uintptr_t);
815
816
817 /*
818 * Create various strings that describe the given CPU for the
819 * processor_info system call and configuration-related kstats.
820 */
821 #define CPU_IDSTRLEN 100
822
823 extern void init_cpu_info(struct cpu *);
824 extern void populate_idstr(struct cpu *);
825 extern void cpu_vm_data_init(struct cpu *);
826 extern void cpu_vm_data_destroy(struct cpu *);
827
828 #endif /* _KERNEL || _FAKE_KERNEL */
829
830 #ifdef __cplusplus
831 }
832 #endif
833
834 #endif /* _SYS_CPUVAR_H */
|