2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 1996, by Steve Passe
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the developer may NOT be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef __MACHINE_MPTABLE_H__
31 #define __MACHINE_MPTABLE_H__
43 UNKNOWN_BUSTYPE = 0xff
46 /* MP Floating Pointer Structure */
47 typedef struct MPFPS {
60 #define MPFB2_IMCR_PRESENT 0x80
61 #define MPFB2_MUL_CLK_SRCS 0x40
63 /* MP Configuration Table Header */
64 typedef struct MPCTH {
66 uint16_t base_table_length;
70 uint8_t product_id[12];
71 uint32_t oem_table_pointer;
72 uint16_t oem_table_size;
74 uint32_t apic_address;
75 uint16_t extended_table_length;
76 uint8_t extended_table_checksum;
80 /* Base table entries */
82 #define MPCT_ENTRY_PROCESSOR 0
83 #define MPCT_ENTRY_BUS 1
84 #define MPCT_ENTRY_IOAPIC 2
85 #define MPCT_ENTRY_INT 3
86 #define MPCT_ENTRY_LOCAL_INT 4
88 typedef struct PROCENTRY {
93 uint32_t cpu_signature;
94 uint32_t feature_flags;
97 } __packed *proc_entry_ptr;
99 #define PROCENTRY_FLAG_EN 0x01
100 #define PROCENTRY_FLAG_BP 0x02
102 typedef struct BUSENTRY {
106 } __packed *bus_entry_ptr;
108 typedef struct IOAPICENTRY {
111 uint8_t apic_version;
113 uint32_t apic_address;
114 } __packed *io_apic_entry_ptr;
116 #define IOAPICENTRY_FLAG_EN 0x01
118 typedef struct INTENTRY {
125 uint8_t dst_apic_int;
126 } __packed *int_entry_ptr;
128 #define INTENTRY_TYPE_INT 0
129 #define INTENTRY_TYPE_NMI 1
130 #define INTENTRY_TYPE_SMI 2
131 #define INTENTRY_TYPE_EXTINT 3
133 #define INTENTRY_FLAGS_POLARITY 0x3
134 #define INTENTRY_FLAGS_POLARITY_CONFORM 0x0
135 #define INTENTRY_FLAGS_POLARITY_ACTIVEHI 0x1
136 #define INTENTRY_FLAGS_POLARITY_ACTIVELO 0x3
137 #define INTENTRY_FLAGS_TRIGGER 0xc
138 #define INTENTRY_FLAGS_TRIGGER_CONFORM 0x0
139 #define INTENTRY_FLAGS_TRIGGER_EDGE 0x4
140 #define INTENTRY_FLAGS_TRIGGER_LEVEL 0xc
142 /* Extended table entries */
144 typedef struct EXTENTRY {
147 } __packed *ext_entry_ptr;
149 #define MPCT_EXTENTRY_SAS 0x80
150 #define MPCT_EXTENTRY_BHD 0x81
151 #define MPCT_EXTENTRY_CBASM 0x82
153 typedef struct SASENTRY {
157 uint8_t address_type;
158 uint64_t address_base;
159 uint64_t address_length;
160 } __packed *sas_entry_ptr;
162 #define SASENTRY_TYPE_IO 0
163 #define SASENTRY_TYPE_MEMORY 1
164 #define SASENTRY_TYPE_PREFETCH 2
166 typedef struct BHDENTRY {
173 } __packed *bhd_entry_ptr;
175 #define BHDENTRY_INFO_SUBTRACTIVE_DECODE 0x1
177 typedef struct CBASMENTRY {
182 uint32_t predefined_range;
183 } __packed *cbasm_entry_ptr;
185 #define CBASMENTRY_ADDRESS_MOD_ADD 0x0
186 #define CBASMENTRY_ADDRESS_MOD_SUBTRACT 0x1
188 #define CBASMENTRY_RANGE_ISA_IO 0
189 #define CBASMENTRY_RANGE_VGA_IO 1
192 struct mptable_hostb_softc {
194 struct pcib_host_resources sc_host_res;
195 int sc_decodes_vga_io;
196 int sc_decodes_isa_io;
201 void mptable_pci_host_res_init(device_t pcib);
203 int mptable_pci_probe_table(int bus);
204 int mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin);
206 #endif /* !__MACHINE_MPTABLE_H__ */