public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: move e820_resource_resources to e820.c
@ 2008-06-16 20:03 Yinghai Lu
  2008-06-17  2:58 ` [PATCH] x86: merge setup_memory_map with e820 Yinghai Lu
  0 siblings, 1 reply; 13+ messages in thread
From: Yinghai Lu @ 2008-06-16 20:03 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


and make 32bit resource register more like 64 bit.

also move probe_roms back to setup_32.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -965,3 +965,35 @@ void __init finish_e820_parsing(void)
 		e820_print_map("user");
 	}
 }
+
+/*
+ * Mark e820 reserved areas as busy for the resource manager.
+ */
+void __init e820_reserve_resources(void)
+{
+	int i;
+	struct resource *res;
+
+	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
+	for (i = 0; i < e820.nr_map; i++) {
+		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;
+#ifndef CONFIG_RESOURCES_64BIT
+		if (res->end > 0x100000000ULL) {
+			res++;
+			continue;
+		}
+#endif
+		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+		insert_resource(&iomem_resource, res);
+		res++;
+	}
+}
+
+
Index: linux-2.6/arch/x86/kernel/e820_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_32.c
+++ linux-2.6/arch/x86/kernel/e820_32.c
@@ -15,198 +15,6 @@
 #include <asm/e820.h>
 #include <asm/setup.h>
 
-static struct resource system_rom_resource = {
-	.name	= "System ROM",
-	.start	= 0xf0000,
-	.end	= 0xfffff,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-};
-
-static struct resource extension_rom_resource = {
-	.name	= "Extension ROM",
-	.start	= 0xe0000,
-	.end	= 0xeffff,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-};
-
-static struct resource adapter_rom_resources[] = { {
-	.name 	= "Adapter ROM",
-	.start	= 0xc8000,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-}, {
-	.name 	= "Adapter ROM",
-	.start	= 0,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-}, {
-	.name 	= "Adapter ROM",
-	.start	= 0,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-}, {
-	.name 	= "Adapter ROM",
-	.start	= 0,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-}, {
-	.name 	= "Adapter ROM",
-	.start	= 0,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-}, {
-	.name 	= "Adapter ROM",
-	.start	= 0,
-	.end	= 0,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-} };
-
-static struct resource video_rom_resource = {
-	.name 	= "Video ROM",
-	.start	= 0xc0000,
-	.end	= 0xc7fff,
-	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
-};
-
-#define ROMSIGNATURE 0xaa55
-
-static int __init romsignature(const unsigned char *rom)
-{
-	const unsigned short * const ptr = (const unsigned short *)rom;
-	unsigned short sig;
-
-	return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE;
-}
-
-static int __init romchecksum(const unsigned char *rom, unsigned long length)
-{
-	unsigned char sum, c;
-
-	for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--)
-		sum += c;
-	return !length && !sum;
-}
-
-static void __init probe_roms(void)
-{
-	const unsigned char *rom;
-	unsigned long start, length, upper;
-	unsigned char c;
-	int i;
-
-	/* video rom */
-	upper = adapter_rom_resources[0].start;
-	for (start = video_rom_resource.start; start < upper; start += 2048) {
-		rom = isa_bus_to_virt(start);
-		if (!romsignature(rom))
-			continue;
-
-		video_rom_resource.start = start;
-
-		if (probe_kernel_address(rom + 2, c) != 0)
-			continue;
-
-		/* 0 < length <= 0x7f * 512, historically */
-		length = c * 512;
-
-		/* if checksum okay, trust length byte */
-		if (length && romchecksum(rom, length))
-			video_rom_resource.end = start + length - 1;
-
-		request_resource(&iomem_resource, &video_rom_resource);
-		break;
-	}
-
-	start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
-	if (start < upper)
-		start = upper;
-
-	/* system rom */
-	request_resource(&iomem_resource, &system_rom_resource);
-	upper = system_rom_resource.start;
-
-	/* check for extension rom (ignore length byte!) */
-	rom = isa_bus_to_virt(extension_rom_resource.start);
-	if (romsignature(rom)) {
-		length = extension_rom_resource.end - extension_rom_resource.start + 1;
-		if (romchecksum(rom, length)) {
-			request_resource(&iomem_resource, &extension_rom_resource);
-			upper = extension_rom_resource.start;
-		}
-	}
-
-	/* check for adapter roms on 2k boundaries */
-	for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
-		rom = isa_bus_to_virt(start);
-		if (!romsignature(rom))
-			continue;
-
-		if (probe_kernel_address(rom + 2, c) != 0)
-			continue;
-
-		/* 0 < length <= 0x7f * 512, historically */
-		length = c * 512;
-
-		/* but accept any length that fits if checksum okay */
-		if (!length || start + length > upper || !romchecksum(rom, length))
-			continue;
-
-		adapter_rom_resources[i].start = start;
-		adapter_rom_resources[i].end = start + length - 1;
-		request_resource(&iomem_resource, &adapter_rom_resources[i]);
-
-		start = adapter_rom_resources[i++].end & ~2047UL;
-	}
-}
-
-/*
- * Request address space for all standard RAM and ROM resources
- * and also for regions reported as reserved by the e820.
- */
-void __init init_iomem_resources(struct resource *code_resource,
-		struct resource *data_resource,
-		struct resource *bss_resource)
-{
-	int i;
-
-	probe_roms();
-	for (i = 0; i < e820.nr_map; i++) {
-		struct resource *res;
-#ifndef CONFIG_RESOURCES_64BIT
-		if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
-			continue;
-#endif
-		res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
-		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;
-		if (request_resource(&iomem_resource, res)) {
-			kfree(res);
-			continue;
-		}
-		if (e820.map[i].type == E820_RAM) {
-			/*
-			 *  We don't know which RAM region contains kernel data,
-			 *  so we try it repeatedly and let the resource manager
-			 *  test it.
-			 */
-			request_resource(res, code_resource);
-			request_resource(res, data_resource);
-			request_resource(res, bss_resource);
-#ifdef CONFIG_KEXEC
-			if (crashk_res.start != crashk_res.end)
-				request_resource(res, &crashk_res);
-#endif
-		}
-	}
-}
-
 /* Overridden in paravirt.c if CONFIG_PARAVIRT */
 char * __init __attribute__((weak)) memory_setup(void)
 {
Index: linux-2.6/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_64.c
+++ linux-2.6/arch/x86/kernel/e820_64.c
@@ -41,30 +41,6 @@ unsigned long end_pfn;
  */
 unsigned long max_pfn_mapped;
 
-/*
- * Mark e820 reserved areas as busy for the resource manager.
- */
-void __init e820_reserve_resources(void)
-{
-	int i;
-	struct resource *res;
-
-	res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
-	for (i = 0; i < e820.nr_map; i++) {
-		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;
-		insert_resource(&iomem_resource, res);
-		res++;
-	}
-}
-
 static void early_panic(char *msg)
 {
 	early_printk(msg);
Index: linux-2.6/arch/x86/kernel/setup_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_32.c
+++ linux-2.6/arch/x86/kernel/setup_32.c
@@ -446,25 +446,28 @@ static void __init reserve_crashkernel(v
 	ret = parse_crashkernel(boot_command_line, total_mem,
 			&crash_size, &crash_base);
 	if (ret == 0 && crash_size > 0) {
-		if (crash_base > 0) {
-			printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
-					"for crashkernel (System RAM: %ldMB)\n",
-					(unsigned long)(crash_size >> 20),
-					(unsigned long)(crash_base >> 20),
-					(unsigned long)(total_mem >> 20));
+		if (crash_base <= 0) {
+			printk(KERN_INFO "crashkernel reservation failed - "
+					"you have to specify a base address\n");
+			return;
+		}
 
-			if (reserve_bootmem(crash_base, crash_size,
+		if (reserve_bootmem_generic(crash_base, crash_size,
 					BOOTMEM_EXCLUSIVE) < 0) {
-				printk(KERN_INFO "crashkernel reservation "
-					"failed - memory is in use\n");
-				return;
-			}
-
-			crashk_res.start = crash_base;
-			crashk_res.end   = crash_base + crash_size - 1;
-		} else
 			printk(KERN_INFO "crashkernel reservation failed - "
-					"you have to specify a base address\n");
+					"memory is in use\n");
+			return;
+		}
+
+		printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
+				"for crashkernel (System RAM: %ldMB)\n",
+				(unsigned long)(crash_size >> 20),
+				(unsigned long)(crash_base >> 20),
+				(unsigned long)(total_mem >> 20));
+
+		crashk_res.start = crash_base;
+		crashk_res.end   = crash_base + crash_size - 1;
+		insert_resource(&iomem_resource, &crashk_res);
 	}
 }
 #else
@@ -682,6 +685,8 @@ char * __init __attribute__((weak)) memo
 	return machine_specific_memory_setup();
 }
 
+static void probe_roms(void);
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -691,6 +696,7 @@ char * __init __attribute__((weak)) memo
  */
 void __init setup_arch(char **cmdline_p)
 {
+	int i;
 	unsigned long max_low_pfn;
 
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
@@ -757,6 +763,13 @@ void __init setup_arch(char **cmdline_p)
 
 	finish_e820_parsing();
 
+	probe_roms();
+
+	/* after parse_early_param, so could debug it */
+	insert_resource(&iomem_resource, &code_resource);
+	insert_resource(&iomem_resource, &data_resource);
+	insert_resource(&iomem_resource, &bss_resource);
+
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
 
@@ -861,9 +874,16 @@ void __init setup_arch(char **cmdline_p)
 			"CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
 #endif
 
-	e820_setup_gap();
+	e820_reserve_resources();
 	e820_mark_nosave_regions(max_low_pfn);
 
+	request_resource(&iomem_resource, &video_ram_resource);
+	/* request I/O space for devices used on all i[345]86 PCs */
+	for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
+		request_resource(&ioport_resource, &standard_io_resources[i]);
+
+	e820_setup_gap();
+
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
 	if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
@@ -874,25 +894,147 @@ void __init setup_arch(char **cmdline_p)
 #endif
 }
 
-/*
- * Request address space for all standard resources
- *
- * This is called just before pcibios_init(), which is also a
- * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
- */
-static int __init request_standard_resources(void)
+static struct resource system_rom_resource = {
+	.name	= "System ROM",
+	.start	= 0xf0000,
+	.end	= 0xfffff,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+};
+
+static struct resource extension_rom_resource = {
+	.name	= "Extension ROM",
+	.start	= 0xe0000,
+	.end	= 0xeffff,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+};
+
+static struct resource adapter_rom_resources[] = { {
+	.name 	= "Adapter ROM",
+	.start	= 0xc8000,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+}, {
+	.name 	= "Adapter ROM",
+	.start	= 0,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+}, {
+	.name 	= "Adapter ROM",
+	.start	= 0,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+}, {
+	.name 	= "Adapter ROM",
+	.start	= 0,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+}, {
+	.name 	= "Adapter ROM",
+	.start	= 0,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+}, {
+	.name 	= "Adapter ROM",
+	.start	= 0,
+	.end	= 0,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+} };
+
+static struct resource video_rom_resource = {
+	.name 	= "Video ROM",
+	.start	= 0xc0000,
+	.end	= 0xc7fff,
+	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
+};
+
+#define ROMSIGNATURE 0xaa55
+
+static int __init romsignature(const unsigned char *rom)
 {
+	const unsigned short * const ptr = (const unsigned short *)rom;
+	unsigned short sig;
+
+	return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE;
+}
+
+static int __init romchecksum(const unsigned char *rom, unsigned long length)
+{
+	unsigned char sum, c;
+
+	for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--)
+		sum += c;
+	return !length && !sum;
+}
+
+static void __init probe_roms(void)
+{
+	const unsigned char *rom;
+	unsigned long start, length, upper;
+	unsigned char c;
 	int i;
 
-	printk(KERN_INFO "Setting up standard PCI resources\n");
-	init_iomem_resources(&code_resource, &data_resource, &bss_resource);
+	/* video rom */
+	upper = adapter_rom_resources[0].start;
+	for (start = video_rom_resource.start; start < upper; start += 2048) {
+		rom = isa_bus_to_virt(start);
+		if (!romsignature(rom))
+			continue;
+
+		video_rom_resource.start = start;
+
+		if (probe_kernel_address(rom + 2, c) != 0)
+			continue;
+
+		/* 0 < length <= 0x7f * 512, historically */
+		length = c * 512;
+
+		/* if checksum okay, trust length byte */
+		if (length && romchecksum(rom, length))
+			video_rom_resource.end = start + length - 1;
 
-	request_resource(&iomem_resource, &video_ram_resource);
+		request_resource(&iomem_resource, &video_rom_resource);
+		break;
+	}
 
-	/* request I/O space for devices used on all i[345]86 PCs */
-	for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
-		request_resource(&ioport_resource, &standard_io_resources[i]);
-	return 0;
+	start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
+	if (start < upper)
+		start = upper;
+
+	/* system rom */
+	request_resource(&iomem_resource, &system_rom_resource);
+	upper = system_rom_resource.start;
+
+	/* check for extension rom (ignore length byte!) */
+	rom = isa_bus_to_virt(extension_rom_resource.start);
+	if (romsignature(rom)) {
+		length = extension_rom_resource.end - extension_rom_resource.start + 1;
+		if (romchecksum(rom, length)) {
+			request_resource(&iomem_resource, &extension_rom_resource);
+			upper = extension_rom_resource.start;
+		}
+	}
+
+	/* check for adapter roms on 2k boundaries */
+	for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
+		rom = isa_bus_to_virt(start);
+		if (!romsignature(rom))
+			continue;
+
+		if (probe_kernel_address(rom + 2, c) != 0)
+			continue;
+
+		/* 0 < length <= 0x7f * 512, historically */
+		length = c * 512;
+
+		/* but accept any length that fits if checksum okay */
+		if (!length || start + length > upper || !romchecksum(rom, length))
+			continue;
+
+		adapter_rom_resources[i].start = start;
+		adapter_rom_resources[i].end = start + length - 1;
+		request_resource(&iomem_resource, &adapter_rom_resources[i]);
+
+		start = adapter_rom_resources[i++].end & ~2047UL;
+	}
 }
 
-subsys_initcall(request_standard_resources);
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -98,6 +98,7 @@ extern void e820_register_active_regions
 					 unsigned long end_pfn);
 extern u64 e820_hole_size(u64 start, u64 end);
 extern void finish_e820_parsing(void);
+extern void e820_reserve_resources(void);
 
 #endif /* __ASSEMBLY__ */
 
Index: linux-2.6/include/asm-x86/e820_32.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_32.h
+++ linux-2.6/include/asm-x86/e820_32.h
@@ -20,9 +20,5 @@
 
 extern void setup_memory_map(void);
 
-extern void init_iomem_resources(struct resource *code_resource,
-				 struct resource *data_resource,
-				 struct resource *bss_resource);
-
 #endif/*!__ASSEMBLY__*/
 #endif/*__E820_HEADER*/
Index: linux-2.6/include/asm-x86/e820_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_64.h
+++ linux-2.6/include/asm-x86/e820_64.h
@@ -16,7 +16,6 @@
 #ifndef __ASSEMBLY__
 extern void setup_memory_region(void);
 extern void contig_e820_setup(void);
-extern void e820_reserve_resources(void);
 extern int e820_any_non_reserved(unsigned long start, unsigned long end);
 extern int is_memory_any_valid(unsigned long start, unsigned long end);
 extern int e820_all_non_reserved(unsigned long start, unsigned long end);

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

* [PATCH] x86: merge setup_memory_map with e820
  2008-06-16 20:03 [PATCH] x86: move e820_resource_resources to e820.c Yinghai Lu
@ 2008-06-17  2:58 ` Yinghai Lu
  2008-06-17 12:31   ` Glauber Costa
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Yinghai Lu @ 2008-06-17  2:58 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


and kill e820_32/64.c and e820_32/64.h

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -48,6 +48,18 @@
 #include <asm/numa.h>
 #include <asm/cacheflush.h>
 
+/*
+ * PFN of last memory page.
+ */
+unsigned long end_pfn;
+
+/*
+ * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
+ * The direct mapping extends to max_pfn_mapped, so that we can directly access
+ * apertures, ACPI and other tables without having to play with fixmaps.
+ */
+unsigned long max_pfn_mapped;
+
 static unsigned long dma_reserve __initdata;
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
Index: linux-2.6/arch/x86/kernel/setup_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_64.c
+++ linux-2.6/arch/x86/kernel/setup_64.c
@@ -281,12 +281,6 @@ static inline void __init reserve_crashk
 {}
 #endif
 
-/* Overridden in paravirt.c if CONFIG_PARAVIRT */
-void __attribute__((weak)) __init memory_setup(void)
-{
-       machine_specific_memory_setup();
-}
-
 /* Current gdt points %fs at the "master" per-cpu area: after this,
  * it's on the real one. */
 void switch_to_new_gdt(void)
@@ -330,7 +324,7 @@ void __init setup_arch(char **cmdline_p)
 
 	ARCH_SETUP
 
-	memory_setup();
+	setup_memory_map();
 	copy_edd();
 
 	if (!boot_params.hdr.root_flags)
Index: linux-2.6/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_64.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Handle the memory map.
- * The functions here do the job until bootmem takes over.
- *
- *  Getting sanitize_e820_map() in sync with i386 version by applying change:
- *  -  Provisions for empty E820 memory regions (reported by certain BIOSes).
- *     Alex Achenbach <xela@slit.de>, December 2002.
- *  Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
- *
- */
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/bootmem.h>
-#include <linux/ioport.h>
-#include <linux/string.h>
-#include <linux/kexec.h>
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/pfn.h>
-#include <linux/pci.h>
-
-#include <asm/pgtable.h>
-#include <asm/page.h>
-#include <asm/e820.h>
-#include <asm/proto.h>
-#include <asm/setup.h>
-#include <asm/sections.h>
-#include <asm/kdebug.h>
-#include <asm/trampoline.h>
-
-/*
- * PFN of last memory page.
- */
-unsigned long end_pfn;
-
-/*
- * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
- * The direct mapping extends to max_pfn_mapped, so that we can directly access
- * apertures, ACPI and other tables without having to play with fixmaps.
- */
-unsigned long max_pfn_mapped;
-
-static void early_panic(char *msg)
-{
-	early_printk(msg);
-	panic(msg);
-}
-
-/* We're not void only for x86 32-bit compat */
-char *__init machine_specific_memory_setup(void)
-{
-	char *who = "BIOS-e820";
-	int new_nr;
-	/*
-	 * Try to copy the BIOS-supplied E820-map.
-	 *
-	 * Otherwise fake a memory map; one section from 0k->640k,
-	 * the next section from 1mb->appropriate_mem_k
-	 */
-	new_nr = boot_params.e820_entries;
-	sanitize_e820_map(boot_params.e820_map,
-			ARRAY_SIZE(boot_params.e820_map),
-			&new_nr);
-	boot_params.e820_entries = new_nr;
-	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
-		early_panic("Cannot find a valid memory map");
-	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
-	e820_print_map(who);
-
-	/* In case someone cares... */
-	return who;
-}
-
-int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
-{
-	int i;
-
-	if (slot < 0 || slot >= e820.nr_map)
-		return -1;
-	for (i = slot; i < e820.nr_map; i++) {
-		if (e820.map[i].type != E820_RAM)
-			continue;
-		break;
-	}
-	if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
-		return -1;
-	*addr = e820.map[i].addr;
-	*size = min_t(u64, e820.map[i].size + e820.map[i].addr,
-		max_pfn << PAGE_SHIFT) - *addr;
-	return i + 1;
-}
Index: linux-2.6/arch/x86/kernel/e820_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_32.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/bootmem.h>
-#include <linux/ioport.h>
-#include <linux/string.h>
-#include <linux/kexec.h>
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/pfn.h>
-#include <linux/uaccess.h>
-
-#include <asm/pgtable.h>
-#include <asm/page.h>
-#include <asm/e820.h>
-#include <asm/setup.h>
-
-/* Overridden in paravirt.c if CONFIG_PARAVIRT */
-char * __init __attribute__((weak)) memory_setup(void)
-{
-	return machine_specific_memory_setup();
-}
-
-void __init setup_memory_map(void)
-{
-	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
-	e820_print_map(memory_setup());
-}
-
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -996,4 +996,76 @@ void __init e820_reserve_resources(void)
 	}
 }
 
+char *__init __attribute__((weak)) machine_specific_memory_setup(void)
+{
+	char *who = "BIOS-e820";
+	int new_nr;
+	/*
+	 * Try to copy the BIOS-supplied E820-map.
+	 *
+	 * Otherwise fake a memory map; one section from 0k->640k,
+	 * the next section from 1mb->appropriate_mem_k
+	 */
+	new_nr = boot_params.e820_entries;
+	sanitize_e820_map(boot_params.e820_map,
+			ARRAY_SIZE(boot_params.e820_map),
+			&new_nr);
+	boot_params.e820_entries = new_nr;
+	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
+#ifdef CONFIG_X86_64
+		early_panic("Cannot find a valid memory map");
+#else
+		unsigned long mem_size;
 
+		/* compare results from other methods and take the greater */
+		if (boot_params.alt_mem_k
+		    < boot_params.screen_info.ext_mem_k) {
+			mem_size = boot_params.screen_info.ext_mem_k;
+			who = "BIOS-88";
+		} else {
+			mem_size = boot_params.alt_mem_k;
+			who = "BIOS-e801";
+		}
+
+		e820.nr_map = 0;
+		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
+		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
+#endif
+	}
+
+	/* In case someone cares... */
+	return who;
+}
+
+/* Overridden in paravirt.c if CONFIG_PARAVIRT */
+char * __init __attribute__((weak)) memory_setup(void)
+{
+	return machine_specific_memory_setup();
+}
+
+void __init setup_memory_map(void)
+{
+	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
+	e820_print_map(memory_setup());
+}
+
+#ifdef CONFIG_X86_64
+int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
+{
+	int i;
+
+	if (slot < 0 || slot >= e820.nr_map)
+		return -1;
+	for (i = slot; i < e820.nr_map; i++) {
+		if (e820.map[i].type != E820_RAM)
+			continue;
+		break;
+	}
+	if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
+		return -1;
+	*addr = e820.map[i].addr;
+	*size = min_t(u64, e820.map[i].size + e820.map[i].addr,
+		max_pfn << PAGE_SHIFT) - *addr;
+	return i + 1;
+}
+#endif
Index: linux-2.6/include/asm-x86/e820_32.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_32.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * structures and definitions for the int 15, ax=e820 memory map
- * scheme.
- *
- * In a nutshell, arch/i386/boot/setup.S populates a scratch table
- * in the empty_zero_block that contains a list of usable address/size
- * duples.   In arch/i386/kernel/setup.c, this information is
- * transferred into the e820map, and in arch/i386/mm/init.c, that
- * new information is used to mark pages reserved or not.
- *
- */
-#ifndef __E820_HEADER
-#define __E820_HEADER
-
-#include <linux/ioport.h>
-
-#define HIGH_MEMORY	(1024*1024)
-
-#ifndef __ASSEMBLY__
-
-extern void setup_memory_map(void);
-
-#endif/*!__ASSEMBLY__*/
-#endif/*__E820_HEADER*/
Index: linux-2.6/include/asm-x86/e820_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820_64.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * structures and definitions for the int 15, ax=e820 memory map
- * scheme.
- *
- * In a nutshell, setup.S populates a scratch table in the
- * empty_zero_block that contains a list of usable address/size
- * duples.  setup.c, this information is transferred into the e820map,
- * and in init.c/numa.c, that new information is used to mark pages
- * reserved or not.
- */
-#ifndef __E820_HEADER
-#define __E820_HEADER
-
-#include <linux/ioport.h>
-
-#ifndef __ASSEMBLY__
-extern void setup_memory_region(void);
-extern void contig_e820_setup(void);
-extern int e820_any_non_reserved(unsigned long start, unsigned long end);
-extern int is_memory_any_valid(unsigned long start, unsigned long end);
-extern int e820_all_non_reserved(unsigned long start, unsigned long end);
-extern int is_memory_all_valid(unsigned long start, unsigned long end);
-
-#endif/*!__ASSEMBLY__*/
-
-#endif/*__E820_HEADER*/
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -99,6 +99,9 @@ extern void e820_register_active_regions
 extern u64 e820_hole_size(u64 start, u64 end);
 extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
+extern void setup_memory_map(void);
+extern char *machine_specific_memory_setup(void);
+extern char *memory_setup(void);
 
 #endif /* __ASSEMBLY__ */
 
@@ -109,10 +112,10 @@ extern void e820_reserve_resources(void)
 #define BIOS_END		0x00100000
 
 #ifdef __KERNEL__
+#include <linux/ioport.h>
+
 #ifdef CONFIG_X86_32
-# include "e820_32.h"
-#else
-# include "e820_64.h"
+#define HIGH_MEMORY	(1024*1024)
 #endif
 #endif /* __KERNEL__ */
 
Index: linux-2.6/arch/x86/mach-default/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/mach-default/setup.c
+++ linux-2.6/arch/x86/mach-default/setup.c
@@ -142,50 +142,3 @@ static int __init print_ipi_mode(void)
 
 late_initcall(print_ipi_mode);
 
-/**
- * machine_specific_memory_setup - Hook for machine specific memory setup.
- *
- * Description:
- *	This is included late in kernel/setup.c so that it can make
- *	use of all of the static functions.
- **/
-
-char * __init machine_specific_memory_setup(void)
-{
-	char *who;
-	int new_nr;
-
-
-	who = "BIOS-e820";
-
-	/*
-	 * Try to copy the BIOS-supplied E820-map.
-	 *
-	 * Otherwise fake a memory map; one section from 0k->640k,
-	 * the next section from 1mb->appropriate_mem_k
-	 */
-	new_nr = boot_params.e820_entries;
-	sanitize_e820_map(boot_params.e820_map,
-			ARRAY_SIZE(boot_params.e820_map),
-			&new_nr);
-	boot_params.e820_entries = new_nr;
-	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
-	    < 0) {
-		unsigned long mem_size;
-
-		/* compare results from other methods and take the greater */
-		if (boot_params.alt_mem_k
-		    < boot_params.screen_info.ext_mem_k) {
-			mem_size = boot_params.screen_info.ext_mem_k;
-			who = "BIOS-88";
-		} else {
-			mem_size = boot_params.alt_mem_k;
-			who = "BIOS-e801";
-		}
-
-		e820.nr_map = 0;
-		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
-		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-  	}
-	return who;
-}
Index: linux-2.6/include/asm-x86/setup.h
===================================================================
--- linux-2.6.orig/include/asm-x86/setup.h
+++ linux-2.6/include/asm-x86/setup.h
@@ -8,7 +8,6 @@
 /* Interrupt control for vSMPowered x86_64 systems */
 void vsmp_init(void);
 
-char *machine_specific_memory_setup(void);
 #ifndef CONFIG_PARAVIRT
 #define paravirt_post_allocator_init()	do {} while (0)
 #endif
@@ -50,10 +49,6 @@ extern struct boot_params boot_params;
  */
 #define LOWMEMSIZE()	(0x9f000)
 
-char * __init machine_specific_memory_setup(void);
-char *memory_setup(void);
-
-
 void __init i386_start_kernel(void);
 
 extern unsigned long init_pg_tables_start;
Index: linux-2.6/arch/x86/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/x86/kernel/Makefile
+++ linux-2.6/arch/x86/kernel/Makefile
@@ -30,7 +30,7 @@ obj-y			+= setup_$(BITS).o i8259.o irqin
 obj-$(CONFIG_X86_32)	+= sys_i386_32.o i386_ksyms_32.o
 obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o setup64.o
-obj-y			+= bootflag.o e820_$(BITS).o e820.o
+obj-y			+= bootflag.o e820.o
 obj-y			+= pci-dma.o quirks.o i8237.o topology.o kdebugfs.o
 obj-y			+= alternative.o i8253.o pci-nommu.o
 obj-y			+= tsc_$(BITS).o io_delay.o rtc.o

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17  2:58 ` [PATCH] x86: merge setup_memory_map with e820 Yinghai Lu
@ 2008-06-17 12:31   ` Glauber Costa
  2008-06-17 16:04     ` H. Peter Anvin
  2008-06-18 14:30   ` Ingo Molnar
  2008-06-18 18:06   ` [PATCH] x86: cleanup machine_specific_memory_setup Yinghai Lu
  2 siblings, 1 reply; 13+ messages in thread
