aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/ps3/setup.c42
-rw-r--r--include/asm-powerpc/ps3.h9
2 files changed, 51 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index e62505e18813..13d669a8ecae 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -24,6 +24,7 @@
24#include <linux/root_dev.h> 24#include <linux/root_dev.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/kexec.h> 26#include <linux/kexec.h>
27#include <linux/bootmem.h>
27 28
28#include <asm/machdep.h> 29#include <asm/machdep.h>
29#include <asm/firmware.h> 30#include <asm/firmware.h>
@@ -80,6 +81,46 @@ static void ps3_panic(char *str)
80 for (;;) ; 81 for (;;) ;
81} 82}
82 83
84
85static void prealloc(struct ps3_prealloc *p)
86{
87 if (!p->size)
88 return;
89
90 p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS));
91 if (!p->address) {
92 printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__,
93 p->name);
94 return;
95 }
96
97 printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size,
98 p->address);
99}
100
101#ifdef CONFIG_FB_PS3
102struct ps3_prealloc ps3fb_videomemory = {
103 .name = "ps3fb videomemory",
104 .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024,
105 .align = 1024*1024 /* the GPU requires 1 MiB alignment */
106};
107#define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory)
108
109static int __init early_parse_ps3fb(char *p)
110{
111 if (!p)
112 return 1;
113
114 ps3fb_videomemory.size = _ALIGN_UP(memparse(p, &p),
115 ps3fb_videomemory.align);
116 return 0;
117}
118early_param("ps3fb", early_parse_ps3fb);
119#else
120#define prealloc_ps3fb_videomemory() do { } while (0)
121#endif
122
123
83static void __init ps3_setup_arch(void) 124static void __init ps3_setup_arch(void)
84{ 125{
85 union ps3_firmware_version v; 126 union ps3_firmware_version v;
@@ -101,6 +142,7 @@ static void __init ps3_setup_arch(void)
101 conswitchp = &dummy_con; 142 conswitchp = &dummy_con;
102#endif 143#endif
103 144
145 prealloc_ps3fb_videomemory();
104 ppc_md.power_save = ps3_power_save; 146 ppc_md.power_save = ps3_power_save;
105 147
106 DBG(" <- %s:%d\n", __func__, __LINE__); 148 DBG(" <- %s:%d\n", __func__, __LINE__);
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 4f5a1e01fdac..e5982ad46576 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -388,4 +388,13 @@ struct ps3_vuart_port_device {
388 388
389int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); 389int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
390 390
391struct ps3_prealloc {
392 const char *name;
393 void *address;
394 unsigned long size;
395 unsigned long align;
396};
397
398extern struct ps3_prealloc ps3fb_videomemory;
399
391#endif 400#endif