From 73cad1f1ae2a9f7b4876f61c5db85c35bbd08db3 Mon Sep 17 00:00:00 2001 From: Venkatesh Sainath Date: Wed, 6 Jun 2018 09:53:43 -0500 Subject: Pushing HB plugins and related files for building errltool Change-Id: I91d432a901fb4ee6de469ca8076637eaa2e1315d Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/60027 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Sampa Misra Reviewed-by: William G. Hoffa Reviewed-by: Daniel M. Crowell --- src/build/mkrules/dist.rules.mk | 7 +-- src/build/mkrules/dist.targets.mk | 47 +++++++++++++++-- src/build/tools/hbDistribute | 8 ++- src/include/usr/hwas/common/hwasCallout.H | 8 +-- src/usr/diag/prdf/common/iipconst.h | 7 +++ .../diag/prdf/common/plugins/prdfProcLogParse.C | 1 + src/usr/diag/prdf/plugins/Makefile_errl | 60 ++++++++++++++++++++++ src/usr/errl/parser/genErrlParsers.pl | 55 +++++++++++++++++++- src/usr/errl/plugins/errludparser.H | 6 ++- src/usr/errl/plugins/errludsensor.H | 3 +- src/usr/errl/plugins/errludstate.H | 3 +- src/usr/fapi2/platCreateHwpErrParser.pl | 4 +- src/usr/targeting/common/xmltohb/xmltohb.pl | 8 +-- 13 files changed, 196 insertions(+), 21 deletions(-) create mode 100644 src/usr/diag/prdf/plugins/Makefile_errl diff --git a/src/build/mkrules/dist.rules.mk b/src/build/mkrules/dist.rules.mk index 7cfcd40f6..b9b120112 100644 --- a/src/build/mkrules/dist.rules.mk +++ b/src/build/mkrules/dist.rules.mk @@ -5,7 +5,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,2018 +# [+] 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. @@ -206,7 +208,7 @@ $(foreach targ,$(COPY_FILES), \ define __COPY_RENAME_TARGET_RULE $(TARGET_DIR)$(3)/$(1): $(ROOTPATH)/$(2) $(TESTVAR_CHANGED_FILE) @mkdir -p $$(dir $$@) - @echo " CP-RENAME $$(notdir $$<) $$(notdir $$@)" && cp -r $$< $$@ + @echo " CP-RENAME $$(notdir $$<) $$(notdir $$@)" && cp -Lr $$< $$@ endef define COPY_RENAME_TARGET_RULE $(call __COPY_RENAME_TARGET_RULE,$(1),$(2)) @@ -443,4 +445,3 @@ $(1)_TARGET_ECHO_START: endef $(foreach targ,$(VALID_TARGETS),$(eval $(call INSTANTIATE_TARGET,$(targ)))) - diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk index f791aa2fe..422c2bad6 100755 --- a/src/build/mkrules/dist.targets.mk +++ b/src/build/mkrules/dist.targets.mk @@ -40,7 +40,7 @@ ROOTPATH = ../../.. # # Content targets. -VALID_TARGETS = fsp tools openpower vpo +VALID_TARGETS = fsp tools openpower vpo errltool # # Files which are to be directly copied into content targets. @@ -149,8 +149,49 @@ COPY_RENAME_FILES = \ securerom.list.bz2:img/securerom.list.bz2:tools,vpo,openpower \ securerom.bin.modinfo:img/securerom.bin.modinfo:tools,vpo,openpower \ $(foreach file, $(call ROOTPATH_WILDCARD,src/build/debug/Hostboot/*.pm), \ - Hostboot/$(notdir $(file)):$(file):tools,vpo,openpower) - + Hostboot/$(notdir $(file)):$(file):tools,vpo,openpower) \ + $(foreach file, $(call ROOTPATH_WILDCARD,obj/genfiles/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + hbplugins/Makefile:obj/genfiles/plugins/Makefile:errltool \ + hbplugins/prdf/Makefile:obj/genfiles/plugins/prdf/Makefile_errl:errltool \ + $(foreach file, $(call ROOTPATH_WILDCARD,obj/genfiles/plugins/prdf/*.h), \ + hbplugins/prdf/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,obj/genfiles/plugins/prdf/*.C), \ + hbplugins/prdf/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,obj/genfiles/plugins/prdf/*.H), \ + hbplugins/prdf/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/sbeio/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/initservice/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/mbox/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/secureboot/common/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/errl/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/fsi/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/vpd/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/i2c/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/runtime/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/isteps/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/usr/scom/plugins/*.*), \ + hbplugins/$(notdir $(file)):$(file):errltool) \ + $(foreach file, $(call ROOTPATH_WILDCARD,src/import/chips/p9/common/include/*.H), \ + hbplugins/prdf/$(notdir $(file)):$(file):errltool) \ + hwas/common/hwasCallout.H:src/include/usr/hwas/common/hwasCallout.H:errltool \ + devicefw/driverif.H:src/include/usr/devicefw/driverif.H:errltool \ + devicefw/userif.H:src/include/usr/devicefw/userif.H:errltool \ + hbplugins/prdf/p9_pm_recovery_ffdc_defines.H:src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H:errltool \ + hbplugins/prdf/p9_hcd_memmap_base.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_memmap_base.H:errltool \ + hbplugins/prdf/p9_hcd_header_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_header_defs.H:errltool \ + hbplugins/prdf/p9_ppe_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H:errltool + # # Symbolic links created in the target. # diff --git a/src/build/tools/hbDistribute b/src/build/tools/hbDistribute index 41936cb93..8c501ad97 100755 --- a/src/build/tools/hbDistribute +++ b/src/build/tools/hbDistribute @@ -95,6 +95,11 @@ do shift ;; + "--errltool") + TARGET="errltool_TARGET" + shift + ;; + "--release") TARGET="ALL" shift @@ -156,7 +161,8 @@ fi echo "sbfw dir = ${SBFW_DIR}" # Verify SBFW directory or default to sandbox. if [ "${SBFW_DIR}" == "invalid directory" -a \ - "${TARGET}" != "openpower_TARGET" ]; then + "${TARGET}" != "openpower_TARGET" -a \ + "${TARGET}" != "errltool_TARGET" ]; then if [ -z "${SANDBOXROOT}" -o -z "${SANDBOXNAME}" ]; then echo "ERROR:SBFW - No path specified and \$SANDBOXBASE undefined." print_usage diff --git a/src/include/usr/hwas/common/hwasCallout.H b/src/include/usr/hwas/common/hwasCallout.H index 773cb9cfd..a7535f093 100644 --- a/src/include/usr/hwas/common/hwasCallout.H +++ b/src/include/usr/hwas/common/hwasCallout.H @@ -34,9 +34,9 @@ /******************************************************************************/ // Includes /******************************************************************************/ -#ifndef PARSER +#if !defined(PARSER) && !defined(LOGPARSER) #include -#endif // not PARSER +#endif // not LOGPARSER namespace HWAS { @@ -306,7 +306,7 @@ typedef struct callout_ud } __attribute__ ((packed)) callout_ud_t; -#ifndef PARSER +#if !defined(PARSER) && !defined(LOGPARSER) /* BUS callout Structure: This structure contains all the parameters needed for callout // in platHandleAddBusCallout, Fields are: @@ -480,7 +480,7 @@ errlHndl_t platHandleI2cDeviceCallout( callOutPriority i_priority, errlHndl_t &io_errl); -#endif // not PARSER +#endif // not LOGPARSER }; // end namespace #endif diff --git a/src/usr/diag/prdf/common/iipconst.h b/src/usr/diag/prdf/common/iipconst.h index 7935a3958..cf0ff8247 100755 --- a/src/usr/diag/prdf/common/iipconst.h +++ b/src/usr/diag/prdf/common/iipconst.h @@ -35,7 +35,10 @@ /* Includes */ /*--------------------------------------------------------------------*/ #include + +#ifndef LOGPARSER #include +#endif /*--------------------------------------------------------------------*/ /* User Types */ @@ -49,7 +52,11 @@ namespace PRDF { +#ifndef LOGPARSER typedef TARGETING::ATTR_HUID_type HUID; +#else + typedef uint32_t HUID; +#endif // FIXME: RTC: 62867 will resolve this enum { INVALID_HUID = 0 }; diff --git a/src/usr/diag/prdf/common/plugins/prdfProcLogParse.C b/src/usr/diag/prdf/common/plugins/prdfProcLogParse.C index ae7287d76..9ae13ca54 100644 --- a/src/usr/diag/prdf/common/plugins/prdfProcLogParse.C +++ b/src/usr/diag/prdf/common/plugins/prdfProcLogParse.C @@ -39,6 +39,7 @@ #include #include #include +#include #include namespace PRDF diff --git a/src/usr/diag/prdf/plugins/Makefile_errl b/src/usr/diag/prdf/plugins/Makefile_errl new file mode 100644 index 000000000..9cffd2508 --- /dev/null +++ b/src/usr/diag/prdf/plugins/Makefile_errl @@ -0,0 +1,60 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/plugins/Makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2018 +# [+] 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 +# +# + +include ../../../rules.mk + +CMDS = libhbprdfplugins.a + +LDFLAGS += -static + +CXXFLAGS += -DPRDF_HOSTBOOT_ERRL_PLUGIN -D__HOSTBOOT_MODULE -DLOGPARSER -DPRDPARSER -I. -I../.. -I../../targeting -I../../../include -I../../../include/util -I../../../include/extras -I../../../include/genfiles + +PRDF_PLUGIN_OBJS = prdfBitString.o prdrErrlPluginsSupt.o p9_capp.prf.err.o \ + p9_eq.prf.err.o p9_mca.prf.err.o p9_mcs.prf.err.o \ + p9_obus.prf.err.o p9_phb.prf.err.o prdfLogParse.o \ + p9_capp.prf.reg.o p9_eq.prf.reg.o p9_mca.prf.reg.o \ + p9_mcs.prf.reg.o p9_obus.prf.reg.o p9_phb.prf.reg.o \ + prdfLogParse_common.o prdfMemLogParse.o p9_ec.prf.err.o \ + p9_ex.prf.err.o p9_mcbist.prf.err.o p9_nimbus.prf.err.o \ + p9_pec.prf.err.o p9_xbus.prf.err.o prdfParserUtils.o \ + p9_ec.prf.reg.o p9_ex.prf.reg.o p9_mcbist.prf.reg.o \ + p9_nimbus.prf.reg.o p9_pec.prf.reg.o p9_xbus.prf.reg.o prdfProcLogParse.o + + +all: $(CMDS) + +libhbprdfplugins.a: $(PRDF_PLUGIN_OBJS) + @echo "LD $(WORK_DIR)/$@" + ar rvs $@ $(PRDF_PLUGIN_OBJS) + +$(PRDF_PLUGIN_OBJS):%.o: %.C + @echo "$(CC) $(CXXFLAGS) $(WORK_DIR)/$@" + @$(CC) $(CXXFLAGS) -c $< + +clean: + @echo "Cleaning up $(WORK_DIR) files..." + @rm -rf $(CMDS) $(PRDF_PLUGIN_OBJS) diff --git a/src/usr/errl/parser/genErrlParsers.pl b/src/usr/errl/parser/genErrlParsers.pl index ff9bb8461..1d3af664d 100755 --- a/src/usr/errl/parser/genErrlParsers.pl +++ b/src/usr/errl/parser/genErrlParsers.pl @@ -978,6 +978,59 @@ foreach my $dir(@pluginDirsToParse) $compValToUdFilesHash{$compVal} = $ofiles; } +#------------------------------------------------------------------------------ +# Generate the makefile that builds the Hostboot error log parsers for errltool +#------------------------------------------------------------------------------ +$outputFileName = $outputDir . "/Makefile"; +open(OFILE, ">", $outputFileName) or die("Cannot open: $outputFileName: $!"); + +print OFILE "\# Automatically generated by Hostboot's $0\n"; +print OFILE "\# Do not modify this file in the errltool tree, it is provided by\n"; +print OFILE "\# Hostboot and will be overwritten\n"; +print OFILE "\#\n"; + +print OFILE "CXXFLAGS += -D__HOSTBOOT_MODULE -DLOGPARSER \n\n"; +print OFILE "CXXFLAGS += -I. -I../ -I../targeting -I../../include -I../../include/util -I../../include/extras -I../../include/genfiles\n\n"; + +print OFILE "LDFLAGS += -static\n\n"; + +print OFILE "\#-------------------------------------------------------------\n"; +print OFILE "\# Call PRD makefile for prdf plugins\n"; +print OFILE "\#-------------------------------------------------------------\n"; +print OFILE "SUBDIRS = prdf\n\n"; + +print OFILE "CMDS = libhbplugins.a\n\n"; + +print OFILE "\#-------------------------------------------------------------\n"; +print OFILE "\# SRC Parsers\n"; +print OFILE "\#-------------------------------------------------------------\n"; + +print OFILE "HB_PLUGIN_SRC_OBJS = "; +foreach my $compValue (keys %compValueToParseHash) +{ + print OFILE "\\\n"; + print OFILE " hbfwSrcParse$compValue.o "; +} + +print OFILE "\n\n"; +print OFILE "all: \$(CMDS)\n"; +print OFILE "\t\@\$(MAKE) -C prdf\n\n"; +print OFILE "libhbplugins.a: \$(HB_PLUGIN_SRC_OBJS)\n"; +print OFILE "\t\@echo \"LD \$(WORK_DIR)/\$\@\"\n"; +print OFILE "\tar rvs \$\@ \$(HB_PLUGIN_SRC_OBJS)\n\n"; + +print OFILE "\$(HB_PLUGIN_SRC_OBJS):%.o: %.C\n"; +print OFILE "\t\@echo \"\$(CC) \$(CXXFLAGS) \$(WORK_DIR)/\$\@\"\n"; +print OFILE "\t\$(CC) \$(CXXFLAGS) -c \$<\n\n"; + +print OFILE "clean:\n"; +print OFILE "\t\@echo \"Cleaning up \$(WORK_DIR) files...\"\n"; +print OFILE "\trm -rf \$(CMDS) \$(HB_PLUGIN_SRC_OBJS)\n"; +print OFILE "\t\@\$(foreach d,\$(SUBDIRS), \$(MAKE) -C \$d clean;)\n\n"; + +print OFILE "\n\ninclude ../../rules.mk\n"; + +close(OFILE); #------------------------------------------------------------------------------ # Generate the FSP makefile that builds the Hostboot error log parsers #------------------------------------------------------------------------------ @@ -989,7 +1042,7 @@ print OFILE "\# Do not modify this file in the FSP tree, it is provided by\n"; print OFILE "\# Hostboot and will be overwritten\n"; print OFILE "\#\n"; -print OFILE "CFLAGS += -DPARSER\n\n"; +print OFILE "CFLAGS += -DPARSER \n\n"; print OFILE "EXPLIBS =\n\n"; print OFILE "\#-------------------------------------------------------------\n"; diff --git a/src/usr/errl/plugins/errludparser.H b/src/usr/errl/plugins/errludparser.H index 7b44109bc..ddaadade7 100755 --- a/src/usr/errl/plugins/errludparser.H +++ b/src/usr/errl/plugins/errludparser.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ +/* [+] 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. */ @@ -33,6 +35,7 @@ #include +#ifndef LOGPARSER /** * @brief Endian swap a uint64_t. This is not provided by in.h */ @@ -57,6 +60,7 @@ inline uint64_t ntohll( uint64_t i ) #else #error Unexpected endian context. #endif +#endif // FSP includes #include diff --git a/src/usr/errl/plugins/errludsensor.H b/src/usr/errl/plugins/errludsensor.H index cdca6631e..630b45591 100644 --- a/src/usr/errl/plugins/errludsensor.H +++ b/src/usr/errl/plugins/errludsensor.H @@ -33,8 +33,9 @@ */ #include "errluserdetails.H" +#ifndef LOGPARSER #include - +#endif namespace ERRORLOG { diff --git a/src/usr/errl/plugins/errludstate.H b/src/usr/errl/plugins/errludstate.H index ac6517b17..99d53c260 100644 --- a/src/usr/errl/plugins/errludstate.H +++ b/src/usr/errl/plugins/errludstate.H @@ -33,8 +33,9 @@ */ #include "errluserdetails.H" +#ifndef LOGPARSER #include - +#endif namespace ERRORLOG { diff --git a/src/usr/fapi2/platCreateHwpErrParser.pl b/src/usr/fapi2/platCreateHwpErrParser.pl index 0281a8aca..618459e30 100755 --- a/src/usr/fapi2/platCreateHwpErrParser.pl +++ b/src/usr/fapi2/platCreateHwpErrParser.pl @@ -77,7 +77,7 @@ print TGFILE "// hbfwPlatHwpErrParser.H\n"; print TGFILE "// This file is generated by perl script platCreateHwpErrParser.pl\n\n"; print TGFILE "#ifndef HBFWPLATHWPERRPARSER_H_\n"; print TGFILE "#define HBFWPLATHWPERRPARSER_H_\n\n"; -print TGFILE "#ifdef PARSER\n\n"; +print TGFILE "#if defined(PARSER) || defined(LOGPARSER)\n\n"; print TGFILE "namespace fapi2\n"; print TGFILE "{\n\n"; print TGFILE "void hbfwParseHwpRc(ErrlUsrParser & i_parser,\n"; @@ -207,7 +207,7 @@ print TGFILE "// hbfwPlatHwpErrParserFFDC.H\n"; print TGFILE "// This file is generated by perl script platCreateHwpErrParser.pl\n\n"; print TGFILE "#ifndef HBFWPLATHWPERRPARSERFFDC_H_\n"; print TGFILE "#define HBFWPLATHWPERRPARSERFFDC_H_\n\n"; -print TGFILE "#ifdef PARSER\n\n"; +print TGFILE "#if defined(PARSER) || defined(LOGPARSER)\n\n"; print TGFILE "#include \n\n"; print TGFILE "namespace fapi2\n"; print TGFILE "{\n\n"; diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index 29727c403..a0be4e3e7 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -2964,7 +2964,7 @@ sub writeAttrErrlHFile { print $outFile "#ifndef ERRL_UDATTRIBUTE_H\n"; print $outFile "#define ERRL_UDATTRIBUTE_H\n"; print $outFile "\n"; - print $outFile "#ifndef PARSER\n"; + print $outFile "#if !defined(PARSER) && !defined(LOGPARSER)\n"; print $outFile "\n"; print $outFile "#include \n"; print $outFile "\n"; @@ -2994,7 +2994,7 @@ sub writeAttrErrlHFile { print $outFile " uint32_t iv_dataSize;\n"; print $outFile "};\n"; print $outFile "}\n"; - print $outFile "#else // if PARSER defined\n"; + print $outFile "#else // if LOGPARSER defined\n"; print $outFile "\n"; print $outFile "#include \"errluserdetails.H\"\n"; print $outFile "\n"; @@ -3864,7 +3864,7 @@ sub writeTargetErrlHFile { print $outFile " };\n"; print $outFile "} TargetLabel_t;\n"; print $outFile "}\n"; - print $outFile "#ifndef PARSER\n"; + print $outFile "#if !defined(PARSER) && !defined(LOGPARSER)\n"; print $outFile "\n"; print $outFile "#include \n"; print $outFile "\n"; @@ -3887,7 +3887,7 @@ sub writeTargetErrlHFile { print $outFile " ErrlUserDetailsTarget & operator=(const ErrlUserDetailsTarget &);\n"; print $outFile "};\n"; print $outFile "}\n"; - print $outFile "#else // if PARSER defined\n"; + print $outFile "#else // if LOGPARSER defined\n"; print $outFile "\n"; print $outFile "#include \"errluserdetails.H\"\n"; print $outFile "#include \n"; -- cgit v1.2.1