From: Glauber Costa @ 2008-06-17 12:31 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-kernel@vger.kernel.org

On Mon, Jun 16, 2008 at 11:58 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
> and kill e820_32/64.c and e820_32/64.h
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
> Index: linux-2.6/arch/x86/mm/init_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/mm/init_64.c
> +++ linux-2.6/arch/x86/mm/init_64.c
> @@ -48,6 +48,18 @@
>  #include <asm/numa.h>
>  #include <asm/cacheflush.h>
>
> +/*
> + * PFN of last memory page.
> + */
> +unsigned long end_pfn;
> +
> +/*
> + * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
> + * The direct mapping extends to max_pfn_mapped, so that we can directly access
> + * apertures, ACPI and other tables without having to play with fixmaps.
> + */
> +unsigned long max_pfn_mapped;
> +
>  static unsigned long dma_reserve __initdata;
>
>  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
> Index: linux-2.6/arch/x86/kernel/setup_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/setup_64.c
> +++ linux-2.6/arch/x86/kernel/setup_64.c
> @@ -281,12 +281,6 @@ static inline void __init reserve_crashk
>  {}
>  #endif
>
> -/* Overridden in paravirt.c if CONFIG_PARAVIRT */
> -void __attribute__((weak)) __init memory_setup(void)
> -{
> -       machine_specific_memory_setup();
> -}
> -
>  /* Current gdt points %fs at the "master" per-cpu area: after this,
>  * it's on the real one. */
>  void switch_to_new_gdt(void)
> @@ -330,7 +324,7 @@ void __init setup_arch(char **cmdline_p)
>
>        ARCH_SETUP
>
> -       memory_setup();
> +       setup_memory_map();
>        copy_edd();
>
>        if (!boot_params.hdr.root_flags)
> Index: linux-2.6/arch/x86/kernel/e820_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/e820_64.c
> +++ /dev/null
> @@ -1,92 +0,0 @@
> -/*
> - * Handle the memory map.
> - * The functions here do the job until bootmem takes over.
> - *
> - *  Getting sanitize_e820_map() in sync with i386 version by applying change:
> - *  -  Provisions for empty E820 memory regions (reported by certain BIOSes).
> - *     Alex Achenbach <xela@slit.de>, December 2002.
> - *  Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> - *
> - */
> -#include <linux/kernel.h>
> -#include <linux/types.h>
> -#include <linux/init.h>
> -#include <linux/bootmem.h>
> -#include <linux/ioport.h>
> -#include <linux/string.h>
> -#include <linux/kexec.h>
> -#include <linux/module.h>
> -#include <linux/mm.h>
> -#include <linux/pfn.h>
> -#include <linux/pci.h>
> -
> -#include <asm/pgtable.h>
> -#include <asm/page.h>
> -#include <asm/e820.h>
> -#include <asm/proto.h>
> -#include <asm/setup.h>
> -#include <asm/sections.h>
> -#include <asm/kdebug.h>
> -#include <asm/trampoline.h>
> -
> -/*
> - * PFN of last memory page.
> - */
> -unsigned long end_pfn;
> -
> -/*
> - * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
> - * The direct mapping extends to max_pfn_mapped, so that we can directly access
> - * apertures, ACPI and other tables without having to play with fixmaps.
> - */
> -unsigned long max_pfn_mapped;
> -
> -static void early_panic(char *msg)
> -{
> -       early_printk(msg);
> -       panic(msg);
> -}
> -
> -/* We're not void only for x86 32-bit compat */
> -char *__init machine_specific_memory_setup(void)
> -{
> -       char *who = "BIOS-e820";
> -       int new_nr;
> -       /*
> -        * Try to copy the BIOS-supplied E820-map.
> -        *
> -        * Otherwise fake a memory map; one section from 0k->640k,
> -        * the next section from 1mb->appropriate_mem_k
> -        */
> -       new_nr = boot_params.e820_entries;
> -       sanitize_e820_map(boot_params.e820_map,
> -                       ARRAY_SIZE(boot_params.e820_map),
> -                       &new_nr);
> -       boot_params.e820_entries = new_nr;
> -       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
> -               early_panic("Cannot find a valid memory map");
> -       printk(KERN_INFO "BIOS-provided physical RAM map:\n");
> -       e820_print_map(who);
> -
> -       /* In case someone cares... */
> -       return who;
> -}
> -
> -int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
> -{
> -       int i;
> -
> -       if (slot < 0 || slot >= e820.nr_map)
> -               return -1;
> -       for (i = slot; i < e820.nr_map; i++) {
> -               if (e820.map[i].type != E820_RAM)
> -                       continue;
> -               break;
> -       }
> -       if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
> -               return -1;
> -       *addr = e820.map[i].addr;
> -       *size = min_t(u64, e820.map[i].size + e820.map[i].addr,
> -               max_pfn << PAGE_SHIFT) - *addr;
> -       return i + 1;
> -}
> Index: linux-2.6/arch/x86/kernel/e820_32.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/e820_32.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -#include <linux/kernel.h>
> -#include <linux/types.h>
> -#include <linux/init.h>
> -#include <linux/bootmem.h>
> -#include <linux/ioport.h>
> -#include <linux/string.h>
> -#include <linux/kexec.h>
> -#include <linux/module.h>
> -#include <linux/mm.h>
> -#include <linux/pfn.h>
> -#include <linux/uaccess.h>
> -
> -#include <asm/pgtable.h>
> -#include <asm/page.h>
> -#include <asm/e820.h>
> -#include <asm/setup.h>
> -
> -/* Overridden in paravirt.c if CONFIG_PARAVIRT */
> -char * __init __attribute__((weak)) memory_setup(void)
> -{
> -       return machine_specific_memory_setup();
> -}
> -
> -void __init setup_memory_map(void)
> -{
> -       printk(KERN_INFO "BIOS-provided physical RAM map:\n");
> -       e820_print_map(memory_setup());
> -}
> -
> Index: linux-2.6/arch/x86/kernel/e820.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/e820.c
> +++ linux-2.6/arch/x86/kernel/e820.c
> @@ -996,4 +996,76 @@ void __init e820_reserve_resources(void)
>        }
>  }
>
> +char *__init __attribute__((weak)) machine_specific_memory_setup(void)
> +{
> +       char *who = "BIOS-e820";
> +       int new_nr;
> +       /*
> +        * Try to copy the BIOS-supplied E820-map.
> +        *
> +        * Otherwise fake a memory map; one section from 0k->640k,
> +        * the next section from 1mb->appropriate_mem_k
> +        */
> +       new_nr = boot_params.e820_entries;
> +       sanitize_e820_map(boot_params.e820_map,
> +                       ARRAY_SIZE(boot_params.e820_map),
> +                       &new_nr);
> +       boot_params.e820_entries = new_nr;
> +       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
> +#ifdef CONFIG_X86_64
> +               early_panic("Cannot find a valid memory map");
> +#else

Can't this be made dependant on HIGHMEM instead of X86_64? It seems
high-memory dependant anyway. Also, are you sure
this code that maps into himem would work with HIGHMEM disabled anyway?

> +               unsigned long mem_size;
>
> +               /* compare results from other methods and take the greater */
> +               if (boot_params.alt_mem_k
> +                   < boot_params.screen_info.ext_mem_k) {
> +                       mem_size = boot_params.screen_info.ext_mem_k;
> +                       who = "BIOS-88";
> +               } else {
> +                       mem_size = boot_params.alt_mem_k;
> +                       who = "BIOS-e801";
> +               }
> +
> +               e820.nr_map = 0;
> +               e820_add_region(0, LOWMEMSIZE(), E820_RAM);
> +               e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
> +#endif
> +       }
> +
> +       /* In case someone cares... */
> +       return who;
> +}
> +
> +/* Overridden in paravirt.c if CONFIG_PARAVIRT */
> +char * __init __attribute__((weak)) memory_setup(void)
> +{
> +       return machine_specific_memory_setup();
> +}
> +
> +void __init setup_memory_map(void)
> +{
> +       printk(KERN_INFO "BIOS-provided physical RAM map:\n");
> +       e820_print_map(memory_setup());
> +}
> +
> +#ifdef CONFIG_X86_64
> +int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
> +{
> +       int i;
> +
> +       if (slot < 0 || slot >= e820.nr_map)
> +               return -1;
> +       for (i = slot; i < e820.nr_map; i++) {
> +               if (e820.map[i].type != E820_RAM)
> +                       continue;
> +               break;
> +       }
> +       if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
> +               return -1;
> +       *addr = e820.map[i].addr;
> +       *size = min_t(u64, e820.map[i].size + e820.map[i].addr,
> +               max_pfn << PAGE_SHIFT) - *addr;
> +       return i + 1;
> +}
> +#endif
> Index: linux-2.6/include/asm-x86/e820_32.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/e820_32.h
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -/*
> - * structures and definitions for the int 15, ax=e820 memory map
> - * scheme.
> - *
> - * In a nutshell, arch/i386/boot/setup.S populates a scratch table
> - * in the empty_zero_block that contains a list of usable address/size
> - * duples.   In arch/i386/kernel/setup.c, this information is
> - * transferred into the e820map, and in arch/i386/mm/init.c, that
> - * new information is used to mark pages reserved or not.
> - *
> - */
> -#ifndef __E820_HEADER
> -#define __E820_HEADER
> -
> -#include <linux/ioport.h>
> -
> -#define HIGH_MEMORY    (1024*1024)
> -
> -#ifndef __ASSEMBLY__
> -
> -extern void setup_memory_map(void);
> -
> -#endif/*!__ASSEMBLY__*/
> -#endif/*__E820_HEADER*/
> Index: linux-2.6/include/asm-x86/e820_64.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/e820_64.h
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -/*
> - * structures and definitions for the int 15, ax=e820 memory map
> - * scheme.
> - *
> - * In a nutshell, setup.S populates a scratch table in the
> - * empty_zero_block that contains a list of usable address/size
> - * duples.  setup.c, this information is transferred into the e820map,
> - * and in init.c/numa.c, that new information is used to mark pages
> - * reserved or not.
> - */
> -#ifndef __E820_HEADER
> -#define __E820_HEADER
> -
> -#include <linux/ioport.h>
> -
> -#ifndef __ASSEMBLY__
> -extern void setup_memory_region(void);
> -extern void contig_e820_setup(void);
> -extern int e820_any_non_reserved(unsigned long start, unsigned long end);
> -extern int is_memory_any_valid(unsigned long start, unsigned long end);
> -extern int e820_all_non_reserved(unsigned long start, unsigned long end);
> -extern int is_memory_all_valid(unsigned long start, unsigned long end);
> -
> -#endif/*!__ASSEMBLY__*/
> -
> -#endif/*__E820_HEADER*/
> Index: linux-2.6/include/asm-x86/e820.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/e820.h
> +++ linux-2.6/include/asm-x86/e820.h
> @@ -99,6 +99,9 @@ extern void e820_register_active_regions
>  extern u64 e820_hole_size(u64 start, u64 end);
>  extern void finish_e820_parsing(void);
>  extern void e820_reserve_resources(void);
> +extern void setup_memory_map(void);
> +extern char *machine_specific_memory_setup(void);
> +extern char *memory_setup(void);
>
>  #endif /* __ASSEMBLY__ */
>
> @@ -109,10 +112,10 @@ extern void e820_reserve_resources(void)
>  #define BIOS_END               0x00100000
>
>  #ifdef __KERNEL__
> +#include <linux/ioport.h>
> +
>  #ifdef CONFIG_X86_32
> -# include "e820_32.h"
> -#else
> -# include "e820_64.h"
> +#define HIGH_MEMORY    (1024*1024)
>  #endif
>  #endif /* __KERNEL__ */
>
> Index: linux-2.6/arch/x86/mach-default/setup.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/mach-default/setup.c
> +++ linux-2.6/arch/x86/mach-default/setup.c
> @@ -142,50 +142,3 @@ static int __init print_ipi_mode(void)
>
>  late_initcall(print_ipi_mode);
>
> -/**
> - * machine_specific_memory_setup - Hook for machine specific memory setup.
> - *
> - * Description:
> - *     This is included late in kernel/setup.c so that it can make
> - *     use of all of the static functions.
> - **/
> -
> -char * __init machine_specific_memory_setup(void)
> -{
> -       char *who;
> -       int new_nr;
> -
> -
> -       who = "BIOS-e820";
> -
> -       /*
> -        * Try to copy the BIOS-supplied E820-map.
> -        *
> -        * Otherwise fake a memory map; one section from 0k->640k,
> -        * the next section from 1mb->appropriate_mem_k
> -        */
> -       new_nr = boot_params.e820_entries;
> -       sanitize_e820_map(boot_params.e820_map,
> -                       ARRAY_SIZE(boot_params.e820_map),
> -                       &new_nr);
> -       boot_params.e820_entries = new_nr;
> -       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
> -           < 0) {
> -               unsigned long mem_size;
> -
> -               /* compare results from other methods and take the greater */
> -               if (boot_params.alt_mem_k
> -                   < boot_params.screen_info.ext_mem_k) {
> -                       mem_size = boot_params.screen_info.ext_mem_k;
> -                       who = "BIOS-88";
> -               } else {
> -                       mem_size = boot_params.alt_mem_k;
> -                       who = "BIOS-e801";
> -               }
> -
> -               e820.nr_map = 0;
> -               e820_add_region(0, LOWMEMSIZE(), E820_RAM);
> -               e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
> -       }
> -       return who;
> -}
> Index: linux-2.6/include/asm-x86/setup.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/setup.h
> +++ linux-2.6/include/asm-x86/setup.h
> @@ -8,7 +8,6 @@
>  /* Interrupt control for vSMPowered x86_64 systems */
>  void vsmp_init(void);
>
> -char *machine_specific_memory_setup(void);
>  #ifndef CONFIG_PARAVIRT
>  #define paravirt_post_allocator_init() do {} while (0)
>  #endif
> @@ -50,10 +49,6 @@ extern struct boot_params boot_params;
>  */
>  #define LOWMEMSIZE()   (0x9f000)
>
> -char * __init machine_specific_memory_setup(void);
> -char *memory_setup(void);
> -
> -
>  void __init i386_start_kernel(void);
>
>  extern unsigned long init_pg_tables_start;
> Index: linux-2.6/arch/x86/kernel/Makefile
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/Makefile
> +++ linux-2.6/arch/x86/kernel/Makefile
> @@ -30,7 +30,7 @@ obj-y                 += setup_$(BITS).o i8259.o irqin
>  obj-$(CONFIG_X86_32)   += sys_i386_32.o i386_ksyms_32.o
>  obj-$(CONFIG_X86_64)   += sys_x86_64.o x8664_ksyms_64.o
>  obj-$(CONFIG_X86_64)   += syscall_64.o vsyscall_64.o setup64.o
> -obj-y                  += bootflag.o e820_$(BITS).o e820.o
> +obj-y                  += bootflag.o e820.o
>  obj-y                  += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o
>  obj-y                  += alternative.o i8253.o pci-nommu.o
>  obj-y                  += tsc_$(BITS).o io_delay.o rtc.o
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



