요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0-or-later
.. include:: <isonum.txt>
Kernel driver dell-smm-hwmon
============================
:Copyright: |copy| 2002-2005 Massimo Dal Zotto <[email protected]>
:Copyright: |copy| 2019 Giovanni Mascellani <[email protected]>
Description
-----------
On many Dell laptops the System Management Mode (SMM) BIOS can be
queried for the status of fans and temperature sensors. Userspace
utilities like ``sensors`` can be used to return the readings. The
userspace suite `i8kutils`__ can also be used to read the sensors and
automatically adjust fan speed (please notice that it currently uses
the deprecated ``/proc/i8k`` interface).
__ https://github.com/vitorafsr/i8kutils
``sysfs`` interface
-------------------
Temperature sensors and fans can be queried and set via the standard
``hwmon`` interface on ``sysfs``, under the directory
``/sys/class/hwmon/hwmonX`` for some value of ``X`` (search for the
``X`` such that ``/sys/class/hwmon/hwmonX/name`` has content
``dell_smm``). A number of other attributes can be read or written:
=============================== ======= =======================================
Name Perm Description
=============================== ======= =======================================
fan[1-4]_input RO Fan speed in RPM.
fan[1-4]_label RO Fan label.
fan[1-4]_min RO Minimal Fan speed in RPM
fan[1-4]_max RO Maximal Fan speed in RPM
fan[1-4]_target RO Expected Fan speed in RPM
pwm[1-4] RW Control the fan PWM duty-cycle.
pwm[1-4]_enable RW/WO Enable or disable automatic BIOS fan
control (not supported on all laptops,
see below for details).
temp[1-10]_input RO Temperature reading in milli-degrees
Celsius.
temp[1-10]_label RO Temperature sensor label.
=============================== ======= =======================================
Due to the nature of the SMM interface, each pwmX attribute controls
fan number X.
Enabling/Disabling automatic BIOS fan control
---------------------------------------------
There exist two methods for enabling/disabling automatic BIOS fan control:
1. Separate SMM commands to enable/disable automatic BIOS fan control for all fans.
2. A special fan state that enables automatic BIOS fan control for a individual fan.
The driver cannot reliably detect what method should be used on a given
device, so instead the following heuristic is used:
- use fan state 3 for enabling BIOS fan control if the maximum fan state
setable by the user is smaller than 3 (default setting).
- use separate SMM commands if device is whitelisted to support them.
When using the first method, each fan will have a standard ``pwmX_enable``
sysfs attribute. Writing ``1`` into this attribute will disable automatic
BIOS fan control for the associated fan and set it to maximum speed. Enabling
BIOS fan control again can be achieved by writing ``2`` into this attribute.
Reading this sysfs attributes returns the current setting as reported by
the underlying hardware.
When using the second method however, only the ``pwm1_enable`` sysfs attribute
will be available to enable/disable automatic BIOS fan control globaly for all
fans available on a given device. Additionally, this sysfs attribute is write-only
as there exists no SMM command for reading the current fan control setting.
If no ``pwmX_enable`` attributes are available, then it means that the driver
cannot use the first method and the SMM codes for enabling and disabling automatic
BIOS fan control are not whitelisted for your device. It is possible that codes
that work for other laptops actually work for yours as well, or that you have to
discover new codes.
Check the list ``i8k_whitelist_fan_control`` in file
``drivers/hwmon/dell-smm-hwmon.c`` in the kernel tree: as a first
attempt you can try to add your machine and use an already-known code
pair. If, after recompiling the kernel, you see that ``pwm1_enable``
is present and works (i.e., you can manually control the fan speed),
then please submit your finding as a kernel patch, so that other users
can benefit from it. Please see
:ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
for information on submitting patches.
If no known code works on your machine, you need to resort to do some
probing, because unfortunately Dell does not publish datasheets for
its SMM. You can experiment with the code in `this repository`__ to
probe the BIOS on your machine and discover the appropriate codes.
__ https://github.com/clopez/dellfan/
Again, when you find new codes, we'd be happy to have your patches!
``thermal`` interface
---------------------------
The driver also exports the fans as thermal cooling devices with
``type`` set to ``dell-smm-fan[1-4]``. This allows for easy fan control
using one of the thermal governors.
Module parameters
-----------------
* force:bool
Force loading without checking for supported
models. (default: 0)
* ignore_dmi:bool
Continue probing hardware even if DMI data does not
match. (default: 0)
* restricted:bool
Allow fan control only to processes with the
``CAP_SYS_ADMIN`` capability set or processes run
as root when using the legacy ``/proc/i8k``
interface. In this case normal users will be able
to read temperature and fan status but not to
control the fan. If your notebook is shared with
other users and you don't trust them you may want
to use this option. (default: 1, only available
with ``CONFIG_I8K``)
* power_status:bool
Report AC status in ``/proc/i8k``. (default: 0,
only available with ``CONFIG_I8K``)
* fan_mult:uint
Factor to multiply fan speed with. (default:
autodetect)
* fan_max:uint
Maximum configurable fan speed. (default:
autodetect)
Legacy ``/proc`` interface
--------------------------
.. warning:: This interface is obsolete and deprecated and should not
used in new applications. This interface is only
available when kernel is compiled with option
``CONFIG_I8K``.
The information provided by the kernel driver can be accessed by
simply reading the ``/proc/i8k`` file. For example::
$ cat /proc/i8k
1.0 A17 2J59L02 52 2 1 8040 6420 1 2
The fields read from ``/proc/i8k`` are::
1.0 A17 2J59L02 52 2 1 8040 6420 1 2
| | | | | | | | | |
| | | | | | | | | +------- 10. buttons status
| | | | | | | | +--------- 9. AC status
| | | | | | | +-------------- 8. fan0 RPM
| | | | | | +------------------- 7. fan1 RPM
| | | | | +--------------------- 6. fan0 status
| | | | +----------------------- 5. fan1 status
| | | +-------------------------- 4. temp0 reading (Celsius)
| | +---------------------------------- 3. Dell service tag (later known as 'serial number')
| +-------------------------------------- 2. BIOS version
+------------------------------------------ 1. /proc/i8k format version
A negative value, for example -22, indicates that the BIOS doesn't
return the corresponding information. This is normal on some
models/BIOSes.
For performance reasons the ``/proc/i8k`` doesn't report by default
the AC status since this SMM call takes a long time to execute and is
not really needed. If you want to see the ac status in ``/proc/i8k``
you must explictitly enable this option by passing the
``power_status=1`` parameter to insmod. If AC status is not
available -1 is printed instead.
The driver provides also an ioctl interface which can be used to
obtain the same information and to control the fan status. The ioctl
interface can be accessed from C programs or from shell using the
i8kctl utility. See the source file of ``i8kutils`` for more
information on how to use the ioctl interface.
SMM Interface
-------------
.. warning:: The SMM interface was reverse-engineered by trial-and-error
since Dell did not provide any Documentation,
please keep that in mind.
The driver uses the SMM interface to send commands to the system BIOS.
This interface is normally used by Dell's 32-bit diagnostic program or
on newer notebook models by the buildin BIOS diagnostics.
The SMM may cause short hangs when the BIOS code is taking too long to
execute.
The SMM handler inside the system BIOS looks at the contents of the
``eax``, ``ebx``, ``ecx``, ``edx``, ``esi`` and ``edi`` registers.
Each register has a special purpose:
=============== ==================================
Register Purpose
=============== ==================================
eax Holds the command code before SMM,
holds the first result after SMM.
ebx Holds the arguments.
ecx Unknown, set to 0.
edx Holds the second result after SMM.
esi Unknown, set to 0.
edi Unknown, set to 0.
=============== ==================================
The SMM handler can signal a failure by either:
- setting the lower sixteen bits of ``eax`` to ``0xffff``
- not modifying ``eax`` at all
- setting the carry flag (legacy SMM interface only)
Legacy SMM Interface
--------------------
When using the legacy SMM interface, a SMM is triggered by writing the least significant byte
of the command code to the special ioports ``0xb2`` and ``0x84``. This interface is not
described inside the ACPI tables and can thus only be detected by issuing a test SMM call.
WMI SMM Interface
-----------------
On modern Dell machines, the SMM calls are done over ACPI WMI:
::
#pragma namespace("\\\\.\\root\\dcim\\sysman\\diagnostics")
[WMI, Provider("Provider_DiagnosticsServices"), Dynamic, Locale("MS\\0x409"),
Description("RunDellDiag"), guid("{F1DDEE52-063C-4784-A11E-8A06684B9B01}")]
class LegacyDiags {
[key, read] string InstanceName;
[read] boolean Active;
[WmiMethodId(1), Implemented, read, write, Description("Legacy Method ")]
void Execute([in, out] uint32 EaxLen, [in, out, WmiSizeIs("EaxLen") : ToInstance] uint8 EaxVal[],
[in, out] uint32 EbxLen, [in, out, WmiSizeIs("EbxLen") : ToInstance] uint8 EbxVal[],
[in, out] uint32 EcxLen, [in, out, WmiSizeIs("EcxLen") : ToInstance] uint8 EcxVal[],
[in, out] uint32 EdxLen, [in, out, WmiSizeIs("EdxLen") : ToInstance] uint8 EdxVal[]);
};
Some machines support only the WMI SMM interface, while some machines support both interfaces.
The driver automatically detects which interfaces are present and will use the WMI SMM interface
if the legacy SMM interface is not present. The WMI SMM interface is usually slower than the
legacy SMM interface since ACPI methods need to be called in order to trigger a SMM.
SMM command codes
-----------------
=============== ======================= ================================================
Command Code Command Name Description
=============== ======================= ================================================
``0x0025`` Get Fn key status Returns the Fn key pressed after SMM:
- 9th bit in ``eax`` indicates Volume up
- 10th bit in ``eax`` indicates Volume down
- both bits indicate Volume mute
``0xa069`` Get power status Returns current power status after SMM:
- 1st bit in ``eax`` indicates Battery connected
- 3th bit in ``eax`` indicates AC connected
``0x00a3`` Get fan state Returns current fan state after SMM:
- 1st byte in ``eax`` holds the current
fan state (0 - 2 or 3)
``0x01a3`` Set fan state Sets the fan speed:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the desired
fan state (0 - 2 or 3)
``0x02a3`` Get fan speed Returns the current fan speed in RPM:
- 1st byte in ``ebx`` holds the fan number
- 1st word in ``eax`` holds the current
fan speed in RPM (after SMM)
``0x03a3`` Get fan type Returns the fan type:
- 1st byte in ``ebx`` holds the fan number
- 1st byte in ``eax`` holds the
fan type (after SMM):
- 5th bit indicates docking fan
- 1 indicates Processor fan
- 2 indicates Motherboard fan
- 3 indicates Video fan
- 4 indicates Power supply fan
- 5 indicates Chipset fan
- 6 indicates other fan type
``0x04a3`` Get nominal fan speed Returns the nominal RPM in each fan state:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the fan state
in question (0 - 2 or 3)
- 1st word in ``eax`` holds the nominal
fan speed in RPM (after SMM)
``0x05a3`` Get fan speed tolerance Returns the speed tolerance for each fan state:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the fan state
in question (0 - 2 or 3)
- 1st byte in ``eax`` returns the speed
tolerance
``0x10a3`` Get sensor temperature Returns the measured temperature:
- 1st byte in ``ebx`` holds the sensor number
- 1st byte in ``eax`` holds the measured
temperature (after SMM)
``0x11a3`` Get sensor type Returns the sensor type:
- 1st byte in ``ebx`` holds the sensor number
- 1st byte in ``eax`` holds the
temperature type (after SMM):
- 1 indicates CPU sensor
- 2 indicates GPU sensor
- 3 indicates SODIMM sensor
- 4 indicates other sensor type
- 5 indicates Ambient sensor
- 6 indicates other sensor type
``0xfea3`` Get SMM signature Returns Dell signature if interface
is supported (after SMM):
- ``eax`` holds 1145651527
(0x44494147 or "DIAG")
- ``edx`` holds 1145392204
(0x44454c4c or "DELL")
``0xffa3`` Get SMM signature Same as ``0xfea3``, check both.
=============== ======================= ================================================
There are additional commands for enabling (``0x31a3`` or ``0x35a3``) and
disabling (``0x30a3`` or ``0x34a3``) automatic fan speed control.
The commands are however causing severe sideeffects on many machines, so
they are not used by default.
On several machines (Inspiron 3505, Precision 490, Vostro 1720, ...), the
fans supports a 4th "magic" state, which signals the BIOS that automatic
fan control should be enabled for a specific fan.
However there are also some machines who do support a 4th regular fan state too,
but in case of the "magic" state, the nominal RPM reported for this state is a
placeholder value, which however is not always detectable.
Firmware Bugs
-------------
The SMM calls can behave erratic on some machines:
======================================================= =================
Firmware Bug Affected Machines
======================================================= =================
Reading of fan states return spurious errors. Precision 490
OptiPlex 7060
Reading of fan types causes erratic fan behaviour. Studio XPS 8000
Studio XPS 8100
Inspiron 580
Inspiron 3505
Fan-related SMM calls take too long (about 500ms). Inspiron 7720
Vostro 3360
XPS 13 9333
XPS 15 L502X
======================================================= =================
In case you experience similar issues on your Dell machine, please
submit a bugreport on bugzilla to we can apply workarounds.
Limitations
-----------
The SMM calls can take too long to execute on some machines, causing
short hangs and/or audio glitches.
Also the fan state needs to be restored after suspend, as well as
the automatic mode settings.
When reading a temperature sensor, values above 127 degrees indicate
a BIOS read error or a deactivated sensor.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Dell SMM fan·temperature driver 개요
1-25이 문서는 GPL-2.0-or-later 라이선스의 `dell-smm-hwmon` 커널 드라이버를 설명합니다. 저작권은 2002~2005년 Massimo Dal Zotto와 2019년 Giovanni Mascellani에게 있습니다.
많은 Dell laptop에서는 System Management Mode(SMM) BIOS에 질의해 fan과 temperature sensor 상태를 얻을 수 있습니다. Userspace의 `sensors`가 측정값을 표시할 수 있고, `i8kutils` suite도 sensor를 읽고 fan speed를 자동 조절할 수 있습니다.
다만 `i8kutils`는 현재 deprecated된 `/proc/i8k` interface를 사용합니다. 프로젝트 주소는 `https://github.com/vitorafsr/i8kutils`입니다.
BIOS SMM 값을 표준 hwmon과 legacy 도구가 소비합니다.
SMM call부터 userspace 표시까지의 흐름입니다.
.. SPDX-License-Identifier: GPL-2.0-or-later
.. include:: <isonum.txt>
Kernel driver dell-smm-hwmon
============================
:Copyright: |copy| 2002-2005 Massimo Dal Zotto <[email protected]>
:Copyright: |copy| 2019 Giovanni Mascellani <[email protected]>
Description
-----------
On many Dell laptops the System Management Mode (SMM) BIOS can be
queried for the status of fans and temperature sensors. Userspace
utilities like ``sensors`` can be used to return the readings. The
userspace suite `i8kutils`__ can also be used to read the sensors and
automatically adjust fan speed (please notice that it currently uses
the deprecated ``/proc/i8k`` interface).
__ https://github.com/vitorafsr/i8kutils
``sysfs`` interface
-------------------
표준 hwmon sysfs ABI
26-51Temperature sensor와 fan은 표준 hwmon sysfs interface로 질의하고 설정할 수 있습니다. 경로는 `/sys/class/hwmon/hwmonX`이며, `/sys/class/hwmon/hwmonX/name`의 내용이 `dell_smm`인 `X`를 찾아야 합니다.
`fan[1-4]_input`은 RPM, `fan[1-4]_label`은 fan label, `fan[1-4]_min`·`max`는 최소·최대 RPM, `fan[1-4]_target`은 예상 RPM을 read-only로 제공합니다.
`pwm[1-4]`는 read-write PWM duty-cycle control입니다. `pwm[1-4]_enable`은 BIOS automatic fan control을 enable 또는 disable하며 read-write 또는 write-only입니다. 모든 laptop에서 지원되지는 않습니다.
`temp[1-10]_input`은 millidegree Celsius 측정값, `temp[1-10]_label`은 sensor label을 read-only로 제공합니다. SMM interface의 성격상 각 `pwmX` attribute는 fan number `X`를 제어합니다.
Fan 4개와 temperature sensor 10개의 표준 ABI입니다.
동일한 번호의 pwm과 fan이 직접 대응합니다.
Temperature sensors and fans can be queried and set via the standard
``hwmon`` interface on ``sysfs``, under the directory
``/sys/class/hwmon/hwmonX`` for some value of ``X`` (search for the
``X`` such that ``/sys/class/hwmon/hwmonX/name`` has content
``dell_smm``). A number of other attributes can be read or written:
=============================== ======= =======================================
Name Perm Description
=============================== ======= =======================================
fan[1-4]_input RO Fan speed in RPM.
fan[1-4]_label RO Fan label.
fan[1-4]_min RO Minimal Fan speed in RPM
fan[1-4]_max RO Maximal Fan speed in RPM
fan[1-4]_target RO Expected Fan speed in RPM
pwm[1-4] RW Control the fan PWM duty-cycle.
pwm[1-4]_enable RW/WO Enable or disable automatic BIOS fan
control (not supported on all laptops,
see below for details).
temp[1-10]_input RO Temperature reading in milli-degrees
Celsius.
temp[1-10]_label RO Temperature sensor label.
=============================== ======= =======================================
Due to the nature of the SMM interface, each pwmX attribute controls
fan number X.
Automatic BIOS fan control 선택과 whitelist
52-108Automatic BIOS fan control을 enable·disable하는 방식은 두 가지입니다. 하나는 모든 fan에 대해 automatic control을 켜고 끄는 별도 SMM command이고, 다른 하나는 개별 fan의 automatic control을 enable하는 특수 fan state입니다.
Driver는 장치마다 어떤 방식을 써야 하는지 신뢰성 있게 탐지할 수 없습니다. 그래서 사용자가 설정할 수 있는 최대 fan state가 3보다 작으면 기본적으로 fan state 3을 BIOS fan control enable에 사용하고, 별도 SMM command 지원 장치로 whitelist되어 있으면 그 command를 사용합니다.
문서가 첫 번째 방식이라고 설명하는 경우 각 fan에 표준 `pwmX_enable`이 생깁니다. 여기에 `1`을 쓰면 해당 fan의 automatic BIOS control을 disable하고 maximum speed로 설정합니다. `2`를 쓰면 BIOS control을 다시 enable합니다. 읽으면 hardware가 보고한 현재 설정을 반환합니다.
문서가 두 번째 방식이라고 설명하는 경우에는 장치의 모든 fan을 전역 enable·disable하는 `pwm1_enable`만 제공됩니다. 현재 fan control setting을 읽는 SMM command가 없으므로 이 attribute는 write-only입니다.
`pwmX_enable`이 전혀 없으면 driver가 첫 번째 방식을 사용할 수 없고 automatic BIOS fan control enable·disable용 SMM code도 해당 장치에 whitelist되지 않았다는 뜻입니다. 다른 laptop의 code가 동작할 수도 있고 새 code를 찾아야 할 수도 있습니다.
Kernel tree의 `drivers/hwmon/dell-smm-hwmon.c`에 있는 `i8k_whitelist_fan_control`을 확인하십시오. 우선 machine을 추가하고 기존 code pair를 시험할 수 있습니다. Kernel 재컴파일 뒤 `pwm1_enable`이 나타나고 수동 fan 제어가 동작하면 다른 사용자도 쓸 수 있도록 kernel patch를 제출해야 합니다. 제출 절차는 `Documentation/process/submitting-patches.rst`를 참조합니다.
알려진 code가 작동하지 않으면 Dell이 SMM datasheet를 공개하지 않으므로 probing이 필요합니다. `https://github.com/clopez/dellfan/`의 code로 BIOS를 probe해 맞는 code를 찾을 수 있으며, 새 code를 찾으면 patch 제출이 권장됩니다.
Driver가 fan state와 whitelist를 선택하는 heuristic입니다.
기존 code를 안전하게 시험하고 upstream에 공유합니다.
Enabling/Disabling automatic BIOS fan control
---------------------------------------------
There exist two methods for enabling/disabling automatic BIOS fan control:
1. Separate SMM commands to enable/disable automatic BIOS fan control for all fans.
2. A special fan state that enables automatic BIOS fan control for a individual fan.
The driver cannot reliably detect what method should be used on a given
device, so instead the following heuristic is used:
- use fan state 3 for enabling BIOS fan control if the maximum fan state
setable by the user is smaller than 3 (default setting).
- use separate SMM commands if device is whitelisted to support them.
When using the first method, each fan will have a standard ``pwmX_enable``
sysfs attribute. Writing ``1`` into this attribute will disable automatic
BIOS fan control for the associated fan and set it to maximum speed. Enabling
BIOS fan control again can be achieved by writing ``2`` into this attribute.
Reading this sysfs attributes returns the current setting as reported by
the underlying hardware.
When using the second method however, only the ``pwm1_enable`` sysfs attribute
will be available to enable/disable automatic BIOS fan control globaly for all
fans available on a given device. Additionally, this sysfs attribute is write-only
as there exists no SMM command for reading the current fan control setting.
If no ``pwmX_enable`` attributes are available, then it means that the driver
cannot use the first method and the SMM codes for enabling and disabling automatic
BIOS fan control are not whitelisted for your device. It is possible that codes
that work for other laptops actually work for yours as well, or that you have to
discover new codes.
Check the list ``i8k_whitelist_fan_control`` in file
``drivers/hwmon/dell-smm-hwmon.c`` in the kernel tree: as a first
attempt you can try to add your machine and use an already-known code
pair. If, after recompiling the kernel, you see that ``pwm1_enable``
is present and works (i.e., you can manually control the fan speed),
then please submit your finding as a kernel patch, so that other users
can benefit from it. Please see
:ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
for information on submitting patches.
If no known code works on your machine, you need to resort to do some
probing, because unfortunately Dell does not publish datasheets for
its SMM. You can experiment with the code in `this repository`__ to
probe the BIOS on your machine and discover the appropriate codes.
__ https://github.com/clopez/dellfan/
Again, when you find new codes, we'd be happy to have your patches!
``thermal`` interface
---------------------------
Thermal cooling device와 module parameter
109-146Driver는 fan을 `type`이 `dell-smm-fan[1-4]`인 thermal cooling device로도 export합니다. 따라서 thermal governor 중 하나로 fan을 쉽게 제어할 수 있습니다.
`force:bool`은 지원 model 확인 없이 강제로 load하며 기본값은 0입니다. `ignore_dmi:bool`은 DMI data가 일치하지 않아도 hardware probing을 계속하며 기본값은 0입니다.
`restricted:bool`은 legacy `/proc/i8k` interface에서 `CAP_SYS_ADMIN` capability가 있는 process 또는 root만 fan을 제어하게 합니다. 일반 사용자는 temperature와 fan status는 읽을 수 있지만 fan은 제어할 수 없습니다. 공유 notebook에서 다른 사용자를 신뢰하지 않을 때 유용합니다. 기본값은 1이며 `CONFIG_I8K`에서만 제공됩니다.
`power_status:bool`은 `/proc/i8k`에 AC status를 보고합니다. 기본값은 0이고 `CONFIG_I8K`에서만 사용할 수 있습니다. `fan_mult:uint`는 fan speed에 곱할 factor, `fan_max:uint`는 설정 가능한 maximum fan speed이며 둘 다 기본값은 autodetect입니다.
Load 정책, 권한, legacy 출력과 fan scaling을 제어합니다.
Hwmon fan을 cooling device로 thermal framework에 연결합니다.
The driver also exports the fans as thermal cooling devices with
``type`` set to ``dell-smm-fan[1-4]``. This allows for easy fan control
using one of the thermal governors.
Module parameters
-----------------
* force:bool
Force loading without checking for supported
models. (default: 0)
* ignore_dmi:bool
Continue probing hardware even if DMI data does not
match. (default: 0)
* restricted:bool
Allow fan control only to processes with the
``CAP_SYS_ADMIN`` capability set or processes run
as root when using the legacy ``/proc/i8k``
interface. In this case normal users will be able
to read temperature and fan status but not to
control the fan. If your notebook is shared with
other users and you don't trust them you may want
to use this option. (default: 1, only available
with ``CONFIG_I8K``)
* power_status:bool
Report AC status in ``/proc/i8k``. (default: 0,
only available with ``CONFIG_I8K``)
* fan_mult:uint
Factor to multiply fan speed with. (default:
autodetect)
* fan_max:uint
Maximum configurable fan speed. (default:
autodetect)
Deprecated /proc/i8k와 ioctl
147-192경고: `/proc/i8k` interface는 obsolete·deprecated 상태이며 새 application에서 사용하면 안 됩니다. Kernel이 `CONFIG_I8K` option으로 compile된 경우에만 제공됩니다.
Kernel driver 정보는 `/proc/i8k`를 읽어 접근할 수 있습니다. 예시 출력은 `1.0 A17 2J59L02 52 2 1 8040 6420 1 2`입니다.
10개 field는 순서대로 `/proc/i8k` format version, BIOS version, Dell service tag(후에는 serial number로 알려짐), `temp0` Celsius, `fan1` status, `fan0` status, `fan1` RPM, `fan0` RPM, AC status, button status입니다. 원문의 ASCII 좌표는 아래 구조화 표로 같은 대응 관계를 표시했습니다.
`-22` 같은 negative value는 BIOS가 해당 정보를 반환하지 않았다는 뜻이며 일부 model·BIOS에서는 정상입니다. `/proc/i8k`는 성능상 기본적으로 AC status를 보고하지 않습니다. 이 SMM call은 실행 시간이 길고 보통 필요하지 않기 때문입니다.
AC status를 보려면 insmod에 `power_status=1`을 명시해야 합니다. AC status를 얻을 수 없으면 `-1`을 출력합니다.
Driver는 같은 정보를 얻고 fan status를 제어하는 ioctl interface도 제공합니다. C program에서 접근하거나 shell의 `i8kctl` utility를 사용할 수 있으며, 자세한 사용법은 `i8kutils` source를 참조합니다.
ASCII 연결선이 나타낸 10개 field의 순서를 구조화했습니다.
Deprecated proc 또는 ioctl 경로로 같은 SMM 정보를 사용합니다.
Legacy ``/proc`` interface
--------------------------
.. warning:: This interface is obsolete and deprecated and should not
used in new applications. This interface is only
available when kernel is compiled with option
``CONFIG_I8K``.
The information provided by the kernel driver can be accessed by
simply reading the ``/proc/i8k`` file. For example::
$ cat /proc/i8k
1.0 A17 2J59L02 52 2 1 8040 6420 1 2
The fields read from ``/proc/i8k`` are::
1.0 A17 2J59L02 52 2 1 8040 6420 1 2
| | | | | | | | | |
| | | | | | | | | +------- 10. buttons status
| | | | | | | | +--------- 9. AC status
| | | | | | | +-------------- 8. fan0 RPM
| | | | | | +------------------- 7. fan1 RPM
| | | | | +--------------------- 6. fan0 status
| | | | +----------------------- 5. fan1 status
| | | +-------------------------- 4. temp0 reading (Celsius)
| | +---------------------------------- 3. Dell service tag (later known as 'serial number')
| +-------------------------------------- 2. BIOS version
+------------------------------------------ 1. /proc/i8k format version
A negative value, for example -22, indicates that the BIOS doesn't
return the corresponding information. This is normal on some
models/BIOSes.
For performance reasons the ``/proc/i8k`` doesn't report by default
the AC status since this SMM call takes a long time to execute and is
not really needed. If you want to see the ac status in ``/proc/i8k``
you must explictitly enable this option by passing the
``power_status=1`` parameter to insmod. If AC status is not
available -1 is printed instead.
The driver provides also an ioctl interface which can be used to
obtain the same information and to control the fan status. The ioctl
interface can be accessed from C programs or from shell using the
i8kctl utility. See the source file of ``i8kutils`` for more
information on how to use the ioctl interface.
SMM register, legacy ioport와 ACPI WMI
193-260경고: Dell이 문서를 제공하지 않았기 때문에 SMM interface는 trial-and-error로 reverse engineering되었습니다.
Driver는 SMM interface로 system BIOS에 command를 보냅니다. 이 interface는 보통 Dell 32-bit diagnostic program이 사용하고 newer notebook에서는 built-in BIOS diagnostic이 사용합니다. BIOS code 실행이 오래 걸리면 SMM이 짧은 hang을 일으킬 수 있습니다.
System BIOS의 SMM handler는 `eax`, `ebx`, `ecx`, `edx`, `esi`, `edi` register 내용을 봅니다. `eax`는 SMM 전 command code와 SMM 후 첫 result, `ebx`는 argument, `edx`는 두 번째 result를 담습니다. `ecx`, `esi`, `edi`의 용도는 알려지지 않아 0으로 설정합니다.
SMM handler는 `eax` 하위 16-bit를 `0xffff`로 설정하거나, `eax`를 전혀 변경하지 않거나, legacy SMM interface에서 carry flag를 설정해 failure를 알릴 수 있습니다.
Legacy interface는 command code의 least significant byte를 special ioport `0xb2`와 `0x84`에 써서 SMM을 trigger합니다. ACPI table에 기술되지 않으므로 test SMM call을 실행해야만 탐지할 수 있습니다.
Modern Dell machine은 ACPI WMI의 `LegacyDiags` class와 GUID `{F1DDEE52-063C-4784-A11E-8A06684B9B01}`을 통해 SMM call을 실행합니다. `Execute` method는 `EaxVal`, `EbxVal`, `EcxVal`, `EdxVal` byte array와 각 length를 in·out parameter로 전달합니다.
일부 machine은 WMI SMM만 지원하고 일부는 두 interface를 모두 지원합니다. Driver는 존재하는 interface를 자동 탐지하고 legacy가 없으면 WMI를 사용합니다. WMI는 SMM trigger에 ACPI method call이 필요해 보통 legacy보다 느립니다.
SMM 전후 register contract와 failure 표시입니다.
탐지 결과에 따라 legacy 또는 WMI 경로로 register를 전달합니다.
SMM Interface
-------------
.. warning:: The SMM interface was reverse-engineered by trial-and-error
since Dell did not provide any Documentation,
please keep that in mind.
The driver uses the SMM interface to send commands to the system BIOS.
This interface is normally used by Dell's 32-bit diagnostic program or
on newer notebook models by the buildin BIOS diagnostics.
The SMM may cause short hangs when the BIOS code is taking too long to
execute.
The SMM handler inside the system BIOS looks at the contents of the
``eax``, ``ebx``, ``ecx``, ``edx``, ``esi`` and ``edi`` registers.
Each register has a special purpose:
=============== ==================================
Register Purpose
=============== ==================================
eax Holds the command code before SMM,
holds the first result after SMM.
ebx Holds the arguments.
ecx Unknown, set to 0.
edx Holds the second result after SMM.
esi Unknown, set to 0.
edi Unknown, set to 0.
=============== ==================================
The SMM handler can signal a failure by either:
- setting the lower sixteen bits of ``eax`` to ``0xffff``
- not modifying ``eax`` at all
- setting the carry flag (legacy SMM interface only)
Legacy SMM Interface
--------------------
When using the legacy SMM interface, a SMM is triggered by writing the least significant byte
of the command code to the special ioports ``0xb2`` and ``0x84``. This interface is not
described inside the ACPI tables and can thus only be detected by issuing a test SMM call.
WMI SMM Interface
-----------------
On modern Dell machines, the SMM calls are done over ACPI WMI:
::
#pragma namespace("\\\\.\\root\\dcim\\sysman\\diagnostics")
[WMI, Provider("Provider_DiagnosticsServices"), Dynamic, Locale("MS\\0x409"),
Description("RunDellDiag"), guid("{F1DDEE52-063C-4784-A11E-8A06684B9B01}")]
class LegacyDiags {
[key, read] string InstanceName;
[read] boolean Active;
[WmiMethodId(1), Implemented, read, write, Description("Legacy Method ")]
void Execute([in, out] uint32 EaxLen, [in, out, WmiSizeIs("EaxLen") : ToInstance] uint8 EaxVal[],
[in, out] uint32 EbxLen, [in, out, WmiSizeIs("EbxLen") : ToInstance] uint8 EbxVal[],
[in, out] uint32 EcxLen, [in, out, WmiSizeIs("EcxLen") : ToInstance] uint8 EcxVal[],
[in, out] uint32 EdxLen, [in, out, WmiSizeIs("EdxLen") : ToInstance] uint8 EdxVal[]);
};
Some machines support only the WMI SMM interface, while some machines support both interfaces.
The driver automatically detects which interfaces are present and will use the WMI SMM interface
if the legacy SMM interface is not present. The WMI SMM interface is usually slower than the
legacy SMM interface since ACPI methods need to be called in order to trigger a SMM.
SMM command code와 magic fan state
261-366`0x0025` Get Fn key status는 SMM 뒤 `eax` 9th bit가 Volume up, 10th bit가 Volume down, 두 bit가 모두 설정되면 Volume mute를 뜻합니다. `0xa069` Get power status는 `eax` 1st bit가 battery connected, 3th bit가 AC connected를 뜻합니다.
`0x00a3` Get fan state는 SMM 뒤 `eax` 1st byte에 현재 fan state 0~2 또는 3을 반환합니다. `0x01a3` Set fan state는 `ebx` 1st byte에 fan number, 2nd byte에 원하는 state 0~2 또는 3을 넣습니다.
`0x02a3` Get fan speed는 `ebx` 1st byte로 fan number를 지정하고 SMM 뒤 `eax` 1st word에 RPM을 반환합니다. `0x03a3` Get fan type은 `ebx` 1st byte로 fan을 지정하고 `eax` 1st byte에 type을 반환합니다. 5th bit는 docking fan이며 type 1은 Processor, 2 Motherboard, 3 Video, 4 Power supply, 5 Chipset, 6 other입니다.
`0x04a3` Get nominal fan speed는 `ebx` 1st byte fan number와 2nd byte state를 받아 `eax` 1st word에 해당 state의 nominal RPM을 반환합니다. `0x05a3` Get fan speed tolerance도 같은 fan·state argument를 받고 `eax` 1st byte에 tolerance를 반환합니다.
`0x10a3` Get sensor temperature는 `ebx` 1st byte로 sensor number를 지정하고 `eax` 1st byte에 measured temperature를 반환합니다. `0x11a3` Get sensor type은 같은 방식으로 type을 반환하며 1 CPU, 2 GPU, 3 SODIMM, 4 other, 5 Ambient, 6 other입니다.
`0xfea3` Get SMM signature는 지원되는 interface라면 `eax=1145651527`(`0x44494147`, `DIAG`)과 `edx=1145392204`(`0x44454c4c`, `DELL`)를 반환합니다. `0xffa3`도 같은 signature command이므로 둘 다 확인합니다.
Automatic fan speed control enable command `0x31a3` 또는 `0x35a3`, disable command `0x30a3` 또는 `0x34a3`도 있습니다. 그러나 많은 machine에서 심각한 side effect를 일으켜 기본적으로 사용하지 않습니다.
Inspiron 3505, Precision 490, Vostro 1720 등 여러 machine은 특정 fan에서 BIOS automatic control을 enable하라는 의미의 네 번째 magic state를 지원합니다. 네 번째 regular fan state를 지원하는 machine도 있으며, magic state의 nominal RPM은 placeholder이지만 항상 탐지 가능한 것은 아닙니다.
Command와 핵심 input·result register를 보존한 표입니다.
Fan 식별부터 RPM feedback까지의 SMM sequence입니다.
SMM command codes
-----------------
=============== ======================= ================================================
Command Code Command Name Description
=============== ======================= ================================================
``0x0025`` Get Fn key status Returns the Fn key pressed after SMM:
- 9th bit in ``eax`` indicates Volume up
- 10th bit in ``eax`` indicates Volume down
- both bits indicate Volume mute
``0xa069`` Get power status Returns current power status after SMM:
- 1st bit in ``eax`` indicates Battery connected
- 3th bit in ``eax`` indicates AC connected
``0x00a3`` Get fan state Returns current fan state after SMM:
- 1st byte in ``eax`` holds the current
fan state (0 - 2 or 3)
``0x01a3`` Set fan state Sets the fan speed:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the desired
fan state (0 - 2 or 3)
``0x02a3`` Get fan speed Returns the current fan speed in RPM:
- 1st byte in ``ebx`` holds the fan number
- 1st word in ``eax`` holds the current
fan speed in RPM (after SMM)
``0x03a3`` Get fan type Returns the fan type:
- 1st byte in ``ebx`` holds the fan number
- 1st byte in ``eax`` holds the
fan type (after SMM):
- 5th bit indicates docking fan
- 1 indicates Processor fan
- 2 indicates Motherboard fan
- 3 indicates Video fan
- 4 indicates Power supply fan
- 5 indicates Chipset fan
- 6 indicates other fan type
``0x04a3`` Get nominal fan speed Returns the nominal RPM in each fan state:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the fan state
in question (0 - 2 or 3)
- 1st word in ``eax`` holds the nominal
fan speed in RPM (after SMM)
``0x05a3`` Get fan speed tolerance Returns the speed tolerance for each fan state:
- 1st byte in ``ebx`` holds the fan number
- 2nd byte in ``ebx`` holds the fan state
in question (0 - 2 or 3)
- 1st byte in ``eax`` returns the speed
tolerance
``0x10a3`` Get sensor temperature Returns the measured temperature:
- 1st byte in ``ebx`` holds the sensor number
- 1st byte in ``eax`` holds the measured
temperature (after SMM)
``0x11a3`` Get sensor type Returns the sensor type:
- 1st byte in ``ebx`` holds the sensor number
- 1st byte in ``eax`` holds the
temperature type (after SMM):
- 1 indicates CPU sensor
- 2 indicates GPU sensor
- 3 indicates SODIMM sensor
- 4 indicates other sensor type
- 5 indicates Ambient sensor
- 6 indicates other sensor type
``0xfea3`` Get SMM signature Returns Dell signature if interface
is supported (after SMM):
- ``eax`` holds 1145651527
(0x44494147 or "DIAG")
- ``edx`` holds 1145392204
(0x44454c4c or "DELL")
``0xffa3`` Get SMM signature Same as ``0xfea3``, check both.
=============== ======================= ================================================
There are additional commands for enabling (``0x31a3`` or ``0x35a3``) and
disabling (``0x30a3`` or ``0x34a3``) automatic fan speed control.
The commands are however causing severe sideeffects on many machines, so
they are not used by default.
On several machines (Inspiron 3505, Precision 490, Vostro 1720, ...), the
fans supports a 4th "magic" state, which signals the BIOS that automatic
fan control should be enabled for a specific fan.
However there are also some machines who do support a 4th regular fan state too,
but in case of the "magic" state, the nominal RPM reported for this state is a
placeholder value, which however is not always detectable.
Firmware bug 표와 제약
367-407일부 machine에서는 SMM call이 불규칙하게 동작합니다. Fan state 읽기가 spurious error를 반환하는 model은 Precision 490과 OptiPlex 7060입니다.
Fan type 읽기가 불규칙한 fan behavior를 일으키는 model은 Studio XPS 8000, Studio XPS 8100, Inspiron 580, Inspiron 3505입니다.
Fan 관련 SMM call이 약 500ms로 너무 오래 걸리는 model은 Inspiron 7720, Vostro 3360, XPS 13 9333, XPS 15 L502X입니다. 비슷한 문제를 겪으면 workaround를 적용할 수 있도록 bugzilla에 bug report를 제출해야 합니다.
일부 machine에서는 SMM call이 너무 오래 걸려 짧은 hang이나 audio glitch가 생길 수 있습니다. Suspend 뒤에는 fan state와 automatic mode setting을 복원해야 합니다. Temperature sensor를 읽을 때 127 degree를 넘는 값은 BIOS read error 또는 deactivated sensor를 뜻합니다.
증상별 영향 model과 운영상 의미입니다.
느린 firmware와 suspend 이후 상태를 보수적으로 다룹니다.
Firmware Bugs
-------------
The SMM calls can behave erratic on some machines:
======================================================= =================
Firmware Bug Affected Machines
======================================================= =================
Reading of fan states return spurious errors. Precision 490
OptiPlex 7060
Reading of fan types causes erratic fan behaviour. Studio XPS 8000
Studio XPS 8100
Inspiron 580
Inspiron 3505
Fan-related SMM calls take too long (about 500ms). Inspiron 7720
Vostro 3360
XPS 13 9333
XPS 15 L502X
======================================================= =================
In case you experience similar issues on your Dell machine, please
submit a bugreport on bugzilla to we can apply workarounds.
Limitations
-----------
The SMM calls can take too long to execute on some machines, causing
short hangs and/or audio glitches.
Also the fan state needs to be restored after suspend, as well as
the automatic mode settings.
When reading a temperature sensor, values above 127 degrees indicate
a BIOS read error or a deactivated sensor.
요약·해설
dell-smm-hwmon.rst:1-407Dell SMM driver가 BIOS의 fan·temperature 정보를 표준 hwmon과 thermal framework에 연결하고, 장치별 fan control code와 firmware bug를 다루는 방법을 설명합니다.
원문 분량과 핵심 interface입니다.
BIOS SMM에서 thermal fan 제어까지의 경로입니다.