xref: /titanic_50/usr/src/uts/sun4v/sys/machsystm.h (revision 100b72f4fc209355ff607a0d787aad892d8a44ed)
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
5*100b72f4Sandrei  * Common Development and Distribution License (the "License").
6*100b72f4Sandrei  * 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  */
217c478bd9Sstevel@tonic-gate /*
22*100b72f4Sandrei  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHSYSTM_H
277c478bd9Sstevel@tonic-gate #define	_SYS_MACHSYSTM_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Numerous platform-dependent interfaces that don't seem to belong
337c478bd9Sstevel@tonic-gate  * in any other header file.
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * This file should not be included by code that purports to be
367c478bd9Sstevel@tonic-gate  * platform-independent.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef _ASM
407c478bd9Sstevel@tonic-gate #include <sys/types.h>
417c478bd9Sstevel@tonic-gate #include <sys/scb.h>
427c478bd9Sstevel@tonic-gate #include <sys/varargs.h>
437c478bd9Sstevel@tonic-gate #include <sys/machparam.h>
447c478bd9Sstevel@tonic-gate #include <sys/thread.h>
457c478bd9Sstevel@tonic-gate #include <vm/seg_enum.h>
467c478bd9Sstevel@tonic-gate #include <sys/processor.h>
477c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
487c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
497c478bd9Sstevel@tonic-gate #endif /* _ASM */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #ifdef __cplusplus
527c478bd9Sstevel@tonic-gate extern "C" {
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #ifdef _KERNEL
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #ifndef _ASM
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * The following enum types determine how interrupts are distributed
607c478bd9Sstevel@tonic-gate  * on a sun4u system.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate enum intr_policies {
637c478bd9Sstevel@tonic-gate 	/*
647c478bd9Sstevel@tonic-gate 	 * Target interrupt at the CPU running the add_intrspec
657c478bd9Sstevel@tonic-gate 	 * thread. Also used to target all interrupts at the panicing
667c478bd9Sstevel@tonic-gate 	 * CPU.
677c478bd9Sstevel@tonic-gate 	 */
687c478bd9Sstevel@tonic-gate 	INTR_CURRENT_CPU = 0,
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate 	/*
717c478bd9Sstevel@tonic-gate 	 * Target all interrupts at the boot cpu
727c478bd9Sstevel@tonic-gate 	 */
737c478bd9Sstevel@tonic-gate 	INTR_BOOT_CPU,
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 	/*
767c478bd9Sstevel@tonic-gate 	 * Flat distribution of all interrupts
777c478bd9Sstevel@tonic-gate 	 */
787c478bd9Sstevel@tonic-gate 	INTR_FLAT_DIST,
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 	/*
817c478bd9Sstevel@tonic-gate 	 * Weighted distribution of all interrupts
827c478bd9Sstevel@tonic-gate 	 */
837c478bd9Sstevel@tonic-gate 	INTR_WEIGHTED_DIST
847c478bd9Sstevel@tonic-gate };
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * Structure that defines the interrupt distribution list. It contains
897c478bd9Sstevel@tonic-gate  * enough info about the interrupt so that it can callback the parent
907c478bd9Sstevel@tonic-gate  * nexus driver and retarget the interrupt to a different CPU.
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate struct intr_dist {
937c478bd9Sstevel@tonic-gate 	struct intr_dist *next;	/* link to next in list */
947c478bd9Sstevel@tonic-gate 	void (*func)(void *);	/* Callback function */
957c478bd9Sstevel@tonic-gate 	void *arg;		/* Nexus parent callback arg 1 */
967c478bd9Sstevel@tonic-gate };
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Miscellaneous cpu_state changes
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate extern void power_down(const char *);
1027c478bd9Sstevel@tonic-gate extern void do_shutdown(void);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * Number of seconds until power is shut off
1067c478bd9Sstevel@tonic-gate  */
1077c478bd9Sstevel@tonic-gate extern int thermal_powerdown_delay;
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * prom-related
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate extern int obpdebug;
1147c478bd9Sstevel@tonic-gate extern int forthdebug_supported;
1157c478bd9Sstevel@tonic-gate extern uint_t tba_taken_over;
1167c478bd9Sstevel@tonic-gate extern void forthdebug_init(void);
1177c478bd9Sstevel@tonic-gate extern void init_vx_handler(void);
1187c478bd9Sstevel@tonic-gate extern void kern_preprom(void);
1197c478bd9Sstevel@tonic-gate extern void kern_postprom(void);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * externally (debugger or prom) initiated panic
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate extern struct regs sync_reg_buf;
1257c478bd9Sstevel@tonic-gate extern uint64_t sync_tt;
1267c478bd9Sstevel@tonic-gate extern void sync_handler(void);
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * Trap-related
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate struct regs;
1327c478bd9Sstevel@tonic-gate extern void trap(struct regs *rp, caddr_t addr, uint32_t type,
1337c478bd9Sstevel@tonic-gate     uint32_t mmu_fsr);
1347c478bd9Sstevel@tonic-gate extern void *get_tba(void);
1357c478bd9Sstevel@tonic-gate extern void *set_tba(void *);
1367c478bd9Sstevel@tonic-gate extern caddr_t set_trap_table(void);
1377c478bd9Sstevel@tonic-gate extern struct scb trap_table;
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate struct trap_info {
1407c478bd9Sstevel@tonic-gate 	struct regs *trap_regs;
1417c478bd9Sstevel@tonic-gate 	uint_t	trap_type;
1427c478bd9Sstevel@tonic-gate 	caddr_t trap_addr;
1437c478bd9Sstevel@tonic-gate 	uint_t	trap_mmu_fsr;
1447c478bd9Sstevel@tonic-gate };
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * misc. primitives
1487c478bd9Sstevel@tonic-gate  */
1497c478bd9Sstevel@tonic-gate #define	PROM_CFGHDL_TO_CPUID(x)	 (x  & ~(0xful << 28))
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate extern void debug_flush_windows(void);
1527c478bd9Sstevel@tonic-gate extern void flush_windows(void);
1537c478bd9Sstevel@tonic-gate extern int getprocessorid(void);
1547c478bd9Sstevel@tonic-gate extern void reestablish_curthread(void);
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate extern void stphys(uint64_t physaddr, int value);
1577c478bd9Sstevel@tonic-gate extern int ldphys(uint64_t physaddr);
1587c478bd9Sstevel@tonic-gate extern void stdphys(uint64_t physaddr, uint64_t value);
1597c478bd9Sstevel@tonic-gate extern uint64_t lddphys(uint64_t physaddr);
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate extern void stphysio(u_longlong_t physaddr, uint_t value);
1627c478bd9Sstevel@tonic-gate extern uint_t ldphysio(u_longlong_t physaddr);
1637c478bd9Sstevel@tonic-gate extern void sthphysio(u_longlong_t physaddr, ushort_t value);
1647c478bd9Sstevel@tonic-gate extern ushort_t ldhphysio(u_longlong_t physaddr);
1657c478bd9Sstevel@tonic-gate extern void stbphysio(u_longlong_t physaddr, uchar_t value);
1667c478bd9Sstevel@tonic-gate extern uchar_t ldbphysio(u_longlong_t physaddr);
1677c478bd9Sstevel@tonic-gate extern void stdphysio(u_longlong_t physaddr, u_longlong_t value);
1687c478bd9Sstevel@tonic-gate extern u_longlong_t lddphysio(u_longlong_t physaddr);
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate extern int pf_is_dmacapable(pfn_t);
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate extern int dip_to_cpu_id(dev_info_t *dip, processorid_t *cpu_id);
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate extern void set_cmp_error_steering(void);
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /*
1777c478bd9Sstevel@tonic-gate  * SPARCv9 %ver register and field definitions
1787c478bd9Sstevel@tonic-gate  */
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate #define	ULTRA_VER_MANUF(x)	((x) >> 48)
1817c478bd9Sstevel@tonic-gate #define	ULTRA_VER_IMPL(x)	(((x) >> 32) & 0xFFFF)
1827c478bd9Sstevel@tonic-gate #define	ULTRA_VER_MASK(x)	(((x) >> 24) & 0xFF)
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate extern uint64_t ultra_getver(void);
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * bootup-time
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate extern int ncpunode;
1907c478bd9Sstevel@tonic-gate extern int niobus;
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate extern void segnf_init(void);
1937c478bd9Sstevel@tonic-gate extern void kern_setup1(void);
1947c478bd9Sstevel@tonic-gate extern void startup(void);
1957c478bd9Sstevel@tonic-gate extern void post_startup(void);
1967c478bd9Sstevel@tonic-gate extern void install_va_to_tte(void);
1977c478bd9Sstevel@tonic-gate extern void setwstate(uint_t);
1987c478bd9Sstevel@tonic-gate extern void create_va_to_tte(void);
1997c478bd9Sstevel@tonic-gate extern int memscrub_init(void);
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate extern void kcpc_hw_init(void);
2027c478bd9Sstevel@tonic-gate extern void kcpc_hw_startup_cpu(ushort_t);
2037c478bd9Sstevel@tonic-gate extern int kcpc_hw_load_pcbe(void);
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate /*
2067c478bd9Sstevel@tonic-gate  * Interrupts
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate struct cpu;
2097c478bd9Sstevel@tonic-gate extern struct cpu cpu0;
2107c478bd9Sstevel@tonic-gate extern size_t intr_add_pools;
2117c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_head;
2127c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_tail;
2137c478bd9Sstevel@tonic-gate extern struct scb *set_tbr(struct scb *);
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate extern uint_t disable_vec_intr(void);
2167c478bd9Sstevel@tonic-gate extern void enable_vec_intr(uint_t);
2177c478bd9Sstevel@tonic-gate extern void setintrenable(int);
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate extern void intr_dist_add(void (*f)(void *), void *);
2207c478bd9Sstevel@tonic-gate extern void intr_dist_rem(void (*f)(void *), void *);
2217c478bd9Sstevel@tonic-gate extern void intr_dist_add_weighted(void (*f)(void *, int32_t, int32_t), void *);
2227c478bd9Sstevel@tonic-gate extern void intr_dist_rem_weighted(void (*f)(void *, int32_t, int32_t), void *);
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate extern uint32_t intr_dist_cpuid(void);
2257c478bd9Sstevel@tonic-gate extern uint32_t intr_dist_mycpuid(void);
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate void intr_dist_cpuid_add_device_weight(uint32_t cpuid, dev_info_t *dip,
2287c478bd9Sstevel@tonic-gate 		int32_t weight);
2297c478bd9Sstevel@tonic-gate void intr_dist_cpuid_rem_device_weight(uint32_t cpuid, dev_info_t *dip);
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate extern void intr_redist_all_cpus(void);
2327c478bd9Sstevel@tonic-gate extern void intr_redist_all_cpus_shutdown(void);
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate extern void send_dirint(int, int);
2357c478bd9Sstevel@tonic-gate extern void setsoftint(uint_t);
2367c478bd9Sstevel@tonic-gate extern void setsoftint_tl1(uint64_t, uint64_t);
2377c478bd9Sstevel@tonic-gate extern void siron(void);
2387c478bd9Sstevel@tonic-gate extern void intr_enqueue_req(uint_t pil, uint32_t inum);
2397c478bd9Sstevel@tonic-gate extern void intr_dequeue_req(uint_t pil, uint32_t inum);
2407c478bd9Sstevel@tonic-gate extern void wr_clr_softint(uint_t);
2417c478bd9Sstevel@tonic-gate 
2427c478bd9Sstevel@tonic-gate /*
2437c478bd9Sstevel@tonic-gate  * Time- and %tick-related
2447c478bd9Sstevel@tonic-gate  */
2457c478bd9Sstevel@tonic-gate extern hrtime_t rdtick(void);
2467c478bd9Sstevel@tonic-gate extern void tick_write_delta(uint64_t);
2477c478bd9Sstevel@tonic-gate extern void tickcmpr_set(uint64_t);
2487c478bd9Sstevel@tonic-gate extern void tickcmpr_reset(void);
2497c478bd9Sstevel@tonic-gate extern void tickcmpr_disable(void);
2507c478bd9Sstevel@tonic-gate extern int tickcmpr_disabled(void);
2517c478bd9Sstevel@tonic-gate extern uint32_t cbe_level14_inum;
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate /*
2547c478bd9Sstevel@tonic-gate  * contiguous memory
2557c478bd9Sstevel@tonic-gate  */
2567c478bd9Sstevel@tonic-gate extern void *contig_mem_alloc(size_t);
257ea841a36Sarao extern void *contig_mem_alloc_align(size_t, size_t);
2587c478bd9Sstevel@tonic-gate extern void contig_mem_free(void *, size_t);
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate /*
2617c478bd9Sstevel@tonic-gate  * Caches
2627c478bd9Sstevel@tonic-gate  */
2637c478bd9Sstevel@tonic-gate extern int vac;
2647c478bd9Sstevel@tonic-gate extern int cache;
2657c478bd9Sstevel@tonic-gate extern int use_mp;
2667c478bd9Sstevel@tonic-gate extern uint_t vac_mask;
2677c478bd9Sstevel@tonic-gate extern uint64_t ecache_flushaddr;
2687c478bd9Sstevel@tonic-gate extern int ecache_alignsize;	/* Maximum ecache linesize for struct align */
2697c478bd9Sstevel@tonic-gate extern int ecache_setsize;	/* Maximum ecache setsize possible */
2707c478bd9Sstevel@tonic-gate extern int cpu_setsize;		/* Maximum ecache setsize of configured cpus */
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate /*
2737c478bd9Sstevel@tonic-gate  * VM
2747c478bd9Sstevel@tonic-gate  */
2757c478bd9Sstevel@tonic-gate extern int do_pg_coloring;
2767c478bd9Sstevel@tonic-gate extern int do_virtual_coloring;
2777c478bd9Sstevel@tonic-gate extern int use_page_coloring;
2787c478bd9Sstevel@tonic-gate extern int use_virtual_coloring;
2797c478bd9Sstevel@tonic-gate extern uint_t vac_colors_mask;
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate extern void ndata_alloc_init(struct memlist *, uintptr_t, uintptr_t);
2827c478bd9Sstevel@tonic-gate extern void *ndata_alloc(struct memlist *, size_t, size_t);
2837c478bd9Sstevel@tonic-gate extern void *ndata_extra_base(struct memlist *, size_t);
2847c478bd9Sstevel@tonic-gate extern size_t ndata_maxsize(struct memlist *);
2857c478bd9Sstevel@tonic-gate extern size_t ndata_spare(struct memlist *, size_t, size_t);
2867c478bd9Sstevel@tonic-gate extern caddr_t get_mmfsa_scratchpad(void);
2877c478bd9Sstevel@tonic-gate extern void set_mmfsa_scratchpad(caddr_t);
2887c478bd9Sstevel@tonic-gate extern int ndata_alloc_mmfsa(struct memlist *);
2897c478bd9Sstevel@tonic-gate extern int ndata_alloc_cpus(struct memlist *);
2907c478bd9Sstevel@tonic-gate extern int ndata_alloc_page_freelists(struct memlist *, int);
2917c478bd9Sstevel@tonic-gate extern int ndata_alloc_dmv(struct memlist *);
2927c478bd9Sstevel@tonic-gate extern int ndata_alloc_tsbs(struct memlist *, pgcnt_t);
2937c478bd9Sstevel@tonic-gate extern int ndata_alloc_hat(struct memlist *, pgcnt_t, pgcnt_t);
2947c478bd9Sstevel@tonic-gate extern caddr_t alloc_page_freelists(int, caddr_t, int);
2957c478bd9Sstevel@tonic-gate extern caddr_t alloc_hme_buckets(caddr_t, int);
2967c478bd9Sstevel@tonic-gate extern size_t page_ctrs_sz(void);
2977c478bd9Sstevel@tonic-gate extern caddr_t page_ctrs_alloc(caddr_t);
2987c478bd9Sstevel@tonic-gate extern void page_freelist_coalesce_all(int);
2997c478bd9Sstevel@tonic-gate extern void ppmapinit(void);
3007c478bd9Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *);
3017c478bd9Sstevel@tonic-gate extern void hw_pa_bcopy32(uint64_t, uint64_t);
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate extern int pp_slots;
3047c478bd9Sstevel@tonic-gate extern int pp_consistent_coloring;
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate /*
3077c478bd9Sstevel@tonic-gate  * ppcopy/hwblkpagecopy interaction.  See ppage.c.
3087c478bd9Sstevel@tonic-gate  */
3097c478bd9Sstevel@tonic-gate #define	PPAGE_STORE_VCOLORING	0x1 /* use vcolors to maintain consistency */
3107c478bd9Sstevel@tonic-gate #define	PPAGE_LOAD_VCOLORING	0x2 /* use vcolors to maintain consistency */
3117c478bd9Sstevel@tonic-gate #define	PPAGE_STORES_POLLUTE	0x4 /* stores pollute VAC */
3127c478bd9Sstevel@tonic-gate #define	PPAGE_LOADS_POLLUTE	0x8 /* loads pollute VAC */
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate /*
3157c478bd9Sstevel@tonic-gate  * VIS-accelerated copy/zero
3167c478bd9Sstevel@tonic-gate  */
3177c478bd9Sstevel@tonic-gate extern int use_hw_bcopy;
3187c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_1;
3197c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_2;
3207c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_4;
3217c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_8;
3227c478bd9Sstevel@tonic-gate extern int use_hw_bzero;
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate #ifdef CHEETAH
3257c478bd9Sstevel@tonic-gate #define	VIS_COPY_THRESHOLD 256
3267c478bd9Sstevel@tonic-gate #else
3277c478bd9Sstevel@tonic-gate #define	VIS_COPY_THRESHOLD 900
3287c478bd9Sstevel@tonic-gate #endif
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate /*
3317c478bd9Sstevel@tonic-gate  * MP
3327c478bd9Sstevel@tonic-gate  */
3337c478bd9Sstevel@tonic-gate extern void idle_other_cpus(void);
3347c478bd9Sstevel@tonic-gate extern void resume_other_cpus(void);
3357c478bd9Sstevel@tonic-gate extern void stop_other_cpus(void);
3367c478bd9Sstevel@tonic-gate extern void idle_stop_xcall(void);
3377c478bd9Sstevel@tonic-gate extern void set_idle_cpu(int);
3387c478bd9Sstevel@tonic-gate extern void unset_idle_cpu(int);
3397c478bd9Sstevel@tonic-gate extern void mp_cpu_quiesce(struct cpu *);
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate /*
3427c478bd9Sstevel@tonic-gate  * Panic at TL > 0
3437c478bd9Sstevel@tonic-gate  */
3447c478bd9Sstevel@tonic-gate extern uint64_t cpu_pa[];
3457c478bd9Sstevel@tonic-gate extern void ptl1_init_cpu(struct cpu *);
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate /*
3487c478bd9Sstevel@tonic-gate  * Defines for DR interfaces
3497c478bd9Sstevel@tonic-gate  */
3507c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_CHILD	0x01	/* Walk immediate children of root  */
3517c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_CONFIGURE	0x02	/* Configure branch after create    */
3527c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_DESTROY	0x04	/* Destroy branch after unconfigure */
3537c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_EVENT	0x08	/* Post NDI event		    */
3547c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_PROM	0x10	/* Branches derived from PROM nodes */
3557c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_SID		0x20	/* SID node branches		    */
3567c478bd9Sstevel@tonic-gate #define	DEVI_BRANCH_ROOT	0x40	/* Node is the root of a branch	    */
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate typedef struct devi_branch {
3597c478bd9Sstevel@tonic-gate 	void		*arg;
3607c478bd9Sstevel@tonic-gate 	void		(*devi_branch_callback)(dev_info_t *, void *, uint_t);
3617c478bd9Sstevel@tonic-gate 	int		type;
3627c478bd9Sstevel@tonic-gate 	union {
363fa9e4066Sahrens 		int	(*prom_branch_select)(pnode_t, void *, uint_t);
3647c478bd9Sstevel@tonic-gate 		int	(*sid_branch_create)(dev_info_t *, void *, uint_t);
3657c478bd9Sstevel@tonic-gate 	} create;
3667c478bd9Sstevel@tonic-gate } devi_branch_t;
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate /*
3707c478bd9Sstevel@tonic-gate  * Prototypes which really belongs to sunddi.c, and should be moved to
3717c478bd9Sstevel@tonic-gate  * sunddi.c if there is another platform using these calls.
3727c478bd9Sstevel@tonic-gate  */
3737c478bd9Sstevel@tonic-gate extern int e_ddi_branch_create(dev_info_t *pdip, devi_branch_t *bp,
3747c478bd9Sstevel@tonic-gate     dev_info_t **dipp, uint_t flags);
3757c478bd9Sstevel@tonic-gate extern int e_ddi_branch_configure(dev_info_t *rdip, dev_info_t **dipp,
3767c478bd9Sstevel@tonic-gate     uint_t flags);
3777c478bd9Sstevel@tonic-gate extern int e_ddi_branch_unconfigure(dev_info_t *rdip, dev_info_t **dipp,
3787c478bd9Sstevel@tonic-gate     uint_t flags);
3797c478bd9Sstevel@tonic-gate extern int e_ddi_branch_destroy(dev_info_t *rdip, dev_info_t **dipp,
3807c478bd9Sstevel@tonic-gate     uint_t flags);
3817c478bd9Sstevel@tonic-gate extern void e_ddi_branch_hold(dev_info_t *rdip);
3827c478bd9Sstevel@tonic-gate extern void e_ddi_branch_rele(dev_info_t *rdip);
3837c478bd9Sstevel@tonic-gate extern int e_ddi_branch_held(dev_info_t *rdip);
3847c478bd9Sstevel@tonic-gate extern int e_ddi_branch_referenced(dev_info_t *rdip,
3857c478bd9Sstevel@tonic-gate     int (*cb)(dev_info_t *dip, void *, uint_t), void *arg);
3867c478bd9Sstevel@tonic-gate 
3877c478bd9Sstevel@tonic-gate /*
3887c478bd9Sstevel@tonic-gate  * Constants which define the "hole" in the 64-bit sfmmu address space.
3897c478bd9Sstevel@tonic-gate  * These are set to specific values by the CPU module code.
3907c478bd9Sstevel@tonic-gate  */
3917c478bd9Sstevel@tonic-gate extern caddr_t	hole_start, hole_end;
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate /* kpm mapping window */
3947c478bd9Sstevel@tonic-gate extern size_t	kpm_size;
3957c478bd9Sstevel@tonic-gate extern uchar_t	kpm_size_shift;
3967c478bd9Sstevel@tonic-gate extern caddr_t	kpm_vbase;
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate #define	INVALID_VADDR(a)	(((a) >= hole_start && (a) < hole_end))
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate extern void adjust_hw_copy_limits(int);
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate struct kdi;
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate void	cpu_kdi_init(struct kdi *);
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate /*
4077c478bd9Sstevel@tonic-gate  * flush instruction and data caches
4087c478bd9Sstevel@tonic-gate  */
4097c478bd9Sstevel@tonic-gate void	kdi_flush_caches(void);
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate struct async_flt;
4127c478bd9Sstevel@tonic-gate 
4137c478bd9Sstevel@tonic-gate /*
4147c478bd9Sstevel@tonic-gate  * take pending fp traps if fpq present
4157c478bd9Sstevel@tonic-gate  * this function is also defined in fpusystm.h
4167c478bd9Sstevel@tonic-gate  */
4177c478bd9Sstevel@tonic-gate void	syncfpu(void);
4187c478bd9Sstevel@tonic-gate 
4197c478bd9Sstevel@tonic-gate void	cpu_flush_ecache(void);
4207c478bd9Sstevel@tonic-gate void	cpu_faulted_enter(struct cpu *);
4217c478bd9Sstevel@tonic-gate void	cpu_faulted_exit(struct cpu *);
4227c478bd9Sstevel@tonic-gate 
4237c478bd9Sstevel@tonic-gate int	cpu_get_mem_name(uint64_t synd, uint64_t *afsr, uint64_t afar,
4247c478bd9Sstevel@tonic-gate 	    char *buf, int buflen, int *lenp);
4257c478bd9Sstevel@tonic-gate int	cpu_get_mem_info(uint64_t synd, uint64_t afar,
4267c478bd9Sstevel@tonic-gate 	    uint64_t *mem_sizep, uint64_t *seg_sizep, uint64_t *bank_sizep,
4277c478bd9Sstevel@tonic-gate 	    int *segsp, int *banksp, int *mcidp);
4287c478bd9Sstevel@tonic-gate size_t	cpu_get_name_bufsize();
4297c478bd9Sstevel@tonic-gate 
4307c478bd9Sstevel@tonic-gate /*
4317c478bd9Sstevel@tonic-gate  * ecache scrub operations
4327c478bd9Sstevel@tonic-gate  */
4337c478bd9Sstevel@tonic-gate void cpu_init_cache_scrub(void);
4347c478bd9Sstevel@tonic-gate 
4357c478bd9Sstevel@tonic-gate /*
4367c478bd9Sstevel@tonic-gate  * clock/tick register operations
4377c478bd9Sstevel@tonic-gate  */
4387c478bd9Sstevel@tonic-gate void	cpu_init_tick_freq(void);
4397c478bd9Sstevel@tonic-gate 
4407c478bd9Sstevel@tonic-gate /*
4417c478bd9Sstevel@tonic-gate  * stick synchronization
4427c478bd9Sstevel@tonic-gate  */
4437c478bd9Sstevel@tonic-gate void	sticksync_slave(void);
4447c478bd9Sstevel@tonic-gate void	sticksync_master(void);
4457c478bd9Sstevel@tonic-gate 
4467c478bd9Sstevel@tonic-gate #endif /* _ASM */
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate /*
4497c478bd9Sstevel@tonic-gate  * Actions for set_error_enable_tl1
4507c478bd9Sstevel@tonic-gate  */
4517c478bd9Sstevel@tonic-gate #define	EER_SET_ABSOLUTE	0x0
4527c478bd9Sstevel@tonic-gate #define	EER_SET_SETBITS		0x1
4537c478bd9Sstevel@tonic-gate #define	EER_SET_CLRBITS		0x2
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate /*
4567c478bd9Sstevel@tonic-gate  * HVDUMP_SIZE_MAX set as 64k due to limitiation by intrq_alloc()
4577c478bd9Sstevel@tonic-gate  */
4587c478bd9Sstevel@tonic-gate 
4597c478bd9Sstevel@tonic-gate #define	HVDUMP_SIZE_MAX		0x10000
4607c478bd9Sstevel@tonic-gate #define	HVDUMP_SIZE_DEFAULT	0x8000
4617c478bd9Sstevel@tonic-gate 
46289a8ba83Sarao /*
46389a8ba83Sarao  * HV TOD service retry in usecs
46489a8ba83Sarao  */
46589a8ba83Sarao 
46689a8ba83Sarao #define	HV_TOD_RETRY_THRESH	100
46789a8ba83Sarao #define	HV_TOD_WAIT_USEC	5
46889a8ba83Sarao 
4697c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
4707c478bd9Sstevel@tonic-gate 
4717c478bd9Sstevel@tonic-gate #ifdef __cplusplus
4727c478bd9Sstevel@tonic-gate }
4737c478bd9Sstevel@tonic-gate #endif
4747c478bd9Sstevel@tonic-gate 
4757c478bd9Sstevel@tonic-gate #endif	/* _SYS_MACHSYSTM_H */
476