Contribute
Register

4540S DSDT Patches. Comments and Questions Please.

Status
Not open for further replies.
Joined
Aug 15, 2011
Messages
961
Motherboard
HP-4540S
CPU
i5-3210M
Graphics
HD4000
Mac
  1. 0
Classic Mac
  1. 0
Mobile Phone
  1. 0
I've received 4540S I3-3110M this morning. Quickly patched my DSDT to get this going. Existing patches are for 4530S chipset and could use some refreshing. Please comment and recommend any changes.

01_Basic_Compilation
Code:
# Fix _T_x compiler reserved errors
into_all all code_regex _T_0 replaceall_matched begin T_0 end;
into_all all code_regex _T_1 replaceall_matched begin T_1 end;

# Fix 201 parse errors (remove FPED)
into device label GFX0 code_regex If\s\(CondRefOf\s\(FPED\)\)\s*\n\s*\{\s*\n\s*FPED\s\(\)\s*\n\s*\} remove_matched;

# 4x40S BB2S 3 dots error
into all code_regex Name\s+\(BB2S,[^\)].*\) replace_matched
begin
Name (BB2S, "                                                                                                                                                                                           ")
end;


02_DSDT_Patch
Code:
#   Power fix
into device label AC insert
begin
Name (_PRW, Package (0x02)\n
            {\n
                0x18, \n
                0x03\n
            })
end;

#    Replace all instances of AC with ADP1 (Apple label naming)
into_all all code_regex \.AC, replaceall_matched begin .ADP1, end;
into all label AC set_label begin ADP1 end;


#   Insert standard DTGP entry
into method label DTGP remove_entry;
into definitionblock code_regex . insert
begin
Method (DTGP, 5, NotSerialized)\n
{\n
    If (LEqual (Arg0, Buffer (0x10)\n
            {\n
                /* 0000 */    0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44, \n
                /* 0008 */    0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B\n
            }))\n
    {\n
        If (LEqual (Arg1, One))\n
        {\n
            If (LEqual (Arg2, Zero))\n
            {\n
                Store (Buffer (One)\n
                    {\n
                        0x03\n
                    }, Arg4)\n
                Return (One)\n
            }\n
            If (LEqual (Arg2, One))\n
            {\n
                Return (One)\n
            }\n
        }\n
    }\n
    Store (Buffer (One)\n
        {\n
            0x00\n
        }, Arg4)\n
    Return (Zero)\n
}
end;

#   Insert Apple USB properties into EHC1 
into method label _DSM parent_adr 0x001D0000 remove_entry;
into device name_adr 0x001D0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    Store (Package ()\n
        {\n
            "subsystem-id",\n 
            Buffer (0x04)\n
            {\n
                0x70, 0x72, 0x00, 0x00\n
            },\n 
            "subsystem-vendor-id",\n 
            Buffer (0x04)\n
            {\n
                0x86, 0x80, 0x00, 0x00\n
            },\n 
            "AAPL,current-available", \n
            0x0834, \n
            "AAPL,current-extra", \n
            0x0898, \n
            "AAPL,current-extra-in-sleep", \n
            0x0640, \n
            "AAPL,device-internal",\n
            0x02,\n
            "AAPL,max-port-current-in-sleep",\n
            0x0834,  \n
            Buffer (One)\n
            {\n
                0x00\n
            }\n
        }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}
end;

# Insert Apple USB properties into EHC2
into method label _DSM parent_adr 0x001A0000 remove_entry;
into device name_adr 0x001A0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    Store (Package ()\n
        {\n
            "subsystem-id",\n 
            Buffer (0x04)\n
            {\n
                0x70, 0x72, 0x00, 0x00\n
            },\n 
            "subsystem-vendor-id",\n 
            Buffer (0x04)\n
            {\n
                0x86, 0x80, 0x00, 0x00\n
            },\n 
            "AAPL,current-available", \n
            0x0834, \n
            "AAPL,current-extra", \n
            0x0898, \n
            "AAPL,current-extra-in-sleep", \n
            0x0640, \n
            "AAPL,device-internal",\n
            0x02,\n
            "AAPL,max-port-current-in-sleep",\n
            0x0834,  \n
            Buffer (One)\n
            {\n
                0x00\n
            }\n
        }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}
end;

