xref: /illumos-gate/usr/src/uts/i86pc/sys/smp_impldefs.h (revision 640aa5d6b13986d0e4efacd16ce0da0aa8a266ce)
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 /*
23  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Copyright 2020 Joyent, Inc.
25  */
26 
27 #ifndef _SYS_SMP_IMPLDEFS_H
28 #define	_SYS_SMP_IMPLDEFS_H
29 
30 #include <sys/types.h>
31 #include <sys/sunddi.h>
32 #include <sys/cpuvar.h>
33 #include <sys/avintr.h>
34 #include <sys/pic.h>
35 #include <sys/xc_levels.h>
36 #include <sys/psm_types.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	WARM_RESET_VECTOR	0x467	/* the ROM/BIOS vector for	*/
43 					/* starting up secondary cpu's	*/
44 /* timer modes for clkinitf */
45 #define	TIMER_ONESHOT		0x1
46 #define	TIMER_PERIODIC		0x2
47 
48 /*
49  *	External Reference Functions
50  */
51 extern void (*psminitf)();	/* psm init entry point			*/
52 extern void (*picinitf)();	/* pic init entry point			*/
53 extern int (*clkinitf)(int, int *);	/* clock init entry point	*/
54 extern int (*ap_mlsetup)();	/* completes init of starting cpu	*/
55 extern void (*send_dirintf)();	/* send interprocessor intr		*/
56 extern hrtime_t (*gethrtimef)(); /* get high resolution timer value	*/
57 extern hrtime_t (*gethrtimeunscaledf)(); /* get high res timer unscaled value */
58 extern void (*psm_shutdownf)(int, int);	/* machine dependent shutdown	*/
59 extern void (*psm_preshutdownf)(int, int); /* machine dependent pre-shutdown */
60 extern void (*psm_notifyf)(int); /* PSMI module notification		*/
61 extern void (*psm_set_idle_cpuf)(processorid_t); /* cpu changed to idle */
62 extern void (*psm_unset_idle_cpuf)(processorid_t); /* cpu out of idle	*/
63 extern int (*psm_disable_intr)(processorid_t); /* disable intr to cpu	*/
64 extern void (*psm_enable_intr)(processorid_t); /* enable intr to cpu	*/
65 extern int (*psm_get_clockirq)(int); /* get clock vector		*/
66 extern int (*psm_get_ipivect)(int, int); /* get interprocessor intr vec */
67 extern int (*psm_clkinit)(int);	/* timer init entry point		*/
68 extern int (*psm_cached_ipivect)(int, int); /* get cached ipi vec	*/
69 extern void (*psm_timer_reprogram)(hrtime_t); /* timer reprogram	*/
70 extern void (*psm_timer_enable)(void);		/* timer enable		*/
71 extern void (*psm_timer_disable)(void);		/* timer disable	*/
72 extern void (*psm_post_cyclic_setup)(void *arg); /* psm cyclic setup	*/
73 extern int (*psm_state)(psm_state_request_t *); /* psm state save/restore */
74 extern uchar_t (*psm_get_ioapicid)(uchar_t);	/* get io-apic id */
75 extern uint32_t (*psm_get_localapicid)(uint32_t);	/* get local-apic id */
76 extern uchar_t (*psm_xlate_vector_by_irq)(uchar_t); /* get vector for an irq */
77 extern int (*psm_get_pir_ipivect)(void); /* get PIR (for VMM) ipi vect	*/
78 extern void (*psm_send_pir_ipi)(processorid_t);	/* send PIR ipi		*/
79 extern void (*psm_cmci_setup)(processorid_t, boolean_t); /* Control CPU CMCI */
80 
81 extern int (*slvltovect)(int);	/* ipl interrupt priority level		*/
82 extern int (*setlvl)(int, int *); /* set intr pri represented by vect	*/
83 extern void (*setlvlx)(int, int); /* set intr pri to specified level	*/
84 extern void (*setspl)(int);	/* mask intr below or equal given ipl	*/
85 extern int (*addspl)(int, int, int, int); /* add intr mask of vector	*/
86 extern int (*delspl)(int, int, int, int); /* delete intr mask of vector */
87 extern int (*get_pending_spl)(void);	/* get highest pending ipl */
88 extern int (*addintr)(void *, int, avfunc, char *, int, caddr_t, caddr_t,
89     uint64_t *, dev_info_t *);	/* replacement of add_avintr */
90 extern void (*remintr)(void *, int, avfunc, int); /* replace of rem_avintr */
91 
92 /* trigger a software intr */
93 extern void (*setsoftint)(int, struct av_softinfo *);
94 
95 /* kmdb private entry point */
96 extern void (*kdisetsoftint)(int, struct av_softinfo *);
97 
98 extern uint_t xc_serv(caddr_t, caddr_t); /* cross call service routine	*/
99 extern void av_set_softint_pending();	/* set software interrupt pending */
100 extern void kdi_av_set_softint_pending(); /* kmdb private entry point */
101 
102 /* map physical address							*/
103 
104 /*
105  * XX64: Changing psm_map_phys() to take a paddr_t rather than a uint32_t
106  * will be a flag day.  Other drivers in the WOS use the psm_map()
107  * interface, so we need this hack to get them to coexist for
108  * pre-integration testing.
109  */
110 extern caddr_t psm_map_phys_new(paddr_t, size_t, int);
111 #define	psm_map_phys psm_map_phys_new
112 
113 /* unmap the physical address given in psm_map_phys() from the addr	*/
114 extern void psm_unmap_phys(caddr_t, size_t);
115 extern void psm_modloadonly(void);
116 extern void psm_install(void);
117 extern void psm_modload(void);
118 
119 /*
120  *	External Reference Data
121  */
122 extern struct av_head autovect[]; /* array of auto intr vectors		*/
123 extern uint32_t rm_platter_pa;	/* phy addr realmode startup storage	*/
124 extern caddr_t rm_platter_va;	/* virt addr realmode startup storage	*/
125 extern cpuset_t mp_cpus;	/* bit map of possible cpus found	*/
126 
127 /*
128  * virtulization support for psm
129  */
130 extern void *psm_vt_ops;
131 
132 #ifdef	__cplusplus
133 }
134 #endif
135 
136 #endif	/* _SYS_SMP_IMPLDEFS_H */
137