-- 
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 12:31   ` Glauber Costa
@ 2008-06-17 16:04     ` H. Peter Anvin
  2008-06-17 16:18       ` Yinghai Lu
  0 siblings, 1 reply; 13+ messages in thread
From: H. Peter Anvin @ 2008-06-17 16:04 UTC (permalink / raw)
  To: Glauber Costa
  Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

Glauber Costa wrote:
>> +       boot_params.e820_entries = new_nr;
>> +       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
>> +#ifdef CONFIG_X86_64
>> +               early_panic("Cannot find a valid memory map");
>> +#else
> 
> Can't this be made dependant on HIGHMEM instead of X86_64? It seems
> high-memory dependant anyway. Also, are you sure
> this code that maps into himem would work with HIGHMEM disabled anyway?
> 

Uhm... x86-64 and HIGHMEM are mutually exclusive.

Either way, it shouldn't be dependent on anything; there is no reason 
why the #else clause can't be applied to both.

	-hpa



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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 16:04     ` H. Peter Anvin
@ 2008-06-17 16:18       ` Yinghai Lu
  2008-06-17 16:25         ` Glauber Costa
  2008-06-17 17:39         ` H. Peter Anvin
  0 siblings, 2 replies; 13+ messages in thread
From: Yinghai Lu @ 2008-06-17 16:18 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Glauber Costa, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

On Tue, Jun 17, 2008 at 9:04 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> Glauber Costa wrote:
>>>
>>> +       boot_params.e820_entries = new_nr;
>>> +       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
>>> < 0) {
>>> +#ifdef CONFIG_X86_64
>>> +               early_panic("Cannot find a valid memory map");
>>> +#else
>>
>> Can't this be made dependant on HIGHMEM instead of X86_64? It seems
>> high-memory dependant anyway. Also, are you sure
>> this code that maps into himem would work with HIGHMEM disabled anyway?

that is behavoir before merge.

>>
>
> Uhm... x86-64 and HIGHMEM are mutually exclusive.
>
> Either way, it shouldn't be dependent on anything; there is no reason why
> the #else clause can't be applied to both.

remove the early_panic?

YH

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 16:18       ` Yinghai Lu
@ 2008-06-17 16:25         ` Glauber Costa
  2008-06-17 17:39         ` H. Peter Anvin
  1 sibling, 0 replies; 13+ messages in thread
