Jump to content

OC: Overriding _STA method from DSDT in SSDT (EC0 disable)


chatelp
 Share

7 posts in this topic

Recommended Posts

Hi all !

 

I'm migrating from Clover to OpenCore and stuck on an ACPI error at boot:

ACPI Error [_STA] Namespace lookup failure, AE_ALREADY_EXISTS

This comes from trying to load my custom SSDT-EC tables.

 

From what I gather, the preferred method of dealing with EC0 for Desktops with OC is to add an _STA method to EC0 to change return code to 0, and then to add a new fake EC device. Both done via SSDT-EC.

 

Problem is, my EC0 defined in the system DSDT already has an _STA method. And it looks like it can't be overridden through SSDT redefinition at boot. Is this excepted ACPI behavior? Is it not possible to override/redefine methods like _STA? If so, what other option do I have?

 

Here is the original EC0 device in DSDT

Device (EC0)
            {
                Name (_HID, EisaId ("PNP0C09"))  // _HID: Hardware ID
                Name (_UID, One)  // _UID: Unique ID
                Name (_GPE, 0x6E)  // _GPE: General Purpose Events
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

....

 

Here is my very standard SSTD-EC for Skylake:

 

/*
 * AppleUsbPower compatibility table for Skylake+.
 *
 * Be warned that power supply values can be different
 * for different systems. Depending on the configuration
 * these values must match injected IOKitPersonalities
 * for com.apple.driver.AppleUSBMergeNub. iPad remains
 * being the most reliable device for testing USB port
 * charging support.
 *
 * Try NOT to rename EC0, H_EC, etc. to EC.
 * These devices are incompatible with macOS and may break
 * at any time. AppleACPIEC kext must NOT load.
 * See the disable code below.
 *
 * Reference USB: https://applelife.ru/posts/550233
 * Reference EC: https://applelife.ru/posts/807985
 */
DefinitionBlock ("", "SSDT", 2, "ACDT", "SsdtEC", 0x00001000)
{
    External (_SB_.PCI0.LPCB, DeviceObj)

    /*
     * Uncomment replacing EC0 with your own value in case your
     * motherboard has an existing embedded controller of PNP0C09 type.
     *
     * While renaming EC0 to EC might potentially work initially,
     * it connects an incompatible driver (AppleACPIEC) to your hardware.
     * This can make your system unbootable at any time or hide bugs that
     * could trigger randomly.
     */

    
    External (_SB_.PCI0.LPCB.EC0, DeviceObj)

    Scope (\_SB.PCI0.LPCB.EC0)
    {
        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            If (_OSI ("Darwin"))
            {
                Return (0)
            }
            Else
            {
                Return (0x0F)
            }
        }
    }

    Scope (\_SB)
    {
        Device (USBX)
        {
            Name (_ADR, Zero)  // _ADR: Address
            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If ((Arg2 == Zero))
                {
                    Return (Buffer (One)
                    {
                         0x03                                             // .
                    })
                }

                Return (Package (0x08)
                {
                    "kUSBSleepPowerSupply",
                    0x13EC,
                    "kUSBSleepPortCurrentLimit",
                    0x0834,
                    "kUSBWakePowerSupply",
                    0x13EC,
                    "kUSBWakePortCurrentLimit",
                    0x0834
                })
            }
        }

        Scope (\_SB.PCI0.LPCB)
        {
            Device (EC)
            {
                Name (_HID, "ACID0001")  // _HID: Hardware ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }
        }
    }
}

 

I saw this other similar post but can't find a working solution in it: https://www.insanelymac.com/forum/topic/341585-hpet/?_fromLogin=1

 

 

Edited by chatelp
Link to comment
Share on other sites

  • 3 weeks later...

I am having the exact same problem with trying to override my `_PWR` method.

DefinitionBlock ("", "SSDT", 2, "HPENVY", "_GLAN", 0x00000000)
{
    External (_SB_.PCI0.GLAN, DeviceObj)
    External (GPRW, MethodObj)
    
    Method (\_SB.PCI0.GLAN._PRW, 0, NotSerialized)
    {
        Return (\GPRW (0x6D, 0x00))
    }
}

Meaning, that I get `ACPI Error [_PRW] Namespace lookup failure, AE_ALREADY_EXISTS`

Edited by Denicio
Link to comment
Share on other sites

On 5/7/2020 at 11:06 AM, chatelp said:

Hi all !

 

I'm migrating from Clover to OpenCore and stuck on an ACPI error at boot:


ACPI Error [_STA] Namespace lookup failure, AE_ALREADY_EXISTS

This comes from trying to load my custom SSDT-EC tables.

 

From what I gather, the preferred method of dealing with EC0 for Desktops with OC is to add an _STA method to EC0 to change return code to 0, and then to add a new fake EC device. Both done via SSDT-EC.

 

Problem is, my EC0 defined in the system DSDT already has an _STA method. And it looks like it can't be overridden through SSDT redefinition at boot. Is this excepted ACPI behavior? Is it not possible to override/redefine methods like _STA? If so, what other option do I have?

 

Here is the original EC0 device in DSDT


