acpidump.h revision 1.6 1 1.6 msaitoh /* $NetBSD: acpidump.h,v 1.6 2017/08/04 06:30:36 msaitoh 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.6 msaitoh * $FreeBSD$
30 1.1 christos */
31 1.1 christos
32 1.1 christos #ifndef _ACPIDUMP_H_
33 1.2 cegger #define _ACPIDUMP_H_
34 1.1 christos
35 1.2 cegger #include <stdlib.h> /* for size_t */
36 1.2 cegger #include <acpi_common.h>
37 1.2 cegger #include <dev/acpi/acpica.h>
38 1.2 cegger
39 1.2 cegger /* GAS address space ID constants. */
40 1.2 cegger #define ACPI_GAS_MEMORY 0
41 1.2 cegger #define ACPI_GAS_IO 1
42 1.2 cegger #define ACPI_GAS_PCI 2
43 1.2 cegger #define ACPI_GAS_EMBEDDED 3
44 1.2 cegger #define ACPI_GAS_SMBUS 4
45 1.2 cegger #define ACPI_GAS_CMOS 5
46 1.2 cegger #define ACPI_GAS_PCIBAR 6
47 1.2 cegger #define ACPI_GAS_DATATABLE 7
48 1.2 cegger #define ACPI_GAS_FIXED 0x7f
49 1.2 cegger
50 1.2 cegger /* Subfields in the HPET Id member. */
51 1.2 cegger #define ACPI_HPET_ID_HARDWARE_REV_ID 0x000000ff
52 1.2 cegger #define ACPI_HPET_ID_COMPARATORS 0x00001f00
53 1.2 cegger #define ACPI_HPET_ID_COUNT_SIZE_CAP 0x00002000
54 1.2 cegger #define ACPI_HPET_ID_LEGACY_CAPABLE 0x00008000
55 1.2 cegger #define ACPI_HPET_ID_PCI_VENDOR_ID 0xffff0000
56 1.2 cegger
57 1.2 cegger /* Find and map the RSD PTR structure and return it for parsing */
58 1.2 cegger ACPI_TABLE_HEADER *sdt_load_devmem(void);
59 1.2 cegger
60 1.6 msaitoh /* TCPA */
61 1.6 msaitoh struct TCPAbody {
62 1.6 msaitoh ACPI_TABLE_HEADER header;
63 1.6 msaitoh uint16_t platform_class;
64 1.6 msaitoh #define ACPI_TCPA_BIOS_CLIENT 0x00
65 1.6 msaitoh #define ACPI_TCPA_BIOS_SERVER 0x01
66 1.6 msaitoh union {
67 1.6 msaitoh struct client_hdr {
68 1.6 msaitoh uint32_t log_max_len __packed;
69 1.6 msaitoh uint64_t log_start_addr __packed;
70 1.6 msaitoh } client;
71 1.6 msaitoh struct server_hdr {
72 1.6 msaitoh uint16_t reserved;
73 1.6 msaitoh uint64_t log_max_len __packed;
74 1.6 msaitoh uint64_t log_start_addr __packed;
75 1.6 msaitoh } server;
76 1.6 msaitoh };
77 1.6 msaitoh } __packed;
78 1.6 msaitoh
79 1.6 msaitoh struct TCPAevent {
80 1.6 msaitoh u_int32_t pcr_index;
81 1.6 msaitoh u_int32_t event_type;
82 1.6 msaitoh u_int8_t pcr_value[20];
83 1.6 msaitoh u_int32_t event_size;
84 1.6 msaitoh u_int8_t event_data[0];
85 1.6 msaitoh };
86 1.6 msaitoh
87 1.6 msaitoh struct TCPApc_event {
88 1.6 msaitoh u_int32_t event_id;
89 1.6 msaitoh u_int32_t event_size;
90 1.6 msaitoh u_int8_t event_data[0];
91 1.6 msaitoh };
92 1.6 msaitoh
93 1.6 msaitoh enum TCPAevent_types {
94 1.6 msaitoh PREBOOT = 0,
95 1.6 msaitoh POST_CODE,
96 1.6 msaitoh UNUSED,
97 1.6 msaitoh NO_ACTION,
98 1.6 msaitoh SEPARATOR,
99 1.6 msaitoh ACTION,
100 1.6 msaitoh EVENT_TAG,
101 1.6 msaitoh SCRTM_CONTENTS,
102 1.6 msaitoh SCRTM_VERSION,
103 1.6 msaitoh CPU_MICROCODE,
104 1.6 msaitoh PLATFORM_CONFIG_FLAGS,
105 1.6 msaitoh TABLE_OF_DEVICES,
106 1.6 msaitoh COMPACT_HASH,
107 1.6 msaitoh IPL,
108 1.6 msaitoh IPL_PARTITION_DATA,
109 1.6 msaitoh NONHOST_CODE,
110 1.6 msaitoh NONHOST_CONFIG,
111 1.6 msaitoh NONHOST_INFO,
112 1.6 msaitoh EVENT_TYPE_MAX,
113 1.6 msaitoh };
114 1.6 msaitoh
115 1.6 msaitoh enum TCPApcclient_ids {
116 1.6 msaitoh SMBIOS = 1,
117 1.6 msaitoh BIS_CERT,
118 1.6 msaitoh POST_BIOS_ROM,
119 1.6 msaitoh ESCD,
120 1.6 msaitoh CMOS,
121 1.6 msaitoh NVRAM,
122 1.6 msaitoh OPTION_ROM_EXEC,
123 1.6 msaitoh OPTION_ROM_CONFIG,
124 1.6 msaitoh OPTION_ROM_MICROCODE = 10,
125 1.6 msaitoh S_CRTM_VERSION,
126 1.6 msaitoh S_CRTM_CONTENTS,
127 1.6 msaitoh POST_CONTENTS,
128 1.6 msaitoh HOST_TABLE_OF_DEVICES,
129 1.6 msaitoh PCCLIENT_ID_MAX,
130 1.6 msaitoh };
131 1.6 msaitoh
132 1.2 cegger /*
133 1.2 cegger * Load the DSDT from a previous save file. Note that other tables are
134 1.2 cegger * not saved (i.e. FADT)
135 1.2 cegger */
136 1.2 cegger ACPI_TABLE_HEADER *dsdt_load_file(char *);
137 1.2 cegger
138 1.2 cegger /* Save the DSDT to a file */
139 1.2 cegger void dsdt_save_file(char *, ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
140 1.2 cegger
141 1.2 cegger /* Print out as many fixed tables as possible, given the RSD PTR */
142 1.2 cegger void sdt_print_all(ACPI_TABLE_HEADER *);
143 1.2 cegger
144 1.2 cegger /* Disassemble the AML in the DSDT */
145 1.2 cegger void aml_disassemble(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
146 1.2 cegger
147 1.2 cegger /* Routines for accessing tables in physical memory */
148 1.2 cegger ACPI_TABLE_RSDP *acpi_find_rsd_ptr(void);
149 1.2 cegger void *acpi_map_physical(vm_offset_t, size_t);
150 1.2 cegger ACPI_TABLE_HEADER *sdt_from_rsdt(ACPI_TABLE_HEADER *, const char *,
151 1.2 cegger ACPI_TABLE_HEADER *);
152 1.2 cegger ACPI_TABLE_HEADER *dsdt_from_fadt(ACPI_TABLE_FADT *);
153 1.2 cegger int acpi_checksum(void *, size_t);
154 1.2 cegger
155 1.2 cegger /* Command line flags */
156 1.3 jmcneill extern int cflag;
157 1.2 cegger extern int dflag;
158 1.4 jmcneill extern int sflag;
159 1.2 cegger extern int tflag;
160 1.2 cegger extern int vflag;
161 1.1 christos
162 1.1 christos #endif /* !_ACPIDUMP_H_ */
163