From: Glauber Costa @ 2008-06-17 16:25 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

On Tue, Jun 17, 2008 at 1:18 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> On Tue, Jun 17, 2008 at 9:04 AM, H. Peter Anvin <hpa@zytor.com> wrote:
>> Glauber Costa wrote:
>>>>
>>>> +       boot_params.e820_entries = new_nr;
>>>> +       if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
>>>> < 0) {
>>>> +#ifdef CONFIG_X86_64
>>>> +               early_panic("Cannot find a valid memory map");
>>>> +#else
>>>
>>> Can't this be made dependant on HIGHMEM instead of X86_64? It seems
>>> high-memory dependant anyway. Also, are you sure
>>> this code that maps into himem would work with HIGHMEM disabled anyway?
>
> that is behavoir before merge.
>
>>>
>>
>> Uhm... x86-64 and HIGHMEM are mutually exclusive.
>>
>> Either way, it shouldn't be dependent on anything; there is no reason why
>> the #else clause can't be applied to both.
>
> remove the early_panic?

If this can be done, I'm for it.
However, it would be better to leave this patch as is, and throw in
another one that just address that, for bisectability purposes.
> YH
>



-- 
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 16:18       ` Yinghai Lu
  2008-06-17 16:25         ` Glauber Costa
@ 2008-06-17 17:39         ` H. Peter Anvin
  2008-06-17 17:52           ` Yinghai Lu
  1 sibling, 1 reply; 13+ messages in thread
From: H. Peter Anvin @ 2008-06-17 17:39 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Glauber Costa, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

Yinghai Lu wrote:
> 
> that is behavoir before merge.
> 
>> Uhm... x86-64 and HIGHMEM are mutually exclusive.
>>
>> Either way, it shouldn't be dependent on anything; there is no reason why
>> the #else clause can't be applied to both.
> 
> remove the early_panic?
> 

Yes, remove the early_panic().  Andi didn't want to support the non-e820 
modes in x86-64, but if the code is unified there is no reason not to.

	-hpa

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 17:39         ` H. Peter Anvin
@ 2008-06-17 17:52           ` Yinghai Lu
  2008-06-17 18:23             ` H. Peter Anvin
  0 siblings, 1 reply; 13+ messages in thread
From: Yinghai Lu @ 2008-06-17 17:52 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Glauber Costa, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

On Tue, Jun 17, 2008 at 10:39 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>
>> that is behavoir before merge.
>>
>>> Uhm... x86-64 and HIGHMEM are mutually exclusive.
>>>
>>> Either way, it shouldn't be dependent on anything; there is no reason why
>>> the #else clause can't be applied to both.
>>
>> remove the early_panic?
>>
>
> Yes, remove the early_panic().  Andi didn't want to support the non-e820
> modes in x86-64, but if the code is unified there is no reason not to.


OK, after Ingo put three patch in the tip, I will submit one to remove
early_panic.

YH

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17 17:52           ` Yinghai Lu
@ 2008-06-17 18:23             ` H. Peter Anvin
  0 siblings, 0 replies; 13+ messages in thread
From: H. Peter Anvin @ 2008-06-17 18:23 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Glauber Costa, Ingo Molnar, Thomas Gleixner,
	linux-kernel@vger.kernel.org

Yinghai Lu wrote:
> 
> OK, after Ingo put three patch in the tip, I will submit one to remove
> early_panic.
> 

I'll do it after lunch if Ingo or Thomas don't beat me to it.

	-hpa

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

* Re: [PATCH] x86: merge setup_memory_map with e820
  2008-06-17  2:58 ` [PATCH] x86: merge setup_memory_map with e820 Yinghai Lu
  2008-06-17 12:31   ` Glauber Costa
@ 2008-06-18 14:30   ` Ingo Molnar
  2008-06-18 18:06   ` [PATCH] x86: cleanup machine_specific_memory_setup Yinghai Lu
  2 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-06-18 14:30 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> and kill e820_32/64.c and e820_32/64.h

whee - applied :-)

	Ingo

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

* [PATCH] x86: cleanup machine_specific_memory_setup
  2008-06-17  2:58 ` [PATCH] x86: merge setup_memory_map with e820 Yinghai Lu
  2008-06-17 12:31   ` Glauber Costa
  2008-06-18 14:30   ` Ingo Molnar
@ 2008-06-18 18:06   ` Yinghai Lu
  2008-06-19  0:27     ` [PATCH] x86: cleanup machine_specific_memory_setup v2 Yinghai Lu
  2 siblings, 1 reply; 13+ messages in thread
From: Yinghai Lu @ 2008-06-18 18:06 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


1. let 64bit support 88 and e801 too
2. introduce default_machine_specific_memory_setup, and reuse it
   for voyager

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/e820.c        |   13 +++++++------
 arch/x86/mach-voyager/setup.c |   32 +-------------------------------
 include/asm-x86/e820.h        |    1 +
 3 files changed, 9 insertions(+), 37 deletions(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -1029,7 +1029,7 @@ void __init e820_reserve_resources(void)
 	}
 }
 
