linuxlinux-device-driverpci-epci-bus

who fills the device configuration space of pci?


I want to know who fills the configuration space of a particular device of PCI at the first place when a new device is connected to the PCI bus. I know both bios and operating system can configure the PCI space but who gives the information of the device to both of them.


Solution

  • The read-only fields of the PCI configuration space, identifying the device and its capabilities, are built-in to the device, not filled in by software.

    Some fields, such as the BARs, are configured by the BIOS, as part of its responsibility to set up the address map of the system. The rest of the fields are programmed by the OS or the device driver. (The BIOS may also have a driver for the device, if the device may be used to boot the system.)

    Decisions of these three software components (BIOS, OS, and driver) are based on rules and policies built into the software by its designers and/or configured by the system installer or user. For example, BIOS setup menus often have settings to control where the BAR regions may be placed. In Windows, information used to configure devices may come from the registry.