[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PCI Configuration BAR all '1' write



Hi,
PCI Specs 2.2 p. 203 says about configuratin BAR operations:
"Power-up software can determine how much address space the device
requires by writing a value of all 1's to the register and then reading
the value back. The device will return 0's in all don't-care address
bits, effectively specifying the address space required."

I have two implementations for the above configuration BAR all '1'
operation:
1. After writing all '1' and reading back the size, it restores the
contents before writing all '1' to it;
2. After writing all '1' and reading back the size, its contents are
always the size. The memory address before writing all '1' to it is lost
after writing all '1' to BAR. It requires software polling the size read
the contents first and store it somewhere, then writing all '1' to it
and reading back to get memory size, then writing the saved value to the
BAR again.

I want to know which one is right. Logic of method 1 is complex, but it
retains contents after software reads its memory size; Logic of method 2
is simple, but it losts its contents after software reads its memory
size. 

Thank you.

Weng