2/16/2025

ACPI application with EfiPy2

Introduction

AcpiAnalyze.pyAcpiRetrieve.pyAcpiTableList.py

These three applications can run on Windows, Linux and UEFI shell.

AcpiRetrieve.py

Retrieve all ACPI tables in current host and save to file with Acpi_XXXX.dat.

The output for example

$ ls -l

total 88

-rw-r--r-- 1 root root   114  二   8 10:52  Acpi_APIC.dat

-rw-r--r-- 1 root root   165  二   8 10:52 'Acpi_ASF!.dat'

-rw-r--r-- 1 root root   176  二   8 10:52  Acpi_DMAR.dat

-rw-r--r-- 1 root root 39858  二   8 10:52  Acpi_DSDT.dat

-rw-r--r-- 1 root root   244  二   8 10:52  Acpi_FACP.dat

-rw-r--r-- 1 root root    64  二   8 10:52  Acpi_FACS.dat

-rw-r--r-- 1 root root    56  二   8 10:52  Acpi_HPET.dat

-rw-r--r-- 1 root root    60  二   8 10:52  Acpi_MCFG.dat

-rw-r--r-- 1 root root    36  二   8 10:52  Acpi_RSDP.dat

-rw-r--r-- 1 root root  2474  二   8 10:52  Acpi_SSDT1.dat

-rw-r--r-- 1 root root  2706  二   8 10:52  Acpi_SSDT2.dat

-rw-r--r-- 1 root root   877  二   8 10:52  Acpi_SSDT.dat

-rw-r--r-- 1 root root   108  二   8 10:52  Acpi_XSDT.dat

$

AcpiTableList.py

$ AcpiTableList.py' -h
usage: AcpiTableList.py [-h] [-t TABLE] [-v]

options:
  -h, --help            show this help message and exit
  -t TABLE, --table TABLE
                        Check if specified ACPI table exist.
  -v, --verbose         List table in verbose.
$

AcpiAnalyze.py

$ AcpiAnalyze.py -h
usage: AcpiAnalyze.py [-h] [-r] [-d] {file,table} ...

positional arguments:
  {file,table}  Analyze ACPI command
    file        parse ACPI file (Windows, Linux, UEFI Shell)
    table       parse ACPI in host (Windows, Linux, UEFI Shell)

options:
  -h, --help    show this help message and exit
  -r, --raw     Dump ACPI raw data.
  -d, --dummy   Analyze ACPI table dummy.
$

