public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: John Marvin <jsm@udlkern.fc.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [PATCH] arch/ia64/kernel/efi.c
Date: Fri, 26 Jul 2002 13:35:11 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905832@msgid-missing> (raw)

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);


             reply	other threads:[~2002-07-26 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-26 13:35 John Marvin [this message]
2002-07-26 13:50 ` [Linux-ia64] [PATCH] arch/ia64/kernel/efi.c Andreas Schwab
2002-07-26 14:13 ` Matthew Wilcox
2002-07-26 15:05 ` David Mosberger
2002-07-26 15:38 ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590701905832@msgid-missing \
    --to=jsm@udlkern.fc.hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox