powerpc/ps3: Add PS3 repository write support
authorGeoff Levand <geoff@infradead.org>
Sun, 1 Apr 2012 01:03:30 +0000 (18:03 -0700)
committerGeoff Levand <geoff@infradead.org>
Tue, 24 Apr 2012 22:34:16 +0000 (15:34 -0700)
Add a new config option CONFIG_PS3_REPOSITORY_WRITE that
conditionally builds in support to create, write and delete
nodes in the PS3 system repository.

This support will allow Linux based bootloaders to manage data
in the system repository for use by later boot stages,

Signed-off-by: Geoff Levand <geoff@infradead.org>
arch/powerpc/platforms/ps3/Kconfig
arch/powerpc/platforms/ps3/repository.c

index 476d9d9b24058d705b481cdf7285e4c76b339cb1..4210aaae6e0d93a0326077572fbcb6a1969c943b 100644 (file)
@@ -88,6 +88,19 @@ config PS3_SYS_MANAGER
          This support is required for system control.  In
          general, all users will say Y or M.
 
+config PS3_REPOSITORY_WRITE
+       bool "PS3 Repository write support" if PS3_ADVANCED
+       depends on PPC_PS3
+       default n
+       help
+         Enables support for writing to the PS3 System Repository.
+
+         This support is intended for bootloaders that need to store data
+         in the repository for later boot stages.
+
+         If in doubt, say N here and reduce the size of the kernel by a
+         small amount.
+
 config PS3_STORAGE
        depends on PPC_PS3
        tristate
index 7bdfea336f5e3b7a3e3ccae07401594f3e14d0ef..b31142cb9e53965f075fcc5bfb1598dec37d400f 100644 (file)
@@ -1002,6 +1002,64 @@ int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar,
                            lpar, rights);
 }
 
+#if defined(CONFIG_PS3_REPOSITORY_WRITE)
+
+static int create_node(u64 n1, u64 n2, u64 n3, u64 n4, u64 v1, u64 v2)
+{
+       int result;
+
+       dump_node(0, n1, n2, n3, n4, v1, v2);
+
+       result = lv1_create_repository_node(n1, n2, n3, n4, v1, v2);
+
+       if (result) {
+               pr_devel("%s:%d: lv1_create_repository_node failed: %s\n",
+                       __func__, __LINE__, ps3_result(result));
+               return -ENOENT;
+       }
+
+       return 0;
+}
+
+static int delete_node(u64 n1, u64 n2, u64 n3, u64 n4)
+{
+       int result;
+
+       dump_node(0, n1, n2, n3, n4, 0, 0);
+
+       result = lv1_delete_repository_node(n1, n2, n3, n4);
+
+       if (result) {
+               pr_devel("%s:%d: lv1_delete_repository_node failed: %s\n",
+                       __func__, __LINE__, ps3_result(result));
+               return -ENOENT;
+       }
+
+       return 0;
+}
+
+static int write_node(u64 n1, u64 n2, u64 n3, u64 n4, u64 v1, u64 v2)
+{
+       int result;
+
+       result = create_node(n1, n2, n3, n4, v1, v2);
+
+       if (!result)
+               return 0;
+
+       result = lv1_write_repository_node(n1, n2, n3, n4, v1, v2);
+
+       if (result) {
+               pr_devel("%s:%d: lv1_write_repository_node failed: %s\n",
+                       __func__, __LINE__, ps3_result(result));
+               return -ENOENT;
+       }
+
+       return 0;
+}
+
+#endif /* defined(CONFIG_PS3_WRITE_REPOSITORY) */
+
 #if defined(DEBUG)
 
 int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo)
This page took 0.038782 seconds and 5 git commands to generate.