aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm/fault.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-01 22:28:17 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-02 05:22:53 -0700
commit9f2b2a5f68c27c00f1e1f1922de5aa2f24505ed8 (patch)
tree2afd44efe02154ab1bfcbd47e1d8ba55167da4e5 /arch/sparc/mm/fault.c
parentsparc32: Kill totally unused memory information tables. (diff)
downloadlinux-dev-9f2b2a5f68c27c00f1e1f1922de5aa2f24505ed8.tar.xz
linux-dev-9f2b2a5f68c27c00f1e1f1922de5aa2f24505ed8.zip
sparc32: More memory probing consolidation.
The PROM library function prom_meminit() builds a table, prom_phys_avail[], just so that probe_memory() in arch/sparc/mm/fault.c can copy it into sp_banks[]. Just have prom_meminit() fill in the sp_banks[] array directly, and remove duplicated sort() function. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/mm/fault.c')
-rw-r--r--arch/sparc/mm/fault.c61
1 files changed, 6 insertions, 55 deletions
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index f25876a56fe6..abd50795a7b6 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -47,64 +47,15 @@ int vac_size, vac_linesize, vac_do_hw_vac_flushes;
int vac_entries_per_context, vac_entries_per_segment;
int vac_entries_per_page;
-/* Nice, simple, prom library does all the sweating for us. ;) */
-int prom_probe_memory (void)
+/* Return how much physical memory we have. */
+unsigned long probe_memory(void)
{
- register struct linux_mlist_v0 *mlist;
- register unsigned long bytes, base_paddr, tally;
- register int i;
-
- i = 0;
- mlist= prom_meminfo();
- bytes = tally = mlist->num_bytes;
- base_paddr = (unsigned long) 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 = (unsigned long) mlist->start_adr;
- sp_banks[i].num_bytes = mlist->num_bytes;
- }
-
- i++;
- sp_banks[i].base_addr = 0xdeadbeef;
- 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;
-}
-
-/* Traverse the memory lists in the prom to see how much physical we
- * have.
- */
-unsigned long
-probe_memory(void)
-{
- int total;
+ unsigned long total = 0;
+ int i;
- total = prom_probe_memory();
+ for (i = 0; sp_banks[i].num_bytes; i++)
+ total += sp_banks[i].num_bytes;
- /* Oh man, much nicer, keep the dirt in promlib. */
return total;
}