Jump to content

AppleALC — dynamic AppleHDA patching


vit9696
5,390 posts in this topic

Recommended Posts

After trying the latest versions of applealc and lilu for my vt2021 sound chip and tested if the kext are loaded correctly it does not work with mojave but with earth. Look at my data about my team.

 

 

Link to comment
Share on other sites

16 hours ago, twsps said:

No codeccommander in /L/E

 

Use codeccommander in \L\E and move all the kext into Clover\Kexts\Other except BrcmFirmwareRepo.kext, it will be the best choice.

 

16 hours ago, twsps said:

Update: Without PluginType=True and the right id injection, it will cause kernel panic. Which means, it won't cause kp when its not selecting the correct inject id for ALC295.

 

If you do it and you have KP, maybe other missing thing will cause the KP, normal or if you inject 1.

 

Now for the config.plist, i just managed it to only have the requirements, and removed inject-plugin type because of the new way on the MBP 14,x's and Apple's latest Mac's, so you can use the attached CpuSsdt in the patched folder. For your knowledge, you can go here, download the MacBook Pro 14,1 dump, and check the ACPI files like DSDT for example, find _DSM's method and add them to your DSDT but think that you have to remove the existing one's and drop them again in config.plist, to properly emulate your hack with Apple Hardware, check also the SSDT-10. You can remove XOSI things from config and patched and just add Darwin into \_OSI "simple way" because of DELL use AMI not like HP that use's it's own, you can also merge directly the SSDT's from patched into DSDT except CpuSsdt, use the help of IOREG to locate your devices infos and Apple devices infos, you can add also "compatible" into _DSM for more OS flexibility.

 

16 hours ago, twsps said:

For the reason why others won't have this issue, I believe this is specifically for my codec ALC295

 

I don't believe that sorry, it's not related to the ALC295 IMHO, because sometimes the problems come from the things that we didn't think about

 

So here's the attached files, but you also can create topic here in laptop/dell or in OSXLatitude forums, you'll have @Jake Lo and @Hervé, they solved all the issues that i had with this E7440, now it works on all apple's OS, without even changing something beside Clover it self.

config.plist

CpuSsdt_amd:dsl.zip

Your Clover:Others.zip

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

For anyone wondering how to patch their own codec (or in my case, add a new Layout to an existing one for better compatibility with my board), I'm gonna tell you this: when you start to understand something like this, a tutorial like this suddenly becomes a walk in the park for you. :)) That is definitely not for the faint of heart. And for someone with 0 knowledge of these things, it's hard.

But knowledge is something you get over time. And I was crazy enough to try.

 

Will see how it goes.

Edited by arsradu
  • Like 2
Link to comment
Share on other sites

@twsps

 

I've found in the MBP 14,1 DSDT file the presence of an _DSM in the (HDEF), this wasn't present in the previous generations, and maybe this will going to make difference, but i'm not 100% sure unless you give it a try:

 

Spoiler

Device (HDEF)
            {
                Name (_ADR, 0x001F0003)  // _ADR: Address
                OperationRegion (HDAR, PCI_Config, Zero, 0x60)
                Field (HDAR, WordAcc, NoLock, Preserve)
                {
                    VID0,   16, 
                    DID0,   16
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If (Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b"))
                    {
                        If ((VID0 & 0xFFFF) != 0xFFFF)
                        {
                            Local0 = Package (0x04)
                                {
                                    "hda-gfx", 
                                    Buffer (0x0A)
                                    {
                                        "onboard-1"
                                    }, 

                                    "hda-idle-support", 
                                    Buffer (0x02)
                                    {
                                        "1"
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }
                    }

                    Return (0x80000002)
                }
            }

 

 

So that said, this "hda-idle-support"=1 still don't know if it will make difference, but I'm sure here it's meaning is "Enabled idle support", if so, by trying it in your DSDT or just using an external _DSM in SSDT and worked for you, by letting the CPU using the idle, you'll be right by saying:

 

18 hours ago, twsps said:

For the reason why others won't have this issue, I believe this is specifically for my codec ALC295

 

Curiously, i was just looking into the DSDT of that MBP 14,1 to see what's the difference between the old and recent ACPI code, because from time to time i do that, and found it, because i'm sure in the previous generations, HDEF device section are empty!

 

Hope this to make the difference

  • Like 1
Link to comment
Share on other sites

Ok, so first attempt was a no-go. :)) I guess I might be missing something. And the newly added Layout ID 12, doesn't seem to work either. Not sure if it works for anyone. It doesn't work with the official version either.

 

So here's what I managed to get done so far: 

  • I chose Layout ID 30. No particular reason for that. But I couldn't find a pattern for the naming.... Any suggestions?
  • Added Layout30 and Platforms30 xml and zlib files to ALC892 folder.
  • Added Layout ID to ALC892 Info.plist (Item 8)

You can see the actual layout of my ports (and Paths Map). I'm not yet sure how to tell which one will show up as "Internal Speaker" or "Headphone".

Also, I re-attached the linux codec dump, for reference.

 

Also, there are a few things in the Layout ID xml which are not really clear to me... Such as MuteGPIO values. Where are those values taken from? Are they mandatory?

 

Anyway, if someone (preferably a dev) can take a look at what I've done so far and tell me what did I miss (cause I have no inputs/outputs whatsoever in System Preferences -> Sound), that would be awesome.

 

Thank you! :)

 

