RSDT:ACPI 根系统描述表的结构、检测与表列表

来源:OSDev Wiki· 阅读原文 ↗
ACPI
固定表
差异化表
工具/库

RSDT (Root System Description Table,根系统描述表)是 ACPI 编程接口中使用的一种数据结构。该表包含指向所有其他系统描述表的指针。

检测

RSDT 由 RSDP 中的 RsdtAddress 字段指向。如果 ACPI 版本至少为 2.0,则应使用 XSDT[1]。

结构

与所有其他系统描述表一样,RSDT 分为头部和数据两部分。

struct SDT_header {
  char Signature[4];
  uint32_t Length;
  uint8_t Revision;
  uint8_t Checksum;
  char OEMID[6];
  char OEMTableID[8];
  uint32_t OEMRevision;
  uint32_t CreatorID;
  uint32_t CreatorRevision;
} __attribute__ ((packed));

字段

Signature

用于标识的 4 字节签名,等于 RSDT.

Length

整个表的长度,包括头部。

Checksum

整个表(包括头部)的 8 位校验和字段。表中所有字节相加之和必须等于 0(mod 0x100)。

bool verify_checksum(struct SDT_header *header)
{
    uint8_t sum = 0;

    for (int i = 0; i < header->Length; i++)
    {
        sum += ((uint8_t *) header)[i];
    }

    return sum == 0;
}

条目

RSDT 包含一个 32 位物理指针数组,指向其他系统描述表。

struct RSDT {
  struct SDT_header header;
  uint32_t entries[(header.Length - sizeof(header)) / 4];
} __attribute__ ((packed));

用法

可以通过遍历 entries 并查找签名正确的那一张来定位表。

例如,可以使用以下代码找到 FACP:

void *find_FACP(struct RSDT *rsdt)
{
    int entries = (rsdt->h.Length - sizeof(rsdt->h)) / 4;

    for (int i = 0; i < entries; i++)
    {
        struct SDT_header *h = (struct SDT_header *) rsdt->entries[i];
        if (!strncmp(h->Signature, "FACP", 4))
            return (void *)h;
    }

    return NULL;
}

FADT、SSDT 和 MADT 表都由 RSDT 指向,对 ACPI 相当重要。对于多处理器系统,SRAT 和 SLIT 表基本上是必需的。

表列表

由 ACPI 定义

ACPI 规范 5.0 对以下系统描述表有直接定义,通过其签名进行标识:

  • "APIC":Multiple APIC Description Table(MADT)
  • "BERT":Boot Error Record Table(BERT)
  • "CPEP":Corrected Platform Error Polling Table(CPEP)
  • "DSDT":Differentiated System Description Table(DSDT)
  • "ECDT":Embedded Controller Boot Resources Table(ECDT)
  • "EINJ":Error Injection Table(EINJ)
  • "ERST":Error Record Serialization Table(ERST)
  • "FACP":Fixed ACPI Description Table(FADT)
  • "FACS":Firmware ACPI Control Structure(FACS)
  • "HEST":Hardware Error Source Table(HEST)
  • "MSCT":Maximum System Characteristics Table(MSCT)
  • "MPST":Memory Power State Table(MPST)
  • "OEMx":OEM 特定信息表(任何签名以 "OEM" 开头的表都属于此定义)
  • "PMTT" Platform Memory Topology Table(PMTT)
  • "PSDT":Persistent System Description Table(PSDT)
  • "RASF":ACPI RAS Feature Table(RASF)
  • "RSDT":Root System Description Table(本 wiki 页面;为完整起见而列入)
  • "SBST":Smart Battery Specification Table(SBST)
  • "SLIT":System Locality System Information Table(SLIT)
  • "SRAT":System Resource Affinity Table(SRAT)
  • "SSDT":Secondary System Description Table(SSDT)
  • "XSDT":Extended System Description Table(XSDT;RSDT 的 64 位版本)

由 ACPI 保留

ACPI 规范为额外的第三方定义的描述表保留了预留项。每个提交预留请求的第三方也会维护这些表的规范,位于各自的站点上。参见 ACPI 规范([1])以获取更多信息。

另请参阅

外部链接

ACPI 规范(版本 6.5)

参考

  1. ↑ 在基于 x86 的系统上,出于兼容性原因,RSDT 和 XSDT 很可能指向同一个表。

来源与翻译说明

本文根据原文快照翻译,保留原有代码、数值、技术限定及历史背景。原文中的命令与运行结果不代表本站已实际执行验证。

原文:RSDT;离线修订号:30509。

原作者:OSDev Wiki 社区贡献者。原文及引用资料的版权与许可声明继续适用:版权声明 许可说明

评论

暂无评论