# Insert Apple USB properties into USB 3.0 XHC
into method label _DSM parent_adr 0x00140000 remove_entry;
into device name_adr 0x00140000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    Store (Package ()\n
        {\n
            "subsystem-id",\n 
            Buffer (0x04)\n
            {\n
                0x70, 0x72, 0x00, 0x00\n
            },\n 
            "subsystem-vendor-id",\n 
            Buffer (0x04)\n
            {\n
                0x86, 0x80, 0x00, 0x00\n
            },\n 
            "AAPL,current-available", \n
            0x0834, \n
            "AAPL,current-extra", \n
            0x0898, \n
            "AAPL,current-extra-in-sleep", \n
            0x0640, \n
            "AAPL,device-internal",\n
            0x02,\n
            "AAPL,max-port-current-in-sleep",\n
            0x0834,  \n
            Buffer (One)\n
            {\n
                0x00\n
            }\n
        }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}
end;

#     Enable functions keys
into device label PS2K insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    Store (Package (0x02)\n
        {\n
            "AAPL,has-embedded-fn-keys", \n
            Buffer (0x04)\n
            {\n
                0x01, 0x00, 0x00, 0x00\n
            }\n
        }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}\n
end;

#   Inject Audio properties
into device label HDEF insert
begin
Method (_DSM, 4, NotSerialized)\n
                {\n
                    Store (Package (0x06)\n
                        {\n
                            "hda-gfx", \n
                            Buffer (0x0A)\n
                            {\n
                                "onboard-1"\n
                            }, \n
                            "layout-id", \n 
                            Buffer (0x04)\n
                            {\n
                                0x0C, 0x00, 0x00, 0x00\n
                            }, \n
                            "PinConfigurations", \n
                            Buffer (Zero) {}\n
                        }, Local0)\n
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
                    Return (Local0)\n
                }
end;



#     IRQ fix
into device name_hid PNP0000 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0100 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0B00 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0103 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} removeall_matched;
into device name_hid PNP0103 code_regex Name\s\(([^,]+),\sResourceTemplate\s\(\)\n\s+\{((?:.|\n)*)\}\) replace_matched
begin
Name (%1, ResourceTemplate ()\n
                    {\n
                        IRQNoFlags ()\n
                            {0}\n
                        IRQNoFlags ()\n
                            {8}\n
                        IRQNoFlags ()\n
                            {11}\n
                        IRQNoFlags ()\n
                            {15}\n
%2
})
end;



#    Rename all instances of GFX0 to IGPU
into_all all code_regex GFX0 replaceall_matched begin IGPU end;
into_all all label GFX0 set_label begin IGPU end;


#   Brightness control fix
into scope label \_SB insert
begin
Device (PNLF)\n
{\n
    Name (_HID, EisaId ("APP0002"))\n
    Name (_CID, "backlight")\n
    Name (_UID, 0x0A)\n
    Name (_STA, 0x0B)\n
}
end;


#   RTC fix
into device name_hid PNP0B00 code_regex (IO\s\((?:\s*[^,]+,\s*(?:\/\/\s.*)?\s*\n)+\s*)(\dx\d+)(,\s*(?:\/\/\s.*)?\s*\n\s*\)) replace_matched begin %10x02%3 end;


#  Shutdown fix
into method label _PTS code_regex_not If\s\(LEqual\s\(Arg0,\s0x05\)\) code_regex ^((?:.|\n)*)$ replace_matched
begin
        If (LEqual (Arg0, 0x05)) {}\n
        Else\n
        {\n
%1
        }
end;


#   SMBUS fix
into method label _DSM parent_adr 0x001F0003 remove_entry;
into device name_adr 0x001F0003 insert
begin
Device (BUS0)\n
                {\n
                    Name (_CID, "smbus")\n
                    Name (_ADR, Zero)\n
                    Device (DVL0)\n
                    {\n
                        Name (_ADR, 0x57)\n
                        Name (_CID, "diagsvault")\n
                        Method (_DSM, 4, NotSerialized)\n
                        {\n
                            Store (Package (0x02)\n
                                {\n
                                    "address", \n
                                    0x57\n
                                }, Local0)\n
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
                            Return (Local0)\n
                        }\n
                    }\n
                }
end;

#     HPET fix
into method label _STA parent_hid PNP0103 remove_entry;
into device name_hid PNP0103 insert
begin
Method (_STA, 0, NotSerialized)\n
{\n
    Return (0x0F)\n
}
end;
into method label _CRS parent_hid PNP0103 remove_entry;
into device name_hid PNP0103 insert
begin
Method (_CRS, 0, NotSerialized)\n
{\n
    Return (BUF0)\n
}
end;


