1/*	$OpenBSD: mpbiosreg.h,v 1.5 2023/04/10 04:21:20 jsg Exp $	*/
2/* 	$NetBSD: mpbiosreg.h,v 1.3 2003/03/04 23:27:32 fvdl Exp $ */
3
4/*-
5 * Copyright (c) 2000 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by RedBack Networks Inc.
10 *
11 * Author: Bill Sommerfeld
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _MACHINE_MPBIOSREG_H_
36#define _MACHINE_MPBIOSREG_H_
37
38#define BIOS_BASE		(0xf0000)
39#define BIOS_SIZE		(0x10000)
40#define BIOS_COUNT		(BIOS_SIZE)
41
42/*
43 * Multiprocessor config table entry types.
44 */
45
46#define MPS_MCT_CPU	0
47#define MPS_MCT_BUS	1
48#define MPS_MCT_IOAPIC	2
49#define MPS_MCT_IOINT	3
50#define MPS_MCT_LINT	4
51
52#define MPS_MCT_NTYPES	5
53
54/*
55 * Interrupt types
56 */
57
58#define MPS_INTTYPE_INT		0
59#define MPS_INTTYPE_NMI		1
60#define MPS_INTTYPE_SMI		2
61#define MPS_INTTYPE_ExtINT	3
62
63#define MPS_INTPO_DEF		0
64#define MPS_INTPO_ACTHI		1
65#define MPS_INTPO_ACTLO		3
66#define MPS_INTPO_SHIFT		0
67#define MPS_INTPO_MASK		3
68
69#define MPS_INTTR_DEF		0
70#define MPS_INTTR_EDGE		1
71#define MPS_INTTR_LEVEL		3
72#define MPS_INTTR_SHIFT		2
73#define MPS_INTTR_MASK		3
74
75#define MPS_INT(p,t) \
76    ((((p) & MPS_INTPO_MASK) << MPS_INTPO_SHIFT) | \
77     (((t) & MPS_INTTR_MASK) << MPS_INTTR_SHIFT))
78
79/* MP Floating Pointer Structure */
80struct mpbios_fps {
81	u_int32_t	signature;
82/* string defined by the Intel MP Spec as identifying the MP table */
83#define MP_FP_SIG		0x5f504d5f	/* _MP_ */
84
85	u_int32_t 	pap;
86	u_int8_t  	length;
87	u_int8_t  	spec_rev;
88	u_int8_t  	checksum;
89	u_int8_t  	mpfb1;	/* system configuration */
90	u_int8_t  	mpfb2;	/* flags */
91#define MPFPS_FLAG_IMCR		0x80	/* IMCR present */
92	u_int8_t  	mpfb3;	/* unused */
93	u_int8_t  	mpfb4;	/* unused */
94	u_int8_t  	mpfb5;	/* unused */
95};
96
97/* MP Configuration Table Header */
98struct mpbios_cth {
99	u_int32_t	signature;
100#define MP_CT_SIG		0x504d4350 	/* PCMP */
101
102	u_int16_t 	base_len;
103	u_int8_t  	spec_rev;
104	u_int8_t  	checksum;
105	u_int8_t  	oem_id[8];
106	u_int8_t  	product_id[12];
107	u_int32_t	oem_table_pointer;
108	u_int16_t 	oem_table_size;
109	u_int16_t 	entry_count;
110	u_int32_t	apic_address;
111	u_int16_t	ext_len;
112	u_int8_t  	ext_cksum;
113	u_int8_t  	reserved;
114};
115
116struct mpbios_proc {
117	u_int8_t  type;
118	u_int8_t  apic_id;
119	u_int8_t  apic_version;
120	u_int8_t  cpu_flags;
121#define PROCENTRY_FLAG_EN	0x01
122#define PROCENTRY_FLAG_BP	0x02
123	u_int32_t  cpu_signature;
124	u_int32_t  feature_flags;
125	u_int32_t  reserved1;
126	u_int32_t  reserved2;
127};
128
129struct mpbios_bus {
130	u_int8_t  type;
131	u_int8_t  bus_id;
132	char    bus_type[6];
133};
134
135struct mpbios_ioapic {
136	u_int8_t  type;
137	u_int8_t  apic_id;
138	u_int8_t  apic_version;
139	u_int8_t  apic_flags;
140#define IOAPICENTRY_FLAG_EN	0x01
141	u_int32_t   apic_address;
142};
143
144struct mpbios_int {
145	u_int8_t  type;
146	u_int8_t  int_type;
147	u_int16_t int_flags;
148	u_int8_t  src_bus_id;
149	u_int8_t  src_bus_irq;
150	u_int8_t  dst_apic_id;
151#define MPS_ALL_APICS	0xff
152	u_int8_t  dst_apic_int;
153};
154
155
156#endif /* !_MACHINE_MPBIOSREG_H_ */
157