diff options
author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2007-02-12 03:55:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:44 -0500 |
commit | fbdb3e5be36619c4acf415d870eceab4cbce2850 (patch) | |
tree | 0bd7149180bdd261fa1e9067421ba64d1bf67d0e | |
parent | dcfe2666ffd6316b764801db82092bc62db56e6f (diff) |
[PATCH] ps3: Preallocate bootmem memory for ps3fb
Preallocate bootmem memory for the PS3 frame buffer device, which needs a
large block of physically-contiguous memory. The size of this memory block is
configurable:
- The config option CONFIG_FB_PS3_DEFAULT_SIZE_M allows to specify the
default amount of memory (in MiB) allocated to the virtual frame buffer.
- The early boot parameter `ps3fb=xxx' allows to override the default value.
It will be rounded up to a multiple of 1 MiB, if needed.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/powerpc/platforms/ps3/setup.c | 42 | ||||
-rw-r--r-- | include/asm-powerpc/ps3.h | 9 |
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 | |||
85 | static 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 | ||
102 | struct 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 | |||
109 | static 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 | } | ||
118 | early_param("ps3fb", early_parse_ps3fb); | ||
119 | #else | ||
120 | #define prealloc_ps3fb_videomemory() do { } while (0) | ||
121 | #endif | ||
122 | |||
123 | |||
83 | static void __init ps3_setup_arch(void) | 124 | static 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 | ||
389 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); | 389 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); |
390 | 390 | ||
391 | struct ps3_prealloc { | ||
392 | const char *name; | ||
393 | void *address; | ||
394 | unsigned long size; | ||
395 | unsigned long align; | ||
396 | }; | ||
397 | |||
398 | extern struct ps3_prealloc ps3fb_videomemory; | ||
399 | |||
391 | #endif | 400 | #endif |