public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] [PATCH] arch/ia64/kernel/efi.c
@ 2002-07-26 13:35 John Marvin
  2002-07-26 13:50 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: John Marvin @ 2002-07-26 13:35 UTC (permalink / raw)
  To: linux-ia64

In doing some testing, I discovered the the mem= kernel command line option
doesn't behave as expected for zx1 based machines. The current implementation
assumes that memory starts at physical address zero and is physically
contiguous, i.e. the mem= value is used as a limit on the physical address,
rather than specifying the maximum physical memory to use.

I've enclosed a patch to fix the problem.  Since this is primarily a
debugging option, this isn't a critical fix.

John Marvin
jsm@fc.hp.com

--- arch/ia64/kernel/efi.c.old	Mon Oct 17 14:01:13 2044
+++ arch/ia64/kernel/efi.c	Mon Oct 17 14:01:31 2044
@@ -210,6 +210,7 @@ efi_memmap_walk (efi_freemem_callback_t 
 	void *efi_map_start, *efi_map_end, *p, *q;
 	efi_memory_desc_t *md, *check_md;
 	u64 efi_desc_size, start, end, granule_addr, first_non_wb_addr = 0;
+       unsigned long mem_found = 0;
 
 	efi_map_start = __va(ia64_boot_param->efi_memmap);
 	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -259,14 +260,16 @@ efi_memmap_walk (efi_freemem_callback_t 
 		trim_top(md, first_non_wb_addr);
 
 		if (is_available_memory(md)) {
-			if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
-				if (md->phys_addr > mem_limit)
+			if (mem_found + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
+				if (mem_found >= mem_limit)
 					continue;
-				md->num_pages = (mem_limit - md->phys_addr) >> EFI_PAGE_SHIFT;
+				md->num_pages = (mem_limit - mem_found) >> EFI_PAGE_SHIFT;
 			}
 
 			if (md->num_pages = 0)
 				continue;
+
+			mem_found += (md->num_pages << EFI_PAGE_SHIFT);
 
 			curr.start = PAGE_OFFSET + md->phys_addr;
 			curr.end   = curr.start + (md->num_pages << EFI_PAGE_SHIFT);


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

end of thread, other threads:[~2002-07-26 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-26 13:35 [Linux-ia64] [PATCH] arch/ia64/kernel/efi.c John Marvin
2002-07-26 13:50 ` Andreas Schwab
2002-07-26 14:13 ` Matthew Wilcox
2002-07-26 15:05 ` David Mosberger
2002-07-26 15:38 ` Grant Grundler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox