xref: /openbsd-src/sys/arch/i386/include/cpuvar.h (revision 0de1afec16fe5e4f278d8db4801680edae2856d8)
1*0de1afecSjsg /*	$OpenBSD: cpuvar.h,v 1.8 2024/10/21 03:07:54 jsg Exp $	*/
2012ea299Sniklas /* $NetBSD: cpuvar.h,v 1.1.2.3 2000/02/21 18:54:07 sommerfeld Exp $ */
3012ea299Sniklas 
4012ea299Sniklas /*-
5012ea299Sniklas  * Copyright (c) 2000 The NetBSD Foundation, Inc.
6012ea299Sniklas  * All rights reserved.
7012ea299Sniklas  *
8012ea299Sniklas  * This code is derived from software contributed to The NetBSD Foundation
9012ea299Sniklas  * by RedBack Networks Inc.
10012ea299Sniklas  *
11012ea299Sniklas  * Author: Bill Sommerfeld
12012ea299Sniklas  *
13012ea299Sniklas  * Redistribution and use in source and binary forms, with or without
14012ea299Sniklas  * modification, are permitted provided that the following conditions
15012ea299Sniklas  * are met:
16012ea299Sniklas  * 1. Redistributions of source code must retain the above copyright
17012ea299Sniklas  *    notice, this list of conditions and the following disclaimer.
18012ea299Sniklas  * 2. Redistributions in binary form must reproduce the above copyright
19012ea299Sniklas  *    notice, this list of conditions and the following disclaimer in the
20012ea299Sniklas  *    documentation and/or other materials provided with the distribution.
21012ea299Sniklas  *
22012ea299Sniklas  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23012ea299Sniklas  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24012ea299Sniklas  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25012ea299Sniklas  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26012ea299Sniklas  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27012ea299Sniklas  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28012ea299Sniklas  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29012ea299Sniklas  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30012ea299Sniklas  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31012ea299Sniklas  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32012ea299Sniklas  * POSSIBILITY OF SUCH DAMAGE.
33012ea299Sniklas  */
34012ea299Sniklas 
35012ea299Sniklas /*
36012ea299Sniklas  * Copyright (c) 1999 Stefan Grefen
37012ea299Sniklas  *
38012ea299Sniklas  * Redistribution and use in source and binary forms, with or without
39012ea299Sniklas  * modification, are permitted provided that the following conditions
40012ea299Sniklas  * are met:
41012ea299Sniklas  * 1. Redistributions of source code must retain the above copyright
42012ea299Sniklas  *    notice, this list of conditions and the following disclaimer.
43012ea299Sniklas  * 2. Redistributions in binary form must reproduce the above copyright
44012ea299Sniklas  *    notice, this list of conditions and the following disclaimer in the
45012ea299Sniklas  *    documentation and/or other materials provided with the distribution.
46012ea299Sniklas  * 3. All advertising materials mentioning features or use of this software
47012ea299Sniklas  *    must display the following acknowledgement:
48012ea299Sniklas  *      This product includes software developed by the NetBSD
49012ea299Sniklas  *      Foundation, Inc. and its contributors.
50012ea299Sniklas  * 4. Neither the name of The NetBSD Foundation nor the names of its
51012ea299Sniklas  *    contributors may be used to endorse or promote products derived
52012ea299Sniklas  *    from this software without specific prior written permission.
53012ea299Sniklas  *
54012ea299Sniklas  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
55012ea299Sniklas  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56012ea299Sniklas  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57012ea299Sniklas  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE
58012ea299Sniklas  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59012ea299Sniklas  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60012ea299Sniklas  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61012ea299Sniklas  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62012ea299Sniklas  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63012ea299Sniklas  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64012ea299Sniklas  * SUCH DAMAGE.
65012ea299Sniklas  */
66012ea299Sniklas 
67012ea299Sniklas struct cpu_functions {
68012ea299Sniklas     int (*start)(struct cpu_info *);
69012ea299Sniklas     int (*stop)(struct cpu_info *);
70012ea299Sniklas     void (*cleanup)(struct cpu_info *);
71012ea299Sniklas };
72012ea299Sniklas 
73012ea299Sniklas extern struct cpu_functions mp_cpu_funcs;
74012ea299Sniklas 
75012ea299Sniklas #define CPU_ROLE_SP	0
76012ea299Sniklas #define CPU_ROLE_BP	1
77012ea299Sniklas #define CPU_ROLE_AP	2
78012ea299Sniklas 
79012ea299Sniklas struct cpu_attach_args {
80012ea299Sniklas 	const char *caa_name;
81a2e7ce2eSkettenis 	int cpu_apicid;
82a2e7ce2eSkettenis 	int cpu_acpi_proc_id;
83012ea299Sniklas 	int cpu_role;
84012ea299Sniklas 	struct cpu_functions *cpu_func;
85012ea299Sniklas 	int cpu_signature;
86012ea299Sniklas 	int feature_flags;
87012ea299Sniklas };
88012ea299Sniklas 
89012ea299Sniklas #ifdef _KERNEL
90012ea299Sniklas 
911245a68aSsf void i386_ipi(int,int,int);
92bce2cee5Ssf void i386_ipi_init(int);
93012ea299Sniklas 
94012ea299Sniklas void identifycpu(struct cpu_info *);
95012ea299Sniklas void cpu_init(struct cpu_info *);
96012ea299Sniklas void cpu_init_first(void);
97012ea299Sniklas 
98012ea299Sniklas #endif
99012ea299Sniklas 
100