Exanple output for analyzing ACPI APIC in current host on Windows
AcpiAnalyze.py' '--raw' 'table' '-t' 'APIC'
Analyze signature b'APIC'
ExtractType: b'APIC', 0
==== ACPI b'APIC' ======
  Header                                                         Struct EFI_ACPI_DESCRIPTION_HEADER
    Signature                                                      0x43495041
    Length                                                         0x0000012C
    Revision                                                       0x04
    Checksum                                                       0x3B
    OemId[0]                                                       0x41 'A'
    OemId[1]                                                       0x43 'C'
    OemId[2]                                                       0x52 'R'
    OemId[3]                                                       0x53 'S'
    OemId[4]                                                       0x59 'Y'
    OemId[5]                                                       0x53 'S'
    OemTableId                                             0x5443445250524341
    OemRevision                                                    0x00000002
    CreatorId                                                      0x35323031
    CreatorRevision                                                0x00040000
  LocalApicAddress                                               0xFEE00000
  Flags                                                          0x00000001
  ProcessorLocalApic_00                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x00
    ApicId                                                         0x00
    Flags                                                          0x00000001
  ProcessorLocalApic_01                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x01
    ApicId                                                         0x02
    Flags                                                          0x00000001
  ProcessorLocalApic_02                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x02
    ApicId                                                         0x04
    Flags                                                          0x00000001
  ProcessorLocalApic_03                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x03
    ApicId                                                         0x06
    Flags                                                          0x00000001
  ProcessorLocalApic_04                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x04
    ApicId                                                         0x01
    Flags                                                          0x00000001
  ProcessorLocalApic_05                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x05
    ApicId                                                         0x03
    Flags                                                          0x00000001
  ProcessorLocalApic_06                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x06
    ApicId                                                         0x05
    Flags                                                          0x00000001
  ProcessorLocalApic_07                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x07
    ApicId                                                         0x07
    Flags                                                          0x00000001
  ProcessorLocalApic_08                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x08
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_09                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x09
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0A                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0A
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0B                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0B
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0C                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0C
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0D                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0D
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0E                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0E
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  ProcessorLocalApic_0F                                          Struct EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE
    Type                                                           0x00
    Length                                                         0x08
    AcpiProcessorUid                                               0x0F
    ApicId                                                         0xFF
    Flags                                                          0x00000000
  IoApic_00                                                      Struct EFI_ACPI_2_0_IO_APIC_STRUCTURE
    Type                                                           0x01
    Length                                                         0x0C
    IoApicId                                                       0x02
    Reserved                                                       0x00
    IoApicAddress                                                  0xFEC00000
    GlobalSystemInterruptBase                                      0x00000000
  InterruptSourceOverride_00                                     Struct EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE
    Type                                                           0x02
    Length                                                         0x0A
    Bus                                                            0x00
    Source                                                         0x00
    GlobalSystemInterrupt                                          0x00000002
    Flags                                                          0x0000
  InterruptSourceOverride_01                                     Struct EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE
    Type                                                           0x02
    Length                                                         0x0A
    Bus                                                            0x00
    Source                                                         0x09
    GlobalSystemInterrupt                                          0x00000009
    Flags                                                          0x000D
  LocalApicNmi_00                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x01
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_01                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x02
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_02                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x03
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_03                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x04
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_04                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x05
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_05                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x06
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_06                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x07
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_07                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x08
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_08                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x09
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_09                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0A
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0A                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0B
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0B                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0C
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0C                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0D
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0D                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0E
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0E                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x0F
    Flags                                                          0x0005
    LocalApicLint                                                  0x01
  LocalApicNmi_0F                                                Struct EFI_ACPI_6_5_LOCAL_APIC_NMI_STRUCTURE
    Type                                                           0x04
    Length                                                         0x06
    AcpiProcessorUid                                               0x10
    Flags                                                          0x0005
    LocalApicLint                                                  0x01

==== ACPI RAW data ======
            0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F  01234567 89ABCDEF
------------------------------------------------------------------------------
00000000   41 50 49 43 2C 01 00 00  04 3B 41 43 52 53 59 53  APIC,... .;ACRSYS
00000010   41 43 52 50 52 44 43 54  02 00 00 00 31 30 32 35  ACRPRDCT ....1025
00000020   00 00 04 00 00 00 E0 FE  01 00 00 00 00 08 00 00  ........ ........
00000030   01 00 00 00 00 08 01 02  01 00 00 00 00 08 02 04  ........ ........
00000040   01 00 00 00 00 08 03 06  01 00 00 00 00 08 04 01  ........ ........
00000050   01 00 00 00 00 08 05 03  01 00 00 00 00 08 06 05  ........ ........
00000060   01 00 00 00 00 08 07 07  01 00 00 00 00 08 08 FF  ........ ........
00000070   00 00 00 00 00 08 09 FF  00 00 00 00 00 08 0A FF  ........ ........
00000080   00 00 00 00 00 08 0B FF  00 00 00 00 00 08 0C FF  ........ ........
00000090   00 00 00 00 00 08 0D FF  00 00 00 00 00 08 0E FF  ........ ........
000000A0   00 00 00 00 00 08 0F FF  00 00 00 00 01 0C 02 00  ........ ........
000000B0   00 00 C0 FE 00 00 00 00  02 0A 00 00 02 00 00 00  ........ ........
000000C0   00 00 02 0A 00 09 09 00  00 00 0D 00 04 06 01 05  ........ ........
000000D0   00 01 04 06 02 05 00 01  04 06 03 05 00 01 04 06  ........ ........
000000E0   04 05 00 01 04 06 05 05  00 01 04 06 06 05 00 01  ........ ........
000000F0   04 06 07 05 00 01 04 06  08 05 00 01 04 06 09 05  ........ ........
00000100   00 01 04 06 0A 05 00 01  04 06 0B 05 00 01 04 06  ........ ........
00000110   0C 05 00 01 04 06 0D 05  00 01 04 06 0E 05 00 01  ........ ........
00000120   04 06 0F 05 00 01 04 06  10 05 00 01              ........ ....

No comments:

Post a Comment