Whiterat
Whiterat

Reputation: 11

Alder Lake N - ACPI/DSDT - GPIO - Change default value

I purchased an obscure NAS only sold to the Chinese domestic market (Zspace Z4Pro) with a view to using another OS on it since it was intel based. I can boot and run another OS (ESXi/Proxmox/etc) fine however there is no power supplied to the drive bays.

After managing to get a restore image from the manufacturer and ripping it apart I found that power is controlled via GPIO at OS level by means of a kernel module - "gpio-z4pro-sata-power.ko" (as are LEDs - but that's another problem for another day).

I've now mapped the GPIOs (and they are thankfully on the Intel side of things, not the SuperIO)

This is an i3-N305 based board (Alder Lake N)

sata0_power_gpio = pin 17 (GPPC_B_17): (MUX UNCLAIMED) INTC1057:00:681 GPIO 0x04000200 0x00000029 0x00000100
sata1_power_gpio = pin 16 (GPPC_B_16): (MUX UNCLAIMED) INTC1057:00:680 GPIO 0x04000200 0x00000028 0x00000100
sata2_power_gpio = pin 8 (GPPC_B_8): (MUX UNCLAIMED) INTC1057:00:672 GPIO 0x04000200 0x00000020 0x00000100
sata3_power_gpio = pin 7 (GPPC_B_7): (MUX UNCLAIMED) INTC1057:00:671 GPIO 0x04000200 0x0000001f 0x00000100

and can power each of them up by pulling low :

echo 0 > /sys/class/gpio/gpio681/value

Great. However I'd like this to be the default and not rely upon the OS to handle this.

I believe this should be achievable by means of editing DSDT ? I've dumped the DSDT and this is the only section I can find that relates to INTC1057 but it doesn't appear overly obvious to me how I might achieve my goal?

    Scope (_SB)
    {
        Device (GPI0)
        {
            Method (_HID, 0, NotSerialized)  // _HID: Hardware ID
            {
                If ((GPHD == One))
                {
                    Return ("PNP0C02")
                }

                If ((PCHS == 0x03))
                {
                    Return ("INTC1057")
                }
                Else
                {
                    Return ("INTC1055")
                }
            }

            Name (LINK, "\\_SB.GPI0")
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBFL, ResourceTemplate ()
                {
                    Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, _Y41)
                    {
                        0x0000000E,
                    }
                    Memory32Fixed (ReadWrite,
                        0x00000000,         // Address Base
                        0x00010000,         // Address Length
                        _Y42)
                    Memory32Fixed (ReadWrite,
                        0x00000000,         // Address Base
                        0x00010000,         // Address Length
                        _Y43)
                    Memory32Fixed (ReadWrite,
                        0x00000000,         // Address Base
                        0x00010000,         // Address Length
                        _Y44)
                    Memory32Fixed (ReadWrite,
                        0x00000000,         // Address Base
                        0x00010000,         // Address Length
                        _Y45)
                })
                CreateDWordField (RBFL, \_SB.GPI0._CRS._Y41._INT, INTL)  // _INT: Interrupts
                INTL = SGIR /* \SGIR */
                CreateDWordField (RBFL, \_SB.GPI0._CRS._Y42._BAS, CML0)  // _BAS: Base Address
                CML0 = (SBRG + 0x006E0000)
                CreateDWordField (RBFL, \_SB.GPI0._CRS._Y43._BAS, CML1)  // _BAS: Base Address
                CML1 = (SBRG + 0x006D0000)
                CreateDWordField (RBFL, \_SB.GPI0._CRS._Y44._BAS, CML4)  // _BAS: Base Address
                CML4 = (SBRG + 0x006A0000)
                CreateDWordField (RBFL, \_SB.GPI0._CRS._Y45._BAS, CML5)  // _BAS: Base Address
                CML5 = (SBRG + 0x00690000)
                Return (RBFL) /* \_SB_.GPI0._CRS.RBFL */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If ((GPHD == One))
                {
                    Return (0x08)
                }

                Return (0x0F)
            }
        }
    }

Would love some pointers or any suggestions!

I believe it should be possible to "test" any DSDT modifications by means of overriding it with grub - with a view of then updating the BIOS with this later for a more permanent fit.

Upvotes: 1

Views: 161

Answers (0)

Related Questions