Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/usr.sbin/acpi/acpidump/acpidump.h
105866 views
1
/*-
2
* SPDX-License-Identifier: BSD-2-Clause
3
*
4
* Copyright (c) 1999 Doug Rabson
5
* Copyright (c) 2000 Mitsuru IWASAKI <[email protected]>
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
* 1. Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in the
15
* documentation and/or other materials provided with the distribution.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*/
29
30
#ifndef _ACPIDUMP_H_
31
#define _ACPIDUMP_H_
32
33
#pragma GCC diagnostic push
34
#pragma GCC diagnostic ignored "-Wunused-parameter"
35
#include <contrib/dev/acpica/include/acpi.h>
36
#include <contrib/dev/acpica/include/acconfig.h>
37
#include <contrib/dev/acpica/include/actbl1.h>
38
#pragma GCC diagnostic pop
39
40
/* GAS address space ID constants. */
41
#define ACPI_GAS_MEMORY 0
42
#define ACPI_GAS_IO 1
43
#define ACPI_GAS_PCI 2
44
#define ACPI_GAS_EMBEDDED 3
45
#define ACPI_GAS_SMBUS 4
46
#define ACPI_GAS_CMOS 5
47
#define ACPI_GAS_PCIBAR 6
48
#define ACPI_GAS_DATATABLE 7
49
#define ACPI_GAS_FIXED 0x7f
50
51
/* Subfields in the HPET Id member. */
52
#define ACPI_HPET_ID_HARDWARE_REV_ID 0x000000ff
53
#define ACPI_HPET_ID_COMPARATORS 0x00001f00
54
#define ACPI_HPET_ID_COUNT_SIZE_CAP 0x00002000
55
#define ACPI_HPET_ID_LEGACY_CAPABLE 0x00008000
56
#define ACPI_HPET_ID_PCI_VENDOR_ID 0xffff0000
57
58
/* Find and map the RSD PTR structure and return it for parsing */
59
ACPI_TABLE_HEADER *sdt_load_devmem(void);
60
61
/* TCPA */
62
struct TCPAbody {
63
ACPI_TABLE_HEADER header;
64
uint16_t platform_class;
65
#define ACPI_TCPA_BIOS_CLIENT 0x00
66
#define ACPI_TCPA_BIOS_SERVER 0x01
67
union {
68
struct client_hdr {
69
uint32_t log_max_len __packed;
70
uint64_t log_start_addr __packed;
71
} client;
72
struct server_hdr {
73
uint16_t reserved;
74
uint64_t log_max_len __packed;
75
uint64_t log_start_addr __packed;
76
} server;
77
};
78
} __packed;
79
80
struct TCPAevent {
81
u_int32_t pcr_index;
82
u_int32_t event_type;
83
u_int8_t pcr_value[20];
84
u_int32_t event_size;
85
u_int8_t event_data[0];
86
};
87
88
struct TCPApc_event {
89
u_int32_t event_id;
90
u_int32_t event_size;
91
u_int8_t event_data[0];
92
};
93
94
enum TCPAevent_types {
95
PREBOOT = 0,
96
POST_CODE,
97
UNUSED,
98
NO_ACTION,
99
SEPARATOR,
100
ACTION,
101
EVENT_TAG,
102
SCRTM_CONTENTS,
103
SCRTM_VERSION,
104
CPU_MICROCODE,
105
PLATFORM_CONFIG_FLAGS,
106
TABLE_OF_DEVICES,
107
COMPACT_HASH,
108
IPL,
109
IPL_PARTITION_DATA,
110
NONHOST_CODE,
111
NONHOST_CONFIG,
112
NONHOST_INFO,
113
EVENT_TYPE_MAX,
114
};
115
116
enum TCPApcclient_ids {
117
SMBIOS = 1,
118
BIS_CERT,
119
POST_BIOS_ROM,
120
ESCD,
121
CMOS,
122
NVRAM,
123
OPTION_ROM_EXEC,
124
OPTION_ROM_CONFIG,
125
OPTION_ROM_MICROCODE = 10,
126
S_CRTM_VERSION,
127
S_CRTM_CONTENTS,
128
POST_CONTENTS,
129
HOST_TABLE_OF_DEVICES,
130
PCCLIENT_ID_MAX,
131
};
132
133
/*
134
* Load the DSDT from a previous save file. Note that other tables are
135
* not saved (i.e. FADT)
136
*/
137
ACPI_TABLE_HEADER *dsdt_load_file(char *);
138
139
/* Save the DSDT to a file */
140
void dsdt_save_file(char *, ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
141
142
/* Print out as many fixed tables as possible, given the RSD PTR */
143
void sdt_print_all(ACPI_TABLE_HEADER *, const char *);
144
145
/* Disassemble the AML in the DSDT */
146
void aml_disassemble(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
147
void aml_disassemble_separate(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
148
149
/* Routines for accessing tables in physical memory */
150
ACPI_TABLE_RSDP *acpi_find_rsd_ptr(void);
151
void *acpi_map_physical(vm_offset_t, size_t);
152
ACPI_TABLE_HEADER *sdt_from_rsdt(ACPI_TABLE_HEADER *, const char *,
153
ACPI_TABLE_HEADER *);
154
ACPI_TABLE_HEADER *dsdt_from_fadt(ACPI_TABLE_FADT *);
155
int acpi_checksum(void *, size_t);
156
157
/* Command line flags */
158
extern int dflag;
159
extern int tflag;
160
extern int vflag;
161
162
#endif /* !_ACPIDUMP_H_ */
163
164