Jump to content

how to change DeviceProperties via ssdt?


NEOSoftWare
 Share

11 posts in this topic

Recommended Posts

Please help me how to change the device-id of a video card via ssdt

there is a video card r7 240 and it does not work without changing the device-id (you need to change it to 0x67981002 or 0x682B1002 or 0x683d1002)

I do everything according to the instructions given on dortania. (is it possible to indicate their link here?)

In Windows 10, in the properties of the graphics adapter in the "Local Path" I get the following results

Quote

ACPI(_SB_)#ACPI(PCI0)#ACPI(NPE3)#PCI(0000)
PCIROOT(0)#PCI(0200)#PCI(0000)

from the resulting one gets the path for ssdt

\_SB_.PCI0.NPE3

and I rule it in SSDT-GPU-SPOOF.dsl

Spoiler

// Based off of WhateverGreen's sample.dsl
// https://github.com/acidanthera/WhateverGreen/blob/master/Manual/Sample.dsl
DefinitionBlock ("", "SSDT", 2, "DRTNIA", "AMDGPU", 0x00001000)
{
    External (_SB_.PCI0, DeviceObj)
    External (_SB_.PCI0.NPE3, DeviceObj)


    Scope (\_SB_.PCI0.NPE3)
    {
        if (_OSI ("Darwin"))
        {
            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                Local0 = Package ()
                {
                    // Where we shove our FakeID
                    "device-id",
                    Buffer (0x04)
                    {
                        0xB0, 0x67, 0x00, 0x00
                    },

                    // Changing the name of the GPU reported, mainly cosmetic
                    "model",
                    Buffer ()
                    {
                        "AMD Radeon R7 240"
                    },

                    // test property
                    "test2",
                    Buffer (0x04)
                    {
                        0xB0, 0x67, 0x00, 0x00
                    }                    
                }
                DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                Return (Local0)
            }
        }
    }
    Scope (\_SB.PCI0)
    {                   
        Method (DTGP, 5, NotSerialized)
        {
            If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))
            {
                If (LEqual (Arg1, One))
                {
                    If (LEqual (Arg2, Zero))
                    {
                        Store (Buffer (One)
                            {
                                 0x03
                            }, Arg4)
                        Return (One)
                    }

                    If (LEqual (Arg2, One))
                    {
                        Return (One)
                    }
                }
            }

            Store (Buffer (One)
                {
                     0x00
                }, Arg4)
            Return (Zero)
        }
      
    }

}

I compile(MaciASL) - no errors - save as aml add to opencore, but changes are not applied,

3333.thumb.png.1fdc6b7488b2f40d9a2e80cb4452e170.png

 

and even the test key "test2" does not appear in the property list in IORegistryExplorer

Tried to get this one get devices via linux (debian) and in ".../firmware_node/path" there was already

Quote

\_SB_.PCI0.NPE7

 

I changed it to NPE7, but that didn't work either. Tell me how to do this?

 

In hackintool -> PCI -> VGA Adapter

Quote

IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/pci-bridge@2/IOPP/GFX0@0
PciRoot(0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)

 

Link to comment
Share on other sites

2 hours ago, Hervé said:

Why would you try to inject properties under ACPI device NPEx that does not appear to exist (at least for your graphics card) when IOReg shows the correct ACPI device to be GFX0 ? All you'd need to inject under device GFX0 @2,0 would be a DSM method with the desired device id value:

 I am very weak in this, I did as it is written in the instructions

For your example, see if I created the ssdt correctly?

Spoiler

DefinitionBlock ("", "SSDT", 2, "DRTNIA", "AMDGPU", 0x00001000)
{
    External (_SB_.PCI0, DeviceObj)


    Scope (\_SB_.PCI0)
    {
            Device (PEGP)
            {
                Name (_ADR, 0x00020000)
            
                Device (GFX0)
                {
                    Name (ADR, Zero)
            
                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                    {
                        If (!Arg2)
                        {
                            Return (Buffer (One)
                            {
                                 0x03
                            })
                        }
            
                        Return (Package (0x02)
                        {
                            "device-id",
                            Buffer (0x4)
                            {
                                0x98, 0x67, 0x00, 0x00     // or 0x2b, 0x68, 0x00, 0x00 or 0x3d, 0x68, 0x00, 0x00
                            }
                        })
            
                    }
                }
            }
    }
}

Probably it is not correct and I was mistaken about something, since it does not work

 

2 hours ago, Hervé said:

But one has to wonder why you'd fake the device id through SSDT when your boot loader config supports that much easier:


Location: PciRoot(0x0)/Pci(0x2,0x0)/Pci(0x0)
Property: device-id        98670000     DATA     (or 2b680000 or 3d680000)

where device-id (without vendor-id) is specified in revere byte order.

Unfortunately, this worked fine in Catalina, in BigSur it no longer works, I cannot change the existing fields, but only add new ones

<key>DeviceProperties</key>
<dict>
    <key>Add</key>
    <dict>
        <key>PciRoot(0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)</key>
        <dict>
            <key>device-id</key>
            <data>
            mGcAAA==
            </data>
            <key>device-id-test</key>
            <data>
            AQAAAA==
            </data>
        </dict>
    </dict>
