Chinese translated version of Documentation\acpi\scan_handlers.txt
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: 朱锋志 605509916@qq.com
---------------------------------------------------------------------
Documentation\acpi\scan_handlers的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者:朱锋志 605509916@qq.com
中文版翻译者: 朱锋志 605509916@qq.com
以下为正文
---------------------------------------------------------------------
ACPI Scan Handlers
ACPI扫描处理程序
Copyright (C) 2012, Intel Corporation
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
作者:Rafael J.威索基的<rafael.j.wysocki@intel.com>
During system initialization and ACPI-based device hot-add, the ACPI namespace
is scanned in search of device objects that generally represent various pieces
of hardware. This causes a struct acpi_device object to be created and
registered with the driver core for every device object in the ACPI namespace
and the hierarchy of those struct acpi_device objects reflects the namespace
layout (i.e. parent device objects in the namespace are represented by parent
struct acpi_device objects and analogously for their children). Those struct
acpi_device objects are referred to as "device nodes" in what follows, but they
should not be confused with struct device_node objects used by the Device Trees
parsing code (although their role is analogous to the role of those objects).
在系统初始化和基于ACPI设备热添加(Hot-Add),ACPI命名空间
被扫描在搜索设备对象,通常代表各硬件。这会导致一个struct acpi_device的对象被创建并
注册ACPI命名空间中的每个设备对象的驱动核心和那些struct acpi_device的对象的层次结构反映了命名空间
布局(即父设备的命名空间中的对象是由家长代表struct acpi_device的对象和类似为子女)。这些结构
,acpi_device对象被称为“在下面”的设备节点,但他们不应混淆与struct device_node的对象,所使用的设备树
解析代码(虽然它们的作用是类似这些对象的作用)。
During ACPI-based device hot-remove device nodes representing pieces of hardware
being removed are unregistered and deleted.
在ACPI的设备,热移除设备节点被删除未注册和删除。
The core ACPI namespace scanning code in drivers/acpi/scan.c carries out basic
initialization of device nodes, such as retrieving common configuration
information from the device objects represented by them and populating them with
appropriate data, but some of them require additional handling after they have
been registered. For example, if the given device node represents a PCI host
bridge, its registration should cause the PCI bus under that bridge to be
enumerated and PCI devices on that bus to be registered with the driver core.
Similarly, if the device node represents a PCI interrupt link, it is necessary
to configure that link so that the kernel can use it.
核心ACPI命名空间进行基本的扫描驱动程序中的代码/ ACPI / scan.c的设备节点的初始化,如检索常用的配置
从他们所代表的设备对象的信息,然后将它们填充相应的数据,但他们中的一些需要额外的处理后,便
已注册。例如,如果给定的设备节点代表一个PCI主机桥梁,其注册应引起PCI总线,桥底下是
枚举和PCI总线上的设备被注册到驱动核心。同样,如果设备节点代表一个PCI中断链路,有必要
配置该链接以使内核可以使用它。
Those additional configuration tasks usually depend on the type of the hardware
component represented by the given device node which can be determined on the
basis of the device node's hardware ID (HID). They are performed by objects
called ACPI scan handlers represented by the following structure:
这些额外的配置任务通常依赖于硬件的类型给定的设备上可以判定节点所表示的组件
根据该设备节点的硬件ID(HID)。它们是由对象称为ACPI扫描处理程序由以下结构表示的:
struct acpi_scan_handler {
const struct acpi_device_id *ids;
struct list_head list_node;
int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
void (*detach)(struct acpi_device *dev);
};
where ids is the list of IDs of device nodes the given handler is supposed to
take care of, list_node is the hook to the global list of ACPI scan handlers
maintained by the ACPI core and the .attach() and .detach() callbacks are
executed, respectively, after registration of new device nodes and before
unregistration of device nodes the handler attached to previously.
IDS是设备节点的ID列表给定的处理程序应该是照顾,list_node钩全局列表的ACPI扫描处理程序
维护ACPI核心及附加和分离()回调执行后,分别登记新的设备节点和前
注销的设备节点连接到以前的处理程序。
The namespace scanning function, acpi_bus_scan(), first registers all of the
device nodes in the given namespace scope with the driver core. Then, it tries
to match a scan handler against each of them using the ids arrays of the
available scan handlers. If a matching scan handler is found, its .attach()
callback is executed for the given device node. If that callback returns 1,
that means that the handler has claimed the device node and is now responsible
for carrying out any additional configuration tasks related to it. It also will
be responsible for preparing the device node for unregistration in that case.
The device node's handler field is then populated with the address of the scan
handler that has claimed it.
该命名空间扫描功能,acpi_bus_scan(),首次登记的所有到驱动核心,在给定的命名空间范围内的设备节点。然后,
它会尝试使用IDS阵列匹配扫描对他们每个人的处理程序可用扫描处理程序。如果找到匹配的扫描处理程序,其附加()
回调函数执行给定的设备节点。如果这个回调函数返回1,这意味着处理器已声称该设备节点,现在是负责
开展相关的任何额外的配置任务。它也将是负责准备注销的设备节点,在这种情况下,该设备节点的处理程
序字段与扫描的地址,然后填充处理程序。
If the .attach() callback returns 0, it means that the device node is not
interesting to the given scan handler and may be matched against the next scan
handler in the list. If it returns a (negative) error code, that means that
the namespace scan should be terminated due to a serious error. The error code
returned should then reflect the type of the error.
如果attach()中的函数返回0时,表示该设备节点不是有趣的给定的扫描处理程序,并且可以比对下一次扫描
在列表中的处理程序。如果它返回一个错误代码(负),这意味着,命名空间扫描应予终止,因为一个严重的错误。
错误代码应该反映错误类型。
The namespace trimming function, acpi_bus_trim(), first executes .detach()
callbacks from the scan handlers of all device nodes in the given namespace
scope (if they have scan handlers). Next, it unregisters all of the device
nodes in that scope.
微调功能的命名空间,acpi_bus_trim(),首先执行分离()从扫描处理程序的所有设备节点,在给定的命名空间的回调
范围(如果他们有扫描处理程序)。接着,取消注册的所有的移动设备在该范围内的节点。
ACPI scan handlers can be added to the list maintained by the ACPI core with the
help of the acpi_scan_add_handler() function taking a pointer to the new scan
handler as an argument. The order in which scan handlers are added to the list
is the order in which they are matched against device nodes during namespace
scans.
ACPI扫描处理程序可以被添加到由ACPI核心与维护的列表中帮助acpi_scan_add_handler()函数的指针到新的扫描
作为一个参数的处理程序。扫描处理程序被添加到列表中的顺序是为了他们对设备节点匹配在命名空间
扫描。
All scan handles must be added to the list before acpi_bus_scan() is run for the
first time and they cannot be removed from it.
所有扫描处理必须被添加到列表中前acpi_bus_scan()运行
第一时间,他们不能被删除。