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 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_MACHSYSTM_H 28 #define _SYS_MACHSYSTM_H 29 30 /* 31 * Numerous platform-dependent interfaces that don't seem to belong 32 * in any other header file. 33 * 34 * This file should not be included by code that purports to be 35 * platform-independent. 36 * 37 */ 38 39 #include <sys/machparam.h> 40 #include <sys/varargs.h> 41 #include <sys/thread.h> 42 #include <sys/cpuvar.h> 43 #include <sys/privregs.h> 44 #include <sys/systm.h> 45 #include <sys/traptrace.h> 46 #include <vm/page.h> 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 #ifdef _KERNEL 53 54 extern void mach_cpu_idle(void); 55 extern void mach_cpu_halt(char *); 56 extern int mach_cpu_start(cpu_t *, void *); 57 extern int mach_cpuid_start(processorid_t, void *); 58 59 extern int Cpudelay; 60 extern void setcpudelay(void); 61 62 extern void send_dirint(int, int); 63 extern void siron(void); 64 extern void sir_on(int); 65 66 extern void return_instr(void); 67 68 extern int kcpc_hw_load_pcbe(void); 69 extern void kcpc_hw_init(cpu_t *cp); 70 extern void kcpc_hw_fini(cpu_t *cp); 71 extern int kcpc_hw_overflow_intr_installed; 72 73 struct panic_trap_info { 74 struct regs *trap_regs; 75 uint_t trap_type; 76 caddr_t trap_addr; 77 }; 78 79 struct memconf { 80 pfn_t mcf_spfn; /* begin page frame number */ 81 pfn_t mcf_epfn; /* end page frame number */ 82 }; 83 84 struct system_hardware { 85 int hd_nodes; /* number of nodes */ 86 int hd_cpus_per_node; /* max cpus in a node */ 87 struct memconf hd_mem[MAXNODES]; 88 /* 89 * memory layout for each 90 * node. 91 */ 92 }; 93 extern struct system_hardware system_hardware; 94 extern void get_system_configuration(void); 95 extern void mmu_init(void); 96 extern int cpuid2nodeid(int); 97 extern void map_kaddr(caddr_t, pfn_t, int, int); 98 99 extern void memscrub_init(void); 100 extern void trap(struct regs *, caddr_t, processorid_t); 101 102 extern void do_interrupt(struct regs *, trap_trace_rec_t *); 103 extern void memscrub_disable(void); 104 105 /* 106 * Dispatcher hooks. 107 */ 108 void (*idle_cpu)(); 109 void (*non_deep_idle_cpu)(); 110 void (*disp_enq_thread)(cpu_t *, int); 111 void (*non_deep_idle_disp_enq_thread)(cpu_t *, int); 112 113 #ifndef __xpv 114 extern unsigned int microdata; 115 #endif 116 117 extern int use_mp; 118 119 extern struct cpu cpus[]; /* pointer to other cpus */ 120 extern struct cpu *cpu[]; /* pointer to all cpus */ 121 122 extern int mach_cpucontext_init(void); 123 extern void mach_cpucontext_fini(void); 124 extern void *mach_cpucontext_alloc(struct cpu *); 125 extern void mach_cpucontext_free(struct cpu *, void *, int); 126 extern void rmp_gdt_init(rm_platter_t *); 127 128 extern uintptr_t hole_start, hole_end; 129 130 #define INVALID_VADDR(a) \ 131 (((a) >= (caddr_t)hole_start && (a) < (caddr_t)hole_end)) 132 133 /* kpm mapping window */ 134 extern size_t kpm_size; 135 extern uchar_t kpm_size_shift; 136 extern caddr_t kpm_vbase; 137 138 struct memlist; 139 extern void memlist_add(uint64_t, uint64_t, struct memlist *, 140 struct memlist **); 141 extern page_t *page_get_physical(uintptr_t seed); 142 extern int linear_pc(struct regs *rp, proc_t *p, caddr_t *linearp); 143 extern int dtrace_linear_pc(struct regs *rp, proc_t *p, caddr_t *linearp); 144 145 extern int force_shutdown_method; 146 147 #ifdef __xpv 148 #include <sys/xen_mmu.h> 149 extern page_t *page_get_high_mfn(mfn_t); 150 #endif 151 152 153 #endif /* _KERNEL */ 154 155 #ifdef __cplusplus 156 } 157 #endif 158 159 #endif /* _SYS_MACHSYSTM_H */ 160