323 - What are the definitions of the BAR bits in PCI/PCIe application?

323 - What are the definitions of the BAR bits in PCI/PCIe application?

The bit definitions of BAR for memory base address register are:

Bit 0: reserved to 0 as memory space indicator.
Bit 2~1: 00 indicates 32-bit access space; while 11 indicates 64-bit access space.
Bit 3: 1 indicates that the memory is prefetchable, which means no side effect on read.
Bit 31~4: number of 0s in lowest bits are used to define memory bar size in 16-byte aligned address blocks, while highest bits should be all 1s during initialization.

Example 1:
For 32-bit wide 1KBytes non-prefetchable memory space, set the BAR to "0xFFFF_FC00".

Example 2:
For 32-bit wide 1MBytes prefetchable memory space, set the BAR to "0xFFF0_0008".