1
0
Fork 0
mirror of https://github.com/tylernguyen/x1c6-hackintosh.git synced 2025-02-05 09:33:13 -06:00

Merge pull request #88 from benbender/suggestions

Various fixes & refinements
This commit is contained in:
Tyler Nguyen 2020-11-03 14:51:48 -06:00 committed by GitHub
commit 3983e6b061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 73 additions and 237 deletions

View file

@ -1285,7 +1285,7 @@
Rg==
</data>
<key>boot-args</key>
<string>keepsyms=1 -hbfx-dump-nvram rtcfx_exclude=80-AB</string>
<string>rtcfx_exclude=80-AB</string>
<key>csr-active-config</key>
<data>
AAAAAA==

View file

@ -1930,7 +1930,7 @@
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
<dict>
<key>boot-args</key>
<string>keepsyms=1 acpi_layer=0x8 acpi_level=0x2 debug=0x100</string>
<string>keepsyms=1 acpi_layer=0x8 acpi_level=0x2 debug=0x12a</string>
</dict>
</dict>
</dict>

View file

@ -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
}
}

View file

@ -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))
{
Return (Buffer (One)
{
0x03
})
}
Return (Package (0x02)
Local0 = Package ()
{
// Inject plugin-type = 0x01
"plugin-type",
One
})
}
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
}
}

View file

@ -3,33 +3,22 @@
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)
Return (0x0F)
}
Else
{
Return (Zero)
}
}
}
}
}

View file

@ -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")
/**
* 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)
{
Name (_HID, EisaId ("APP0002")) // _HID: Hardware ID
Name (_CID, "backlight") // _CID: Compatible ID
// _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)
// 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
Field(RMP1, AnyAcc, NoLock, Preserve)
Method (_STA, 0, NotSerialized)
{
GDID, 16
If (OSDW ())
{
Return (0x0B)
}
Method(_INI)
{
Local0 = ^GDID
// check Arrandale/Sandy/Ivy
If (Ones != Match(Package()
{
// 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
}
// 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)
}
}
}

View file

@ -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"))
Method (_STA, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
Return (0x0F)
}
Else
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 (OSDW())
{
Return (0x0F)
}
Return (Zero)
}
}
}

View file

@ -53,7 +53,6 @@ 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.

View file

@ -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))