# Remove icons for SD card
into method label _RMV parent_label SMHC replace_content begin Return (Zero) end;
into method label _RMV parent_label MSHC replace_content begin Return (Zero) end;
into method label _RMV parent_label XDCC replace_content begin Return (Zero) end;
into method label _RMV parent_label I1C replace_content begin Return (Zero) end;


03_AR9285 Atheros WiFi card. Use instead of patching AirPortAtheros40.kext with pci168c,2b
Code:
#   Atheros AR9285 fix works with vanilla IO80211 kext 
into device label WNIC parent_label RP04 replace_content
begin
Name (_ADR, Zero)  // _ADR: Address\n
Method (_PRW, 0, Serialized)  // _PRW: Power Resources for Wake\n
{\n
    Return (^^_PRW)\n
}\n
Method (_DSM, 4, NotSerialized)\n
{\n
    Store (Package (0x0C)\n
        {\n
            "AAPL,slot-name", \n
            Buffer (0x08)\n
            {\n
                "AirPort"\n
            }, \n
            "device-id", \n
            Unicode ("*"), \n
            "device_type", \n
            Buffer (0x08)\n
            {\n
                "AirPort"\n
            }, \n
            "model", \n
             Buffer (0x33)\n
             {\n
                "Atheros 9285 802.11 b/g/n Wireless Network Adapter"\n
             },\n
            "subsystem-id", \n
            Buffer (0x04)\n
            {\n
                0x8F, 0x00, 0x00, 0x00\n
            }, \n
            "subsystem-vendor-id", \n
            Buffer (0x04)\n
            {\n
                0x6B, 0x10, 0x00, 0x00\n
            }\n
        }, Local0)\n
    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
    Return (Local0)\n
}
end;
# Rename wireless label WNIC to ARPT
into all label WNIC set_label begin ARPT end;


04a_HDMI. Provides HDMI and QE/CI graphics info for HD3000/HD4000 (HD3000 in addition needs MEI patch)

Code:
#   Inject HDMI info into GFX0/IGPU   */
into method label _DSM parent_adr 0x00020000 remove_entry;
into device name_adr 0x00020000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
                    Store (Package ()\n
                        {\n
                            "hda-gfx",\n 
                            Buffer (0x0A)\n
                            {\n
                                "onboard-1"\n
                            },\n
                            "AAPL,snb-platform-id",\n 
                            Buffer (0x04)\n
                            {\n
                                0x00, 0x00, 0x01, 0x00\n
                            },\n
                            "AAPL,ig-platform-id",\n
                            Buffer (0x04)\n
                            {\n
                                 0x03, 0x00, 0x66, 0x01\n
                            }\n
                        }, Local0)\n
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
                    Return (Local0)\n 
 }\n
end;



04b_HDMI_Dual-Link. Use instead of patch 4a (1600x900 and 4740S laptops)

