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