BAR Programming

How system software program BARs ?

For type 0 header, there are 6 BARs; For type 1 header, there are 2 BARs.  Not all BAR have to be implemented.  Chip designer knows how many internal registers or ram needed to be accessed by software and how may BARs are implemented.

BAR[0]: 0: memory request; 1: IO request

BAR[2:1]: 00 32-bit address; 10 64-bit address

BAR[3]: 0: non-prefetchable; 1: prefetchable.

Two things chip designer needs to do:

1, Extra BARs are hard-coded with all 0’s notifying software that these BARs are not implemented.

2, Hard-coded the lower bits of the BARs to certain values indicating the type and size of the address space being requested.

System software write all 1’s to BARs and read them back first.  Then software knows the type and size.  Finally software write the requested value(address range) to the upper bits of the BARs.

 

 

 

Leave a comment