aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/ps3/repository.c
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2011-08-11 15:31:06 -0400
committerGeoff Levand <geoff@infradead.org>2012-04-24 18:34:17 -0400
commit6750edbd8d6d1d72365e29e58b05f164bc23755a (patch)
tree4271c86d77401a9474a5e08e70fd547567a26b7e /arch/powerpc/platforms/ps3/repository.c
parent79f2a81bf117ffea757b0f298467333cf4e835a8 (diff)
powerpc/ps3: Add highmem repository read routines
Add repository helper routines to read highmem region info. Bootloaders that preallocate highmem regions must place the region info into the repository at these well known nodes. These routines allow second stage kernles to read the region info from those nodes. Signed-off-by: Andre Heider <a.heider@gmail.com> CC: Nathan Whitehorn <nwhitehorn@freebsd.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'arch/powerpc/platforms/ps3/repository.c')
-rw-r--r--arch/powerpc/platforms/ps3/repository.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index c73f3a68d2a7..9b47ba7a5de7 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -779,6 +779,72 @@ int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, u64 *region_total)
779} 779}
780 780
781/** 781/**
782 * ps3_repository_read_highmem_region_count - Read the number of highmem regions
783 *
784 * Bootloaders must arrange the repository nodes such that regions are indexed
785 * with a region_index from 0 to region_count-1.
786 */
787
788int ps3_repository_read_highmem_region_count(unsigned int *region_count)
789{
790 int result;
791 u64 v1 = 0;
792
793 result = read_node(PS3_LPAR_ID_CURRENT,
794 make_first_field("highmem", 0),
795 make_field("region", 0),
796 make_field("count", 0),
797 0,
798 &v1, NULL);
799 *region_count = v1;
800 return result;
801}
802
803
804int ps3_repository_read_highmem_base(unsigned int region_index,
805 u64 *highmem_base)
806{
807 return read_node(PS3_LPAR_ID_CURRENT,
808 make_first_field("highmem", 0),
809 make_field("region", region_index),
810 make_field("base", 0),
811 0,
812 highmem_base, NULL);
813}
814
815int ps3_repository_read_highmem_size(unsigned int region_index,
816 u64 *highmem_size)
817{
818 return read_node(PS3_LPAR_ID_CURRENT,
819 make_first_field("highmem", 0),
820 make_field("region", region_index),
821 make_field("size", 0),
822 0,
823 highmem_size, NULL);
824}
825
826/**
827 * ps3_repository_read_highmem_info - Read high memory region info
828 * @region_index: Region index, {0,..,region_count-1}.
829 * @highmem_base: High memory base address.
830 * @highmem_size: High memory size.
831 *
832 * Bootloaders that preallocate highmem regions must place the
833 * region info into the repository at these well known nodes.
834 */
835
836int ps3_repository_read_highmem_info(unsigned int region_index,
837 u64 *highmem_base, u64 *highmem_size)
838{
839 int result;
840
841 *highmem_base = 0;
842 result = ps3_repository_read_highmem_base(region_index, highmem_base);
843 return result ? result
844 : ps3_repository_read_highmem_size(region_index, highmem_size);
845}
846
847/**
782 * ps3_repository_read_num_spu_reserved - Number of physical spus reserved. 848 * ps3_repository_read_num_spu_reserved - Number of physical spus reserved.
783 * @num_spu: Number of physical spus. 849 * @num_spu: Number of physical spus.
784 */ 850 */