Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andre Heider and committed by
Geoff Levand
6750edbd 79f2a81b

+73
+7
arch/powerpc/platforms/ps3/platform.h
··· 188 188 int ps3_repository_read_region_total(u64 *region_total); 189 189 int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, 190 190 u64 *region_total); 191 + int ps3_repository_read_highmem_region_count(unsigned int *region_count); 192 + int ps3_repository_read_highmem_base(unsigned int region_index, 193 + u64 *highmem_base); 194 + int ps3_repository_read_highmem_size(unsigned int region_index, 195 + u64 *highmem_size); 196 + int ps3_repository_read_highmem_info(unsigned int region_index, 197 + u64 *highmem_base, u64 *highmem_size); 191 198 192 199 int ps3_repository_write_highmem_region_count(unsigned int region_count); 193 200 int ps3_repository_write_highmem_base(unsigned int region_index,
+66
arch/powerpc/platforms/ps3/repository.c
··· 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 + 788 + int 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 + 804 + int 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 + 815 + int 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 + 836 + int 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 848 * ps3_repository_read_num_spu_reserved - Number of physical spus reserved. 783 849 * @num_spu: Number of physical spus. 784 850 */