To address a PCI device, it must be enabled by being mapped into the system's I/O port address space or
memory-mapped address space. The system's
firmware (e.g.
BIOS) or the
operating system program the
Base Address Registers (commonly called BARs) to inform the device of its
resources configuration by writing configuration commands to the PCI controller. Because all PCI devices are in an
inactive state upon system reset, they will have no addresses assigned to them by which the operating system or
device drivers can communicate with them. Either the
BIOS or the operating system geographically addresses the PCI devices (for example, the first PCI slot, the second PCI slot, the third PCI slot, or the integrated PCI devices, etc., on the
motherboard) through the PCI controller using the per slot or per device IDSEL (Initialization Device Select) signals. When the computer is powered on, the PCI bus(es) and device(s) must be
enumerated by BIOS or operating system. Bus enumeration is performed by attempting to access the PCI configuration space registers for each buses, devices and functions. Note that device number, different from VID and DID, is merely a device's sequential number on that bus. Moreover, after a new bridge is detected, a new bus number is defined, and device enumeration restarts at device number zero. If no response is received from the device's function #0, the
bus master performs an abort and returns an all-bits-on value ( in
hexadecimal), which is an invalid VID/DID value, thus the BIOS or operating system can tell that the specified combination bus/device_number/function (B/D/F) is not present. So, when a read to a function ID of zero for a given bus/device causes the master (initiator) to abort, it must then be presumed that no working device exists on that bus because devices are required to implement function number zero. In this case, reads to the remaining functions numbers (1–7) are not necessary as they also will not exist. When a read to a specified B/D/F combination for the vendor ID register succeeds, the system firmware or operating system knows that it exists; it writes all ones to its BARs and reads back the device's requested memory size in an encoded form. The design implies that all address space sizes are a power of two and are naturally aligned. that is between 16 bytes and 2 gigabytes in size, located below the 4 gigabyte address space limit. If a platform supports the "Above 4G" option in system firmware, 64 bit BARs can be used. A PCI device may also have an
option ROM.
Resizable BAR Resizable BAR (also known as
Re-Size BAR,
AMD Smart Access Memory (SAM), or
ASRock Clever Access Memory (CAM)) is a capability which a PCIe device can use to negotiate a larger BAR size. Classically, BARs were limited to a size of 256MB, but modern
graphics cards have
framebuffers much larger than that. This mismatch led to inefficiencies when the CPU accessed the framebuffer. Resizable BAR lets a CPU access the whole framebuffer at once, thus improving performance. == Hardware implementation ==