[MemoryInitPeiLib] Reason for splitting the Memory resource descriptor HOB


Pankaj Bansal
 

Hi Ard/Leif et al.,

I am looking into the code for declaring available system memory (RAM) from PI phase to DXE phase.
I am not able to understand this piece of code and comments :

https://github.com/tianocore/edk2/commit/44d2e8d7cab3ee1be0cf02f604d833e6b75b04b2

Why do we need to split the Memory resource descriptor ?
Moreover, this doesn't affect the system because the GCD service coalesces the adjacent entries in GCD memory map:

https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Gcd/Gcd.c#L453

This would render the splitting of Memory resource descriptor of no use.
Why can't we just declare the FV region as Memory allocation Hob without splitting ?

Regards,
Pankaj Bansal


Pankaj Bansal
 

+ OSS email id

-----Original Message-----
From: Pankaj Bansal
Sent: Sunday, July 19, 2020 7:06 AM
To: discuss@edk2.groups.io; 'Ard Biesheuvel' <ard.biesheuvel@...>; 'Leif
Lindholm' <leif.lindholm@...>
Subject: [MemoryInitPeiLib] Reason for splitting the Memory resource
descriptor HOB

Hi Ard/Leif et al.,

I am looking into the code for declaring available system memory (RAM) from PI
phase to DXE phase.
I am not able to understand this piece of code and comments :

https://github.com/tianocore/edk2/commit/44d2e8d7cab3ee1be0cf02f604d83
3e6b75b04b2

Why do we need to split the Memory resource descriptor ?
Moreover, this doesn't affect the system because the GCD service coalesces the
adjacent entries in GCD memory map:

https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Gc
d/Gcd.c#L453

This would render the splitting of Memory resource descriptor of no use.
Why can't we just declare the FV region as Memory allocation Hob without
splitting ?

Regards,
Pankaj Bansal