1 /* $NetBSD: cpuvar.h,v 1.19 2007/11/15 19:46:44 ad Exp $ */ 2 3 /*- 4 * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by RedBack Networks Inc. 9 * 10 * Author: Bill Sommerfeld 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the NetBSD 23 * Foundation, Inc. and its contributors. 24 * 4. Neither the name of The NetBSD Foundation nor the names of its 25 * contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 */ 40 41 /* 42 * Copyright (c) 1999 Stefan Grefen 43 * 44 * Redistribution and use in source and binary forms, with or without 45 * modification, are permitted provided that the following conditions 46 * are met: 47 * 1. Redistributions of source code must retain the above copyright 48 * notice, this list of conditions and the following disclaimer. 49 * 2. Redistributions in binary form must reproduce the above copyright 50 * notice, this list of conditions and the following disclaimer in the 51 * documentation and/or other materials provided with the distribution. 52 * 3. All advertising materials mentioning features or use of this software 53 * must display the following acknowledgement: 54 * This product includes software developed by the NetBSD 55 * Foundation, Inc. and its contributors. 56 * 4. Neither the name of The NetBSD Foundation nor the names of its 57 * contributors may be used to endorse or promote products derived 58 * from this software without specific prior written permission. 59 * 60 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 61 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 63 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE 64 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 65 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 70 * SUCH DAMAGE. 71 */ 72 73 #ifndef _X86_CPUVAR_H_ 74 #define _X86_CPUVAR_H_ 75 76 struct cpu_functions { 77 int (*start)(struct cpu_info *); 78 int (*stop)(struct cpu_info *); 79 void (*cleanup)(struct cpu_info *); 80 }; 81 82 extern const struct cpu_functions mp_cpu_funcs; 83 84 #define CPU_ROLE_SP 0 85 #define CPU_ROLE_BP 1 86 #define CPU_ROLE_AP 2 87 88 struct cpu_attach_args { 89 int cpu_number; 90 int cpu_role; 91 const struct cpu_functions *cpu_func; 92 }; 93 94 #ifdef _KERNEL 95 96 #include "opt_multiprocessor.h" 97 #ifndef XEN 98 #include "opt_enhanced_speedstep.h" 99 #include "opt_intel_coretemp.h" 100 #include "opt_intel_odcm.h" 101 #endif 102 103 #ifdef MULTIPROCESSOR 104 extern u_int32_t cpus_running; 105 #endif 106 107 int x86_ipi(int,int,int); 108 void x86_self_ipi(int); 109 int x86_ipi_init(int); 110 void x86_errata(void); 111 112 void identifycpu(struct cpu_info *); 113 void cpu_init(struct cpu_info *); 114 void cpu_init_first(void); 115 116 #ifdef INTEL_CORETEMP 117 void coretemp_register(struct cpu_info *); 118 #endif 119 120 #ifdef INTEL_ONDEMAND_CLOCKMOD 121 void clockmod_init(void); 122 #endif 123 124 #ifdef ENHANCED_SPEEDSTEP 125 void est_init(int); 126 int via_get_bus_clock(struct cpu_info *); 127 int p3_get_bus_clock(struct cpu_info *); 128 int p4_get_bus_clock(struct cpu_info *); 129 #endif 130 131 void cpu_get_tsc_freq(struct cpu_info *); 132 133 extern int cpu_vendor; 134 extern bool x86_mp_online; 135 136 #endif 137 138 #endif /* !_X86_CPUVAR_H_ */ 139