2 * Copyright (c) 1999 Doug Rabson
3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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
27 * $FreeBSD: src/usr.sbin/acpi/acpidump/acpidump.h,v 1.21 2005/02/17 21:09:26 scottl Exp $
28 * $DragonFly: src/usr.sbin/acpi/acpidump/acpidump.h,v 1.4 2007/01/10 12:23:23 hsu Exp $
34 /* Generic Address structure */
36 u_int8_t address_space_id
;
37 #define ACPI_GAS_MEMORY 0
39 #define ACPI_GAS_PCI 2
40 #define ACPI_GAS_EMBEDDED 3
41 #define ACPI_GAS_SMBUS 4
42 #define ACPI_GAS_FIXED 0x7f
49 /* Root System Description Pointer */
62 /* System Description Table */
73 #define SIZEOF_SDT_HDR 36 /* struct size except body */
74 u_int32_t body
[1];/* This member should be casted */
77 /* Fixed ACPI Description Table (body) */
82 #define ACPI_FADT_INTMODEL_PIC 0 /* Standard PC-AT PIC */
83 #define ACPI_FADT_INTMODEL_APIC 1 /* Multiple APIC */
88 u_int8_t acpi_disable
;
91 u_int32_t pm1a_evt_blk
;
92 u_int32_t pm1b_evt_blk
;
93 u_int32_t pm1a_cnt_blk
;
94 u_int32_t pm1b_cnt_blk
;
95 u_int32_t pm2_cnt_blk
;
100 u_int8_t pm1_cnt_len
;
101 u_int8_t pm2_cnt_len
;
107 u_int16_t p_lvl2_lat
;
108 u_int16_t p_lvl3_lat
;
109 u_int16_t flush_size
;
110 u_int16_t flush_stride
;
116 u_int16_t iapc_boot_arch
;
117 #define FADT_FLAG_LEGACY_DEV 1 /* System has legacy devices */
118 #define FADT_FLAG_8042 2 /* 8042 keyboard controller */
121 #define FADT_FLAG_WBINVD 1 /* WBINVD is correctly supported */
122 #define FADT_FLAG_WBINVD_FLUSH 2 /* WBINVD flushes caches */
123 #define FADT_FLAG_PROC_C1 4 /* C1 power state supported */
124 #define FADT_FLAG_P_LVL2_UP 8 /* C2 power state works on SMP */
125 #define FADT_FLAG_PWR_BUTTON 16 /* Power button uses control method */
126 #define FADT_FLAG_SLP_BUTTON 32 /* Sleep button uses control method */
127 #define FADT_FLAG_FIX_RTC 64 /* RTC wakeup not supported */
128 #define FADT_FLAG_RTC_S4 128 /* RTC can wakeup from S4 state */
129 #define FADT_FLAG_TMR_VAL_EXT 256 /* TMR_VAL is 32bit */
130 #define FADT_FLAG_DCK_CAP 512 /* Can support docking */
131 #define FADT_FLAG_RESET_REG 1024 /* Supports RESET_REG */
132 #define FADT_FLAG_SEALED_CASE 2048 /* Case cannot be opened */
133 #define FADT_FLAG_HEADLESS 4096 /* No monitor */
134 #define FADT_FLAG_CPU_SW_SLP 8192 /* Supports CPU software sleep */
135 struct ACPIgas reset_reg
;
136 u_int8_t reset_value
;
137 u_int8_t reserved5
[3];
138 u_int64_t x_facs_ptr
;
139 u_int64_t x_dsdt_ptr
;
140 struct ACPIgas x_pm1a_evt_blk
;
141 struct ACPIgas x_pm1b_evt_blk
;
142 struct ACPIgas x_pm1a_cnt_blk
;
143 struct ACPIgas x_pm1b_cnt_blk
;
144 struct ACPIgas x_pm2_cnt_blk
;
145 struct ACPIgas x_pm_tmr_blk
;
146 struct ACPIgas x_gpe0_blk
;
147 struct ACPIgas x_gpe1_blk
;
150 /* Firmware ACPI Control Structure */
156 * NOTE This should be filled with physical address below 1MB!!
159 u_int32_t firm_wake_vec
;
160 u_int32_t global_lock
;
161 #define FACS_FLAG_LOCK_PENDING 1 /* 5.2.6.1 Global Lock */
162 #define FACS_FLAG_LOCK_OWNED 2
164 #define FACS_FLAG_S4BIOS_F 1 /* Supports S4BIOS_SEQ */
165 u_int64_t x_firm_wake_vec
;
170 struct MADT_local_apic
{
174 #define ACPI_MADT_APIC_LOCAL_FLAG_ENABLED 1
177 struct MADT_io_apic
{
184 struct MADT_int_override
{
189 #define MPS_INT_FLAG_POLARITY_MASK 0x3
190 #define MPS_INT_FLAG_POLARITY_CONFORM 0x0
191 #define MPS_INT_FLAG_POLARITY_HIGH 0x1
192 #define MPS_INT_FLAG_POLARITY_LOW 0x3
193 #define MPS_INT_FLAG_TRIGGER_MASK 0xc
194 #define MPS_INT_FLAG_TRIGGER_CONFORM 0x0
195 #define MPS_INT_FLAG_TRIGGER_EDGE 0x4
196 #define MPS_INT_FLAG_TRIGGER_LEVEL 0xc
204 struct MADT_local_nmi
{
210 struct MADT_local_apic_override
{
215 struct MADT_io_sapic
{
222 struct MADT_local_sapic
{
230 struct MADT_int_src
{
233 #define ACPI_MADT_APIC_INT_SOURCE_PMI 1
234 #define ACPI_MADT_APIC_INT_SOURCE_INIT 2
235 #define ACPI_MADT_APIC_INT_SOURCE_CPEI 3 /* Corrected Platform Error */
245 #define ACPI_MADT_APIC_TYPE_LOCAL_APIC 0
246 #define ACPI_MADT_APIC_TYPE_IO_APIC 1
247 #define ACPI_MADT_APIC_TYPE_INT_OVERRIDE 2
248 #define ACPI_MADT_APIC_TYPE_NMI 3
249 #define ACPI_MADT_APIC_TYPE_LOCAL_NMI 4
250 #define ACPI_MADT_APIC_TYPE_LOCAL_OVERRIDE 5
251 #define ACPI_MADT_APIC_TYPE_IO_SAPIC 6
252 #define ACPI_MADT_APIC_TYPE_LOCAL_SAPIC 7
253 #define ACPI_MADT_APIC_TYPE_INT_SRC 8
256 struct MADT_local_apic local_apic
;
257 struct MADT_io_apic io_apic
;
258 struct MADT_int_override int_override
;
260 struct MADT_local_nmi local_nmi
;
261 struct MADT_local_apic_override local_apic_override
;
262 struct MADT_io_sapic io_sapic
;
263 struct MADT_local_sapic local_sapic
;
264 struct MADT_int_src int_src
;
269 u_int32_t lapic_addr
;
271 #define ACPI_APIC_FLAG_PCAT_COMPAT 1 /* System has dual-8259 setup. */
276 u_int32_t block_hwrev
:8,
278 block_counter_size
:1,
280 block_legacy_capable
:1,
284 u_int8_t hpet_number
;
285 u_int16_t clock_tick __packed
;
288 /* Embedded Controller Description Table */
290 struct ACPIgas ec_control
; /* Control register */
291 struct ACPIgas ec_data
; /* Data register */
292 uint32_t uid
; /* Same value as _UID in namespace */
293 uint8_t gpe_bit
; /* GPE bit for the EC */
294 u_char ec_id
[1]; /* Variable length name string */
297 /* Memory Mapped PCI config space base allocation structure */
301 uint64_t baseaddr
; /* Base Address */
302 uint16_t seg_grp
; /* Segment group number */
303 uint8_t start
; /* Starting bus number */
304 uint8_t end
; /* Ending bus number */
305 uint8_t rsvd
[4]; /* Reserved */
310 * Addresses to scan on ia32 for the RSD PTR. According to section 5.2.2
311 * of the ACPI spec, we only consider two regions for the base address:
312 * 1. EBDA (1 KB area addressed to by 16 bit pointer at 0x40E)
313 * 2. High memory (0xE0000 - 0xFFFFF)
315 #define RSDP_EBDA_PTR 0x40E
316 #define RSDP_EBDA_SIZE 0x400
317 #define RSDP_HI_START 0xE0000
318 #define RSDP_HI_SIZE 0x20000
320 /* Find and map the RSD PTR structure and return it for parsing */
321 struct ACPIsdt
*sdt_load_devmem(void);
324 * Load the DSDT from a previous save file. Note that other tables are
325 * not saved (i.e. FADT)
327 struct ACPIsdt
*dsdt_load_file(char *);
329 /* Save the DSDT to a file */
330 void dsdt_save_file(char *, struct ACPIsdt
*, struct ACPIsdt
*);
332 /* Print out as many fixed tables as possible, given the RSD PTR */
333 void sdt_print_all(struct ACPIsdt
*);
335 /* Disassemble the AML in the DSDT */
336 void aml_disassemble(struct ACPIsdt
*, struct ACPIsdt
*);
338 /* Routines for accessing tables in physical memory */
339 struct ACPIrsdp
*acpi_find_rsd_ptr(void);
340 void *acpi_map_physical(vm_offset_t
, size_t);
341 struct ACPIsdt
*sdt_from_rsdt(struct ACPIsdt
*, const char *,
343 struct ACPIsdt
*dsdt_from_fadt(struct FADTbody
*);
344 int acpi_checksum(void *, size_t);
346 /* Command line flags */
351 #endif /* !_ACPIDUMP_H_ */