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