On Thu, Apr 14, 2016 at 12:29:04PM +0200, Laszlo Ersek wrote:
> Gary,
> 
> On 04/14/16 10:16, Gary Lin wrote:
> > The memory space for the ramdisk was allocated by AllocatePool() which
> > allocates the memory in BootServiceData, and then the ramdisk would be
> > cleared after ExitBootService(). This commit changes the allocated area
> > to EfiReservedMemoryType so that OS can access it later.
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Gary Lin <g...@suse.com>
> > ---
> >  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c 
> > b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
> > index 29dcbf7..83bf114 100644
> > --- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
> > +++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
> > @@ -417,7 +417,7 @@ HiiCreateRamDisk (
> >      Size = FileInformation->FileSize;
> >    }
> >  
> > -  StartingAddr = (UINTN) AllocatePool ((UINTN) Size);
> > +  StartingAddr = (UINTN) AllocateReservedPool ((UINTN) Size);
> >    if (0 == StartingAddr) {
> >      do {
> >        CreatePopUp (
> > 
> 
> Ray explained in another message:
> 
> http://thread.gmane.org/gmane.comp.bios.edk2.devel/9885/focus=9923
> 
> that it is not necessary to allocate all RAM disks from reserved memory.
> Reserved memory is needed only if you want to boot off a RAM disk.
> 
> So, I think that making this change unconditionally in the HII callback
> is not correct. (Although I believe that the current code is also
> incorrect.)
> 
Ah, I didn't expect that RAM disk to be used only in UEFI shell.
I applied the NFIT patch(*) and it complained the allocated memory is
not reserved so I wrote this patch.

(*) http://thread.gmane.org/gmane.comp.bios.edk2.devel/9952
    MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory RAM disks

> Instead, I think this question should be exposed with a checkbox on the
> form: "will you want to boot from this RAM disk?" And then the answer to
> that question should determine the type of memory the RAM disk is
> allocated from.
> 
Agree. This is much better. I'll keep this patch for my personal test
until it's fixed properly.

Thanks,

Gary Lin
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to