Re: Clarification needed for PCI address translation


Pankaj Bansal
 

On Mon, 11 May 2020 at 05:36, Pankaj Bansal <pankaj.bansal@nxp.com> wrote:

But won't it?

There can be only two scenarios :
1. PCI address space coincides with CPU address space.
In this case host address = device address and translation = 0
2. PCI address space lies at some offset in CPU address space. Like the
example I mention in LX2160A
In this case host address = device address + translation, where translation >
0

Can there be a scenario where translation < 0 ? I don't think so
I don't see how this matters.

Translation uses unsigned 64-bit integer arithmetic, so if you need
the translation to go the other way, just subtract from
0x1_0000_0000_0000_0000.
That is what confuses me. Why is this convoluted logic needed altogether ?
Why can't we use direct translation values (instead of MAX_UINT64 + 1 - translation) ?

Regards,
Pankaj Bansal

Join discuss@edk2.groups.io to automatically receive all group messages.