In my previous question, I established that the memory address used by PCI/PCIe devices does not have to mapped to system RAM, but could also refer to "on device" memory, e.g. RAM or registers.
But how are the BARs set up in this case?
Is it simply a case (that during configuration):
- the device advertises that it wishes to expose, for example 16MB of memory,
- BAR gets assigned a base address,
- Thereafter the device maps the offsets to its internal memory?
How does this differ from when the device wishes to access 16MB of system memory (i.e. the device has no memory of its own?)
EDIT: How does the addressing differ between:
A: The device has no memory of its own, e.g. a Video Adapter using shared memory.
B: The device has memory, and shares it with the system (e.g. hypothetical HDD adapter with RAM buffers).
In both cases, are the BARs assigned by the OS and occupy addressable memory?
This distinction is important in a system fully-occupied with RAM (e.g. a 32-bit system with 4 GB RAM installed would be able to support a Video Adapter with 2 GB shared RAM [situation (A)]. But the same system has no address space left over for a hypothetical HDD adapter with onboard 2 GB RAM cache [situation (B)]?