xref: /titanic_44/usr/src/uts/i86pc/sys/machcpuvar.h (revision b9238976491622ad75a67ab0c12edf99e36212b9)
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 (the "License").
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_MACHCPUVAR_H
27 #define	_SYS_MACHCPUVAR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/inttypes.h>
36 #include <sys/xc_levels.h>
37 #include <sys/tss.h>
38 #include <sys/segments.h>
39 #include <sys/rm_platter.h>
40 #include <sys/avintr.h>
41 #include <sys/pte.h>
42 
43 #ifndef	_ASM
44 /*
45  * Machine specific fields of the cpu struct
46  * defined in common/sys/cpuvar.h.
47  *
48  * Note:  This is kinda kludgy but seems to be the best
49  * of our alternatives.
50  */
51 typedef void *cpu_pri_lev_t;
52 
53 struct cpuid_info;
54 struct cpu_ucode_info;
55 
56 /*
57  * A note about the hypervisor affinity bits: a one bit in the affinity mask
58  * means the corresponding event channel is allowed to be serviced
59  * by this cpu.
60  */
61 struct xen_evt_data {
62 	ulong_t		pending_sel[PIL_MAX + 1]; /* event array selectors */
63 	ulong_t		pending_evts[PIL_MAX + 1][sizeof (ulong_t) * 8];
64 	ulong_t		evt_affinity[sizeof (ulong_t) * 8]; /* service on cpu */
65 };
66 
67 struct	machcpu {
68 	/* define all the x_call stuff */
69 	volatile int	xc_pend[X_CALL_LEVELS];
70 	volatile int	xc_wait[X_CALL_LEVELS];
71 	volatile int	xc_ack[X_CALL_LEVELS];
72 	volatile int	xc_state[X_CALL_LEVELS];
73 	volatile int	xc_retval[X_CALL_LEVELS];
74 
75 	int		mcpu_nodeid;		/* node-id */
76 	int		mcpu_pri;		/* CPU priority */
77 	cpu_pri_lev_t	mcpu_pri_data;		/* ptr to machine dependent */
78 						/* data for setting priority */
79 						/* level */
80 
81 	struct hat	*mcpu_current_hat; /* cpu's current hat */
82 
83 	struct hat_cpu_info	*mcpu_hat_info;
84 
85 	volatile ulong_t	mcpu_tlb_info;
86 
87 	/* i86 hardware table addresses that cannot be shared */
88 
89 	user_desc_t	*mcpu_gdt;	/* GDT */
90 	gate_desc_t	*mcpu_idt;	/* current IDT */
91 
92 	struct tss	*mcpu_tss;	/* TSS */
93 
94 	kmutex_t	mcpu_ppaddr_mutex;
95 	caddr_t		mcpu_caddr1;	/* per cpu CADDR1 */
96 	caddr_t		mcpu_caddr2;	/* per cpu CADDR2 */
97 	uint64_t	mcpu_caddr1pte;
98 	uint64_t	mcpu_caddr2pte;
99 
100 	struct softint	mcpu_softinfo;
101 	uint64_t	pil_high_start[HIGH_LEVELS];
102 	uint64_t	intrstat[PIL_MAX + 1][2];
103 
104 	struct cpuid_info	 *mcpu_cpi;
105 
106 #if defined(__amd64)
107 	greg_t	mcpu_rtmp_rsp;		/* syscall: temporary %rsp stash */
108 	greg_t	mcpu_rtmp_r15;		/* syscall: temporary %r15 stash */
109 #endif
110 
111 	struct vcpu_info *mcpu_vcpu_info;
112 	uint64_t	mcpu_gdtpa;	/* hypervisor: GDT physical address */
113 
114 	uint16_t mcpu_intr_pending;	/* hypervisor: pending intrpt levels */
115 	struct xen_evt_data *mcpu_evt_pend; /* hypervisor: pending events */
116 
117 	volatile uint32_t *mcpu_mwait;	/* MONITOR/MWAIT buffer */
118 
119 	struct cpu_ucode_info	*mcpu_ucode_info;
120 };
121 
122 #define	NINTR_THREADS	(LOCK_LEVEL-1)	/* number of interrupt threads */
123 #define	MWAIT_HALTED	(1)		/* mcpu_mwait set when halting */
124 #define	MWAIT_RUNNING	(0)		/* mcpu_mwait set to wakeup */
125 #define	MWAIT_WAKEUP(cpu)	(*((cpu)->cpu_m.mcpu_mwait) = MWAIT_RUNNING);
126 
127 #endif	/* _ASM */
128 
129 /* Please DON'T add any more of this namespace-poisoning sewage here */
130 
131 #define	cpu_nodeid cpu_m.mcpu_nodeid
132 #define	cpu_pri cpu_m.mcpu_pri
133 #define	cpu_pri_data cpu_m.mcpu_pri_data
134 #define	cpu_current_hat cpu_m.mcpu_current_hat
135 #define	cpu_hat_info cpu_m.mcpu_hat_info
136 #define	cpu_ppaddr_mutex cpu_m.mcpu_ppaddr_mutex
137 #define	cpu_gdt cpu_m.mcpu_gdt
138 #define	cpu_idt cpu_m.mcpu_idt
139 #define	cpu_tss cpu_m.mcpu_tss
140 #define	cpu_ldt cpu_m.mcpu_ldt
141 #define	cpu_caddr1 cpu_m.mcpu_caddr1
142 #define	cpu_caddr2 cpu_m.mcpu_caddr2
143 #define	cpu_softinfo cpu_m.mcpu_softinfo
144 #define	cpu_caddr1pte cpu_m.mcpu_caddr1pte
145 #define	cpu_caddr2pte cpu_m.mcpu_caddr2pte
146 
147 #ifdef	__cplusplus
148 }
149 #endif
150 
151 #endif	/* _SYS_MACHCPUVAR_H */
152