summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/image/sbe_default_tool.c36
-rwxr-xr-xtools/scripts/ppeCreateAttrGetSetMacros.pl33
2 files changed, 48 insertions, 21 deletions
diff --git a/tools/image/sbe_default_tool.c b/tools/image/sbe_default_tool.c
index 975c017d..3bd90438 100644
--- a/tools/image/sbe_default_tool.c
+++ b/tools/image/sbe_default_tool.c
@@ -50,37 +50,37 @@ void assertTarget(const char* str, unsigned int index)
if (index > 0) {
fprintf(stderr, "sbe_default_tool: index (%d) is larger than 0\n", index);
exit(1);
- }
+ }
} else if(strcmp(str, "TARGET_TYPE_EX") == 0) {
if (index > EX_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n",
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n",
index, EX_TARGET_COUNT);
exit(1);
- }
+ }
} else if(strcmp(str, "TARGET_TYPE_EQ") == 0) {
if (index > EQ_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n",
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n",
index, EQ_TARGET_COUNT);
exit(1);
- }
+ }
} else if(strcmp(str, "TARGET_TYPE_CORE") == 0) {
if (index > CORE_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n",
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n",
index, CORE_TARGET_COUNT);
exit(1);
- }
+ }
} else if(strcmp(str, "TARGET_TYPE_PERV") == 0) {
if (index > PERV_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n",
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n",
index, PERV_TARGET_COUNT);
exit(1);
- }
+ }
} else {
if (index >= PERV_TARGET_COUNT) {
fprintf(stderr, "sbe_default_tool: target not supported:");
fprintf(stderr, " %s\n", str);
exit(1);
- }
+ }
}
return;
}
@@ -176,17 +176,17 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) {
fprintf(stderr, " %s", attribute);
exit(1);
}
-
+
sbe_xip_image2host(image, item.iv_address, &thePointer);
if(item.iv_toc->iv_type == SBE_XIP_UINT8) {
val = *((uint8_t*)thePointer + (index * sizeof(uint8_t)));
-
+
} else if(item.iv_toc->iv_type == SBE_XIP_INT8) {
val = *((int8_t*)thePointer + (index * sizeof(int8_t)));
- val &= 0xFF;
+ val &= 0xFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT16) {
@@ -195,7 +195,7 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) {
} else if(item.iv_toc->iv_type == SBE_XIP_INT16) {
val = xipRevLe16(*((int16_t*)thePointer + (index * sizeof(int16_t))));
- val &= 0xFFFF;
+ val &= 0xFFFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT32) {
@@ -204,7 +204,7 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) {
} else if(item.iv_toc->iv_type == SBE_XIP_INT32) {
val = xipRevLe32(*((int32_t*)thePointer + (index * sizeof(int32_t))));
- val &= 0xFFFFFFFF;
+ val &= 0xFFFFFFFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT64) {
@@ -235,7 +235,7 @@ int main(int argc, const char** argv)
fprintf(stderr, "sbe_default_tool: argument missing\n");
fprintf(stderr, g_usage);
exit(1);
- }
+ }
printf("sbe_default_tool %s %s %s %s %s\n", argv[1], argv[2], argv[3], argv[4], argv[5]);
@@ -269,7 +269,7 @@ int main(int argc, const char** argv)
uint64_t check = getAttribute(image, argv[2], index);
if((check & val) != check) {
-
+
fprintf(stderr, "sbe_default_tool: set and get values not equal -> ");
fprintf(stderr, "%lx != %lx\n", check, val);
exit(1);
@@ -282,6 +282,6 @@ int main(int argc, const char** argv)
exit(1);
}
-
+
return 0;
}
diff --git a/tools/scripts/ppeCreateAttrGetSetMacros.pl b/tools/scripts/ppeCreateAttrGetSetMacros.pl
index bdbbcae3..7ac64372 100755
--- a/tools/scripts/ppeCreateAttrGetSetMacros.pl
+++ b/tools/scripts/ppeCreateAttrGetSetMacros.pl
@@ -271,10 +271,15 @@ for my $attribute (sort keys %{$enums{AttributeId}}) {
$targetImplementation .= "\n" . $targetFunction . "\n{\n *o_pvalue = object->fapi2attr::${macroTarget}::${attribute};\n}\n";
- } else {
+ } elsif($targetMacro eq "TARGET_TYPE_PERV") {
- $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *o_pvalue = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n";
+ $targetImplementation .= "\n" . $targetFunction .
+"\n{
+ *o_pvalue = object->fapi2attr::${macroTarget}::${attribute}[getPervAttrIndex(i_ptarget)];
+}\n";
+ } else {
+$targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *o_pvalue = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"
}
push(@newTargetImplementations, $targetImplementation);
}
@@ -363,7 +368,29 @@ if (@newAttributeDefines != 0) {
print OUTFILE "#include \"proc_sbe_fixed.H\"\n";
print OUTFILE "#include \"plat_target_parms.H\"\n\n";
print OUTFILE "namespace fapi2 {\n";
-
+ print OUTFILE "
+uint32_t getPervAttrIndex(const fapi2::Target<TARGET_TYPE_PERV> &i_target)
+{
+ uint32_t l_index = i_target.getTargetNumber();
+ if(TARGET_TYPE_EQ & i_target.getTargetType())
+ {
+ l_index += (EQ_TARGET_OFFSET);
+ }
+ else if(TARGET_TYPE_CORE & i_target.getTargetType())
+ {
+ l_index += (CORE_TARGET_OFFSET);
+ }
+ else if(TARGET_TYPE_MCS & i_target.getTargetType())
+ {
+ l_index += (MCS_TARGET_OFFSET);
+ }
+ else
+ {
+ l_index += (NEST_GROUP1_TARGET_OFFSET);
+ }
+ return (l_index - NEST_GROUP1_TARGET_OFFSET);
+}
+";
foreach my $impl (@newTargetImplementations) {
OpenPOWER on IntegriCloud