Jump to content

Dual boot ACPI patch for I2C ( If (_OSI('Darwin'))


sudoali
 Share

3 posts in this topic

Recommended Posts

Hi,

I dual-booted Windows and Hackintosh, using OpenCore. But OpenCore will apply all dsdt patches and renames to all operating systems, including windows. So I need to edit my patches in a way that won't affect windows. The main problem is that the I2C patch has conflicts with windows.

To make I2C touchpad work in Hackintosh, I renamed the _CRS for TPD0 device in config.plist to XCRS and used below hotpatch to overwrite _CRS method. 

DSDT-I2C:

DefinitionBlock ("", "SSDT", 2, "hack", "I2C", 0x00000000)
{
    External (_SB_.PCI0.GPI0, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.I2C0.TPD0, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.I2C0.TPD0.SBFB, FieldUnitObj)    // (from opcode)
    External (_SB_.PCI0.I2C0.TPD0.XCRS, MethodObj)    // 0 Arguments (from opcode)

    Scope (_SB.PCI0.I2C0.TPD0)
    {
        Name (XBFG, ResourceTemplate ()
        {
            GpioInt (Level, ActiveLow, ExclusiveAndWake, PullDefault, 0x0000,
                "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer, ,
                )
                {   // Pin list
                    0x0052
                }
        })
        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            If (_OSI ("Darwin"))
            {
                Return (ConcatenateResTemplate (SBFB, XBFG))
            }

            Return (XCRS ())
        }
    }
}

DSDT-GPIO-GPHD:

Spoiler

DefinitionBlock ("", "SSDT", 2, "hack", "GPI0", 0x00000000)
{
    External (GPHD, FieldUnitObj)    // (from opcode)

    Scope (\)
    {
        If (_OSI ("Darwin"))
        {
            Store (Zero, GPHD)
        }
    }
}

 

also, I needed these two functions: SSCN and FMCN,

Spoiler

DefinitionBlock ("", "SSDT", 2, "hack", "_GPI0", 0x00000000)
{
    External (_SB_.PCI0.I2C0, DeviceObj)    // (from opcode)
    External (FMD0, UnknownObj)    // (from opcode)
    External (FMH0, UnknownObj)    // (from opcode)
    External (FML0, UnknownObj)    // (from opcode)
    External (SSD0, UnknownObj)    // (from opcode)
    External (SSH0, UnknownObj)    // (from opcode)
    External (SSL0, UnknownObj)    // (from opcode)

    Scope (_SB.PCI0.I2C0)
    {
        If (_OSI ("Darwin"))
        {
            Method (PKG3, 3, Serialized)
            {
                Name (PKG, Package (0x03)
                {
                    Zero, 
                    Zero, 
                    Zero
                })
                Store (Arg0, Index (PKG, Zero))
                Store (Arg1, Index (PKG, One))
                Store (Arg2, Index (PKG, 0x02))
                Return (PKG)
            }

            Method (SSCN, 0, NotSerialized)
            {
                Return (PKG3 (SSH0, SSL0, SSD0))
            }

            Method (FMCN, 0, NotSerialized)
            {
                Return (PKG3 (FMH0, FML0, FMD0))
            }
        }
    }
}

 

as you can see in the DSDT-I2C I tried to call the XCRS from the main DSDT if _OSI returns false for darwin. but still, I get error in windows device manager, and touchpad is not working.

is there something wrong with this approach? is there a way to use pinning in voodooI2C without conflict with windows?

Windows device manger error message:

This device cannot start. (Code 10)

A required I2C connection and/or interrupt resource was missing.

 

Edited by sudoali
Link to comment
Share on other sites

No, it's not driver related issue.

Sorry, I should have mentioned that I'm using OpenCore, and it will apply dsdt patches for all operating systems it is going to boot. So when I choose Windows Boot Loader from the bios boot menu and boot windows directly from it's own .efi bootloader, everything is fine. however, booting windows from OpenCore's menu, I get no touchpad.

2 hours ago, Hervé said:

ACPI patches compatible with Windows

So by this, I mean I have to edit all my DSDT patches in a way that would only affect macOS, and result in original DSDT for all other operating systems. pretty much like what they did in this DSL file, which will turn off dGPU for macOS but not other OSes.

Link to comment
Share on other sites

Well, I ended up copying content of the _CRS method from original DSDT and use it as below

If (_OSI ("Darwin"))
{
    Return (ConcatenateResTemplate (SBFB, XBFG)) // <- needed for gpio pinning
}
Else
{
    Return (ConcatenateResTemplate (SBFB, SBFI)) // <- from original DSDT 
}

not sure why calling XCRS() didn't work :unsure:

Link to comment
Share on other sites

 Share

×
×
  • Create New...