XSDT

From OSDev Wiki
Jump to: navigation, search

eXtended System Descriptor Table (XSDT) - the 64-bit version of the ACPI RSDT

Contents

Introduction

"the XSDT provides identical functionality to the RSDT but accommodates physical addresses of DESCRIPTION HEADERs that are larger than 32-bits." - ACPI Specification v5.0. This means all addresses are now 64 bits. If the pointer to the XSDT is valid, the OS MUST use the XSDT. All of the addresses will probably be 32 bits, and if you are not using PAE, you couldn't use higher than 32 bits, but the spec says you should use this anyway.

Detecting the XSDT

To find the XSDT you need first to locate and check the RSDP, then use the XsdtPointer (if it exists).

Validating the XSDT

You only need to sum all the bytes in the table and compare the result to 0.

Structure

The XSDT is the main System Description Table. However there are many kinds of SDT. All the SDT may be split into two parts. One (the header) which is common to all the SDT an another (data) which is different for each table. The structure of the header is:

struct ACPISDTHeader {
  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;
}

Header fields

Signature

All the ACPI tables have a 4 byte Signature field (except the RSDP which has an 8 byte one). Using the signature, you can determine what table are you working with.

Length

Total size of the table, inclusive of the header.

Checksum

A 8 bit checksum field of the whole table, inclusive of the header. All bytes of the table summed must be equal to 0 (mod 0xFF). You should always do a checksum of the table before using it, even if you found the table linked by other tables.

bool doChecksum(ACPISDTHeader *tableHeader)
{
    unsigned char sum = 0;
 
    for (int i = 0; i < tableHeader->Length; i++)
    {
        sum += ((char *) tableHeader)[i];
    }
 
    return sum == 0;
}

Other fields

The XSDT contains pointers to other tables:

struct XSDT {
  struct ACPISDTHeader h;
  uint64_t PointerToOtherSDT[(h.Length - sizeof(h)) / 8];
}

How to use

Well, suppose you want to find the FADT. The FADT, being a SDT has a ACPISDTHeader. It's signature is "FACP". You may use this code:

void *findFACP(void *RootSDT)
{
    XSDT *xsdt = (XSDT *) RootSDT;
    int entries = (xsdt->h.Length - sizeof(xsdt->h)) / 8;
 
    for (int i = 0; i < entries; i++)
    {
        ACPISDTHeader *h = (ACPISDTHeader *) xsdt->PointerToOtherSDT[i];
        if (!strncmp(h->Signature, "FACP", 4))
            return (void *) h;
    }
 
    // No FACP found
    return NULL;
}

What can you find?

Defined by ACPI

The ACPI Specification 5.0 has direct definitions for the following System Descriptor tables, identified by their signatures:

  • "APIC": Multiple APIC Description Table (MADT)
  • "BGRT": Boot Graphics Resource Table (BGRT; only supported on UEFI systems)
  • "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 ACPPI Control Structure (FACS)
  • "HEST": Hardware Error Source Table (HEST)
  • "MSCT": Maximum System Characteristics Table (MSCT)
  • "MPST": Memory Power State Table (MPST)
  • "OEMx": OEM Specific Information Tables (Any table with a signature beginning with "OEM" falls into this definition)
  • "PMTT" Platform Memory Topology Table (PMTT)
  • "PSDT": Persistent System Description Table (PSDT)
  • "RASF": ACPI RAS FeatureTable (RASF)
  • "RSDT": Root System Description Table (RSDT; 32-bit version of the XSDT)
  • "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 (This wiki page; included for completeness)

Reserved by ACPI

The ACPI specification maintains reservations for additional third party defined description tables. Each third party submitting a request for a reservation also maintains a specification for these tables, located on individual sites. See the ACPI spec ([1]) for more information.

What's next?

You should now parse each table pointed by the RSDP. (Probably you will need only the FADT, the SSDT and the MADT)

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox