🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] # 授人以渔 要参照对比学习! # 提取 DSDT 1. 在Mac 下,用MaciASL就可以直接获取DSDT信息(New from ACPI)。 2. 启动到 Clover 界面,按键盘 F4(部分笔记本可能是`F4+Fn`)会自动提取 DSDT 文件到 U 盘`EFI/ClOVER/ACPI/origin` 文件夹下 # FN 小太阳 用 MaciASL 打开 `DSDT.aml`,然后搜索 0x86 和 0x87 (不要问为什么是这两个值,不多谈,经验所得,知道这两个值是跟亮度调节有关的! 本机 是在 `_Q11` 和 `_Q12` 两个方法中! # 原生电源管理 1. MaciASL.app 打开 DSDT.aml 2. 然后搜索你 CPU 的名字。一般情况下,CPU 的名字可能是:`PR.CPU0`,`PR.P000`,`PR.PR00`,`SB.CPU0`,`SB.P000`,`SB.PR00`, `SCK0.C000`, `SCK0.CPU0`。请依次搜索直到找到自己的CPU名字,比如我的 PC 就是`PR.CPU0` 3. 仓库地址在这里:https://github.com/daliansky/OC-little ,找到“电源 -> 注入X86文件夹”,寻找包含有自己 CPU 名字的 dsl 文件。 4. 另存为,文件名字随便写吧,就叫`PLUG-XCPM.aml`,记住后缀为`.aml`。 5. 将 `PLUG-XCPM.aml`放入 OC 引导文件夹`EFI/OC/ACPI`下,并在 config.plist 中添加加载此`.aml`文件。 6. 重启系统(不行的话,可以尝试清理一次 nvram),我们看到“偏好设置–节能中,原生电源管理已经被加载了。 7. 一般有4项节能出现,而第五项“断电后重启”这项还需要加载 PPMC 以及 LPCB 下的 PMCR 才能出现。虽然说这项功能没啥鸟用,使用通用的`SSDT-PM.aml`载入即可。 提醒一下,并非所有的机型都可以开启“节能四项”或“节能五项”,如 Mac mini 仅提供三项,具体情况可以参考苹果官方帮助文档:https://support.apple.com/zh-cn/HT202824 。 > [手把手教你 黑苹果加载原生电源管理,开启节能五项!](https://macx.top/8842.html) ## 加载 AppleLPC 驱动原生电源管理 结合以下两个 方法,使用 Hackintool 工具 “> PCIe -> Device Name” 下 查找 LPC 关键字,来修改 VirtualSMC.kext 中的`info.plist`文件,注意字母小写! > [黑苹果最简单加载applelpc的方法利用 fakesmc](https://www.bilibili.com/video/av51049909/) # 电量显示(笔记本) 先搜索电池相关设备所在位置:是 `EC` 还是 `H_EC` 还是 `EC0`;本机 `EC` 位置: ``` Scope (_SB.PCI0.LPCB) { Device (EC) { Name (_HID, EisaId ("PNP0C09")) // _HID: Hardware ID ``` 可以看出 EC 的 ACPI 路径为 `_SB.PCI0.LPCB.EC`,我们需要寻找位于该范围下 `OperationRegion` 和 `Field` ## 筛选 过 8位 ``` OperationRegion (RAM, SystemMemory, 0xFF700100, 0x0100) Field (RAM, ByteAcc, Lock, Preserve) { ... } ... OperationRegion (EC81, EmbeddedControl, Zero, 0xFF) Field (EC81, ByteAcc, Lock, Preserve) { ... } ``` 清理找出 存在被调用的情况)整理出: 16 位: OEM3 拆分: OEM3:OE0M OE1M 32 位: BDC0 BFC0 BDV0 BST0 BPR0 BRC0 BPV0 BCW0 BCL0 拆分: BD0C BF0C BD0V BS0T BP0R BR0C ... 需要修改的 Method: ``` _SB.PCI0.LPCB.EC._Q35 _SB.PCI0.LPCB.EC._Q37 _SB.WMI.GCMD _SB.BAT0.UPBI _SB.BAT0.UPBS ``` ## 需要 16 位和32 位拆分函数 添加 16 位拆分读取 `B1B2` 函数 添加 32 位拆分读取 `B1B4` 函数 写入注意!: ``` Store (RECB (0x64, 0x0100), FB4) WECB (0x64, 0x0100, FB4) ``` ## 计算 offset 要点:8 bit 进 1 ``` OperationRegion (XRAM, SystemMemory, 0xFF700100, 0x0100) // 保持原来的起始偏移量,其他位置可能要加上原起始偏移量 Field (XRAM, ByteAcc, Lock, Preserve) { Offset (0x16), // 根据原 DSDT.dsl 位置的 BDC0 前一个值的位置(保持 8进1 ,十六进制) BD0C, 8, BD1C, 8, BD2C, 8, BD3C, 8, BF0C, 8, ``` ## EC 域外的引用修改 代码段: `If (LNot (^^LPCB.EC0.BATP (Zero)))` `^^LPCB.EC0.BATP` 这个方法写法中存在 `^^` 这两个字符,意思上级的上级域里面的,类似于相对路径,`LPCB.EC.BATP` 方法,完整路径就是 `\\\_SB.PCI0.LPCB.EC0.BATP`, 因为这个方法不在我们的 SSDT 里面,故此我们需要外部引入他。在 `External` 的部分加入 `External (\\\_SB.PCI0.LPCB.EC0.BATP, MethodObj)` 但是上面的 `^^LPCB.EC0.BATP` 这样的调用方法猜测应该是同一 SSDT 或是在 DSDT 中存在才能这样写,如果是外部引入后,我们需要将其改成绝对路径. 将 `^^LPCB.EC0.BATP` 替换成 `\\\_SB.PCI0.LPCB.EC0.BATP`. ``` * 140, 6084, Object does not exist (NBIX) ``` 或者: ``` B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M) 改为 If ((B1B2 (^^PCI0.LPCB.EC0.ADC0, ^^PCI0.LPCB.EC0.ADC1) < 0x0C80)) ``` ## 注意 改名函数参数个数! 注意返回值!不是所有函数都定义了返回值! ``` ... Else { IVBI () // 没有返回 } } Else { Return (\_SB.PCI0.LPCB.EC0.XTST(Arg0, Arg1)) // 这里其实不需要 Return ,并且加了参数 } ``` ## 改名! 最后好需要 配合在 `OC/ACPI/patch` 中改名! ## 结果: ```swift // battery // In config ACPI, _Q35 renamed XQ35 // Find: 5F513335 00 // Replace: 58513335 00 // // In config ACPI, _Q37 renamed XQ37 // Find: 5F513337 00 // Replace: 58513337 00 // // In config ACPI, GCMD renamed XCMD // Find: 47434D44 0B // Replace: 58434D44 0B // // In config ACPI, UPBI renamed XPBI // Find: 55504249 00 // Replace: 58504249 00 // // In config ACPI, UPBS renamed XPBS // Find: 55504253 00 // Replace: 58504253 00 // DefinitionBlock ("", "SSDT", 2, "ACDT", "BATT", 0x00000000) { External (_SB.PCI0.LPCB.EC, DeviceObj) External (_SB.PCI0.PEG0.PEGP, DeviceObj) External (_SB.BAT0, DeviceObj) // 0 Arguments External (_SB.WMI, DeviceObj) // 0 Arguments External (_SB.WMI.GCMD, MethodObj) // 0 Arguments External (_SB.BAT0.IVBI, MethodObj) // 0 Arguments External (_SB.BAT0.IVBS, MethodObj) // 0 Arguments External (_SB.BAT0.PBST, PkgObj) External (_SB.BAT0.PBIF, PkgObj) External (GNVS, FieldUnitObj) External (NVBB, FieldUnitObj) External (BSCP, FieldUnitObj) External (PSF2, FieldUnitObj) External (BAEE, FieldUnitObj) External (BTCP, FieldUnitObj) External (PSF0, FieldUnitObj) External (P80H, FieldUnitObj) External (PSF1, FieldUnitObj) External (PSST, FieldUnitObj) External (VGAS, FieldUnitObj) External (_SB.PCI0.LPCB.EC.FCMD, FieldUnitObj) External (_SB.PCI0.LPCB.EC.FDAT, FieldUnitObj) External (_SB.PCI0.LPCB.EC.BBST, FieldUnitObj) External (_SB.PCI0.LPCB.EC.BAT0, FieldUnitObj) External (_SB.PCI0.LPCB.EC.FBUF, FieldUnitObj) External (_SB.PCI0.LPCB.EC.FBF1, FieldUnitObj) External (_SB.PCI0.LPCB.EC.FBF2, FieldUnitObj) External (_SB.PCI0.LPCB.EC.B15C, IntObj) External (_SB.PCI0.LPCB.EC.SLFG, IntObj) External (_SB.PCI0.LPCB.EC.ECOK, IntObj) External (_SB.AC.ACFG, IntObj) External (_SB.WMI.INDX, IntObj) External (_SB.WMI.EVNT, IntObj) External (_SB.WMI.HKDR, IntObj) External (_SB.BAT0.BFCC, IntObj) External (_TZ.TZ0.PPFG, IntObj) External (_SB.AC.ADJP, MethodObj) External (_SB.PCI0.GFX0.PDDS, MethodObj) External (_SB.WMI.XCMD, MethodObj) // 3 Arguments External (_SB.PCI0.LPCB.EC.XQ35, MethodObj) // 0 Arguments External (_SB.PCI0.LPCB.EC.XQ37, MethodObj) // 0 Arguments External (_SB.BAT0.XPBI, MethodObj) // 0 Arguments External (_SB.BAT0.XPBS, MethodObj) // 0 Arguments // 16 bits chaifeng Method (B1B2, 2, NotSerialized) { Return ((Arg0 | (Arg1 << 0x08))) } // 32 bits chaifeng Method (B1B4, 4, NotSerialized) { Local0 = (Arg2 | (Arg3 << 0x08)) Local0 = (Arg1 | (Local0 << 0x08)) Local0 = (Arg0 | (Local0 << 0x08)) Return (Local0) } Scope (_SB.BAT0) { Method (UPBI, 0, NotSerialized) { If (_OSI ("Darwin")) { If (\_SB.PCI0.LPCB.EC.BAT0) { And (B1B4 (^^PCI0.LPCB.EC.BD0C, ^^PCI0.LPCB.EC.BD1C, ^^PCI0.LPCB.EC.BD2C, ^^PCI0.LPCB.EC.BD3C), 0xFFFF, Local0) Store (Local0, Index (PBIF, One)) And (B1B4 (^^PCI0.LPCB.EC.BF0C, ^^PCI0.LPCB.EC.BF1C, ^^PCI0.LPCB.EC.BF2C, ^^PCI0.LPCB.EC.BF3C), 0xFFFF, Local0) Store (Local0, Index (PBIF, 0x02)) Store (Local0, BFCC) And (B1B4 (^^PCI0.LPCB.EC.BD0V, ^^PCI0.LPCB.EC.BD1V, ^^PCI0.LPCB.EC.BD2V, ^^PCI0.LPCB.EC.BD3V), 0xFFFF, Local0) Store (Local0, Index (PBIF, 0x04)) And (B1B4 (^^PCI0.LPCB.EC.BC0W, ^^PCI0.LPCB.EC.BC1W, ^^PCI0.LPCB.EC.BC2W, ^^PCI0.LPCB.EC.BC3W), 0xFFFF, Local0) Store (Local0, Index (PBIF, 0x05)) And (B1B4 (^^PCI0.LPCB.EC.BC0L, ^^PCI0.LPCB.EC.BC1L, ^^PCI0.LPCB.EC.BC2L, ^^PCI0.LPCB.EC.BC3L), 0xFFFF, Local0) Store (Local0, Index (PBIF, 0x06)) Store ("BAT", Index (PBIF, 0x09)) Store ("0001", Index (PBIF, 0x0A)) Store ("LION", Index (PBIF, 0x0B)) Store ("Notebook", Index (PBIF, 0x0C)) } Else { IVBI () } } Else { \_SB.BAT0.XPBI () } } Method (UPBS, 0, NotSerialized) { If (_OSI ("Darwin")) { If (\_SB.PCI0.LPCB.EC.BAT0) { Store (Zero, Local0) Store (Zero, Local1) If (^^AC.ACFG) { If (LEqual (And (B1B4 (^^PCI0.LPCB.EC.BS0T, ^^PCI0.LPCB.EC.BS1T, ^^PCI0.LPCB.EC.BS2T, ^^PCI0.LPCB.EC.BS3T), 0x02), 0x02)) { Or (Local0, 0x02, Local0) And (B1B4 (^^PCI0.LPCB.EC.BP0R, ^^PCI0.LPCB.EC.BP1R, ^^PCI0.LPCB.EC.BP2R, ^^PCI0.LPCB.EC.BP3R), 0xFFFF, Local1) } } Else { Or (Local0, One, Local0) And (B1B4 (^^PCI0.LPCB.EC.BP0R, ^^PCI0.LPCB.EC.BP1R, ^^PCI0.LPCB.EC.BP2R, ^^PCI0.LPCB.EC.BP3R), 0xFFFF, Local1) } And (Local1, 0x8000, Local7) If (LEqual (Local7, 0x8000)) { XOr (Local1, 0xFFFF, Local1) } And (B1B4 (^^PCI0.LPCB.EC.BR0C, ^^PCI0.LPCB.EC.BR1C, ^^PCI0.LPCB.EC.BR2C, ^^PCI0.LPCB.EC.BR3C), 0xFFFF, Local2) And (B1B4 (^^PCI0.LPCB.EC.BP0V, ^^PCI0.LPCB.EC.BP1V, ^^PCI0.LPCB.EC.BP2V, ^^PCI0.LPCB.EC.BP3V), 0xFFFF, Local3) Store (Local0, Index (PBST, Zero)) Store (Local1, Index (PBST, One)) Store (Local2, Index (PBST, 0x02)) Store (Local3, Index (PBST, 0x03)) If (LNotEqual (BFCC, B1B4 (^^PCI0.LPCB.EC.BF0C, ^^PCI0.LPCB.EC.BF1C, ^^PCI0.LPCB.EC.BF2C, ^^PCI0.LPCB.EC.BF3C))) { Notify (BAT0, 0x81) } } Else { IVBS () } } Else { \_SB.BAT0.XPBS () } } } Scope (_SB.WMI) { Method (GCMD, 3, Serialized) { If (_OSI ("Darwin")) { Name (ARGS, Zero) If (SizeOf (Arg2)) { Store (Arg2, ARGS) } Store (Zero, Local0) If (LEqual (ToInteger (Arg1), One)) { If (\_SB.WMI.HKDR) { Store (\_SB.WMI.EVNT, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x05)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M), 0x08)) { If (And (Local1, 0x02)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Else { Store (0x02, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x06)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M), 0x04)) { If (And (Local1, One)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Else { Store (0x02, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x07)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M), 0x10)) { If (And (Local1, 0x04)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Else { Store (0x02, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x09)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (Local1, 0x10)) { Store (One, Local0) } Else { Store (Zero, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x0A)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M), 0x20)) { If (And (Local1, 0x08)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Else { Store (0x02, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x10)) { If (^^PCI0.LPCB.EC.SLFG) { Or (Local0, One, Local0) } If (\_TZ.TZ0.PPFG) { Or (Local0, 0x02, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x11)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0xA1, ^^PCI0.LPCB.EC.FDAT) Store (0xB8, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) If (And (Local1, 0x40)) { Store (One, Local0) } Else { Store (Zero, Local0) } Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x12)) { If (^^PCI0.LPCB.EC.ECOK) { If (And (B1B2 (^^PCI0.LPCB.EC.OE0M, ^^PCI0.LPCB.EC.OE1M), 0x0800)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x32)) { If (^^PCI0.LPCB.EC.ECOK) { Store (B1B4 (^^PCI0.LPCB.EC.BD0C, ^^PCI0.LPCB.EC.BD1C, ^^PCI0.LPCB.EC.BD2C, ^^PCI0.LPCB.EC.BD3C), Local0) } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x33)) { If (^^PCI0.LPCB.EC.ECOK){} Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x34)) { If (^^PCI0.LPCB.EC.ECOK){} Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x38)) { Store (One, Local0) Return (Local0) } If (LEqual (ToInteger (Arg1), 0x39)) { Return (Zero) } If (LEqual (ToInteger (Arg1), 0x3B)) { Noop Return (Local0) } If (LEqual (ToInteger (Arg1), 0x3C)) { If (LEqual (And (PSF0, 0x10), Zero)) { If (^^PCI0.GFX0.PDDS (0x0300)) { Store (One, Local0) } Else { Store (Zero, Local0) } } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x3D)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0x61, P80H) Store (One, ^^PCI0.LPCB.EC.FDAT) Store (0xCA, ^^PCI0.LPCB.EC.FCMD) Store (^^PCI0.LPCB.EC.FBUF, Local0) } Else { Store (Zero, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x3F)) { Store (Zero, Local0) Return (Local0) } If (LEqual (ToInteger (Arg1), 0x43)) { If (^^PCI0.LPCB.EC.ECOK){} Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x44)) { Store (0x03, ^^PCI0.LPCB.EC.FDAT) Store (0xCD, ^^PCI0.LPCB.EC.FCMD) Store (^^PCI0.LPCB.EC.FBUF, Local0) Return (Local0) } If (LEqual (ToInteger (Arg1), 0x45)) { Return (Local0) } If (LEqual (ToInteger (Arg1), 0x51)) { Noop Return (Local0) } If (LEqual (ToInteger (Arg1), 0x52)) { Or (Local0, 0x40000000, PSF1) Or (PSF1, 0x00200000, PSF1) Return (PSF1) } If (LEqual (ToInteger (Arg1), 0x54)) { Return (VGAS) } If (LEqual (ToInteger (Arg1), 0x62)) { Return (Zero) } If (LEqual (ToInteger (Arg1), 0x63)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0x02, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) Store (^^PCI0.LPCB.EC.FDAT, Local1) Store (^^PCI0.LPCB.EC.FBF2, Local2) Store (0x03, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) Store (^^PCI0.LPCB.EC.FDAT, Local1) Store (^^PCI0.LPCB.EC.FBF2, Local0) Or (ShiftLeft (Local0, 0x08), Local2, Local0) Or (ShiftLeft (Local0, 0x08), Local1, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x64)) { If (^^PCI0.LPCB.EC.ECOK) { Store (Zero, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local0) Store (^^PCI0.LPCB.EC.FBUF, Local2) Store (^^PCI0.LPCB.EC.FBF1, Local3) Or (ShiftLeft (Local0, 0x08), Local2, Local0) Or (ShiftLeft (Local0, 0x08), Local3, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x6E)) { If (^^PCI0.LPCB.EC.ECOK) { Store (One, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local0) Store (^^PCI0.LPCB.EC.FBUF, Local2) Store (^^PCI0.LPCB.EC.FBF1, Local3) Or (ShiftLeft (Local0, 0x08), Local2, Local0) Or (ShiftLeft (Local0, 0x08), Local3, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x6F)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0x02, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) Store (^^PCI0.LPCB.EC.FBF2, Local0) Or (ShiftLeft (Local0, 0x08), Local0, Local0) Or (ShiftLeft (Local0, 0x08), Local1, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x70)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0x03, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FBUF, Local1) Store (^^PCI0.LPCB.EC.FBF1, Local0) Or (ShiftLeft (Local1, 0x08), Local0, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } Store (0x04, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local2) Store (^^PCI0.LPCB.EC.FBUF, Local1) Or (ShiftLeft (Local2, 0x08), Local1, Local1) Or (ShiftLeft (Local1, 0x10), Local0, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x71)) { If (^^PCI0.LPCB.EC.ECOK) { Store (0x05, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FDAT, Local1) Store (^^PCI0.LPCB.EC.FBUF, Local0) Or (ShiftLeft (Local1, 0x08), Local0, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } Store (0x02, ^^PCI0.LPCB.EC.FDAT) Store (0xC0, ^^PCI0.LPCB.EC.FCMD) If (One) { Store (^^PCI0.LPCB.EC.FBUF, Local2) Store (^^PCI0.LPCB.EC.FBF1, Local1) Or (ShiftLeft (Local2, 0x08), Local1, Local1) Or (ShiftLeft (Local1, 0x10), Local0, Local0) Store (Zero, ^^PCI0.LPCB.EC.FCMD) } } Else { Store (Ones, Local0) } Return (Local0) } If (LEqual (ToInteger (Arg1), 0x73)) { And (INDX, 0xFFFF, Local1) And (ShiftRight (INDX, 0x10), 0xFFFF, Local2) If (LGreater (Local2, 0x02)) { Store (Zero, Local2) } If (LGreater (Local1, 0xFF)) { Return (Zero) } ShiftLeft (One, Local2, Local2) Store (Local2, Local3) Decrement (Local3) If (LGreater (Add (Local1, Local3), 0xFF)) { Return (Zero) } Add (Local1, 0xFF700100, Local0) Name (RBUF, Buffer (0x04) { 0x00, 0x00, 0x00, 0x00 }) If (^^PCI0.LPCB.EC.ECOK) { OperationRegion (RH2M, SystemMemory, Local0, Local2) Switch (ToInteger (Local2)) { Case (One) { Field (RH2M, ByteAcc, Lock, Preserve) { RHMB, 8 } Store (RHMB, RBUF) } Case (0x02) { Field (RH2M, ByteAcc, Lock, Preserve) { RHMW, 16 } Store (RHMW, RBUF) } Case (0x04) { Field (RH2M, ByteAcc, Lock, Preserve) { RHMD, 32 } Store (RHMD, RBUF) } } } Return (RBUF) } If (LEqual (ToInteger (Arg1), 0x77)) { Store (ShiftRight (BAEE, One), Local0) Or (Local0, ShiftLeft (BSCP, 0x08), Local0) Or (Local0, ShiftLeft (BTCP, 0x10), Local0) Return (Local0) } If (LEqual (ToInteger (Arg1), 0x7A)) { Store (And (PSF2, 0xFFFFFFFFFFFFFBFF), Local0) If (PSST) { Or (Local0, 0x0400, Local0) } If (PSST) { Or (Local0, 0x0400, Local0) } Or (Local0, 0x02, Local0) Or (Local0, 0x04, Local0) Or (Local0, 0x10, Local0) Or (Local0, 0x40, Local0) Or (Local0, 0x4000, Local0) Or (Local0, 0x00020000, Local0) Or (Local0, 0x00080000, Local0) Or (Local0, 0x00100000, Local0) Return (Local0) } Return (Ones) } Else { Return (\_SB.WMI.XCMD (Arg0, Arg1, Arg2)) } } } Scope (\_SB.PCI0.LPCB.EC) { OperationRegion (XRAM, SystemMemory, 0xFF700100, 0x0100) // 保持原来的起始偏移量 Field (XRAM, ByteAcc, Lock, Preserve) { Offset (0x16), // 根据原 DSDT.dsl 位置的 BDC0 前一个值的位置(保持 8进1 ,十六进制) BD0C, 8, BD1C, 8, BD2C, 8, BD3C, 8, BF0C, 8, BF1C, 8, BF2C, 8, BF3C, 8, Offset (0x22), BD0V, 8, BD1V, 8, BD2V, 8, BD3V, 8, BS0T, 8, BS1T, 8, BS2T, 8, BS3T, 8, BP0R, 8, BP1R, 8, BP2R, 8, BP3R, 8, BR0C, 8, BR1C, 8, BR2C, 8, BR3C, 8, BP0V, 8, BP1V, 8, BP2V, 8, BP3V, 8, Offset (0x3A), BC0W, 8, BC1W, 8, BC2W, 8, BC3W, 8, BC0L, 8, BC1L, 8, BC2L, 8, BC3L, 8, Offset (0xCA), OE0M, 8, OE1M, 8 } Method (_Q35, 0, NotSerialized) // _Qxx: EC Query { If (_OSI ("Darwin")) { Store (0x35, P80H) If (^^^^WMI.HKDR) { If (And (B1B2 (OE0M, OE1M), 0x8000)) { Store (One, SLFG) Store (0xDE, ^^^^WMI.EVNT) } Else { Store (Zero, SLFG) Store (0xDF, ^^^^WMI.EVNT) } } Notify (WMI, 0xD0) ^^^^AC.ADJP (Zero) } Else { \_SB.PCI0.LPCB.EC.XQ35 () } } Method (_Q37, 0, NotSerialized) // _Qxx: EC Query { If (_OSI ("Darwin")) { Store (0x37, P80H) Store (B1B2 (OE0M, OE1M), Local0) If (And (Local0, 0x2000)) { Store (One, B15C) } Else { Store (Zero, B15C) } If (And (NVBB, 0xFFFF)) { If (LNotEqual (And (PSF1, 0x30), 0x20)) { Store (Zero, BBST) Store (And (NVBB, 0x0F), Local1) } Else { If (And (Local0, 0x2000)) { Add (And (ShiftRight (NVBB, 0x08), 0xFF), And (NVBB, 0xFF), Local1) Decrement (Local1) } Else { Store (And (NVBB, 0x0F), Local1) } Store (Or (And (ShiftRight (NVBB, 0x04), 0xF0), Local1), BBST) } Notify (^^^PEG0.PEGP, Or (Local1, 0xD0)) } ^^^^AC.ADJP (Zero) } Else { \_SB.PCI0.LPCB.EC.XQ37 () } } } } ``` 将驱动 [ACPIBatteryManager.kext](https://github.com/fishrong/ASUS-FL5500L-EFI/tree/master/EFI/CLOVER/kexts/Other/ACPIBatteryManager.kext/Contents) 放到 clover 的 kexts 目录下,再向 **DSDT** 中打相应补丁,在 [Rehabman 电池补丁](https://github.com/RehabMan/Laptop-DSDT-Patch/tree/master/battery)找自己电脑相应型号的补丁。将生成的 **DSDT.aml** 放到 **EFI/CLOVER/patched/。** 如果重启没有效果,可尝试拔下电源适配器(笔记本)再重启。 # 屏蔽独显 我的笔记本好像直接可以在bios里面关闭独显, 但是集显还是要驱动的! ## 参考 [【Hotpatch】安装 10.13 时屏蔽独显的方法分享(EC 相关\_OFF 方法)](http://bbs.pcbeta.com/viewthread-1778010-1-1.html) # acpi 打补丁 – OpenCore 为了让黑果更加接近白果,在很多方面我们都需要打补丁,如 USB,原生电源管理,开关机,显卡等等很多方面完善都需要用到打补丁。 我们举个例子说明如何打补丁 。 比如我们想把xhc 下的 `_PRW` 进行改名为 `XPRW`。 ~~~ Comment String XHC:_PRW to XPRW Count Number //需要重点解释 Enabled Boolean True //表示应用此补丁,不应用选False Find Data 5F505257 //hex转text的含义即是:_PRW Limit Number 0 //这个按默认即可 不去管他 Mask Data <> //这个按默认即可 不去管他 OemTableId Data <> //这个按默认即可 不去管他 Replace Data 58505257 //hex转text的含义即是:XPRW ReplaceMask Data <> //这个按默认即可 不去管他 Skip Number //需要重点解释 TableLength Number 0 //这个按默认即可 不去管他 TableSignature Data 44534454 //hex转text的含义即是:DSDT,这里按默认即可,代表对dsdt进行修改 ~~~ oc 的 tgtbridge 是通过一个数过去来定位具体哪一个位置的。 比如 xhc 的 prw 是整张 dsdt 里面的第 55 个,那 skip 填 54,意味着跳过前 54 个,从第 55 个开始执行。那执行多少次呢?执行一次 count 就填 1;比如你要同时改第 55 个和 56 个,那 count 就填 2。 ``` grep -nr "GPRW" *.dsl // 查找具体位置 grep -cnr "GPRW" *.dsl // 查找具体个数 ``` 然后以 -v 重启,看看能不能正常开机。如果可以正常开机,登录以后打开终端执行以下命令,查看日志中是否包括 ACPI Error: ``` $ log show --last boot | grep -Ei "ACPI" ``` > [3.10.2 方法二:沿用 Clover 版本的 0D/06 补丁 & 展示 TgtBridge 在 OC 下的用法](https://www.jianshu.com/p/275789cc105f) # 睡眠问题 ## 解决睡眠即醒的问题。 [https://www.jianshu.com/p/275789cc105f](https://www.jianshu.com/p/275789cc105f) # 未完成 voodoops2controller 换成 其他作者的 ## 相同 DSDT 机型整理 [http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1827111](http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1827111) # 参考 [ACPI 官方指导网址](https://dortania.github.io/Getting-Started-With-ACPI/) [Getting-Started-With-ACPI](https://khronokernel.github.io/Getting-Started-With-ACPI/) [OC-little hotpatch](https://github.com/daliansky/OC-little) [【分享】我的 Hotpatch 学习笔记](http://bbs.pcbeta.com/viewthread-1733965-1-1.html) https://xstar-dev.github.io/hackintosh_advanced/Guide_For_Battery_Hotpatch.html [[Guide] Using Clover to "hotpatch" ACPI](https://www.tonymacx86.com/threads/guide-using-clover-to-hotpatch-acpi.200137/) [DSDT 基础知识收集](https://www.jianshu.com/p/8bbb1cef40e2)