The translation is temporarily closed for contributions due to maintenance, please come back later.

Translation

BecauseAs the PnP devices are disabled when probing the legacy devices they will not be attached twice (once as legacy and once as PnP). But in case of device-dependent identify routines it is the responsibility of the driver to make sure that the same device will not be attached by the driver twice: once as legacy user-configured and once as auto-identified.
(itstool) path: sect1/para
English
As the PnP devices are disabled when probing the legacy devices they will not be attached twice (once as legacy and once as PnP). But in case of device-dependent identify routines it is the responsibility of the driver to make sure that the same device will not be attached by the driver twice: once as legacy user-configured and once as auto-identified.
Context English Chinese (Simplified) (zh_CN) State
device xxx0 at isa? device xxx0 at isa?
For legacy ISA devices in many cases the drivers are still able to detect the configuration parameters. But each device to be configured in the system must have a config line. If two devices of some type are installed in the system but there is only one configuration line for the corresponding driver, ie: <_:programlisting-1/> then only one device will be configured. 对于老的ISA设备,很多情况下驱动程序仍然能够侦测配置参数。但是系统中配置的每个设备必须具有一个配置行。如果系统中装有同一类型的两个设备,但对应的驱动程序却只有一个配置行,例如:<programlisting>device xxx0 at isa?</programlisting>那么只有一个设备会被配置。
But for the devices supporting automatic identification by the means of Plug-n-Play or some proprietary protocol one configuration line is enough to configure all the devices in the system, like the one above or just simply: 但对于支持通过PnP或专有协议进行自动识别的设备,一个配置行就足够配置系统中的所有设备,如上面的配置行,或者简单地:
device xxx at isa? device xxx at isa?
If a driver supports both auto-identified and legacy devices and both kinds are installed at once in one machine then it is enough to describe in the config file the legacy devices only. The auto-identified devices will be added automatically. 如果设备驱动程序既支持能自动识别的设备又支持老设备,并且两类设备同时安装在一台机器上,那么只要在配置文件中描述老设备就足够了。自动识别的设备将被自动添加。
When an ISA bus is auto-configured the events happen as follows: 如果ISA设备是自动配置的,发生的事件如下:
All the drivers' identify routines (including the PnP identify routine which identifies all the PnP devices) are called in random order. As they identify the devices they add them to the list on the ISA bus. Normally the drivers' identify routines associate their drivers with the new devices. The PnP identify routine does not know about the other drivers yet so it does not associate any with the new devices it adds. 所有设备驱动程序的识别例程(包括识别所有PnP设备的PnP识别例程)以随机顺序被调用。他们识别出设备后就把设备添加到ISA总线上的列表中。通常驱动程序的识别例程将新设备与它们的驱动程序关联起来。而PnP识别例程并不知道其他驱动程序,因此不能将驱动程序与它所添加的新设备关联起来。
The PnP devices are put to sleep using the PnP protocol to prevent them from being probed as legacy devices. 使用PnP协议让PnP设备进入睡眠,以防止它们被探测为老设备。
The probe routines of non-PnP devices marked as <literal>sensitive</literal> are called. If probe for a device went successfully, the attach routine is called for it. 被标记为<literal>敏感(sensitive)</literal>的非PnP设备的探测例程被调用。如果探测设备成功,那么就为其调用挂接(attach)例程。
The probe and attach routines of all non-PNP devices are called likewise. 所有非PnP设备的探测和连接例程以同样的方式被调用。
The PnP devices are brought back from the sleep state and assigned the resources they request: I/O and memory address ranges, IRQs and DRQs, all of them not conflicting with the attached legacy devices. PnP设备从睡眠中恢复过来,并给它们分配所请求的资源:I/O、内存地址范围、IRQ和DRQ,所有这些与已连接的老设备不会冲突。
Then for each PnP device the probe routines of all the present ISA drivers are called. The first one that claims the device gets attached. It is possible that multiple drivers would claim the device with different priority; in this case, the highest-priority driver wins. The probe routines must call <function>ISA_PNP_PROBE()</function> to compare the actual PnP ID with the list of the IDs supported by the driver and if the ID is not in the table return failure. That means that absolutely every driver, even the ones not supporting any PnP devices must call <function>ISA_PNP_PROBE()</function>, at least with an empty PnP ID table to return failure on unknown PnP devices. 对于每个PnP设备,所有ISA设备驱动程序的探测例程都会被调用。第一个要求此设备的驱动程序将被连接。多个驱动程序以不同的优先权要求一个设备的情况是可能的,这种情况下,具有最高优先权的驱动程序将获胜。探测例程必须调用<function>ISA_PNP_PROBE()</function>将真实的PnP ID和驱动程序支持的ID列表作比较,如果ID不在表中则返回失败。这意味着每个驱动程序,包括不支持任何PnP设备的驱动程序,都必须对未知的PnP设备无条件调用<function>ISA_PNP_PROBE()</function>,对于未知设备, 至少要用一个空的PnP ID表调用并返回失败。
The probe routine returns a positive value (the error code) on error, zero or negative value on success. 探测例程遇到错误时会返回一个正值(错误码),成功时返回零或负值。
The negative return values are used when a PnP device supports multiple interfaces. For example, an older compatibility interface and a newer advanced interface which are supported by different drivers. Then both drivers would detect the device. The driver which returns a higher value in the probe routine takes precedence (in other words, the driver returning 0 has highest precedence, returning -1 is next, returning -2 is after it and so on). In result the devices which support only the old interface will be handled by the old driver (which should return -1 from the probe routine) while the devices supporting the new interface as well will be handled by the new driver (which should return 0 from the probe routine). If multiple drivers return the same value then the one called first wins. So if a driver returns value 0 it may be sure that it won the priority arbitration. 负的返回值用于PnP设备支持多个接口的情况。例如,老的兼容接口和新的高级接口通过不同的驱动程序来提供支持。两个驱动程序都侦测设备。在探测例程中返回较高值的驱动程序优先(换句话说,返回0的驱动程序具有最高的优先级,返回-1的其次,返回-2的更在其后,如此下去)。如果多个驱动程序返回相同的值,那么最先调用的获胜。因此,如果驱动程序返回0,就基本能够确信它获得优先权仲裁。
The device-specific identify routines can also assign not a driver but a class of drivers to the device. Then all the drivers in the class are probed for this device, like the case with PnP. This feature is not implemented in any existing driver and is not considered further in this document. 设备特定的识别例程也能够将一类而不是单个驱动程序指派给设备。就象使用PnP的情况一样,对于某一设备,会探测这一类中所有的驱动程序。由于这个特性在任何现存的驱动程序中总均未实现,故本文档中不再予以考虑。
As the PnP devices are disabled when probing the legacy devices they will not be attached twice (once as legacy and once as PnP). But in case of device-dependent identify routines it is the responsibility of the driver to make sure that the same device will not be attached by the driver twice: once as legacy user-configured and once as auto-identified. 由于探测老设备的时候PnP设备被禁用,它们不会被连接两次(一次作为老设备,一次作为PnP)。但如果识别例程设备相关的,这种情况下设备驱动程序有责任确保同一设备不会被设备驱动程序连接两次:一次作为老的由用户配置的,一次作为自动识别的。
Another practical consequence for the auto-identified devices (both PnP and device-specific) is that the flags can not be passed to them from the kernel configuration file. So they must either not use the flags at all or use the flags from the device unit 0 for all the auto-identified devices or use the sysctl interface instead of flags. 对于自动识别的设备(包括PnP和设备特定的)的另一个实践结论是,不能从内核配置文件中向它们传递旗标。因此它们必须要么根本不使用旗标,要么为所有自动识别的设备使用单元号为0的设备的旗标,或者使用sysctl接口而不是旗标。
Other unusual configurations may be accommodated by accessing the configuration resources directly with functions of families <function>resource_query_*()</function> and <function>resource_*_value()</function>. Their implementations are located in <filename>kern/subr_bus.c</filename>. The old IDE disk driver <filename>i386/isa/wd.c</filename> contains examples of such use. But the standard means of configuration must always be preferred. Leave parsing the configuration resources to the bus configuration code. 通过使用函数族<function>resource_query_*()</function>和<function>resource_*_value()</function>直接访问配置资源,从而可以提供其他不常用的配置。它们的实现位于<filename>kern/subr_bus.c</filename>。老的IDE磁盘驱动器<filename>i386/isa/wd.c</filename>包含这样使用的例子。但必须优先使用配置的标准方法。将解析配置资源这类事情留给总线配置代码。
Resources 资源
<primary>resources</primary> <primary>resources</primary>
<primary>device driver</primary><secondary>resources</secondary> <primary>device driver</primary><secondary>resources</secondary>
The information that a user enters into the kernel configuration file is processed and passed to the kernel as configuration resources. This information is parsed by the bus configuration code and transformed into a value of structure device_t and the bus resources associated with it. The drivers may access the configuration resources directly using functions <function>resource_*</function> for more complex cases of configuration. However, generally this is neither needed nor recommended, so this issue is not discussed further here. 用户写入到内核配置文件中的信息被作为配置资源处理,并传递到内核。总线配置代码解析这部分信息并将其转换为结构device_t的值和与之关联的总线资源。对于复杂情况下的配置,驱动程序可以直接使用<function>resource_*</function> 函数访问配置资源。 然而,通常既不需要也不推荐这样做,因此这儿不再进一步讨论这个问题。
The bus resources are associated with each device. They are identified by type and number within the type. For the ISA bus the following types are defined: 总线资源与每个设备相关联。通过类型和类型中的数字标识它们。对于ISA总线,定义了下面的类型:
<primary>DMA channel</primary> <primary>DMA channel(DMA通道)</primary>
<emphasis>SYS_RES_IRQ</emphasis> - interrupt number <emphasis>SYS_RES_IRQ</emphasis> - 中断号
<emphasis>SYS_RES_DRQ</emphasis> - ISA DMA channel number <emphasis>SYS_RES_DRQ</emphasis> - ISA DMA通道号
<emphasis>SYS_RES_MEMORY</emphasis> - range of device memory mapped into the system memory space <emphasis>SYS_RES_MEMORY</emphasis> - 映射到系统内存空间的设备内存的范围
<emphasis>SYS_RES_IOPORT</emphasis> - range of device I/O registers <emphasis>SYS_RES_IOPORT</emphasis> - 设备I/O寄存器的范围
The enumeration within types starts from 0, so if a device has two memory regions it would have resources of type <literal>SYS_RES_MEMORY</literal> numbered 0 and 1. The resource type has nothing to do with the C language type, all the resource values have the C language type <literal>unsigned long</literal> and must be cast as necessary. The resource numbers do not have to be contiguous, although for ISA they normally would be. The permitted resource numbers for ISA devices are: 类型内的枚举从0开始,因此如果设备有两个内存区域,它的<literal>SYS_RES_MEMORY</literal> 类型的资源编号为0和1。资源类型与C语言的类型无关,所有资源值具有C语言 <literal>unsigned long</literal>类型,并且必要时必须进行类型强制转换 (cast)。资源号不必连续,尽管对于ISA它们一般是连续的。ISA设备允许的资源编号为:
IRQ: 0-1
DRQ: 0-1
MEMORY: 0-3
IOPORT: 0-7
IRQ: 0-1
DRQ: 0-1
MEMORY: 0-3
IOPORT: 0-7
All the resources are represented as ranges, with a start value and count. For IRQ and DRQ resources the count would normally be equal to 1. The values for memory refer to the physical addresses. 所有资源被表示为带有起始值和计数的范围。对于IRQ和DRQ资源,计数一般等于1。内存的值引用物理地址。

Loading…

BecauseAs the PnP devices are disabled when probing the legacy devices they will not be attached twice (once as legacy and once as PnP). But in case of device-dependent identify routines it is the responsibility of the driver to make sure that the same device will not be attached by the driver twice: once as legacy user-configured and once as auto-identified.
a month ago
Browse all component changes

Glossary

English Chinese (Simplified) (zh_CN)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect1/para
Source string location
book.translate.xml:16866
String age
a month ago
Source string age
a month ago
Translation file
books/zh_CN/arch-handbook.po, string 1791