-char *__init __attribute__((weak)) machine_specific_memory_setup(void)
+char *__init default_machine_specific_memory_setup(void)
 {
 	char *who = "BIOS-e820";
 	int new_nr;
@@ -1045,10 +1045,7 @@ char *__init __attribute__((weak)) machi
 			&new_nr);
 	boot_params.e820_entries = new_nr;
 	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
-#ifdef CONFIG_X86_64
-		early_panic("Cannot find a valid memory map");
-#else
-		unsigned long mem_size;
+		u64 mem_size;
 
 		/* compare results from other methods and take the greater */
 		if (boot_params.alt_mem_k
@@ -1063,13 +1060,17 @@ char *__init __attribute__((weak)) machi
 		e820.nr_map = 0;
 		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
 		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-#endif
 	}
 
 	/* In case someone cares... */
 	return who;
 }
 
+char *__init __attribute__((weak)) machine_specific_memory_setup(void)
+{
+	return default_machine_specific_memory_setup();
+}
+
 /* Overridden in paravirt.c if CONFIG_PARAVIRT */
 char * __init __attribute__((weak)) memory_setup(void)
 {
Index: linux-2.6/arch/x86/mach-voyager/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/mach-voyager/setup.c
+++ linux-2.6/arch/x86/mach-voyager/setup.c
@@ -104,35 +104,5 @@ char *__init machine_specific_memory_set
 		return who;
 	}
 
