Jump to content

[SOLVED] Requesting assistance in converting DSDT patch to SSDT


Wannabe Hacker
 Share

13 posts in this topic

Recommended Posts

I am currently completing installation of Big Sur using Open Core on a very outdated socket 775 system (Asus P5QE, Q9650, GT 710).   I have spent the last several days fixing shutdown. I first tried using the OpenCore guide but found that I could not apply its suggestion to my system (no doubt a failure on my part).  I was previously using Clover to run High Sierra on this system and this problem was easily solved by selecting "FixShutdown" in the ACPI patches section. According to the Clover Wiki:  FixShutdown_0004 "Adds If(arg=5){) to method _PTS". A little bit of research led me to this DSDT patch in MaciASL labeled "Shutdown Fix -ASUS":

 

# Maintained by: PJALM (help@pjalm.com) for: http://pjalm.com/repos/

# These patches are the registered property of PJALM.COM and can not be
# redistributed or modified without the written consent of PJALM.COM.
# Links to these patches are allowed. All material is protected under the DMCA.

# Last Updated  : 05/07/2016
# Patch Name    : Shutdown Fix - ASUS
# Patch Version : 1.0

# ASUS Shutdown Fix
into method label _PTS code_regex_not If\s*\(LEqual\s*\(Arg0,\s*0x05\)\) code_regex ^((?:.|\n)*)$ replace_matched begin
        If (LEqual (Arg0, 0x05)) {}\n
        Else\n
        {\n
%1
        }

Of note, there are two additional patches by Rehabman in MaciASL that address shutdown. The first is labeled "[sys] Shutdown Fix" and appears to be the same code as above. The second labeled "[sys] Shutdown Fix v2" looks to be slight variation. 

 

Applying the above patch to my system DSDT does indeed fix my shutdown problem.  Unfortunately, this fix requires me to insert my entire DSDT.aml in the ACPI section of OpenCore which I would like to avoid.  The Dortania guide seems to frown on this as well. This then leads to the question of this post, how to I convert this DSDT patch to an SSDT? Although I have no knowledge of ACPI programming, I am willing to give it a try with a little direction.  I have included both the unpatched and patched DSDT.aml files.

 

BTW, my system DSDT was obtained using F4 in the Clover boot menu.  The DSDT patch was applied using the Legacy compiler in MaciASL. Using the Standard compiler produced a fatal error which I did not know how to correct. The Legacy compiler also produced several nonfatal warnings but did allow me to successfully compile. 

 

 

 

DSDT.aml DSDT_patched.aml

Edited by MacGeoDoc
Link to comment
Share on other sites

This is done by renaming the original method and then adding a SSDT which calls back the renamed method.

Let's try to mimic SSDT-GPRW and its patch for your case.

In ProperTree:

image.thumb.png.6df841bbd9196848bea8cc5be30e749f.png

 

and something like:

 

DefinitionBlock ("", "SSDT", 2, "ETRX", "sleep", 0x00000001)
{
    External (XPTS, MethodObj)

    Method (_PTS, 1, NotSerialized) // _PTS: Prepare To Sleep
    {
        If ((_OSI ("Darwin")) && (Arg0 == 0x05)) {}
        Else
        {
            XPTS (Arg0)
        }
    }
}

 

Note that the patch in your post tests for Arg0 lower or equal to 0x05 but your patched DSDT tests for Arg0 == 0x05.

 

 

SSDT-XPTS.aml SSDT-XPTS.dsl

Edited by etorix
corrected (LEqual = Logical Equal)
Link to comment
Share on other sites

9 hours ago, etorix said:

This is done by renaming the original method and then adding a SSDT which calls back the renamed method.

Let's try to mimic SSDT-GPRW and its patch for your case.

In ProperTree:

image.thumb.png.6df841bbd9196848bea8cc5be30e749f.png

 

and something like:

 

DefinitionBlock ("", "SSDT", 2, "ETRX", "sleep", 0x00000001)
{
    External (XPTS, MethodObj)

    Method (_PTS, 1, NotSerialized) // _PTS: Prepare To Sleep
    {
        If ((_OSI ("Darwin")) && (Arg0 == 0x05)) {}
        Else
        {
            XPTS (Arg0)
        }
    }
}

 

Note that the patch in your post tests for Arg0 lower or equal to 0x05 but your patched DSDT tests for Arg0 == 0x05.

 

 

SSDT-XPTS.aml 80 B · 0 downloads SSDT-XPTS.dsl 303 B · 0 downloads

 

Thank you so much for this!!   Looking forward to trying this out when I get back to my system.  Not sure for the difference in the arguments between what I posted and the actual file.  I know I was also testing other patches and perhaps I uploaded the wrong one. I will investigate.

Edited by MacGeoDoc
Link to comment
Share on other sites

1 hour ago, etorix said:

This is done by renaming the original method and then adding a SSDT which calls back the renamed method.

Let's try to mimic SSDT-GPRW and its patch for your case.

In ProperTree:

image.thumb.png.6df841bbd9196848bea8cc5be30e749f.png

 

and something like:

 

DefinitionBlock ("", "SSDT", 2, "ETRX", "sleep", 0x00000001)
{
    External (XPTS, MethodObj)

    Method (_PTS, 1, NotSerialized) // _PTS: Prepare To Sleep
    {
        If ((_OSI ("Darwin")) && (Arg0 == 0x05)) {}
        Else
        {
            XPTS (Arg0)
        }
    }
}

 