Device (EC0)
            {
                Name (_HID, EisaId ("PNP0C09"))  // _HID: Hardware ID
                Name (_UID, One)  // _UID: Unique ID
                Name (_GPE, 0x6E)  // _GPE: General Purpose Events
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

....

 

Here is my very standard SSTD-EC for Skylake:

 


/*
 * AppleUsbPower compatibility table for Skylake+.
 *
 * Be warned that power supply values can be different
 * for different systems. Depending on the configuration
 * these values must match injected IOKitPersonalities
 * for com.apple.driver.AppleUSBMergeNub. iPad remains
 * being the most reliable device for testing USB port
 * charging support.
 *
 * Try NOT to rename EC0, H_EC, etc. to EC.
 * These devices are incompatible with macOS and may break
 * at any time. AppleACPIEC kext must NOT load.
 * See the disable code below.
 *
 * Reference USB: https://applelife.ru/posts/550233
 * Reference EC: https://applelife.ru/posts/807985
 */
DefinitionBlock ("", "SSDT", 2, "ACDT", "SsdtEC", 0x00001000)
{
    External (_SB_.PCI0.LPCB, DeviceObj)

    /*
     * Uncomment replacing EC0 with your own value in case your
     * motherboard has an existing embedded controller of PNP0C09 type.
     *
     * While renaming EC0 to EC might potentially work initially,
     * it connects an incompatible driver (AppleACPIEC) to your hardware.
     * This can make your system unbootable at any time or hide bugs that
     * could trigger randomly.
     */

    
    External (_SB_.PCI0.LPCB.EC0, DeviceObj)

    Scope (\_SB.PCI0.LPCB.EC0)
    {
        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            If (_OSI ("Darwin"))
            {
                Return (0)
            }
            Else
            {
                Return (0x0F)
            }
        }
    }

    Scope (\_SB)
    {
        Device (USBX)
        {
            Name (_ADR, Zero)  // _ADR: Address
            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If ((Arg2 == Zero))
                {
                    Return (Buffer (One)
                    {
                         0x03                                             // .
                    })
                }

                Return (Package (0x08)
                {
                    "kUSBSleepPowerSupply",
                    0x13EC,
                    "kUSBSleepPortCurrentLimit",
                    0x0834,
                    "kUSBWakePowerSupply",
                    0x13EC,
                    "kUSBWakePortCurrentLimit",
                    0x0834
                })
            }
        }

        Scope (\_SB.PCI0.LPCB)
        {
            Device (EC)
            {
                Name (_HID, "ACID0001")  // _HID: Hardware ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }
        }
    }
}

 

I saw this other similar post but can't find a working solution in it: https://www.insanelymac.com/forum/topic/341585-hpet/?_fromLogin=1

 

 

 

 

 Try edit your DSDT like that:

Device (EC0)
            {
                Name (_HID, EisaId ("PNP0C09"))  // _HID: Hardware ID
                Name (_UID, One)  // _UID: Unique ID
                Name (_GPE, 0x6E)  // _GPE: General Purpose Events
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (_OSI ("Darwin"))
                    {
                     Return (0)
                    }
                    Else
                    {
                     Return (0x0F)
                    }

Add this SSDT-EC-USBX.aml to ACPI folder and edit config.plist.

DefinitionBlock ("", "SSDT", 2, "ACDT", "SsdtEC", 0x00001000)
{
    External (_SB_.PCI0.LPCB, DeviceObj)

    Scope (\_SB)
    {
        Device (USBX)
        {
            Name (_ADR, Zero)  // _ADR: Address
            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If ((Arg2 == Zero))
                {
                    Return (Buffer (One)
                    {
                         0x03                                             // .
                    })
                }

                Return (Package (0x08)
                {
                    "kUSBSleepPowerSupply", 
                    0x13EC, 
                    "kUSBSleepPortCurrentLimit", 
                    0x0834, 
                    "kUSBWakePowerSupply", 
                    0x13EC, 
                    "kUSBWakePortCurrentLimit", 
                    0x0834
                })
            }
        }

        Scope (\_SB.PCI0.LPCB)
        {
            Device (EC)
            {
                Name (_HID, "ACID0001")  // _HID: Hardware ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }
        }
    }
}

Theoretically should work.

Edited by hardcorehenry
Link to comment
Share on other sites

  • 1 year later...
On 5/28/2020 at 9:46 AM, Denicio said:

So, I just realized that you need to rename the method you want to override in ACPI patches first, then the override will be successful.

Hi, thanks for the response, I'm stuck in the same situation, could you please provide an example in how to rename the method to override? I'm getting the same error. is it a binary rename? in which scope?  Thanks in advance

Link to comment
Share on other sites

  • 3 months later...
On 10/23/2021 at 2:29 AM, djmacross said:

Hi, thanks for the response, I'm stuck in the same situation, could you please provide an example in how to rename the method to override? I'm getting the same error. is it a binary rename? in which scope?  Thanks in advance

 

You can follow this guide: https://github.com/5T33Z0/OC-Little-Translated/tree/main/01_Adding_missing_Devices_and_enabling_Features/Embedded_Controller_(SSDT-EC)

Link to comment
Share on other sites

😀 Compare this to orig. patch. Operating system DARWIN hehe
Scope (\_SB.PCI0.LPCB) // path 
        {
            Scope (EC0) // Device to disable _SB.PCI0.LPCB.EC0
            {
            Name (_STA, Zero) 
            }

            Device (EC) // New device in the same scope ..LPCB
            {
                Name (_HID, "ACID0001")  // _HID: Hardware ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }
        }

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...