summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Makefile6
-rw-r--r--src/lib/common/Makefile4
-rw-r--r--src/lib/occlib/Makefile4
-rw-r--r--src/lib/ppc405lib/Makefile4
-rwxr-xr-xsrc/occ_405/Makefile18
-rw-r--r--src/occ_405/img_defs.mk40
-rw-r--r--src/occ_gpe0/Makefile6
-rw-r--r--src/occ_gpe0/img_defs.mk27
-rw-r--r--src/occ_gpe1/Makefile6
-rw-r--r--src/occ_gpe1/img_defs.mk27
-rw-r--r--src/ppe/pk/gpe/Makefile4
-rw-r--r--src/ppe/pk/kernel/Makefile5
-rw-r--r--src/ppe/pk/ppe/Makefile4
-rw-r--r--src/ppe/pk/ppe42/Makefile4
-rw-r--r--src/ppe/pk/std/Makefile4
-rw-r--r--src/ppe/pk/trace/Makefile4
-rw-r--r--src/ssx/occhw/Makefile2
-rw-r--r--src/ssx/ppc32/Makefile2
-rw-r--r--src/ssx/ppc405/Makefile2
-rw-r--r--src/ssx/ssx/Makefile2
-rw-r--r--src/ssx/trace/Makefile2
-rwxr-xr-xsrc/tools/check-sensors.sh98
22 files changed, 225 insertions, 50 deletions
diff --git a/src/Makefile b/src/Makefile
index 9f4b49c..b72cbc4 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -105,16 +105,20 @@ clean:
rm -fr $(OBJDIR)
rm -f $(TRACEPP_DIR)/tracepp
-#make binary application images
+# Make binary application images
+.PHONY : $(OBJDIR)/$(OCC_405_IMAGE_NAME)/$(OCC_405_IMAGE_NAME).out
$(OBJDIR)/$(OCC_405_IMAGE_NAME)/$(OCC_405_IMAGE_NAME).out:
(cd $(SRCDIR)/$(OCC_405_IMAGE_NAME) && make)
+.PHONY : $(OBJDIR)/$(OCC_GPE0_IMAGE_NAME)/$(OCC_GPE0_IMAGE_NAME).out
$(OBJDIR)/$(OCC_GPE0_IMAGE_NAME)/$(OCC_GPE0_IMAGE_NAME).out:
(cd $(SRCDIR)/$(OCC_GPE0_IMAGE_NAME) && make)
+.PHONY : $(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out
$(OBJDIR)/$(OCC_GPE1_IMAGE_NAME)/$(OCC_GPE1_IMAGE_NAME).out:
(cd $(SRCDIR)/$(OCC_GPE1_IMAGE_NAME) && make)
+.PHONY : $(OBJDIR)/$(OCC_BOOTLOADER_DIR_NAME)/$(OCC_BOOTLOADER_NAME).out
$(OBJDIR)/$(OCC_BOOTLOADER_DIR_NAME)/$(OCC_BOOTLOADER_NAME).out $(OBJDIR)/$(OCC_BOOTLOADER_DIR_NAME)/$(IMAGE_HDR_SCRIPT):
(cd $(SRCDIR)/$(OCC_BOOTLOADER_DIR_NAME) && make)
diff --git a/src/lib/common/Makefile b/src/lib/common/Makefile
index 5147b59..3e31306 100644
--- a/src/lib/common/Makefile
+++ b/src/lib/common/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -52,6 +52,6 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-#include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/lib/occlib/Makefile b/src/lib/occlib/Makefile
index 9f86413..d529cc6 100644
--- a/src/lib/occlib/Makefile
+++ b/src/lib/occlib/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -52,6 +52,6 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/lib/ppc405lib/Makefile b/src/lib/ppc405lib/Makefile
index 37ef2ea..9f69a28 100644
--- a/src/lib/ppc405lib/Makefile
+++ b/src/lib/ppc405lib/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -52,6 +52,6 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-#include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/occ_405/Makefile b/src/occ_405/Makefile
index 9c56ad5..716af1f 100755
--- a/src/occ_405/Makefile
+++ b/src/occ_405/Makefile
@@ -36,7 +36,7 @@ include topfiles.mk
SSX_MAKE_DIR := $(SSX_SRCDIR)/occhw
OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS))
-OBJDIRS = $(dir ${OBJS})
+OBJDIRS = $(sort $(dir ${OBJS}))
SSXLIB := $(OBJDIR)/ssx/libssx.a
COMMONLIB := $(OBJDIR)/common/libcommon.a
OCCLIB := $(OBJDIR)/occlib/libocc.a
@@ -80,9 +80,14 @@ $(OBJDIR)/$(IMAGE_NAME).bin $(OBJDIR)/$(IMAGE_NAME).dis: $(OBJDIR)/$(IMAGE_NAME)
$(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_NAME).dis
#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_NAME).out: $(TRACEPP_DIR)/tracepp $(LINK_OBJS) $(LINK_SCRIPT)
+$(OBJDIR)/$(IMAGE_NAME).out: $(TRACEPP_DIR)/tracepp $(LINK_OBJS) $(LINK_SCRIPT) check-sensors
$(LD) -e __ssx_boot -T$(LINK_SCRIPT) $(LDFLAGS) -Map $(OBJDIR)/$(IMAGE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_NAME).out $(LIB_DIRS) -lssx -locc -lppc405 -lcommon
+#Verifies that we aren't missing sensors in the sensor lists
+.PHONY : check-sensors
+check-sensors:
+ $(OCCTOOLS)/check-sensors.sh $(OBJDUMP) $(OBJDIR)/sensor/
+
$(PPETOOLS_OBJDIR)/ppetracepp: $(PPETOOLS_OBJDIR)
g++ -O3 -w -g -I$(PPETRACEPP_DIR)/ $(PPETRACEPP_DIR)/ppetracepp.C -o $(PPETOOLS_OBJDIR)/ppetracepp
@@ -94,11 +99,12 @@ $(PPETOOLS_OBJDIR):
$(LINK_SCRIPT): $(LINK_CMD_SCRIPT)
$(CPP) -E -x c -P $(DEFS) $(LINK_CMD_SCRIPT) -o $(LINK_SCRIPT)
+
#Create an obj directory if needed
$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d): | $(OBJDIRS)
$(OBJDIRS):
- mkdir -p $(OBJDIRS)
+ mkdir -p $@
#Build the SSX kernel library
$(SSXLIB):
@@ -136,6 +142,6 @@ clean:
rm -fr $(OBJDIR)
#Add dependencies to header files
-#ifneq ($(MAKECMDGOALS),clean)
-#include $(OBJS:.o=.d)
-#endif
+ifneq ($(MAKECMDGOALS),clean)
+-include $(OBJS:.o=.d)
+endif
diff --git a/src/occ_405/img_defs.mk b/src/occ_405/img_defs.mk
index e30299e..45ab35d 100644
--- a/src/occ_405/img_defs.mk
+++ b/src/occ_405/img_defs.mk
@@ -79,6 +79,10 @@ ifndef GLOBAL_INCLUDES
export GLOBAL_INCLUDES = -I$(IMAGE_SRCDIR)/..
endif
+ifndef OCCTOOLS
+export OCCTOOLS = $(abspath ../tools/)
+endif
+
ifndef BASE_OBJDIR
export BASE_OBJDIR = $(abspath ../../obj)
endif
@@ -114,7 +118,7 @@ export PPETRACEPP_DIR = $(abspath ../ppe/tools/ppetracepp)
endif
ifndef PPETOOLS_OBJDIR
-export PPETOOLS_OBJDIR = $(abspath ../obj/ppetools)
+export PPETOOLS_OBJDIR = $(BASE_OBJDIR)/ppetools
endif
ifndef TRACEPP_DIR
@@ -294,18 +298,26 @@ $(OBJDIR)/%.o: %.S
# work as Make targets. The *.d files are include-ed in the
# subdirectory Makefiles.
-#$(OBJDIR)/%.d: %.c
-# @set -e; rm -f $@; \
-# echo -n "$(OBJDIR)/" > $@.$$$$; \
-# $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
-# sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
-# rm -f $@.$$$$
-
-#$(OBJDIR)/%.d: %.S
-# @set -e; rm -f $@; \
-# echo -n "$(OBJDIR)/" > $@.$$$$; \
-# $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
-# sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
-# rm -f $@.$$$$
+$(OBJDIR)/%.d: %.c
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJDIR)/%.d: %.S
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
diff --git a/src/occ_gpe0/Makefile b/src/occ_gpe0/Makefile
index b19aab9..1f815a4 100644
--- a/src/occ_gpe0/Makefile
+++ b/src/occ_gpe0/Makefile
@@ -108,6 +108,6 @@ clean:
rm -fr $(OBJDIR)
#Add dependencies to header files
-#ifneq ($(MAKECMDGOALS),clean)
-#include $(OBJS:.o=.d)
-#endif
+ifneq ($(MAKECMDGOALS),clean)
+-include $(OBJS:.o=.d)
+endif
diff --git a/src/occ_gpe0/img_defs.mk b/src/occ_gpe0/img_defs.mk
index 5b77299..74a2e4e 100644
--- a/src/occ_gpe0/img_defs.mk
+++ b/src/occ_gpe0/img_defs.mk
@@ -274,6 +274,33 @@ $(OBJDIR)/%.s: %.S
$(TCPP) $(CFLAGS) $(DEFS) $(CPPFLAGS) -o $@ $<
.PRECIOUS: $(OBJDIR)/%.s
+$(OBJDIR)/%.d: %.c
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,\($*\)\.d[ :]*,\1.s $@ : ,g' < $@ > $@.$$$$; \
+ sed 's,\($*\)\.d[ :]*,\1.es $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJDIR)/%.d: %.S
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,\($*\)\.d[ :]*,\1.s $@ : ,g' < $@ > $@.$$$$; \
+ sed 's,\($*\)\.d[ :]*,\1.es $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+
ifndef P2P_ENABLE
$(OBJDIR)/%.o: $(OBJDIR)/%.s
diff --git a/src/occ_gpe1/Makefile b/src/occ_gpe1/Makefile
index 767785c..c5af47b 100644
--- a/src/occ_gpe1/Makefile
+++ b/src/occ_gpe1/Makefile
@@ -108,6 +108,6 @@ clean:
rm -fr $(OBJDIR)
#Add dependencies to header files
-#ifneq ($(MAKECMDGOALS),clean)
-#include $(OBJS:.o=.d)
-#endif
+ifneq ($(MAKECMDGOALS),clean)
+-include $(OBJS:.o=.d)
+endif
diff --git a/src/occ_gpe1/img_defs.mk b/src/occ_gpe1/img_defs.mk
index 704400e..8526b3d 100644
--- a/src/occ_gpe1/img_defs.mk
+++ b/src/occ_gpe1/img_defs.mk
@@ -274,6 +274,33 @@ $(OBJDIR)/%.s: %.S
$(TCPP) $(CFLAGS) $(DEFS) $(CPPFLAGS) -o $@ $<
.PRECIOUS: $(OBJDIR)/%.s
+# Header dependency files
+$(OBJDIR)/%.d: %.c
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,\($*\)\.d[ :]*,\1.s $@ : ,g' < $@ > $@.$$$$; \
+ sed 's,\($*\)\.d[ :]*,\1.es $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJDIR)/%.d: %.S
+ @set -e; rm -f $@; \
+ if [ "$(dir $*)" != "./" ]; then \
+ echo -n "$(OBJDIR)/$(dir $*)" > $@.$$$$; \
+ else \
+ echo -n "$(OBJDIR)/" > $@.$$$$; \
+ fi ; \
+ $(CC_ASM) -MM $(INCLUDES) $(CPPFLAGS) $(DEFS) $< >> $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,\($*\)\.d[ :]*,\1.s $@ : ,g' < $@ > $@.$$$$; \
+ sed 's,\($*\)\.d[ :]*,\1.es $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
ifndef P2P_ENABLE
$(OBJDIR)/%.o: $(OBJDIR)/%.s
diff --git a/src/ppe/pk/gpe/Makefile b/src/ppe/pk/gpe/Makefile
index bee7ad8..4c36e1f 100644
--- a/src/ppe/pk/gpe/Makefile
+++ b/src/ppe/pk/gpe/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -70,5 +70,5 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ppe/pk/kernel/Makefile b/src/ppe/pk/kernel/Makefile
index d08930a..5e0fbc0 100644
--- a/src/ppe/pk/kernel/Makefile
+++ b/src/ppe/pk/kernel/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -46,5 +46,6 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
+
diff --git a/src/ppe/pk/ppe/Makefile b/src/ppe/pk/ppe/Makefile
index 51afc5c..943e1b3 100644
--- a/src/ppe/pk/ppe/Makefile
+++ b/src/ppe/pk/ppe/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -70,5 +70,5 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ppe/pk/ppe42/Makefile b/src/ppe/pk/ppe42/Makefile
index 8d7ce82..b6c5b69 100644
--- a/src/ppe/pk/ppe42/Makefile
+++ b/src/ppe/pk/ppe42/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -46,5 +46,5 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ppe/pk/std/Makefile b/src/ppe/pk/std/Makefile
index 443430f..878d9ac 100644
--- a/src/ppe/pk/std/Makefile
+++ b/src/ppe/pk/std/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -70,5 +70,5 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ppe/pk/trace/Makefile b/src/ppe/pk/trace/Makefile
index 45f5a44..f4a721e 100644
--- a/src/ppe/pk/trace/Makefile
+++ b/src/ppe/pk/trace/Makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER OnChipController Project
#
-# Contributors Listed Below - COPYRIGHT 2015
+# Contributors Listed Below - COPYRIGHT 2015,2016
# [+] International Business Machines Corp.
#
#
@@ -46,5 +46,5 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ssx/occhw/Makefile b/src/ssx/occhw/Makefile
index 45101df..b24c15a 100644
--- a/src/ssx/occhw/Makefile
+++ b/src/ssx/occhw/Makefile
@@ -73,5 +73,5 @@ clean:
rm -fr $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ssx/ppc32/Makefile b/src/ssx/ppc32/Makefile
index eb270c7..61cc57a 100644
--- a/src/ssx/ppc32/Makefile
+++ b/src/ssx/ppc32/Makefile
@@ -39,6 +39,6 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ssx/ppc405/Makefile b/src/ssx/ppc405/Makefile
index 5a25846..900cebc 100644
--- a/src/ssx/ppc405/Makefile
+++ b/src/ssx/ppc405/Makefile
@@ -49,6 +49,6 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ssx/ssx/Makefile b/src/ssx/ssx/Makefile
index f78e831..4ed1a03 100644
--- a/src/ssx/ssx/Makefile
+++ b/src/ssx/ssx/Makefile
@@ -47,5 +47,5 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/ssx/trace/Makefile b/src/ssx/trace/Makefile
index a822a78..8b950cb 100644
--- a/src/ssx/trace/Makefile
+++ b/src/ssx/trace/Makefile
@@ -46,5 +46,5 @@ $(OBJDIR):
mkdir -p $(OBJDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJS:.o=.d)
+-include $(OBJS:.o=.d)
endif
diff --git a/src/tools/check-sensors.sh b/src/tools/check-sensors.sh
new file mode 100755
index 0000000..450c4e6
--- /dev/null
+++ b/src/tools/check-sensors.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/tools/check-sensors.sh $
+#
+# OpenPOWER OnChipController Project
+#
+# Contributors Listed Below - COPYRIGHT 2016
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+
+# This script checks to ensure that the lists of sensors used by
+# the OCC are fully populated in order to ensure that when a sensor
+# is added, it is added to all relevant sensor lists.
+
+# Usage: check-sensors.sh objdump path/to/occ_405/sensor/
+#
+# A version of objdump that supports powerpc object disassembly
+# must be used.
+
+# Get file name of script
+SCRIPTNAME=`basename "$0"`
+
+# Check that we have two arguments
+if [ $# -ne 2 ]; then
+ echo ${SCRIPTNAME}: usage: ${SCRIPTNAME} /path/to/powerpc-objdump /path/to/occ_405/sensor/
+ exit 1
+fi
+
+# Get paths to required tools
+WC=`which wc`
+READELF=`which readelf`
+
+# Assign arguments to coherent variables
+OBJDUMP=$1
+SENSOR_PATH=$2
+
+# Object files that contain the sensor lists
+SENSOR_TABLE=${SENSOR_PATH}/sensor_table.o
+SENSOR_INFO=${SENSOR_PATH}/sensor_info.o
+
+# Keep track of if a sensor is missing from a list
+ERROR=0
+
+# This disassembles G_amec_sensor_list and takes advantage
+# of the 4-byte data alignment that objdump uses in its
+# output in addition to the fact that G_amec_sensor_list
+# is an array of pointers. On the 405 processor, pointers
+# are 4 bytes, so this looks for any lines in the objdump
+# output that are NULL pointers, indicating either a missing
+# sensor or one that was improperly implemented.
+NUM_ZERO_ENTRIES=$(${OBJDUMP} -Dz ${SENSOR_TABLE} \
+ | awk -v RS= '/^[[:xdigit:]].*<G_amec_sensor_list>/' \
+ | grep .long\ 0x0 \
+ | ${WC} -l)
+
+# Error message if there are missing/incomplete sensors in G_amec_sensor_list
+if [ ${NUM_ZERO_ENTRIES} -ne 0 ]; then
+ echo ERROR: There are ${NUM_ZERO_ENTRIES} missing entries in G_amec_sensor_list!
+ ERROR=1
+fi
+
+# This dumps the .rodata section of sensor_info.o, which for
+# this particular file, only contains G_sensor_info. It then
+# takes advantage of the fact that G_sensor_info is an array
+# of sensor_info_t structures, which is 33 bytes. readelf's
+# output here is rows of 16 bytes each, so if there are any
+# missing sensors, there will be at least one row of all 0s.
+NUM_ZERO_ENTRIES=$(${READELF} ${SENSOR_INFO} -x .rodata \
+ | grep 00000000\ 00000000\ 00000000\ 00000000 \
+ | ${WC} -l)
+
+if [ ${NUM_ZERO_ENTRIES} -ne 0 ]; then
+ NUM_MISSING=`expr ${NUM_ZERO_ENTRIES} / 2`
+ NUM_MISSING2=`expr ${NUM_MISSING} + 1`
+ RANGE=${NUM_MISSING}-${NUM_MISSING2}
+ echo ERROR: There are approximately ${RANGE} missing entries in G_sensor_info!
+ ERROR=1
+fi
+
+if [ ${ERROR} -ne 0 ]; then
+ exit 1
+fi
OpenPOWER on IntegriCloud