Note that the patch in your post tests for Arg0 lower or equal to 0x05 but your patched DSDT tests for Arg0 == 0x05.

 

 

SSDT-XPTS.aml 80 B · 1 download SSDT-XPTS.dsl 303 B · 1 download

 

 

Unfortunately the SSDT you kindly provided does not work.  I think the problem is the with with argument difference that you describe.  I went back and investigated this and discovered that the difference appears to be explained by the compiler version you are using.  If you open my patched DSDT file using MaciASL (ver 1.6.2) and the default Stable compiler (which uses iasl version 20200925) you get Arg0==0x05.  If you open it using the Legacy compiler (which uses iasl version 20100331) you get LEqual (Arg0, 0x05). This is a very old DSDT. If you recall, I had to use the Legacy compiler in MaciASL to make my patched DSDT.  The default Stable compiler produced a fatal error that I did not know how to correct. I went back and tried to change the argument in your SSDT to Arg0<=0x05 but it still didn't work.  Maybe I'm not using the proper syntax?  

  • Like 1
Link to comment
Share on other sites

27 minutes ago, Hervé said:

Stick to Clover and avoid OpenCore since latter can not provide CPU power management for legacy C2D/C2Q CPUs unlike Clover.

 

I appreciate your feedback. Could you provide me with more detailed info regarding the CPU power issues you mention?  I am aware that Clover allows for setting C states and P states which OpenCore does not directly support.  I have discovered, though, that this only seems to be necessary if you are using SpeedStep.  If you turn off SpeedStep in the BIOS or overclock (which I am doing), setting C/P states does not appear to be needed.  So far, OpenCore seems to be working very well with Big Sur on this legacy system.  I am actually quite surprised by how stable and funtional it is.  How would you suggest I test for proper CPU power management? 

Edited by MacGeoDoc
Link to comment
Share on other sites

14 hours ago, MacGeoDoc said:

Unfortunately the SSDT you kindly provided does not work.  I think the problem is the with with argument difference that you describe.  I went back and investigated this and discovered that the difference appears to be explained by the compiler version you are using.  If you open my patched DSDT file using MaciASL (ver 1.6.2) and the default Stable compiler (which uses iasl version 20200925) you get Arg0==0x05.  If you open it using the Legacy compiler (which uses iasl version 20100331) you get LEqual (Arg0, 0x05). This is a very old DSDT.

Thanks for your feedback. It is certainly possible to work out the old syntax and set a correct toolchain—and code!—to get the correct result, but this is above my skill level.

@Hervé gave a good reason to update and stay with Clover rather than switch to OpenCore.

 

14 hours ago, MacGeoDoc said:

If you recall, I had to use the Legacy compiler in MaciASL to make my patched DSDT.  The default Stable compiler produced a fatal error that I did not know how to correct. I went back and tried to change the argument in your SSDT to Arg0<=0x05 but it still didn't work.  Maybe I'm not using the proper syntax?  

Syntax is as shown in the patch: "LEqual (Arg0,0x05)".

Edited by etorix
corrected (see below)
Link to comment
Share on other sites

10 hours ago, etorix said:

 

Note that the patch in your post tests for Arg0 lower or equal to 0x05 but your patched DSDT tests for Arg0 == 0x05.

 

 

After additional research I have come to understand that the operator "LEqual" is the legacy equivalent of "==". The table below is from the ACPI Specification 6.4 Manual:

 

 

image.png.bf9b79723bcfff5103a6c811eb6e6a92.png

 

Thus, I am back to where I started. I appreciate your attempt to create this SSDT.  The reason the SSDT does not work must be something other than the logical operator.  I will continue my research and hope that maybe someone else has some additional insight.  Thanks again!

Edited by MacGeoDoc
  • Like 1
Link to comment
Share on other sites

10 hours ago, MaLd0n said:

Use dsdt above and check if work with clover or opencore

 

Yes, the patched DSDT you uploaded works well including shutdown.  What I was hoping for is an SSDT with just the shutdown patch instead of a patched DSDT.  As I mentioned in my original post, I would prefer to not have OpenCore load a full DSDT. 

Edited by MacGeoDoc
Link to comment
Share on other sites

12 hours ago, etorix said:

This is done by renaming the original method and then adding a SSDT which calls back the renamed method.

Let's try to mimic SSDT-GPRW and its patch for your case.

In ProperTree:

image.thumb.png.6df841bbd9196848bea8cc5be30e749f.png

 

and something like:

 

DefinitionBlock ("", "SSDT", 2, "ETRX", "sleep", 0x00000001)
{
    External (XPTS, MethodObj)

    Method (_PTS, 1, NotSerialized) // _PTS: Prepare To Sleep
    {
        If ((_OSI ("Darwin")) && (Arg0 == 0x05)) {}
        Else
        {
            XPTS (Arg0)
        }
    }
}

 

Note that the patch in your post tests for Arg0 lower or equal to 0x05 but your patched DSDT tests for Arg0 == 0x05.

 

 

SSDT-XPTS.aml 80 B · 1 download SSDT-XPTS.dsl 303 B · 2 downloads

 

My apologies to @etorix.  The SSDT you supplied WORKS! 😃  I went back and reread your post and realized that I had forgotten to also include the ACPI renaming patch.  I think I got distracted by all the discussion regarding the logical operator.  I consider this problem SOLVED. Many thanks!!!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...