# Patch Name: Rampage IV Extreme by Shilohh Oct 2014 # Fix the SMBUS to allow for loading of the AppleSMBusController.kext into device label BUS0 parent_label SBUS remove_entry; into device name_adr 0x001F0003 insert begin Device (BUS0)\n {\n Name (_CID, "smbus")\n Name (_ADR, 0x00)\n }\n Device (BUS1)\n {\n Name (_CID, "smbus")\n Name (_ADR, 0x01)\n } end; # Fix IRQ into device label PS2K code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} removeall_matched; into device label PS2M code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} removeall_matched; 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_not IRQNoFlags 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 {12}\n %2 }) end; # Fix Shared IRQs into method label _PRS parent_label LNKA remove_entry; into device label LNKA insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,10,12,14,15}\n })\n end; into method label _PRS parent_label LNKB remove_entry; into device label LNKB insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,11,12,14,15}\n })\n end; into method label _PRS parent_label LNKC remove_entry; into device label LNKC insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,10,12,14,15}\n })\n end; into method label _PRS parent_label LNKD remove_entry; into device label LNKD insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,11,12,14,15}\n })\n end; into method label _PRS parent_label LNKE remove_entry; into device label LNKE insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,10,12,14,15}\n })\n end; into method label _PRS parent_label LNKF remove_entry; into device label LNKF insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,11,12,14,15}\n })\n end; into method label _PRS parent_label LNKG remove_entry; into device label LNKG insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,10,12,14,15}\n })\n end; into method label _PRS parent_label LNKH remove_entry; into device label LNKH insert begin Name (_PRS, ResourceTemplate ()\n {\n IRQ (Level, ActiveLow, Shared, )\n {1,3,4,5,6,7,11,12,14,15}\n })\n end; # Add HDEF device for Toleda's ALC898 Interim IvyBridge AppleHDA.kext into device label HDEF parent_label PCI0 remove_entry; into device label PCI0 insert begin Device (HDEF)\n {\n Name (_ADR, 0x001B0000)\n Method (_DSM, 4, NotSerialized)\n {\n If (LEqual (Arg2, Zero))\n {\n Return (Buffer (One)\n { 0x03\n })\n }\n Return (Package (0x04)\n {\n "layout-id",\n Buffer (0x04)\n {\n 0x01,0x00,0x00,0x00\n },\n "PinConfigurations",\n Buffer (Zero) {}\n })\n }\n } end; #Add ac WIFI device. into device label ARPT parent_label PEX3 remove_entry; into device label PEX3 insert begin Device (ARPT)\n {\n Name (_ADR, Zero)\n Method (_STA, 0, NotSerialized) // _STA: Status\n {\n Return (0x0F)\n }\n Name (_PRW, Package (0x02) // _PRW: Power Resources for Wake\n {\n 0x0B, \n 0x05\n })\n Method (_RMV, 0, NotSerialized) // _RMV: Removal Status\n {\n Return (0x00)\n }\n Method (_DSM, 4, NotSerialized)\n {\n If (LEqual (Arg2, Zero))\n {\n Return (Buffer (One)\n { 0x03\n })\n }\n Return (Package (0x0C)\n {\n "name", \n "AirPort Extreme", \n "compatible", \n "pci14e4,43a0", \n "IOName", \n "pci14e4,43a0", \n "device_type", \n "AirPort", \n "device-id", \n Buffer (0x04)\n {\n 0xA0, 0x43, 0x00, 0x00\n }, \n "model", \n Buffer (0x33)\n {\n "Broadcom BCM4352 802.11ac Wireless Network Adapter"\n }\n })\n }\n } end; # Make Ethernet EN0 (Not needed) into device label GBE insert begin OperationRegion (GPIO, SystemIO, 0x0800, 0x06)\n Field (GPIO, ByteAcc, NoLock, Preserve)\n {\n GO01, 8, \n GO02, 8, \n GO03, 8, \n GO04, 8, \n GO05, 8, \n GP45, 1, \n GP9, 1\n }\n end; into method label EWOL parent_label GBE remove_entry; into device label GBE insert begin Method (EWOL, 1, NotSerialized)\n {\n If (LEqual (Arg0, One))\n {\n Or (GP9, One, GP9)\n }\n Else\n {\n And (GP9, Zero, GP9)\n }\n If (LEqual (Arg0, GP9))\n {\n Return (Zero)\n }\n Else\n {\n Return (One)\n }\n }\n end; # Fix 'Built-in' status for Intel Gigabit Ethernet into method label _DSM parent_label GBE remove_entry; into device label GBE insert begin Method (_DSM, 4, NotSerialized)\n {\n If (LEqual (Arg2, Zero))\n {\n Return (Buffer (One)\n { 0x03\n })\n }\n Return (Package (0x08)\n {\n "device_type", \n Buffer (0x14)\n {\n "Ethernet Controller"\n }, \n "model", \n Buffer (0x0D)\n {\n "Intel 82579V"\n }, \n "name", \n Buffer (0x1B)\n {\n "Gigabit Network Connection"\n },\n "built-in", \n Buffer (One)\n {\n 0x01\n } \n })\n }\n end; # Add MP6,1 DSM to EUSB into method label _DSM parent_label EUSB remove_entry; into device label EUSB insert begin Method (_DSM, 4, NotSerialized)\n {\n If (LEqual (Arg2, Zero))\n {\n Return (Buffer (One)\n { 0x03\n })\n }\n Return (Package (0x0B)\n {\n "AAPL,current-available", \n 0x0834, \n "AAPL,current-extra", \n 0x0A8C, \n "AAPL,current-extra-in-sleep", \n 0x0A8C, \n "AAPL,max-port-current-in-sleep", \n 0x0834,\n "AAPL,device-internal", \n 0x02, \n Buffer (One)\n {\n 0x00\n }\n })\n }\n end; # Add MP6,1 DSM to USBE into method label _DSM parent_label USBE remove_entry; into device label USBE insert begin Method (_DSM, 4, NotSerialized)\n {\n If (LEqual (Arg2, Zero))\n {\n Return (Buffer (One)\n { 0x03\n })\n }\n Return (Package (0x0B)\n {\n "AAPL,current-available", \n 0x0834, \n "AAPL,current-extra", \n 0x0A8C, \n "AAPL,current-extra-in-sleep", \n 0x0A8C, \n "AAPL,max-port-current-in-sleep", \n 0x0834,\n "AAPL,device-internal", \n 0x02, \n Buffer (One)\n {\n 0x00\n }\n })\n }\n end; # Remove Speaker Device into device label SPKR remove_entry; # Add the missing MCHC device into device label MCHC parent_label PCI0 remove_entry; into device label PCI0 insert begin Device (MCHC)\n {\n Name (_ADR, Zero)\n } end; # Add the missing FirmWare Hub device into device label FWHD parent_label PCI0 remove_entry; into device label PCI0 insert begin Device (FWHD)\n {\n Name (_HID, EisaId ("INT0800"))\n Name (_CRS, ResourceTemplate ()\n {\n Memory32Fixed (ReadOnly,\n 0xFF000000, // Address Base\n 0x01000000, // Address Length\n )\n })\n } end; # Add GCON into device label GCON parent_label SBRG remove_entry; into device label SBRG insert begin Device (GCON)\n {\n Name (_HID, EisaId ("APP000B"))\n Name (_CID, "gcon")\n Name (_STA, 0x0B)\n Name (_CRS, ResourceTemplate ()\n {\n IO (Decode16,\n 0x0700, // Range Minimum\n 0x07FF, // Range Maximum\n 0x01, // Alignment\n 0xFF, // Length\n )\n })\n Name (_PRW, Package (0x02)\n {\n 0x16, \n 0x04 })\n Scope (\) { OperationRegion (GPIO, SystemIO, \GPBS, 0x64) Field (GPIO, ByteAcc, NoLock, Preserve) { Offset (0x0C), GP06, 1, Offset (0x10), } } Scope (\_GPE)\n {\n Method (_L16, 0, NotSerialized)\n {\n Notify (\_SB.PCI0.SBRG.GCON, 0x80)\n }\n }\n Name (GMGP, 0x16)\n Method (GMSP, 1, NotSerialized)\n {\n If (LLessEqual (Arg0, 0x01))\n {\n Or (GP06, Arg0, GP06)\n }\n }\n Method (GMLV, 0, NotSerialized)\n {\n Return (GP06)\n }\n }\n end; # Add Device XRES into device label XRES parent_label PCI0 remove_entry; into device label PCI0 insert begin Device (XRES)\n {\n Name (_HID, EisaId ("PNP0C02"))\n Name (CRS, ResourceTemplate ()\n {\n Memory32Fixed (ReadOnly,\n 0xFED1B000, // Address Base\n 0x00001000, // Address Length\n )\n Memory32Fixed (ReadOnly,\n 0xDFFF8000, // Address Base\n 0x00001000, // Address Length\n )\n })\n OperationRegion (MCFG, SystemMemory, 0xE0000000, 0x10000000)\n Field (MCFG, AnyAcc, Lock, Preserve)\n {\n Offset (0x50), \n RCBB, 32, \n Offset (0x28180), \n VTDB, 32\n }\n Method (_CRS, 0, Serialized)\n {\n CreateDWordField (CRS, 0x04, RCB0)\n And (0xFFFFF000, RCBB, RCB0)\n CreateDWordField (CRS, 0x10, VTD0)\n And (0xFFFFE000, VTDB, VTD0)\n Return (CRS)\n }\n }\n end; # Add Device Embedded Controller into device label EC parent_label SBRG remove_entry; into device name_adr 0x001F0000 insert begin Device (EC)\n {\n Name (_HID, EisaId ("PNP0C09"))\n Name (_UID, Zero)\n Name (_CRS, ResourceTemplate ()\n {\n IO (Decode16,\n 0x0062, // Range Minimum\n 0x0062, // Range Maximum\n 0x00, // Alignment\n 0x01, // Length\n )\n IO (Decode16,\n 0x0066, // Range Minimum\n 0x0066, // Range Maximum\n 0x00, // Alignment\n 0x01, // Length\n )\n })\n Name (_GPE, 0x17)\n Name (_PRW, Package (0x02)\n {\n 0x09, \n 0x04\n })\n Name (ECOK, Zero)\n OperationRegion (ECOR, EmbeddedControl, Zero, 0xFF)\n Field (ECOR, ByteAcc, Lock, Preserve)\n {\n ECVS, 8, \n Offset (0x02), \n Offset (0x03), \n G3HT, 1, \n Offset (0x04), \n WBCB, 1, \n DSLP, 1, \n Offset (0x05), \n Offset (0x06), \n WKRS, 8, \n Offset (0x10), \n ECSS, 8, \n PLIM, 8, \n ALB0, 8, \n ALB1, 8, \n WTLB, 8, \n WTMB, 8, \n Offset (0x20), \n SPTR, 8, \n SSTS, 8, \n SADR, 8, \n SCMD, 8, \n SBFR, 256, \n SCNT, 8, \n SAAD, 8, \n SAD0, 8, \n SAD1, 8, \n SMUX, 8, \n Offset (0x60), \n ELSW, 1, \n EACP, 1, \n ECDI, 1, \n ENMI, 1, \n Offset (0x61), \n EMHP, 1, \n Offset (0x62), \n Offset (0x63), \n Offset (0x64), \n SWLO, 1, \n SWLC, 1, \n SWAI, 1, \n SWAR, 1, \n SWCI, 1, \n SWCE, 1, \n SWMI, 1, \n SWMR, 1, \n SWPB, 1, \n SWGP, 1, \n SWPM, 1, \n SWWT, 1, \n SWLB, 1, \n Offset (0x66), \n Offset (0x67), \n Offset (0x68), \n EWLO, 1, \n EWLC, 1, \n EWAI, 1, \n EWAR, 1, \n EWCI, 1, \n EWCE, 1, \n EWMI, 1, \n EWMR, 1, \n EWPB, 1, \n EWGP, 1, \n EWPM, 1, \n ENWT, 1, \n EWLB, 1, \n Offset (0x6A), \n Offset (0x6B), \n Offset (0x6C), \n LWLO, 1, \n LWLC, 1, \n LWAI, 1, \n LWAR, 1, \n LWCI, 1, \n LWCE, 1, \n LWMI, 1, \n LWMR, 1, \n LWPB, 1, \n LWGP, 1, \n LWPM, 1, \n LWWT, 1, \n LWLB, 1, \n Offset (0x6E), \n Offset (0x6F), \n Offset (0x70)\n }\n Field (ECOR, ByteAcc, Lock, Preserve)\n {\n Offset (0x03), \n G3AD, 1, \n BLOD, 1, \n S4WE, 1, \n Offset (0x04), \n Offset (0x6C), \n LWE0, 8, \n LWE1, 8, \n LWE2, 8, \n LWE3, 8\n }\n Field (ECOR, ByteAcc, Lock, Preserve)\n {\n Offset (0x24), \n SBDW, 16, \n Offset (0x46), \n SADW, 16\n }\n Method (WAKE, 0, NotSerialized)\n {\n If (ECOK)\n {\n Return (WKRS)\n }\n Else\n {\n Return (Zero)\n }\n }\n Method (_Q5A, 0, NotSerialized)\n {\n Notify (\_SB.SLPB, 0x80)\n }\n Method (_Q80, 0, NotSerialized)\n {\n Notify (C000, 0x80)\n Notify (C001, 0x80)\n Notify (C002, 0x80)\n Notify (C003, 0x80)\n Notify (C004, 0x80)\n Notify (C005, 0x80)\n Notify (C006, 0x80)\n Notify (C007, 0x80)\n Notify (C008, 0x80)\n Notify (C009, 0x80)\n Notify (C00A, 0x80)\n Notify (C00B, 0x80)\n }\n Method (_REG, 2, NotSerialized)\n {\n If (LEqual (Arg0, 0x03))\n {\n Store (Arg1, ECOK)\n If (LEqual (Arg1, 0x01))\n {\n Store (0x00, ECSS)\n }\n }\n }\n }\n end; # Make Marvell SATA built-in???? into method label _RMV parent_label NPE2 remove_entry; into device label NPE2 insert begin Device (SATA)\n {\n Name (_ADR, Zero)\n Name (_PRW, Package (0x02)\n {\n 0x09, \n 0x04\n })\n Method (_RMV, 0, NotSerialized)\n {\n Return (Zero)\n }\n }\n end; # Cleaning Section. Keep at end of List!!!——————————————————————————————————— # Fix _T into_all all code_regex _T_([0-6]) replaceall_matched begin T_%1 end; # Fix Large & Small Tag Warnings into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS1,\s\\_SB.PCI0.*._MIN,\sMN8L\) replace_matched begin CreateQWordField (CRS1, \\_SB.PCI0._Y05._MIN, MN8L) end; into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS1,\s\\_SB.PCI0.*._MAX,\sMX8L\) replace_matched begin CreateQWordField (CRS1, \\_SB.PCI0._Y05._MAX, MX8L) end; into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS1,\s\\_SB.PCI0.*._LEN,\sLN8L\) replace_matched begin CreateQWordField (CRS1, \\_SB.PCI0._Y05._LEN, LN8L) end; into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS2,\s\\_SB.PCI0.*._MIN,\sMN9L\) replace_matched begin CreateQWordField (CRS2, \\_SB.PCI0._Y0B._MIN, MN9L) end; into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS2,\s\\_SB.PCI0.*._MAX,\sMX9L\) replace_matched begin CreateQWordField (CRS2, \\_SB.PCI0._Y0B._MAX, MX9L) end; into method label _CRS parent_label PCI0 code_regex CreateDWordField\s\(CRS2,\s\\_SB.PCI0.*._LEN,\sLN9L\) replace_matched begin CreateQWordField (CRS2, \\_SB.PCI0._Y0B._LEN, LN9L) end; into method label _CRS parent_label ^UNC0 code_regex CreateDWordField\s\(CRS1,\s\\_SB.UNC0.*._MIN,\sUMIN\) replace_matched begin CreateWordField (CRS1, \\_SB.UNC0._Y0D._MIN, UMIN) end; into method label _CRS parent_label ^UNC0 code_regex CreateDWordField\s\(CRS1,\s\\_SB.UNC0.*._MAX,\sUMAX\) replace_matched begin CreateWordField (CRS1, \\_SB.UNC0._Y0D._MAX, UMAX) end; # Fix Reserved Name _WDG and _WED for ACPI 4.0 into_all all code_regex _WDG replaceall_matched begin WDG end; into method label _WED set_label begin WED end; # Fix 0xFDFC0000 into_all all code_regex 0xFDFC0000 replaceall_matched begin 0xFDE00000 end; # Fix lower case into_all all code_regex pnp0c14 replaceall_matched begin PNP0C14 end; # Fix MUT0 into_all all code_regex (Acquire\s\(MUT0,\s0x)....\) replace_matched begin %1FFFF) end; # Fix SIOS into method label SIOS insert begin Return (Zero) end; # Fix USB missing package into_all all code_regex (Name\s*\(_PLD,\s*)Buffer(\s\(0x10\)[^\)]*) replaceall_matched begin %1Package(0x01) { Buffer%2} end; # Fix USB missing buffer into_all all code_regex (Name\s*\(_PLD,\s*)Package(\s\(0x10\)[^\)]*) replaceall_matched begin %1Package(0x01) { Buffer%2} end; # Fix TCMF Return Value into_all all code_regex If\s\(TCMF\)\s\{\} replaceall_matched begin If (TCMF) {Return (Zero)} end;