diff options
author | Geoff Levand <geoff@infradead.org> | 2012-03-31 21:03:30 -0400 |
---|---|---|
committer | Geoff Levand <geoff@infradead.org> | 2012-04-24 18:34:16 -0400 |
commit | 07c044c86e05818c2d5e99b8ff881e2e4543c6ad (patch) | |
tree | ef61e7e66c2129d59b94cdacbdc0a0459891fbbe /arch | |
parent | 08a6b25631b5f1984a963fd7cf9771898ebb07e5 (diff) |
powerpc/ps3: Add PS3 repository write support
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/ps3/Kconfig | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/repository.c | 58 |
2 files changed, 71 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig index 476d9d9b2405..4210aaae6e0d 100644 --- a/arch/powerpc/platforms/ps3/Kconfig +++ b/arch/powerpc/platforms/ps3/Kconfig | |||
@@ -88,6 +88,19 @@ config PS3_SYS_MANAGER | |||
88 | This support is required for system control. In | 88 | This support is required for system control. In |
89 | general, all users will say Y or M. | 89 | general, all users will say Y or M. |
90 | 90 | ||
91 | config PS3_REPOSITORY_WRITE | ||
92 | bool "PS3 Repository write support" if PS3_ADVANCED | ||
93 | depends on PPC_PS3 | ||
94 | default n | ||
95 | help | ||
96 | Enables support for writing to the PS3 System Repository. | ||
97 | |||
98 | This support is intended for bootloaders that need to store data | ||
99 | in the repository for later boot stages. | ||
100 | |||
101 | If in doubt, say N here and reduce the size of the kernel by a | ||
102 | small amount. | ||
103 | |||
91 | config PS3_STORAGE | 104 | config PS3_STORAGE |
92 | depends on PPC_PS3 | 105 | depends on PPC_PS3 |
93 | tristate | 106 | tristate |
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c index 7bdfea336f5e..b31142cb9e53 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c | |||
@@ -1002,6 +1002,64 @@ int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar, | |||
1002 | lpar, rights); | 1002 | lpar, rights); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | #if defined(CONFIG_PS3_REPOSITORY_WRITE) | ||
1006 | |||
1007 | static int create_node(u64 n1, u64 n2, u64 n3, u64 n4, u64 v1, u64 v2) | ||
1008 | { | ||
1009 | int result; | ||
1010 | |||
1011 | dump_node(0, n1, n2, n3, n4, v1, v2); | ||
1012 | |||
1013 | result = lv1_create_repository_node(n1, n2, n3, n4, v1, v2); | ||
1014 | |||
1015 | if (result) { | ||
1016 | pr_devel("%s:%d: lv1_create_repository_node failed: %s\n", | ||
1017 | __func__, __LINE__, ps3_result(result)); | ||
1018 | return -ENOENT; | ||
1019 | } | ||
1020 | |||
1021 | return 0; | ||
1022 | } | ||
1023 | |||
1024 | static int delete_node(u64 n1, u64 n2, u64 n3, u64 n4) | ||
1025 | { | ||
1026 | int result; | ||
1027 | |||
1028 | dump_node(0, n1, n2, n3, n4, 0, 0); | ||
1029 | |||
1030 | result = lv1_delete_repository_node(n1, n2, n3, n4); | ||
1031 | |||
1032 | if (result) { | ||
1033 | pr_devel("%s:%d: lv1_delete_repository_node failed: %s\n", | ||
1034 | __func__, __LINE__, ps3_result(result)); | ||
1035 | return -ENOENT; | ||
1036 | } | ||
1037 | |||
1038 | return 0; | ||
1039 | } | ||
1040 | |||
1041 | static int write_node(u64 n1, u64 n2, u64 n3, u64 n4, u64 v1, u64 v2) | ||
1042 | { | ||
1043 | int result; | ||
1044 | |||
1045 | result = create_node(n1, n2, n3, n4, v1, v2); | ||
1046 | |||
1047 | if (!result) | ||
1048 | return 0; | ||
1049 | |||
1050 | result = lv1_write_repository_node(n1, n2, n3, n4, v1, v2); | ||
1051 | |||
1052 | if (result) { | ||
1053 | pr_devel("%s:%d: lv1_write_repository_node failed: %s\n", | ||
1054 | __func__, __LINE__, ps3_result(result)); | ||
1055 | return -ENOENT; | ||
1056 | } | ||
1057 | |||
1058 | return 0; | ||
1059 | } | ||
1060 | |||
1061 | #endif /* defined(CONFIG_PS3_WRITE_REPOSITORY) */ | ||
1062 | |||
1005 | #if defined(DEBUG) | 1063 | #if defined(DEBUG) |
1006 | 1064 | ||
1007 | int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo) | 1065 | int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo) |