所有定义块都加载到单个命名空间中。命名空间 是由名称和路径标识的对象层次结构。 以下命名约定适用于 ACPI 中的对象名称 命名空间:
所有名称的长度均为 32 位。
名称的第一个字节必须是“A”-“Z”、“_”之一。
名称的每个剩余字节必须是“A”-“Z”、“0”之一 - ‘9’, ‘_’.
以“_”开头的名称由 ACPI 规范保留。
“”符号表示命名空间的根(即名称 前缀为 ‘’ 是相对于命名空间根目录的)。
“^”符号表示当前命名空间节点的父节点 (即以“^”开头的名称相对于 当前命名空间节点)。
下图显示了一个示例 ACPI 命名空间:
+------+
| \ | Root
+------+|| +------++-| _PR | Scope(_PR): the processor namespace| +------+| || | +------+| +-| CPU0 | Processor(CPU0): the first processor| +------+|| +------++-| _SB | Scope(_SB): the system bus namespace| +------+| || | +------+| +-| LID0 | Device(LID0); the lid device| | +------+| | || | | +------+| | +-| _HID | Name(_HID, "PNP0C0D"): the hardware ID| | | +------+| | || | | +------+| | +-| _STA | Method(_STA): the status control method| | +------+| || | +------+| +-| PCI0 | Device(PCI0); the PCI root bridge| +------+| || | +------+| +-| _HID | Name(_HID, "PNP0A08"): the hardware ID| | +------+| || | +------+| +-| _CID | Name(_CID, "PNP0A03"): the compatible ID| | +------+| || | +------+| +-| RP03 | Scope(RP03): the PCI0 power scope| | +------+| | || | | +------+| | +-| PXP3 | PowerResource(PXP3): the PCI0 power resource| | +------+| || | +------+| +-| GFX0 | Device(GFX0): the graphics adapter| +------+| || | +------+| +-| _ADR | Name(_ADR, 0x00020000): the PCI bus address| | +------+| || | +------+| +-| DD01 | Device(DD01): the LCD output device| +------+| || | +------+| +-| _BCL | Method(_BCL): the backlight control method| +------+|| +------++-| _TZ | Scope(_TZ): the thermal zone namespace| +------+| || | +------+| +-| FN00 | PowerResource(FN00): the FAN0 power resource| | +------+| || | +------+| +-| FAN0 | Device(FAN0): the FAN0 cooling device| | +------+| | || | | +------+| | +-| _HID | Name(_HID, "PNP0A0B"): the hardware ID| | +------+| || | +------+| +-| TZ00 | ThermalZone(TZ00); the FAN thermal zone| +------+|| +------++-| _GPE | Scope(_GPE): the GPE namespace+------+Figure 2. Example ACPI Namespace
Linux ACPI 设备树
结构acpi_device对象的 sysfs 层次结构对应于 图 2 中所示的示例 ACPI 命名空间,添加了 固定PWR_BUTTON/SLP_BUTTON设备如下所示:
+--------------+---+-----------------+
| LNXSYSTEM:00 | \ | acpi:LNXSYSTEM: |
+--------------+---+-----------------+|| +-------------+-----+----------------++-| LNXPWRBN:00 | N/A | acpi:LNXPWRBN: || +-------------+-----+----------------+|| +-------------+-----+----------------++-| LNXSLPBN:00 | N/A | acpi:LNXSLPBN: || +-------------+-----+----------------+|| +-----------+------------+--------------++-| LNXCPU:00 | \_PR_.CPU0 | acpi:LNXCPU: || +-----------+------------+--------------+|| +-------------+-------+----------------++-| LNXSYBUS:00 | \_SB_ | acpi:LNXSYBUS: || +-------------+-------+----------------+| || | +- - - - - - - +- - - - - - +- - - - - - - -+| +-| PNP0C0D:00 | \_SB_.LID0 | acpi:PNP0C0D: || | +- - - - - - - +- - - - - - +- - - - - - - -+| || | +------------+------------+-----------------------+| +-| PNP0A08:00 | \_SB_.PCI0 | acpi:PNP0A08:PNP0A03: || +------------+------------+-----------------------+| || | +-----------+-----------------+-----+| +-| device:00 | \_SB_.PCI0.RP03 | N/A || | +-----------+-----------------+-----+| | || | | +-------------+----------------------+----------------+| | +-| LNXPOWER:00 | \_SB_.PCI0.RP03.PXP3 | acpi:LNXPOWER: || | +-------------+----------------------+----------------+| || | +-------------+-----------------+----------------+| +-| LNXVIDEO:00 | \_SB_.PCI0.GFX0 | acpi:LNXVIDEO: || +-------------+-----------------+----------------+| || | +-----------+-----------------+-----+| +-| device:01 | \_SB_.PCI0.DD01 | N/A || +-----------+-----------------+-----+|| +-------------+-------+----------------++-| LNXSYBUS:01 | \_TZ_ | acpi:LNXSYBUS: |+-------------+-------+----------------+|| +-------------+------------+----------------++-| LNXPOWER:0a | \_TZ_.FN00 | acpi:LNXPOWER: || +-------------+------------+----------------+|| +------------+------------+---------------++-| PNP0C0B:00 | \_TZ_.FAN0 | acpi:PNP0C0B: || +------------+------------+---------------+|| +-------------+------------+----------------++-| LNXTHERM:00 | \_TZ_.TZ00 | acpi:LNXTHERM: |+-------------+------------+----------------+Figure 3. Example Linux ACPI Device Tree
注意
每个节点都表示为“对象/路径/模态别名”,其中:
“对象”是 sysfs 中对象目录的名称。
“path”是相应 ACPI 命名空间对象,由对象的“路径”返回 系统属性。
‘modalias’ 是对象的 ‘modalias’ sysfs 的值 属性(如本文档前面所述)。