Ami Aptio firmware (UEFI) dsdt firmware mod

Discussion in 'BIOS Mods' started by XpamAmAdEuS, Aug 13, 2013.

  1. nexus76

    nexus76 MDL Addicted

    Jan 25, 2009
    788
    300
    30
    #41 nexus76, Aug 25, 2013
    Last edited: Aug 25, 2013
    thanks, I integrated also hermitshell, but do you know how to access it?
    loading patched DSDT.aml from root does not work, or do you think a patched DSDT can be loaded via kernel flags too?
    the args can be set with

    sudo nvram boot-args="dart=0 DSDT=DSDT.aml"

    but DSDT is not loaded by the bootargs.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. nexus76

    nexus76 MDL Addicted

    Jan 25, 2009
    788
    300
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. XpamAmAdEuS

    XpamAmAdEuS MDL Novice

    Oct 24, 2009
    46
    15
    0
    Yes u must have GPT for this to work right way.
     
  4. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    #45 Protocol7, Sep 12, 2013
    Last edited by a moderator: Apr 20, 2017
    I never had to consider Windows in my OS X DSDT fixes before but if I wanted to insert my fixed DSDT back into my BIOS I'll need to redo the edits to include this OS check. But I'm not that savvy when it comes to DSDT editing. I've mostly just used patches other people have written.

    If I could get one clear example of how to implement this I should be OK. Here's one of my USB patches before and after (the injected code is bolded in the bottom).

    Before:
    Code:
                Device (EUSB)
                {
                    Name (_ADR, 0x001D0000)
                    Name (_S4D, 0x02)
                    Name (_S3D, 0x02)
                    Name (_S2D, 0x02)
                    Name (_S1D, 0x02)
                    Device (HUBN)
                    {
                        Name (_ADR, Zero)
                        Device (PR10)
                        {
                            Name (_ADR, One)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF, 
                                Zero, 
                                Zero, 
                                Zero
                            })
                            Name (_PLD, Buffer (0x10)
                            {
                                /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                /* 0008 */    0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                            })
                            Device (PR30)
                            {
                                Name (_ADR, One)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR31)
                            {
                                Name (_ADR, 0x02)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR32)
                            {
                                Name (_ADR, 0x03)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR33)
                            {
                                Name (_ADR, 0x04)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR34)
                            {
                                Name (_ADR, 0x05)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR35)
                            {
                                Name (_ADR, 0x06)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR36)
                            {
                                Name (_ADR, 0x07)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB0, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR37)
                            {
                                Name (_ADR, 0x08)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                        }
                    }
                }
    After:
    Code:
                Device (EUSB)
                {
                    Name (_ADR, 0x001D0000)
                    Name (_S4D, 0x02)
                    Name (_S3D, 0x02)
                    Name (_S2D, 0x02)
                    Name (_S1D, 0x02)
                    Device (HUBN)
                    {
                        Name (_ADR, Zero)
                        Device (PR10)
                        {
                            Name (_ADR, One)
                            Name (_UPC, Package (0x04)
                            {
                                0xFF, 
                                Zero, 
                                Zero, 
                                Zero
                            })
                            Name (_PLD, Buffer (0x10)
                            {
                                /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                /* 0008 */    0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                            })
                            Device (PR30)
                            {
                                Name (_ADR, One)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR31)
                            {
                                Name (_ADR, 0x02)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR32)
                            {
                                Name (_ADR, 0x03)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR33)
                            {
                                Name (_ADR, 0x04)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xE1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR34)
                            {
                                Name (_ADR, 0x05)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR35)
                            {
                                Name (_ADR, 0x06)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR36)
                            {
                                Name (_ADR, 0x07)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB0, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                            Device (PR37)
                            {
                                Name (_ADR, 0x08)
                                Name (_UPC, Package (0x04)
                                {
                                    0xFF, 
                                    0xFF, 
                                    Zero, 
                                    Zero
                                })
                                Name (_PLD, Buffer (0x10)
                                {
                                    /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                    /* 0008 */    0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                })
                            }
                        }
                    }
                    Method (_DSM, 4, NotSerialized)
                                    {
                                        Store (Package ()
                                           {
                                            "AAPL,current-available",
                                            0x0834,
                                            "AAPL,current-extra",
                                            0x0A8C,
                                            "AAPL,current-extra-in-sleep",
                                            0x0A8C,
                                            "AAPL,max-port-current-in-sleep",
                                            0x0834,
                                            "AAPL,device-internal",
                                            0x02,
                                            Buffer (0x01)
                                            {
                                                0x00
                                            }
                                            }, Local0)
                                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                                        Return (Local0)
                                    }
                }
    Could you show me how to add the OS check to this? There's also a lot of device renaming going on (like COPR to MATH, IDE1 to SATA).
     
  5. LatinMcG

    LatinMcG Bios Borker

    Feb 27, 2011
    5,711
    1,606
    180
    #46 LatinMcG, Sep 13, 2013
    Last edited by a moderator: Apr 20, 2017
    thats a tough one due to it being an addition to dsdt rather a return value
    so likely (never tested)
    Code:
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                                        Return (Local0)
    to
    Code:
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                                        here if osid windows (depending on your dsdt _OSI identification scheme.. not actual code to be used)
                                        return 0
                                        else (if osid not windows)
                                        Return (Local0)
    prety much u want to break the return local 0 if its windows... if its osx it returns local0 rather than 0.. or return One ?

    the brazilians at olarilla can likely help in the chat and pastebin
     
  6. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    #47 Protocol7, Sep 13, 2013
    Last edited by a moderator: Apr 20, 2017
    Thanks that did the trick! Replacing
    Code:
    Return (Local0)
    with
    Code:
    If (LGreater (OSYS, 0x07D0))
                                            {
                                                Return (Zero)
                                            }
                                            Else
                                            {
                                                Return (Local0)
                                            }
    only injects the code in OS X. I tested this by swapping the return values and rebooting OS X. With the values swapped the injection didn't happen because the DSDT was returning zero.

    That takes care of the injections. Now I just have to see how to apply it to other things like device labels. But I should be on the right track now. Thanks for the help!
     
  7. LatinMcG

    LatinMcG Bios Borker

    Feb 27, 2011
    5,711
    1,606
    180
    u can apply that to HPET _STA also.
    just post the code u modded and well see if it can be done one way or another.



    im on the hunt for a macbookpro 9,x EMC 2554 MX25L640E backup.bin (flashrom) i doubt ill find it and have to backup from another laptop myself
     
  8. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    #49 Protocol7, Sep 13, 2013
    Last edited by a moderator: Apr 20, 2017
    I've tidied this up a little. I've added OS X to the OSI list:

    Code:
    If (_OSI ("Darwin"))
                     {
                         Store (0x2710, OSYS)
                     }
    And added the same OS X detection function that Apple use in their firmwares:

    Code:
    Method (OSDW, 0, NotSerialized)
            {
                If (LEqual (OSYS, 0x2710))
                {
                    Return (One)
                }
                Else
                {
                    Return (Zero)
                }
            }
    So I now have If (OSDW ()) in place of If (LGreater (OSYS, 0x07D0)).

    The trickiest patch to figure out is the JMB362 eSATA one as it replaces the entire device entry. Here's the original BIOS code:
    Code:
    Device (JMB0)
                    {
                        Name (_ADR, Zero)
                        OperationRegion (CF40, PCI_Config, 0x40, 0x04)
                        Field (CF40, ByteAcc, NoLock, Preserve)
                        {
                            CHE0,   1, 
                            MULT,   1, 
                                ,   1, 
                            CAB0,   1, 
                            CHE1,   1, 
                                    Offset (0x01), 
                            AHEN,   1, 
                                ,   3, 
                            PRT0,   1, 
                            AHM0,   1, 
                            PRT1,   1, 
                            AHM1,   1, 
                            CF42,   6, 
                            SWAP,   1, 
                            PATA,   1, 
                                ,   6, 
                            WTEN,   1, 
                                    Offset (0x04)
                        }
                        Name (PIOT, Package (0x05)
                        {
                            0x0258, 
                            0x0186, 
                            0x014A, 
                            0xB4, 
                            0x78
                        })
                        Name (UDMA, Package (0x07)
                        {
                            0x78, 
                            0x50, 
                            0x3C, 
                            0x28, 
                            0x1E, 
                            0x14, 
                            0x0F
                        })
                        Name (MDMA, Package (0x03)
                        {
                            0x01E0, 
                            0x96, 
                            0x78
                        })
                        Name (IDEB, Buffer (0x14) {})
                        CreateDWordField (IDEB, Zero, GTM0)
                        CreateDWordField (IDEB, 0x04, GTM1)
                        CreateDWordField (IDEB, 0x08, GTM2)
                        CreateDWordField (IDEB, 0x0C, GTM3)
                        CreateDWordField (IDEB, 0x10, GTM4)
                        Name (PIO0, 0x04)
                        Name (DMA0, 0x06)
                        Name (MDA0, 0x02)
                        Name (PIO1, 0x04)
                        Name (DMA1, 0x06)
                        Name (MDA1, 0x02)
                        Name (PIO2, 0x04)
                        Name (DMA2, 0x06)
                        Name (MDA2, 0x02)
                        Name (PIO3, 0x04)
                        Name (DMA3, 0x06)
                        Name (MDA3, 0x02)
                        Name (FLGP, 0x1F)
                        Name (FLGS, 0x1F)
                        Device (IDE0)
                        {
                            Name (_ADR, Zero)
                            Method (_GTM, 0, NotSerialized)
                            {
                                Store (DerefOf (Index (PIOT, PIO0)), Local0)
                                Store (DerefOf (Index (PIOT, PIO1)), Local2)
                                Store (0x1A, Local4)
                                If (LAnd (FLGP, One))
                                {
                                    If (LNot (MULT))
                                    {
                                        If (LAnd (CAB0, SWAP))
                                        {
                                            Store (0x02, DMA0)
                                        }
                                    }
                                    Store (DerefOf (Index (UDMA, DMA0)), Local1)
                                    Or (Local4, One, Local4)
                                }
                                Else
                                {
                                    Store (DerefOf (Index (MDMA, MDA0)), Local1)
                                }
                                If (LAnd (FLGP, 0x04))
                                {
                                    If (LAnd (CAB0, SWAP))
                                    {
                                        Store (0x02, DMA1)
                                    }
                                    Store (DerefOf (Index (UDMA, DMA1)), Local3)
                                    Or (Local4, 0x04, Local4)
                                }
                                Else
                                {
                                    Store (DerefOf (Index (MDMA, MDA1)), Local3)
                                }
                                Store (Local0, GTM0)
                                Store (Local1, GTM1)
                                Store (Local2, GTM2)
                                Store (Local3, GTM3)
                                Store (Local4, GTM4)
                                Return (IDEB)
                            }
                            Method (_STM, 3, NotSerialized)
                            {
                                Store (Arg0, IDEB)
                                Store (GTM0, Local0)
                                Store (GTM1, Local1)
                                Store (GTM2, Local2)
                                Store (GTM3, Local3)
                                Store (GTM4, Local4)
                                Store (Local4, FLGP)
                                If (LAnd (LNotEqual (Local0, 0xFFFFFFFF), LNotEqual (Local0, Zero)))
                                {
                                    Store (Match (PIOT, MEQ, Local0, MTR, Zero, Zero), PIO0)
                                }
                                If (LAnd (LNotEqual (Local1, 0xFFFFFFFF), LNotEqual (Local1, Zero)))
                                {
                                    If (LAnd (FLGP, One))
                                    {
                                        Store (Match (UDMA, MEQ, Local1, MTR, Zero, Zero), DMA0)
                                    }
                                    Else
                                    {
                                        Store (Match (MDMA, MEQ, Local1, MTR, Zero, Zero), MDA0)
                                    }
                                }
                                If (LAnd (LNotEqual (Local2, 0xFFFFFFFF), LNotEqual (Local2, Zero)))
                                {
                                    Store (Match (PIOT, MEQ, Local2, MTR, Zero, Zero), PIO1)
                                }
                                If (LAnd (LNotEqual (Local3, 0xFFFFFFFF), LNotEqual (Local3, Zero)))
                                {
                                    If (LAnd (FLGP, 0x04))
                                    {
                                        Store (Match (UDMA, MEQ, Local3, MTR, Zero, Zero), DMA1)
                                    }
                                    Else
                                    {
                                        Store (Match (MDMA, MEQ, Local3, MTR, Zero, Zero), MDA1)
                                    }
                                }
                            }
                            Device (DRV0)
                            {
                                Name (_ADR, Zero)
                                Method (_GTF, 0, NotSerialized)
                                {
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xEF
                                        }, Local0)
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xEF
                                        }, Local1)
                                    CreateByteField (Local0, One, PIOM)
                                    CreateByteField (Local1, One, DMAM)
                                    Store (PIO0, PIOM)
                                    Or (PIOM, 0x08, PIOM)
                                    If (LAnd (FLGP, One))
                                    {
                                        Store (DMA0, DMAM)
                                        Or (DMAM, 0x40, DMAM)
                                    }
                                    Else
                                    {
                                        Store (MDA0, DMAM)
                                        Or (DMAM, 0x20, DMAM)
                                    }
                                    Concatenate (Local0, Local1, Local2)
                                    Return (Local2)
                                }
                            }
                            Device (DRV1)
                            {
                                Name (_ADR, One)
                                Method (_GTF, 0, NotSerialized)
                                {
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xEF
                                        }, Local0)
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xEF
                                        }, Local1)
                                    CreateByteField (Local0, One, PIOM)
                                    CreateByteField (Local1, One, DMAM)
                                    Store (PIO1, PIOM)
                                    Or (PIOM, 0x08, PIOM)
                                    If (LAnd (FLGP, 0x04))
                                    {
                                        Store (DMA1, DMAM)
                                        Or (DMAM, 0x40, DMAM)
                                    }
                                    Else
                                    {
                                        Store (MDA1, DMAM)
                                        Or (DMAM, 0x20, DMAM)
                                    }
                                    Concatenate (Local0, Local1, Local2)
                                    Return (Local2)
                                }
                            }
                        }
                        Device (IDE1)
                        {
                            Name (_ADR, One)
                            Method (_GTM, 0, NotSerialized)
                            {
                                Store (DerefOf (Index (PIOT, PIO2)), Local0)
                                Store (DerefOf (Index (PIOT, PIO3)), Local2)
                                Store (0x1A, Local4)
                                If (LAnd (FLGS, One))
                                {
                                    If (LNot (MULT))
                                    {
                                        If (LAnd (CAB0, LNot (SWAP)))
                                        {
                                            Store (0x02, DMA2)
                                        }
                                    }
                                    Store (DerefOf (Index (UDMA, DMA2)), Local1)
                                    Or (Local4, One, Local4)
                                }
                                Else
                                {
                                    Store (DerefOf (Index (MDMA, MDA2)), Local1)
                                }
                                If (LAnd (FLGS, 0x04))
                                {
                                    If (LAnd (CAB0, LNot (SWAP)))
                                    {
                                        Store (0x02, DMA3)
                                    }
                                    Store (DerefOf (Index (UDMA, DMA3)), Local3)
                                    Or (Local4, 0x04, Local4)
                                }
                                Else
                                {
                                    Store (DerefOf (Index (MDMA, MDA3)), Local3)
                                }
                                Store (Local0, GTM0)
                                Store (Local1, GTM1)
                                Store (Local2, GTM2)
                                Store (Local3, GTM3)
                                Store (Local4, GTM4)
                                Return (IDEB)
                            }
                            Method (_STM, 3, NotSerialized)
                            {
                                Store (Arg0, IDEB)
                                Store (GTM0, Local0)
                                Store (GTM1, Local1)
                                Store (GTM2, Local2)
                                Store (GTM3, Local3)
                                Store (GTM4, Local4)
                                Store (Local4, FLGS)
                                If (LAnd (LNotEqual (Local0, 0xFFFFFFFF), LNotEqual (Local0, Zero)))
                                {
                                    Store (Match (PIOT, MEQ, Local0, MTR, Zero, Zero), PIO2)
                                }
                                If (LAnd (LNotEqual (Local1, 0xFFFFFFFF), LNotEqual (Local1, Zero)))
                                {
                                    If (LAnd (FLGS, One))
                                    {
                                        Store (Match (UDMA, MEQ, Local1, MTR, Zero, Zero), DMA2)
                                    }
                                    Else
                                    {
                                        Store (Match (MDMA, MEQ, Local1, MTR, Zero, Zero), MDA2)
                                    }
                                }
                                If (LAnd (LNotEqual (Local2, 0xFFFFFFFF), LNotEqual (Local2, Zero)))
                                {
                                    Store (Match (PIOT, MEQ, Local2, MTR, Zero, Zero), PIO3)
                                }
                                If (LAnd (LNotEqual (Local3, 0xFFFFFFFF), LNotEqual (Local3, Zero)))
                                {
                                    If (LAnd (FLGS, 0x04))
                                    {
                                        Store (Match (UDMA, MEQ, Local3, MTR, Zero, Zero), DMA3)
                                    }
                                    Else
                                    {
                                        Store (Match (MDMA, MEQ, Local3, MTR, Zero, Zero), MDA3)
                                    }
                                }
                            }
                            Device (DRV0)
                            {
                                Name (_ADR, Zero)
                                Method (_GTF, 0, NotSerialized)
                                {
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xEF
                                        }, Local0)
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xEF
                                        }, Local1)
                                    CreateByteField (Local0, One, PIOM)
                                    CreateByteField (Local1, One, DMAM)
                                    Store (PIO2, PIOM)
                                    Or (PIOM, 0x08, PIOM)
                                    If (LAnd (FLGS, One))
                                    {
                                        Store (DMA2, DMAM)
                                        Or (DMAM, 0x40, DMAM)
                                    }
                                    Else
                                    {
                                        Store (MDA2, DMAM)
                                        Or (DMAM, 0x20, DMAM)
                                    }
                                    Concatenate (Local0, Local1, Local2)
                                    Return (Local2)
                                }
                            }
                            Device (DRV1)
                            {
                                Name (_ADR, One)
                                Method (_GTF, 0, NotSerialized)
                                {
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xEF
                                        }, Local0)
                                    Store (Buffer (0x07)
                                        {
                                            0x03, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xEF
                                        }, Local1)
                                    CreateByteField (Local0, One, PIOM)
                                    CreateByteField (Local1, One, DMAM)
                                    Store (PIO3, PIOM)
                                    Or (PIOM, 0x08, PIOM)
                                    If (LAnd (FLGS, 0x04))
                                    {
                                        Store (DMA3, DMAM)
                                        Or (DMAM, 0x40, DMAM)
                                    }
                                    Else
                                    {
                                        Store (MDA3, DMAM)
                                        Or (DMAM, 0x20, DMAM)
                                    }
                                    Concatenate (Local0, Local1, Local2)
                                    Return (Local2)
                                }
                            }
                        }
                    }
    And here's the hackintosh code:
    Code:
    Device (JMB0)
                    {
                        Name (_ADR, Zero)
                        OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                        Field (BAR0, WordAcc, NoLock, Preserve)
                        {
                            M1,     8,
                            M2,     8,
                            M3,     8
                        }
                        Method (_DSM, 4, NotSerialized)
                        {
                            Store (0xB3, M1)
                            Store (0xA1, M2)
                            Store (0xC2, M3)
                            Store (Package (0x02)
                                {
                                    "name",
                                    Buffer (0x15)
                                    {
                                        "JMicron JMB362 eSATA"
                                    }
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }
                    }
    The hackintosh entry is completely different so nothing from the original code can be reused.

    Sorry I can't help with the MBP firmware. I don't have access to any Macs other than my own.
     
  9. LatinMcG

    LatinMcG Bios Borker

    Feb 27, 2011
    5,711
    1,606
    180
    #50 LatinMcG, Sep 14, 2013
    Last edited by a moderator: Apr 20, 2017
    likely have to make a fake subdevices with ADR Zero. and next dev ADR One but im not sure on this oe. akes brainstorming and lots of examples

    JMBW for Win and JMB0 for Osx ?
    turn on and off with STA return Zero instead of 0x0F ?
    need to test if windows will load driver for new JMBW

    theres many ways it can be done i think
    similar to how Device HPET is enabled or disabled ?
    or method EJT ?

    or even usin INI or PINI method to inject the regs with OSDW check on top of regs
    Code:
    Device (JMB0)
                    {
                        Name (_ADR, Zero)
                        OperationRegion (BAR0, PCI_Config, 0x40, 0x04)
                        Field (BAR0, WordAcc, NoLock, Preserve)
                        {
                       If (LEqual (OSYS, 0x2710))
                        {
                            M1,     8,
                            M2,     8,
                            M3,     8
                         }
                        }
                        Method (_DSM, 4, NotSerialized)
                        {
                       If (LEqual (OSYS, 0x2710))
                        {
                            Store (0xB3, M1)
                            Store (0xA1, M2)
                            Store (0xC2, M3)
                            Store (Package (0x02)
                                {
                                    "name",
                                    Buffer (0x15)
                                    {
                                        "JMicron JMB362 eSATA"
                                    }
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                         }
                        }
                    }
    u could probably merge the codes to detect.
     
  10. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    A lot of that has gone over my head to be honest. But it's good to know that there should be some way to do it. Ideally I'd like to be able to boot Windows with the DSDT totally stock.

    I've attached my DSDT and the patch file I'm working with (I load this into DSDTEditor and patch everything in one go). This way you can see what I'm seeing.
     

    Attached Files:

  11. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    Hi XpamAmAdEuS

    I've already checked that one. I've used it and a MacPro5,1 DSDT for reference. But there's very little of use in the QUO DSDT (unless it's staring me in the face and I'm just not seeing it).

    In most cases the hackintosh fixes (like HPET IRQs) are hard-set so they'll also be applied in Windows. I'm guessing a lot of these won't have any adverse effects in Windows but it would be nice to know how to apply the OS check to as many of the hackintosh tweaks as possible so the Windows side can be left as untouched as possible.
     
  12. öbus

    öbus MDL Novice

    Sep 5, 2009
    4
    0
    0
    Hi Yen!

    I have been following this thread for a while because I've been trying to mod my edited DSDT for putting it into my bios together with ozmosis boot loader. I have been struggling with this for more than a week without any success and now I'm giving up. Could you please advise me or help me to make it happen. My DSDT seems to be bigger in size than the original and not smaller like it was in in theXpamAmAdEuS case. I'm just a noob so don't make it to hard for me. It should be really nice if you could help me in some way.:popcorn:

    What do you need from me?

    Regards
    öbus
     
  13. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    #55 Protocol7, Nov 9, 2013
    Last edited: Nov 9, 2013
    Hi öbus

    While you wait for Yen to post some help I should update my situation here. I decided to insert my edited DSDT minus the JMB fix to see if everything would work ok. Well, it didn't. I reckon I'd changed too much as the flash failed to complete (it hung near the end in EZ Flash 2). Left me with a mobo that wouldn't post and the "CrashFree" feature didn't work for recovery. So I ended up buying a eeprom programmer and used that to reflash the BIOS chip. I'm a lot more confident flashing my BIOS now knowing I have that if anything goes wrong. I'd recommend anyone who is doing this stuff to own one.

    So I looked at my patch and removed everything "non-essential" from it. All the device renames are gone as are most of the devices I removed to free up space. I only had to remove the JMB1 device to make up enough space to hold all my other edits. There's only one eSATA port on the board so JMB1 isn't even used. I integrated that DSDT and all my edits are working fine. I just have to go without eSATA in OS X because I never found out how to integrate that JMB patch.

    I only have a small amount of space left in my DSDT so I'll need to remove more devices if I do want to add more edits later so I'm also interested in knowing what devices are safe to remove in a desktop board. There are DOCK and BAT devices that sound like they're more laptop-oriented.
     
  14. öbus

    öbus MDL Novice

    Sep 5, 2009
    4
    0
    0
    Hi Protocol7.
    I will try to explain my specific problem. My mobo has dual bios so I can afford to make mistake as long as I don't screw up booth.
    My mobo is a Gigabyte Z77X UP5 TH which is quite similar to the one XpamAmAdEuS is refereeing to and the one that Yen was helping him to edit in Phoenixtool earlier in this thread. The only difference between my mobo and XP:s Z77X UD5 is that mine has dual thunderbolt and only one networkcard (Realtek) instead of two networkcard (Atheros and Realtek) and none thunderbolt in the UD5 mobo.
    I decided to try to just swap Xp:s DSDT table in the AmiBoardInfo module from the one Yen injected with success in Xp:s bios with my own edited DSDT. So i did that with Phoenixtool 2.18 with succsess.
    Then I open the new produced slic bios with mmtools and extracted the AmiBoardInfo and injected it into my own F8 bios together with the rest of the ozmosis (HermitCrab) stuff together and a third party AHCI driver for Marvell.
    After that I closed my eyes and loaded the bios into my mobo with Q-flash and everything was working like a charm. I can install Maverick straight from my USB installer and everything seems to work fine including iMessage.
    Dualbooting Windows 8.1/Maverick on one ssd 240 gb disk is working perfect so I'm quite happy.
    What is the problem then? The problem is that the rest of the AmiBoardInfo table in my new modded bios is from Xp:s F16 UD5 bios and not from my original F8 UP5 bios.
    If I try the same procedure as above with my original F8 bios it dosen't work. When I replace the DSDT section with Phoenixtool it produce a file which is impossible to open and make mmtools to crash.

    Any input.
    Regards
    Öbus
     
  15. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    #57 Protocol7, Nov 12, 2013
    Last edited: Nov 12, 2013
    I found the Phoenixtool method a bit clunky. I only used it the first time (for the BIOS I screwed up with too many edits). Now I just extract the AmiBoardInfo file uncompressed with MMTool and overwrite the DSDT data with a hex editor. Then put it back using MMTool. This works fine so long as your DSDT isn't larger than the one you're overwriting. My edited DSDT comes in less than 100b smaller than the original DSDT.

    Also I think the copy of the DSDT being patched should be extracted from the AmiBoardInfo file and not from the BIOS of a running system. There are differences.

    Either way you should patch your board's DSDT rather than try to use one from another. BIOS changes from one version to another can break old DSDT tables so trying to use one from a different board is not a good idea. Even if it might seem to be working OK.
     
  16. öbus

    öbus MDL Novice

    Sep 5, 2009
    4
    0
    0
    In my case the edited DSDT I want to put in to AmiBoardInfo module is bigger than the one in the original F8 bios. How to handle that?
    Any ideas?:rolleyes:
     
  17. Protocol7

    Protocol7 MDL Novice

    Mar 7, 2009
    18
    2
    0
    You need to delete devices from the DSDT that aren't being used. If you go back a couple of pages you can see someone with the same problem. I was lucky in that I knew one device that wasn't being used and it was big enough to allow all my patches (so far).
     
  18. öbus

    öbus MDL Novice

    Sep 5, 2009
    4
    0
    0
    :worthy:
    My problem is that my edited DSDT are bigger in size than the original. How to handle that? I don't know how to edit the size of my module so I'm just stuck.
    I'm just a noob and all of this just get over my head. I've been trying for more than two weeks now without success.
    Anybody out there how could help me?:worthy: