On Mon, Apr 06, 2020 at 10:08:43 +0000, Pankaj Bansal (OSS) wrote:
> 
> > > +
> > > +  FdBase = (UINTN)FixedPcdGet64 (PcdFdBaseAddress);
> > > +  FdTop = FdBase + (UINTN)FixedPcdGet32 (PcdFdSize);
> > > +
> > > +  // Declare memory regios to system
> > 
> >                        regions
> 
> OK
> 
> > 
> > > +  for (Index = MAX_DRAM_REGIONS - 1; Index >= 0; Index--) {
> > 
> > I guess what confuses me about this loop is the combination of:
> > - Iterating over the DRAM regions backwards (optimization?)
> > - Not terminating the iteration once all of the Fd region has been
> >   covered (the opposite of optimization).
> > 
> > Could something be done about that?
> > 
> 
> The DRAM region info is sorted based on the RAM address is SOC memory map.
> i.e. region0 is at lower address, as compared to region1.
> The goal to start from last region is to find the topmost RAM region that can 
> contain UEFI DXE region i.e. PcdSystemMemoryUefiRegionSize.
> In the upcoming patches I would update the PcdSystemMemoryBase dynamically 
> from that region.
> If UEFI were to allocate any reserved or runtime region, it would be 
> allocated from topmost RAM region.
> This ensures that maximum amount of lower RAM (32 bit addresses) are left for 
> OS to allocate to devices that can only
> work with 32bit physical addresses. E.g. legacy devices that need to DMA to 
> 32bit addresses.

OK, that's (sadly) a good reason. Can it be explained in a comment?

/
    Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56981): https://edk2.groups.io/g/devel/message/56981
Mute This Topic: https://groups.io/mt/72077425/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to