这几天遇到一个奇怪的问题,我试着透过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里面会找到像是这样的讯息: 当有这讯息出现时,会完全找不到i2c的device,因为resource被ACPI占住了。解决的方式满简单的,只要在kernel的boot option里加入底下的参数即可: 节录kernel-parameters.txt里的说明: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 driveracpi_enforce_resources=no
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.
正常加载i2c-dev.ko i2c-i801.ko dmesg显示如下:
[ 469.840945] i2c /dev entries driver
[ 474.923981] i801_smbus 0000:00:1f.3: SMBus using PCI Interrupt