Skip to content

Latest commit

 

History

History
138 lines (87 loc) · 7.95 KB

README.md

File metadata and controls

138 lines (87 loc) · 7.95 KB

SSDT-O2SD — O2 Micro 8520 SD 读卡器黑苹果冷启动修复

English below

修复 O2 Micro / BayHubTech PCI SD 读卡器(VEN_1217&DEV_8520,代号 FUJIN2)在 macOS 下冷启动不识别的问题。

问题现象

用 CtlnaSDXC.kext + Broadcom 仿冒(pci14e4,16bc)驱动这颗读卡器时:

  • 从 Windows 重启进 macOS → 一切正常 ✅
  • 关机后冷启动进 macOS → 驱动加载了(kextstat 可见)但找不到硬件,SD 卡不识别 ❌

根因:这颗芯片需要厂商私有的 PCI 配置空间初始化序列才能工作,该状态断电即丢。Windows 驱动每次开机都会写入,macOS 侧没有任何驱动会写——所以只有热重启(芯片还保留着 Windows 写好的状态)才能用。

解决方案

本 SSDT 把 Linux 内核驱动 sdhci-pci-o2micro.c 中 FUJIN2 的完整初始化序列(约 17 条寄存器写入:PLL、时钟、DLL 调谐窗口、LDO 电压等)移植为 ACPI _INI 方法,每次开机自动执行,彻底根治冷启动问题。

完整方案三件套(缺一不可)

  1. CtlnaSDXC.kext(Big Sur AppleSDXC 移植版,macOS 12+ 必需)→ EFI/OC/Kexts/

  2. DeviceProperties 仿冒(把设备伪装成 BCM57765): 路径 PciRoot(0x0)/Pci(0x1D,0x0)/Pci(0x0,0x0)(SV8;你的机器可能不同):

    Key Type Value
    compatible String pci14e4,16bc
    IOName String pci14e4,16bc
    name String pci14e4,16bc
    device-type String SD Host controller
    device-id Data vBY=
    vendor-id Data 5BQ=
    model String BCM57765/57785 SDXC/MMC Card Reader
  3. 本 SSDT → SSDT-O2SD.aml 放入 EFI/OC/ACPI/,并在 config.plist 的 ACPI → Add 中注册

CtlnaSDXC 下载渠道

原项目仓库已从 GitHub 消失,但 1.9.0 版本在多个 Hackintosh EFI 仓库中有完整镜像(已核实均包含二进制本体,大小应为 363,968 字节):

下载整个仓库 ZIP(Code → Download ZIP)后从中提取 CtlnaSDXC.kext 文件夹即可。

⚠️ 重要:修改 ACPI 路径

SSDT 中的路径 \_SB.PCI0.RP11.PXSX 是松下 Let's Note CF-SV8 的读卡器路径,你的机器很可能不同(如 RP05.PXSX)。查找方法:

  • Windows:设备管理器 → 读卡器设备 → 属性 → 详细信息 → "BIOS 设备名称"(如 \_SB.PCI0.RP11.PXSX)
  • macOS:ioreg -p IODeviceTree -n PXSX -r | grep acpi-path

改完 SSDT-O2SD.dsl 里的路径后用 iASL 重新编译:iasl SSDT-O2SD.dsl

已知限制

  • S3 睡眠唤醒后读卡器失效(芯片睡眠断电丢初始化 + CtlnaSDXC 二进制驱动唤醒后不重新认卡,拔插无效)。以下方案均已实测无效,请勿再尝试:

    • _WAK 钩子重跑初始化序列(硬件确实重新初始化了,但驱动不理)
    • 给设备声明唤醒能力 _PRW / _S3D / _S3W / _S0W(macOS 不会为没有驱动唤醒请求的设备武装 PME)
    • _PTS 钩子里沿 PCI 能力链表手动武装 PME_En(平台依旧切断槽位供电,或者芯片活着但驱动依旧不认——两头都堵死)

    绕行方案:

    • 重启即恢复(SSDT 每次开机都会重跑初始化)
    • 或 sudo pmset -a hibernatemode 25 改用深度休眠(唤醒走类冷启动路径,读卡器存活,但唤醒较慢)
  • SD 卡热插拔支持不佳,建议开机前插好卡

