xref: /onnv-gate/usr/src/uts/sun4v/sys/machsystm.h (revision 12908:80a39220b451)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51455Sandrei  * Common Development and Distribution License (the "License").
61455Sandrei  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12908SPavel.Tatashin@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef _SYS_MACHSYSTM_H
260Sstevel@tonic-gate #define	_SYS_MACHSYSTM_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate  * Numerous platform-dependent interfaces that don't seem to belong
300Sstevel@tonic-gate  * in any other header file.
310Sstevel@tonic-gate  *
320Sstevel@tonic-gate  * This file should not be included by code that purports to be
330Sstevel@tonic-gate  * platform-independent.
340Sstevel@tonic-gate  */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #ifndef _ASM
370Sstevel@tonic-gate #include <sys/types.h>
380Sstevel@tonic-gate #include <sys/scb.h>
390Sstevel@tonic-gate #include <sys/varargs.h>
400Sstevel@tonic-gate #include <sys/machparam.h>
410Sstevel@tonic-gate #include <sys/thread.h>
420Sstevel@tonic-gate #include <vm/seg_enum.h>
430Sstevel@tonic-gate #include <sys/processor.h>
440Sstevel@tonic-gate #include <sys/sunddi.h>
450Sstevel@tonic-gate #include <sys/memlist.h>
460Sstevel@tonic-gate #endif /* _ASM */
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #ifdef __cplusplus
490Sstevel@tonic-gate extern "C" {
500Sstevel@tonic-gate #endif
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #ifdef _KERNEL
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #ifndef _ASM
550Sstevel@tonic-gate /*
560Sstevel@tonic-gate  * The following enum types determine how interrupts are distributed
570Sstevel@tonic-gate  * on a sun4u system.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate enum intr_policies {
600Sstevel@tonic-gate 	/*
610Sstevel@tonic-gate 	 * Target interrupt at the CPU running the add_intrspec
620Sstevel@tonic-gate 	 * thread. Also used to target all interrupts at the panicing
630Sstevel@tonic-gate 	 * CPU.
640Sstevel@tonic-gate 	 */
650Sstevel@tonic-gate 	INTR_CURRENT_CPU = 0,
660Sstevel@tonic-gate 
670Sstevel@tonic-gate 	/*
680Sstevel@tonic-gate 	 * Target all interrupts at the boot cpu
690Sstevel@tonic-gate 	 */
700Sstevel@tonic-gate 	INTR_BOOT_CPU,
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 	/*
730Sstevel@tonic-gate 	 * Flat distribution of all interrupts
740Sstevel@tonic-gate 	 */
750Sstevel@tonic-gate 	INTR_FLAT_DIST,
760Sstevel@tonic-gate 
770Sstevel@tonic-gate 	/*
780Sstevel@tonic-gate 	 * Weighted distribution of all interrupts
790Sstevel@tonic-gate 	 */
800Sstevel@tonic-gate 	INTR_WEIGHTED_DIST
810Sstevel@tonic-gate };
820Sstevel@tonic-gate 
830Sstevel@tonic-gate 
840Sstevel@tonic-gate /*
850Sstevel@tonic-gate  * Structure that defines the interrupt distribution list. It contains
860Sstevel@tonic-gate  * enough info about the interrupt so that it can callback the parent
870Sstevel@tonic-gate  * nexus driver and retarget the interrupt to a different CPU.
880Sstevel@tonic-gate  */
890Sstevel@tonic-gate struct intr_dist {
900Sstevel@tonic-gate 	struct intr_dist *next;	/* link to next in list */
910Sstevel@tonic-gate 	void (*func)(void *);	/* Callback function */
920Sstevel@tonic-gate 	void *arg;		/* Nexus parent callback arg 1 */
930Sstevel@tonic-gate };
940Sstevel@tonic-gate 
950Sstevel@tonic-gate /*
960Sstevel@tonic-gate  * Miscellaneous cpu_state changes
970Sstevel@tonic-gate  */
980Sstevel@tonic-gate extern void power_down(const char *);
990Sstevel@tonic-gate extern void do_shutdown(void);
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate /*
1020Sstevel@tonic-gate  * Number of seconds until power is shut off
1030Sstevel@tonic-gate  */
1040Sstevel@tonic-gate extern int thermal_powerdown_delay;
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate /*
1080Sstevel@tonic-gate  * prom-related
1090Sstevel@tonic-gate  */
1100Sstevel@tonic-gate extern int obpdebug;
1110Sstevel@tonic-gate extern int forthdebug_supported;
1120Sstevel@tonic-gate extern uint_t tba_taken_over;
1130Sstevel@tonic-gate extern void forthdebug_init(void);
1140Sstevel@tonic-gate extern void init_vx_handler(void);
1150Sstevel@tonic-gate extern void kern_preprom(void);
1160Sstevel@tonic-gate extern void kern_postprom(void);
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate /*
1190Sstevel@tonic-gate  * externally (debugger or prom) initiated panic
1200Sstevel@tonic-gate  */
1210Sstevel@tonic-gate extern struct regs sync_reg_buf;
1220Sstevel@tonic-gate extern uint64_t sync_tt;
1230Sstevel@tonic-gate extern void sync_handler(void);
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate /*
1260Sstevel@tonic-gate  * Trap-related
1270Sstevel@tonic-gate  */
1280Sstevel@tonic-gate struct regs;
1290Sstevel@tonic-gate extern void trap(struct regs *rp, caddr_t addr, uint32_t type,
1300Sstevel@tonic-gate     uint32_t mmu_fsr);
1310Sstevel@tonic-gate extern void *get_tba(void);
1320Sstevel@tonic-gate extern void *set_tba(void *);
1330Sstevel@tonic-gate extern caddr_t set_trap_table(void);
1340Sstevel@tonic-gate extern struct scb trap_table;
1350Sstevel@tonic-gate 
1365084Sjohnlev struct panic_trap_info {
1370Sstevel@tonic-gate 	struct regs *trap_regs;
1380Sstevel@tonic-gate 	uint_t	trap_type;
1390Sstevel@tonic-gate 	caddr_t trap_addr;
1400Sstevel@tonic-gate 	uint_t	trap_mmu_fsr;
1410Sstevel@tonic-gate };
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate /*
1440Sstevel@tonic-gate  * misc. primitives
1450Sstevel@tonic-gate  */
1460Sstevel@tonic-gate #define	PROM_CFGHDL_TO_CPUID(x)	 (x  & ~(0xful << 28))
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate extern void debug_flush_windows(void);
1490Sstevel@tonic-gate extern void flush_windows(void);
1500Sstevel@tonic-gate extern int getprocessorid(void);
1510Sstevel@tonic-gate extern void reestablish_curthread(void);
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate extern void stphys(uint64_t physaddr, int value);
1540Sstevel@tonic-gate extern int ldphys(uint64_t physaddr);
1550Sstevel@tonic-gate extern void stdphys(uint64_t physaddr, uint64_t value);
1560Sstevel@tonic-gate extern uint64_t lddphys(uint64_t physaddr);
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate extern void stphysio(u_longlong_t physaddr, uint_t value);
1590Sstevel@tonic-gate extern uint_t ldphysio(u_longlong_t physaddr);
1600Sstevel@tonic-gate extern void sthphysio(u_longlong_t physaddr, ushort_t value);
1610Sstevel@tonic-gate extern ushort_t ldhphysio(u_longlong_t physaddr);
1620Sstevel@tonic-gate extern void stbphysio(u_longlong_t physaddr, uchar_t value);
1630Sstevel@tonic-gate extern uchar_t ldbphysio(u_longlong_t physaddr);
1640Sstevel@tonic-gate extern void stdphysio(u_longlong_t physaddr, u_longlong_t value);
1650Sstevel@tonic-gate extern u_longlong_t lddphysio(u_longlong_t physaddr);
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate extern int pf_is_dmacapable(pfn_t);
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate extern int dip_to_cpu_id(dev_info_t *dip, processorid_t *cpu_id);
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate extern void set_cmp_error_steering(void);
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate /*
1740Sstevel@tonic-gate  * SPARCv9 %ver register and field definitions
1750Sstevel@tonic-gate  */
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #define	ULTRA_VER_MANUF(x)	((x) >> 48)
1780Sstevel@tonic-gate #define	ULTRA_VER_IMPL(x)	(((x) >> 32) & 0xFFFF)
1790Sstevel@tonic-gate #define	ULTRA_VER_MASK(x)	(((x) >> 24) & 0xFF)
1800Sstevel@tonic-gate 
1810Sstevel@tonic-gate extern uint64_t ultra_getver(void);
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate /*
1840Sstevel@tonic-gate  * bootup-time
1850Sstevel@tonic-gate  */
1860Sstevel@tonic-gate extern void segnf_init(void);
1870Sstevel@tonic-gate extern void kern_setup1(void);
1880Sstevel@tonic-gate extern void startup(void);
1890Sstevel@tonic-gate extern void post_startup(void);
1900Sstevel@tonic-gate extern void install_va_to_tte(void);
1910Sstevel@tonic-gate extern void setwstate(uint_t);
1920Sstevel@tonic-gate extern void create_va_to_tte(void);
1930Sstevel@tonic-gate extern int memscrub_init(void);
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate extern void kcpc_hw_init(void);
1960Sstevel@tonic-gate extern void kcpc_hw_startup_cpu(ushort_t);
1970Sstevel@tonic-gate extern int kcpc_hw_load_pcbe(void);
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate /*
2000Sstevel@tonic-gate  * Interrupts
2010Sstevel@tonic-gate  */
2020Sstevel@tonic-gate struct cpu;
2030Sstevel@tonic-gate extern struct cpu cpu0;
2040Sstevel@tonic-gate extern struct scb *set_tbr(struct scb *);
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate extern uint_t disable_vec_intr(void);
2070Sstevel@tonic-gate extern void enable_vec_intr(uint_t);
2080Sstevel@tonic-gate extern void setintrenable(int);
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate extern void intr_dist_add(void (*f)(void *), void *);
2110Sstevel@tonic-gate extern void intr_dist_rem(void (*f)(void *), void *);
2120Sstevel@tonic-gate extern void intr_dist_add_weighted(void (*f)(void *, int32_t, int32_t), void *);
2130Sstevel@tonic-gate extern void intr_dist_rem_weighted(void (*f)(void *, int32_t, int32_t), void *);
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate extern uint32_t intr_dist_cpuid(void);
2160Sstevel@tonic-gate extern uint32_t intr_dist_mycpuid(void);
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate void intr_dist_cpuid_add_device_weight(uint32_t cpuid, dev_info_t *dip,
2190Sstevel@tonic-gate 		int32_t weight);
2200Sstevel@tonic-gate void intr_dist_cpuid_rem_device_weight(uint32_t cpuid, dev_info_t *dip);
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate extern void intr_redist_all_cpus(void);
2230Sstevel@tonic-gate extern void intr_redist_all_cpus_shutdown(void);
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate extern void send_dirint(int, int);
2262973Sgovinda extern void setsoftint(uint64_t);
2270Sstevel@tonic-gate extern void setsoftint_tl1(uint64_t, uint64_t);
2280Sstevel@tonic-gate extern void siron(void);
2295107Seota extern void sir_on(int);
2302973Sgovinda extern void intr_enqueue_req(uint_t pil, uint64_t inum);
2312973Sgovinda extern void intr_dequeue_req(uint_t pil, uint64_t inum);
2320Sstevel@tonic-gate extern void wr_clr_softint(uint_t);
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate /*
2350Sstevel@tonic-gate  * Time- and %tick-related
2360Sstevel@tonic-gate  */
2370Sstevel@tonic-gate extern hrtime_t rdtick(void);
2380Sstevel@tonic-gate extern void tick_write_delta(uint64_t);
2390Sstevel@tonic-gate extern void tickcmpr_set(uint64_t);
2400Sstevel@tonic-gate extern void tickcmpr_reset(void);
2410Sstevel@tonic-gate extern void tickcmpr_disable(void);
2420Sstevel@tonic-gate extern int tickcmpr_disabled(void);
2432973Sgovinda extern uint64_t cbe_level14_inum;
2440Sstevel@tonic-gate 
2450Sstevel@tonic-gate /*
2460Sstevel@tonic-gate  * contiguous memory
2470Sstevel@tonic-gate  */
2480Sstevel@tonic-gate extern void *contig_mem_alloc(size_t);
249288Sarao extern void *contig_mem_alloc_align(size_t, size_t);
2500Sstevel@tonic-gate extern void contig_mem_free(void *, size_t);
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate /*
2530Sstevel@tonic-gate  * Caches
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate extern int vac;
2560Sstevel@tonic-gate extern int cache;
2570Sstevel@tonic-gate extern int use_mp;
2580Sstevel@tonic-gate extern uint_t vac_mask;
2590Sstevel@tonic-gate extern uint64_t ecache_flushaddr;
2600Sstevel@tonic-gate extern int ecache_alignsize;	/* Maximum ecache linesize for struct align */
2610Sstevel@tonic-gate extern int ecache_setsize;	/* Maximum ecache setsize possible */
2620Sstevel@tonic-gate extern int cpu_setsize;		/* Maximum ecache setsize of configured cpus */
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate /*
2650Sstevel@tonic-gate  * VM
2660Sstevel@tonic-gate  */
2670Sstevel@tonic-gate extern int do_pg_coloring;
2680Sstevel@tonic-gate extern int use_page_coloring;
2690Sstevel@tonic-gate extern uint_t vac_colors_mask;
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate extern caddr_t get_mmfsa_scratchpad(void);
2720Sstevel@tonic-gate extern void set_mmfsa_scratchpad(caddr_t);
2730Sstevel@tonic-gate extern int ndata_alloc_mmfsa(struct memlist *);
2740Sstevel@tonic-gate extern int ndata_alloc_page_freelists(struct memlist *, int);
2750Sstevel@tonic-gate extern int ndata_alloc_dmv(struct memlist *);
2760Sstevel@tonic-gate extern int ndata_alloc_tsbs(struct memlist *, pgcnt_t);
277*12908SPavel.Tatashin@Sun.COM extern int ndata_alloc_hat(struct memlist *);
2785648Ssetje extern int ndata_alloc_kpm(struct memlist *, pgcnt_t);
2795648Ssetje extern int ndata_alloc_page_mutexs(struct memlist *ndata);
2805648Ssetje 
2815648Ssetje extern size_t calc_pp_sz(pgcnt_t);
2825648Ssetje extern size_t calc_kpmpp_sz(pgcnt_t);
2835648Ssetje extern size_t calc_hmehash_sz(pgcnt_t);
2845648Ssetje extern size_t calc_pagehash_sz(pgcnt_t);
2855648Ssetje extern size_t calc_free_pagelist_sz(void);
2865648Ssetje 
2875648Ssetje extern caddr_t alloc_hmehash(caddr_t);
2885648Ssetje extern caddr_t alloc_page_freelists(caddr_t);
2895648Ssetje 
2900Sstevel@tonic-gate extern size_t page_ctrs_sz(void);
2910Sstevel@tonic-gate extern caddr_t page_ctrs_alloc(caddr_t);
2920Sstevel@tonic-gate extern void page_freelist_coalesce_all(int);
2930Sstevel@tonic-gate extern void ppmapinit(void);
2940Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *);
2950Sstevel@tonic-gate extern void hw_pa_bcopy32(uint64_t, uint64_t);
2960Sstevel@tonic-gate 
2970Sstevel@tonic-gate extern int pp_slots;
2980Sstevel@tonic-gate extern int pp_consistent_coloring;
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate /*
3010Sstevel@tonic-gate  * ppcopy/hwblkpagecopy interaction.  See ppage.c.
3020Sstevel@tonic-gate  */
3030Sstevel@tonic-gate #define	PPAGE_STORE_VCOLORING	0x1 /* use vcolors to maintain consistency */
3040Sstevel@tonic-gate #define	PPAGE_LOAD_VCOLORING	0x2 /* use vcolors to maintain consistency */
3050Sstevel@tonic-gate #define	PPAGE_STORES_POLLUTE	0x4 /* stores pollute VAC */
3060Sstevel@tonic-gate #define	PPAGE_LOADS_POLLUTE	0x8 /* loads pollute VAC */
3070Sstevel@tonic-gate 
3080Sstevel@tonic-gate /*
3090Sstevel@tonic-gate  * VIS-accelerated copy/zero
3100Sstevel@tonic-gate  */
3110Sstevel@tonic-gate extern int use_hw_bcopy;
3120Sstevel@tonic-gate extern uint_t hw_copy_limit_1;
3130Sstevel@tonic-gate extern uint_t hw_copy_limit_2;
3140Sstevel@tonic-gate extern uint_t hw_copy_limit_4;
3150Sstevel@tonic-gate extern uint_t hw_copy_limit_8;
3160Sstevel@tonic-gate extern int use_hw_bzero;
3170Sstevel@tonic-gate 
3180Sstevel@tonic-gate #ifdef CHEETAH
3190Sstevel@tonic-gate #define	VIS_COPY_THRESHOLD 256
3200Sstevel@tonic-gate #else
3210Sstevel@tonic-gate #define	VIS_COPY_THRESHOLD 900
3220Sstevel@tonic-gate #endif
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate /*
3250Sstevel@tonic-gate  * MP
3260Sstevel@tonic-gate  */
3270Sstevel@tonic-gate extern void idle_other_cpus(void);
3280Sstevel@tonic-gate extern void resume_other_cpus(void);
3290Sstevel@tonic-gate extern void stop_other_cpus(void);
3300Sstevel@tonic-gate extern void idle_stop_xcall(void);
3310Sstevel@tonic-gate extern void set_idle_cpu(int);
3320Sstevel@tonic-gate extern void unset_idle_cpu(int);
3330Sstevel@tonic-gate extern void mp_cpu_quiesce(struct cpu *);
3341991Sheppo extern int stopcpu_bycpuid(int);
3350Sstevel@tonic-gate 
3360Sstevel@tonic-gate /*
3370Sstevel@tonic-gate  * Panic at TL > 0
3380Sstevel@tonic-gate  */
3390Sstevel@tonic-gate extern uint64_t cpu_pa[];
3400Sstevel@tonic-gate extern void ptl1_init_cpu(struct cpu *);
3410Sstevel@tonic-gate 
3420Sstevel@tonic-gate /*
3430Sstevel@tonic-gate  * Constants which define the "hole" in the 64-bit sfmmu address space.
3440Sstevel@tonic-gate  * These are set to specific values by the CPU module code.
3450Sstevel@tonic-gate  */
3460Sstevel@tonic-gate extern caddr_t	hole_start, hole_end;
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate /* kpm mapping window */
3490Sstevel@tonic-gate extern size_t	kpm_size;
3500Sstevel@tonic-gate extern uchar_t	kpm_size_shift;
3510Sstevel@tonic-gate extern caddr_t	kpm_vbase;
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate #define	INVALID_VADDR(a)	(((a) >= hole_start && (a) < hole_end))
3541991Sheppo #define	VA_ADDRESS_SPACE_BITS		64
3551991Sheppo #define	RA_ADDRESS_SPACE_BITS		56
3561991Sheppo #define	MAX_REAL_ADDRESS		(1ull << RA_ADDRESS_SPACE_BITS)
3571991Sheppo #define	DEFAULT_VA_ADDRESS_SPACE_BITS	48	/* def. Niagara (broken MD) */
3581991Sheppo #define	PAGESIZE_MASK_BITS		16
3591991Sheppo #define	MAX_PAGESIZE_MASK		((1<<PAGESIZE_MASK_BITS) - 1)
3600Sstevel@tonic-gate 
3610Sstevel@tonic-gate extern void adjust_hw_copy_limits(int);
3620Sstevel@tonic-gate 
3630Sstevel@tonic-gate struct kdi;
3640Sstevel@tonic-gate 
3650Sstevel@tonic-gate void	cpu_kdi_init(struct kdi *);
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate /*
3680Sstevel@tonic-gate  * flush instruction and data caches
3690Sstevel@tonic-gate  */
3700Sstevel@tonic-gate void	kdi_flush_caches(void);
3710Sstevel@tonic-gate 
3720Sstevel@tonic-gate struct async_flt;
3730Sstevel@tonic-gate 
3740Sstevel@tonic-gate /*
3750Sstevel@tonic-gate  * take pending fp traps if fpq present
3760Sstevel@tonic-gate  * this function is also defined in fpusystm.h
3770Sstevel@tonic-gate  */
3780Sstevel@tonic-gate void	syncfpu(void);
3790Sstevel@tonic-gate 
3800Sstevel@tonic-gate void	cpu_faulted_enter(struct cpu *);
3810Sstevel@tonic-gate void	cpu_faulted_exit(struct cpu *);
3820Sstevel@tonic-gate 
3830Sstevel@tonic-gate int	cpu_get_mem_name(uint64_t synd, uint64_t *afsr, uint64_t afar,
3840Sstevel@tonic-gate 	    char *buf, int buflen, int *lenp);
3850Sstevel@tonic-gate int	cpu_get_mem_info(uint64_t synd, uint64_t afar,
3860Sstevel@tonic-gate 	    uint64_t *mem_sizep, uint64_t *seg_sizep, uint64_t *bank_sizep,
3870Sstevel@tonic-gate 	    int *segsp, int *banksp, int *mcidp);
3880Sstevel@tonic-gate size_t	cpu_get_name_bufsize();
3890Sstevel@tonic-gate 
3900Sstevel@tonic-gate /*
3910Sstevel@tonic-gate  * ecache scrub operations
3920Sstevel@tonic-gate  */
3930Sstevel@tonic-gate void cpu_init_cache_scrub(void);
3940Sstevel@tonic-gate 
3950Sstevel@tonic-gate /*
3960Sstevel@tonic-gate  * clock/tick register operations
3970Sstevel@tonic-gate  */
3980Sstevel@tonic-gate void	cpu_init_tick_freq(void);
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate /*
4010Sstevel@tonic-gate  * stick synchronization
4020Sstevel@tonic-gate  */
4030Sstevel@tonic-gate void	sticksync_slave(void);
4040Sstevel@tonic-gate void	sticksync_master(void);
4050Sstevel@tonic-gate 
4060Sstevel@tonic-gate #endif /* _ASM */
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate /*
4090Sstevel@tonic-gate  * Actions for set_error_enable_tl1
4100Sstevel@tonic-gate  */
4110Sstevel@tonic-gate #define	EER_SET_ABSOLUTE	0x0
4120Sstevel@tonic-gate #define	EER_SET_SETBITS		0x1
4130Sstevel@tonic-gate #define	EER_SET_CLRBITS		0x2
4140Sstevel@tonic-gate 
4150Sstevel@tonic-gate /*
4160Sstevel@tonic-gate  * HVDUMP_SIZE_MAX set as 64k due to limitiation by intrq_alloc()
4170Sstevel@tonic-gate  */
4180Sstevel@tonic-gate 
4190Sstevel@tonic-gate #define	HVDUMP_SIZE_MAX		0x10000
4200Sstevel@tonic-gate #define	HVDUMP_SIZE_DEFAULT	0x8000
4210Sstevel@tonic-gate 
42220Sarao /*
42320Sarao  * HV TOD service retry in usecs
42420Sarao  */
42520Sarao 
42620Sarao #define	HV_TOD_RETRY_THRESH	100
42720Sarao #define	HV_TOD_WAIT_USEC	5
42820Sarao 
4291991Sheppo /*
4301991Sheppo  * Interrupt Queues and Error Queues
4311991Sheppo  */
4321991Sheppo 
4331991Sheppo #define	INTR_CPU_Q	0x3c
4341991Sheppo #define	INTR_DEV_Q	0x3d
4351991Sheppo #define	CPU_RQ		0x3e
4361991Sheppo #define	CPU_NRQ		0x3f
4371991Sheppo #define	DEFAULT_CPU_Q_ENTRIES	0x100
4381991Sheppo #define	DEFAULT_DEV_Q_ENTRIES	0x100
4391991Sheppo #define	INTR_REPORT_SIZE	64
4401991Sheppo 
4411991Sheppo #ifndef	_ASM
4421991Sheppo extern uint64_t cpu_q_entries;
4431991Sheppo extern uint64_t dev_q_entries;
4441991Sheppo extern uint64_t cpu_rq_entries;
4451991Sheppo extern uint64_t cpu_nrq_entries;
4464204Sha137994 extern uint64_t ncpu_guest_max;
4471991Sheppo #endif /* _ASM */
4481991Sheppo 
4490Sstevel@tonic-gate #endif /* _KERNEL */
4500Sstevel@tonic-gate 
4510Sstevel@tonic-gate #ifdef __cplusplus
4520Sstevel@tonic-gate }
4530Sstevel@tonic-gate #endif
4540Sstevel@tonic-gate 
4550Sstevel@tonic-gate #endif	/* _SYS_MACHSYSTM_H */
456