diff options
author | David S. Miller <davem@davemloft.net> | 2008-05-02 01:28:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-02 08:22:53 -0400 |
commit | 9f2b2a5f68c27c00f1e1f1922de5aa2f24505ed8 (patch) | |
tree | 2afd44efe02154ab1bfcbd47e1d8ba55167da4e5 /arch/sparc/mm | |
parent | ccc34028d46230f715eeda4c8cce27e919934fad (diff) |
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')
-rw-r--r-- | arch/sparc/mm/fault.c | 61 |
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; | |||
47 | int vac_entries_per_context, vac_entries_per_segment; | 47 | int vac_entries_per_context, vac_entries_per_segment; |
48 | int vac_entries_per_page; | 48 | int vac_entries_per_page; |
49 | 49 | ||
50 | /* Nice, simple, prom library does all the sweating for us. ;) */ | 50 | /* Return how much physical memory we have. */ |
51 | int prom_probe_memory (void) | 51 | unsigned long probe_memory(void) |
52 | { | 52 | { |
53 | register struct linux_mlist_v0 *mlist; | 53 | unsigned long total = 0; |
54 | register unsigned long bytes, base_paddr, tally; | 54 | int i; |
55 | register int i; | ||
56 | |||
57 | i = 0; | ||
58 | mlist= prom_meminfo(); | ||
59 | bytes = tally = mlist->num_bytes; | ||
60 | base_paddr = (unsigned long) mlist->start_adr; | ||
61 | |||
62 | sp_banks[0].base_addr = base_paddr; | ||
63 | sp_banks[0].num_bytes = bytes; | ||
64 | |||
65 | while (mlist->theres_more != (void *) 0){ | ||
66 | i++; | ||
67 | mlist = mlist->theres_more; | ||
68 | bytes = mlist->num_bytes; | ||
69 | tally += bytes; | ||
70 | if (i > SPARC_PHYS_BANKS-1) { | ||
71 | printk ("The machine has more banks than " | ||
72 | "this kernel can support\n" | ||
73 | "Increase the SPARC_PHYS_BANKS " | ||
74 | "setting (currently %d)\n", | ||
75 | SPARC_PHYS_BANKS); | ||
76 | i = SPARC_PHYS_BANKS-1; | ||
77 | break; | ||
78 | } | ||
79 | |||
80 | sp_banks[i].base_addr = (unsigned long) mlist->start_adr; | ||
81 | sp_banks[i].num_bytes = mlist->num_bytes; | ||
82 | } | ||
83 | |||
84 | i++; | ||
85 | sp_banks[i].base_addr = 0xdeadbeef; | ||
86 | sp_banks[i].num_bytes = 0; | ||
87 | |||
88 | /* Now mask all bank sizes on a page boundary, it is all we can | ||
89 | * use anyways. | ||
90 | */ | ||
91 | for(i=0; sp_banks[i].num_bytes != 0; i++) | ||
92 | sp_banks[i].num_bytes &= PAGE_MASK; | ||
93 | |||
94 | return tally; | ||
95 | } | ||
96 | |||
97 | /* Traverse the memory lists in the prom to see how much physical we | ||
98 | * have. | ||
99 | */ | ||
100 | unsigned long | ||
101 | probe_memory(void) | ||
102 | { | ||
103 | int total; | ||
104 | 55 | ||
105 | total = prom_probe_memory(); | 56 | for (i = 0; sp_banks[i].num_bytes; i++) |
57 | total += sp_banks[i].num_bytes; | ||
106 | 58 | ||
107 | /* Oh man, much nicer, keep the dirt in promlib. */ | ||
108 | return total; | 59 | return total; |
109 | } | 60 | } |
110 | 61 | ||