Code:
#   Inject HDMI info and dual-link into GFX0/IGPU   */ 
# Do not use GraphicsEnabler or device-properties
into method label _DSM parent_adr 0x00020000 remove_entry;
into device name_adr 0x00020000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
                    Store (Package ()\n
                        {\n
                            "AAPL00,DualLink",\n 
                            Buffer (0x04)\n
                            {\n
                                0x01, 0x00, 0x00, 0x00\n
                            },\n 
                            "hda-gfx",\n 
                            Buffer (0x0A)\n
                            {\n
                                "onboard-1"\n
                            },\n
                            "AAPL,snb-platform-id",\n 
                            Buffer (0x04)\n
                            {\n
                                0x00, 0x00, 0x01, 0x00\n
                            },\n 
                            "AAPL,ig-platform-id",\n
                            Buffer (0x04)\n
                            {\n
                                 0x04, 0x00, 0x66, 0x01\n
                            }\n
                        }, Local0)\n
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
                    Return (Local0)\n 
}\n
end;
05a_FanExperimental No change at this moment.
Code:
# add fan readings and fan control
into device label SMCD remove_entry;
into definitionblock code_regex . insert
begin
Device (SMCD)\n
{\n
    Name (_HID, "FAN00000")  // _HID: Hardware ID\n
    Method (FAN0, 0, Serialized)\n
    {\n
        Store (\_TZ.GFRM (), Local0)\n
        If (LEqual (0x03C4, Local0))\n
        {\n
            Store (Zero, Local0)\n
            Return (Local0)\n
        }\n
        Return (Local0)\n
    }\n
\n
// commented out: just for debugging and experimenting
//
// monitoring additional temperatures\n
//    Method (TDIM, 0, Serialized)  // GFXZ temp\n
//    {\n
//        Divide (Subtract (\_TZ.GFXZ._TMP, 2732), 10,, Local0)\n
//        return (Local0)\n
//    }\n
//    Method (TSYS, 0, Serialized)  // LOCZ temp\n
//    {\n
//        Divide (Subtract (\_TZ.LOCZ._TMP, 2732), 10,, Local0)\n
//        return (Local0)\n
//    }\n
//\n
// for debugging fan control\n
//    Method (TCPP, 0, Serialized)  // Average temp\n
//    {\n
//        Store (FNUM, Local0)\n
//        if (LNotEqual (Local0, 0))\n
//        {\n
//            Store (FSUM, Local1)\n
//            Divide (Local1, Local0,, Local0)\n
//        }\n
//        return (Local0)\n
//    }\n
//    Method (TAMB, 0, Serialized)  // fan counter\n
//    {\n
//        return (FCNT)\n
//    }\n
//\n
    Method (TCPU, 0, Serialized)\n
    {\n
        Acquire (\_SB.PCI0.LPCB.EC0.ECMX, 0xFFFF)\n
        Store (1, \_SB.PCI0.LPCB.EC0.CRZN)\n
        Store (\_SB.PCI0.LPCB.EC0.DTMP, Local0)\n
        Release (\_SB.PCI0.LPCB.EC0.ECMX)\n
        return (Local0)\n
    }\n
\n
// Fan Control Table (pairs of temp, fan control byte)\n
    Name (FTAB, Buffer ()\n
    {\n
        50, 255,     // 255 is off (really auto, but at low temp it is off)\n
        57, 128,     // 128 is slowest speed\n
        63, 82,\n
        68, 74,\n
        72, 59,\n
        75, 49,\n
        0xFF, 0     // last entry must be 0xFF, 0 is max fan speed\n
    })\n
// Table to keep track of past temperatures (to build average)\n
    Name (FHST, Buffer (16) { 0x0, 0, 0, 0, 0x0, 0, 0, 0, 0x0, 0, 0, 0, 0x0, 0, 0, 0 })\n
    Name (FIDX, Zero)     // current index in buffer above\n
    Name (FNUM, Zero)     // number of entries in above buffer to count in avg\n
    Name (FSUM, Zero)     // current sum of entries in buffer\n
// Keeps track of last fan speed set, and counter to set new one\n
    Name (FLST, 0xFF)    // last index for fan control\n
    Name (FCNT, 0)        // count of times it has been "wrong", 0 means no counter\n
    Name (FCTU, 20)        // timeout for changes (fan rpm going up)\n
    Name (FCTD, 40)        // timeout for changes (fan rpm going down)\n
\n
    // Fan control for CPU -- expects to be evaluated 1-per second\n
    Method (FCPU, 0, Serialized)\n
    {\n
        Acquire (\_SB.PCI0.LPCB.EC0.ECMX, 0xFFFF)\n
\n
        // setup fake temperature (this is the key to controlling the fan!)\n
        Store (1, \_SB.PCI0.LPCB.EC0.CRZN)  // select CPU temp\n
        Store (31, \_SB.PCI0.LPCB.EC0.TEMP) // write fake value there (31C)\n
\n
        // get current temp into Local0 for eventual return\n
        // Note: reading from DTMP here instead of TEMP because we wrote\n
        //  a fake temp to TEMP to trick the system into running the fan\n
        //    at a lower speed than it otherwise would.\n
        Store (1, \_SB.PCI0.LPCB.EC0.CRZN)  // select CPU temp\n
        Store (\_SB.PCI0.LPCB.EC0.DTMP, Local0) // Local0 is current temp\n
\n
        // calculate average temperature\n
        Add (Local0, FSUM, Local1)\n
        Store (FIDX, Local2)\n
        Subtract (Local1, DerefOf (Index (FHST, Local2)), Local1)\n
        Store (Local0, Index (FHST, Local2))\n
        Store (Local1, FSUM)  // Local1 is new sum\n
\n
        // adjust current index into temp table\n
        Increment (Local2)\n
        if (LGreaterEqual (Local2, SizeOf(FHST)))\n
            { Store (0, Local2) }\n
        Store (Local2, FIDX)\n
        // adjust total items collected in temp table\n
        Store (FNUM, Local2)\n
        if (LNotEqual (Local2, SizeOf (FHST)))\n
        {\n
            Increment (Local2)\n
            Store (Local2, FNUM)\n
        }\n
\n
        // Local1 is new sum, Local2 is number of entries in sum\n
        Divide (Local1, Local2,, Local0)  // Local0 is now average temp\n
\n        
        // table based search (use avg temperature to search)\n
        if (LGreater (Local0, 255)) { Store (255, Local0) }\n
        Store (Zero, Local2)\n
        while (LGreater (Local0, DerefOf (Index (FTAB, Local2))))\n
            { Add (Local2, 2, Local2) }\n
\n
        // calculate difference between current and found index\n
        if (LGreater (Local2, FLST))\n
        {\n
            Subtract(Local2, FLST, Local1)\n
            Store(FCTU, Local4)\n
        }\n
        else\n
        {\n
            Subtract(FLST, Local2, Local1)\n
            Store(FCTD, Local4)\n
        }\n
\n
        // set new fan speed, if necessary\n
        if (LEqual (Local1, 0))\n
        {\n
            // no difference, so leave current fan speed and reset count\n
            Store (0, FCNT)\n
        }\n
        else\n
        {\n
            // there is a difference, start/continue process of changing fan\n
            Store (FCNT, Local3)\n
            Increment (Local3)\n
            Store (Local3, FCNT)\n
\n
            // how long to wait depends on how big the difference\n
            // 20 secs if diff is 2, 5 secs if diff is 4, etc.\n
            Divide (ShiftLeft (Local4, 1), Local1,, Local1)\n
            if (LGreaterEqual (Local3, Local1))\n
            {\n
                // timeout expired, so set new fan speed\n
                Store (Local2, FLST)\n
                Increment (Local2)\n
                Store (DerefOf (Index (FTAB, Local2)), \_SB.PCI0.LPCB.EC0.FTGC)\n
                Store (0, FCNT)\n
            }\n
        }\n
\n
        Release (\_SB.PCI0.LPCB.EC0.ECMX)\n
        return (Local0)  // returns average temp\n
    }\n
}\n
end;


