Skip to contentSkip to conversation

Incoming to hostme.bitkeeper.com:/ua/repos/p/ppc/linuxppc_2_4_devel

DISCUSSION Tom Rini 2 participants 4 messages Nov 1, 2001 – Nov 2, 2001 2 messages not in the archive

lore
Share & tools
lore

Tom Rini

author
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Roman Zippel

Hi,

Quoted 3 lines

[email protected], 2001-10-31 17:09:57-07:00, [email protected]
Minor cleanups wrt isa_{io,mem}_base and pci_dram_offset, from Roman Zippel <[email protected]>

You missed the declaritions in mpc8xx.h, that change is in the other patch. Sorry, I didn't mention it, I didn't resent the parts that applied cleanly.

Arg, not my day. Can you split up the rest of the changes into seperate patches (01, 02, 0n) and make it vs the _devel tree? It'll help stop me from doing things like that. :)

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

Hi,

Quoted 3 lines · Tom Rini

Arg, not my day. Can you split up the rest of the changes into seperate patches (01, 02, 0n) and make it vs the _devel tree? It'll help stop me from doing things like that. :)

Hmm, there isn't much left to split.
BTW the second patch depends on the first and only the last patch doesn't apply to the stable tree.

---------- introduce PPC_MEMSTART/PPC_MEMOFFSET, rename ram_phys_base to ppc_memstart

asm-ppc/page.h +16 -0
@@ -89,6 +89,17 @@
 extern void clear_user_page(struct page *page, unsigned long vaddr);
 extern void copy_user_page(struct page *to, struct page *from, unsigned long vaddr);
 
+extern unsigned long ppc_memstart;
+extern unsigned long ppc_memoffset;
+#ifndef CONFIG_APUS
+#define PPC_MEMSTART	0
+#define PPC_MEMOFFSET	PAGE_OFFSET
+#else
+#define PPC_MEMSTART	ppc_memstart
+#define PPC_MEMOFFSET	ppc_memoffset
+#endif
+
+#if defined(CONFIG_APUS) && !defined(MODULE)
 /* map phys->virtual and virtual->phys for RAM pages */
 static inline unsigned long ___pa(unsigned long v)
 {
@@ -116,6 +127,11 @@
 
 	return (void*) v;
 }
+#else
+#define ___pa(vaddr) ((vaddr)-PPC_MEMOFFSET)
+#define ___va(paddr) ((paddr)+PPC_MEMOFFSET)
+#endif
+
 #define __pa(x) ___pa ((unsigned long)(x))
 #define __va(x) ___va ((unsigned long)(x))
 
asm-ppc/io.h +1 -1
@@ -295,7 +295,7 @@
 /*
  * Change "struct page" to physical address.
  */
-#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)	(((page - mem_map) << PAGE_SHIFT) + PPC_MEMSTART)
 #define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
 
 /*
asm-ppc/pgtable.h +2 -2
@@ -393,7 +393,7 @@
  * Permanent address of a page.
  */
 #define page_address(page)	((page)->virtual)
-#define pte_page(x)		(mem_map+(unsigned long)((pte_val(x) >> PAGE_SHIFT)))
+#define pte_page(x)		(mem_map+(unsigned long)((pte_val(x)-PPC_MEMSTART) >> PAGE_SHIFT))
 
 #ifndef __ASSEMBLY__
 /*
@@ -459,7 +459,7 @@
 #define mk_pte(page,pgprot) \
 ({									\
 	pte_t pte;							\
-	pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); \
+	pte_val(pte) = (((page - mem_map) << PAGE_SHIFT) + PPC_MEMSTART) | pgprot_val(pgprot); \
 	pte;							\
 })
 
ppc/kernel/apus_setup.c +2 -1
@@ -991,6 +991,8 @@
 		memory[0].size = ((size+0x001fffff) & 0xffe00000);
 	}
 
+	ppc_memstart = memory[0].addr;
+	ppc_memoffset = PAGE_OFFSET - PPC_MEMSTART;
 	total = memory[0].size;
 
 	/* Remove the memory chunks that are controlled by special
@@ -1011,7 +1013,6 @@
 	   the PowerUP board. Other system memory is horrible slow in
 	   comparison. The user can use other memory for swapping
 	   using the z2ram device. */
-	ram_phys_base = memory[0].addr;
 	return total;
 }
 
ppc/mm/init.c +11 -7
@@ -62,6 +62,9 @@
 unsigned long total_memory;
 unsigned long total_lowmem;
 
+unsigned long ppc_memstart;
+unsigned long ppc_memoffset = PAGE_OFFSET;
+
 int mem_init_done;
 int init_bootmem_done;
 int boot_mapsize;
@@ -406,8 +409,11 @@
 	}
 	start = PAGE_ALIGN(start);
 
-	boot_mapsize = init_bootmem(start >> PAGE_SHIFT,
-				    total_lowmem >> PAGE_SHIFT);
+	min_low_pfn = start >> PAGE_SHIFT;
+	max_low_pfn = (PPC_MEMSTART + total_lowmem) >> PAGE_SHIFT;
+	boot_mapsize = init_bootmem_node(&contig_page_data, min_low_pfn,
+					 PPC_MEMSTART >> PAGE_SHIFT,
+					 max_low_pfn);
 
 	/* remove the bootmem bitmap from the available memory */
 	mem_pieces_remove(&phys_avail, start, boot_mapsize, 1);
@@ -460,12 +466,10 @@
 
 	highmem_mapnr = total_lowmem >> PAGE_SHIFT;
 	highmem_start_page = mem_map + highmem_mapnr;
-	max_mapnr = total_memory >> PAGE_SHIFT;
-#else
-	max_mapnr = max_low_pfn;
 #endif /* CONFIG_HIGHMEM */
