Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/hq/sts/linux/doc/pnp/pnpHOWTO/Plug-and-Play-HOWTO-7.html
Дата изменения: Unknown
Дата индексирования: Sat Sep 11 22:04:11 2010
Кодировка:

Поисковые слова: сферическая составляющая галактик
Plug-and-Play-HOWTO : What Is My Current Configuration? Next Previous Contents

7. What Is My Current Configuration?

Here "configuration" means the assignment of PnP bus-resources (addresses, IRQs, and DMAs). There are two parts to this question for each device. Each part should have the same answer.

  1. What is the configuration of the device driver software? I.e.: What does the driver think the hardware configuration is?
  2. What configuration (if any) is set in the device hardware?

Of course the configuration of the device hardware and its driver should be the same (and it normally is). But if things are not working right, it could be because there's a difference. This means the the driver has incorrect information about the actual configuration of the hardware. This spells trouble. If the software you use doesn't adequately tell you what's wrong (or automatically configure it correctly) then you need to investigate how your hardware devices and their drivers are configured. While Linux device drivers should "tell all" in some cases it's not easy to determine what has been set in the hardware.

Another problem is that when you view configuration messages on the screen, it's sometimes not clear whether the reported configuration is that of the device driver, the device hardware, or both. If the device driver has either set the configuration in the hardware or has otherwise checked the hardware then the driver should have the correct information.

But sometimes the driver has been provided incorrect resources by a script, by incorrect resource parameters given to a module, or perhaps just hasn't been told what the resources are and tries to use incorrect default resources. For example, one can uses "setserial" to tell the serial port driver an incorrect resource configuration and the driver accepts it without question.

7.1 Boot-time Messages

Some info on configuration may be obtained by reading the messages from the BIOS and from Linux that appear on the screen when you first start the computer. These messages often flash by too fast to read but once they stop type Shift-PageUp a few times to scroll back to them. To scroll forward thru them type Shift-PageDown. Typing "dmesg" at any time to the shell prompt will show only the Linux kernel messages and miss some of the most important ones (including ones from the BIOS). The messages from Linux may sometimes only show what the device driver thinks the configuration is, perhaps as told it via an incorrect configuration file. Checking log files in /var/log may also useful.

For the PCI bus, the notation: 00:1a:0 means the PCI bus 00 (the main PCI bus), PCI card (or chip) 1a, and function 0 (the first device) on the card or chip. The 2nd device on card (or chip) 08 would be: 00:08:1.

The BIOS messages display first and will show the actual hardware configuration at that time, but isapnp, or pci utilities, or device drivers may change it later. As an alternative to eventually using Shift-PageUp to read them, try freezing them by hitting the "Pause" key. Press any key to resume. But once the messages from Linux start to appear, it's too late to use "Pause" since it will not freeze the messages from Linux.

7.2 How Are My Device Drivers Configured?

There may be a programs you can run from the command line (such as "setserial" for serial ports) to determine this. The /proc directory tree is useful. It seems that there are many files buried deep in this tree that contain bus-resource info. Only a couple of them will be mentioned here. /proc/ioports shows the I/O addresses that the drivers use (or try if it's wrong). They might not be set this way in hardware.

/proc/interrupts shows only interrupts currently in use. Many interrupts that have been allocated to drivers don't show at all since they're not currently being used. For example, even though your floppy drive has a floppy disk in it and is ready to use, the interrupt for it will not show unless its in use. Again, just because an interrupt shows up here doesn't mean that it exists in the hardware. A clue that it doesn't exist in hardware will be if it shows that 0 interrupts have been issued by this interrupt. Even if it shows some interrupts have been issued there is no guarantee that they came from the device shown. It could be that some other device which is not currently in use has issued them. A device not in use (per the kernel) may still issue some interrupts for various reasons.

7.3 How Are My Hardware Devices Configured?

It's easy to find out what bus-resources have been assigned to devices on the PCI bus with the "lspci" or "scanpci" commands. For for kernels < 2.2: see /proc/pci or /proc/bus/pci for later kernels. Note that IRQs for /proc/pci are in hexadecimal. Don't bother trying to decipher /proc/bus/pci/devices since "lspci" will do that for you.

In most cases for PCI you will only see how the hardware is now configured and not what resources are required. In some cases you only see the base addresses (the starting addresses of the range) but not the ending addresses. If you see the entire range then you can determine how many bytes of address resource is needed. So in some cases you could calculate the needed resources and possibly set (with setpci --hard to use) a different address range (of the same length) if needed. You only need to tell the device what the new base address is since it internally has a knowledge of the length.

For the ISA bus you may try running pnpdump --dumpregs but it's not a sure thing. The results may be seem cryptic but they can be deciphered. Don't confuse the read-port address which pnpdump "tries" (and finds something there) with the I/O address of the found device. They are not the same. To try to find missing hardware on the ISA bus (both PnP and legacy) try the program "scanport" (Debian only ??) but be warned that it might hang your PC. It will not show the IRQ nor will it positively identify the hardware.

Messages from the BIOS at boot-time tell you how the hardware configuration was then. In case only the BIOS does the configuring, then it should still be the same. Messages from Linux may be from drivers that used kernel PnP functions to inspect and/or set bus-resources. These should be correct, but beware of messages that only show what is in some configuration file (what the driver thinks). Of course, if the device works fine, then it's likely configured the same as the driver.

Some people have attempted to use Windows to see how bus-resources have been set up. Unfortunately, since the hardware forgets its bus-resource configuration when powered down, the configuration may not be the same under Linux. It sometimes turns out to be the same because in many cases both Windows and Linux simply accept what the BIOS has set. But where Windows and/or Linux do the configuring, they may do it differently. So don't count on devices being configured the same.


Next Previous Contents