Skip to content

Analyze your notebook's DSDT

Stefan Hirschmann edited this page May 15, 2018 · 14 revisions

The Differentiated System Description Table (DSDT) is part of the Advanced Configuration and Power Interface (ACPI) which allows an operating system to communicate with the system firmware (BIOS/UEFI). It contains useful information about your notebook's hardware, including the EC.

In this chapter I will show you how to disassemble and analyze the DSDT. First, please download this DSDT editor (requires Java). Unzip it, start it and then disassemble the DSDT (File --> extract DSDT, may take up to a minute). In case the DSDT editor is not able to disassemble the DSDT, you can also give RWEverything a try (APCI Tables --> DSDT).

You will see a bunch of ASL code (see ACPI specifications, ch. 19 and ACPICA documentation). It might look cryptic, but even if you've never heard of ASL before you can still try to get some information out of it.

To show you what you have to search for, let's take a look at these excerpts from my notebook's DSDT. I omitted (for our purposes) irrelevant code and added some comments:

// Low Pin Count bus
Device (LPCB)
{
    // embedded controller 0
    Device (EC0)
    {
        // EC register map
        // OperationRegion (region_name, address_space_type, start_offset, region_size)
        OperationRegion (ECRM, EmbeddedControl, 0x00, 0xFF)
        Field (ECRM, ByteAcc, NoLock, Preserve)
        {
        // ...
            Offset (0x22),
        //  name,   bits
            CRZN,   8,      // 0x22: current (thermal) zone
            THTA,   8,
            HYST,   8,
            CRIT,   8,
            TEMP,   8,      // 0x26: temperature
            TENA,   8,
        // ...
            Offset (0x2E),
            FRDC,   8,      // 0x2E: fan read duty cycle
            FTGC,   8,      // 0x2F: fan target (duty) cycle
            PLTP,   8,
            Offset (0x32),
            DTMP,   8,
        // ...
        }
    }
}

Basically, you should look for fields in the EmbeddedControl address space which describe the EC's registers. Then you can try to discover the register(s) which let you control the fan(s). Unfortunately, names of ACPI-objects are limited to 4 characters which doesn't make them exactly meaningful. Because of this limitation, you have to find out their purpose either by looking at how they are used within methods in the DSDT code or simply by looking at the register's values (see Probe the EC's registers).

The former could look something like this:

// Get fan rpm(?), 0 arguments, calls are serialized (like synchronized in Java)
// synchronized int GFRM()
Method (GFRM, 0, Serialized)
{
    // Local0 = 0;
    Store (0x00, Local0)

    // if(ECRG != 0)
    If (\_SB.PCI0.LPCB.EC0.ECRG)
    {
        // Acquire EC0 mutex (ECMX), timeout after 0xFFFF (65535) ms
        Acquire (\_SB.PCI0.LPCB.EC0.ECMX, 0xFFFF)

        // Local0 = FRDC;
        Store (\_SB.PCI0.LPCB.EC0.FRDC, Local0)

        // Release EC0 mutex
        Release (\_SB.PCI0.LPCB.EC0.ECMX)

        // if(Local0 != 0)
        If (Local0)
        {
            // Local1 = Local0 >> 1;
            ShiftRight (Local0, 0x01, Local1)

            // Local2 = 245760 + Local1;
            Add (0x0003C000, Local1, Local2)

            // Local1 = Local2 % Local0;
            // Local0 = Local2 / Local0;
            Divide (Local2, Local0, Local1, Local0)
        }
    }
    Return (Local0)
}

This method shows us that FRDC holds the fan speed value (and how to convert this value into RPM which is currently not supported by NBFC). I repeated this procedure for some more registers which looked interesting and this is what I found out so far:

  • ReadRegister: FRDC is at 0x2E = 46 (decimal)
  • WriteRegister: FTGC is at 0x2E + 1 byte = 47 (decimal)
  • ReadWriteWords: must be set to false, because the EC uses only one 8 bit (= 1 byte) wide register to store the fan speed instead of 2 8 bit wide (= 2 byte = 1 word) registers
  • CRZN is at 0x22 = 34 (decimal) and allows us to select the current thermal zone
  • TEMP is at 0x22 + 4 byte = 38 (decimal) and allows us to get (or set) the temperature of the currently selected thermal zone

Though your notebook's DSDT may differ completely from my example, I hope this gives you an idea of what should to search for. I will not go further into detail because you don't have to fully understand the DSDT to extract some useful information. If you want to learn more, you should read the ACPI specifications.

Regardless of whether you were successful or your notebook's DSDT does not offer you any useful information at all, you can still go on with the next chapter: Probe the EC's registers