All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/3] grub efi initrd image memory allocation 4K alignment
@ 2006-10-24  7:03 bibo,mao
  2006-10-25  5:40 ` bibo,mao
  0 siblings, 1 reply; 2+ messages in thread
From: bibo,mao @ 2006-10-24  7:03 UTC (permalink / raw)
  To: grub-devel

Hi,
  On grub efi platform, initrd image memory allocation start
address must be 4K alignment, else it will fail to alloc memory
for initrd image.
  
thanks
bibo,mao

diff -Nruap grub2.org/loader/i386/efi/linux.c grub2/loader/i386/efi/linux.c
--- grub2.org/loader/i386/efi/linux.c	2006-10-24 13:24:46.000000000 +0800
+++ grub2/loader/i386/efi/linux.c	2006-10-24 13:25:35.000000000 +0800
@@ -587,7 +587,6 @@ grub_rescue_cmd_initrd (int argc, char *
        desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
     {
       if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
-	  && desc->physical_start >= addr_min
 	  && desc->physical_start + size < addr_max
 	  && desc->num_pages >= initrd_pages)
 	{
@@ -598,7 +597,7 @@ grub_rescue_cmd_initrd (int argc, char *
 	    physical_end = addr_max;
 
 	  if (physical_end > addr)
-	    addr = physical_end - page_align (size);
+	    addr = PAGE_DOWN(physical_end - page_align (size));
 	}
     }
 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 2/3] grub efi initrd image memory allocation 4K alignment
  2006-10-24  7:03 [patch 2/3] grub efi initrd image memory allocation 4K alignment bibo,mao
@ 2006-10-25  5:40 ` bibo,mao
  0 siblings, 0 replies; 2+ messages in thread
From: bibo,mao @ 2006-10-25  5:40 UTC (permalink / raw)
  To: grub-devel

This patch is sent for second time.

thanks
bibo,mao

diff -Nrup grub2.org/loader/i386/efi/linux.c grub2/loader/i386/efi/linux.c
--- grub2.org/loader/i386/efi/linux.c	2006-10-25 12:15:25.000000000 +0800
+++ grub2/loader/i386/efi/linux.c	2006-10-25 11:40:24.000000000 +0800
@@ -587,7 +587,6 @@ grub_rescue_cmd_initrd (int argc, char *
        desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
     {
       if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
-	  && desc->physical_start >= addr_min
 	  && desc->physical_start + size < addr_max
 	  && desc->num_pages >= initrd_pages)
 	{
@@ -598,7 +597,7 @@ grub_rescue_cmd_initrd (int argc, char *
 	    physical_end = addr_max;
 
 	  if (physical_end > addr)
-	    addr = physical_end - page_align (size);
+	    addr = GRUB_EFI_PAGE_TRUNC (physical_end - page_align (size));
 	}
     }
 

Mao, Bibo wrote:
> Hi,
>   On grub efi platform, initrd image memory allocation start
> address must be 4K alignment, else it will fail to alloc memory
> for initrd image.
>  
> thanks
> bibo,mao
> 
> diff -Nruap grub2.org/loader/i386/efi/linux.c grub2/loader/i386/efi/linux.c
> --- grub2.org/loader/i386/efi/linux.c   2006-10-24 13:24:46.000000000 +0800
> +++ grub2/loader/i386/efi/linux.c       2006-10-24 13:25:35.000000000 +0800
> @@ -587,7 +587,6 @@ grub_rescue_cmd_initrd (int argc, char *
>         desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
>      {
>        if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
> -         && desc->physical_start >= addr_min
>           && desc->physical_start + size < addr_max
>           && desc->num_pages >= initrd_pages)
>         {
> @@ -598,7 +597,7 @@ grub_rescue_cmd_initrd (int argc, char *
>             physical_end = addr_max;
> 
>           if (physical_end > addr)
> -           addr = physical_end - page_align (size);
> +           addr = PAGE_DOWN(physical_end - page_align (size));
>         }
>      }
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-25  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-24  7:03 [patch 2/3] grub efi initrd image memory allocation 4K alignment bibo,mao
2006-10-25  5:40 ` bibo,mao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.