From: Magnus Damm <magnus.damm@gmail.com>
To: kexec@lists.infradead.org
Cc: horms@verge.net.au, Magnus Damm <magnus.damm@gmail.com>
Subject: [PATCH 02/06] sh: Get system memory ranges from /proc/iomem
Date: Tue, 26 Aug 2008 20:12:04 +0900 [thread overview]
Message-ID: <20080826111204.615.30390.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20080826111150.615.97501.sendpatchset@rx1.opensource.se>
From: Magnus Damm <damm@igel.co.jp>
Parse contents of /proc/iomem instead of hardcoding RAM ranges.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
kexec/arch/sh/kexec-sh.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
--- 0002/kexec/arch/sh/kexec-sh.c
+++ work/kexec/arch/sh/kexec-sh.c 2008-08-22 10:53:15.000000000 +0900
@@ -22,19 +22,31 @@
#define MAX_MEMORY_RANGES 64
static struct memory_range memory_range[MAX_MEMORY_RANGES];
+static int kexec_sh_memory_range_callback(void *data, int nr,
+ char *str,
+ unsigned long base,
+ unsigned long length)
+{
+ if (nr < MAX_MEMORY_RANGES) {
+ memory_range[nr].start = base;
+ memory_range[nr].end = base + length - 1;
+ memory_range[nr].type = RANGE_RAM;
+ return 0;
+ }
+
+ return 1;
+}
+
/* Return a sorted list of available memory ranges. */
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long kexec_flags)
{
- int memory_ranges;
+ int nr;
- memory_ranges = 0;
- memory_range[memory_ranges].start = 0x08000000;
- memory_range[memory_ranges].end = 0x10000000;
- memory_range[memory_ranges].type = RANGE_RAM;
- memory_ranges++;
+ nr = kexec_iomem_for_each_line("System RAM\n",
+ kexec_sh_memory_range_callback, NULL);
*range = memory_range;
- *ranges = memory_ranges;
+ *ranges = nr;
return 0;
}
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2008-08-26 11:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-26 11:11 [PATCH 00/06] sh: Improved kexec support for SuperH Magnus Damm
2008-08-26 11:11 ` [PATCH 01/06] sh: Add support for sh4al-dsp processors Magnus Damm
2008-08-26 11:12 ` Magnus Damm [this message]
2008-08-26 11:12 ` [PATCH 03/06] sh: Add virtual addresses support Magnus Damm
2008-08-26 11:12 ` [PATCH 04/06] sh: Autodetect zImage zero page address Magnus Damm
2008-08-26 11:12 ` [PATCH 05/06] sh: Use dynamic zImage load address Magnus Damm
2008-08-26 11:12 ` [PATCH 06/06] sh: Add vmlinux support Magnus Damm
2008-08-27 2:39 ` Simon Horman
2008-08-27 4:10 ` Magnus Damm
2008-08-27 5:40 ` Simon Horman
2008-08-27 6:55 ` Magnus Damm
2008-08-27 7:35 ` Simon Horman
2008-08-27 7:05 ` [PATCH 00/06] sh: Improved kexec support for SuperH Paul Mundt
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=20080826111204.615.30390.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.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 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.