Re: [PATCH 31/60] microblaze_v4: memory inicialization, MMU, TLB

2008-07-08 Thread Michal Simek
Hi Arnd,

 On Thursday 26 June 2008, [EMAIL PROTECTED] wrote:
 
 +#include linux/autoconf.h
 
 You should never need to include linux/autoconf.h anywhere,
 just remove this.

Remove from all files

 +#include linux/init.h
 +#include linux/mm.h
 +#include ../../../mm/internal.h
 
 Why do you need to include the internal.h file here?
 If you have a good reason to do it, you should probably
 add the symbol you need to a global header file.

There was reason for doing it in older version. With current
version work without internal.h.

Thank for comment,
Michal



   Arnd 
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@ozlabs.org
 https://ozlabs.org/mailman/listinfo/linuxppc-dev
 
 
 
 
 
 No virus found in this incoming message.
 Checked by AVG. 
 Version: 8.0.101 / Virus Database: 270.4.1/1519 - Release Date: 25.6.2008 
 04:13
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 31/60] microblaze_v4: memory inicialization, MMU, TLB

2008-06-26 Thread monstr
From: Michal Simek [EMAIL PROTECTED]


Signed-off-by: Michal Simek [EMAIL PROTECTED]
---
 arch/microblaze/mm/init.c|  184 ++
 include/asm-microblaze/mmu.h |   17 +++
 include/asm-microblaze/mmu_context.h |   22 
 include/asm-microblaze/tlb.h |   16 +++
 include/asm-microblaze/tlbflush.h|   20 
 5 files changed, 259 insertions(+), 0 deletions(-)
 create mode 100644 arch/microblaze/mm/init.c
 create mode 100644 include/asm-microblaze/mmu.h
 create mode 100644 include/asm-microblaze/mmu_context.h
 create mode 100644 include/asm-microblaze/tlb.h
 create mode 100644 include/asm-microblaze/tlbflush.h

diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
new file mode 100644
index 000..5bb3e01
--- /dev/null
+++ b/arch/microblaze/mm/init.c
@@ -0,0 +1,184 @@
+/*
+ * arch/microblaze/mm/init.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007-2008 Michal Simek [EMAIL PROTECTED]
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#undef DEBUG
+
+#include linux/autoconf.h
+#include linux/init.h
+#include linux/mm.h
+#include ../../../mm/internal.h
+#include linux/swap.h
+#include linux/bootmem.h
+#include linux/pfn.h
+#include linux/lmb.h
+
+#include asm/sections.h
+#include asm/uaccess.h
+#include asm/system.h
+#include asm/pgtable.h
+
+char *klimit = _end;
+static unsigned int memory_start;
+unsigned int memory_end; /* due to mm/nommu.c */
+
+unsigned int __page_offset;
+/* EXPORT_SYMBOL(__page_offset); */
+
+void __init setup_memory(void)
+{
+   int i;
+   unsigned int start, end;
+   unsigned long map_size;
+   unsigned long start_pfn = 0;
+   unsigned long end_pfn = 0;
+
+   /* Find main memory where is the kernel */
+   for (i = 0; i  lmb.memory.cnt; i++) {
+   start_pfn = lmb.memory.region[i].base  PAGE_SHIFT;
+   end_pfn = start_pfn + lmb_size_pages(lmb.memory, i);
+   if ((start_pfn = (((int)_text)  PAGE_SHIFT)) 
+   (((int)_text  PAGE_SHIFT) = end_pfn)) {
+   memory_end = (end_pfn  PAGE_SHIFT) - 1;
+   PAGE_OFFSET = memory_start = start_pfn  PAGE_SHIFT;
+   pr_debug(%s: Main mem: 0x%x-0x%x\n, __func__,
+   memory_start, memory_end);
+   break;
+   }
+   }
+   /*
+* start_pfn - start page - starting point
+* end_pfn - first unused page
+* memory_start - base physical address of main memory
+* memory_end - end physical address of main memory
+* PAGE_OFFSET - moving of first page
+*
+* Kernel:
+* start: base phys address of kernel - page align
+* end: base phys address of kernel - page align
+*
+* min_low_pfn - the first page (mm/bootmem.c - node_boot_start)
+* max_low_pfn
+* max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn)
+* num_physpages - number of all pages
+*
+*/
+
+   /* reservation of region where is the kernel */
+   start = PFN_DOWN((int)_text)  PAGE_SHIFT;
+   end = PAGE_ALIGN((unsigned long)klimit);
+   lmb_reserve(start, end - start);
+   pr_debug(%s: kernel addr 0x%08x-0x%08x\n, __func__, start, end);
+
+   /* calculate free pages, etc. */
+   min_low_pfn = PFN_UP(start_pfn  PAGE_SHIFT);
+   max_mapnr = PFN_DOWN((end_pfn  PAGE_SHIFT));
+   max_low_pfn = max_mapnr - min_low_pfn;
+   num_physpages = max_mapnr - min_low_pfn + 1;
+   printk(KERN_INFO %s: max_mapnr: %#lx\n, __func__, max_mapnr);
+   printk(KERN_INFO %s: min_low_pfn: %#lx\n, __func__, min_low_pfn);
+   printk(KERN_INFO %s: max_low_pfn: %#lx\n, __func__, max_low_pfn);
+
+   /* add place for data pages */
+   map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(end),
+   min_low_pfn, max_mapnr);
+   lmb_reserve(PFN_UP(end)  PAGE_SHIFT, map_size);
+
+   /* free bootmem is whole main memory */
+   free_bootmem_node(NODE_DATA(0), start_pfn  PAGE_SHIFT,
+   ((end_pfn - start_pfn)  PAGE_SHIFT) - 1);
+
+   /* reserve allocate blocks */
+   for (i = 0; i  lmb.reserved.cnt; i++) {
+   pr_debug(reserved %d - 0x%08x-0x%08x\n, i,
+   (u32) lmb.reserved.region[i].base,
+   (u32) lmb_size_bytes(lmb.reserved, i));
+   reserve_bootmem(lmb.reserved.region[i].base,
+   lmb_size_bytes(lmb.reserved, i) - 1, BOOTMEM_DEFAULT);
+   }
+}
+
+void __init paging_init(void)
+{
+   int i;
+   unsigned long zones_size[MAX_NR_ZONES];
+
+   /* we can DMA to/from any address.  put all page into
+* ZONE_DMA. */
+   zones_size[ZONE_NORMAL] = max_low_pfn;
+
+

Re: [PATCH 31/60] microblaze_v4: memory inicialization, MMU, TLB

2008-06-26 Thread Arnd Bergmann
On Thursday 26 June 2008, [EMAIL PROTECTED] wrote:

 +#include linux/autoconf.h

You should never need to include linux/autoconf.h anywhere,
just remove this.

 +#include linux/init.h
 +#include linux/mm.h
 +#include ../../../mm/internal.h

Why do you need to include the internal.h file here?
If you have a good reason to do it, you should probably
add the symbol you need to a global header file.

Arnd 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev