1 /*        $NetBSD: mpbiosreg.h,v 1.6 2010/04/18 23:47:51 jym Exp $ */
2 
3 /*-
4  * Copyright (c) 2000 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  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _X86_MPBIOSREG_H_
35 #define _X86_MPBIOSREG_H_
36 
37 #define BIOS_BASE             (0xf0000)
38 #define BIOS_SIZE             (0x10000)
39 #define BIOS_COUNT            (BIOS_SIZE)
40 
41 /*
42  * Multiprocessor config table entry types.
43  */
44 
45 #define MPS_MCT_CPU 0
46 #define MPS_MCT_BUS 1
47 #define MPS_MCT_IOAPIC        2
48 #define MPS_MCT_IOINT         3
49 #define MPS_MCT_LINT          4
50 
51 #define MPS_MCT_NTYPES        5
52 
53 /* MP Floating Pointer Structure */
54 struct mpbios_fps {
55           uint32_t  signature;
56 /* string defined by the Intel MP Spec as identifying the MP table */
57 #define MP_FP_SIG             0x5f504d5f          /* _MP_ */
58 
59           uint32_t  pap;
60           uint8_t   length;
61           uint8_t   spec_rev;
62           uint8_t   checksum;
63           uint8_t   mpfb1;    /* system configuration */
64           uint8_t   mpfb2;    /* flags */
65 #define MPFPS_FLAG_IMCR                 0x80      /* IMCR present */
66           uint8_t   mpfb3;    /* unused */
67           uint8_t   mpfb4;    /* unused */
68           uint8_t   mpfb5;    /* unused */
69 };
70 
71 /* MP Configuration Table Header */
72 struct mpbios_cth {
73           uint32_t  signature;
74 #define MP_CT_SIG             0x504d4350          /* PCMP */
75 
76           uint16_t  base_len;
77           uint8_t   spec_rev;
78           uint8_t   checksum;
79           uint8_t   oem_id[8];
80           uint8_t   product_id[12];
81           uint32_t  oem_table_pointer;
82           uint16_t  oem_table_size;
83           uint16_t  entry_count;
84           uint32_t  apic_address;
85           uint16_t  ext_len;
86           uint8_t   ext_cksum;
87           uint8_t   reserved;
88 };
89 
90 struct mpbios_proc {
91           uint8_t  type;
92           uint8_t  apic_id;
93           uint8_t  apic_version;
94           uint8_t  cpu_flags;
95 #define PROCENTRY_FLAG_EN     0x01
96 #define PROCENTRY_FLAG_BP     0x02
97           uint32_t  reserved1;
98           uint32_t  reserved2;
99 };
100 
101 struct mpbios_bus {
102           uint8_t  type;
103           uint8_t  bus_id;
104           char    bus_type[6];
105 };
106 
107 struct mpbios_ioapic {
108           uint8_t  type;
109           uint8_t  apic_id;
110           uint8_t  apic_version;
111           uint8_t  apic_flags;
112 #define IOAPICENTRY_FLAG_EN   0x01
113           uint32_t   apic_address;
114 };
115 
116 struct mpbios_int {
117           uint8_t  type;
118           uint8_t  int_type;
119           uint16_t int_flags;
120           uint8_t  src_bus_id;
121           uint8_t  src_bus_irq;
122           uint8_t  dst_apic_id;
123 #define MPS_ALL_APICS         0xff
124           uint8_t  dst_apic_int;
125 };
126 
127 
128 #endif /* !_X86_MPBIOSREG_H_ */
129