diff options
author | Takashi Yamamoto <TakashiA.Yamamoto@jp.sony.com> | 2008-01-18 15:32:31 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-25 06:52:52 -0500 |
commit | c2b16e1c1050b3cb3a63943eafc99ae86b8f51c3 (patch) | |
tree | a4cb647d0cbc83bd789e93a31c25f0f18e2e6263 /arch | |
parent | 720c9133ff108998c5fb910d165146de5bc4705a (diff) |
[POWERPC] PS3: Add logical performance monitor repository routines
Add repository routines for the PS3 Logical Performance Monitor.
Signed-off-by: Takashi Yamamoto <TakashiA.Yamamoto@jp.sony.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/ps3/platform.h | 12 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/repository.c | 75 |
2 files changed, 83 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 7af1231e77b9..235c13ebacd9 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h | |||
@@ -180,10 +180,10 @@ int ps3_repository_read_stor_dev_region(unsigned int bus_index, | |||
180 | unsigned int dev_index, unsigned int region_index, | 180 | unsigned int dev_index, unsigned int region_index, |
181 | unsigned int *region_id, u64 *region_start, u64 *region_size); | 181 | unsigned int *region_id, u64 *region_start, u64 *region_size); |
182 | 182 | ||
183 | /* repository pu and memory info */ | 183 | /* repository logical pu and memory info */ |
184 | 184 | ||
185 | int ps3_repository_read_num_pu(unsigned int *num_pu); | 185 | int ps3_repository_read_num_pu(u64 *num_pu); |
186 | int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); | 186 | int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id); |
187 | int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); | 187 | int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); |
188 | int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); | 188 | int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); |
189 | int ps3_repository_read_region_total(u64 *region_total); | 189 | int ps3_repository_read_region_total(u64 *region_total); |
@@ -194,9 +194,15 @@ int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, | |||
194 | 194 | ||
195 | int ps3_repository_read_num_be(unsigned int *num_be); | 195 | int ps3_repository_read_num_be(unsigned int *num_be); |
196 | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); | 196 | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); |
197 | int ps3_repository_read_be_id(u64 node_id, u64 *be_id); | ||
197 | int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); | 198 | int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); |
198 | int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); | 199 | int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); |
199 | 200 | ||
201 | /* repository performance monitor info */ | ||
202 | |||
203 | int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar, | ||
204 | u64 *rights); | ||
205 | |||
200 | /* repository 'Other OS' area */ | 206 | /* repository 'Other OS' area */ |
201 | 207 | ||
202 | int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); | 208 | int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); |
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c index cded41eab10f..22063adeb38b 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c | |||
@@ -711,6 +711,35 @@ int ps3_repository_read_stor_dev_region(unsigned int bus_index, | |||
711 | return result; | 711 | return result; |
712 | } | 712 | } |
713 | 713 | ||
714 | /** | ||
715 | * ps3_repository_read_num_pu - Number of logical PU processors for this lpar. | ||
716 | */ | ||
717 | |||
718 | int ps3_repository_read_num_pu(u64 *num_pu) | ||
719 | { | ||
720 | *num_pu = 0; | ||
721 | return read_node(PS3_LPAR_ID_CURRENT, | ||
722 | make_first_field("bi", 0), | ||
723 | make_field("pun", 0), | ||
724 | 0, 0, | ||
725 | num_pu, NULL); | ||
726 | } | ||
727 | |||
728 | /** | ||
729 | * ps3_repository_read_pu_id - Read the logical PU id. | ||
730 | * @pu_index: Zero based index. | ||
731 | * @pu_id: The logical PU id. | ||
732 | */ | ||
733 | |||
734 | int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id) | ||
735 | { | ||
736 | return read_node(PS3_LPAR_ID_CURRENT, | ||
737 | make_first_field("bi", 0), | ||
738 | make_field("pu", pu_index), | ||
739 | 0, 0, | ||
740 | pu_id, NULL); | ||
741 | } | ||
742 | |||
714 | int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size) | 743 | int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size) |
715 | { | 744 | { |
716 | return read_node(PS3_LPAR_ID_CURRENT, | 745 | return read_node(PS3_LPAR_ID_CURRENT, |
@@ -883,6 +912,10 @@ int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size) | |||
883 | : ps3_repository_read_boot_dat_size(size); | 912 | : ps3_repository_read_boot_dat_size(size); |
884 | } | 913 | } |
885 | 914 | ||
915 | /** | ||
916 | * ps3_repository_read_num_be - Number of physical BE processors in the system. | ||
917 | */ | ||
918 | |||
886 | int ps3_repository_read_num_be(unsigned int *num_be) | 919 | int ps3_repository_read_num_be(unsigned int *num_be) |
887 | { | 920 | { |
888 | int result; | 921 | int result; |
@@ -898,6 +931,12 @@ int ps3_repository_read_num_be(unsigned int *num_be) | |||
898 | return result; | 931 | return result; |
899 | } | 932 | } |
900 | 933 | ||
934 | /** | ||
935 | * ps3_repository_read_be_node_id - Read the physical BE processor node id. | ||
936 | * @be_index: Zero based index. | ||
937 | * @node_id: The BE processor node id. | ||
938 | */ | ||
939 | |||
901 | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id) | 940 | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id) |
902 | { | 941 | { |
903 | return read_node(PS3_LPAR_ID_PME, | 942 | return read_node(PS3_LPAR_ID_PME, |
@@ -908,6 +947,22 @@ int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id) | |||
908 | node_id, NULL); | 947 | node_id, NULL); |
909 | } | 948 | } |
910 | 949 | ||
950 | /** | ||
951 | * ps3_repository_read_be_id - Read the physical BE processor id. | ||
952 | * @node_id: The BE processor node id. | ||
953 | * @be_id: The BE processor id. | ||
954 | */ | ||
955 | |||
956 | int ps3_repository_read_be_id(u64 node_id, u64 *be_id) | ||
957 | { | ||
958 | return read_node(PS3_LPAR_ID_PME, | ||
959 | make_first_field("be", 0), | ||
960 | node_id, | ||
961 | 0, | ||
962 | 0, | ||
963 | be_id, NULL); | ||
964 | } | ||
965 | |||
911 | int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq) | 966 | int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq) |
912 | { | 967 | { |
913 | return read_node(PS3_LPAR_ID_PME, | 968 | return read_node(PS3_LPAR_ID_PME, |
@@ -924,11 +979,29 @@ int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq) | |||
924 | u64 node_id; | 979 | u64 node_id; |
925 | 980 | ||
926 | *tb_freq = 0; | 981 | *tb_freq = 0; |
927 | result = ps3_repository_read_be_node_id(0, &node_id); | 982 | result = ps3_repository_read_be_node_id(be_index, &node_id); |
928 | return result ? result | 983 | return result ? result |
929 | : ps3_repository_read_tb_freq(node_id, tb_freq); | 984 | : ps3_repository_read_tb_freq(node_id, tb_freq); |
930 | } | 985 | } |
931 | 986 | ||
987 | int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar, | ||
988 | u64 *rights) | ||
989 | { | ||
990 | int result; | ||
991 | u64 node_id; | ||
992 | |||
993 | *lpar = 0; | ||
994 | *rights = 0; | ||
995 | result = ps3_repository_read_be_node_id(be_index, &node_id); | ||
996 | return result ? result | ||
997 | : read_node(PS3_LPAR_ID_PME, | ||
998 | make_first_field("be", 0), | ||
999 | node_id, | ||
1000 | make_field("lpm", 0), | ||
1001 | make_field("priv", 0), | ||
1002 | lpar, rights); | ||
1003 | } | ||
1004 | |||
932 | #if defined(DEBUG) | 1005 | #if defined(DEBUG) |
933 | 1006 | ||
934 | int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo) | 1007 | int ps3_repository_dump_resource_info(const struct ps3_repository_device *repo) |