05b Fan_Speed. No fan control, displays speed and heatsink temperature only. Use instead of patch 5a
Code:
into device label SMCD remove_entry;
into definitionblock code_regex . insert
begin
Device (SMCD)\n
{\n
    Name (_HID, "FAN00000")  // _HID: Hardware ID\n
    Method (FAN0, 0, Serialized)\n
    {\n
        Store (\_TZ.GFRM (), Local0)\n
        If (LEqual (0x03C4, Local0))\n
        {\n
            Store (Zero, Local0)\n
            Return (Local0)\n
        }\n
        Return (Local0)\n
    }\n
    Method (TCPU, 0, Serialized)\n
    {\n
        Acquire (\_SB.PCI0.LPCB.EC0.ECMX, 0xFFFF)\n
        Store (1, \_SB.PCI0.LPCB.EC0.CRZN)\n
        Store (\_SB.PCI0.LPCB.EC0.DTMP, Local0)\n
        Release (\_SB.PCI0.LPCB.EC0.ECMX)\n
        return (Local0)\n
    }\n
}\n
end;
 
06_Battery_Patch No change at this moment.
Code:
# Add cycle count and temperature to battery info method
# 16-bit version
into method label BTIF code_regex Store\s\(BDAT,\sLocal1\) replace_matched
begin
    Store (BDAT, Local1)\n
    // battery cycle count\n
    Store (BCC, Index (DerefOf (Index (NBTI, Arg0)), 0x0D))\n
    // battery temperature\n
    Store (\\_TZ.GTTP (0x04, 0x05, Zero, Zero, 0x7F), Local2)\n
    Add (Multiply (Local2, 10), 2732, Local2) // Celsius to .1K\n
    Store (Local2, Index (DerefOf (Index (NBTI, Arg0)), 0x0E))\n
end;

# Need to extend size of NBTI packages
into all code_regex \"Hewlett\-Packard\"\s+\},\s+Package\s\(0x0D\) replaceall_matched
begin
        "Hewlett-Packard",\n
        Zero,\n
        Zero,\n
       },\n
    Package (0x0F)\n
end;