-	who = "BIOS-e820";
-
-	/*
-	 * Try to copy the BIOS-supplied E820-map.
-	 *
-	 * Otherwise fake a memory map; one section from 0k->640k,
-	 * the next section from 1mb->appropriate_mem_k
-	 */
-	new_nr = boot_params.e820_entries;
-	sanitize_e820_map(boot_params.e820_map,
-			ARRAY_SIZE(boot_params.e820_map),
-			&new_nr);
-	boot_params.e820_entries = new_nr;
-	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
-	    < 0) {
-		unsigned long mem_size;
-
-		/* compare results from other methods and take the greater */
-		if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
-			mem_size = boot_params.screen_info.ext_mem_k;
-			who = "BIOS-88";
-		} else {
-			mem_size = boot_params.alt_mem_k;
-			who = "BIOS-e801";
-		}
-
-		e820.nr_map = 0;
-		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
-		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-	}
-	return who;
+	return default_machine_specific_memory_setup();
 }
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -102,6 +102,7 @@ extern u64 e820_hole_size(u64 start, u64
 extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
 extern void setup_memory_map(void);
+extern char *default_machine_specific_memory_setup(void);
 extern char *machine_specific_memory_setup(void);
 extern char *memory_setup(void);

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

* [PATCH] x86: cleanup machine_specific_memory_setup v2
  2008-06-18 18:06   ` [PATCH] x86: cleanup machine_specific_memory_setup Yinghai Lu
@ 2008-06-19  0:27     ` Yinghai Lu
  2008-06-19 12:11       ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Yinghai Lu @ 2008-06-19  0:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


1. let 64bit support 88 and e801 too
2. introduce default_machine_specific_memory_setup, and reuse it
   for voyager

v2: fix 64 bit compiling

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/e820.c        |   13 +++++++------
 arch/x86/mach-voyager/setup.c |   32 +-------------------------------
 include/asm-x86/e820.h        |    3 +--
 include/asm-x86/setup.h       |    3 ++-
 4 files changed, 11 insertions(+), 40 deletions(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -1029,7 +1029,7 @@ void __init e820_reserve_resources(void)
 	}
 }
 
