Документ взят из кэша поисковой машины. Адрес оригинального документа : http://jet.sao.ru/hq/sts/linux/doc/pnp/pnpHOWTO/Plug-and-Play-HOWTO-6.html
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 10:24:46 2012
Кодировка:

Поисковые слова: п п п п п п п п п п п п п п п п п п п п
Plug-and-Play-HOWTO : Tell the Driver the Configuration Next Previous Contents

6. Tell the Driver the Configuration

6.1 Introduction

A modern driver for a device will find out the bus-resource configuration without you having to tell it anything. It may even set the bus-resources in the hardware using PnP methods. Some drivers have more than one way to find out how their physical device is configured. In the worst case you must hard-code the bus-resources into the kernel (or a module) and recompile.

In the middle are cases such as where you run a program to give the bus-resource info to the driver or put the info in a configuration file. In some cases the driver may probe for the device at addresses where it suspects the device resides (but it will never find a PnP device if it hasn't been enabled by PnP methods). It may then try to test various IRQs to see which one works. It may or may not automatically do this. In other cases the driver may use PnP methods to find the device and how the bus-resources have been set by the BIOS, etc. but will not actually set them. It may also look at some of the "files" in the /proc directory.

One may need to "manually" tell a driver what bus-resources it should use. You give such bus-resources as a parameter to the kernel or to a loadable module. If the driver is built into the kernel, you pass the parameters to the kernel via the "boot-prompt". See The Boot-Prompt-HOWTO which describes some of the bus-resource and other parameters. Once you know what parameters to give to the kernel, one may put them into a boot loader configuration file. For example, put append="...". into the lilo.conf file and then the lilo to get this info into the kernel loader.

If the driver is loaded as a module, in many cases the module will find the bus-resources it needs and set them in the device. In other cases (mostly for older PCs) you may need to give bus-resources as parameters to the module. In some versions of Linux /usr/lib/modules_help/descr.gz shows a list of possible module parameters. Parameters to a module (including ones that automatically load) may be specified in /etc/modules.conf. There are usually tools used to modify this file which are distribution-dependent. Comments in this file should help regarding how to modify it. Also, any module your put in /etc/modules will get loaded along with its parameters.

While there is great non-uniformity about how drivers find out about bus-resources, the end goal is the same. If you're having problems with a driver you may need to look at driver documentation (check the kernel documentation tree). Some brief examples of a few drivers is presented in the following sections:

6.2 Serial Port Driver Example

For PCI serial ports (and for newer 2.4 kernels for ISA), the serial driver detects the type of serial port and PnP configures it. Unfortunately, there may be some PCI serial ports that are not supported yet.

For the standard ISA serial port with older versions of the kernel and serial driver (not for multiport cards) you use setserial to inform the driver. Using setserial is also a must for non-pnp serial ports. Setserial is often run from a start-up file. In newer versions there is a /etc/serial.conf file that you "edit" by simply using the setserial command in the normal way and what you set using setserial is saved in the serial.conf configuration file. The serial.conf file should be consulted when the setserial command runs from a start-up file. Your distribution may or may not set this up for you.

There are two different ways to use setserial depending on the options you give it. One way is used to manually tell the driver the configuration. The other way is to probe at a given address and report if a serial port exists there. It can also probe this address and try to detect what IRQ is used for this port. The driver runs something like setserial at start-up but it doesn't probe for IRQs, it just assigns the "standard" IRQ which may be wrong. It does probe for the existence of a port. See Serial-HOWTO for more details.

6.3 Some Sound Card Driver Examples

OSS-Lite

You must give the IO, IRQ, and DMA as parameters to a module or compile them into the kernel. But some PCI cards will get automatically detected. RedHat supplies a program "sndconfig" which detects ISA PnP cards and automatically sets up the modules for loading with the detected bus-resources.

OSS (Open Sound System) and ALSA

These will detect the card by PnP methods and then select the appropriate driver and load it. It will also set the bus-resources on an ISA-PnP card. You may need to manually intervene to avoid conflicts. For the ALSA driver, support for ISA-PnP is optional and you may use isapnp tools if you want to.


Next Previous Contents