diff options
Diffstat (limited to 'arch/powerpc/platforms/ps3/mm.c')
-rw-r--r-- | arch/powerpc/platforms/ps3/mm.c | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 0c9f643d9e2a..b0f34663b1ae 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -223,6 +223,44 @@ void ps3_mm_vas_destroy(void) | |||
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | static int ps3_mm_get_repository_highmem(struct mem_region *r) | ||
227 | { | ||
228 | int result; | ||
229 | |||
230 | /* Assume a single highmem region. */ | ||
231 | |||
232 | result = ps3_repository_read_highmem_info(0, &r->base, &r->size); | ||
233 | |||
234 | if (result) | ||
235 | goto zero_region; | ||
236 | |||
237 | if (!r->base || !r->size) { | ||
238 | result = -1; | ||
239 | goto zero_region; | ||
240 | } | ||
241 | |||
242 | r->offset = r->base - map.rm.size; | ||
243 | |||
244 | DBG("%s:%d: Found high region in repository: %llxh %llxh\n", | ||
245 | __func__, __LINE__, r->base, r->size); | ||
246 | |||
247 | return 0; | ||
248 | |||
249 | zero_region: | ||
250 | DBG("%s:%d: No high region in repository.\n", __func__, __LINE__); | ||
251 | |||
252 | r->size = r->base = r->offset = 0; | ||
253 | return result; | ||
254 | } | ||
255 | |||
256 | static int ps3_mm_set_repository_highmem(const struct mem_region *r) | ||
257 | { | ||
258 | /* Assume a single highmem region. */ | ||
259 | |||
260 | return r ? ps3_repository_write_highmem_info(0, r->base, r->size) : | ||
261 | ps3_repository_write_highmem_info(0, 0, 0); | ||
262 | } | ||
263 | |||
226 | /** | 264 | /** |
227 | * ps3_mm_region_create - create a memory region in the vas | 265 | * ps3_mm_region_create - create a memory region in the vas |
228 | * @r: pointer to a struct mem_region to accept initialized values | 266 | * @r: pointer to a struct mem_region to accept initialized values |
@@ -291,36 +329,7 @@ static void ps3_mm_region_destroy(struct mem_region *r) | |||
291 | r->size = r->base = r->offset = 0; | 329 | r->size = r->base = r->offset = 0; |
292 | map.total = map.rm.size; | 330 | map.total = map.rm.size; |
293 | } | 331 | } |
294 | } | 332 | ps3_mm_set_repository_highmem(NULL); |
295 | |||
296 | static int ps3_mm_get_repository_highmem(struct mem_region *r) | ||
297 | { | ||
298 | int result; | ||
299 | |||
300 | /* Assume a single highmem region. */ | ||
301 | |||
302 | result = ps3_repository_read_highmem_info(0, &r->base, &r->size); | ||
303 | |||
304 | if (result) | ||
305 | goto zero_region; | ||
306 | |||
307 | if (!r->base || !r->size) { | ||
308 | result = -1; | ||
309 | goto zero_region; | ||
310 | } | ||
311 | |||
312 | r->offset = r->base - map.rm.size; | ||
313 | |||
314 | DBG("%s:%d: Found high region in repository: %llxh %llxh\n", | ||
315 | __func__, __LINE__, r->base, r->size); | ||
316 | |||
317 | return 0; | ||
318 | |||
319 | zero_region: | ||
320 | DBG("%s:%d: No high region in repository.\n", __func__, __LINE__); | ||
321 | |||
322 | r->size = r->base = r->offset = 0; | ||
323 | return result; | ||
324 | } | 333 | } |
325 | 334 | ||
326 | /*============================================================================*/ | 335 | /*============================================================================*/ |
@@ -1210,8 +1219,12 @@ void __init ps3_mm_init(void) | |||
1210 | 1219 | ||
1211 | /* Check if we got the highmem region from an earlier boot step */ | 1220 | /* Check if we got the highmem region from an earlier boot step */ |
1212 | 1221 | ||
1213 | if (ps3_mm_get_repository_highmem(&map.r1)) | 1222 | if (ps3_mm_get_repository_highmem(&map.r1)) { |
1214 | ps3_mm_region_create(&map.r1, map.total - map.rm.size); | 1223 | result = ps3_mm_region_create(&map.r1, map.total - map.rm.size); |
1224 | |||
1225 | if (!result) | ||
1226 | ps3_mm_set_repository_highmem(&map.r1); | ||
1227 | } | ||
1215 | 1228 | ||
1216 | /* correct map.total for the real total amount of memory we use */ | 1229 | /* correct map.total for the real total amount of memory we use */ |
1217 | map.total = map.rm.size + map.r1.size; | 1230 | map.total = map.rm.size + map.r1.size; |