1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHSYSTM_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_MACHSYSTM_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * Numerous platform-dependent interfaces that don't seem to belong 34*7c478bd9Sstevel@tonic-gate * in any other header file. 35*7c478bd9Sstevel@tonic-gate * 36*7c478bd9Sstevel@tonic-gate * This file should not be included by code that purports to be 37*7c478bd9Sstevel@tonic-gate * platform-independent. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifndef _ASM 41*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 42*7c478bd9Sstevel@tonic-gate #include <sys/scb.h> 43*7c478bd9Sstevel@tonic-gate #include <sys/varargs.h> 44*7c478bd9Sstevel@tonic-gate #include <sys/machparam.h> 45*7c478bd9Sstevel@tonic-gate #include <sys/thread.h> 46*7c478bd9Sstevel@tonic-gate #include <vm/seg_enum.h> 47*7c478bd9Sstevel@tonic-gate #include <sys/processor.h> 48*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 49*7c478bd9Sstevel@tonic-gate #include <sys/memlist.h> 50*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 53*7c478bd9Sstevel@tonic-gate extern "C" { 54*7c478bd9Sstevel@tonic-gate #endif 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate #ifndef _ASM 59*7c478bd9Sstevel@tonic-gate /* 60*7c478bd9Sstevel@tonic-gate * The following enum types determine how interrupts are distributed 61*7c478bd9Sstevel@tonic-gate * on a sun4u system. 62*7c478bd9Sstevel@tonic-gate */ 63*7c478bd9Sstevel@tonic-gate enum intr_policies { 64*7c478bd9Sstevel@tonic-gate /* 65*7c478bd9Sstevel@tonic-gate * Target interrupt at the CPU running the add_intrspec 66*7c478bd9Sstevel@tonic-gate * thread. Also used to target all interrupts at the panicing 67*7c478bd9Sstevel@tonic-gate * CPU. 68*7c478bd9Sstevel@tonic-gate */ 69*7c478bd9Sstevel@tonic-gate INTR_CURRENT_CPU = 0, 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate /* 72*7c478bd9Sstevel@tonic-gate * Target all interrupts at the boot cpu 73*7c478bd9Sstevel@tonic-gate */ 74*7c478bd9Sstevel@tonic-gate INTR_BOOT_CPU, 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate /* 77*7c478bd9Sstevel@tonic-gate * Flat distribution of all interrupts 78*7c478bd9Sstevel@tonic-gate */ 79*7c478bd9Sstevel@tonic-gate INTR_FLAT_DIST, 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate /* 82*7c478bd9Sstevel@tonic-gate * Weighted distribution of all interrupts 83*7c478bd9Sstevel@tonic-gate */ 84*7c478bd9Sstevel@tonic-gate INTR_WEIGHTED_DIST 85*7c478bd9Sstevel@tonic-gate }; 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate /* 89*7c478bd9Sstevel@tonic-gate * Structure that defines the interrupt distribution list. It contains 90*7c478bd9Sstevel@tonic-gate * enough info about the interrupt so that it can callback the parent 91*7c478bd9Sstevel@tonic-gate * nexus driver and retarget the interrupt to a different CPU. 92*7c478bd9Sstevel@tonic-gate */ 93*7c478bd9Sstevel@tonic-gate struct intr_dist { 94*7c478bd9Sstevel@tonic-gate struct intr_dist *next; /* link to next in list */ 95*7c478bd9Sstevel@tonic-gate void (*func)(void *); /* Callback function */ 96*7c478bd9Sstevel@tonic-gate void *arg; /* Nexus parent callback arg 1 */ 97*7c478bd9Sstevel@tonic-gate }; 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* 100*7c478bd9Sstevel@tonic-gate * Miscellaneous cpu_state changes 101*7c478bd9Sstevel@tonic-gate */ 102*7c478bd9Sstevel@tonic-gate extern void power_down(const char *); 103*7c478bd9Sstevel@tonic-gate extern void do_shutdown(void); 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* 106*7c478bd9Sstevel@tonic-gate * Number of seconds until power is shut off 107*7c478bd9Sstevel@tonic-gate */ 108*7c478bd9Sstevel@tonic-gate extern int thermal_powerdown_delay; 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate /* 112*7c478bd9Sstevel@tonic-gate * prom-related 113*7c478bd9Sstevel@tonic-gate */ 114*7c478bd9Sstevel@tonic-gate extern int obpdebug; 115*7c478bd9Sstevel@tonic-gate extern int forthdebug_supported; 116*7c478bd9Sstevel@tonic-gate extern uint_t tba_taken_over; 117*7c478bd9Sstevel@tonic-gate extern void forthdebug_init(void); 118*7c478bd9Sstevel@tonic-gate extern void init_vx_handler(void); 119*7c478bd9Sstevel@tonic-gate extern void kern_preprom(void); 120*7c478bd9Sstevel@tonic-gate extern void kern_postprom(void); 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate /* 123*7c478bd9Sstevel@tonic-gate * externally (debugger or prom) initiated panic 124*7c478bd9Sstevel@tonic-gate */ 125*7c478bd9Sstevel@tonic-gate extern struct regs sync_reg_buf; 126*7c478bd9Sstevel@tonic-gate extern uint64_t sync_tt; 127*7c478bd9Sstevel@tonic-gate extern void sync_handler(void); 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * Trap-related 131*7c478bd9Sstevel@tonic-gate */ 132*7c478bd9Sstevel@tonic-gate struct regs; 133*7c478bd9Sstevel@tonic-gate extern void trap(struct regs *rp, caddr_t addr, uint32_t type, 134*7c478bd9Sstevel@tonic-gate uint32_t mmu_fsr); 135*7c478bd9Sstevel@tonic-gate extern void *get_tba(void); 136*7c478bd9Sstevel@tonic-gate extern void *set_tba(void *); 137*7c478bd9Sstevel@tonic-gate extern caddr_t set_trap_table(void); 138*7c478bd9Sstevel@tonic-gate extern struct scb trap_table; 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate struct trap_info { 141*7c478bd9Sstevel@tonic-gate struct regs *trap_regs; 142*7c478bd9Sstevel@tonic-gate uint_t trap_type; 143*7c478bd9Sstevel@tonic-gate caddr_t trap_addr; 144*7c478bd9Sstevel@tonic-gate uint_t trap_mmu_fsr; 145*7c478bd9Sstevel@tonic-gate }; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * misc. primitives 149*7c478bd9Sstevel@tonic-gate */ 150*7c478bd9Sstevel@tonic-gate #define PROM_CFGHDL_TO_CPUID(x) (x & ~(0xful << 28)) 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate extern void debug_flush_windows(void); 153*7c478bd9Sstevel@tonic-gate extern void flush_windows(void); 154*7c478bd9Sstevel@tonic-gate extern int getprocessorid(void); 155*7c478bd9Sstevel@tonic-gate extern void reestablish_curthread(void); 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate extern void stphys(uint64_t physaddr, int value); 158*7c478bd9Sstevel@tonic-gate extern int ldphys(uint64_t physaddr); 159*7c478bd9Sstevel@tonic-gate extern void stdphys(uint64_t physaddr, uint64_t value); 160*7c478bd9Sstevel@tonic-gate extern uint64_t lddphys(uint64_t physaddr); 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate extern void stphysio(u_longlong_t physaddr, uint_t value); 163*7c478bd9Sstevel@tonic-gate extern uint_t ldphysio(u_longlong_t physaddr); 164*7c478bd9Sstevel@tonic-gate extern void sthphysio(u_longlong_t physaddr, ushort_t value); 165*7c478bd9Sstevel@tonic-gate extern ushort_t ldhphysio(u_longlong_t physaddr); 166*7c478bd9Sstevel@tonic-gate extern void stbphysio(u_longlong_t physaddr, uchar_t value); 167*7c478bd9Sstevel@tonic-gate extern uchar_t ldbphysio(u_longlong_t physaddr); 168*7c478bd9Sstevel@tonic-gate extern void stdphysio(u_longlong_t physaddr, u_longlong_t value); 169*7c478bd9Sstevel@tonic-gate extern u_longlong_t lddphysio(u_longlong_t physaddr); 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate extern int pf_is_dmacapable(pfn_t); 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate extern int dip_to_cpu_id(dev_info_t *dip, processorid_t *cpu_id); 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate extern void set_cmp_error_steering(void); 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* 178*7c478bd9Sstevel@tonic-gate * SPARCv9 %ver register and field definitions 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate #define ULTRA_VER_MANUF(x) ((x) >> 48) 182*7c478bd9Sstevel@tonic-gate #define ULTRA_VER_IMPL(x) (((x) >> 32) & 0xFFFF) 183*7c478bd9Sstevel@tonic-gate #define ULTRA_VER_MASK(x) (((x) >> 24) & 0xFF) 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate extern uint64_t ultra_getver(void); 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* 188*7c478bd9Sstevel@tonic-gate * bootup-time 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate extern int ncpunode; 191*7c478bd9Sstevel@tonic-gate extern int niobus; 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate extern void segnf_init(void); 194*7c478bd9Sstevel@tonic-gate extern void kern_setup1(void); 195*7c478bd9Sstevel@tonic-gate extern void startup(void); 196*7c478bd9Sstevel@tonic-gate extern void post_startup(void); 197*7c478bd9Sstevel@tonic-gate extern void install_va_to_tte(void); 198*7c478bd9Sstevel@tonic-gate extern void setwstate(uint_t); 199*7c478bd9Sstevel@tonic-gate extern void create_va_to_tte(void); 200*7c478bd9Sstevel@tonic-gate extern int memscrub_init(void); 201*7c478bd9Sstevel@tonic-gate 202*7c478bd9Sstevel@tonic-gate extern void kcpc_hw_init(void); 203*7c478bd9Sstevel@tonic-gate extern void kcpc_hw_startup_cpu(ushort_t); 204*7c478bd9Sstevel@tonic-gate extern int kcpc_hw_load_pcbe(void); 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate /* 207*7c478bd9Sstevel@tonic-gate * Interrupts 208*7c478bd9Sstevel@tonic-gate */ 209*7c478bd9Sstevel@tonic-gate struct cpu; 210*7c478bd9Sstevel@tonic-gate extern struct cpu cpu0; 211*7c478bd9Sstevel@tonic-gate extern size_t intr_add_pools; 212*7c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_head; 213*7c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_tail; 214*7c478bd9Sstevel@tonic-gate extern struct scb *set_tbr(struct scb *); 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate extern void init_intr_threads(struct cpu *); 217*7c478bd9Sstevel@tonic-gate extern uint_t disable_vec_intr(void); 218*7c478bd9Sstevel@tonic-gate extern void enable_vec_intr(uint_t); 219*7c478bd9Sstevel@tonic-gate extern void setintrenable(int); 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate extern void intr_dist_add(void (*f)(void *), void *); 222*7c478bd9Sstevel@tonic-gate extern void intr_dist_rem(void (*f)(void *), void *); 223*7c478bd9Sstevel@tonic-gate extern void intr_dist_add_weighted(void (*f)(void *, int32_t, int32_t), void *); 224*7c478bd9Sstevel@tonic-gate extern void intr_dist_rem_weighted(void (*f)(void *, int32_t, int32_t), void *); 225*7c478bd9Sstevel@tonic-gate 226*7c478bd9Sstevel@tonic-gate extern uint32_t intr_dist_cpuid(void); 227*7c478bd9Sstevel@tonic-gate extern uint32_t intr_dist_mycpuid(void); 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate void intr_dist_cpuid_add_device_weight(uint32_t cpuid, dev_info_t *dip, 230*7c478bd9Sstevel@tonic-gate int32_t weight); 231*7c478bd9Sstevel@tonic-gate void intr_dist_cpuid_rem_device_weight(uint32_t cpuid, dev_info_t *dip); 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate extern void intr_redist_all_cpus(void); 234*7c478bd9Sstevel@tonic-gate extern void intr_redist_all_cpus_shutdown(void); 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate extern void send_dirint(int, int); 237*7c478bd9Sstevel@tonic-gate extern void setsoftint(uint_t); 238*7c478bd9Sstevel@tonic-gate extern void setsoftint_tl1(uint64_t, uint64_t); 239*7c478bd9Sstevel@tonic-gate extern void siron(void); 240*7c478bd9Sstevel@tonic-gate extern void intr_enqueue_req(uint_t pil, uint32_t inum); 241*7c478bd9Sstevel@tonic-gate extern void intr_dequeue_req(uint_t pil, uint32_t inum); 242*7c478bd9Sstevel@tonic-gate extern void wr_clr_softint(uint_t); 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate /* 245*7c478bd9Sstevel@tonic-gate * Time- and %tick-related 246*7c478bd9Sstevel@tonic-gate */ 247*7c478bd9Sstevel@tonic-gate extern hrtime_t rdtick(void); 248*7c478bd9Sstevel@tonic-gate extern void tick_write_delta(uint64_t); 249*7c478bd9Sstevel@tonic-gate extern void tickcmpr_set(uint64_t); 250*7c478bd9Sstevel@tonic-gate extern void tickcmpr_reset(void); 251*7c478bd9Sstevel@tonic-gate extern void tickcmpr_disable(void); 252*7c478bd9Sstevel@tonic-gate extern int tickcmpr_disabled(void); 253*7c478bd9Sstevel@tonic-gate extern uint32_t cbe_level14_inum; 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate /* 256*7c478bd9Sstevel@tonic-gate * contiguous memory 257*7c478bd9Sstevel@tonic-gate */ 258*7c478bd9Sstevel@tonic-gate extern void *contig_mem_alloc(size_t); 259*7c478bd9Sstevel@tonic-gate extern void contig_mem_free(void *, size_t); 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate /* 262*7c478bd9Sstevel@tonic-gate * Caches 263*7c478bd9Sstevel@tonic-gate */ 264*7c478bd9Sstevel@tonic-gate extern int vac; 265*7c478bd9Sstevel@tonic-gate extern int cache; 266*7c478bd9Sstevel@tonic-gate extern int use_mp; 267*7c478bd9Sstevel@tonic-gate extern uint_t vac_mask; 268*7c478bd9Sstevel@tonic-gate extern uint64_t ecache_flushaddr; 269*7c478bd9Sstevel@tonic-gate extern int ecache_alignsize; /* Maximum ecache linesize for struct align */ 270*7c478bd9Sstevel@tonic-gate extern int ecache_setsize; /* Maximum ecache setsize possible */ 271*7c478bd9Sstevel@tonic-gate extern int cpu_setsize; /* Maximum ecache setsize of configured cpus */ 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate /* 274*7c478bd9Sstevel@tonic-gate * VM 275*7c478bd9Sstevel@tonic-gate */ 276*7c478bd9Sstevel@tonic-gate extern int do_pg_coloring; 277*7c478bd9Sstevel@tonic-gate extern int do_virtual_coloring; 278*7c478bd9Sstevel@tonic-gate extern int use_page_coloring; 279*7c478bd9Sstevel@tonic-gate extern int use_virtual_coloring; 280*7c478bd9Sstevel@tonic-gate extern uint_t vac_colors_mask; 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate extern void ndata_alloc_init(struct memlist *, uintptr_t, uintptr_t); 283*7c478bd9Sstevel@tonic-gate extern void *ndata_alloc(struct memlist *, size_t, size_t); 284*7c478bd9Sstevel@tonic-gate extern void *ndata_extra_base(struct memlist *, size_t); 285*7c478bd9Sstevel@tonic-gate extern size_t ndata_maxsize(struct memlist *); 286*7c478bd9Sstevel@tonic-gate extern size_t ndata_spare(struct memlist *, size_t, size_t); 287*7c478bd9Sstevel@tonic-gate extern caddr_t get_mmfsa_scratchpad(void); 288*7c478bd9Sstevel@tonic-gate extern void set_mmfsa_scratchpad(caddr_t); 289*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_mmfsa(struct memlist *); 290*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_cpus(struct memlist *); 291*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_page_freelists(struct memlist *, int); 292*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_dmv(struct memlist *); 293*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_tsbs(struct memlist *, pgcnt_t); 294*7c478bd9Sstevel@tonic-gate extern int ndata_alloc_hat(struct memlist *, pgcnt_t, pgcnt_t); 295*7c478bd9Sstevel@tonic-gate extern caddr_t alloc_page_freelists(int, caddr_t, int); 296*7c478bd9Sstevel@tonic-gate extern caddr_t alloc_hme_buckets(caddr_t, int); 297*7c478bd9Sstevel@tonic-gate extern size_t page_ctrs_sz(void); 298*7c478bd9Sstevel@tonic-gate extern caddr_t page_ctrs_alloc(caddr_t); 299*7c478bd9Sstevel@tonic-gate extern void page_freelist_coalesce_all(int); 300*7c478bd9Sstevel@tonic-gate extern void ppmapinit(void); 301*7c478bd9Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *); 302*7c478bd9Sstevel@tonic-gate extern void hw_pa_bcopy32(uint64_t, uint64_t); 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate extern int pp_slots; 305*7c478bd9Sstevel@tonic-gate extern int pp_consistent_coloring; 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate /* 308*7c478bd9Sstevel@tonic-gate * ppcopy/hwblkpagecopy interaction. See ppage.c. 309*7c478bd9Sstevel@tonic-gate */ 310*7c478bd9Sstevel@tonic-gate #define PPAGE_STORE_VCOLORING 0x1 /* use vcolors to maintain consistency */ 311*7c478bd9Sstevel@tonic-gate #define PPAGE_LOAD_VCOLORING 0x2 /* use vcolors to maintain consistency */ 312*7c478bd9Sstevel@tonic-gate #define PPAGE_STORES_POLLUTE 0x4 /* stores pollute VAC */ 313*7c478bd9Sstevel@tonic-gate #define PPAGE_LOADS_POLLUTE 0x8 /* loads pollute VAC */ 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate /* 316*7c478bd9Sstevel@tonic-gate * VIS-accelerated copy/zero 317*7c478bd9Sstevel@tonic-gate */ 318*7c478bd9Sstevel@tonic-gate extern int use_hw_bcopy; 319*7c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_1; 320*7c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_2; 321*7c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_4; 322*7c478bd9Sstevel@tonic-gate extern uint_t hw_copy_limit_8; 323*7c478bd9Sstevel@tonic-gate extern int use_hw_bzero; 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate #ifdef CHEETAH 326*7c478bd9Sstevel@tonic-gate #define VIS_COPY_THRESHOLD 256 327*7c478bd9Sstevel@tonic-gate #else 328*7c478bd9Sstevel@tonic-gate #define VIS_COPY_THRESHOLD 900 329*7c478bd9Sstevel@tonic-gate #endif 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate /* 332*7c478bd9Sstevel@tonic-gate * MP 333*7c478bd9Sstevel@tonic-gate */ 334*7c478bd9Sstevel@tonic-gate extern void idle_other_cpus(void); 335*7c478bd9Sstevel@tonic-gate extern void resume_other_cpus(void); 336*7c478bd9Sstevel@tonic-gate extern void stop_other_cpus(void); 337*7c478bd9Sstevel@tonic-gate extern void idle_stop_xcall(void); 338*7c478bd9Sstevel@tonic-gate extern void set_idle_cpu(int); 339*7c478bd9Sstevel@tonic-gate extern void unset_idle_cpu(int); 340*7c478bd9Sstevel@tonic-gate extern void mp_cpu_quiesce(struct cpu *); 341*7c478bd9Sstevel@tonic-gate 342*7c478bd9Sstevel@tonic-gate /* 343*7c478bd9Sstevel@tonic-gate * Panic at TL > 0 344*7c478bd9Sstevel@tonic-gate */ 345*7c478bd9Sstevel@tonic-gate extern uint64_t cpu_pa[]; 346*7c478bd9Sstevel@tonic-gate extern void ptl1_init_cpu(struct cpu *); 347*7c478bd9Sstevel@tonic-gate 348*7c478bd9Sstevel@tonic-gate /* 349*7c478bd9Sstevel@tonic-gate * Defines for DR interfaces 350*7c478bd9Sstevel@tonic-gate */ 351*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_CHILD 0x01 /* Walk immediate children of root */ 352*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_CONFIGURE 0x02 /* Configure branch after create */ 353*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_DESTROY 0x04 /* Destroy branch after unconfigure */ 354*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_EVENT 0x08 /* Post NDI event */ 355*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_PROM 0x10 /* Branches derived from PROM nodes */ 356*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_SID 0x20 /* SID node branches */ 357*7c478bd9Sstevel@tonic-gate #define DEVI_BRANCH_ROOT 0x40 /* Node is the root of a branch */ 358*7c478bd9Sstevel@tonic-gate 359*7c478bd9Sstevel@tonic-gate typedef struct devi_branch { 360*7c478bd9Sstevel@tonic-gate void *arg; 361*7c478bd9Sstevel@tonic-gate void (*devi_branch_callback)(dev_info_t *, void *, uint_t); 362*7c478bd9Sstevel@tonic-gate int type; 363*7c478bd9Sstevel@tonic-gate union { 364*7c478bd9Sstevel@tonic-gate int (*prom_branch_select)(dnode_t, void *, uint_t); 365*7c478bd9Sstevel@tonic-gate int (*sid_branch_create)(dev_info_t *, void *, uint_t); 366*7c478bd9Sstevel@tonic-gate } create; 367*7c478bd9Sstevel@tonic-gate } devi_branch_t; 368*7c478bd9Sstevel@tonic-gate 369*7c478bd9Sstevel@tonic-gate 370*7c478bd9Sstevel@tonic-gate /* 371*7c478bd9Sstevel@tonic-gate * Prototypes which really belongs to sunddi.c, and should be moved to 372*7c478bd9Sstevel@tonic-gate * sunddi.c if there is another platform using these calls. 373*7c478bd9Sstevel@tonic-gate */ 374*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_create(dev_info_t *pdip, devi_branch_t *bp, 375*7c478bd9Sstevel@tonic-gate dev_info_t **dipp, uint_t flags); 376*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_configure(dev_info_t *rdip, dev_info_t **dipp, 377*7c478bd9Sstevel@tonic-gate uint_t flags); 378*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_unconfigure(dev_info_t *rdip, dev_info_t **dipp, 379*7c478bd9Sstevel@tonic-gate uint_t flags); 380*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_destroy(dev_info_t *rdip, dev_info_t **dipp, 381*7c478bd9Sstevel@tonic-gate uint_t flags); 382*7c478bd9Sstevel@tonic-gate extern void e_ddi_branch_hold(dev_info_t *rdip); 383*7c478bd9Sstevel@tonic-gate extern void e_ddi_branch_rele(dev_info_t *rdip); 384*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_held(dev_info_t *rdip); 385*7c478bd9Sstevel@tonic-gate extern int e_ddi_branch_referenced(dev_info_t *rdip, 386*7c478bd9Sstevel@tonic-gate int (*cb)(dev_info_t *dip, void *, uint_t), void *arg); 387*7c478bd9Sstevel@tonic-gate 388*7c478bd9Sstevel@tonic-gate /* 389*7c478bd9Sstevel@tonic-gate * Constants which define the "hole" in the 64-bit sfmmu address space. 390*7c478bd9Sstevel@tonic-gate * These are set to specific values by the CPU module code. 391*7c478bd9Sstevel@tonic-gate */ 392*7c478bd9Sstevel@tonic-gate extern caddr_t hole_start, hole_end; 393*7c478bd9Sstevel@tonic-gate 394*7c478bd9Sstevel@tonic-gate /* kpm mapping window */ 395*7c478bd9Sstevel@tonic-gate extern size_t kpm_size; 396*7c478bd9Sstevel@tonic-gate extern uchar_t kpm_size_shift; 397*7c478bd9Sstevel@tonic-gate extern caddr_t kpm_vbase; 398*7c478bd9Sstevel@tonic-gate 399*7c478bd9Sstevel@tonic-gate #define INVALID_VADDR(a) (((a) >= hole_start && (a) < hole_end)) 400*7c478bd9Sstevel@tonic-gate 401*7c478bd9Sstevel@tonic-gate extern void adjust_hw_copy_limits(int); 402*7c478bd9Sstevel@tonic-gate 403*7c478bd9Sstevel@tonic-gate struct kdi; 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gate void cpu_kdi_init(struct kdi *); 406*7c478bd9Sstevel@tonic-gate 407*7c478bd9Sstevel@tonic-gate /* 408*7c478bd9Sstevel@tonic-gate * flush instruction and data caches 409*7c478bd9Sstevel@tonic-gate */ 410*7c478bd9Sstevel@tonic-gate void kdi_flush_caches(void); 411*7c478bd9Sstevel@tonic-gate 412*7c478bd9Sstevel@tonic-gate struct async_flt; 413*7c478bd9Sstevel@tonic-gate 414*7c478bd9Sstevel@tonic-gate /* 415*7c478bd9Sstevel@tonic-gate * take pending fp traps if fpq present 416*7c478bd9Sstevel@tonic-gate * this function is also defined in fpusystm.h 417*7c478bd9Sstevel@tonic-gate */ 418*7c478bd9Sstevel@tonic-gate void syncfpu(void); 419*7c478bd9Sstevel@tonic-gate 420*7c478bd9Sstevel@tonic-gate void cpu_flush_ecache(void); 421*7c478bd9Sstevel@tonic-gate void cpu_faulted_enter(struct cpu *); 422*7c478bd9Sstevel@tonic-gate void cpu_faulted_exit(struct cpu *); 423*7c478bd9Sstevel@tonic-gate 424*7c478bd9Sstevel@tonic-gate int cpu_get_mem_name(uint64_t synd, uint64_t *afsr, uint64_t afar, 425*7c478bd9Sstevel@tonic-gate char *buf, int buflen, int *lenp); 426*7c478bd9Sstevel@tonic-gate int cpu_get_mem_info(uint64_t synd, uint64_t afar, 427*7c478bd9Sstevel@tonic-gate uint64_t *mem_sizep, uint64_t *seg_sizep, uint64_t *bank_sizep, 428*7c478bd9Sstevel@tonic-gate int *segsp, int *banksp, int *mcidp); 429*7c478bd9Sstevel@tonic-gate size_t cpu_get_name_bufsize(); 430*7c478bd9Sstevel@tonic-gate 431*7c478bd9Sstevel@tonic-gate /* 432*7c478bd9Sstevel@tonic-gate * ecache scrub operations 433*7c478bd9Sstevel@tonic-gate */ 434*7c478bd9Sstevel@tonic-gate void cpu_init_cache_scrub(void); 435*7c478bd9Sstevel@tonic-gate 436*7c478bd9Sstevel@tonic-gate /* 437*7c478bd9Sstevel@tonic-gate * clock/tick register operations 438*7c478bd9Sstevel@tonic-gate */ 439*7c478bd9Sstevel@tonic-gate void cpu_init_tick_freq(void); 440*7c478bd9Sstevel@tonic-gate 441*7c478bd9Sstevel@tonic-gate /* 442*7c478bd9Sstevel@tonic-gate * stick synchronization 443*7c478bd9Sstevel@tonic-gate */ 444*7c478bd9Sstevel@tonic-gate void sticksync_slave(void); 445*7c478bd9Sstevel@tonic-gate void sticksync_master(void); 446*7c478bd9Sstevel@tonic-gate 447*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 448*7c478bd9Sstevel@tonic-gate 449*7c478bd9Sstevel@tonic-gate /* 450*7c478bd9Sstevel@tonic-gate * Actions for set_error_enable_tl1 451*7c478bd9Sstevel@tonic-gate */ 452*7c478bd9Sstevel@tonic-gate #define EER_SET_ABSOLUTE 0x0 453*7c478bd9Sstevel@tonic-gate #define EER_SET_SETBITS 0x1 454*7c478bd9Sstevel@tonic-gate #define EER_SET_CLRBITS 0x2 455*7c478bd9Sstevel@tonic-gate 456*7c478bd9Sstevel@tonic-gate /* 457*7c478bd9Sstevel@tonic-gate * HVDUMP_SIZE_MAX set as 64k due to limitiation by intrq_alloc() 458*7c478bd9Sstevel@tonic-gate */ 459*7c478bd9Sstevel@tonic-gate 460*7c478bd9Sstevel@tonic-gate #define HVDUMP_SIZE_MAX 0x10000 461*7c478bd9Sstevel@tonic-gate #define HVDUMP_SIZE_DEFAULT 0x8000 462*7c478bd9Sstevel@tonic-gate 463*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 464*7c478bd9Sstevel@tonic-gate 465*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 466*7c478bd9Sstevel@tonic-gate } 467*7c478bd9Sstevel@tonic-gate #endif 468*7c478bd9Sstevel@tonic-gate 469*7c478bd9Sstevel@tonic-gate #endif /* _SYS_MACHSYSTM_H */ 470