-char *__init __attribute__((weak)) machine_specific_memory_setup(void)
+char *__init default_machine_specific_memory_setup(void)
 {
 	char *who = "BIOS-e820";
 	int new_nr;
@@ -1045,10 +1045,7 @@ char *__init __attribute__((weak)) machi
 			&new_nr);
 	boot_params.e820_entries = new_nr;
 	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
-#ifdef CONFIG_X86_64
-		early_panic("Cannot find a valid memory map");
-#else
-		unsigned long mem_size;
+		u64 mem_size;
 
 		/* compare results from other methods and take the greater */
 		if (boot_params.alt_mem_k
@@ -1063,13 +1060,17 @@ char *__init __attribute__((weak)) machi
 		e820.nr_map = 0;
 		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
 		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-#endif
 	}
 
 	/* In case someone cares... */
 	return who;
 }
 
+char *__init __attribute__((weak)) machine_specific_memory_setup(void)
+{
+	return default_machine_specific_memory_setup();
+}
+
 /* Overridden in paravirt.c if CONFIG_PARAVIRT */
 char * __init __attribute__((weak)) memory_setup(void)
 {
Index: linux-2.6/arch/x86/mach-voyager/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/mach-voyager/setup.c
+++ linux-2.6/arch/x86/mach-voyager/setup.c
@@ -104,35 +104,5 @@ char *__init machine_specific_memory_set
 		return who;
 	}
 
