You can do resource HOB like stuff directly in the DXE via gDS->AddMemorySpace(), and all the other PI Global Coherency Domain (GCD) services.
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Pi/PiDxeCis.h see DXE_SERVICES Thanks, Andrew Fish On Mar 3, 2014, at 12:59 PM, Mike Maslenkin <miha...@parallels.com> wrote: > Hello! > Could someone correct my understanding of reserved memory regions? > I want to reserve some region (below 4G) but this region must be > accessible for OS. > To be clear this is ACPI NVS region which must be accessible for Linux > Kernel, i.e request_mem_region() must succeed. > So what I am doing: > On PEI phase I create two HOBs: > BuildResourceDescriptorHob ( > EFI_RESOURCE_SYSTEM_MEMORY, > EFI_RESOURCE_ATTRIBUTE_PRESENT | > EFI_RESOURCE_ATTRIBUTE_INITIALIZED | > EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | > EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | > EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | > EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | > EFI_RESOURCE_ATTRIBUTE_TESTED, > BASE_1MB, > LowerMemorySize - ReservedMemorySize) > ); > > BuildResourceDescriptorHob ( > EFI_RESOURCE_MEMORY_RESERVED, > EFI_RESOURCE_ATTRIBUTE_PRESENT | > EFI_RESOURCE_ATTRIBUTE_INITIALIZED | > EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | > EFI_RESOURCE_ATTRIBUTE_TESTED, > ReservedMemoryBase, > ReservedMemorySize > ); > > So, DXE phase will not use reserved memory. > To insert this reserved memory region to EFI memory map I call > gBS->AllocatePages ( > AllocateAddress, > EfiACPIMemoryNVS, > EFI_SIZE_TO_PAGES (ReservedMemorySize), > ReservedMemoryBase > ); > So, everyone is happy, OS kernels (Linux, Windows) successfully maps > this memory. > But CSM LegacyBiosDxe asserts. > LegacyBiosBuildE820 function detects overlapped memory region, because > it processes > EFI memory map and HOB list during E820 map building. > AllocatePages() adds this region to memory map, while HOB list still > contains it also. > So here is a question: Am I reserve memory region correctly or there is > a some inaccuracy at LegacyBiosDxe? > > > ------------------------------------------------------------------------------ > Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. > With Perforce, you get hassle-free workflows. Merge that actually works. > Faster operations. Version large binaries. Built-in WAN optimization and the > freedom to use Git, Perforce or both. Make the move to Perforce. > http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel