1*50d91653Smsaitoh /* $NetBSD: acpidump.h,v 1.7 2017/09/07 04:40:56 msaitoh Exp $ */ 253e202c1Schristos 353e202c1Schristos /*- 453e202c1Schristos * Copyright (c) 1999 Doug Rabson 553e202c1Schristos * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org> 653e202c1Schristos * All rights reserved. 753e202c1Schristos * 853e202c1Schristos * Redistribution and use in source and binary forms, with or without 953e202c1Schristos * modification, are permitted provided that the following conditions 1053e202c1Schristos * are met: 1153e202c1Schristos * 1. Redistributions of source code must retain the above copyright 1253e202c1Schristos * notice, this list of conditions and the following disclaimer. 1353e202c1Schristos * 2. Redistributions in binary form must reproduce the above copyright 1453e202c1Schristos * notice, this list of conditions and the following disclaimer in the 1553e202c1Schristos * documentation and/or other materials provided with the distribution. 1653e202c1Schristos * 1753e202c1Schristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1853e202c1Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1953e202c1Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2053e202c1Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2153e202c1Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2253e202c1Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2353e202c1Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2453e202c1Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2553e202c1Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2653e202c1Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2753e202c1Schristos * SUCH DAMAGE. 2853e202c1Schristos * 29c359a213Smsaitoh * $FreeBSD$ 3053e202c1Schristos */ 3153e202c1Schristos 3253e202c1Schristos #ifndef _ACPIDUMP_H_ 3353e202c1Schristos #define _ACPIDUMP_H_ 3453e202c1Schristos 353b140d48Scegger #include <stdlib.h> /* for size_t */ 363b140d48Scegger #include <acpi_common.h> 373b140d48Scegger #include <dev/acpi/acpica.h> 383b140d48Scegger 393b140d48Scegger /* Subfields in the HPET Id member. */ 403b140d48Scegger #define ACPI_HPET_ID_HARDWARE_REV_ID 0x000000ff 413b140d48Scegger #define ACPI_HPET_ID_COMPARATORS 0x00001f00 423b140d48Scegger #define ACPI_HPET_ID_COUNT_SIZE_CAP 0x00002000 433b140d48Scegger #define ACPI_HPET_ID_LEGACY_CAPABLE 0x00008000 443b140d48Scegger #define ACPI_HPET_ID_PCI_VENDOR_ID 0xffff0000 4553e202c1Schristos 463b140d48Scegger /* Find and map the RSD PTR structure and return it for parsing */ 473b140d48Scegger ACPI_TABLE_HEADER *sdt_load_devmem(void); 4853e202c1Schristos 49c359a213Smsaitoh /* TCPA */ 50c359a213Smsaitoh struct TCPAbody { 51c359a213Smsaitoh ACPI_TABLE_HEADER header; 52c359a213Smsaitoh uint16_t platform_class; 53c359a213Smsaitoh #define ACPI_TCPA_BIOS_CLIENT 0x00 54c359a213Smsaitoh #define ACPI_TCPA_BIOS_SERVER 0x01 55c359a213Smsaitoh union { 56c359a213Smsaitoh struct client_hdr { 57c359a213Smsaitoh uint32_t log_max_len __packed; 58c359a213Smsaitoh uint64_t log_start_addr __packed; 59c359a213Smsaitoh } client; 60c359a213Smsaitoh struct server_hdr { 61c359a213Smsaitoh uint16_t reserved; 62c359a213Smsaitoh uint64_t log_max_len __packed; 63c359a213Smsaitoh uint64_t log_start_addr __packed; 64c359a213Smsaitoh } server; 65c359a213Smsaitoh }; 66c359a213Smsaitoh } __packed; 67c359a213Smsaitoh 68c359a213Smsaitoh struct TCPAevent { 69c359a213Smsaitoh u_int32_t pcr_index; 70c359a213Smsaitoh u_int32_t event_type; 71c359a213Smsaitoh u_int8_t pcr_value[20]; 72c359a213Smsaitoh u_int32_t event_size; 73c359a213Smsaitoh u_int8_t event_data[0]; 74c359a213Smsaitoh }; 75c359a213Smsaitoh 76c359a213Smsaitoh struct TCPApc_event { 77c359a213Smsaitoh u_int32_t event_id; 78c359a213Smsaitoh u_int32_t event_size; 79c359a213Smsaitoh u_int8_t event_data[0]; 80c359a213Smsaitoh }; 81c359a213Smsaitoh 82c359a213Smsaitoh enum TCPAevent_types { 83c359a213Smsaitoh PREBOOT = 0, 84c359a213Smsaitoh POST_CODE, 85c359a213Smsaitoh UNUSED, 86c359a213Smsaitoh NO_ACTION, 87c359a213Smsaitoh SEPARATOR, 88c359a213Smsaitoh ACTION, 89c359a213Smsaitoh EVENT_TAG, 90c359a213Smsaitoh SCRTM_CONTENTS, 91c359a213Smsaitoh SCRTM_VERSION, 92c359a213Smsaitoh CPU_MICROCODE, 93c359a213Smsaitoh PLATFORM_CONFIG_FLAGS, 94c359a213Smsaitoh TABLE_OF_DEVICES, 95c359a213Smsaitoh COMPACT_HASH, 96c359a213Smsaitoh IPL, 97c359a213Smsaitoh IPL_PARTITION_DATA, 98c359a213Smsaitoh NONHOST_CODE, 99c359a213Smsaitoh NONHOST_CONFIG, 100c359a213Smsaitoh NONHOST_INFO, 101c359a213Smsaitoh EVENT_TYPE_MAX, 102c359a213Smsaitoh }; 103c359a213Smsaitoh 104c359a213Smsaitoh enum TCPApcclient_ids { 105c359a213Smsaitoh SMBIOS = 1, 106c359a213Smsaitoh BIS_CERT, 107c359a213Smsaitoh POST_BIOS_ROM, 108c359a213Smsaitoh ESCD, 109c359a213Smsaitoh CMOS, 110c359a213Smsaitoh NVRAM, 111c359a213Smsaitoh OPTION_ROM_EXEC, 112c359a213Smsaitoh OPTION_ROM_CONFIG, 113c359a213Smsaitoh OPTION_ROM_MICROCODE = 10, 114c359a213Smsaitoh S_CRTM_VERSION, 115c359a213Smsaitoh S_CRTM_CONTENTS, 116c359a213Smsaitoh POST_CONTENTS, 117c359a213Smsaitoh HOST_TABLE_OF_DEVICES, 118c359a213Smsaitoh PCCLIENT_ID_MAX, 119c359a213Smsaitoh }; 120c359a213Smsaitoh 12153e202c1Schristos /* 1223b140d48Scegger * Load the DSDT from a previous save file. Note that other tables are 1233b140d48Scegger * not saved (i.e. FADT) 12453e202c1Schristos */ 1253b140d48Scegger ACPI_TABLE_HEADER *dsdt_load_file(char *); 12653e202c1Schristos 1273b140d48Scegger /* Save the DSDT to a file */ 1283b140d48Scegger void dsdt_save_file(char *, ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *); 1293b140d48Scegger 1303b140d48Scegger /* Print out as many fixed tables as possible, given the RSD PTR */ 1313b140d48Scegger void sdt_print_all(ACPI_TABLE_HEADER *); 1323b140d48Scegger 1333b140d48Scegger /* Disassemble the AML in the DSDT */ 1343b140d48Scegger void aml_disassemble(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *); 1353b140d48Scegger 1363b140d48Scegger /* Routines for accessing tables in physical memory */ 1373b140d48Scegger ACPI_TABLE_RSDP *acpi_find_rsd_ptr(void); 13853e202c1Schristos void *acpi_map_physical(vm_offset_t, size_t); 1393b140d48Scegger ACPI_TABLE_HEADER *sdt_from_rsdt(ACPI_TABLE_HEADER *, const char *, 1403b140d48Scegger ACPI_TABLE_HEADER *); 1413b140d48Scegger ACPI_TABLE_HEADER *dsdt_from_fadt(ACPI_TABLE_FADT *); 14253e202c1Schristos int acpi_checksum(void *, size_t); 14353e202c1Schristos 1443b140d48Scegger /* Command line flags */ 145d91f7d52Sjmcneill extern int cflag; 1463b140d48Scegger extern int dflag; 147d34a996fSjmcneill extern int sflag; 1483b140d48Scegger extern int tflag; 1493b140d48Scegger extern int vflag; 15053e202c1Schristos 15153e202c1Schristos #endif /* !_ACPIDUMP_H_ */ 152