-	who = "BIOS-e820";
-
-	/*
-	 * Try to copy the BIOS-supplied E820-map.
-	 *
-	 * Otherwise fake a memory map; one section from 0k->640k,
-	 * the next section from 1mb->appropriate_mem_k
-	 */
-	new_nr = boot_params.e820_entries;
-	sanitize_e820_map(boot_params.e820_map,
-			ARRAY_SIZE(boot_params.e820_map),
-			&new_nr);
-	boot_params.e820_entries = new_nr;
-	if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
-	    < 0) {
-		unsigned long mem_size;
-
-		/* compare results from other methods and take the greater */
-		if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
-			mem_size = boot_params.screen_info.ext_mem_k;
-			who = "BIOS-88";
-		} else {
-			mem_size = boot_params.alt_mem_k;
-			who = "BIOS-e801";
-		}
-
-		e820.nr_map = 0;
-		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
-		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-	}
-	return who;
+	return default_machine_specific_memory_setup();
 }
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -102,6 +102,7 @@ extern u64 e820_hole_size(u64 start, u64
 extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
 extern void setup_memory_map(void);
+extern char *default_machine_specific_memory_setup(void);
 extern char *machine_specific_memory_setup(void);
 extern char *memory_setup(void);
 
@@ -116,9 +117,7 @@ extern char *memory_setup(void);
 #ifdef __KERNEL__
 #include <linux/ioport.h>
 
-#ifdef CONFIG_X86_32
 #define HIGH_MEMORY	(1024*1024)
-#endif
 #endif /* __KERNEL__ */
 
 #endif  /* __ASM_E820_H */
Index: linux-2.6/include/asm-x86/setup.h
===================================================================
--- linux-2.6.orig/include/asm-x86/setup.h
+++ linux-2.6/include/asm-x86/setup.h
@@ -42,13 +42,14 @@ void vsmp_init(void);
  */
 extern struct boot_params boot_params;
 
-#ifdef __i386__
 /*
  * Do NOT EVER look at the BIOS memory size location.
  * It does not work on many machines.
  */
 #define LOWMEMSIZE()	(0x9f000)
 
+#ifdef __i386__
+
 void __init i386_start_kernel(void);
 
 extern unsigned long init_pg_tables_start;

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

* Re: [PATCH] x86: cleanup machine_specific_memory_setup v2
  2008-06-19  0:27     ` [PATCH] x86: cleanup machine_specific_memory_setup v2 Yinghai Lu
@ 2008-06-19 12:11       ` Ingo Molnar
  0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-06-19 12:11 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> 1. let 64bit support 88 and e801 too
> 2. introduce default_machine_specific_memory_setup, and reuse it
>    for voyager
> 
> v2: fix 64 bit compiling

applied to tip/x86/mpparse - thanks Yinghai.

	Ingo

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

end of thread, other threads:[~2008-06-19 12:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 20:03 [PATCH] x86: move e820_resource_resources to e820.c Yinghai Lu
2008-06-17  2:58 ` [PATCH] x86: merge setup_memory_map with e820 Yinghai Lu
2008-06-17 12:31   ` Glauber Costa
2008-06-17 16:04     ` H. Peter Anvin
2008-06-17 16:18       ` Yinghai Lu
2008-06-17 16:25         ` Glauber Costa
2008-06-17 17:39         ` H. Peter Anvin
2008-06-17 17:52           ` Yinghai Lu
2008-06-17 18:23             ` H. Peter Anvin
2008-06-18 14:30   ` Ingo Molnar
2008-06-18 18:06   ` [PATCH] x86: cleanup machine_specific_memory_setup Yinghai Lu
2008-06-19  0:27     ` [PATCH] x86: cleanup machine_specific_memory_setup v2 Yinghai Lu
2008-06-19 12:11       ` Ingo Molnar

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