diff --git a/EFI-OpenCore/EFI/OC/config.plist b/EFI-OpenCore/EFI/OC/config.plist
index 09c94a4..2815cc9 100755
--- a/EFI-OpenCore/EFI/OC/config.plist
+++ b/EFI-OpenCore/EFI/OC/config.plist
@@ -1285,7 +1285,7 @@
Rg==
boot-args
- keepsyms=1 -hbfx-dump-nvram rtcfx_exclude=80-AB
+ rtcfx_exclude=80-AB
csr-active-config
AAAAAA==
diff --git a/patches/Debug Patches/Debug.plist b/patches/Debug Patches/Debug.plist
index 6a69bdc..c4f2853 100644
--- a/patches/Debug Patches/Debug.plist
+++ b/patches/Debug Patches/Debug.plist
@@ -1930,7 +1930,7 @@
7C436110-AB2A-4BBB-A880-FE41995C9F82
boot-args
- keepsyms=1 acpi_layer=0x8 acpi_level=0x2 debug=0x100
+ keepsyms=1 acpi_layer=0x8 acpi_level=0x2 debug=0x12a
diff --git a/patches/SSDT-INIT.dsl b/patches/SSDT-INIT.dsl
index 4f02663..b92ba66 100644
--- a/patches/SSDT-INIT.dsl
+++ b/patches/SSDT-INIT.dsl
@@ -52,16 +52,10 @@ DefinitionBlock ("", "SSDT", 2, "tyler", "_INIT", 0x00001000)
External (HPTE, FieldUnitObj) // HPET enabled?
External (WNTF, FieldUnitObj) // DYTC enabled?
External (DPTF, FieldUnitObj) // DPTF enabled?
- External (GPEN, FieldUnitObj) // GPIO enabled?
- External (SADE, FieldUnitObj) // B0D4 enabled?
- External (ACC0, FieldUnitObj) // TPM enabled?
-
- External (SDS8, FieldUnitObj)
- External (SMD8, FieldUnitObj)
If (OSDW ())
{
- Debug = "Set Variables..."
+ Debug = "INIT: Set Variables..."
// Disable HPET. It shouldn't be needed on modern systems anyway and is also disabled in genuine OSX
HPTE = Zero
@@ -71,15 +65,5 @@ DefinitionBlock ("", "SSDT", 2, "tyler", "_INIT", 0x00001000)
// Disable DPTF, we use DYTC!
DPTF = Zero
-
- // Enable broadcom BLTH-uart
- SDS8 = 0x02
- SMD8 = 0x02
-
- // Disable GPIO
- // GPEN = Zero
-
- // Disable B0D4
- // SADE = Zero
}
}
\ No newline at end of file
diff --git a/patches/SSDT-PLUG.dsl b/patches/SSDT-PLUG.dsl
index 704d412..2253dc5 100644
--- a/patches/SSDT-PLUG.dsl
+++ b/patches/SSDT-PLUG.dsl
@@ -5,6 +5,8 @@
DefinitionBlock ("", "SSDT", 2, "tyler", "_PLUG", 0x00001000)
{
External(_PR.PR00, ProcessorObj)
+ /* Support methods */
+ External (DTGP, MethodObj) // 5 Arguments
If (CondRefOf (\PR.PR00))
{
@@ -12,20 +14,14 @@ DefinitionBlock ("", "SSDT", 2, "tyler", "_PLUG", 0x00001000)
{
Method (_DSM, 4, NotSerialized)
{
- If (LEqual (Arg2, Zero))
+ Local0 = Package ()
{
- Return (Buffer (One)
- {
- 0x03
- })
- }
-
- Return (Package (0x02)
- {
- // Inject plugin-type = 0x01
- "plugin-type",
- One
- })
+ // Inject plugin-type = 0x01
+ "plugin-type",
+ One
+ }
+ DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
+ Return (Local0)
}
}
}
diff --git a/patches/SSDT-PMCR.dsl b/patches/SSDT-PMCR.dsl
index de38afc..d82dc9b 100755
--- a/patches/SSDT-PMCR.dsl
+++ b/patches/SSDT-PMCR.dsl
@@ -3,32 +3,21 @@
DefinitionBlock ("", "SSDT", 2, "tyler", "_PMCR", 0)
{
External (OSDW, MethodObj)
- External(_SB.PCI0.LPCB, DeviceObj)
Scope (_SB.PCI0.LPCB)
{
Device (PMCR)
{
- // Name (_ADR, 0x001F0002) // _ADR: Address
- Name (_HID, EisaId ("APP9876"))
- Name (_CRS, ResourceTemplate ()
- {
- Memory32Fixed (ReadWrite,
- 0xFE000000,
- 0x00010000
- )
+ Name (_ADR, 0x001F0002) // _ADR: Address
- })
Method (_STA, 0, NotSerialized)
{
If (OSDW ())
{
- Return (0x0B)
- }
- Else
- {
- Return (Zero)
+ Return (0x0F)
}
+
+ Return (Zero)
}
}
}
diff --git a/patches/SSDT-PNLF.dsl b/patches/SSDT-PNLF.dsl
index e86f8b8..b019c25 100644
--- a/patches/SSDT-PNLF.dsl
+++ b/patches/SSDT-PNLF.dsl
@@ -8,90 +8,49 @@
DefinitionBlock("", "SSDT", 2, "tyler", "_PNLF", 0)
{
External(_SB.PCI0.GFX0, DeviceObj)
- Scope(_SB.PCI0.GFX0)
- {
- OperationRegion(RMP1, PCI_Config, 2, 2)
- }
+ // OS Is Darwin?
+ External (OSDW, MethodObj) // 0 Arguments
// For backlight control
- Device(_SB.PCI0.GFX0.PNLF)
+ Scope(_SB.PCI0.GFX0)
{
- Name(_ADR, Zero)
- Name(_HID, EisaId("APP0002"))
- Name(_CID, "backlight")
- // _UID is set depending on device ID to match profiles in WhateverGreen
- // 14: Arrandale/Sandy/Ivy
- // 15: Haswell/Broadwell
- // 16: Skylake/KabyLake
- // 17: custom LMAX=0x7a1
- // 18: custom LMAX=0x1499
- // 19: CoffeeLake 0xffff
- Name(_UID, 0)
- Name(_STA, 0x0B)
-
- Field(RMP1, AnyAcc, NoLock, Preserve)
+ /**
+ * The purpose of the PNLF-device is to make AppleBacklight load.
+ *
+ * But it is not enough to make backlight working. There is a mismatch in PWM MAX between macOS and our laptop,
+ * so we need to fix that, either by patching macOS (which AppleBacklightSmoother and WhateverGreen's CoffeeLake patch does)
+ * or set PWM MAX in hardware to match that of macOS (which the traditional SSDT-PNLF does). In addition, we also need to set
+ * UID to match profiles defined in WhateverGreen). But each platform needs a different value. If you look into SSDT-PNLF
+ * (both from this repo and WhateverGreen), you would see it contains device-id of various IGPU. They are used for
+ * automatically detecting platform and injecting corresponding value.
+ *
+ * SSDT-PNLF from WhateverGreen also set PWM MAX, but as I said before, it's not needed for AppleBacklightSmoother as
+ * it patches macOS to work with all PWM MAX.
+ *
+ * (@hieplpvip, https://github.com/hieplpvip/AppleBacklightSmoother/issues/2#issuecomment-703273278)
+ */
+ Device (PNLF)
{
- GDID, 16
- }
+ Name (_HID, EisaId ("APP0002")) // _HID: Hardware ID
+ Name (_CID, "backlight") // _CID: Compatible ID
- Method(_INI)
- {
- Local0 = ^GDID
+ // _UID is set depending on device ID to match profiles in WhateverGreen
+ // 0x0E - 14: Arrandale/Sandy/Ivy
+ // 0x0F - 15: Haswell/Broadwell
+ // 0x10 - 16: Skylake/KabyLake
+ // 0x11 - 17: custom LMAX=0x7a1
+ // 0x12 - 18: custom LMAX=0x1499
+ // 0x13 - 19: CoffeeLake 0xffff
+ Name (_UID, 0x10) // _UID: Unique ID
- // check Arrandale/Sandy/Ivy
- If (Ones != Match(Package()
+ Method (_STA, 0, NotSerialized)
{
- // Arrandale
- 0x0042, 0x0046, 0x004a,
- // Sandy HD3000
- 0x0102, 0x0106, 0x010a, 0x010b, 0x010e,
- 0x0112, 0x0116, 0x0122, 0x0126,
- // Ivy
- 0x0152, 0x0156, 0x015a, 0x015e, 0x0162,
- 0x0166, 0x016a, 0x0172, 0x0176,
- }, MEQ, Local0, MTR, 0, 0))
- {
- _UID = 14
- }
+ If (OSDW ())
+ {
+ Return (0x0B)
+ }
- // check Haswell/Broadwell
- ElseIf (Ones != Match(Package()
- {
- // Haswell
- 0x0402, 0x0406, 0x040a, 0x0412, 0x0416,
- 0x041a, 0x041e, 0x0a06, 0x0a16, 0x0a1e,
- 0x0a22, 0x0a26, 0x0a2a, 0x0a2b, 0x0a2e,
- 0x0d12, 0x0d16, 0x0d22, 0x0d26, 0x0d2a,
- 0x0d36,
- // Broadwell
- 0x1612, 0x1616, 0x161e, 0x1622, 0x1626,
- 0x162a, 0x162b, 0x162d,
- }, MEQ, Local0, MTR, 0, 0))
- {
- _UID = 15
- }
-
- // check Skylake/Kaby Lake
- ElseIf (Ones != Match(Package()
- {
- // Skylake
- 0x1902, 0x1906, 0x190b, 0x1912, 0x1916,
- 0x191b, 0x191d, 0x191e, 0x1921, 0x1923,
- 0x1926, 0x1927, 0x192b, 0x192d, 0x1932,
- 0x193a, 0x193b,
- // Kaby Lake
- 0x5902, 0x5912, 0x5916, 0x5917, 0x591b,
- 0x591c, 0x591d, 0x591e, 0x5923, 0x5926,
- 0x5927, 0x87c0
- }, MEQ, Local0, MTR, 0, 0))
- {
- _UID = 16
- }
-
- // assume Coffee Lake and newer
- Else
- {
- _UID = 19
+ Return (Zero)
}
}
}
diff --git a/patches/SSDT-PWRB.dsl b/patches/SSDT-PWRB.dsl
index fa05141..02f7106 100755
--- a/patches/SSDT-PWRB.dsl
+++ b/patches/SSDT-PWRB.dsl
@@ -1,22 +1,30 @@
//Add PWRB
DefinitionBlock("", "SSDT", 2, "tyler", "PNP0C0C", 0)
{
+ External (OSDW, MethodObj)
+
//search PNP0C0C
Scope (\_SB)
{
+ // Adds ACPI power-button-device
+ // https://github.com/daliansky/OC-little/blob/master/06-%E6%B7%BB%E5%8A%A0%E7%BC%BA%E5%A4%B1%E7%9A%84%E9%83%A8%E4%BB%B6/SSDT-PWRB.dsl
Device (PWRB)
{
- Name (_HID, EisaId ("PNP0C0C"))
+ Name (_HID, EisaId ("PNP0C0C") /* Power Button Device */) // _HID: Hardware ID
+
+ Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
+ {
+ Return (Zero)
+ }
+
Method (_STA, 0, NotSerialized)
{
- If (_OSI ("Darwin"))
+ If (OSDW())
{
Return (0x0F)
}
- Else
- {
- Return (Zero)
- }
+
+ Return (Zero)
}
}
}
diff --git a/patches/SSDT-Sleep.dsl b/patches/SSDT-Sleep.dsl
index d584f17..7801b64 100644
--- a/patches/SSDT-Sleep.dsl
+++ b/patches/SSDT-Sleep.dsl
@@ -53,8 +53,7 @@ DefinitionBlock ("", "SSDT", 1, "tyler", "_Sleep", 0x00002000)
// Sleep-config from BIOS
External (S0ID, FieldUnitObj) // S0 enabled
External (STY0, FieldUnitObj) // S3 Enabled?
- External (LWCP, FieldUnitObj) // LID control power
-
+
// Package to signal to OS S3-capability. We'll add it if missing.
External (SS3, FieldUnitObj) // S3 Enabled?
@@ -70,9 +69,6 @@ DefinitionBlock ("", "SSDT", 1, "tyler", "_Sleep", 0x00002000)
// Disable S0 for now
S0ID = Zero
- // Enable LID control power
- LWCP = One
-
// This adds S3 for OSX, even when sleep=windows in bios.
If (STY0 == Zero && !CondRefOf (\_S3))
{
@@ -213,8 +209,10 @@ DefinitionBlock ("", "SSDT", 1, "tyler", "_Sleep", 0x00002000)
// Sync S0-state between BIOS and OS
Method (LPS0, 0, NotSerialized)
{
- Debug = "LPS0 - S0ID: "
- Debug = S0ID
+ If (S0ID == One)
+ {
+ Debug = "SLEEP: Enable S0-Sleep / DeepSleep"
+ }
// If S0ID is enabled, enable deep-sleep in OSX. Can be set above.
Return (S0ID)
@@ -243,105 +241,6 @@ DefinitionBlock ("", "SSDT", 1, "tyler", "_Sleep", 0x00002000)
}
}
-
- External (_SB.PCI0.LPCB, DeviceObj)
- External (_SB.PCI0.LPCB.EC.LID, DeviceObj)
- External (_SB.PCI0.LPCB.EC.LED, MethodObj) // 2 Arguments
- External (_SB.PCI0.LPCB.EC._Q2A, MethodObj) // 0 Arguments
- External (_SB.PCI0.LPCB.EC._Q2B, MethodObj) // 0 Arguments
-
-
- // Scope (_SB.PCI0.LPCB.EC.LID)
- // {
- // Name (AOAC, Zero)
- // }
-
- Scope (_SB.PCI0.LPCB)
- {
- Method (_PS0, 0, Serialized)
- {
- If (OSDW () && S0ID == One)
- {
- Debug = "LPCB:_PS0"
- Debug = "LPCB:_PS0 - old lid state LIDS: "
- Debug = \LIDS
-
- Debug = "LPCB:_PS0 - hw lid state LIDS: "
- Debug = \_SB.PCI0.LPCB.EC.HPLD
-
- Local1 = \LIDS
-
- \_SB.PCI0.LPCB.EC.LED (0x00, 0x80)
- \_SB.PCI0.LPCB.EC.LED (0x0A, 0x80)
- \_SB.PCI0.LPCB.EC.LED (0x07, 0x80)
-
- // Update lid-state
- \LIDS = \_SB.PCI0.LPCB.EC.HPLD
- \_SB.PCI0.GFX0.CLID = LIDS
-
- Debug = "LPCB:_PS0 - new lid state LIDS: "
- Debug = \LIDS
-
- // Fire missing lid-open event if lid was closed before.
- // Also notifies LID-device and sets LEDs to the right state on wake.
- If (Local1 == Zero)
- {
- Debug = "LPCB:_PS0 - fire lid open-event "
-
- // Lid-open Event
- \_SB.PCI0.LPCB.EC._Q2A ()
- }
-
- Sleep (200) /* Delay 200 */
-
- // Update ac-state
- \PWRS = \_SB.PCI0.LPCB.EC.AC._PSR ()
-
- // Notify (\_SB.PWRB, 0x80)
- }
-
- }
-
- Method (_PS3, 0, Serialized)
- {
- If (OSDW () && S0ID == One)
- {
- Debug = "LPCB:_PS3"
-
- \_SB.PCI0.LPCB.EC.LED (0x07, 0xA0)
- \_SB.PCI0.LPCB.EC.LED (0x00, 0xA0)
- \_SB.PCI0.LPCB.EC.LED (0x0A, 0xA0)
-
- // Update lid-state
- \LIDS = \_SB.PCI0.LPCB.EC.HPLD
- \_SB.PCI0.GFX0.CLID = LIDS
-
- Debug = "LPCB:_PS3 - lid state LIDS: "
- Debug = \LIDS
-
- If (\LIDS == Zero)
- {
- Debug = "LPCB:_PS3 - fire lid close-event "
-
- // Lid-open Event
- \_SB.PCI0.LPCB.EC._Q2B ()
-
- // \_SB.PCI0.LPCB.EC.LED (0x00, 0xA0)
- }
- }
- }
- }
-
-
- External (_SB.PCI0.LPCB.EC, DeviceObj)
-
- Scope (\_SB.PCI0.LPCB.EC)
- {
- Name (EWAI, Zero)
- Name (EWAR, Zero)
- }
-
-
External (_SB.PCI0.LPCB.EC.AC, DeviceObj)
// Patching AC-Device so that AppleACPIACAdapter-driver loads.
diff --git a/patches/SSDT-USBX.dsl b/patches/SSDT-USBX.dsl
index 8426ac6..0c67364 100644
--- a/patches/SSDT-USBX.dsl
+++ b/patches/SSDT-USBX.dsl
@@ -18,9 +18,10 @@ DefinitionBlock ("", "SSDT", 2, "tyler", "_USBX", 0x00001000)
{
Local0 = Package ()
{
- "kUSBSleepPortCurrentLimit", 1500,
+ // Values from genuine macbook14,1 with same USB-controller
+ "kUSBSleepPortCurrentLimit", 2100,
+ "kUSBWakePortCurrentLimit", 2100,
"kUSBSleepPowerSupply", 9600,
- "kUSBWakePortCurrentLimit", 1500,
"kUSBWakePowerSupply", 9600,
}
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))