+	max_mapnr = total_memory >> PAGE_SHIFT;
 
-	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
+	high_memory = __va(PPC_MEMSTART + total_lowmem);
 	num_physpages = max_mapnr;	/* RAM is assumed contiguous */
 
 	totalram_pages += free_all_bootmem();
@@ -553,7 +557,7 @@
 	 * physical memory.
 	 */
 
-	phys_avail.regions[0].address = 0;
+	phys_avail.regions[0].address = PPC_MEMSTART;
 	phys_avail.regions[0].size = total_memory;
 	phys_avail.n_regions = 1;
 
ppc/mm/mmu_decl.h +0 -1
@@ -38,7 +38,6 @@
 
 extern unsigned long total_memory;
 extern unsigned long total_lowmem;
-extern unsigned long ram_phys_base;
 extern int mem_init_done;
 
 extern PTE *Hash, *Hash_end;
ppc/mm/pgtable.c +1 -3
@@ -35,8 +35,6 @@
 
 #include "mmu_decl.h"
 
-unsigned long ram_phys_base;
-
 unsigned long ioremap_base;
 unsigned long ioremap_bot;
 int io_bat_index;
@@ -199,7 +197,7 @@
 #endif /* HAVE_BATS */
 
 	v = KERNELBASE;
-	p = ram_phys_base;
+	p = PPC_MEMSTART;
 	for (s = 0; s < total_lowmem; s += PAGE_SIZE) {
 		/* On the MPC8xx, we want the page shared so we
 		 * don't get ASID compares on kernel space.
ppc/mm/ppc_mmu.c +4 -4
@@ -96,8 +96,8 @@
 
 	/* Make sure we don't map a block larger than the
 	   smallest alignment of the physical address. */
-	/* alignment of ram_phys_base */
-	align = ~(ram_phys_base-1) & ram_phys_base;
+	/* alignment of PPC_MEMSTART */
+	align = ~(PPC_MEMSTART-1) & PPC_MEMSTART;
 	/* set BAT block size to MIN(max_size, align) */
 	if (align && align < max_size)
 		max_size = align;
@@ -108,7 +108,7 @@
 			break;
 	}
 
-	setbat(2, KERNELBASE, ram_phys_base, bl, _PAGE_KERNEL);
+	setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_KERNEL);
 	done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
 	if ((done < tot) && !bat_addrs[3].limit) {
 		/* use BAT3 to cover a bit more */
@@ -116,7 +116,7 @@
 		for (bl = 128<<10; bl < max_size; bl <<= 1)
 			if (bl * 2 > tot)
 				break;
-		setbat(3, KERNELBASE+done, ram_phys_base+done, bl,
+		setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl,
 		       _PAGE_KERNEL);
 	}
 }

---------- replace end_of_DRAM with high_memory

ppc/mm/init.c +1 -3
@@ -58,7 +58,6 @@
 
 mmu_gather_t mmu_gathers[NR_CPUS];
 
-void *end_of_DRAM;
 unsigned long total_memory;
 unsigned long total_lowmem;
 
@@ -327,7 +326,6 @@
 		total_memory = total_lowmem;
 #endif /* CONFIG_HIGHMEM */
 	}
-	end_of_DRAM = __va(total_lowmem);
 	set_phys_avail(total_lowmem);
 
 	/* Initialize the MMU hardware */
@@ -497,7 +495,7 @@
 		     addr += PAGE_SIZE)
 			SetPageReserved(virt_to_page(addr));
 
-	for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM;
+	for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
 	     addr += PAGE_SIZE) {
 		if (!PageReserved(virt_to_page(addr)))
 			continue;
ppc/mm/mmu_decl.h +0 -1
@@ -31,7 +31,6 @@
 extern void reserve_phys_mem(unsigned long start, unsigned long size);
 
 extern int __map_without_bats;
-extern void *end_of_DRAM;
 extern unsigned long ioremap_base;
 extern unsigned long ioremap_bot;
 extern unsigned int rtas_data, rtas_size;

---------- move ifdef __KERNEL__ inside include protection

asm-ppc/io.h +3 -2
@@ -2,10 +2,11 @@
  * BK Id: SCCS/s.io.h 1.21 10/16/01 16:44:09 %#%
  */
 
-#ifdef __KERNEL__
 #ifndef _PPC_IO_H
 #define _PPC_IO_H
 
+#ifdef __KERNEL__
+
 #include <linux/config.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>
@@ -448,5 +449,5 @@
 #define consistent_sync_page(pg, off, sz, rw)	do { } while (0)
 
 #endif /* CONFIG_NOT_COHERENT_CACHE */
-#endif /* _PPC_IO_H */
 #endif /* __KERNEL__ */
+#endif /* _PPC_IO_H */

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#4 lore raw
Quoted 11 lines · Roman Zippel

Hi,

Quoted 3 lines · Tom Rini

Arg, not my day. Can you split up the rest of the changes into seperate patches (01, 02, 0n) and make it vs the _devel tree? It'll help stop me from doing things like that. :)

Hmm, there isn't much left to split.
BTW the second patch depends on the first and only the last patch doesn't apply to the stable tree.

Just wondering, but have you tried these changes on a 'fake' CONFIG_HIGHMEM setup? (eg set MAX_LOW_MEM to half your real RAM or so..)

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw

Hi,

Quoted 2 lines · Tom Rini

Just wondering, but have you tried these changes on a 'fake' CONFIG_HIGHMEM setup? (eg set MAX_LOW_MEM to half your real RAM or so..)

No and I don't expect any problems for any non-APUS configuration and APUS doesn't need the highmem option.

bye, Roman

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/