[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] [PATCH] GFW: Fix InitializeXenVram()



Fix InitializeXenVram()

alignemnt logic was wrong. round up is needed instead of round down.
add two debug messages.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r ceb752058fbb 
edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.c
--- a/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.c Wed Sep 
24 18:46:12 2008 +0900
+++ b/edk2-sparse/EdkQemuPkg/Chipset/PcCompatible/VgaInit/Dxe/XenVRam.c Thu Sep 
25 13:34:18 2008 +0900
@@ -96,10 +96,13 @@
   Memory = 0xffffffff; // 32bit
   Status = gBS->AllocatePages (AllocateMaxAddress, EfiRuntimeServicesData, 
Pages, &Memory);
   if (Status != EFI_SUCCESS) {
+    DEBUG ((EFI_D_ERROR,
+           "InitializeXenVRam can't allocate memory for vram size = 0x%lx\n",
+           VGA_RAM_SIZE));
     return;
   }
   AlignedMask = ~(XEN_PAGE_SIZE - 1);
-  VgaRam = (UINTN) Memory & AlignedMask;
+  VgaRam = (Memory + XEN_PAGE_SIZE - 1) & AlignedMask;
   UnalignedPages = EFI_SIZE_TO_PAGES (VgaRam - Memory);
   if (UnalignedPages > 0) {
     gBS->FreePages (Memory, UnalignedPages);
@@ -109,6 +112,8 @@
     gBS->FreePages (VgaRam + VGA_RAM_SIZE, UnalignedPages);
   }
   ZeroMem ((VOID*) VgaRam, VGA_RAM_SIZE);
+  DEBUG ((EFI_D_INFO, "InitializeXenVRam vram 0x%lx - 0x%lx\n",
+         VgaRam, VgaRam + VGA_RAM_SIZE));
 
   Data32 = VgaRam; // discard upper bit
   Bar0 = PciRead32 (


-- 
yamahata

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.