요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
========================================
Probing devices in other D states than 0
========================================
Introduction
============
In some cases it may be preferred to leave certain devices powered off for the
entire system bootup if powering on these devices has adverse side effects,
beyond just powering on the said device.
How it works
============
The _DSC (Device State for Configuration) object that evaluates to an integer
may be used to tell Linux the highest allowed D state for a device during
probe. The support for _DSC requires support from the kernel bus type if the
bus driver normally sets the device in D0 state for probe.
The downside of using _DSC is that as the device is not powered on, even if
there's a problem with the device, the driver likely probes just fine but the
first user will find out the device doesn't work, instead of a failure at probe
time. This feature should thus be used sparingly.
I²C
---
If an I²C driver indicates its support for this by setting the
I2C_DRV_ACPI_WAIVE_D0_PROBE flag in struct i2c_driver.flags field and the
_DSC object evaluates to integer higher than the D state of the device,
the device will not be powered on (put in D0 state) for probe.
D states
--------
The D states and thus also the allowed values for _DSC are listed below. Refer
to [1] for more information on device power states.
.. code-block:: text
Number State Description
0 D0 Device fully powered on
1 D1
2 D2
3 D3hot
4 D3cold Off
References
==========
[1] https://uefi.org/specifications/ACPI/6.4/02_Definition_of_Terms/Definition_of_Terms.html#device-power-state-definitions
Example
=======
An ASL example describing an ACPI device using _DSC object to tell Operating
System the device should remain powered off during probe looks like this. Some
objects not relevant from the example point of view have been omitted.
.. code-block:: text
Device (CAM0)
{
Name (_HID, "SONY319A")
Name (_UID, Zero)
Name (_CRS, ResourceTemplate ()
{
I2cSerialBus(0x0020, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C0",
0x00, ResourceConsumer)
})
Method (_DSC, 0, NotSerialized)
{
Return (0x4)
}
}
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
D0 이외 상태에서 probe하는 이유와 _DSC
1-25일부 device는 전원을 켜는 행위가 해당 device의 소비 전력 증가를 넘어 다른 부작용을 일으킬 수 있다. 이런 경우에는 system boot 전체 동안 특정 device를 powered off 상태로 두는 편이 바람직할 수 있다.
Integer로 evaluation되는 ACPI `_DSC`(Device State for Configuration) object는 probe 중 device에 허용되는 가장 높은 D state를 Linux에 알린다. Bus driver가 보통 probe를 위해 device를 D0로 전환한다면, `_DSC`를 실제로 존중하려면 해당 kernel bus type도 이 기능을 지원해야 한다.
이 방식의 중요한 단점은 device를 켜지 않으므로 hardware 문제가 있어도 driver probe가 정상적으로 끝날 가능성이 높다는 점이다. Probe 시점의 명확한 실패 대신 첫 사용자가 device가 작동하지 않는다는 사실을 발견하게 될 수 있다.
따라서 `_DSC` 기반 non-D0 probe는 부작용 회피가 꼭 필요한 device에 제한적으로 사용해야 한다. 단순히 boot 전력을 줄이기 위한 일반적인 선택으로 광범위하게 적용해서는 안 된다.
Firmware 요청과 bus 지원 여부가 device를 D0로 올릴지 결정한다.
전원 유지 이점과 오류 발견 시점의 위험을 함께 본다.
.. SPDX-License-Identifier: GPL-2.0
========================================
Probing devices in other D states than 0
========================================
Introduction
============
In some cases it may be preferred to leave certain devices powered off for the
entire system bootup if powering on these devices has adverse side effects,
beyond just powering on the said device.
How it works
============
The _DSC (Device State for Configuration) object that evaluates to an integer
may be used to tell Linux the highest allowed D state for a device during
probe. The support for _DSC requires support from the kernel bus type if the
bus driver normally sets the device in D0 state for probe.
The downside of using _DSC is that as the device is not powered on, even if
there's a problem with the device, the driver likely probes just fine but the
first user will find out the device doesn't work, instead of a failure at probe
time. This feature should thus be used sparingly.
I²C driver의 opt-in 조건
26-39I²C driver는 `struct i2c_driver.flags` field에 `I2C_DRV_ACPI_WAIVE_D0_PROBE` flag를 설정해 non-D0 probe를 지원한다고 명시한다. Driver의 opt-in 없이 firmware의 `_DSC`만으로 일반 I²C probe 동작이 바뀌지는 않는다.
Driver가 이 flag를 설정했고 `_DSC` object가 device의 D state보다 높은 integer로 evaluation되면, probe를 위해 device 전원을 켜거나 D0 state로 전환하지 않는다. 원문의 비교 조건을 그대로 유지해야 하며 D-state 숫자를 임의로 역변환해서는 안 된다.
이 동작은 bus driver가 평소 probe 전에 수행하는 D0 전환을 면제하는 것이다. Device가 실제로 사용될 때 필요한 power transition과 기능 검증 책임까지 없애는 것은 아니다.
두 조건과 결과를 kernel field·ACPI object 기준으로 정리한다.
Driver flag와 _DSC가 모두 참여하는 순서이다.
I²C
---
If an I²C driver indicates its support for this by setting the
I2C_DRV_ACPI_WAIVE_D0_PROBE flag in struct i2c_driver.flags field and the
_DSC object evaluates to integer higher than the D state of the device,
the device will not be powered on (put in D0 state) for probe.
D states
--------
The D states and thus also the allowed values for _DSC are listed below. Refer
to [1] for more information on device power states.
_DSC에 사용할 수 있는 D state 값
40-53`_DSC`에 허용되는 값은 ACPI device power state 번호와 같다. `0`은 완전히 powered on인 D0이고, `1`과 `2`는 각각 D1과 D2, `3`은 D3hot, `4`는 powered off 상태인 D3cold이다.
각 state의 더 자세한 의미는 원문의 ACPI 6.4 Device Power State Definitions reference를 따른다. Firmware와 driver는 이 숫자를 독자적인 enum으로 재해석하지 않고 ACPI D-state 값으로 사용해야 한다.
원문 code table의 번호, state와 명시된 설명을 그대로 구조화했다.
_DSC integer 0부터 4까지를 원문 표의 state 순서에 대응시킨다.
.. code-block:: text
Number State Description
0 D0 Device fully powered on
1 D1
2 D2
3 D3hot
4 D3cold Off
References
==========
[1] https://uefi.org/specifications/ACPI/6.4/02_Definition_of_Terms/Definition_of_Terms.html#device-power-state-definitions
CAM0 ASL 예제
54-78ASL 예제는 ACPI device `CAM0`가 probe 중 powered off 상태를 유지해야 한다고 operating system에 알리는 방법을 보여 준다. 설명과 무관한 일부 object는 생략되어 있다.
`CAM0`의 `_HID`는 `SONY319A`, `_UID`는 `Zero`이다. `_CRS` resource template은 7-bit address `0x0020`, speed `0x00061A80`, controller path `\_SB.PCI0.I2C0`을 사용하는 `I2cSerialBus` resource를 정의한다.
Argument가 없고 `NotSerialized`인 `_DSC` method는 `0x4`를 return한다. D-state 표에서 `4`는 `D3cold`, 즉 `Off`이므로 firmware는 이 device가 probe를 위해 D0로 올라가지 않고 powered off 상태를 유지할 수 있음을 표현한다.
예제의 identity, resource와 configuration power policy를 분리해 정리한다.
ASL의 _DSC return 값이 I²C driver opt-in과 결합되는 과정이다.
Example
=======
An ASL example describing an ACPI device using _DSC object to tell Operating
System the device should remain powered off during probe looks like this. Some
objects not relevant from the example point of view have been omitted.
.. code-block:: text
Device (CAM0)
{
Name (_HID, "SONY319A")
Name (_UID, Zero)
Name (_CRS, ResourceTemplate ()
{
I2cSerialBus(0x0020, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C0",
0x00, ResourceConsumer)
})
Method (_DSC, 0, NotSerialized)
{
Return (0x4)
}
}
요약·해설
non-d0-probe.rst:1-78ACPI `_DSC`는 probe 중 device에 허용되는 가장 높은 D state를 나타낸다. I²C에서는 driver가 `I2C_DRV_ACPI_WAIVE_D0_PROBE`를 명시적으로 설정하고 `_DSC` 비교 조건도 충족할 때 probe용 D0 전환을 생략한다.
Non-D0 probe는 device power-on이 만드는 외부 부작용을 막을 수 있지만, 실제 hardware failure가 probe에서 드러나지 않고 첫 사용 시점까지 지연될 수 있다. 이 때문에 문서는 기능을 제한적으로 사용하라고 경고한다.
예제 `CAM0`는 `_DSC`에서 `0x4`를 반환해 D3cold를 나타낸다. `_HID=SONY319A`, I²C address `0x0020`, controller `\_SB.PCI0.I2C0` 등의 ASL 값은 그대로 보존된다.
Firmware와 driver 양쪽이 의도적으로 기능을 선택했는지 확인한다.