Path: blob/main/usr.sbin/acpi/acpidump/acpidump.h
105866 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 1999 Doug Rabson4* Copyright (c) 2000 Mitsuru IWASAKI <[email protected]>5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _ACPIDUMP_H_30#define _ACPIDUMP_H_3132#pragma GCC diagnostic push33#pragma GCC diagnostic ignored "-Wunused-parameter"34#include <contrib/dev/acpica/include/acpi.h>35#include <contrib/dev/acpica/include/acconfig.h>36#include <contrib/dev/acpica/include/actbl1.h>37#pragma GCC diagnostic pop3839/* GAS address space ID constants. */40#define ACPI_GAS_MEMORY 041#define ACPI_GAS_IO 142#define ACPI_GAS_PCI 243#define ACPI_GAS_EMBEDDED 344#define ACPI_GAS_SMBUS 445#define ACPI_GAS_CMOS 546#define ACPI_GAS_PCIBAR 647#define ACPI_GAS_DATATABLE 748#define ACPI_GAS_FIXED 0x7f4950/* Subfields in the HPET Id member. */51#define ACPI_HPET_ID_HARDWARE_REV_ID 0x000000ff52#define ACPI_HPET_ID_COMPARATORS 0x00001f0053#define ACPI_HPET_ID_COUNT_SIZE_CAP 0x0000200054#define ACPI_HPET_ID_LEGACY_CAPABLE 0x0000800055#define ACPI_HPET_ID_PCI_VENDOR_ID 0xffff00005657/* Find and map the RSD PTR structure and return it for parsing */58ACPI_TABLE_HEADER *sdt_load_devmem(void);5960/* TCPA */61struct TCPAbody {62ACPI_TABLE_HEADER header;63uint16_t platform_class;64#define ACPI_TCPA_BIOS_CLIENT 0x0065#define ACPI_TCPA_BIOS_SERVER 0x0166union {67struct client_hdr {68uint32_t log_max_len __packed;69uint64_t log_start_addr __packed;70} client;71struct server_hdr {72uint16_t reserved;73uint64_t log_max_len __packed;74uint64_t log_start_addr __packed;75} server;76};77} __packed;7879struct TCPAevent {80u_int32_t pcr_index;81u_int32_t event_type;82u_int8_t pcr_value[20];83u_int32_t event_size;84u_int8_t event_data[0];85};8687struct TCPApc_event {88u_int32_t event_id;89u_int32_t event_size;90u_int8_t event_data[0];91};9293enum TCPAevent_types {94PREBOOT = 0,95POST_CODE,96UNUSED,97NO_ACTION,98SEPARATOR,99ACTION,100EVENT_TAG,101SCRTM_CONTENTS,102SCRTM_VERSION,103CPU_MICROCODE,104PLATFORM_CONFIG_FLAGS,105TABLE_OF_DEVICES,106COMPACT_HASH,107IPL,108IPL_PARTITION_DATA,109NONHOST_CODE,110NONHOST_CONFIG,111NONHOST_INFO,112EVENT_TYPE_MAX,113};114115enum TCPApcclient_ids {116SMBIOS = 1,117BIS_CERT,118POST_BIOS_ROM,119ESCD,120CMOS,121NVRAM,122OPTION_ROM_EXEC,123OPTION_ROM_CONFIG,124OPTION_ROM_MICROCODE = 10,125S_CRTM_VERSION,126S_CRTM_CONTENTS,127POST_CONTENTS,128HOST_TABLE_OF_DEVICES,129PCCLIENT_ID_MAX,130};131132/*133* Load the DSDT from a previous save file. Note that other tables are134* not saved (i.e. FADT)135*/136ACPI_TABLE_HEADER *dsdt_load_file(char *);137138/* Save the DSDT to a file */139void dsdt_save_file(char *, ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);140141/* Print out as many fixed tables as possible, given the RSD PTR */142void sdt_print_all(ACPI_TABLE_HEADER *, const char *);143144/* Disassemble the AML in the DSDT */145void aml_disassemble(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);146void aml_disassemble_separate(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);147148/* Routines for accessing tables in physical memory */149ACPI_TABLE_RSDP *acpi_find_rsd_ptr(void);150void *acpi_map_physical(vm_offset_t, size_t);151ACPI_TABLE_HEADER *sdt_from_rsdt(ACPI_TABLE_HEADER *, const char *,152ACPI_TABLE_HEADER *);153ACPI_TABLE_HEADER *dsdt_from_fadt(ACPI_TABLE_FADT *);154int acpi_checksum(void *, size_t);155156/* Command line flags */157extern int dflag;158extern int tflag;159extern int vflag;160161#endif /* !_ACPIDUMP_H_ */162163164