Re: [RFC][PATCH 4/7] x86_64 code for the physmem map

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

 



Regards, Hari
---

This patch contains the x86_64 specific code to generate
the /proc/physmem view.
---

Signed-off-by: Hariprasad Nellitheertha <[email protected]>
---

 linux-2.6.12-rc1-hari/arch/x86_64/kernel/e820.c |   55 +++++++++++++++++-------
 1 files changed, 39 insertions(+), 16 deletions(-)

diff -puN arch/x86_64/kernel/e820.c~physmem-x8664 arch/x86_64/kernel/e820.c
--- linux-2.6.12-rc1/arch/x86_64/kernel/e820.c~physmem-x8664	2005-03-23 17:48:09.000000000 +0530
+++ linux-2.6.12-rc1-hari/arch/x86_64/kernel/e820.c	2005-03-23 17:48:09.000000000 +0530
@@ -178,25 +178,30 @@ unsigned long __init e820_end_of_ram(voi
 	return end_pfn;	
 }
 
-/* 
- * Mark e820 reserved areas as busy for the resource manager.
- */
-void __init e820_reserve_resources(void)
+static struct resource * __init alloc_e820_resource(struct resource *resource, int i)
+{
+	struct resource *res;
+
+	res = alloc_bootmem_low(sizeof(struct resource));
+	switch (e820.map[i].type) {
+	case E820_RAM:	res->name = "System RAM"; break;
+	case E820_ACPI:	res->name = "ACPI Tables"; break;
+	case E820_NVS:	res->name = "ACPI Non-volatile Storage"; break;
+	default:	res->name = "reserved";
+	}
+	res->start = e820.map[i].addr;
+	res->end = res->start + e820.map[i].size - 1;
+	res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+	request_resource(resource, res);
+	return res;
+}
+
+static void __init e820_reserve_iomem_resources(void)
 {
 	int i;
+	struct resource *res;
 	for (i = 0; i < e820.nr_map; i++) {
-		struct resource *res;
-		res = alloc_bootmem_low(sizeof(struct resource));
-		switch (e820.map[i].type) {
-		case E820_RAM:	res->name = "System RAM"; break;
-		case E820_ACPI:	res->name = "ACPI Tables"; break;
-		case E820_NVS:	res->name = "ACPI Non-volatile Storage"; break;
-		default:	res->name = "reserved";
-		}
-		res->start = e820.map[i].addr;
-		res->end = res->start + e820.map[i].size - 1;
-		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-		request_resource(&iomem_resource, res);
+		res = alloc_e820_resource(&iomem_resource, i);
 		if (e820.map[i].type == E820_RAM) {
 			/*
 			 *  We don't know which RAM region contains kernel data,
@@ -212,6 +217,24 @@ void __init e820_reserve_resources(void)
 	}
 }
 
+static void __init e820_reserve_physmem_resources(void)
+{
+	int i;
+	struct resource *res;
+	for (i = 0; i < e820.nr_map; i++) {
+		res = alloc_e820_resource(&physmem_resource, i);
+	}
+}
+
+/*
+ * Mark e820 reserved areas as busy for the resource manager.
+ */
+void __init e820_reserve_resources(void)
+{
+	e820_reserve_iomem_resources();
+	e820_reserve_physmem_resources();
+}
+
 /* 
  * Add a memory region to the kernel e820 map.
  */ 
_

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux