[Cbe-oss-dev] [PATCH 3/3] ps3vram: extend size parameter and change default
Jim Paris
jim at jtan.com
Tue Apr 29 09:21:59 EST 2008
Accept trailing '-' on ps3vram.size parameter to indicate that we
should subtract off ps3fb_videomemory.size, and make "256M-" the
default. This will allow us to leave space for the framebuffer if
ps3vram is loaded first (once that is supported).
Signed-off-by: Jim Paris <jim at jtan.com>
---
drivers/mtd/devices/ps3vram.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/devices/ps3vram.c b/drivers/mtd/devices/ps3vram.c
index c6a9f9e..5c1ef26 100644
--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -92,7 +92,8 @@ struct ps3vram_priv {
#define NOTIFIER 8 /* notifier used for completion report */
-char *size = "256M";
+/* A trailing '-' means to subtract off ps3fb_videomemory.size */
+char *size = "256M-";
module_param(size, charp, 0);
MODULE_PARM_DESC(size, "memory size");
@@ -605,7 +606,8 @@ static int __init init_ps3vram(void)
{
struct ps3vram_priv *priv;
uint64_t status;
- uint64_t ddr_lpar, ddr_size, ctrl_lpar, info_lpar, reports_lpar;
+ uint64_t ddr_lpar, ctrl_lpar, info_lpar, reports_lpar;
+ int64_t ddr_size;
uint64_t reports_size;
int ret = -ENOMEM;
char *rest;
@@ -641,9 +643,11 @@ static int __init init_ps3vram(void)
/* Request memory */
status = -1;
ddr_size = memparse(size, &rest);
+ if (*rest == '-')
+ ddr_size -= ps3fb_videomemory.size;
ddr_size = ALIGN(ddr_size, 1024*1024);
- if (ddr_size == 0) {
- printk(KERN_ERR "ps3vram: specified size is zero\n");
+ if (ddr_size <= 0) {
+ printk(KERN_ERR "ps3vram: specified size is too small\n");
ret = -EINVAL;
goto out_close_gpu;
}
@@ -656,7 +660,7 @@ static int __init init_ps3vram(void)
break;
ddr_size -= 1024*1024;
}
- if (status != 0 || ddr_size == 0) {
+ if (status != 0 || ddr_size <= 0) {
pr_err("ps3vram: lv1_gpu_memory_allocate failed\n");
ret = -ENOMEM;
goto out_free_xdr_buf;
--
1.5.5
More information about the cbe-oss-dev
mailing list