]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/ncpus/acpidump.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / ncpus / acpidump.h
1 /*-
2  * Copyright (c) 1999 Doug Rabson
3  * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
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
25  * SUCH DAMAGE.
26  *
27  *      $FreeBSD$
28  */
29
30 #ifndef _ACPIDUMP_H_
31 #define _ACPIDUMP_H_
32
33 /* Root System Description Pointer */
34 struct ACPIrsdp {
35         u_char          signature[8];
36         u_char          sum;
37         u_char          oem[6];
38         u_char          revision;
39         u_int32_t       rsdt_addr;
40         u_int32_t       length;
41         u_int64_t       xsdt_addr;
42         u_char          xsum;
43         u_char          _reserved_[3];
44 } __packed;
45
46 /* System Description Table */
47 struct ACPIsdt {
48         u_char          signature[4];
49         u_int32_t       len;
50         u_char          rev;
51         u_char          check;
52         u_char          oemid[6];
53         u_char          oemtblid[8];
54         u_int32_t       oemrev;
55         u_char          creator[4];
56         u_int32_t       crerev;
57 #define SIZEOF_SDT_HDR 36       /* struct size except body */
58         u_int32_t       body[1];/* This member should be casted */
59 } __packed;
60
61 struct MADT_local_apic {
62         u_char          cpu_id;
63         u_char          apic_id;
64         u_int32_t       flags;
65 #define ACPI_MADT_APIC_LOCAL_FLAG_ENABLED       1
66 } __packed;
67
68 struct MADT_io_apic {
69         u_char          apic_id;
70         u_char          reserved;
71         u_int32_t       apic_addr;
72         u_int32_t       int_base;
73 } __packed;
74
75 struct MADT_int_override {
76         u_char          bus;
77         u_char          source;
78         u_int32_t       intr;
79         u_int16_t       mps_flags;
80 #define MPS_INT_FLAG_POLARITY_MASK      0x3
81 #define MPS_INT_FLAG_POLARITY_CONFORM   0x0
82 #define MPS_INT_FLAG_POLARITY_HIGH      0x1
83 #define MPS_INT_FLAG_POLARITY_LOW       0x3
84 #define MPS_INT_FLAG_TRIGGER_MASK       0xc
85 #define MPS_INT_FLAG_TRIGGER_CONFORM    0x0
86 #define MPS_INT_FLAG_TRIGGER_EDGE       0x4
87 #define MPS_INT_FLAG_TRIGGER_LEVEL      0xc
88 } __packed;
89
90 struct MADT_nmi {
91         u_int16_t       mps_flags;
92         u_int32_t       intr;
93 } __packed;
94
95 struct MADT_local_nmi {
96         u_char          cpu_id;
97         u_int16_t       mps_flags;
98         u_char          lintpin;
99 } __packed;
100
101 struct MADT_local_apic_override {
102         u_char          reserved[2];
103         u_int64_t       apic_addr;
104 } __packed;
105
106 struct MADT_io_sapic {
107         u_char          apic_id;
108         u_char          reserved;
109         u_int32_t       int_base;
110         u_int64_t       apic_addr;
111 } __packed;
112
113 struct MADT_local_sapic {
114         u_char          cpu_id;
115         u_char          apic_id;
116         u_char          apic_eid;
117         u_char          reserved[3];
118         u_int32_t       flags;
119 } __packed;
120
121 struct MADT_int_src {
122         u_int16_t       mps_flags;
123         u_char          type;
124 #define ACPI_MADT_APIC_INT_SOURCE_PMI   1
125 #define ACPI_MADT_APIC_INT_SOURCE_INIT  2
126 #define ACPI_MADT_APIC_INT_SOURCE_CPEI  3       /* Corrected Platform Error */
127         u_char          cpu_id;
128         u_char          cpu_eid;
129         u_char          sapic_vector;
130         u_int32_t       intr;
131         u_char          reserved[4];
132 } __packed;
133
134 struct MADT_APIC {
135         u_char          type;
136 #define ACPI_MADT_APIC_TYPE_LOCAL_APIC  0
137 #define ACPI_MADT_APIC_TYPE_IO_APIC     1
138 #define ACPI_MADT_APIC_TYPE_INT_OVERRIDE 2
139 #define ACPI_MADT_APIC_TYPE_NMI         3
140 #define ACPI_MADT_APIC_TYPE_LOCAL_NMI   4
141 #define ACPI_MADT_APIC_TYPE_LOCAL_OVERRIDE 5
142 #define ACPI_MADT_APIC_TYPE_IO_SAPIC    6
143 #define ACPI_MADT_APIC_TYPE_LOCAL_SAPIC 7
144 #define ACPI_MADT_APIC_TYPE_INT_SRC     8
145         u_char          len;
146         union {
147                 struct MADT_local_apic local_apic;
148                 struct MADT_io_apic io_apic;
149                 struct MADT_int_override int_override;
150                 struct MADT_nmi nmi;
151                 struct MADT_local_nmi local_nmi;
152                 struct MADT_local_apic_override local_apic_override;
153                 struct MADT_io_sapic io_sapic;
154                 struct MADT_local_sapic local_sapic;
155                 struct MADT_int_src int_src;
156         } body;
157 } __packed;
158
159 struct MADTbody {
160         u_int32_t       lapic_addr;
161         u_int32_t       flags;
162 #define ACPI_APIC_FLAG_PCAT_COMPAT 1    /* System has dual-8259 setup. */
163         u_char          body[1];
164 } __packed;
165
166 /*
167  * Addresses to scan on ia32 for the RSD PTR.  According to section 5.2.2
168  * of the ACPI spec, we only consider two regions for the base address:
169  * 1. EBDA (1 KB area addressed to by 16 bit pointer at 0x40E)
170  * 2. High memory (0xE0000 - 0xFFFFF)
171  */
172 #define RSDP_EBDA_PTR   0x40E
173 #define RSDP_EBDA_SIZE  0x400
174 #define RSDP_HI_START   0xE0000
175 #define RSDP_HI_SIZE    0x20000
176
177 #endif  /* !_ACPIDUMP_H_ */