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