aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/prom
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-02 00:28:59 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-02 08:22:53 -0400
commitccc34028d46230f715eeda4c8cce27e919934fad (patch)
treefa9ef4679b6c30c5b439471ba39c5e383011c25e /arch/sparc/prom
parent2678fefedbbc03a3ae6f5c254791bf147d6c52fd (diff)
sparc32: Kill totally unused memory information tables.
The code in arch/sparc/prom/memory.c computes three tables, the list of total memory, the list of available memory (total minus what firmware is using), and the list of firmware taken memory. Only the available memory list is even used. Therefore, kill those unused tables and make prom_meminfo() return just the available memory list. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/prom')
-rw-r--r--arch/sparc/prom/memory.c103
1 files changed, 4 insertions, 99 deletions
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
index b0c0f9c4fc14..08ac1bf2e588 100644
--- a/arch/sparc/prom/memory.c
+++ b/arch/sparc/prom/memory.c
@@ -1,5 +1,4 @@
1/* $Id: memory.c,v 1.15 2000/01/29 01:09:12 anton Exp $ 1/* memory.c: Prom routine for acquiring various bits of information
2 * memory.c: Prom routine for acquiring various bits of information
3 * about RAM on the machine, both virtual and physical. 2 * about RAM on the machine, both virtual and physical.
4 * 3 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -22,19 +21,9 @@
22 */ 21 */
23 22
24struct linux_prom_registers prom_reg_memlist[64]; 23struct linux_prom_registers prom_reg_memlist[64];
25struct linux_prom_registers prom_reg_tmp[64];
26 24
27struct linux_mlist_v0 prom_phys_total[64];
28struct linux_mlist_v0 prom_prom_taken[64];
29struct linux_mlist_v0 prom_phys_avail[64]; 25struct linux_mlist_v0 prom_phys_avail[64];
30 26
31struct linux_mlist_v0 *prom_ptot_ptr = prom_phys_total;
32struct linux_mlist_v0 *prom_ptak_ptr = prom_prom_taken;
33struct linux_mlist_v0 *prom_pavl_ptr = prom_phys_avail;
34
35struct linux_mem_v0 prom_memlist;
36
37
38/* Internal Prom library routine to sort a linux_mlist_v0 memory 27/* Internal Prom library routine to sort a linux_mlist_v0 memory
39 * list. Used below in initialization. 28 * list. Used below in initialization.
40 */ 29 */
@@ -77,23 +66,6 @@ void __init prom_meminit(void)
77 switch(prom_vers) { 66 switch(prom_vers) {
78 case PROM_V0: 67 case PROM_V0:
79 /* Nice, kind of easier to do in this case. */ 68 /* Nice, kind of easier to do in this case. */
80 /* First, the total physical descriptors. */
81 for(mptr = (*(romvec->pv_v0mem.v0_totphys)), iter=0;
82 mptr; mptr=mptr->theres_more, iter++) {
83 prom_phys_total[iter].start_adr = mptr->start_adr;
84 prom_phys_total[iter].num_bytes = mptr->num_bytes;
85 prom_phys_total[iter].theres_more = &prom_phys_total[iter+1];
86 }
87 prom_phys_total[iter-1].theres_more = NULL;
88 /* Second, the total prom taken descriptors. */
89 for(mptr = (*(romvec->pv_v0mem.v0_prommap)), iter=0;
90 mptr; mptr=mptr->theres_more, iter++) {
91 prom_prom_taken[iter].start_adr = mptr->start_adr;
92 prom_prom_taken[iter].num_bytes = mptr->num_bytes;
93 prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1];
94 }
95 prom_prom_taken[iter-1].theres_more = NULL;
96 /* Last, the available physical descriptors. */
97 for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0; 69 for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0;
98 mptr; mptr=mptr->theres_more, iter++) { 70 mptr; mptr=mptr->theres_more, iter++) {
99 prom_phys_avail[iter].start_adr = mptr->start_adr; 71 prom_phys_avail[iter].start_adr = mptr->start_adr;
@@ -101,9 +73,6 @@ void __init prom_meminit(void)
101 prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1]; 73 prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1];
102 } 74 }
103 prom_phys_avail[iter-1].theres_more = NULL; 75 prom_phys_avail[iter-1].theres_more = NULL;
104 /* Sort all the lists. */
105 prom_sortmemlist(prom_phys_total);
106 prom_sortmemlist(prom_prom_taken);
107 prom_sortmemlist(prom_phys_avail); 76 prom_sortmemlist(prom_phys_avail);
108 break; 77 break;
109 case PROM_V2: 78 case PROM_V2:
@@ -124,69 +93,12 @@ void __init prom_meminit(void)
124 &prom_phys_avail[iter+1]; 93 &prom_phys_avail[iter+1];
125 } 94 }
126 prom_phys_avail[iter-1].theres_more = NULL; 95 prom_phys_avail[iter-1].theres_more = NULL;
127
128 num_regs = prom_getproperty(node, "reg",
129 (char *) prom_reg_memlist,
130 sizeof(prom_reg_memlist));
131 num_regs = (num_regs/sizeof(struct linux_prom_registers));
132 for(iter=0; iter<num_regs; iter++) {
133 prom_phys_total[iter].start_adr =
134 (char *) prom_reg_memlist[iter].phys_addr;
135 prom_phys_total[iter].num_bytes =
136 (unsigned long) prom_reg_memlist[iter].reg_size;
137 prom_phys_total[iter].theres_more =
138 &prom_phys_total[iter+1];
139 }
140 prom_phys_total[iter-1].theres_more = NULL;
141
142 node = prom_getchild(prom_root_node);
143 node = prom_searchsiblings(node, "virtual-memory");
144 num_regs = prom_getproperty(node, "available",
145 (char *) prom_reg_memlist,
146 sizeof(prom_reg_memlist));
147 num_regs = (num_regs/sizeof(struct linux_prom_registers));
148
149 /* Convert available virtual areas to taken virtual
150 * areas. First sort, then convert.
151 */
152 for(iter=0; iter<num_regs; iter++) {
153 prom_prom_taken[iter].start_adr =
154 (char *) prom_reg_memlist[iter].phys_addr;
155 prom_prom_taken[iter].num_bytes =
156 (unsigned long) prom_reg_memlist[iter].reg_size;
157 prom_prom_taken[iter].theres_more =
158 &prom_prom_taken[iter+1];
159 }
160 prom_prom_taken[iter-1].theres_more = NULL;
161
162 prom_sortmemlist(prom_prom_taken);
163
164 /* Finally, convert. */
165 for(iter=0; iter<num_regs; iter++) {
166 prom_prom_taken[iter].start_adr =
167 prom_prom_taken[iter].start_adr +
168 prom_prom_taken[iter].num_bytes;
169 prom_prom_taken[iter].num_bytes =
170 prom_prom_taken[iter+1].start_adr -
171 prom_prom_taken[iter].start_adr;
172 }
173 prom_prom_taken[iter-1].num_bytes =
174 0xffffffff - (unsigned long) prom_prom_taken[iter-1].start_adr;
175
176 /* Sort the other two lists. */
177 prom_sortmemlist(prom_phys_total);
178 prom_sortmemlist(prom_phys_avail); 96 prom_sortmemlist(prom_phys_avail);
179 break; 97 break;
180 98
181 case PROM_SUN4: 99 case PROM_SUN4:
182#ifdef CONFIG_SUN4 100#ifdef CONFIG_SUN4
183 /* how simple :) */ 101 /* how simple :) */
184 prom_phys_total[0].start_adr = NULL;
185 prom_phys_total[0].num_bytes = *(sun4_romvec->memorysize);
186 prom_phys_total[0].theres_more = NULL;
187 prom_prom_taken[0].start_adr = NULL;
188 prom_prom_taken[0].num_bytes = 0x0;
189 prom_prom_taken[0].theres_more = NULL;
190 prom_phys_avail[0].start_adr = NULL; 102 prom_phys_avail[0].start_adr = NULL;
191 prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail); 103 prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail);
192 prom_phys_avail[0].theres_more = NULL; 104 prom_phys_avail[0].theres_more = NULL;
@@ -196,20 +108,13 @@ void __init prom_meminit(void)
196 default: 108 default:
197 break; 109 break;
198 }; 110 };
199
200 /* Link all the lists into the top-level descriptor. */
201 prom_memlist.v0_totphys=&prom_ptot_ptr;
202 prom_memlist.v0_prommap=&prom_ptak_ptr;
203 prom_memlist.v0_available=&prom_pavl_ptr;
204
205 return;
206} 111}
207 112
208/* This returns a pointer to our libraries internal v0 format 113/* This returns a pointer to our libraries internal v0 format
209 * memory descriptor. 114 * available memory list.
210 */ 115 */
211struct linux_mem_v0 * 116struct linux_mlist_v0 *
212prom_meminfo(void) 117prom_meminfo(void)
213{ 118{
214 return &prom_memlist; 119 return prom_phys_avail;
215} 120}