CloverHackyColor / CloverBootloader

Bootloader for macOS, Windows and Linux in UEFI and in legacy mode
BSD 2-Clause "Simplified" License
4.5k stars 618 forks source link

SSDT injection of simple Device Names fails partially - Firmware to blame? #178

Closed mackonsti closed 4 years ago

mackonsti commented 4 years ago

Hi @asava and @vectorsigma72 I hope you are well all and safe, I address to you as I wanted to ask for your advice and report a possible injection bug.

For many Clover revisions now, including the one running on my Intel NUC8i7BEH computer today (r5107 and Mojave) I have not been able to inject some simple Devices Names (just the names, so they populate hardware by name the IOReg) which is weird as they do exist (per lspci -nn) and do appear in the IOReg as entries; they just don't have "names".

I have opened-up (decompiled) the DSDT and SSDTs of the computer (via MaciASL) and there is nowhere to be found their address that could potentially be in conflict with an existing Device Name in the DSDT already. Nor is there a Variable with the same name. However, part of the SSDT is not injected correctly...

I tried different syntax like Scope (_SB.PCI0) or Scope (\_SB.PCI0) or direct entry Device (\_SB.PCI0.SRAM) etc. but to no avail for some devices; they still appear as pci8086,9def@14,2 for example.

Note that I do not wish to use a patched DSDT as it's a painful story, specially for Coffee Lake computers (way to big!)

The SSDT currently loaded in Clover is the following:

DefinitionBlock ("SSDT-OTHER.aml", "SSDT", 2, "Clover", "OTHER", 0x00000000)
{
    External (_SB_.PCI0, DeviceObj)

    Scope (\_SB.PCI0)
    {
//      Device (MCHC)  // Intel Corporation Host Bridge/DRAM Registers [8086:3ed0]
//      {
//          Name (_ADR, 0x00000000)
//      }

        Device (PGMM)  // Intel Corporation Core Processor Gaussian Mixture Model [8086:1911]
        {
            Name (_ADR, 0x00080000)
        }

        Device (SRAM)  // Intel Corporation Coffee Lake Shared SRAM [8086:9def]
        {
            Name (_ADR, 0x00142000)
        }

        Device (XSPI)  // Intel Corporation Coffee Lake Serial Bus SPI Controller [8086:9da4]
        {
            Name (_ADR, 0x001F5000)

            Method (_DSM, 4, NotSerialized)
            {
                If ((Arg2 == Zero))
                {
                    Return (Buffer (One) {0x03})
                }

                Return (Package (0x02)
                {
                    "pci-device-hidden", Buffer (0x08) {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
                })
            }
        }
    }
} 

What is interesting is that PGMM for example loads just fine, so did MCHC (but I chose the Clover option instead). However, both other devices at _ADR 0x00142000 and 0x001F5000 can in no way be injected:

Some Devices Not Named I tried various syntax styles as mentioned, even a direct entry Device (\_SB.PCI0.SRAM) without External (_SB_.PCI0, DeviceObj) of course, but with no results.

I believe you can see the problem. I do not enable DropOEM etc. as some tables are needed and my Clover options are rather straightforward.

Based on your richer experience, would you have any idea why would an injected SSDT be partially working? Is there anything I can report back that would possibly block the injection, at no Clover's fault? The 2 devices exist as you can see; it's just not possible to assign a human Name per SSDT injection...

Right now, these devices do not seem to be needed or offering some functionally but it's been bugging me for so long that I wanted to ask you guys. Many warm thanks!

mackonsti commented 4 years ago

Hi everyone, after years on the Hackintosh hobby, I am still learning. I was browsing the SSDT patches shared by https://github.com/jsassu20/OpenCore-HotPatching-Guide and saw that device XSPI was declared wrongly on my SSDT <facepalm>

The following corrected SSDT works and loads and devices now appear with respective names. Sorry again for posting this.

DefinitionBlock ("SSDT-OTHER.aml", "SSDT", 2, "Clover", "OTHER", 0x00000000)
{
    External (_SB_.PCI0, DeviceObj)

    Scope (\_SB.PCI0)
    {
//      Device (MCHC)  // Intel Corporation Host Bridge/DRAM Registers [8086:3ed0]
//      {
//          Name (_ADR, 0x00000000)
//      }

        Device (PGMM)  // Intel Corporation Core Processor Gaussian Mixture Model [8086:1911]
        {
            Name (_ADR, 0x00080000)
        }

//      Device (THRM)  // Intel Corporation Coffee Lake Thermal Controller [8086:9df9]
//      {
//          Name (_ADR, 0x00120000)
//      }

        Device (SRAM)  // Intel Corporation Coffee Lake Shared SRAM [8086:9def]
        {
            Name (_ADR, 0x00140002)
        }

        Device (XSPI)  // Intel Corporation Coffee Lake Serial Bus SPI Controller [8086:9da4]
        {
            Name (_ADR, 0x001F0005)

            Method (_DSM, 4, NotSerialized)
            {
                If ((Arg2 == Zero))
                {
                    Return (Buffer (One) {0x03})
                }

                Return (Package (0x02)
                {
                    "pci-device-hidden", Buffer (0x08) {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
                })
            }
        }
    }
}

So instead of Name (_ADR, 0x001F5000) it should be Name (_ADR, 0x001F0005). It's lspci that mislead me... and IORegistryExplorer didn't show any reference to the address to make me think twice!

Thank you again for all your continuing effort on improving Clover despite the "new kid in the block" (OpenCore) :-)