17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
541791439Sandrei  * Common Development and Distribution License (the "License").
641791439Sandrei  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21ae115bc7Smrj 
227c478bd9Sstevel@tonic-gate /*
235cd376e8SJimmy Vetayases  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
24*575694f6SJason King  * Copyright 2020 Joyent, Inc.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_SMP_IMPLDEFS_H
287c478bd9Sstevel@tonic-gate #define	_SYS_SMP_IMPLDEFS_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/types.h>
317c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
327c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h>
33e23a7e34Slq #include <sys/avintr.h>
347c478bd9Sstevel@tonic-gate #include <sys/pic.h>
357c478bd9Sstevel@tonic-gate #include <sys/xc_levels.h>
362df1fe9cSrandyf #include <sys/psm_types.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
42918e0d92SRobert Mustacchi #define	WARM_RESET_VECTOR	0x467	/* the ROM/BIOS vector for	*/
437c478bd9Sstevel@tonic-gate 					/* starting up secondary cpu's	*/
447c478bd9Sstevel@tonic-gate /* timer modes for clkinitf */
457c478bd9Sstevel@tonic-gate #define	TIMER_ONESHOT		0x1
467c478bd9Sstevel@tonic-gate #define	TIMER_PERIODIC		0x2
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  *	External Reference Functions
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate extern void (*psminitf)();	/* psm init entry point			*/
527c478bd9Sstevel@tonic-gate extern void (*picinitf)();	/* pic init entry point			*/
537c478bd9Sstevel@tonic-gate extern int (*clkinitf)(int, int *);	/* clock init entry point	*/
54918e0d92SRobert Mustacchi extern int (*ap_mlsetup)();	/* completes init of starting cpu	*/
557c478bd9Sstevel@tonic-gate extern void (*send_dirintf)();	/* send interprocessor intr		*/
567c478bd9Sstevel@tonic-gate extern hrtime_t (*gethrtimef)(); /* get high resolution timer value	*/
577c478bd9Sstevel@tonic-gate extern hrtime_t (*gethrtimeunscaledf)(); /* get high res timer unscaled value */
587c478bd9Sstevel@tonic-gate extern void (*psm_shutdownf)(int, int);	/* machine dependent shutdown	*/
597c478bd9Sstevel@tonic-gate extern void (*psm_preshutdownf)(int, int); /* machine dependent pre-shutdown */
607c478bd9Sstevel@tonic-gate extern void (*psm_notifyf)(int); /* PSMI module notification		*/
617c478bd9Sstevel@tonic-gate extern void (*psm_set_idle_cpuf)(processorid_t); /* cpu changed to idle */
62918e0d92SRobert Mustacchi extern void (*psm_unset_idle_cpuf)(processorid_t); /* cpu out of idle	*/
637c478bd9Sstevel@tonic-gate extern int (*psm_disable_intr)(processorid_t); /* disable intr to cpu	*/
647c478bd9Sstevel@tonic-gate extern void (*psm_enable_intr)(processorid_t); /* enable intr to cpu	*/
657c478bd9Sstevel@tonic-gate extern int (*psm_get_clockirq)(int); /* get clock vector		*/
667c478bd9Sstevel@tonic-gate extern int (*psm_get_ipivect)(int, int); /* get interprocessor intr vec */
677c478bd9Sstevel@tonic-gate extern int (*psm_clkinit)(int);	/* timer init entry point		*/
681c2d0470SPatrick Mooney extern int (*psm_cached_ipivect)(int, int); /* get cached ipi vec	*/
697c478bd9Sstevel@tonic-gate extern void (*psm_timer_reprogram)(hrtime_t); /* timer reprogram	*/
707c478bd9Sstevel@tonic-gate extern void (*psm_timer_enable)(void);		/* timer enable		*/
717c478bd9Sstevel@tonic-gate extern void (*psm_timer_disable)(void);		/* timer disable	*/
727c478bd9Sstevel@tonic-gate extern void (*psm_post_cyclic_setup)(void *arg); /* psm cyclic setup	*/
732df1fe9cSrandyf extern int (*psm_state)(psm_state_request_t *); /* psm state save/restore */
747ff178cdSJimmy Vetayases extern uchar_t (*psm_get_ioapicid)(uchar_t);	/* get io-apic id */
757ff178cdSJimmy Vetayases extern uint32_t (*psm_get_localapicid)(uint32_t);	/* get local-apic id */
767ff178cdSJimmy Vetayases extern uchar_t (*psm_xlate_vector_by_irq)(uchar_t); /* get vector for an irq */
771c2d0470SPatrick Mooney extern int (*psm_get_pir_ipivect)(void); /* get PIR (for VMM) ipi vect	*/
781c2d0470SPatrick Mooney extern void (*psm_send_pir_ipi)(processorid_t);	/* send PIR ipi		*/
79918e0d92SRobert Mustacchi extern void (*psm_cmci_setup)(processorid_t, boolean_t); /* Control CPU CMCI */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate extern int (*slvltovect)(int);	/* ipl interrupt priority level		*/
827c478bd9Sstevel@tonic-gate extern int (*setlvl)(int, int *); /* set intr pri represented by vect	*/
837c478bd9Sstevel@tonic-gate extern void (*setlvlx)(int, int); /* set intr pri to specified level	*/
847c478bd9Sstevel@tonic-gate extern void (*setspl)(int);	/* mask intr below or equal given ipl	*/
85918e0d92SRobert Mustacchi extern int (*addspl)(int, int, int, int); /* add intr mask of vector	*/
867c478bd9Sstevel@tonic-gate extern int (*delspl)(int, int, int, int); /* delete intr mask of vector */
877ff178cdSJimmy Vetayases extern int (*get_pending_spl)(void);	/* get highest pending ipl */
887ff178cdSJimmy Vetayases extern int (*addintr)(void *, int, avfunc, char *, int, caddr_t, caddr_t,
897ff178cdSJimmy Vetayases     uint64_t *, dev_info_t *);	/* replacement of add_avintr */
907ff178cdSJimmy Vetayases extern void (*remintr)(void *, int, avfunc, int); /* replace of rem_avintr */
91e23a7e34Slq 
92e23a7e34Slq /* trigger a software intr */
93e23a7e34Slq extern void (*setsoftint)(int, struct av_softinfo *);
947c478bd9Sstevel@tonic-gate 
95a1af7ba0Scwb /* kmdb private entry point */
96a1af7ba0Scwb extern void (*kdisetsoftint)(int, struct av_softinfo *);
97a1af7ba0Scwb 
987c478bd9Sstevel@tonic-gate extern uint_t xc_serv(caddr_t, caddr_t); /* cross call service routine	*/
99e23a7e34Slq extern void av_set_softint_pending();	/* set software interrupt pending */
100a1af7ba0Scwb extern void kdi_av_set_softint_pending(); /* kmdb private entry point */
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /* map physical address							*/
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * XX64: Changing psm_map_phys() to take a paddr_t rather than a uint32_t
1067c478bd9Sstevel@tonic-gate  * will be a flag day.  Other drivers in the WOS use the psm_map()
1077c478bd9Sstevel@tonic-gate  * interface, so we need this hack to get them to coexist for
1087c478bd9Sstevel@tonic-gate  * pre-integration testing.
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate extern caddr_t psm_map_phys_new(paddr_t, size_t, int);
1117c478bd9Sstevel@tonic-gate #define	psm_map_phys psm_map_phys_new
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /* unmap the physical address given in psm_map_phys() from the addr	*/
1147c478bd9Sstevel@tonic-gate extern void psm_unmap_phys(caddr_t, size_t);
1157c478bd9Sstevel@tonic-gate extern void psm_modloadonly(void);
1167c478bd9Sstevel@tonic-gate extern void psm_install(void);
1177c478bd9Sstevel@tonic-gate extern void psm_modload(void);
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  *	External Reference Data
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate extern struct av_head autovect[]; /* array of auto intr vectors		*/
1237c478bd9Sstevel@tonic-gate extern uint32_t rm_platter_pa;	/* phy addr realmode startup storage	*/
1247c478bd9Sstevel@tonic-gate extern caddr_t rm_platter_va;	/* virt addr realmode startup storage	*/
12541791439Sandrei extern cpuset_t mp_cpus;	/* bit map of possible cpus found	*/
1267c478bd9Sstevel@tonic-gate 
127bb8220baSVikram Hegde /*
128bb8220baSVikram Hegde  * virtulization support for psm
129bb8220baSVikram Hegde  */
130bb8220baSVikram Hegde extern void *psm_vt_ops;
131bb8220baSVikram Hegde 
1327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate #endif
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate #endif	/* _SYS_SMP_IMPLDEFS_H */
137