</dict>

When looking at IORegistryExplorer I get

157439190_2021-08-0311_35_19.png.718c4b24b6231e1155b0643747aabab9.png

 

Link to comment
Share on other sites

2 hours ago, Hervé said:

Your SSDT looks fine but I had made a typo for GFX0; the IO location statement must be:


Name (_ADR, Zero)     // Underscore character "_" before ADR

It helped, thanks.
But those device-id that I found (0x67981002 or 0x682B1002 or 0x683d1002) give a black screen and the computer reboots, I began to select the identifier, I took from the Radeon R7 260X / 360 - 0x6658, still 7MB of video memory, but I see no IORegistryExplorer <58 66 00 00> a <Xf>, This is fine?

1146918683_2021-08-0400_58_35.thumb.png.3188a32e06f774ee60bee632e8633913.png

 

Link to comment
Share on other sites

3 hours ago, Hervé said:

Double check that you did not make a typo in your SSDT.

Could you take a professional look, maybe I did something wrong?

Spoiler

DefinitionBlock ("", "SSDT", 2, "DRTNIA", "AMDGPU", 0x00001000)
{
    External (_SB_.PCI0, DeviceObj)

    Scope (\_SB.PCI0)
    {
        Device (PEGP)
        {
            Name (_ADR, 0x00020000)  // _ADR: Address
            Device (GFX0)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                {
                    If (!Arg2)
                    {
                        Return (Buffer (One)
                        {
                             0x03                                           
                        })
                    }

                    Return (Package (0x02)
                    {
                        "device-id", 
                        Buffer (0x04)
                        {
                             0x58, 0x66, 0x00, 0x00                           
                        }
                    })
                }
            }
        }
    }
}
 

 

Link to comment
Share on other sites

35 minutes ago, Hervé said:

Certainly looks Ok. What are you using  to compile your SSDT? What app, what version?

MaciASL 1.5.9

 

35 minutes ago, Hervé said:

Return (Package (0x02) { "compatible", "pci1002,xxxx" // where xxxx is the desired device id })

did not help (

Link to comment
Share on other sites

If/when you run out of ideas you might want to try this one.

DefinitionBlock ("", "SSDT", 2, "HACK", "SSDTGPU", 0x00001000)
{
    External (_SB_.PCI0, DeviceObj)
    External (_SB_.PCI0.NPE3, DeviceObj)
    External (_SB_.PCI0.NPE3.GFX0, DeviceObj)

    Scope (\_SB.PCI0)
    {
        Scope (NPE3)
        {
            Scope (GFX0)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
                {
                    If (LNot (Arg2))
                    {
                        Return (Buffer (One)
                        {
                             0x03                                             
                        })
                    }

                    Return (Package (0x02)
                    {
                        "device-id", 
                        Buffer (0x04)
                        {
                             0x58, 0x66, 0x00, 0x00
                        }
                    })
                }
            }
        }
    }
}

Not sure about NPE3, if it doesn’t work change it to PEG0.

EDIT: Misprint corrected.

Edited by hardcorehenry
Link to comment
Share on other sites

30 minutes ago, Hervé said:

What guessing from IOREg and borked SSDT are you referring to?

From OP.

 

32 minutes ago, Hervé said:

Anyway, if any device renaming were required in the SSDT I suggested above, then it would simply consist of:

  1. changing PEGP to PEG0
  2. changing GFX0 to PEGP

 

 

And what did I suggested?

Spoiler

795978722_ScreenShot2021-08-04at11_08_51PM.thumb.png.99ef24e21e405855f7411811d9b1fceb.png

 

Link to comment
Share on other sites

  • 2 weeks later...
On 8/5/2021 at 12:32 AM, Hervé said:

Your suggested SSDT missed 2 x critical elements: the IO address of the PCI bridge and the fact that you're referring to non-existing external objects... That's what I've been trying to tell you. Whether you called it NPE3 or PEG0, that device does not exist by default in IO of OP's computer so you need to define a PCI bridge device (since it clearly shows in IOReg) and if you forget to declare/define its address, you're just shooting into vacuum.

you are absolutely right, if you do not specify the address, then the value of the properties will not be attached to anything

 

 

Still do not tell me how you can do if I put a device with "device-id" == <13 66 00 00> then only in this case it was changed to <98 67 00 00>?

Link to comment
Share on other sites

 

2 hours ago, NEOSoftWare said:

you are absolutely right, if you do not specify the address, then the value of the properties will not be attached to anything

 

Yeah, right. In my custom SSDT-GPU there is no specified address and fake device-id is injected correctly, unless your case is special…

 

Spoiler

304985002_ScreenShot2021-08-15at2_39_34PM.thumb.png.68788d8d157070b138be61a60f4dc1e9.png

 

Edited by hardcorehenry
Link to comment
Share on other sites

2 minutes ago, hardcorehenry said:

Yeah, right. In my custom SSDT-GPU there is no specified address and fake device-id is injected correctly, unless your case is special…

maybe you have an address for these devices registered in the main DSDT?
Because it does not work for me without an address (I tried it on 2 boards, huanan and asus x79)

Link to comment
Share on other sites

 Share

×
×
  • Create New...