xref: /openbsd-src/sys/arch/i386/include/mpbiosreg.h (revision 9bec9e437814d912a96fbd6178318d8771001434)
1*9bec9e43Sjsg /*	$OpenBSD: mpbiosreg.h,v 1.6 2023/04/10 04:21:20 jsg Exp $	*/
2012ea299Sniklas /* $NetBSD: mpbiosreg.h,v 1.1.2.3 2000/02/29 13:17:51 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 
352fa72412Spirofti #ifndef _MACHINE_MPBIOSREG_H_
362fa72412Spirofti #define _MACHINE_MPBIOSREG_H_
37012ea299Sniklas 
38012ea299Sniklas #define BIOS_BASE		(0xf0000)
39012ea299Sniklas #define BIOS_SIZE		(0x10000)
40012ea299Sniklas #define BIOS_COUNT		(BIOS_SIZE)
41012ea299Sniklas 
42012ea299Sniklas /*
43012ea299Sniklas  * Multiprocessor config table entry types.
44012ea299Sniklas  */
45012ea299Sniklas 
46012ea299Sniklas #define MPS_MCT_CPU	0
47012ea299Sniklas #define MPS_MCT_BUS	1
48012ea299Sniklas #define MPS_MCT_IOAPIC	2
49012ea299Sniklas #define MPS_MCT_IOINT	3
50012ea299Sniklas #define MPS_MCT_LINT	4
51012ea299Sniklas 
52012ea299Sniklas #define MPS_MCT_NTYPES	5
53012ea299Sniklas 
54012ea299Sniklas /*
55*9bec9e43Sjsg  * Interrupt types
56012ea299Sniklas  */
57012ea299Sniklas 
58012ea299Sniklas #define MPS_INTTYPE_INT		0
59012ea299Sniklas #define MPS_INTTYPE_NMI		1
60012ea299Sniklas #define MPS_INTTYPE_SMI		2
61012ea299Sniklas #define MPS_INTTYPE_ExtINT	3
62012ea299Sniklas 
63012ea299Sniklas #define MPS_INTPO_DEF		0
64012ea299Sniklas #define MPS_INTPO_ACTHI		1
65012ea299Sniklas #define MPS_INTPO_ACTLO		3
66a25c7806Smickey #define MPS_INTPO_SHIFT		0
67a25c7806Smickey #define MPS_INTPO_MASK		3
68012ea299Sniklas 
69012ea299Sniklas #define MPS_INTTR_DEF		0
70012ea299Sniklas #define MPS_INTTR_EDGE		1
71012ea299Sniklas #define MPS_INTTR_LEVEL		3
72a25c7806Smickey #define MPS_INTTR_SHIFT		2
73a25c7806Smickey #define MPS_INTTR_MASK		3
74012ea299Sniklas 
75a25c7806Smickey #define MPS_INT(p,t) \
76a25c7806Smickey     ((((p) & MPS_INTPO_MASK) << MPS_INTPO_SHIFT) | \
77a25c7806Smickey      (((t) & MPS_INTTR_MASK) << MPS_INTTR_SHIFT))
78012ea299Sniklas 
79012ea299Sniklas /* MP Floating Pointer Structure */
80012ea299Sniklas struct mpbios_fps {
81012ea299Sniklas 	u_int32_t	signature;
82012ea299Sniklas /* string defined by the Intel MP Spec as identifying the MP table */
83012ea299Sniklas #define MP_FP_SIG		0x5f504d5f	/* _MP_ */
84012ea299Sniklas 
85012ea299Sniklas 	u_int32_t 	pap;
86012ea299Sniklas 	u_int8_t  	length;
87012ea299Sniklas 	u_int8_t  	spec_rev;
88012ea299Sniklas 	u_int8_t  	checksum;
89012ea299Sniklas 	u_int8_t  	mpfb1;	/* system configuration */
90012ea299Sniklas 	u_int8_t  	mpfb2;	/* flags */
91012ea299Sniklas #define MPFPS_FLAG_IMCR		0x80	/* IMCR present */
92012ea299Sniklas 	u_int8_t  	mpfb3;	/* unused */
93012ea299Sniklas 	u_int8_t  	mpfb4;	/* unused */
94012ea299Sniklas 	u_int8_t  	mpfb5;	/* unused */
95012ea299Sniklas };
96012ea299Sniklas 
97012ea299Sniklas /* MP Configuration Table Header */
98012ea299Sniklas struct mpbios_cth {
99012ea299Sniklas 	u_int32_t	signature;
100012ea299Sniklas #define MP_CT_SIG		0x504d4350 	/* PCMP */
101012ea299Sniklas 
102012ea299Sniklas 	u_int16_t 	base_len;
103012ea299Sniklas 	u_int8_t  	spec_rev;
104012ea299Sniklas 	u_int8_t  	checksum;
105012ea299Sniklas 	u_int8_t  	oem_id[8];
106012ea299Sniklas 	u_int8_t  	product_id[12];
107012ea299Sniklas 	u_int32_t	oem_table_pointer;
108012ea299Sniklas 	u_int16_t 	oem_table_size;
109012ea299Sniklas 	u_int16_t 	entry_count;
110012ea299Sniklas 	u_int32_t	apic_address;
111012ea299Sniklas 	u_int16_t	ext_len;
112012ea299Sniklas 	u_int8_t  	ext_cksum;
113012ea299Sniklas 	u_int8_t  	reserved;
114012ea299Sniklas };
115012ea299Sniklas 
116012ea299Sniklas struct mpbios_proc {
117012ea299Sniklas 	u_int8_t  type;
118012ea299Sniklas 	u_int8_t  apic_id;
119012ea299Sniklas 	u_int8_t  apic_version;
120012ea299Sniklas 	u_int8_t  cpu_flags;
121012ea299Sniklas #define PROCENTRY_FLAG_EN	0x01
122012ea299Sniklas #define PROCENTRY_FLAG_BP	0x02
123012ea299Sniklas 	u_long  cpu_signature;
124012ea299Sniklas 	u_long  feature_flags;
125012ea299Sniklas 	u_long  reserved1;
126012ea299Sniklas 	u_long  reserved2;
127012ea299Sniklas };
128012ea299Sniklas 
129012ea299Sniklas struct mpbios_bus {
130012ea299Sniklas 	u_int8_t  type;
131012ea299Sniklas 	u_int8_t  bus_id;
132012ea299Sniklas 	char    bus_type[6];
133012ea299Sniklas };
134012ea299Sniklas 
135012ea299Sniklas struct mpbios_ioapic {
136012ea299Sniklas 	u_int8_t  type;
137012ea299Sniklas 	u_int8_t  apic_id;
138012ea299Sniklas 	u_int8_t  apic_version;
139012ea299Sniklas 	u_int8_t  apic_flags;
140012ea299Sniklas #define IOAPICENTRY_FLAG_EN	0x01
141012ea299Sniklas 	void   *apic_address;
142012ea299Sniklas };
143012ea299Sniklas 
144012ea299Sniklas struct mpbios_int {
145012ea299Sniklas 	u_int8_t  type;
146012ea299Sniklas 	u_int8_t  int_type;
147012ea299Sniklas 	u_int16_t int_flags;
148012ea299Sniklas 	u_int8_t  src_bus_id;
149012ea299Sniklas 	u_int8_t  src_bus_irq;
150012ea299Sniklas 	u_int8_t  dst_apic_id;
151012ea299Sniklas #define MPS_ALL_APICS	0xff
152012ea299Sniklas 	u_int8_t  dst_apic_int;
153012ea299Sniklas };
154012ea299Sniklas 
1552fa72412Spirofti #endif /* !_MACHINE_MPBIOSREG_H_ */
156