acpidump.h revision 1.1 1 1.1 christos /* $NetBSD: acpidump.h,v 1.1 2007/01/14 04:36:13 christos Exp $ */
2 1.1 christos
3 1.1 christos /*-
4 1.1 christos * Copyright (c) 1999 Doug Rabson
5 1.1 christos * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki (at) FreeBSD.org>
6 1.1 christos * All rights reserved.
7 1.1 christos *
8 1.1 christos * Redistribution and use in source and binary forms, with or without
9 1.1 christos * modification, are permitted provided that the following conditions
10 1.1 christos * are met:
11 1.1 christos * 1. Redistributions of source code must retain the above copyright
12 1.1 christos * notice, this list of conditions and the following disclaimer.
13 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 christos * notice, this list of conditions and the following disclaimer in the
15 1.1 christos * documentation and/or other materials provided with the distribution.
16 1.1 christos *
17 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 1.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 1.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 1.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 1.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 1.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 1.1 christos * SUCH DAMAGE.
28 1.1 christos *
29 1.1 christos * Id: acpidump.h,v 1.3 2000/08/09 14:47:52 iwasaki Exp
30 1.1 christos * $FreeBSD: src/usr.sbin/acpi/acpidump/acpidump.h,v 1.5 2002/10/09 19:46:09 jhb Exp $
31 1.1 christos */
32 1.1 christos
33 1.1 christos #ifndef _ACPIDUMP_H_
34 1.1 christos #define _ACPIDUMP_H_
35 1.1 christos
36 1.1 christos /* Generic Address structure */
37 1.1 christos struct ACPIgas {
38 1.1 christos u_int8_t address_space_id;
39 1.1 christos #define ACPI_GAS_MEMORY 0
40 1.1 christos #define ACPI_GAS_IO 1
41 1.1 christos #define ACPI_GAS_PCI 2
42 1.1 christos #define ACPI_GAS_EMBEDDED 3
43 1.1 christos #define ACPI_GAS_SMBUS 4
44 1.1 christos #define ACPI_GAS_FIXED 0x7f
45 1.1 christos u_int8_t register_bit_width;
46 1.1 christos u_int8_t register_bit_offset;
47 1.1 christos u_int8_t res;
48 1.1 christos u_int64_t address;
49 1.1 christos } __packed;
50 1.1 christos
51 1.1 christos /* Root System Description Pointer */
52 1.1 christos struct ACPIrsdp {
53 1.1 christos u_char signature[8];
54 1.1 christos u_char sum;
55 1.1 christos u_char oem[6];
56 1.1 christos u_char res;
57 1.1 christos u_int32_t addr;
58 1.1 christos } __packed;
59 1.1 christos
60 1.1 christos /* System Description Table */
61 1.1 christos struct ACPIsdt {
62 1.1 christos u_char signature[4];
63 1.1 christos u_int32_t len;
64 1.1 christos u_char rev;
65 1.1 christos u_char check;
66 1.1 christos u_char oemid[6];
67 1.1 christos u_char oemtblid[8];
68 1.1 christos u_int32_t oemrev;
69 1.1 christos u_char creator[4];
70 1.1 christos u_int32_t crerev;
71 1.1 christos #define SIZEOF_SDT_HDR 36 /* struct size except body */
72 1.1 christos u_int32_t body[1];/* This member should be casted */
73 1.1 christos } __packed;
74 1.1 christos
75 1.1 christos /* Fixed ACPI Description Table (body) */
76 1.1 christos struct FACPbody {
77 1.1 christos u_int32_t facs_ptr;
78 1.1 christos u_int32_t dsdt_ptr;
79 1.1 christos u_int8_t int_model;
80 1.1 christos #define ACPI_FACP_INTMODEL_PIC 0 /* Standard PC-AT PIC */
81 1.1 christos #define ACPI_FACP_INTMODEL_APIC 1 /* Multiple APIC */
82 1.1 christos u_char reserved1;
83 1.1 christos u_int16_t sci_int;
84 1.1 christos u_int32_t smi_cmd;
85 1.1 christos u_int8_t acpi_enable;
86 1.1 christos u_int8_t acpi_disable;
87 1.1 christos u_int8_t s4biosreq;
88 1.1 christos u_int8_t reserved2;
89 1.1 christos u_int32_t pm1a_evt_blk;
90 1.1 christos u_int32_t pm1b_evt_blk;
91 1.1 christos u_int32_t pm1a_cnt_blk;
92 1.1 christos u_int32_t pm1b_cnt_blk;
93 1.1 christos u_int32_t pm2_cnt_blk;
94 1.1 christos u_int32_t pm_tmr_blk;
95 1.1 christos u_int32_t gpe0_blk;
96 1.1 christos u_int32_t gpe1_blk;
97 1.1 christos u_int8_t pm1_evt_len;
98 1.1 christos u_int8_t pm1_cnt_len;
99 1.1 christos u_int8_t pm2_cnt_len;
100 1.1 christos u_int8_t pm_tmr_len;
101 1.1 christos u_int8_t gpe0_len;
102 1.1 christos u_int8_t gpe1_len;
103 1.1 christos u_int8_t gpe1_base;
104 1.1 christos u_int8_t reserved3;
105 1.1 christos u_int16_t p_lvl2_lat;
106 1.1 christos u_int16_t p_lvl3_lat;
107 1.1 christos u_int16_t flush_size;
108 1.1 christos u_int16_t flush_stride;
109 1.1 christos u_int8_t duty_off;
110 1.1 christos u_int8_t duty_width;
111 1.1 christos u_int8_t day_alrm;
112 1.1 christos u_int8_t mon_alrm;
113 1.1 christos u_int8_t century;
114 1.1 christos u_int16_t iapc_boot_arch;
115 1.1 christos u_char reserved4[1];
116 1.1 christos u_int32_t flags;
117 1.1 christos #define ACPI_FACP_FLAG_WBINVD 1 /* WBINVD is correctly supported */
118 1.1 christos #define ACPI_FACP_FLAG_WBINVD_FLUSH 2 /* WBINVD flushes caches */
119 1.1 christos #define ACPI_FACP_FLAG_PROC_C1 4 /* C1 power state supported */
120 1.1 christos #define ACPI_FACP_FLAG_P_LVL2_UP 8 /* C2 power state works on SMP */
121 1.1 christos #define ACPI_FACP_FLAG_PWR_BUTTON 16 /* Power button uses control method */
122 1.1 christos #define ACPI_FACP_FLAG_SLP_BUTTON 32 /* Sleep button uses control method */
123 1.1 christos #define ACPI_FACP_FLAG_FIX_RTC 64 /* RTC wakeup not supported */
124 1.1 christos #define ACPI_FACP_FLAG_RTC_S4 128 /* RTC can wakeup from S4 state */
125 1.1 christos #define ACPI_FACP_FLAG_TMR_VAL_EXT 256 /* TMR_VAL is 32bit */
126 1.1 christos #define ACPI_FACP_FLAG_DCK_CAP 512 /* Can support docking */
127 1.1 christos struct ACPIgas reset_reg;
128 1.1 christos u_int8_t reset_value;
129 1.1 christos u_int8_t reserved5[3];
130 1.1 christos u_int64_t x_firmware_ctrl;
131 1.1 christos u_int64_t x_dsdt;
132 1.1 christos struct ACPIgas x_pm1a_evt_blk;
133 1.1 christos struct ACPIgas x_pm1b_evt_blk;
134 1.1 christos struct ACPIgas x_pm1a_cnt_blk;
135 1.1 christos struct ACPIgas x_pm1b_cnt_blk;
136 1.1 christos struct ACPIgas x_pm2_cnt_blk;
137 1.1 christos struct ACPIgas x_pm_tmr_blk;
138 1.1 christos struct ACPIgas x_gpe0_blk;
139 1.1 christos struct ACPIgas x_gpe1_blk;
140 1.1 christos } __packed;
141 1.1 christos
142 1.1 christos /* Firmware ACPI Control Structure */
143 1.1 christos struct FACS {
144 1.1 christos u_char signature[4];
145 1.1 christos u_int32_t len;
146 1.1 christos u_char hard_sig[4];
147 1.1 christos /*
148 1.1 christos * NOTE This should be filled with physical address below 1MB!!
149 1.1 christos * sigh....
150 1.1 christos */
151 1.1 christos u_int32_t firm_wake_vec;
152 1.1 christos u_int32_t g_lock; /* bit field */
153 1.1 christos /* 5.2.6.1 Global Lock */
154 1.1 christos #define ACPI_GLOBAL_LOCK_PENDING 1
155 1.1 christos #define ACPI_GLOBAL_LOCK_OWNED 2
156 1.1 christos u_int32_t flags; /* bit field */
157 1.1 christos #define ACPI_FACS_FLAG_S4BIOS_F 1 /* Supports S4BIOS_SEQ */
158 1.1 christos char reserved[40];
159 1.1 christos } __packed;
160 1.1 christos
161 1.1 christos void *acpi_map_physical(vm_offset_t, size_t);
162 1.1 christos struct ACPIrsdp *acpi_find_rsd_ptr(void);
163 1.1 christos int acpi_checksum(void *, size_t);
164 1.1 christos struct ACPIsdt *acpi_map_sdt(vm_offset_t);
165 1.1 christos void acpi_print_rsd_ptr(struct ACPIrsdp *);
166 1.1 christos void acpi_print_sdt(struct ACPIsdt *);
167 1.1 christos void acpi_print_rsdt(struct ACPIsdt *);
168 1.1 christos void acpi_print_facp(struct FACPbody *);
169 1.1 christos void acpi_print_dsdt(struct ACPIsdt *);
170 1.1 christos
171 1.1 christos void asl_dump_termobj(u_int8_t **, int);
172 1.1 christos void asl_dump_objectlist(u_int8_t **, u_int8_t *, int);
173 1.1 christos
174 1.1 christos void aml_dump(struct ACPIsdt *);
175 1.1 christos
176 1.1 christos void acpi_handle_rsdt(struct ACPIsdt *);
177 1.1 christos void acpi_load_dsdt(char *, u_int8_t **, u_int8_t **);
178 1.1 christos void acpi_dump_dsdt(u_int8_t *, u_int8_t *);
179 1.1 christos extern char *aml_dumpfile;
180 1.1 christos extern struct ACPIsdt dsdt_header;
181 1.1 christos extern int rflag;
182 1.1 christos
183 1.1 christos #endif /* !_ACPIDUMP_H_ */
184