2014年3月24日 星期一

ACPI I/O resource conflict with SMBus

這幾天遇到一個奇怪的問題,我試著透過 io 的方式去讀 sch5027 這顆 SuperIO 的 Hardware Monitor,但發現它的 Hardware Monitor 只支援透過 I2C/SMBus 去讀,不過這也不是問題,因為 Linux 有支援,只要掛載 dme1737 就行了。

奇怪的點在於,掛上 dme1737 後,完全找不到應該建立在 /sys/class/hwmon/ 下的 entry,追了一下 code 後,發現 dme1737_i2c_probe 根本沒有被呼叫到,繼續深入追了一下又發現,雖然 lspci 是有 SMBus 資訊,且 i2c-i801 也有掛載,但 i2cdetect 完全找不到有任何的device.......0rz


最後經由 google 大神的提示,才知道原來是 ACPI 和 SMBus 的衝突造成的。從 dmesg 裡面會找到像是這樣的訊息:
ACPI: resource 0000:00:1f.3 [io 0xXXXX-0xYYYY] conflicts with ACPI region SMBI ......
ACPI: If an ACPI is available for this device, you should used it instead of native driver


當有這訊息出現時,會完全找不到 i2c 的 device,因為 resource 被 ACPI 佔住了。解決的方式滿簡單的,只要在 kernel 的 boot option 裡加入底下的參數即可:
acpi_enforce_resources=no

節錄 kernel-parameters.txt 裡的說明:
acpi_enforce_resources= [ACPI]
{ strict | lax | no }
Check for resource conflicts between native drivers
and ACPI OperationRegions (SystemIO and SystemMemory
only). IO ports and memory declared in ACPI might be
used by the ACPI subsystem in arbitrary AML code and
can interfere with legacy drivers.
strict (default): access to resources claimed by ACPI
is denied; legacy drivers trying to access reserved
resources will fail to bind to device using them.
lax: access to resources claimed by ACPI is allowed;
legacy drivers trying to access reserved resources
will bind successfully but a warning message is logged.
no: ACPI OperationRegions are not marked as reserved,
no further checks are performed.
參考資料
Bug 12376 - ACPI I/O resource conflict with SMBus
[solved] Dme1737
Bug 13967 - Revert "ACPICA: Remove obsolete acpi_os_validate_address interface" regression