From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: [PATCH 6/10] ps3: Preallocate bootmem memory for ps3fb Date: Thu, 8 Feb 2007 14:59:22 +0100 (CET) Message-ID: References: Reply-To: linux-fbdev-devel@lists.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1HF9o9-0001rj-5u for linux-fbdev-devel@lists.sourceforge.net; Thu, 08 Feb 2007 05:59:29 -0800 Received: from [80.88.33.193] (helo=vervifontaine.sonycom.com) by mail.sourceforge.net with esmtp (Exim 4.44) id 1HF9o8-00087h-NB for linux-fbdev-devel@lists.sourceforge.net; Thu, 08 Feb 2007 05:59:29 -0800 In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-fbdev-devel-bounces@lists.sourceforge.net Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: Andrew Morton Cc: Paul Mackerras , James Simmons , Linux Frame Buffer Device Development , Linux/PPC Development 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 Signed-off-by: Geoff Levand --- arch/powerpc/platforms/ps3/setup.c | 42 +++++++++++++++++++++++++++++++++++++ include/asm-powerpc/ps3.h | 9 +++++++ 2 files changed, 51 insertions(+) --- ps3-linux-2.6.20.orig/arch/powerpc/platforms/ps3/setup.c +++ ps3-linux-2.6.20/arch/powerpc/platforms/ps3/setup.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,46 @@ static void ps3_panic(char *str) for (;;) ; } + +static void prealloc(struct ps3_prealloc *p) +{ + if (!p->size) + return; + + p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS)); + if (!p->address) { + printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__, + p->name); + return; + } + + printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size, + p->address); +} + +#ifdef CONFIG_FB_PS3 +struct ps3_prealloc ps3fb_videomemory = { + .name = "ps3fb videomemory", + .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024, + .align = 1024*1024 /* the GPU requires 1 MiB alignment */ +}; +#define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory) + +static int __init early_parse_ps3fb(char *p) +{ + if (!p) + return 1; + + ps3fb_videomemory.size = _ALIGN_UP(memparse(p, &p), + ps3fb_videomemory.align); + return 0; +} +early_param("ps3fb", early_parse_ps3fb); +#else +#define prealloc_ps3fb_videomemory() do { } while (0) +#endif + + static void __init ps3_setup_arch(void) { DBG(" -> %s:%d\n", __func__, __LINE__); @@ -87,6 +128,7 @@ static void __init ps3_setup_arch(void) conswitchp = &dummy_con; #endif + prealloc_ps3fb_videomemory(); ppc_md.power_save = ps3_power_save; DBG(" <- %s:%d\n", __func__, __LINE__); --- ps3-linux-2.6.20.orig/include/asm-powerpc/ps3.h +++ ps3-linux-2.6.20/include/asm-powerpc/ps3.h @@ -459,4 +459,13 @@ static inline void *ps3_system_bus_get_d extern struct bus_type ps3_system_bus_type; +struct ps3_prealloc { + const char *name; + void *address; + unsigned long size; + unsigned long align; +}; + +extern struct ps3_prealloc ps3fb_videomemory; + #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) Geert.Uytterhoeven@sonycom.com ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vervifontaine.sonycom.com (unknown [80.88.33.193]) by ozlabs.org (Postfix) with ESMTP id DA2FDDE54D for ; Fri, 9 Feb 2007 00:59:23 +1100 (EST) Date: Thu, 8 Feb 2007 14:59:22 +0100 (CET) From: Geert Uytterhoeven Sender: geert@sonytel.be To: Andrew Morton Subject: [PATCH 6/10] ps3: Preallocate bootmem memory for ps3fb In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Paul Mackerras , James Simmons , Linux Frame Buffer Device Development , Linux/PPC Development List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Signed-off-by: Geoff Levand --- arch/powerpc/platforms/ps3/setup.c | 42 +++++++++++++++++++++++++++++++++++++ include/asm-powerpc/ps3.h | 9 +++++++ 2 files changed, 51 insertions(+) --- ps3-linux-2.6.20.orig/arch/powerpc/platforms/ps3/setup.c +++ ps3-linux-2.6.20/arch/powerpc/platforms/ps3/setup.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,46 @@ static void ps3_panic(char *str) for (;;) ; } + +static void prealloc(struct ps3_prealloc *p) +{ + if (!p->size) + return; + + p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS)); + if (!p->address) { + printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__, + p->name); + return; + } + + printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size, + p->address); +} + +#ifdef CONFIG_FB_PS3 +struct ps3_prealloc ps3fb_videomemory = { + .name = "ps3fb videomemory", + .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024, + .align = 1024*1024 /* the GPU requires 1 MiB alignment */ +}; +#define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory) + +static int __init early_parse_ps3fb(char *p) +{ + if (!p) + return 1; + + ps3fb_videomemory.size = _ALIGN_UP(memparse(p, &p), + ps3fb_videomemory.align); + return 0; +} +early_param("ps3fb", early_parse_ps3fb); +#else +#define prealloc_ps3fb_videomemory() do { } while (0) +#endif + + static void __init ps3_setup_arch(void) { DBG(" -> %s:%d\n", __func__, __LINE__); @@ -87,6 +128,7 @@ static void __init ps3_setup_arch(void) conswitchp = &dummy_con; #endif + prealloc_ps3fb_videomemory(); ppc_md.power_save = ps3_power_save; DBG(" <- %s:%d\n", __func__, __LINE__); --- ps3-linux-2.6.20.orig/include/asm-powerpc/ps3.h +++ ps3-linux-2.6.20/include/asm-powerpc/ps3.h @@ -459,4 +459,13 @@ static inline void *ps3_system_bus_get_d extern struct bus_type ps3_system_bus_type; +struct ps3_prealloc { + const char *name; + void *address; + unsigned long size; + unsigned long align; +}; + +extern struct ps3_prealloc ps3fb_videomemory; + #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) Geert.Uytterhoeven@sonycom.com ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium