summaryrefslogtreecommitdiffstats
path: root/tools/image
diff options
context:
space:
mode:
authorGreg Still <stillgs@us.ibm.com>2015-07-20 07:27:48 -0500
committerAmit J. Tendolkar <amit.tendolkar@in.ibm.com>2015-08-19 11:07:29 -0500
commitf3c18a2e5d3af5d66100b502091f636d219c3655 (patch)
treea5467166a2032e474059d1b3fcb4658d6c29f131 /tools/image
parent316f046100d70f6d8f0e1eda0174f49a797c1264 (diff)
downloadtalos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.tar.gz
talos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.zip
Honor PPE partial good attributes to intialize targets
- Addressed internal Gerrit comments - Addressed compilation issues with real procedures - Fix image tool "clean" function (updated) (deals with missing tools/image/bin) - make "clean" fixup - Get vector of attribute values properly into the image - Fix FAPI_ATTR_* signature from target pointer to target reference - ATTR_CHIP_UNIT_POS support for non-core/cache chiplets - Require FAPI_ATTR_GET/SET invocation to be in the form of fapi2::ATTR_.... - Fix tools bin directory creation issue - Address plat_PervPGTargets error case - Add FAPI_EXEC_HW support to deal with recently merged functions - Update libcommonerrors.mk to deal with recently merged compilation issue Change-Id: I31485ff05731e7fbaa0453d8ed9985b9ca56b8b3 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19342 Tested-by: Jenkins Server Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'tools/image')
-rw-r--r--tools/image/Makefile45
-rw-r--r--tools/image/bin/.empty0
-rw-r--r--tools/image/sbe_default_tool.c65
-rw-r--r--tools/image/sbe_xip_tool.c34
4 files changed, 55 insertions, 89 deletions
diff --git a/tools/image/Makefile b/tools/image/Makefile
index 0afc09ee..a7da7ae9 100644
--- a/tools/image/Makefile
+++ b/tools/image/Makefile
@@ -20,36 +20,6 @@ $(warning CTEPATH not defined; defaulting to awd)
CTEPATH = /afs/awd/projects/cte
endif
-
-# Are we setup for eCMD, if so let's get our eCMD Release from there
-ifneq ($(strip $(ECMD_RELEASE)),)
- ECMD_RELEASE := $(shell ecmdVersion full)
- # Make sure we got a valid version back
- ifeq ($(findstring ver,$(ECMD_RELEASE)),)
- ECMD_RELEASE := rel
- endif
-else
- # If not setup for eCMD, default to rel
- ECMD_RELEASE := rel
-endif
-
-
-# Ok, now set our eCMD Path, if not set already
-ifeq ($(strip $(ECMD_PATH)),)
- ECMD_PATH := ${CTEPATH}/tools/ecmd/${ECMD_RELEASE}/
-endif
-
-ifeq ($(strip $(ECMD_PLUGIN)),cro)
-# Cronus plugin specific setup
- CRONUS_PATH := $(shell echo ${ECMD_EXE} | sed -n 's|\([a-zA-Z0-9]*\)\(_*\)\([a-zA-Z0-9]*\)_x86\.exe|prcd_d|p')
- ifeq ($(strip $(CRONUS_PATH)),)
- $(error "Error determining CRONUS_PATH from env!")
- endif
-endif
-
-# We need common up-to-date headers for FAPI - currently using these.
-FAPI = $(ECMD_PATH)ext/fapi
-
# Locations of required headers.
INCLUDES += -I. -I../../ -I../../utils
INCLUDES += -I ../../sbe/image/
@@ -63,10 +33,6 @@ INCLUDES += -I ../../pk/trace/
INCLUDES += -I ../../tools/ppetracepp/
INCLUDES += -I ../../importtemp/fapi2/include/
-INCLUDES += -I$(CRONUS_PATH)
-INCLUDES += -I$(ECMD_PATH)/capi
-INCLUDES += -I$(FAPI)/capi
-
# Under Linux the scheme is to use a common compiler to create procedures.
# However, the common compiler can be VERY slow, so if the system compiler is
# also 4.1.2 we're using that one instead. Also, the Linux FAPI libraries we
@@ -101,8 +67,11 @@ UTILITIES-DEPENDENCIES = $(patsubst %.o,%.d,$(UTILITIES-OBJECTS))
UTILITIES-EXECUTABLES = $(patsubst %,bin/%,$(UTILITIES))
-.PHONY : utilities
-utilities: $(UTILITIES-EXECUTABLES)
+.PHONY : utilities buildBinDir
+utilities: buildBinDir $(UTILITIES-EXECUTABLES)
+
+buildBinDir:
+ mkdir -p bin
bin/%.o: %.c
$(CXX) -std=c++11 $(INCLUDES) $(CXXFLAGS) -DDEBUG_SBE_XIP_IMAGE=1 -DFAPI2_NO_FFDC -c -o $@ $<
@@ -119,6 +88,6 @@ bin/sbe_default_tool: bin/sbe_xip_image.o bin/sbe_default_tool.o
ln -sf bin/sbe_default_tool sbe_default_tool
clean:
- rm sbe_xip_tool sbe_default_tool
+ rm -f sbe_xip_tool sbe_default_tool
rm -rf bin
- mkdir -p bin \ No newline at end of file
+ mkdir -p bin
diff --git a/tools/image/bin/.empty b/tools/image/bin/.empty
deleted file mode 100644
index e69de29b..00000000
--- a/tools/image/bin/.empty
+++ /dev/null
diff --git a/tools/image/sbe_default_tool.c b/tools/image/sbe_default_tool.c
index 2b1679ef..817eee09 100644
--- a/tools/image/sbe_default_tool.c
+++ b/tools/image/sbe_default_tool.c
@@ -18,6 +18,7 @@
#define __PPE__
#include "fapi2.H"
#include "proc_sbe_fixed.H"
+#include "sbe_xip_image.h"
const char* g_usage =
"Usage: sbe_default_tool <image> <attribute> <value> <target type> <index>\n"
@@ -46,31 +47,35 @@ void assertTarget(const char* str, unsigned int index)
if(strcmp(str, "TARGET_TYPE_PROC_CHIP") == 0) {
if (index > 0) {
- fprintf(stderr, "sbe_default_tool: index is larger than 0\n");
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than 0\n", index);
exit(1);
}
return;
} else if(strcmp(str, "TARGET_TYPE_EX") == 0) {
- if (index >= EX_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index is larger than EX_TARGET_COUNT\n");
+ if (index > EX_TARGET_COUNT) {
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n",
+ index, EX_TARGET_COUNT);
exit(1);
}
return;
} else if(strcmp(str, "TARGET_TYPE_EQ") == 0) {
- if (index >= EQ_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n");
+ if (index > EQ_TARGET_COUNT) {
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n",
+ index, EQ_TARGET_COUNT);
exit(1);
}
return;
} else if(strcmp(str, "TARGET_TYPE_CORE") == 0) {
- if (index >= CORE_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n");
+ if (index > CORE_TARGET_COUNT) {
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n",
+ index, CORE_TARGET_COUNT);
exit(1);
}
return;
} else if(strcmp(str, "TARGET_TYPE_PERV") == 0) {
- if (index >= PERV_TARGET_COUNT) {
- fprintf(stderr, "sbe_default_tool: index is larger than PERV_TARGET_COUNT\n");
+ if (index > PERV_TARGET_COUNT) {
+ fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n",
+ index, PERV_TARGET_COUNT);
exit(1);
}
return;
@@ -100,45 +105,44 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64
// debug purpose
//printf("offset in string section: 0x%x \n", be32toh(item.iv_toc->iv_id));
- //printf("address: 0x%x \n", item.iv_address);
+ //printf("address: 0x%x index: %2d 0x%x\n", item.iv_address, index, index);
sbe_xip_image2host(image, item.iv_address, &thePointer);
// debug purpose
- //printf("pointer1: 0x%x \n", thePointer);
- //printf("val: 0x%llx \n", val);
+ //printf("pointer1: 0x%x val: 0x%llx \n", thePointer, val);
if(item.iv_toc->iv_type == SBE_XIP_UINT8) {
- *((uint8_t*)thePointer + index) = (uint8_t)val;
+ *((uint8_t*)thePointer + (index * sizeof(uint8_t))) = (uint8_t)val;
} else if(item.iv_toc->iv_type == SBE_XIP_INT8) {
- *((int8_t*)thePointer + index) = (int8_t)val;
+ *((int8_t*)thePointer + (index * sizeof(int8_t))) = (int8_t)val;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT16) {
- *((uint16_t*)thePointer + index) = (uint16_t)val;
+ *((uint16_t*)thePointer + (index * sizeof(uint16_t))) = xipRevLe16((uint16_t)val);
} else if(item.iv_toc->iv_type == SBE_XIP_INT16) {
- *((int16_t*)thePointer + index) = (int16_t)val;
+ *((int16_t*)thePointer + (index * sizeof(int16_t))) = xipRevLe16((int16_t)val);
} else if(item.iv_toc->iv_type == SBE_XIP_UINT32) {
- *((uint32_t*)thePointer + index) = (uint32_t)val;
+ *((uint32_t*)thePointer + (index * sizeof(uint32_t))) = xipRevLe32((uint32_t)val);
} else if(item.iv_toc->iv_type == SBE_XIP_INT32) {
- *((int32_t*)thePointer + index) = (int32_t)val;
+ *((int32_t*)thePointer + (index * sizeof(int32_t))) = xipRevLe32((int32_t)val);
} else if(item.iv_toc->iv_type == SBE_XIP_UINT64) {
- *((uint64_t*)thePointer + index) = (uint64_t)val;
+ *((uint64_t*)thePointer + (index * sizeof(uint64_t))) = xipRevLe64((uint64_t)val);
} else if(item.iv_toc->iv_type == SBE_XIP_INT64) {
- *((int64_t*)thePointer + index) = (int64_t)val;
+ *((int64_t*)thePointer + (index * sizeof(int64_t))) = xipRevLe64((int64_t)val);
} else {
fprintf(stderr, "sbe_default_tool: type not available");
@@ -152,7 +156,8 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64
SBE_XIP_TYPE_STRINGS(type_name);
// debug purpose
- //printf("pointer2: 0x%x \n", thePointer);
+ //printf("pointer2: 0x%x \n", thePointer + index);
+ //printf("elements: %d \n", item.iv_elements);
//printf("section id: %s \n", section_name[item.iv_toc->iv_section]);
//printf("location in section: 0x%x \n", be32toh(item.iv_toc->iv_data));
//printf("type name: %s \n", type_name[item.iv_toc->iv_type]);
@@ -180,38 +185,38 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) {
if(item.iv_toc->iv_type == SBE_XIP_UINT8) {
- val = *((uint8_t*)thePointer + index);
+ val = *((uint8_t*)thePointer + (index * sizeof(uint8_t)));
} else if(item.iv_toc->iv_type == SBE_XIP_INT8) {
- val = *((int8_t*)thePointer + index);
+ val = *((int8_t*)thePointer + (index * sizeof(int8_t)));
val &= 0xFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT16) {
- val = *((uint16_t*)thePointer + index);
+ val = xipRevLe16(*((uint16_t*)thePointer + (index * sizeof(uint16_t))));
} else if(item.iv_toc->iv_type == SBE_XIP_INT16) {
- val = *((int16_t*)thePointer + index);
+ val = xipRevLe16(*((int16_t*)thePointer + (index * sizeof(int16_t))));
val &= 0xFFFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT32) {
- val = *((uint32_t*)thePointer + index);
+ val = xipRevLe32(*((uint32_t*)thePointer + (index * sizeof(uint32_t))));
} else if(item.iv_toc->iv_type == SBE_XIP_INT32) {
- val = *((int32_t*)thePointer + index);
+ val = xipRevLe32(*((int32_t*)thePointer + (index * sizeof(int32_t))));
val &= 0xFFFFFFFF;
} else if(item.iv_toc->iv_type == SBE_XIP_UINT64) {
- val = *((uint64_t*)thePointer + index);
+ val = xipRevLe64(*((uint64_t*)thePointer + (index * sizeof(uint64_t))));
} else if(item.iv_toc->iv_type == SBE_XIP_INT64) {
- val = *((int64_t*)thePointer + index);
+ val = xipRevLe64(*((int64_t*)thePointer + (index * sizeof(int64_t))));
} else {
fprintf(stderr, "sbe_default_tool: type not available");
@@ -269,7 +274,7 @@ int main(int argc, const char** argv)
if((check & val) != check) {
- fprintf(stderr, "sbe_default_tool: set and get values not equal");
+ fprintf(stderr, "sbe_default_tool: set and get values not equal -> ");
fprintf(stderr, "%lx != %lx\n", check, val);
exit(1);
diff --git a/tools/image/sbe_xip_tool.c b/tools/image/sbe_xip_tool.c
index 75448a25..8f6318db 100644
--- a/tools/image/sbe_xip_tool.c
+++ b/tools/image/sbe_xip_tool.c
@@ -324,40 +324,40 @@ tocListing(void* io_image,
if (rc) break;
printf("0x%02x", (uint8_t)data);
break;
- case SBE_XIP_INT8:
+ case SBE_XIP_UINT16:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("%d", (int8_t)data);
+ printf("0x%04x", (uint16_t)data);
break;
- case SBE_XIP_UINT16:
+ case SBE_XIP_UINT32:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("0x%08x", (uint16_t)data);
+ printf("0x%08x", (uint32_t)data);
break;
- case SBE_XIP_INT16:
+ case SBE_XIP_UINT64:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("%d", (int16_t)data);
+ printf("0x%016llx", data);
break;
- case SBE_XIP_UINT32:
+ case SBE_XIP_INT8:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("0x%08x", (uint32_t)data);
+ printf("0x%02x", (uint8_t)data);
break;
- case SBE_XIP_INT32:
+ case SBE_XIP_INT16:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("%d", (int32_t)data);
+ printf("0x%04x", (uint16_t)data);
break;
- case SBE_XIP_UINT64:
+ case SBE_XIP_INT32:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("0x%016llx", data);
+ printf("0x%08x", (uint32_t)data);
break;
case SBE_XIP_INT64:
rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data);
if (rc) break;
- printf("%d", (int64_t)data);
+ printf("0x%016llx", data);
break;
case SBE_XIP_STRING:
rc = sbe_xip_get_string(io_image, i_item->iv_id, &s);
@@ -781,14 +781,6 @@ get(void* i_image, const int i_argc, const char** i_argv, int i_getv)
}
printf("%s\n", s);
break;
- case SBE_XIP_INT8:
- case SBE_XIP_INT16:
- case SBE_XIP_INT32:
- case SBE_XIP_INT64:
- fprintf(stderr, "%s%d : Bug, int types not implemented %d\n",
- __FILE__, __LINE__, item.iv_type);
- exit(1);
- break;
default:
fprintf(stderr, "%s%d : Bug, unexpected type %d\n",
__FILE__, __LINE__, item.iv_type);
OpenPOWER on IntegriCloud