2

I'm trying to find the link between Memory BARs (Base Address Registers) and Physical Memory in a PCI Express Transactions. In my last question I started to understand what happens when a CPU reads/writes at a certain memory address, now I need to go deep into the PCI Express Transaction.

I need to understand if physical RAM is involved in every PCI Express Memory Read/Write Transaction.

1) Does the physical memory addressed by a device Memory BAR reside in the device itself? Or does it reside in the RAM?

2) When I start a Memory Read/Write transaction to a PCI Express device without inboard physical memory, specifying a memory address, how can the device access it if it's not mapped to an inner physical memory? When my device returns a transaction packet with data, does the root complex both give the data to the cpu and insert it into physical RAM?

Jacopo Reggiani
  • 95
  • 1
  • 2
  • 4

1 Answers1

5

Main system RAM has nothing to do with a BAR. The BAR simply configures the device to decode access to those addresses. Normally the device contains a number of configuration registers. The BAR allows the CPU to access these registers as if they were a block of ram, but there isn't actually ram there. The PCIe root complex is configured to route most memory access to RAM, and access to a block of addresses, typically in the 3-4 GB area, to the PCIe bus instead. The BAR in a given device configures it to respond to a specific block of those addresses.

On the other hand, some devices, most notably video cards, actually do have their own ram on board that is accessed via the BAR.

psusi
  • 8,122