├── README.md └── acpiparse.py /README.md: -------------------------------------------------------------------------------- 1 | # acpiparse 2 | 3 | acpiparse is a small utility which understands the format of common 4 | ACPI tables and can print them in a human-readable way. 5 | 6 | This is primarily meant for quickly understanding the ACPI configuration 7 | of a machine and understanding kernel behavior. 8 | 9 | On most Linux systems, you can get the ACPI tables from 10 | `/sys/firmware/acpi/tables`. 11 | 12 | ## Currently supported tables 13 | 14 | * TPM2 15 | * APIC (header only for now) 16 | 17 | ## Coming soon 18 | 19 | * APIC (remaining fields) 20 | * FACP 21 | * FACS 22 | 23 | -------------------------------------------------------------------------------- /acpiparse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import sys 4 | import struct 5 | 6 | def print_header(table): 7 | out = struct.unpack("<4sIBB6sQI4sI", table[0:36]) 8 | 9 | print("%-20s: %s" % ("signature", out[0].decode("ascii"))) 10 | print("%-20s: %s" % ("length", out[1])) 11 | print("%-20s: %s" % ("revision", out[2])) 12 | print("%-20s: %s" % ("checksum", out[3])) 13 | print("%-20s: %s" % ("oem_id", out[4].decode("ascii"))) 14 | print("%-20s: %s" % ("oem_table_id", hex(out[5]))) 15 | print("%-20s: %s" % ("oem_revision", out[6])) 16 | print("%-20s: %s" % ("creator_id", out[7].decode("ascii"))) 17 | print("%-20s: %s" % ("creator_revision", out[8])) 18 | 19 | def print_tpm2(table): 20 | print_header(table) 21 | out = struct.unpack("") 36 | exit(1) 37 | 38 | with open(sys.argv[1], "rb") as f: 39 | table = f.read() 40 | signature = table[0:4].decode("ascii") 41 | print("Parsing ACPI table with signature %s" % (signature)) 42 | if signature == "TPM2": 43 | print_tpm2(table) 44 | elif signature == "APIC": 45 | print_apic(table) 46 | else: 47 | print("Table with signature %s is not supported" % (table)) 48 | 49 | --------------------------------------------------------------------------------