into all code_regex Name\s\(NBTI,\sPackage\s\(0x02\)\s+\{\s+Package\s\(0x0D\) replaceall_matched
begin
    Name (NBTI, Package(0x02)\n
    {\n
        Package (0x0F)\n
end;

into_all all code_regex \"LIon\",\s+\"Hewlett\-Packard\"\n\s+\}\n replaceall_matched
begin
    "LIon",\n
    "Hewlett-Packard",\n
    Zero,\n
    Zero,\n
}\n
end;


# Convert battery EC info from 16-bit to 8-bit fields...

# Need this utility method B1B2(lowbyte, hibyte)... returns ((hibyte << 8) | lowbyte)
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized)\n
{\n
    ShiftLeft (Arg1, 8, Local0)\n
    Or (Arg0, Local0, Local0)\n
    Return (Local0)\n
}\n
end;

# Change EC register declarations from 16-bit to 8-bit
into device label EC0 code_regex BDC,\s+16 replace_matched begin BDC0, 8,\nBDC1, 8 end;
into device label EC0 code_regex BFC,\s+16 replace_matched begin BFC0, 8,\nBFC1, 8 end;
into device label EC0 code_regex BRTE,\s+16 replace_matched begin RTE0, 8,\nRTE1, 8 end;
into device label EC0 code_regex BME,\s+16 replace_matched begin BME0, 8,\nBME1, 8 end;
into device label EC0 code_regex BDV,\s+16 replace_matched begin BDV0, 8,\nBDV1, 8 end;
into device label EC0 code_regex BATE,\s+16 replace_matched begin ATE0, 8,\nATE1, 8 end;
into device label EC0 code_regex BPR,\s+16 replace_matched begin BPR0, 8,\nBPR1, 8 end;
into device label EC0 code_regex BCR,\s+16 replace_matched begin BCR0, 8,\nBCR1, 8 end;
into device label EC0 code_regex BRC,\s+16 replace_matched begin BRC0, 8,\nBRC1, 8 end;
into device label EC0 code_regex BCC,\s+16 replace_matched begin BCC0, 8,\nBCC1, 8 end;
into device label EC0 code_regex BPV,\s+16 replace_matched begin BPV0, 8,\nBPV1, 8 end;
into device label EC0 code_regex BCV1,\s+16 replace_matched begin BCX0, 8,\nBCX1, 8 end;
into device label EC0 code_regex BCV2,\s+16 replace_matched begin BCA0, 8,\nBCA1, 8 end;
into device label EC0 code_regex BCV3,\s+16 replace_matched begin BCB0, 8,\nBCB1, 8 end;
into device label EC0 code_regex BCV4,\s+16 replace_matched begin BCP0, 8,\nBCP1, 8 end;
into device label EC0 code_regex BATF,\s+16 replace_matched begin ATF0, 8,\nATF1, 8 end;
into device label EC0 code_regex MAXC,\s+16 replace_matched begin AXC0, 8,\nAXC1, 8 end;
into device label EC0 code_regex BSTS,\s+16 replace_matched begin BST0, 8,\nBST1, 8 end;
into device label EC0 code_regex BSN,\s+16 replace_matched begin BSN0, 8,\nBSN1, 8 end;
into device label EC0 code_regex BDAT,\s+16 replace_matched begin BDA0, 8,\nBDA1, 8 end;
into device label EC0 code_regex CBT,\s+16 replace_matched begin CBT0, 8,\nCBT1, 8 end;

# Change access (reads) to those registers from 16-bit to 8-bit
into_all method label BTIF code_regex \(BFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label GBTI code_regex \(BFC, replaceall_matched begin (B1B2 (BFC0, BFC1), end;
into_all method label BTIF code_regex \(BDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label GBTI code_regex \(BDV, replaceall_matched begin (B1B2 (BDV0, BDV1), end;
into_all method label BTIF code_regex \(BSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label GBTI code_regex \(BSN, replaceall_matched begin (B1B2 (BSN0, BSN1), end;
into_all method label BTIF code_regex \(BDAT, replaceall_matched begin (B1B2 (BDA0, BDA1), end;
into_all method label GBTI code_regex \(BDAT, replaceall_matched begin (B1B2 (BDA0, BDA1), end;
into_all method label BTST code_regex \(BPR, replaceall_matched begin (B1B2 (BPR0, BPR1), end;
into_all method label GBTI code_regex \(BPR, replaceall_matched begin (B1B2 (BPR0, BPR1), end;
into_all method label BTST code_regex \(BRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBTI code_regex \(BRC, replaceall_matched begin (B1B2 (BRC0, BRC1), end;
into_all method label GBTI code_regex \(BCR, replaceall_matched begin (B1B2 (BCR0, BCR1), end;
into_all method label BTST code_regex \(BPV, replaceall_matched begin (B1B2 (BPV0, BPV1), end;
into_all method label GBTI code_regex \(BPV, replaceall_matched begin (B1B2 (BPV0, BPV1), end;
into_all method label GBTI code_regex \(BDC, replaceall_matched begin (B1B2 (BDC0, BDC1), end;
into_all method label GBTI code_regex \(BME, replaceall_matched begin (B1B2 (BME0, BME1), end;
into_all method label GBTI code_regex \(BCC, replaceall_matched begin (B1B2 (BCC0, BCC1), end;
into_all method label BTIF code_regex \(BCC, replaceall_matched begin (B1B2 (BCC0, BCC1), end;
into_all method label GBTI code_regex \(CBT, replaceall_matched begin (B1B2 (CBT0, CBT1), end;
into_all method label GBTI code_regex \(BSTS, replaceall_matched begin (B1B2 (BST0, BST1), end;
into_all method label GBTI code_regex \(BCV1, replaceall_matched begin (B1B2 (BCX0, BCX1), end;
into_all method label GBTI code_regex \(BCV2, replaceall_matched begin (B1B2 (BCA0, BCA1), end;
into_all method label GBTI code_regex \(BCV3, replaceall_matched begin (B1B2 (BCB0, BCB1), end;
into_all method label GBTI code_regex \(BCV4, replaceall_matched begin (B1B2 (BCP0, BCP1), end;
into_all method label GBTI code_regex \(BRTE, replaceall_matched begin (B1B2 (RTE0, RTE1), end;
into_all method label GBTI code_regex \(BATE, replaceall_matched begin (B1B2 (ATE0, ATE1), end;
into_all method label GBTI code_regex \(BATF, replaceall_matched begin (B1B2 (ATF0, ATF1), end;
into_all method label GBTC code_regex \(MAXC, replaceall_matched begin (B1B2 (AXC0, AXC1), end;

# Now deal with the writes to those registers
# Store (0xFA, MAXC)
into_all method label SBTC code_regex \(0xFA,\sMAXC\) replaceall_matched begin (0xFA, AXC0)\nStore (Zero, AXC1) end;
# Store (Zero, MAXC)
into_all method label SBTC code_regex \(Zero,\sMAXC\) replaceall_matched begin (Zero, AXC0)\nStore (Zero, AXC1) end;
# Store (0x00, MAXC)
into_all method label SBTC code_regex \(0x00,\sMAXC\) replaceall_matched begin (0x00, AXC0)\nStore (0x00, AXC1) end;

# This should match against nothing... if it does, it will cause an error when
# compiling the DSDT, which will clue us in that this patch below needs to change.
into_all method label GBTI code_regex Local7 replaceall_matched begin Error_Local7_IsBeingUsedAlready end;

# Store (GBSS (B1B2 (BSN0, BSN1), BDAT, BTSN)
into_all method label GBTI code_regex Store\s\(GBSS\s\(B1B2\s\(BSN0,\sBSN1\),\sBDAT\),\sBTSN\) replaceall_matched
begin
Store (GBSS (B1B2 (BSN0, BSN1), B1B2 (BDA0, BDA1)), Local7)\n
Store (Local7, BSN0)\n
Store (ShiftRight (Local7, 8), BSN1)
end;


07_Ivy_PState_Patch ( PStates for HM76 with IvyBridge processors is Work in Progress)
Do Not Use patch enabling "plugin-type" in DSDT CPU0 instead
generate SSDT with Pike's script and place it in /Extra folder along with MacbookPro9.2 SMBios
http://www.tonymacx86.com/ssdt/86906-ssdt-generation-script-ivybridge-pm.html



08_IMEI_Patch For HM76 chipset with Sandy Bridge processors (HD3000) to pick up SNB Graphics framebuffer rather than Capri
Do not use if using IMEI modified kexts AppleIntelSNBGraphics and AppleIntelFrameBufferCapri
Code:
into device label PCI0 insert
begin
Device (IMEI)\n
            {\n
                Name (_ADR, 0x00160000)\n
                Method (_DSM, 4, NotSerialized)\n                
        {\n
                    Store (Package (0x02)\n
                        {\n
                            "device-id",\n 
                            Buffer (0x04)\n
                            {\n
                                0x3A, 0x1C, 0x00, 0x00\n
                            }\n
                        }, Local0)\n
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
                    Return (Local0)\n
                }\n
            }
end;


USB.3.0.Patch
Please check for GenericUSBXHCI.kext in this thread
http://www.tonymacx86.com/hp-probook/93732-new-kexts-proposed-probook-installer-v6-1-a.html
before applying the USB3.0 patch. It looks very promissing.
 

Attachments

  • USB.3.0.Patch.4540S.rev.1.0.txt
    18.8 KB · Views: 482
I will re-arrange my file names along the same lines as yours to make doing a 'diffmerge' easier...

You have ML on your 4540s yet?
 
I will re-arrange my file names along the same lines as yours to make doing a 'diffmerge' easier...

You have ML on your 4540s yet?

Yes, 10.8.2. I've got couple trouble spots I'm trying to resolve like USB and some IOGraphics errors in the log.
 
Brilliant.

Thanks Big Donkey.

I have Sandy Bridge 4540s and I applied the following that you have just posted to my raw DSDT:
Patches 1, 2, 3, 4a and 6 - I deleted the specific CPU Ivy Bridge patch from your patch number 2. I did though after applying all these patches have to add the following to my DSDT to make the SNBframebuffer load:

Code:
Device (MEI)
            {
                Name (_ADR, 0x00160000)
                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x02)
                        {
                            "device-id", 
                            Buffer (0x04)
                            {
                                0x3A, 0x1C, 0x00, 0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }
            }

Without that patch a SB 4540s will not boot to a QE/CI desktop and trackpad functionality is usually lost.

Perhaps when you and RehabMan do the package there could be a Sandy Bridge variant patch separate from the Ivy Bridge variant with all other patches being common?

Otherwise am happy to report that all the patches I have tested work for me here and I'll let you know if I get any problems.

Thanks for your work.
 
Without that patch a SB 4540s will not boot to a QE/CI desktop and trackpad functionality is usually lost.

Perhaps when you and RehabMan do the package there could be a Sandy Bridge variant patch separate from the Ivy Bridge variant with all other patches being common?

Otherwise am happy to report that all the patches I have tested work for me here and I'll let you know if I get any problems.

Thanks for your work.

Thanks,
How's USB is working?
For 4540S equipped with Sandy Bridge processors: Can patches coexist and let the OS pickup correct variant? or we need separate tree.
 
Other comment is that for SB variant the IGPU patch needs to be:


Method (_DSM, 4, NotSerialized)
{
Store (Package (0x04)
{
"hda-gfx",
Buffer (0x0A)
{
"onboard-1"
},

"AAPL,snb-platform-id",
Buffer (0x04)
{
0x00, 0x00, 0x01, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}








Instead of:

Method (_DSM, 4, NotSerialized)
{
Store (Package (0x04)
{
"hda-gfx",
Buffer (0x0A)
{
"onboard-1"
},

"AAPL,ig-platform-id",
Buffer (0x04)
{
0x03, 0x00, 0x66, 0x01
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}

This will then enable the HDMI out properly for the Sandy Bridge models. Hope this helps out for a generalised 4540s install thread.
 
Would this still work for you? I imagine that HD3000 processor will ignore ig part since SMBIOS is for IVY?


Method (_DSM, 4, NotSerialized)
{
Store (Package ()
{
"hda-gfx",
Buffer (0x0A)
{
"onboard-1"
},
"AAPL,ig-platform-id",
Buffer (0x04)
{
0x03, 0x00, 0x66, 0x01
},
"AAPL,snb-platform-id",
Buffer (0x04)
{
0x00, 0x00, 0x01, 0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
 
Thanks,
How's USB is working?
For 4540S equipped with Sandy Bridge processors: Can patches coexist and let the OS pickup correct variant? or we need separate tree.

In my opinion almost all patches will be exactly the same, so maybe just have generalised patches and then an (a) and (b) variant to a processor family specific patch.

USB by the way looks fine here with all ports activated. Is there something specific you'd like me to try?
 
Would this still work for you? I imagine that HD3000 processor will ignore ig part since SMBIOS is for IVY?

Yes, that one works fine as a generalised patch for me.

So could go with a common branch and then leave it to those with SNB variant to decide whether they want to patch the SNBframebuffer kext or do a DSDT mod to account for the use of 6 series processor on 7 series board. I favour though the DSDT mod for the Device (MEI) as it survives system updates.
 
Status
Not open for further replies.
Back
Top