Skip to content

Commit

Permalink
mtd/ps3vram: Add ps3vram driver for accessing video RAM as MTD
Browse files Browse the repository at this point in the history
Add ps3vram driver, which exposes unused video RAM on the PS3 as a MTD
device suitable for storage or swap.  Fast data transfer is achieved
using a local cache in system RAM and DMA transfers via the GPU.

Signed-off-by: Vivien Chappelier <vivien.chappelier@free.fr>
Signed-off-by: Jim Paris <jim@jtan.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Jim Paris authored and Benjamin Herrenschmidt committed Jan 8, 2009
1 parent d2b4397 commit cffb4ad
Show file tree
Hide file tree
Showing 6 changed files with 828 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3484,6 +3484,12 @@ L: linuxppc-dev@ozlabs.org
L: cbe-oss-dev@ozlabs.org
S: Supported

PS3VRAM DRIVER
P: Jim Paris
M: jim@jtan.com
L: cbe-oss-dev@ozlabs.org
S: Maintained

PVRUSB2 VIDEO4LINUX DRIVER
P: Mike Isely
M: isely@pobox.com
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/ps3.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ enum ps3_match_id {

enum ps3_match_sub_id {
PS3_MATCH_SUB_ID_GPU_FB = 1,
PS3_MATCH_SUB_ID_GPU_RAMDISK = 2,
};

#define PS3_MODULE_ALIAS_EHCI "ps3:1:0"
Expand Down
37 changes: 37 additions & 0 deletions arch/powerpc/platforms/ps3/device-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,41 @@ static int __init ps3_register_graphics_devices(void)
return result;
}

static int __init ps3_register_ramdisk_device(void)
{
int result;
struct layout {
struct ps3_system_bus_device dev;
} *p;

pr_debug(" -> %s:%d\n", __func__, __LINE__);

p = kzalloc(sizeof(struct layout), GFP_KERNEL);

if (!p)
return -ENOMEM;

p->dev.match_id = PS3_MATCH_ID_GPU;
p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_RAMDISK;
p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;

result = ps3_system_bus_device_register(&p->dev);

if (result) {
pr_debug("%s:%d ps3_system_bus_device_register failed\n",
__func__, __LINE__);
goto fail_device_register;
}

pr_debug(" <- %s:%d\n", __func__, __LINE__);
return 0;

fail_device_register:
kfree(p);
pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
return result;
}

/**
* ps3_setup_dynamic_device - Setup a dynamic device from the repository
*/
Expand Down Expand Up @@ -946,6 +981,8 @@ static int __init ps3_register_devices(void)

ps3_register_lpm_devices();

ps3_register_ramdisk_device();

pr_debug(" <- %s:%d\n", __func__, __LINE__);
return 0;
}
Expand Down
7 changes: 7 additions & 0 deletions drivers/mtd/devices/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ config MTD_PHRAM
doesn't have access to, memory beyond the mem=xxx limit, nvram,
memory on the video card, etc...

config MTD_PS3VRAM
tristate "PS3 video RAM"
depends on FB_PS3
help
This driver allows you to use excess PS3 video RAM as volatile
storage or system swap.

config MTD_LART
tristate "28F160xx flash driver for LART"
depends on SA1100_LART
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/devices/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ obj-$(CONFIG_MTD_LART) += lart.o
obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
obj-$(CONFIG_MTD_M25P80) += m25p80.o
obj-$(CONFIG_MTD_PS3VRAM) += ps3vram.o
Loading

0 comments on commit cffb4ad

Please sign in to comment.