[SPARC64]: Move phys_base, kern_{base,size}, and sp_banks[] init to paging_init
authorDavid S. Miller <davem@sunset.davemloft.net>
Thu, 29 Sep 2005 04:38:08 +0000 (21:38 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 29 Sep 2005 04:38:08 +0000 (21:38 -0700)
Also, move prom_probe_memory() into arch/sparc64/mm/init.c

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/setup.c
arch/sparc64/mm/fault.c
arch/sparc64/mm/init.c

index 516f4854955f7ac278a6fcbab5beace954e5575f..4c9c8f2417489c6ac7874c5b8b77581b43850bd3 100644 (file)
@@ -464,8 +464,6 @@ static void __init boot_flags_init(char *commands)
        }
 }
 
-extern int prom_probe_memory(void);
-extern unsigned long start, end;
 extern void panic_setup(char *, int *);
 
 extern unsigned short root_flags;
@@ -494,8 +492,6 @@ void register_prom_callbacks(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-       int i;
-
        /* Initialize PROM console and command line. */
        *cmdline_p = prom_getbootargs();
        strcpy(saved_command_line, *cmdline_p);
@@ -514,21 +510,6 @@ void __init setup_arch(char **cmdline_p)
        boot_flags_init(*cmdline_p);
 
        idprom_init();
-       (void) prom_probe_memory();
-
-       phys_base = 0xffffffffffffffffUL;
-       for (i = 0; sp_banks[i].num_bytes != 0; i++) {
-               unsigned long top;
-
-               if (sp_banks[i].base_addr < phys_base)
-                       phys_base = sp_banks[i].base_addr;
-               top = sp_banks[i].base_addr +
-                       sp_banks[i].num_bytes;
-       }
-       pfn_base = phys_base >> PAGE_SHIFT;
-
-       kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
-       kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
 
        if (!root_flags)
                root_mountflags &= ~MS_RDONLY;
index 4a52e79d515f1e11e6eff56975341f0ec7ef90d1..80793d61f3113dbc9c785ee6f8c64de6a39d6038 100644 (file)
@@ -71,53 +71,6 @@ void set_brkpt(unsigned long addr, unsigned char mask, int flags, int mode)
                             : "memory");
 }
 
-/* Nice, simple, prom library does all the sweating for us. ;) */
-unsigned long __init prom_probe_memory (void)
-{
-       register struct linux_mlist_p1275 *mlist;
-       register unsigned long bytes, base_paddr, tally;
-       register int i;
-
-       i = 0;
-       mlist = *prom_meminfo()->p1275_available;
-       bytes = tally = mlist->num_bytes;
-       base_paddr = mlist->start_adr;
-  
-       sp_banks[0].base_addr = base_paddr;
-       sp_banks[0].num_bytes = bytes;
-
-       while (mlist->theres_more != (void *) 0) {
-               i++;
-               mlist = mlist->theres_more;
-               bytes = mlist->num_bytes;
-               tally += bytes;
-               if (i >= SPARC_PHYS_BANKS-1) {
-                       printk ("The machine has more banks than "
-                               "this kernel can support\n"
-                               "Increase the SPARC_PHYS_BANKS "
-                               "setting (currently %d)\n",
-                               SPARC_PHYS_BANKS);
-                       i = SPARC_PHYS_BANKS-1;
-                       break;
-               }
-    
-               sp_banks[i].base_addr = mlist->start_adr;
-               sp_banks[i].num_bytes = mlist->num_bytes;
-       }
-
-       i++;
-       sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL;
-       sp_banks[i].num_bytes = 0;
-
-       /* Now mask all bank sizes on a page boundary, it is all we can
-        * use anyways.
-        */
-       for (i = 0; sp_banks[i].num_bytes != 0; i++)
-               sp_banks[i].num_bytes &= PAGE_MASK;
-
-       return tally;
-}
-
 static void __kprobes unhandled_fault(unsigned long address,
                                      struct task_struct *tsk,
                                      struct pt_regs *regs)
index 9f6ca624892d78ccdbd1af9cbefa499f7191ce4e..63a7b9bafaff516a1d08b82b67de09b90bc2bc3d 100644 (file)
@@ -1425,6 +1425,50 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
 }
 #endif
 
+static void __init prom_probe_memory(void)
+{
+       struct linux_mlist_p1275 *mlist;
+       unsigned long bytes, base_paddr, tally;
+       int i;
+
+       i = 0;
+       mlist = *prom_meminfo()->p1275_available;
+       bytes = tally = mlist->num_bytes;
+       base_paddr = mlist->start_adr;
+  
+       sp_banks[0].base_addr = base_paddr;
+       sp_banks[0].num_bytes = bytes;
+
+       while (mlist->theres_more != (void *) 0) {
+               i++;
+               mlist = mlist->theres_more;
+               bytes = mlist->num_bytes;
+               tally += bytes;
+               if (i >= SPARC_PHYS_BANKS-1) {
+                       printk ("The machine has more banks than "
+                               "this kernel can support\n"
+                               "Increase the SPARC_PHYS_BANKS "
+                               "setting (currently %d)\n",
+                               SPARC_PHYS_BANKS);
+                       i = SPARC_PHYS_BANKS-1;
+                       break;
+               }
+    
+               sp_banks[i].base_addr = mlist->start_adr;
+               sp_banks[i].num_bytes = mlist->num_bytes;
+       }
+
+       i++;
+       sp_banks[i].base_addr = 0xdeadbeefbeefdeadUL;
+       sp_banks[i].num_bytes = 0;
+
+       /* Now mask all bank sizes on a page boundary, it is all we can
+        * use anyways.
+        */
+       for (i = 0; sp_banks[i].num_bytes != 0; i++)
+               sp_banks[i].num_bytes &= PAGE_MASK;
+}
+
 /* paging_init() sets up the page tables */
 
 extern void cheetah_ecache_flush_init(void);
@@ -1435,7 +1479,23 @@ pgd_t swapper_pg_dir[2048];
 void __init paging_init(void)
 {
        unsigned long end_pfn, pages_avail, shift;
-       unsigned long real_end;
+       unsigned long real_end, i;
+
+       prom_probe_memory();
+
+       phys_base = 0xffffffffffffffffUL;
+       for (i = 0; sp_banks[i].num_bytes != 0; i++) {
+               unsigned long top;
+
+               if (sp_banks[i].base_addr < phys_base)
+                       phys_base = sp_banks[i].base_addr;
+               top = sp_banks[i].base_addr +
+                       sp_banks[i].num_bytes;
+       }
+       pfn_base = phys_base >> PAGE_SHIFT;
+
+       kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
+       kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
 
        set_bit(0, mmu_context_bmap);