into method label _DSM parent_adr 0x001F0000 remove_entry; into device name_adr 0x001F0000 insert begin OperationRegion (LPC0, PCI_Config, 0xA4, 0x02)\n Field (LPC0, ByteAcc, NoLock, Preserve)\n {\n AG3E, 1\n } end; # Add method DTGP to the main block, it's used by other patches # 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; into method label _DSM parent_adr 0x001D0007 remove_entry; into device name_adr 0x001D0007 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x08)\n {\n "AAPL,current-available", \n 0x05DC, \n "AAPL,current-extra", \n 0x044C, \n "AAPL,current-in-sleep", \n 0x09C4, \n "device-id", \n Buffer (0x04)\n {\n 0x3A, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001A0007 remove_entry; into device name_adr 0x001A0007 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x08)\n {\n "AAPL,current-available", \n 0x05DC, \n "AAPL,current-extra", \n 0x044C, \n "AAPL,current-in-sleep", \n 0x09C4, \n "device-id", \n Buffer (0x04)\n {\n 0x3A, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into device label PWRB code_regex (Name\s\()_HID(\,\sEisaId\s\(\"PNP0C0C\"\)\)) replace_matched begin %1_CID%2 end; # Change methods _STA and _CRS into device HPET (to avoid AppleIntelCPUPowerManagement panic) # 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 (ATT3)\n } end; into_all all code_regex Or\s\(0x03,\sPARM\) replaceall_matched begin Or (PARM, 0x03, PARM) end; # Remove IRQs from devices PIC, RTC and TMR, and add IRQs to device HPET # 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 %2 }) end; into method label _DSM parent_adr 0x001D0000 remove_entry; into device name_adr 0x001D0000 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001D0001 remove_entry; into device name_adr 0x001D0001 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001D0002 remove_entry; into device name_adr 0x001D0002 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001A0000 remove_entry; into device name_adr 0x001A0000 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001A0001 remove_entry; into device name_adr 0x001A0001 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001A0002 remove_entry; into device name_adr 0x001A0002 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into method label _DSM parent_adr 0x001D0003 remove_entry; into device name_adr 0x001D0003 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x34, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; # Change ID of device with _ADR 0x001F0000 (LPC) # into method label _DSM parent_adr 0x001F0000 remove_entry; into device name_adr 0x001F0000 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x18, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end; into device label SPKR remove_entry; into device label FDC remove_entry; into device label FDC0 remove_entry; into device label LPT1 remove_entry; into device label LPTE remove_entry; into device label ECP1 remove_entry; into device label \_SB.PCI0.PEX4.JMB0 remove_entry; into device label \_SB.PCI0.PEX4.JMB1 remove_entry; into device label PEX1.JMB0 remove_entry; into device label PEX1.JMB1 remove_entry; into device label MEM remove_entry; into device label ^^RMEM remove_entry; into device label FWH set_label begin FWHD end; into device label PIC set_label begin IPIC end; into device label DMA1 set_label begin DMAC end; into device label TMR set_label begin TIMR end; into device label RTC0 set_label begin RTC end; into device label COPR set_label begin MATH end; into device label OMSC set_label begin LDRC end; into device label IDE1 set_label begin SATA end; into device label CHN0 set_label begin PRT0 end; into device label CHN1 set_label begin PRT1 end; into device label USB0 set_label begin UHC1 end; into device label USB1 set_label begin UHC2 end; into device label USB2 set_label begin UHC3 end; into device label USB3 set_label begin UHC4 end; into device label USB4 set_label begin UHC5 end; into device label USB5 set_label begin UHC6 end; into device label USB6 set_label begin UHC7 end; into device label USBE set_label begin EHC1 end; into device label USE2 set_label begin EHC2 end; into device label PRIM set_label begin PRT0 end; into device label SECD set_label begin PRT1 end; into_all all code_regex TMR replaceall_matched begin TIMR end; into_all all code_regex RTC0 replaceall_matched begin RTC end; into_all all code_regex COPR replaceall_matched begin MATH end; into_all all code_regex OMSC replaceall_matched begin LDRC end; into_all all code_regex CHN0 replaceall_matched begin PRT0 end; into_all all code_regex CHN1 replaceall_matched begin PRT1 end; into_all all code_regex USB0 replaceall_matched begin UHC1 end; into_all all code_regex USB1 replaceall_matched begin UHC2 end; into_all all code_regex USB2 replaceall_matched begin UHC3 end; into_all all code_regex USB3 replaceall_matched begin UHC4 end; into_all all code_regex USB4 replaceall_matched begin UHC5 end; into_all all code_regex USB5 replaceall_matched begin UHC6 end; into_all all code_regex USB6 replaceall_matched begin UHC7 end; into_all all code_regex USBE replaceall_matched begin EHC1 end; into_all all code_regex USE2 replaceall_matched begin EHC2 end; into device name_adr 0x001E0000 set_label begin PCIB end; into_all all code_regex HUB0 replaceall_matched begin PCIB end; # Change the length of IO segment in device RTC to 0x02 (fix CMOS reset) # 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; # Insert device SBUS into device PCI0 # into device name_adr 0x001F0003 parent_label PCI0 remove_entry; into device label PCI0 insert begin Device (SBUS)\n {\n Name (_ADR, 0x001F0003)\n Device (BUS0)\n {\n Name (_CID, "smbus")\n Name (_ADR, Zero)\n Device (DVL0)\n {\n Name (_ADR, 0x57)\n Name (_CID, "diagsvault")\n }\n }\n Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x02)\n {\n "device-id", \n Buffer (0x04)\n {\n 0x30, 0x3A, 0x00, 0x00\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n }\n } end; # Insert return into method _WAK to fix warning # (for Gigabyte motherboards) # into method label _WAK code_regex Return\s\(\s*\n?\s*Package\s*\n?\s*\(0x02\)\s*\n?\s*\{\s*\n?(?:\s*Zero,?\s*\n?){2}\s*\}\s*\n?\s*\) remove_matched; into method label _WAK insert begin Return (Package (0x02)\n {\n Zero, \n Zero\n }) end; into method label \_WAK code_regex Return\s\(\s*\n?\s*Package\s*\n?\s*\(0x02\)\s*\n?\s*\{\s*\n?(?:\s*Zero,?\s*\n?){2}\s*\}\s*\n?\s*\) remove_matched; into method label \_WAK insert begin Return (Package (0x02)\n {\n Zero, \n Zero\n }) end; into scope label _SB insert begin Device (MCEH)\n {\n Name (_HID, EisaId ("APP0006"))\n Name (_GPE, 0x17)\n Name (_STA, 0x0B)\n } end; into scope label \_SB insert begin Device (MCEH)\n {\n Name (_HID, EisaId ("APP0006"))\n Name (_GPE, 0x17)\n Name (_STA, 0x0B)\n } end; # Change method _PTS where Arg0 is 0x05 (shutdown) # into method label _PTS code_regex (If\s*\(LEqual\s*\(Arg0,\s*0x05\)\)\s*\n\s*\{\s*\n)(?:[^\n\}]+\n)+(\s*\}) replace_matched begin %1 Store (One, \\_SB.PCI0.PX40.AG3E)\n Store (Zero, SLPE)\n Sleep (0x10)\n %2\n Else\n {\n Store (Zero, \\_SB.PCI0.PX40.AG3E)\n } end; into method label \_PTS code_regex (If\s*\(LEqual\s*\(Arg0,\s*0x05\)\)\s*\n\s*\{\s*\n)(?:[^\n\}]+\n)+(\s*\}) replace_matched begin %1 Store (One, \\_SB.PCI0.PX40.AG3E)\n Store (Zero, SLPE)\n Sleep (0x10)\n %2\n Else\n {\n Store (Zero, \\_SB.PCI0.PX40.AG3E)\n } end; into definitionblock code_regex . code_regex_not OperationRegion\s*\(PMRS insert begin OperationRegion (PMRS, SystemIO, 0x0430, One)\n Field (PMRS, ByteAcc, NoLock, Preserve)\n {\n , 4, \n SLPE, 1\n } end; # Rename device AZAL to HDEF and change all references to it # into device name_adr 0x001B0000 set_label begin HDEF end; into_all all code_regex AZAL replaceall_matched begin HDEF end; # Insert method _DSM into device with _ADR 0x001B0000 # into method label _DSM parent_adr 0x001B0000 remove_entry; into device name_adr 0x001B0000 insert begin Method (_DSM, 4, NotSerialized)\n {\n Store (Package (0x08)\n {\n "codec-id", \n Buffer (0x04)\n {\n 0x89, 0x08, 0xEC, 0x10\n }, \n "layout-id", \n Buffer (0x04)\n {\n 0x79, 0x03, 0x00, 0x00\n }, \n "device-type", \n Buffer (0x0F)\n {\n "Realtek ALC889"\n }, \n "PinConfigurations", \n Buffer (0x28)\n {\n /* 0000 */ 0x10, 0x90, 0xA0, 0x90, 0x20, 0x90, 0xA1, 0x02, \n /* 0008 */ 0x80, 0x30, 0x81, 0x01, 0x90, 0x40, 0x21, 0x02, \n /* 0010 */ 0x30, 0x40, 0x11, 0x01, 0x40, 0x10, 0x01, 0x01, \n /* 0018 */ 0x50, 0x60, 0x01, 0x01, 0x60, 0x20, 0x01, 0x01, \n /* 0020 */ 0x70, 0x61, 0x4B, 0x01, 0xA0, 0x01, 0xCB, 0x01\n }\n }, Local0)\n DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n Return (Local0)\n } end