aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-31 21:13:36 -0400
committerGeoff Levand <geoff@infradead.org>2012-04-24 18:34:17 -0400
commit79f2a81bf117ffea757b0f298467333cf4e835a8 (patch)
tree3457e31d8f84cd62f1ec8f4a741b2c4e94c701da /arch
parent07c044c86e05818c2d5e99b8ff881e2e4543c6ad (diff)
powerpc/ps3: Add highmem repository write routines
Add routines to allow Linux based bootloaders to create and/or modify highmem region info in the PS3 system repository where it can be retrived by later boot stages. Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/ps3/platform.h9
-rw-r--r--arch/powerpc/platforms/ps3/repository.c74
2 files changed, 83 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 1a633ed0fe98..4012a86515cd 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -189,6 +189,15 @@ int ps3_repository_read_region_total(u64 *region_total);
189int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, 189int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
190 u64 *region_total); 190 u64 *region_total);
191 191
192int ps3_repository_write_highmem_region_count(unsigned int region_count);
193int ps3_repository_write_highmem_base(unsigned int region_index,
194 u64 highmem_base);
195int ps3_repository_write_highmem_size(unsigned int region_index,
196 u64 highmem_size);
197int ps3_repository_write_highmem_info(unsigned int region_index,
198 u64 highmem_base, u64 highmem_size);
199int ps3_repository_delete_highmem_info(unsigned int region_index);
200
192/* repository pme info */ 201/* repository pme info */
193 202
194int ps3_repository_read_num_be(unsigned int *num_be); 203int ps3_repository_read_num_be(unsigned int *num_be);
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index b31142cb9e53..c73f3a68d2a7 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -1058,6 +1058,80 @@ static int write_node(u64 n1, u64 n2, u64 n3, u64 n4, u64 v1, u64 v2)
1058 return 0; 1058 return 0;
1059} 1059}
1060 1060
1061int ps3_repository_write_highmem_region_count(unsigned int region_count)
1062{
1063 int result;
1064 u64 v1 = (u64)region_count;
1065
1066 result = write_node(
1067 make_first_field("highmem", 0),
1068 make_field("region", 0),
1069 make_field("count", 0),
1070 0,
1071 v1, 0);
1072 return result;
1073}
1074
1075int ps3_repository_write_highmem_base(unsigned int region_index,
1076 u64 highmem_base)
1077{
1078 return write_node(
1079 make_first_field("highmem", 0),
1080 make_field("region", region_index),
1081 make_field("base", 0),
1082 0,
1083 highmem_base, 0);
1084}
1085
1086int ps3_repository_write_highmem_size(unsigned int region_index,
1087 u64 highmem_size)
1088{
1089 return write_node(
1090 make_first_field("highmem", 0),
1091 make_field("region", region_index),
1092 make_field("size", 0),
1093 0,
1094 highmem_size, 0);
1095}
1096
1097int ps3_repository_write_highmem_info(unsigned int region_index,
1098 u64 highmem_base, u64 highmem_size)
1099{
1100 int result;
1101
1102 result = ps3_repository_write_highmem_base(region_index, highmem_base);
1103 return result ? result
1104 : ps3_repository_write_highmem_size(region_index, highmem_size);
1105}
1106
1107static int ps3_repository_delete_highmem_base(unsigned int region_index)
1108{
1109 return delete_node(
1110 make_first_field("highmem", 0),
1111 make_field("region", region_index),
1112 make_field("base", 0),
1113 0);
1114}
1115
1116static int ps3_repository_delete_highmem_size(unsigned int region_index)
1117{
1118 return delete_node(
1119 make_first_field("highmem", 0),
1120 make_field("region", region_index),
1121 make_field("size", 0),
1122 0);
1123}
1124
1125int ps3_repository_delete_highmem_info(unsigned int region_index)
1126{
1127 int result;
1128
1129 result = ps3_repository_delete_highmem_base(region_index);
1130 result += ps3_repository_delete_highmem_size(region_index);
1131
1132 return result ? -1 : 0;
1133}
1134
1061#endif /* defined(CONFIG_PS3_WRITE_REPOSITORY) */ 1135#endif /* defined(CONFIG_PS3_WRITE_REPOSITORY) */
1062 1136
1063#if defined(DEBUG) 1137#if defined(DEBUG)