layout30.xml

Platforms30.xml

ConvertedNodeID

PathMaps

codec_dump_card1(ALC892).txt

PinDefaults & Verbs

Info.plist

Edited by arsradu
  • Like 2
Link to comment
Share on other sites

4 hours ago, ammoune78 said:

@twsps

 

I've found in the MBP 14,1 DSDT file the presence of an _DSM in the (HDEF), this wasn't present in the previous generations, and maybe this will going to make difference, but i'm not 100% sure unless you give it a try:

 

  Hide contents


Device (HDEF)
            {
                Name (_ADR, 0x001F0003)  // _ADR: Address
                OperationRegion (HDAR, PCI_Config, Zero, 0x60)
                Field (HDAR, WordAcc, NoLock, Preserve)
                {
                    VID0,   16, 
                    DID0,   16
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If (Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b"))
                    {
                        If ((VID0 & 0xFFFF) != 0xFFFF)
                        {
                            Local0 = Package (0x04)
                                {
                                    "hda-gfx", 
                                    Buffer (0x0A)
                                    {
                                        "onboard-1"
                                    }, 

                                    "hda-idle-support", 
                                    Buffer (0x02)
                                    {
                                        "1"
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }
                    }

                    Return (0x80000002)
                }
            }

 

 

So that said, this "hda-idle-support"=1 still don't know if it will make difference, but I'm sure here it's meaning is "Enabled idle support", if so, by trying it in your DSDT or just using an external _DSM in SSDT and worked for you, by letting the CPU using the idle, you'll be right by saying:

 

 

Curiously, i was just looking into the DSDT of that MBP 14,1 to see what's the difference between the old and recent ACPI code, because from time to time i do that, and found it, because i'm sure in the previous generations, HDEF device section are empty!

 

Hope this to make the difference

Hey,

Thanks for the idea here, how would I add this section of code into DSDT? I tried with patch in MaciASL but I can't apply, or how would I use an external _DSM SSDT?

 

Help is appreciated. Thanks

Link to comment
Share on other sites

[mention=1581907]twsps[/mention]
 
I've found in the MBP 14,1 DSDT file the presence of an _DSM in the (HDEF), this wasn't present in the previous generations, and maybe this will going to make difference, but i'm not 100% sure unless you give it a try:
 
Spoiler
Device (HDEF){Name (_ADR, 0x001F0003)  // _ADR: AddressOperationRegion (HDAR, PCI_Config, Zero, 0x60)Field (HDAR, WordAcc, NoLock, Preserve){                   VID0,   16,                    DID0,   16}Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method{If (Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")){If ((VID0 & 0xFFFF) != 0xFFFF){Local0 = Package (0x04){"hda-gfx", Buffer (0x0A){"onboard-1"}, "hda-idle-support", Buffer (0x02){"1"}}                           DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))Return (Local0)}}Return (0x80000002)}}

 
 
So that said, this "hda-idle-support"=1 still don't know if it will make difference, but I'm sure here it's meaning is "Enabled idle support", if so, by trying it in your DSDT or just using an external _DSM in SSDT and worked for you, by letting the CPU using the idle, you'll be right by saying:
 
 
Curiously, i was just looking into the DSDT of that MBP 14,1 to see what's the difference between the old and recent ACPI code, because from time to time i do that, and found it, because i'm sure in the previous generations, HDEF device section are empty!
 
Hope this to make the difference

Although I still don't get how do I put this code into DSDT, I tried with MacBook Pro 11,1, and it turns out it's the same problem. I would still like to try if your method will work out
Thanks

Sent from my MHA-AL00 using Tapatalk

Link to comment
Share on other sites

9 hours ago, ammoune78 said:

 

Use codeccommander in \L\E and move all the kext into Clover\Kexts\Other except BrcmFirmwareRepo.kext, it will be the best choice.

 

 

If you do it and you have KP, maybe other missing thing will cause the KP, normal or if you inject 1.

 

Now for the config.plist, i just managed it to only have the requirements, and removed inject-plugin type because of the new way on the MBP 14,x's and Apple's latest Mac's, so you can use the attached CpuSsdt in the patched folder. For your knowledge, you can go here, download the MacBook Pro 14,1 dump, and check the ACPI files like DSDT for example, find _DSM's method and add them to your DSDT but think that you have to remove the existing one's and drop them again in config.plist, to properly emulate your hack with Apple Hardware, check also the SSDT-10. You can remove XOSI things from config and patched and just add Darwin into \_OSI "simple way" because of DELL use AMI not like HP that use's it's own, you can also merge directly the SSDT's from patched into DSDT except CpuSsdt, use the help of IOREG to locate your devices infos and Apple devices infos, you can add also "compatible" into _DSM for more OS flexibility.

 

 

I don't believe that sorry, it's not related to the ALC295 IMHO, because sometimes the problems come from the things that we didn't think about

 

So here's the attached files, but you also can create topic here in laptop/dell or in OSXLatitude forums, you'll have @Jake Lo and @Hervé, they solved all the issues that i had with this E7440, now it works on all apple's OS, without even changing something beside Clover it self.

config.plist

CpuSsdt_amd:dsl.zip

Your Clover:Others.zip

Ok, I managed to add that HDEF code into my DSDT with no errors, but it's still having the same issue. Here I attached my edited DSDT.

DSDT.aml

Link to comment
Share on other sites

Did you tried the files suggested from the previous post for that config, kexts and CpuSsdt? Because it is from your previously uploaded clover folder, so i patched your CpuSsdt, did some changes into that config and asked you to move the whole kexts from \L\E to Other folder inside clover.

 

2 hours ago, twsps said:

Ok, I managed to add that HDEF code into my DSDT with no errors, but it's still having the same issue. Here I attached my edited DSDT.

DSDT.aml

 

No, you have to know that your Device HDAS is already renamed to HDEF by using clover AcpiPatcher, adding another device that have the same name is not appreciated using the same location address:

Name (_ADR, 0x001F0003) // _ADR: Address. The other thing is that the HDAS device has it's own _DSM, by adding the _DSM into the other HDEF will make confusion. Did you done any patches to that DSDT, because if you're using DSDT you need to apply some fixes the begin patching with _DSM and \_OSI. Also copy paste from other ACPI tables of different hardware into your tables is a bad thing, because it's a code and layout that is different from Bios revision to another one and from manufacturer to another.

 

I'll upload here DSDT with only HDAS>_DSM "Layout-ID 28", BUS0, IMEI, MCHC, Enable GPIO Controller and \_OSI, a complete one need more time, because I have to look into the MBP 14,1 and need also your IOREG.  

DSDT.aml

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

hello,there is a problem when I compiled AppleALC-1.2.8 with Lilu-1.2.4,,the xcode throw a error,
111.thumb.jpg.562f21467b3e3b04b652ef4ead646805.jpg
 
I wonder has anyone encountered this problem?
Lilu 1.2.5 and AppleALC 1.3.0 are available to be built from source. Try them, make sure you have debug Lilu.kext in AppleALC folder before building

Sent from my SM-G930F using Tapatalk

  • Like 2
Link to comment
Share on other sites

28 minutes ago, Master1024 said:

hello,there is a problem when I compiled AppleALC-1.2.8 with Lilu-1.2.4,,the xcode throw a error

 

I wonder has anyone encountered this problem?

 

  • Download BOTH Lilu sources and AppleALC sources.
  • Build Lilu first.
  • Copy the resulting Lilu DEBUG kext into the AppleALC folder.
  • Build AppleALC
Edited by arsradu
  • Like 1
Link to comment
Share on other sites

1 hour ago, SavageAUS said:

Lilu 1.2.5 and AppleALC 1.3.0 are available to be built from source. Try them, make sure you have debug Lilu.kext in AppleALC folder before building 

Sent from my SM-G930F using Tapatalk
 

ok,thanks,it ok

56 minutes ago, arsradu said:

 

  • Download BOTH Lilu sources and AppleALC sources.
  • Build Lilu first.
  • Copy the resulting Lilu DEBUG kext into the AppleALC folder.
  • Build AppleALC

ok,thanks,it ok

Link to comment
Share on other sites

Did you tried the files suggested from the previous post for that config, kexts and CpuSsdt? Because it is from your previously uploaded clover folder, so i patched your CpuSsdt, did some changes into that config and asked you to move the whole kexts from \L\E to Other folder inside clover.
 
 
No, you have to know that your Device HDAS is already renamed to HDEF by using clover AcpiPatcher, adding another device that have the same name is not appreciated using the same location address:
Name (_ADR, 0x001F0003) // _ADR: Address. The other thing is that the HDAS device has it's own _DSM, by adding the _DSM into the other HDEF will make confusion. Did you done any patches to that DSDT, because if you're using DSDT you need to apply some fixes the begin patching with _DSM and \_OSI. Also copy paste from other ACPI tables of different hardware into your tables is a bad thing, because it's a code and layout that is different from Bios revision to another one and from manufacturer to another.
 
I'll upload here DSDT with only HDAS>_DSM "Layout-ID 28", BUS0, IMEI, MCHC, Enable GPIO Controller and \_OSI, a complete one need more time, because I have to look into the MBP 14,1 and need also your IOREG.  
DSDT.aml
I tried all your files completely, but now clover doesn't recognize any disk. So I can't boot in macOS right now

Sent from my MHA-AL00 using Tapatalk

Link to comment
Share on other sites

I tried all your files completely, but now clover doesn't recognize any disk. So I can't boot in macOS right now

Sent from my MHA-AL00 using Tapatalk



Have you removed apfs.efi from the drivers folder, or you see the disks but black screen or just stay at Apple logo?


Sent from my iPhone using Tapatalk
Link to comment
Share on other sites

But i see now, with the new DSDT you have to remove xsid and xosi from the config plist and also ssdt-xosi from patched
I changed csractiveconfig to 0x67 and injectkexts=yes, added -xcpm to boot-args and change SAT0 to SATA, set apsn and aplf to true.

So maybe injectkexts in that added options don’t let you boot, just set it to detect if you want you can keep csractiveconfig to 3


Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

Also set drop OEM DSM in the config to true for all devices, i think you didn’t read my whole posts?


Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

Also set drop OEM DSM in the config to true for all devices, i think you didn’t read my whole posts?


Sent from my iPhone using Tapatalk
I use your config plist. So do I still need to change drop OEM DSM on my own?

Sent from my MHA-AL00 using Tapatalk

Link to comment
Share on other sites

I use your config plist. So do I still need to change drop OEM DSM on my own?

Sent from my MHA-AL00 using Tapatalk


Yes because of new DSDT, from the skylake builds to up, all OEM Manufacturers added in each device it’s own _DSM, so if you delete one of them and replaced it by another, you absolutely have to use drop OEM DSM of that device, otherwise the system will not boot, you’ll have acpi error in verbose


Sent from my iPhone using Tapatalk
Link to comment
Share on other sites


Yes because of new DSDT, from the skylake builds to up, all OEM Manufacturers added in each device it’s own _DSM, so if you delete one of them and replaced it by another, you absolutely have to use drop OEM DSM of that device, otherwise the system will not boot, you’ll have acpi error in verbose


Sent from my iPhone using Tapatalk
If I use your config, no disk will be recognized in clover, which means I can't boot in any OS. If I replace to my own config, clover will recognize my disk. I checked your config plist that you've provided to me, but you have changed a lot, would you mind to tell me what are the necessary ones?
Thanks

Sent from my MHA-AL00 using Tapatalk

Link to comment
Share on other sites

9 minutes ago, twsps said:

If I use your config, no disk will be recognized in clover, which means I can't boot in any OS. If I replace to my own config, clover will recognize my disk. I checked your config plist that you've provided to me, but you have changed a lot, would you mind to tell me what are the necessary ones?
Thanks

Sent from my MHA-AL00 using Tapatalk
 

 

Ok, let's start with your config, put the CpuSsdt i uploaded in the patched folder, remove plugin-type from the config and under ACPI Drop Tables add the following to the existing one:

 

Spoiler

		<key>DropTables</key>
		<array>
			<dict>
				<key>Signature</key>
				<string>SSDT</string>
				<key>TableId</key>
				<string>CpuPm</string>
			</dict>
		</array>

 

 

And see if you can boot, then we will do another steps!

Link to comment
Share on other sites

6 minutes ago, ammoune78 said:

 

Ok, let's start with your config, put the CpuSsdt i uploaded in the patched folder, remove plugin-type from the config and under ACPI Drop Tables add the following to the existing one:

 

  Hide contents


		<key>DropTables</key>
		<array>
			<dict>
				<key>Signature</key>
				<string>SSDT</string>
				<key>TableId</key>
				<string>CpuPm</string>
			</dict>
		</array>

 

 

And see if you can boot, then we will do another steps!

Yes, I can successfully boot in, using id=13. Here I attached files for you to check.

Thanks.

Step 1.zip

Link to comment
Share on other sites

2 minutes ago, twsps said:

Yes, I can successfully boot in, using id=13. Here I attached files for you to check.

Thanks.

Step 1.zip

 

Uncheck PluginType and then reboot:

 

Spoiler

866204972_ScreenShot2018-07-09at2_46_10PM.png.74c3ae6486c44ee02dbc6212d07b5294.png

 

Once done and you can boot without problem, remove the following from the patched folder:

 

Spoiler

1568669480_ScreenShot2018-07-09at2_56_36PM.png.ea9fcb72c5430399262b86a7c546f6c3.png

 

Then do the following with the latest clover configurator:

 

Spoiler

371670913_ScreenShot2018-07-09at3_02_20PM.png.a2fc6c75fc43ba1a24b7d3b7a4022ad5.png

 

Now see if you're able to boot!

Link to comment
Share on other sites

 

Uncheck PluginType and then reboot:

 

  Reveal hidden contents 866204972_ScreenShot2018-07-09at2_46_10PM.png.74c3ae6486c44ee02dbc6212d07b5294.png

 

Once done and you can boot without problem, remove the following from the patched folder:

 

  Reveal hidden contents https://www.insanelymac.com/applications/core/interface/imageproxy/imageproxy.php?img=&key=c17464ef1b1b51c7eb0b5b89a0af038b737118dc4bd88ab99825a65a517b2615[/img]1568669480_ScreenShot2018-07-09at2_56_36PM.png.ea9fcb72c5430399262b86a7c546f6c3.png

 

Then do the following with the latest clover configurator:

 

  Reveal hidden contents 371670913_ScreenShot2018-07-09at3_02_20PM.png.a2fc6c75fc43ba1a24b7d3b7a4022ad5.png

 

Now see if you're able to boot!

I'm able to boot, attached files.

Note: SSDT-XOSI is for brightness key fix, but I'm ok to remove now and try next step to find the problem

Thanks

 

Step 2.zip

 

 

Link to comment
Share on other sites

Ok, now check the following:

 

Spoiler

1078810168_ScreenShot2018-07-09at3_41_18PM.png.bf4e283ab361df05eb0afeedec181438.png

1331213593_ScreenShot2018-07-09at3_44_33PM.png.116778443a43c5917ea0aa7b1291a73c.png

1860648962_ScreenShot2018-07-09at3_47_56PM.png.3e9659834d4b373b7a10d0fa586bd59d.png 938242677_ScreenShot2018-07-09at3_52_55PM.png.7b4c18f5b25c11fff92ab997de93832b.png   1633524478_ScreenShot2018-07-09at3_57_16PM.png.4b5081a11e29fe7a2c5cf83227614c29.png

 

Now because of the DSDT already contain Layout ID 28 which was proposed by @pepito1, i added it into screenshot. And because of CpuSsdt already contain the required things for CPUPM, you can uncheck AppleIntelCPUPM like the screenshot. Then, you can go to KernelAndKextPatches, and under KernelToPatch add the following:

 

Spoiler

		<key>KernelToPatch</key>
		<array>
			<dict>
				<key>Comment</key>
				<string>MSR 0xE2 _xcpm_idle instant reboot(c) Pike R. Alpha</string>
				<key>Disabled</key>
				<false/>
				<key>Find</key>
				<data>
				ILniAAAADzA=
				</data>
				<key>Replace</key>
				<data>
				ILniAAAAkJA=
				</data>
			</dict>
		</array>

 

 

Reboot, and see if you can boot with the these options

Link to comment
Share on other sites

×
×
  • Create New...