测试环境

  • 松下 Let's Note CF-SV8(i5-8365U)
  • macOS Sequoia 15.7.7 + OpenCore 1.0.5
  • CtlnaSDXC 1.9.0

致谢与许可

  • 初始化序列移植自 Linux 内核 drivers/mmc/host/sdhci-pci-o2micro.c(BayHub Technology Ltd.)
  • CtlnaSDXC.kext 原作者及远景论坛相关教程作者
  • 本项目以 GPL-2.0 许可发布(衍生自 Linux 内核代码)

SSDT-O2SD — O2 Micro 8520 SD Reader Cold-Boot Fix for Hackintosh

Fixes the O2 Micro / BayHubTech PCIe SD card reader (VEN_1217&DEV_8520, codename FUJIN2) not being detected after a cold boot on macOS.

The problem

With CtlnaSDXC.kext + Broadcom spoof (pci14e4,16bc):

  • Warm reboot from Windows into macOS → reader works ✅
  • Cold boot into macOS → kext loads (visible in kextstat) but never attaches; no SD card ❌

Root cause: the chip requires a vendor-specific PCI config-space init sequence that only the Windows driver performs. The state is lost on power-off, and nothing on the macOS side re-applies it — so the reader only survived warm reboots (chip retained Windows' initialization).

The fix

This SSDT replays the complete FUJIN2 init sequence (~17 register writes: PLL, clocks, DLL tuning window, LDO voltage, etc.) ported from the Linux kernel driver sdhci-pci-o2micro.c, inside an ACPI _INI method that runs at every boot.

You need all three parts

  1. CtlnaSDXC.kext (Big Sur AppleSDXC port, required on macOS 12+) in EFI/OC/Kexts/
  2. DeviceProperties spoof as BCM57765 (see Chinese table above; PCI path shown is for the SV8)
  3. This SSDT: SSDT-O2SD.aml in EFI/OC/ACPI/ + registered in config.plist ACPI → Add

Where to get CtlnaSDXC

The original project repo has vanished from GitHub, but v1.9.0 is fully mirrored inside several Hackintosh EFI repos (verified to contain the actual binary — it should be 363,968 bytes):

Download the repo ZIP (Code → Download ZIP) and extract the CtlnaSDXC.kext folder.

⚠️ Adjust the ACPI path

\_SB.PCI0.RP11.PXSX is the reader path on the Panasonic Let's Note CF-SV8 — yours will likely differ (e.g. RP05.PXSX). Find it via Windows Device Manager (device Properties → Details → "BIOS device name") or ioreg -p IODeviceTree -n PXSX -r | grep acpi-path on macOS. Edit the .dsl and recompile with iASL.

Known limitations

  • Reader dies after S3 sleep (chip loses init in sleep + the CtlnaSDXC binary never re-detects media; re-plugging doesn't help). All of the following were tested and confirmed not to work — save yourself the trouble:

    • A _WAK hook replaying the init sequence (the hardware re-initializes cleanly; the driver ignores it)
    • Declaring wake capability via _PRW / _S3D / _S3W / _S0W (macOS won't arm PME for a device whose driver never requested wake)
    • Arming PME_En manually from a _PTS hook, walking the PCI capability list (the platform still cuts slot power — or the chip survives and the driver still doesn't care; dead end either way)

    Workarounds: reboot (init re-runs every boot), or sudo pmset -a hibernatemode 25 (deep hibernation; wake takes longer but the reader survives).

  • Hot-plug is unreliable; insert the card before boot.

Tested on

  • Panasonic Let's Note CF-SV8 (i5-8365U)
  • macOS Sequoia 15.7.7 + OpenCore 1.0.5 + CtlnaSDXC 1.9.0

Credits & License

Init sequence ported from Linux kernel drivers/mmc/host/sdhci-pci-o2micro.c (BayHub Technology Ltd.). Released under GPL-2.0 as a derivative work.