[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)
- 簡介
- 基本命令
- 高效操作
- 命令操作
- 常用軟件
- 問題設置
- 命令行神器
- 開發配置
- 開發環境配置
- brew
- git
- Karabiner-Elements
- iTerm2
- MacVim
- aria2
- LaunchBar
- zsh
- Tmux
- Charles
- Emacs(感覺不需要了)
- 常用工具
- Alfred
- mac 詞典增強
- Mac 高級操作
- mac 資源
- 黑蘋果
- 個人配置
- 黑蘋果資源
- 驅動集合
- 工具集合
- 黑蘋果指南
- [FAQ] 開始必讀!筆記本電腦常見問題
- [指南] hackintosh之SSDT/DSDT
- [指南] hackintosh之hotpatch
- [指南] 為Sierra(以及后來的版本)進行USB電源屬性注入
- [指南] 10.11+ USB的變化和解決方案
- [指南] 為USBInjectAll.kext創建一個自定義的SSDT
- [指南] Intel IGPU HDMI/DP audio (Sandy/Ivy/Haswell/Broadwell/Skylake)
- [指南] 怎么給DSDT打補丁來顯示電池狀態
- [指南]在雙GPU筆記本電腦中禁用獨立顯卡.md
- [指南]
- OpenCore
- 多系統引導
- hotpatch
- 黑蘋果裝機
- 刷BIOS大法
- dd