Open vieyahn2017 opened 8 months ago
基本概念
参考资料
下载开源acpi工具
git clone https://github.com/acpica/acpica.git
编译
ll bin total 2772 -rwxr-xr-x 1 55416 Apr 26 20:17 acpibin -rwxr-xr-x 1 65456 Apr 26 20:17 acpidump -rwxr-xr-x 1 257504 Apr 26 20:17 acpiexamples -rwxr-xr-x 1 675424 Apr 26 20:18 acpiexec -rwxr-xr-x 1 144856 Apr 26 20:18 acpihelp -rwxr-xr-x 1 280968 Apr 26 20:18 acpinames -rwxr-xr-x 1 97184 Apr 26 20:18 acpisrc -rwxr-xr-x 1 45640 Apr 26 20:18 acpi
acpidump -o ACPI_table.out 【 输出到文件 】 acpixtract -a ACPI_table.out 【从文件解析】 ll /sys/firmware/acpi/tables/ iasl -d dsdt.dat 【 生成 dsdt.dsl 】
acpidump – dump a system’s ACPI tables to an ASCII file acpixtract – convert ASCII acpidump output to raw binary table turbostat – gather performance statistics
IASL:ACPI Source Language compiler/decompiler
或者 yum install acpica-tools
Intel ACPI Component Architecture ASL+ Optimizing Compiler/Disassembler version 20200528 Copyright (c) 2000 - 2020 Intel Corporation
Supports ACPI Specification Revision 6.3
Usage: iasl [Options] [Files] Options:
General:
-@
Help: -h This message -hc Display operators allowed in constant expressions -hd Info for obtaining and disassembling binary ACPI tables -hf Display help for output filename generation -hr Display ACPI reserved method names -ht Display currently supported ACPI table names
Preprocessor:
-D
Errors, Warnings, and Remarks:
-va Disable all errors/warnings/remarks
-ve Report only errors (ignore warnings and remarks)
-vi Less verbose errors and warnings for use with IDEs
-vr Disable remarks
-vw
AML Bytecode Generation (*.aml):
-oa Disable all optimizations (compatibility mode)
-of Disable constant folding
-oi Disable integer optimization to Zero/One/Ones
-on Disable named reference string optimization
-ot Disable typechecking
-cr Disable Resource Descriptor error checking
-in Ignore NoOp operators
-r
Listings: -l Create mixed listing file (ASL source and AML) (.lst) -lm Create hardware summary map file (.map) -ln Create namespace file (.nsp) -ls Create combined source file (expanded includes) (.src) -lx Create cross-reference file (*.xrf)
Firmware Support - C Text Output: -tc Create hex AML table in C (.hex) -sc Create named hex AML arrays in C (.c) -ic Create include file in C for -sc symbols (.h) -so Create namespace AML offset table in C (.offset.h)
Firmware Support - Assembler Text Output: -ta Create hex AML table in assembler (.hex) -sa Create named hex AML arrays in assembler (.asm) -ia Create include file in assembler for -sa symbols (*.inc)
Firmware Support - ASL Text Output: -ts Create hex AML table in ASL (Buffer object) (*.hex)
Legacy-ASL to ASL+ Converter:
-ca
Data Table Compiler:
-tp Compile tables with flex/bison prototype
-G Compile custom table that contains generic operators
-T
AML Disassembler:
-d <f1 f2 ...> Disassemble or decode binary ACPI tables to file (*.dsl)
(Optional, file type is automatically detected)
-da <f1 f2 ...> Disassemble multiple tables from single namespace
-db Do not translate Buffers to Resource Templates
-dc <f1 f2 ...> Disassemble AML and immediately compile it
(Obtain DSDT from current system if no input file)
-df Force disassembler to assume table contains valid AML
-dl Emit legacy ASL code only (no C-style operators)
-e <f1 f2 ...> Include ACPI table(s) for external symbol resolution
-fe
Debug Options:
-bc Create converter debug file (.cdb)
-bf Create debug file (full output) (.txt)
-bs Create debug file (parse tree only) (*.txt)
-bp
ll /sys/firmware/acpi/tables total 0 -r-------- 1 root root 772 Aug 1 17:08 APIC -r-------- 1 root root 165 Aug 1 17:08 'ASF!' -r-------- 1 root root 48 Aug 1 17:08 BDAT -r-------- 1 root root 48 Aug 1 17:08 BERT -r-------- 1 root root 40 Aug 1 17:08 BOOT drwxr-xr-x 2 root root 0 Aug 1 17:08 data -r-------- 1 root root 52 Aug 1 17:08 DBGP -r-------- 1 root root 280 Aug 1 17:08 DMAR -r-------- 1 root root 186073 Aug 1 17:08 DSDT drwxr-xr-x 2 root root 0 Aug 1 17:08 dynamic -r-------- 1 root root 336 Aug 1 17:08 EINJ -r-------- 1 root root 560 Aug 1 17:08 ERST -r-------- 1 root root 268 Aug 1 17:08 FACP -r-------- 1 root root 64 Aug 1 17:08 FACS -r-------- 1 root root 68 Aug 1 17:08 FPDT -r-------- 1 root root 168 Aug 1 17:08 HEST -r-------- 1 root root 56 Aug 1 17:08 HPET -r-------- 1 root root 60 Aug 1 17:08 MCFG -r-------- 1 root root 209 Aug 1 17:08 PRAD -r-------- 1 root root 108 Aug 1 17:08 SLIT -r-------- 1 root root 65 Aug 1 17:08 SPMI -r-------- 1 root root 976 Aug 1 17:08 SRAT -r-------- 1 root root 1480 Aug 1 17:08 SSDT1 -r-------- 1 root root 1608 Aug 1 17:08 SSDT2 -r-------- 1 root root 566 Aug 1 17:08 UEFI1 -r-------- 1 root root 66 Aug 1 17:08 UEFI2 -r-------- 1 root root 404 Aug 1 17:08 WDAT
ACPI定义了很多的表,这里不一一说明,下面是其中的一些:
• Root System Description Table (RSDT) • Fixed ACPI Description Table (FADT) • Firmware ACPI Control Structure (FACS) • Differentiated System Description Table (DSDT) 差异化系统描述表 • Secondary System Description Table (SSDT) • Multiple APIC Description Table (MADT) • Smart Battery Table (SBST) • Extended System Description Table (XSDT) • Embedded Controller Boot Resources Table (ECDT) • System Locality Distance Information Table (SLIT) • System Resource Affinity Table (SRAT) • Corrected Platform Error Polling Table (CPEP) • Maximum System Characteristics Table (MSCT) • ACPI RAS Feature Table (RASF) • Memory Power State Table (MPST) • Platform Memory Topology Table (PMTT) • Boot Graphics Resource Table (BGRT) • Firmware Performance Data Table (FPDT) 固件性能数据表 • Generic Timer Description Table (GTDT) • NVDIMM Firmware Interface Table (NFIT)
ACPI Spec的第五章ACPI Software Programming Model中对它们有介绍。
DefinitionBlock ("", "DSDT", 2, "QCOMM ", "SM6225 ", 0x00000003)
Linux内核深入理解定时器和时间管理(6):x86_64 相关的时钟源(kvm-clock,tsc,acpi_pm,hpet)
在BIOS向OS报告的ACPI表中,最重要的是SRAT(System Resource Affinity Table 系统资源亲和性表)和SLIT(System Locality Information Table 系统位置信息表)。
SRAT中包含两个结构
Processor Local APIC/SAPIC Affinity Structure:每个逻辑Processor在Proximity Domain所处的位置。每个逻辑Processor都有不同的Local APIC ID,所以Processor用Local APIC ID表示。 Memory Affinity Structure:记录内存的信息,即每块内存都从属于哪个Proximity Domain。 有了这个表OSPM就可以描绘出一个CPU和内存的关系图,包括有几个node,每个node里面有那些逻辑Processor和内存。
SLIT表则记录了各个结点之间的距离
通过这两个表,OS可以在内存中建立整体Processor和内存的亲缘关系图和距离表,作为任务调度和内存分配的依据。详细信息可以查看ACPI Spec 6.1的第17章节
=== 【这两跟NUMA相关】
ACPI其实是一种电源管理标准,ACPI是Advanced Configuration and Power Interface的首字母缩写,一般翻译成高级电源管理,是Intel、Microsoft和东芝共同开发的一种电源管理标准。