Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: axp-list@redhat.com
Subject: Re: Linux-2.4.0-test2
Date: Sun, 25 Jun 2000 13:15:06 -0700	[thread overview]
Message-ID: <20000625131506.A2755@twiddle.net> (raw)
In-Reply-To: <395640CD.7E14F352@darkwing.uoregon.edu>

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

On Sun, Jun 25, 2000 at 09:26:37AM -0800, werner@darkwing.uoregon.edu wrote:
> can you post the patch on the list, I'll be glad to test it using the
> latest SRM.

Note that it's not a problem with SRM in general.  It works
just fine on my SX164.  But last time I tried it on the DS20,
I saw corruption in the memory being allocated for the PCI
configury.

Anyway, here's the patch updated to 2.4.0-test2-ac1.


r~

[-- Attachment #2: d-2402-memory --]
[-- Type: text/plain, Size: 3270 bytes --]

--- arch/alpha/kernel/setup.c.orig	Sat Jun 24 13:06:24 2000
+++ arch/alpha/kernel/setup.c	Sun Jun 25 13:04:00 2000
@@ -246,11 +246,12 @@ get_mem_size_limit(char *s)
 }
 
 static void __init
-setup_memory(void * kernel_end)
+setup_memory(void *kernel_end)
 {
 	struct memclust_struct * cluster;
 	struct memdesc_struct * memdesc;
-	unsigned long start_pfn, bootmap_size, bootmap_pages, bootmap_start;
+	unsigned long start_kernel_pfn, end_kernel_pfn;
+	unsigned long bootmap_size, bootmap_pages, bootmap_start;
 	unsigned long start, end;
 	int i;
 
@@ -282,12 +283,13 @@ setup_memory(void * kernel_end)
 		max_low_pfn = mem_size_limit;
 	}
 
-	/* Find the end of the memory used by the kernel.  */
-	start_pfn = PFN_UP(virt_to_phys(kernel_end));
+	/* Find the bounds of kernel memory.  */
+	start_kernel_pfn = PFN_DOWN(KERNEL_START_PHYS);
+	end_kernel_pfn = PFN_UP(virt_to_phys(kernel_end));
 	bootmap_start = -1;
 
  try_again:
-	if (max_low_pfn <= start_pfn)
+	if (max_low_pfn <= end_kernel_pfn)
 		panic("not enough memory to boot");
 
 	/* We need to know how many physically contiguous pages
@@ -301,14 +303,19 @@ setup_memory(void * kernel_end)
 
 		start = cluster->start_pfn;
 		end = start + cluster->numpages;
-		if (end <= start_pfn)
-			continue;
 		if (start >= max_low_pfn)
 			continue;
-		if (start < start_pfn)
-			start = start_pfn;
 		if (end > max_low_pfn)
 			end = max_low_pfn;
+		if (start < start_kernel_pfn) {
+			if (end > end_kernel_pfn
+			    && end - end_kernel_pfn >= bootmap_pages) {
+				bootmap_start = end_kernel_pfn;
+				break;
+			} else if (end > start_kernel_pfn)
+				end = start_kernel_pfn;
+		} else if (start < end_kernel_pfn)
+			start = end_kernel_pfn;
 		if (end - start >= bootmap_pages) {
 			bootmap_start = start;
 			break;
@@ -329,22 +336,28 @@ setup_memory(void * kernel_end)
 			continue;
 
 		start = cluster->start_pfn;
-		if (start < start_pfn)
-			start = start_pfn;
-
 		end = cluster->start_pfn + cluster->numpages;
+		if (start >= max_low_pfn)
+			continue;
 		if (end > max_low_pfn)
 			end = max_low_pfn;
-
+		if (start < start_kernel_pfn) {
+			if (end > end_kernel_pfn) {
+				free_bootmem(PFN_PHYS(start),
+					     (PFN_PHYS(start_kernel_pfn)
+					      - PFN_PHYS(start)));
+				printk("freeing pages %ld:%ld\n",
+				       start, start_kernel_pfn);
+				start = end_kernel_pfn;
+			} else if (end > start_kernel_pfn)
+				end = start_kernel_pfn;
+		} else if (start < end_kernel_pfn)
+			start = end_kernel_pfn;
 		if (start >= end)
 			continue;
 
-		start = PFN_PHYS(start);
-		end = PFN_PHYS(end);
-
-		free_bootmem(start, end - start);
-		printk("freeing pages %ld:%ld\n",
-		       PFN_UP(start), PFN_DOWN(end));
+		free_bootmem(PFN_PHYS(start), PFN_PHYS(end) - PFN_PHYS(start));
+		printk("freeing pages %ld:%ld\n", start, end);
 	}
 
 	/* Reserve the bootmap memory.  */
@@ -461,11 +474,12 @@ void __init unregister_srm_console(void)
 void __init
 setup_arch(char **cmdline_p)
 {
+	extern char _end[];
+
 	struct alpha_machine_vector *vec = NULL;
 	struct percpu_struct *cpu;
 	char *type_name, *var_name, *p;
-	extern char _end;
-	void * kernel_end = &_end; /* end of kernel */
+	void *kernel_end = _end; /* end of kernel */
 
 	/*
 	 * Let vmlinux.lds know where to put the kernel start.

  reply	other threads:[~2000-06-25 20:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.10.10006232158510.962-100000@penguin.transmeta.com>
2000-06-24 19:48 ` Linux-2.4.0-test2 Thorsten Kranzkowski
2000-06-24 21:56   ` Linux-2.4.0-test2 Richard Henderson
2000-06-25 11:35     ` Linux-2.4.0-test2 Ivan Kokshaysky
2000-06-25 16:27       ` Linux-2.4.0-test2 Richard Henderson
2000-06-25 17:26         ` Linux-2.4.0-test2 werner
2000-06-25 20:15           ` Richard Henderson [this message]
2000-06-26  0:05             ` Linux-2.4.0-test2 werner
     [not found]         ` <Pine.LNX.4.21.0006251933250.20731-100000@inspiron.random>
2000-06-27 22:24           ` Linux-2.4.0-test2 Richard Henderson
2000-06-28 14:44             ` Linux-2.4.0-test2 Robert Williams
2000-06-25 17:24       ` Linux-2.4.0-test2 werner
2000-06-25 21:40     ` Linux-2.4.0-test2 Thorsten Kranzkowski
2000-06-26 10:41       ` Linux-2.4.0-test2 Ivan Kokshaysky
2000-06-25 13:12 Linux-2.4.0-test2 GReg meno
read-only archive

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