summaryrefslogtreecommitdiffstats
path: root/hwpf
diff options
context:
space:
mode:
authorGreg Still <stillgs@us.ibm.com>2015-04-06 11:30:30 -0500
committerDerk Rembold <rembold@de.ibm.com>2015-05-21 06:53:54 -0500
commit8154f8810540dba21865d1566dc5209eef5a3515 (patch)
tree96090ab85b85cd1dca4a372190e65c1565c79f16 /hwpf
parent1ebc3c0868c74833aabe3775509d65ae29cd4925 (diff)
downloadtalos-sbe-8154f8810540dba21865d1566dc5209eef5a3515.tar.gz
talos-sbe-8154f8810540dba21865d1566dc5209eef5a3515.zip
Initial PPE FAPI2 platform implementation - targets+get/putscom; no Attributes
Change-Id: I805dd3286b1b9d33b585d903d38ba7555bf40c21 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16869 Reviewed-by: Glenn R. Miles <milesg@us.ibm.com> Reviewed-by: Derk Rembold <rembold@de.ibm.com> Tested-by: Derk Rembold <rembold@de.ibm.com>
Diffstat (limited to 'hwpf')
-rwxr-xr-x[-rw-r--r--]hwpf/fapi/.empty0
-rwxr-xr-xhwpf/fapi/docs/Doxyfile2355
-rwxr-xr-xhwpf/fapi/docs/README6
-rwxr-xr-xhwpf/fapi/docs/topics/DEPRECATED.md81
-rwxr-xr-xhwpf/fapi/docs/topics/Examples.md246
-rwxr-xr-xhwpf/fapi/docs/topics/Ffdc.md149
-rwxr-xr-xhwpf/fapi/docs/topics/README.md166
-rwxr-xr-xhwpf/fapi/include/buffer.H423
-rwxr-xr-xhwpf/fapi/include/buffer_base.H331
-rwxr-xr-xhwpf/fapi/include/buffer_parameters.H65
-rwxr-xr-xhwpf/fapi/include/buffer_traits.H232
-rwxr-xr-xhwpf/fapi/include/collect_reg_ffdc.H78
-rwxr-xr-xhwpf/fapi/include/error_info.H854
-rwxr-xr-xhwpf/fapi/include/error_scope.H104
-rwxr-xr-xhwpf/fapi/include/ffdc.H191
-rwxr-xr-xhwpf/fapi/include/hw_access.H720
-rwxr-xr-xhwpf/fapi/include/plat_trace.H64
-rwxr-xr-xhwpf/fapi/include/return_code.H180
-rwxr-xr-xhwpf/fapi/include/target.H337
-rwxr-xr-xhwpf/fapi/include/target_types.H105
-rwxr-xr-xhwpf/fapi/include/utils.H59
-rwxr-xr-xhwpf/fapi/include/variable_buffer.H663
-rwxr-xr-xhwpf/fapi/src/error_info.C410
-rwxr-xr-xhwpf/fapi/src/ffdc.C57
-rwxr-xr-xhwpf/fapi/src/plat_utils.C117
-rwxr-xr-xhwpf/fapi/tools/parseErrorInfo.pl1479
-rwxr-xr-xhwpf/fapi/xml/buffer_errors.xml40
-rwxr-xr-x[-rw-r--r--]hwpf/plat/.empty0
-rw-r--r--hwpf/plat/include/array.H174
-rw-r--r--hwpf/plat/include/buffer.H423
-rw-r--r--hwpf/plat/include/buffer_base.H347
-rw-r--r--hwpf/plat/include/buffer_parameters.H65
-rw-r--r--hwpf/plat/include/buffer_traits.H238
-rw-r--r--hwpf/plat/include/error_scope.H147
-rw-r--r--hwpf/plat/include/fapi2.H44
-rw-r--r--hwpf/plat/include/fapi2Structs.H109
-rw-r--r--hwpf/plat/include/hw_access.H716
-rw-r--r--hwpf/plat/include/plat_hw_access.H78
-rw-r--r--hwpf/plat/include/plat_includes.H40
-rw-r--r--hwpf/plat/include/plat_target_definitions.H112
-rw-r--r--hwpf/plat/include/plat_target_parms.H62
-rw-r--r--hwpf/plat/include/return_code.H187
-rw-r--r--hwpf/plat/include/target.H532
-rw-r--r--hwpf/plat/include/target_types.H132
-rw-r--r--hwpf/plat/include/utils.H56
-rw-r--r--hwpf/plat/include/variable_buffer.H670
-rw-r--r--hwpf/plat/src/Makefile21
-rw-r--r--hwpf/plat/src/array.C145
-rw-r--r--hwpf/plat/src/error_info.C410
-rw-r--r--hwpf/plat/src/fapi2ppefiles.mk24
-rw-r--r--hwpf/plat/src/ffdc.C57
-rw-r--r--hwpf/plat/src/plat_utils.C135
-rw-r--r--hwpf/plat/src/target.C35
-rwxr-xr-xhwpf/plat/target_map49
54 files changed, 14520 insertions, 0 deletions
diff --git a/hwpf/fapi/.empty b/hwpf/fapi/.empty
index e69de29b..e69de29b 100644..100755
--- a/hwpf/fapi/.empty
+++ b/hwpf/fapi/.empty
diff --git a/hwpf/fapi/docs/Doxyfile b/hwpf/fapi/docs/Doxyfile
new file mode 100755
index 00000000..9cb5dc43
--- /dev/null
+++ b/hwpf/fapi/docs/Doxyfile
@@ -0,0 +1,2355 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "FAPI 2"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = genfiles
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = NO
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = ../include ./topics
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.idl \
+ *.ddl \
+ *.odl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.cs \
+ *.d \
+ *.php \
+ *.php4 \
+ *.php5 \
+ *.phtml \
+ *.inc \
+ *.m \
+ *.markdown \
+ *.md \
+ *.mm \
+ *.dox \
+ *.py \
+ *.f90 \
+ *.f \
+ *.for \
+ *.tcl \
+ *.vhd \
+ *.vhdl \
+ *.ucf \
+ *.qsf \
+ *.as \
+ *.js \
+ *.H
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 1
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = YES
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED = DOXYGEN
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/hwpf/fapi/docs/README b/hwpf/fapi/docs/README
new file mode 100755
index 00000000..da66d671
--- /dev/null
+++ b/hwpf/fapi/docs/README
@@ -0,0 +1,6 @@
+
+To generate FAPI2 documentation, run
+
+$doxygen Doxyfile
+
+The documentation will be output into genfiles.
diff --git a/hwpf/fapi/docs/topics/DEPRECATED.md b/hwpf/fapi/docs/topics/DEPRECATED.md
new file mode 100755
index 00000000..39df626e
--- /dev/null
+++ b/hwpf/fapi/docs/topics/DEPRECATED.md
@@ -0,0 +1,81 @@
+@deprecated Functions which were either not found used in the
+hostboot code or have other ways to perform the same operation
+with the new buffers are candidates for deprecation. They are listed
+here so if you're looking for something you might find that it's
+deprecated and not been implemented. If there's something in this
+list which should be implemented, let someone know and we can
+implement it.<br>
+- setDoubleWordLength(uint32_t i_newNumDoubleWords);<br>
+- setWordLength(uint32_t i_newNumWords);<br>
+- setHalfWordLength(uint32_t i_newNumHalfWords);<br>
+- setByteLength(uint32_t i_newNumBytes);<br>
+- setBitLength(uint32_t i_newNumBits);<br>
+- setCapacity (uint32_t i_newNumWords);<br>
+- shrinkBitLength(uint32_t i_newNumBits);<br>
+- growBitLength(uint32_t i_newNumBits);<br>
+Replaced with std::container operations
+- shiftRight(uint32_t i_shiftnum, uint32_t i_offset = 0);<br>
+Replaced with operator>> as offset appears unused<br>
+- shiftLeft(uint32_t i_shiftnum, uint32_t i_offset = 0xFFFFFFFF);<br>
+Replaced with operator<< as offset appears unused<br>
+- shiftRightAndResize(uint32_t i_shiftnum, uint32_t i_offset = 0);<br>
+- shiftLeftAndResize(uint32_t i_shiftnum);<br>
+- rotateRight(uint32_t i_rotatenum);<br>
+- rotateLeft(uint32_t i_rotatenum);<br>
+- flushTo0(); and flushTo1();<br>
+Replaced with flush<X>() where X can be {0,1}<br>
+- applyInversionMask(const uint32_t * i_invMask, uint32_t
+ i_invByteLen);<br>
+- applyInversionMask(const ecmdDataBufferBase & i_invMaskBuffer,
+ uint32_t i_invByteLen);<br>
+- insert(const ecmdDataBufferBase & i_bufferIn, uint32_t i_targetStart,
+ uint32_t i_len, uint32_t i_sourceStart = 0);<br>
+ insert(const uint32_t * i_data, uint32_t i_targetStart, uint32_t
+ i_len, uint32_t i_sourceStart = 0);<br>
+It appears from the usage that the insert functions were used like a
+initializer list - given a chunk of data, insert at bit 0.
+Other useages have been replaced with a templated version for
+variable_buffers and bit operations for integral buffers.<br>
+- insertFromRight<br>
+Replaced with a templated version for
+variable_buffers and bit operations for integral buffers.<br>
+- extract API<br>
+Replaced with a templated version for
+variable_buffers and bit operations for integral buffers.<br>
+- setOr API/merge API<br>
+- concat( ... );<br>
+Replaced with operator+() and operator+=()<br>
+- setOr(const uint32_t * i_data, uint32_t i_startbit,
+ uint32_t i_len);<br>
+ merge()
+Replaced with operator|=() as it looks like startbit is always 0
+and len is always the length of i_data. Merge is the same I think<br>
+- setXor(const ecmdDataBufferBase & i_bufferIn, uint32_t i_startbit,
+ uint32_t i_len);
+Replaced with operator|=() as it looks like startbit is always 0
+and len is always the length of i_data.<br>
+- setAnd(const ecmdDataBufferBase & i_bufferIn, uint32_t i_startbit,
+ uint32_t i_len);<br>
+Replaced with operator&=() as it looks like startbit is mostly 0
+and len is mostly the length of i_data. The few cases seen where
+this isn't the case, a uint64_t mask would work better.<br>
+- copy(ecmdDataBufferBase & o_copyBuffer) const
+Replaced with operator=()
+- memCopyIn, memCopyOut
+- flattenSize(void) const;
+- flatten(uint8_t * o_data, uint32_t i_len) const;
+- unflatten(const uint8_t * i_data, uint32_t i_len);
+- oddParity()
+- evenParity()
+- shareBuffer(ecmdDataBufferBase* i_sharingBuffer);
+- compressBuffer(ecmdCompressionMode_t i_mode = ECMD_COMP_PRD);
+- uncompressBuffer();
+- isBufferCompressed();
+- setWord(), setHalfWord(), etc.
+Replaced with a templated version, set<type>();
+- getDoubleWordLength(), getDoubleLength
+Replaced with a templated version taking the type as an argument
+- getCapacity()
+- writeBit(bits_type i_bit, uint32_t i_value);
+Replaced with set operations (this might be needed?)
+e \ No newline at end of file
diff --git a/hwpf/fapi/docs/topics/Examples.md b/hwpf/fapi/docs/topics/Examples.md
new file mode 100755
index 00000000..e7ccb027
--- /dev/null
+++ b/hwpf/fapi/docs/topics/Examples.md
@@ -0,0 +1,246 @@
+
+# Examples And Frequently Asked Questions
+
+## Buffers
+
+### Create a buffer of 32 bits and initialize it.
+
+ fapi2::buffer<uint32_t> data(0xAA55FFAA);
+
+### Flip bit 0
+
+ data.flipBit<0>();
+
+### Invert the buffer
+
+ data.invert();
+
+### Reset it's value
+
+ data = 0xFFFFFFFF;
+
+### Create a mask using an anonymous object
+
+ my_buffer &= buffer<T>().setBit<B>.invert();
+
+### Create an 8 bit buffer, initialize it, and flip some bits around
+
+ fapi2::buffer<uint8_t>(0xA5).flipBit<5>().flipBit<5>() == 0xA5;
+
+## Operations and Things
+### Is the FAPI_TRY / 'clean_up:' method, the recommended method for doing put/getscoms?
+
+Yes, FAPI_TRY is the preferred wrapper for put/get scom as well as other operations which used to do the do/while/break dance based on the fapi return code.
+A thread-local fapi return code, fapi2::current_err has been introduced to help with the housekeeping.
+
+Feel free to decompose the FAPI_TRY pattern if you have clean_up requirements which make FAPI_TRY too simplistic.
+
+
+## Targets
+
+### Create a processor target
+
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A);
+
+### Define a function which takes only a processor as an argument, enforced by the compiler
+
+ void takesProc( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& V );
+
+### How do I pass TARGET_TYPE_X into putScom?
+
+It should "just work." fapi2::putScom is defined as a template.
+Basically any TargetType will match. So,
+
+ Target<TARGET_TYPE_XBUS> foo;
+ Target<TARGET_TYPE_ABUS> bar;
+
+will both match fapi::putScom in it's more generic sense. However, platforms
+might specialize the hw_access templates. For example, if the operation to
+perform a putScom on an XBUS is different than accessing other targets, the
+platform needs to specialize for XBUS.
+
+ template<>
+ fapi2::ReturnCode fapi2::putScom (const fapi2::Target<TARGET_TYPE_XBUS> &i_target, const uint64_t i_address, buffer< uint64_t > &i_data)
+ {
+ // Do XBUS special code here.
+ }
+
+### How do I get <information> with the new targets when this used to be an attribute look up before?
+
+This question came up in the context of ATTR_CHIP_UNIT_POS, but really applies for any information
+previously tucked away in attributes.
+
+Do the attribute lookup, the platform can optimize the look up away. In any event the get_attr macro/call will always do the right thing.
+
+If the platform can resolve the lookup without looking anything up (all the information is encoded in the value of the target) the attribute
+mechanism can simply do that manipulation at compile time.
+
+For the smaller platforms, we discussed attribute look ups were templates which could be (would be?) specialized per attribute "key."
+In this way, the "look up" for the unit position could be coded to be nothing more than a static manipulation of the target value.
+A look up would, obviously, be needed if the unit position (or any other attribute value) couldn't be resolved from the target value alone.
+
+### Target Types
+
+#### How do I write a procedure which takes multiple target types?
+
+Depends on what you mean.
+
+##### If you mean "I have a procedure which is generic but only for a subset of types":
+
+ fapi2::ReturnCode newProcedure( const fapi2::Target<TARGET_TYPE_XBUS | TARGET_TYPE_ABUS> & i_target, ...);
+
+Note that newProcedure can not then say "if xbus, do this, if abus do the
+other." This is the static equivilent of grabbing a "base class" and the same
+rules apply - if the method is not generic for all the subclasses, you need to
+specialize for those subclasses.
+
+__Think twice about using this mechanism. It creates a new type (the or of the
+target types) and reduces the input to this type. There is no support for run
+time type conversion, and so the original type is not available in this scope.__
+
+##### If you mean "I have a procedure and I want it to do different things for different target types":
+
+You can create templates:
+
+ template<fapi2::TargetType T>
+ void newProcedure( const fapi2::Target<T>& i_target );
+
+ template<>
+ void newProcedure( const fapi2::Target<TARGET_TYPE_XBUS>& i_target )
+ {
+ // XBUS specific code here
+ }
+
+ template<>
+ void newProcedure( const fapi2::Target<TARGET_TYPE_ABUS>& i_target )
+ {
+ // ABUS specific code here
+ }
+
+Notice that because the generic case for newProcedure is declared but
+never defined you will get an error at compile time if newProcedure is
+called with a type other than XBUS or ABUS.
+
+Or overloaded functions:
+
+ void newProcedure( const fapi2::Target<TARGET_TYPE_XBUS>& i_target )
+ {
+ // XBUS specific code here
+ }
+
+ void newProcedure( const fapi2::Target<TARGET_TYPE_ABUS>& i_target )
+ {
+ // ABUS specific code here
+ }
+
+##### If you mean "I have a procedure which is mostly generic but I need special handling for some target types":
+
+More or less the same as above, but define the generic template. There is no equivilent for
+overloaded functions unless a composite target will suit your needs.
+
+ template<fapi2::TargetType T>
+ void newProcedure( const fapi2::Target<T>& i_target )
+ {
+ // Code for types other than ABUS or XBUS
+ }
+
+ template<>
+ void newProcedure( const fapi2::Target<TARGET_TYPE_XBUS>& i_target )
+ {
+ // XBUS specific code here
+ }
+
+ template<>
+ void newProcedure( const fapi2::Target<TARGET_TYPE_ABUS>& i_target )
+ {
+ // ABUS specific code here
+ }
+
+##### If you want to build a procedure which takes all target types:
+
+__It is recomended that you do not use TARGET_TYPE_ALL - that will reduce the
+type of the passed in target to the "top level base class" of targets and
+every procedure called will need to be completly generic. This is probably
+not what you inteded (but is sometimes useful.) Rather, it is recomended
+that you simply make a generic template.__
+
+ template<fapi2::TargetType T>
+ void newProcedure( const fapi2::Target<T>& i_target )
+ {
+ // Code for all types
+ fapi2::putScom(i_target, ... );
+ }
+
+Note that the putScom here will always be the correct putScom for the
+target type passed in. Assuming procedures called in this method have
+been specialized for specific target types, the compiler will find the
+best match and call it.
+
+#### Once I'm in newProcedure, what is the type of the target?
+
+If you used a generic or specialized template, the type will be the type
+of the target passed in. If you used a composite type (or'd together target
+types) then the type will be TYPE_A | TYPE_B.
+
+Notice there's no simple way to know the original type was TYPE_A in this
+case. If you think about this, it makes sense. Consider:
+
+ void f(double x);
+
+ int y = 3;
+ f(y);
+
+There's no way in f() to know that x started life as an int, which happened to
+be cast to a double.
+
+Targets are the same thing - they're just types we create on the fly. So all of
+the usual C++ tools to deal with this are available.
+
+#### So, wait - I can't write a procedure which handles multiple target types?
+
+You can. What you can't do is figure out the type of the object prior to
+the cast. So what you need to do is make sure the original type isn't lost,
+and that means you can't use TYPE_A | TYPE_B:
+
+##### Specialize. This is the prefered mechanism.
+The template and overload examples above show how to do this specialization.
+It will create very regular and easy to maintain code.
+
+##### Create a generic template and handle each type yourself.
+
+ template<fapi2::TargetType T>
+ void newProcedure( fapi2::Target<T> i_target )
+ {
+ // If this procedure isn't generic, check for allowed types here.
+ static_assert(fapi2::is_same<T, fapi2::TARGET_TYPE_ABUS>() || fapi2::is_same<T, fapi2::TARGET_TYPE_XBUS>(),
+ "newProcedure only takes X/A busses");
+
+ :
+ :
+
+ if (fapi2::is_same<T, fapi2::TARGET_TYPE_ABUS>())
+ {
+ // ABUS code
+ }
+
+ if (fapi2::is_same<T, fapi2::TARGET_TYPE_XBUS>())
+ {
+ // XBUS code
+ }
+
+ :
+ :
+ }
+
+newProcedure is a generic template, any target type will match. And, the type T of i_target is
+the original value of the target - the template matched without a cast because it's generic.
+However, with that generality we lost the compiler argument type checking so we replace it with
+the static_assert. This happens at compile time so the compiler will complain if a target other
+than an XBUS or ABUS is passed in to this procedure. To handle the special cases for the types,
+fapi2::is_same is used again - and is also a compile time operation. And so when this template
+matches an XBUS target, the code generated is specific to the XBUS target.
+
+#### Ok, so what is TARGET_TYPE_X | TARGET_TYPE_Y for then?
+
+Creating procedures which are generic to those types. Think of this as a base
+class method.
diff --git a/hwpf/fapi/docs/topics/Ffdc.md b/hwpf/fapi/docs/topics/Ffdc.md
new file mode 100755
index 00000000..85d696b1
--- /dev/null
+++ b/hwpf/fapi/docs/topics/Ffdc.md
@@ -0,0 +1,149 @@
+
+# Using the FFDC/XML Error Parsing Tools
+
+For FAPI2, the parseErrorInfo PERL script has changed. The main goal was to
+enable FFDC generation classes/methods. This enables a named-parameter
+model as well as tucking the FFDC generation into a container which can
+easily be used by the FAPI_ASSERT macro.
+
+## Using the Tools
+
+parseErrorInfo.pl [--empty-ffdc-classes] [--use-variable-buffers] --output-dir=<output dir> <filename1> <filename2> ...
+- This perl script will parse HWP Error XML files and creates the following files:
+- hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)
+- hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR when a HWP generates an error)
+- collect_reg_ffdc.C. Function to collect register FFDC
+- set_sbe_error.H. Macro to create an SBE error
+
+The --empty-ffdc-classes option is for platforms which don't collect FFDC. It will generate stub classes which
+will allow the source to have the same code, but compile to no-ops on certain platforms.
+
+The --use-variable-bufers option is for platforms which support variable buffers.
+
+The XML input is the same format as for P8
+
+## Using the Generated Classes
+
+Each error found in the XML files generates a class in hwp_ffdc_classes.H.
+The name of the class is the same as the return code itself (lower case)
+and the set methods are the same as the elements the xml described as
+needing colletion.
+
+Take for example RC_MBVPD_INVALID_MT_DATA. Here is the XML:
+
+ <hwpError>
+ <rc>RC_MBVPD_INVALID_MT_DATA</rc>
+ <description>
+ To get the proper MT data, we need a valid
+ dimm rank combination.
+ </description>
+ <ffdc>RANK_NUM</ffdc>
+ <callout>
+ <procedure>CODE</procedure>
+ <priority>HIGH</priority>
+ </callout>
+ </hwpError>
+
+It generates an FFDC class which looks like this (simplified):
+
+ class rc_mbvpd_invalid_mt_data
+ {
+ public:
+ rc_mbvpd_invalid_mt_data( ... )
+ { FAPI_ERR("To get the proper MT data, we need a valid dimm rank combination."); }
+
+ rc_mbvpd_invalid_mt_data& set_rank_num(const T& i_value)
+ { <setup ffdc> }
+
+ void execute(void)
+ {
+ FAPI_SET_HWP_ERROR(..., RC_MBVPD_INVALID_MT_DATA);
+ fapi2::logError( ... );
+ }
+ };
+
+To use this, for example, you may do:
+
+ FAPI_ASSERT( foo != bar,
+ rc_mbvpd_invalid_mt_data().set_rank_num(l_rank),
+ "foo didn't equal bar" );
+
+Notice the description of the error is automatically logged.
+
+## Buffer Support
+
+In FAPI, a ReturnCode had a mechanism for "containing" an error from an
+ecmdDataBuffer. The API, setEcmdError(), no longer exists. fapi2::buffers
+return ReturnCodes, and as such the FFDC information is added in a manner
+consistent with the rest of the FFDC gathering.
+
+There is a new error xml file specifically for buffers called
+buffer_error.xml. It will generate an FFDC class which will take a buffer
+as an argument and generate the correct FFDC.
+
+ <hwpError>
+ <rc>RC_FAPI2_BUFFER</rc>
+ <description>
+ fapi2 error from a buffer operation
+ </description>
+ <buffer>BUFFER</buffer>
+ <callout>
+ <procedure>CODE</procedure>
+ <priority>HIGH</priority>
+ </callout>
+ </hwpError>
+
+And its FFDC class:
+
+ class rc_fapi2_buffer
+ {
+ public:
+ rc_fapi2_buffer( ... )
+ { FAPI_ERR("fapi2 error from a buffer operation"); }
+
+ rc_fapi2_buffer& set_buffer(const fapi2::variable_buffer& i_value)
+ { ... }
+
+ template< typename T >
+ rc_fapi2_buffer& set_buffer(const fapi2::buffer<T>& i_value)
+ { ... }
+ };
+
+And it can be used:
+
+ fapi2::buffer<uint64_t> foo;
+ fapi2::variable_buffer bar;
+
+ FAPI_ASSERT( rc != FAPI2_RC_SUCCESS,
+ rc_fapi2_buffer().set_fapi2_buffer(foo),
+ "problem with buffer" );
+
+ FAPI_ASSERT( rc != FAPI2_RC_SUCCESS,
+ rc_fapi2_buffer().set_fapi2_buffer(bar),
+ "problem with buffer" );
+
+Note the indifference to integral or variable buffers.
+
+## Error Log Generation
+
+FAPI had a function called fapiLogError() which would generate platform
+errors. The pattern was to call fapiLogError() at the end of the block
+which generated the FFDC. With the addition of the FFDC classes, this
+is no longer needed - the class knows to create these logs for you.
+
+However, the severity information is needed by this logging mechanism.
+It was an argument to fapiLogError(), and so it's been added to the
+constructor of the FFDC class:
+
+rc_repair_ring_invalid_ringbuf_ptr(fapi2::errlSeverity_t i_sev, ...)
+
+It defaults to "unrecoverable" and so only need be set for errors
+which have a different severity. That is, doing nothing will get you
+and error log with unrecoverable severity - which was the default
+for FAPI.
+
+## Known Limitations
+
+- Collecting register FFDC is not presently implemented.
+- Calling out to hwp to collect FFDC is not presently implemented.
+- The FirstFailureData class does not have a platform pointer \ No newline at end of file
diff --git a/hwpf/fapi/docs/topics/README.md b/hwpf/fapi/docs/topics/README.md
new file mode 100755
index 00000000..ee7a9f07
--- /dev/null
+++ b/hwpf/fapi/docs/topics/README.md
@@ -0,0 +1,166 @@
+
+# FAPI 2 and FAPI Lite definitions for targets, buffers, error handling.
+
+## Were are some examples?
+
+Examples can be found in the "Related Pages" tab. These examples are constantly
+being expanded, please check back often.
+
+## How is the code structured?
+
+There is a new namespace; fapi2. This was created to prevent
+the FAPI 1 code, in the fapi namespace, from colliding with the new code.
+
+- Most documentation can be found under the class definition.
+- Documentation for FAPI_TRY/FAPI_ASSERT is in the file error_scope.H,
+ and doesn't have a "tab" in the HTML like the classes and the namespaces do.
+- The documentation for TargeType is in the fapi namespace section.
+
+## What do I need to implement for my platform?
+
+### fapi2::buffer and fapi2::variable_buffer
+There should be nothing for platforms to implement in the buffer code.
+Smaller platforms which use fapi2::variable_buffer will need to
+ensure they have an implementation of std::vector. Hostboot has one
+which I'm sure you can steal if needed.
+
+### fapi2::Target and fapi2::TargetType
+Target is defined as a template of <TargetType, Value> where
+Value is defined per platform. Smaller platforms will want an integer
+type here, say uint64_t. Larger platforms may want to change this to
+a pointer to an underlying platform specific targeting object.
+
+The target traversing functions will need to be implemented per-platform.
+
+### Hardware Access (fapi2::getScom() ...)
+
+All of the hardware access functions are assumed to need implementation
+per platform.
+
+Please use template specialization for target types which need special
+treatment. The API documented here are generic, but they can be made
+very specific for a target type or composite type.
+
+For example (perhaps a poor example ...)
+
+ template< TargetType K >
+ ReturnCode getScom(const Target<K>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& o_data)
+can become
+
+ template<>
+ ReturnCode getScom(const Target<TARGET_TYPE_DIMM>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& o_data)
+for DIMMs
+
+or
+
+ template<>
+ ReturnCode getScom(const Target<TARGET_TYPE_XBUS | TARGET_TYPE_ABUS>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& o_data)
+
+for XBUS and ABUS
+
+### fapi2::ReturnCode and error_scope.H
+
+For smaller platforms, a fapi::ReturnCode is nothing but a uint64_t. For
+larger platforms fapi2::ReturnCode inherits from a (TBD) FFDC object.
+
+There should be nothing to do for error_scope.H
+
+### fapi2::FirstFailureData (FFDC (work in progress))
+
+The platform specific FFDC object will need to be implemented, but the
+tooling to generate the FFDC functions used in FAPI_ASSERT will be provided.
+
+### Attributes
+
+As in FAPI 1, platforms will need to implement the mechanism behind the
+ATTR_GET/SET macros.
+
+## How to report an issue?
+
+Something in here is wrong - I'm sure of it. But you found it before someone
+else. Please don't fire off an email into the ether; it will get lost.
+Report an issue. Issues can be tracked and you can see what other issues are
+taking priority over yours, etc. It's just better for everyone.
+
+__To report an issue use Clear Quest__
+ - Tier: ip Firmware
+ - Reported Release: FW910
+ - Subsystem: Hostboot
+ - Component: FAPI
+
+## Not sure how to do something?
+
+So you've read the API documentation and it's horrible. You can't figure
+out how to get anything done. Could be an issue, could be you just need the
+crazy engineer who specified this horrible mess to see what struggles they
+created in their overzealous attempt to make things "simple."
+
+__Put it on the wiki__
+
+You could send someone an email, and that might work out great. But if you
+use the wiki you can be abrasive with your comments! Others might be able
+to help or offer an opinion or become a member of the virtual posse you're
+gathering to track down the crazy engineer. Good fun? You need a hobby.
+
+None the less, the crazy engineer should update the FAPI 2 documentation when
+the best practice is worked out, or create an issue to track the change
+(and add it to a test case.)
+
+Examples can be found in the "Related Pages" tab.
+
+Questions have been asked as topics on the PFD/HW for P9 community wiki.
+
+## Something missing? Before you report an issue ...
+
+Many of the API from FAPI 1 have been changed into templated functions. For
+example,
+
+ ecmdDataBuffer::getDoubleWordLength() -> fapi::buffer::getLength<uint64_t>()
+ ecmdDataBuffer::getWordLength() -> fapi::buffer::getLength<uint32_t>()
+ ecmdDataBuffer::getHalfWordLength() -> fapi::buffer::getLength<uint16_t>()
+
+Some API have been deprecated in favor of other API, some API have been
+deprecated and are waiting for a use-case, and they'll be implemented.
+A list of deprecated ecmdDataBuffer functions can be found in the
+fapi::buffer_base class documentation.
+
+Some API have been removed/deprecated and are expected to return in a different
+form once the requirements are understood. Examples of this are the compressed
+fapi::buffers. While platforms may need these functions, they have been removed
+from the class itself as they are not vital to the class operation. These
+functions, as needed, will be replaced with utility functions which perform the
+operations needed for the platform. An example is fapi::Target::toString.
+It has been replaced with fapi::toString(Target, ...) which can be overloaded
+to take any type, and makes a nice utility for the fapi namespace.
+
+Some API have plum been forgotten. You should open an issue so we can track
+the implementation.
+
+## Where's the documentation for Attributes?
+
+The attribute macros are not expected to change for FAPI 2:
+
+ l_rc = FAPI_ATTR_GET(<ID>, l_pTarget, l_val);
+ l_rc = FAPI_ATTR_SET(<ID>, l_pTarget, l_val);
+ l_rc = FAPI_ATTR_GET_PRIVILEGED(<ID>, l_pTarget, l_val);
+ l_rc = FAPI_ATTR_SET_PRIVILEGED(<ID>, l_pTarget, l_val);
+
+There is one outstanding question:
+ 1. whether we should/can change from a pointer to a target to a reference
+ to a target to save a dereference on the smaller platforms (maybe it gets
+ optimized out anyway?)
+
+ Seems like the answer will be "no," but this depends on the PPE attribute
+ look up scheme I think. Work in Progress.
+
+## Where's the FFDC documentation?
+
+Currently scheduled for End of February, 2015.
+
+## Other Known Issues
+
+- Thread local storage is broken on gcc 4.8, and the thread_local variables in
+error_scope.H will need to become pthread TLS for the time being.
diff --git a/hwpf/fapi/include/buffer.H b/hwpf/fapi/include/buffer.H
new file mode 100755
index 00000000..3f28c187
--- /dev/null
+++ b/hwpf/fapi/include/buffer.H
@@ -0,0 +1,423 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer.H
+ * @brief definitions for fapi2 variable integral buffers
+ */
+
+#ifndef __FAPI2_INTEGRAL_BUFFER__
+#define __FAPI2_INTEGRAL_BUFFER__
+
+#include <buffer_base.H>
+#include <return_code.H>
+
+namespace fapi2
+{
+ /// @brief Class representing a FAPI buffer<T>
+ /// @note Buffers support method chaining. So, rather than
+ /// this
+ /// @code
+ /// buffer<T> mask;
+ /// mask.setBit<B>();
+ /// mask.invert();
+ /// my_buffer &= mask;
+ /// @endcode
+ /// You can do
+ /// @code
+ /// my_buffer &= buffer<T>().setBit<B>.invert();
+ /// @endcode
+ template <typename T>
+ class buffer : public buffer_base<T>
+ {
+ public:
+ /// Shortcut typedef to map to our traits class
+ typedef typename buffer_base<T, buffer>::bits_type bits_type;
+
+ ///
+ /// @brief Integral buffer assignment constructor
+ /// @param[in] i_value initial value of the buffer
+ /// Meaningless for variable types and thus protected.
+ ///
+ inline buffer(T i_value = 0)
+ {
+ // Why not an initializer list? That would force buffer_base<T>
+ // to have a ctor which took a T, and I want to avoid that in
+ // the generic case: this makes it more clear that the two
+ // ctor's (integral and container) behave very differently.
+ // variable_buffers also have a ctor which takes a single
+ // numerical value, and that represents a bit count, not an
+ // initial value.
+ this->iv_data = i_value;
+ }
+
+
+ /// @name Bit/Word Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Return the length of the buffer in bits
+ /// @return Length in bits
+ ///
+ inline constexpr uint32_t getBitLength(void) const
+ { return bufferTraits<T>::bit_length(this->iv_data); }
+
+ ///
+ /// @brief Return the length of the buffer in OT units
+ /// @return Length in OT units rounded up
+ /// @tparam OT the type to get the length of. For example, if one
+ /// wanted the length in double words, OT would be uint64_t
+ /// (getLength<uint64_t>().) Similarly, to get the length in words,
+ /// getLength<uin32_t>().
+ ///
+ template< typename OT >
+ inline constexpr uint32_t getLength(void) const
+ {
+ return bufferTraits<T>::template size<OT>(this->iv_data);
+ }
+
+ ///
+ /// @brief Templated setBit for integral types
+ /// @tparam B the bit number to set.
+ /// @return buffer& Useful for method chaining
+ /// @note 0 is left-most
+ /// @note Example: fapi2::buffer<uint64_t>().setBit<3>();
+ ///
+ template <bits_type B>
+ inline buffer& setBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ // Force iv_data to be dependent on the template type to force
+ // its look up in the second phase
+ this->iv_data |= (static_cast<T>(1)) << (bufferTraits<T>::bits_per_unit - B - 1);
+ return *this;
+ }
+
+ ///
+ /// @brief Clear a bit in buffer
+ /// @tparam B Bit in buffer to clear.
+ /// @return buffer& Useful for method chaining
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline buffer& clearBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ this->iv_data &= buffer<T>().setBit<B>().invert();
+ return *this;
+ }
+
+ ///
+ /// @brief Invert bit
+ /// @tparam B Bit in buffer to invert.
+ /// @return buffer& Useful for method chaining
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline buffer& flipBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ this->iv_data ^= buffer<T>().setBit<B>();
+ return *this;
+ }
+
+ ///
+ /// @brief Set a bit in the buffer
+ /// @param[in] i_bit the bit number to set.
+ /// @note 0 is left-most
+ /// @return FAPI2_RC_SUCCESS if OK
+ ///
+ inline fapi2::ReturnCode setBit(const bits_type& i_bit)
+ {
+ if (i_bit >= bufferTraits<T>::bits_per_unit)
+ {
+ return FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ // Force iv_data to be dependent on the template type to force
+ // its look up in the second phase
+ this->iv_data |=
+ (static_cast<T>(1)) << (bufferTraits<T>::bits_per_unit - i_bit - 1);
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Get the value of a bit in the buffer
+ /// @tparam B Bit in buffer to get.
+ /// @return true if bit is on, false if bit is off
+ ///
+ template< bits_type B >
+ inline bool getBit(void) const
+ {
+ return buffer<T>().setBit<B>() & this->iv_data;
+ }
+
+ ///@}
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ // Note: Many (all?) of these are not needed and the compiler complains
+ // as the cast to T yields a better operator. There are here mainly for
+ // documenation purposes.
+
+ ///
+ /// @brief operator>>()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator>>(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator<<()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator<<(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator+()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator+(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator+=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator+=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator|=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator&=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator|(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator&(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator^=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator^=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator~()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator~(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator==()
+ ///
+#ifdef DOXYGEN
+ bool operator==(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator!=()
+ ///
+#ifdef DOXYGEN
+ bool operator!=(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief Copy part of a OT into the DataBuffer
+ /// @tparam TS Start bit to insert into (target start)
+ /// @tparam L Length of bits to insert
+ /// @tparam SS Start bit in source
+ /// @tparam OT the type of the incoming (origin) data
+ /// @param[in] i_datain OT value to copy into DataBuffer
+ /// - data is taken left aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, bits_type SS, typename OT>
+ inline void insert(const OT i_datain)
+ {
+ const bits_type target_length = parameterTraits<T>::bit_length;
+ const bits_type source_length = parameterTraits<OT>::bit_length;
+
+ // Error if input data don't make sense
+ static_assert((TS + L) <= target_length,
+ "insert(): (Target Start + Len) is out of bounds");
+ static_assert((SS + L) <= source_length,
+ "insert(): (Source Start + Len) is out of bounds");
+ static_assert(TS < target_length,
+ "insert(): Target Start is out of bounds");
+ static_assert(SS < source_length,
+ "insert(): Source Start is out of bounds");
+
+ // Get mask value for Target buffer
+ // Note: Need "& ((T)-1) because bit shift left for Target buffer doesn't roll off
+ T mask =((T(~0) << (target_length - L)) & T(~0)) >> TS;
+
+ // Calculate the equivalent position of the input Source start for the size of the Target buffer.
+
+ // Assume OT is smaller (sizeof(T) > sizeof(OT))
+ uint64_t sourceShift = abs(TS - ((target_length - source_length) + SS));
+ uint64_t sourceAlign = T(i_datain) << sourceShift;
+
+ if (sizeof(T) == sizeof(OT))
+ {
+ sourceShift = abs(SS - TS);
+ sourceAlign = (SS > TS) ? ((T)i_datain) << sourceShift : ((T)i_datain) >> sourceShift;
+ }
+
+ if (sizeof(T) < sizeof(OT))
+ {
+ sourceShift = source_length - target_length;
+ if (SS <= sourceShift)
+ {
+ sourceShift = sourceShift + TS - SS;
+ sourceAlign = ((OT)i_datain) >> sourceShift;
+ }
+
+ // (SS > sourceShift)
+ else
+ {
+ if (sourceShift > TS)
+ {
+ sourceShift = SS - sourceShift - TS;
+ sourceAlign = OT(i_datain) << sourceShift;
+ }
+ else
+ {
+ sourceShift = SS - sourceShift;
+ sourceAlign = (sourceShift < TS) ? OT(i_datain) >> sourceShift : OT(i_datain);
+ }
+ }
+ }
+
+ this->iv_data = (this->iv_data & ~mask) | (sourceAlign & mask);
+ return;
+ }
+
+ ///
+ /// @brief Copy in a right aligned value
+ /// @tparam SB Start bit to insert into
+ /// @tparam L Length of bits to insert
+ /// @tparam OT the type of the incoming (origin) data
+ /// @param[in] i_datain OT value to copy into DataBuffer
+ /// - data is taken right aligned
+ /// @note Data is assumed to be aligned on the word boundary of L
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, typename OT>
+ inline void insertFromRight(const OT i_datain)
+ {
+ // Error if input data don't make sense
+ static_assert(L < parameterTraits<OT>::bit_length,
+ "insertFromRight(): Len >= input buffer");
+ static_assert(TS < parameterTraits<T>::bit_length,
+ "insertFromRight(): Target Start is out of bounds");
+ static_assert((TS + L) <= parameterTraits<T>::bit_length,
+ "InsertFromRight(): (Target Start + Len) is out of bounds");
+
+ this->insert<TS, L, parameterTraits<OT>::bit_length - L>(i_datain);
+ return;
+ }
+
+ ///
+ /// @brief Copy data from this buffer into an OT
+ /// @tparam TS Start bit to insert into (target start)
+ /// @tparam L Length of bits to insert
+ /// @tparam SS Start bit in source
+ /// @tparam OT the type of the outgoing (target)
+ /// @param[out] o_out OT to copy into - data is placed left aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, bits_type SS, typename OT>
+ inline void extract(OT& o_out)
+ {
+ // Extraction is just an insert into o_out
+
+ buffer<OT> out(o_out);
+ out.insert<TS, L, SS>(this->iv_data);
+ o_out = out;
+ return;
+ }
+
+#if 0
+ ///
+ /// @brief Copy data from this buffer into an OT and right justify
+ /// @tparam OT the type of the outgoing data - defaults to T
+ /// @tparam SB Start bit to insert into - defaults to 0
+ /// @tparam SS Start bit in o_out - default value is zero
+ /// @tparam L Length of bits to copy - defaults to sizeof(OT) * 8
+ /// @param[out] o_out OT to copy into - data is placed right aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @post Data is copied from specified location to o_out, right
+ /// aligned. Data is only right aligned if L < sizeof(bits_type)
+ ///
+ template< typename OT = T, bits_type L = parameterTraits<OT>::bit_length,
+ bits_type SB = 0, bits_type SS = 0 >
+ void extractFromRight(OT& o_out);
+#endif
+ ///@}
+ };
+};
+
+#endif
diff --git a/hwpf/fapi/include/buffer_base.H b/hwpf/fapi/include/buffer_base.H
new file mode 100755
index 00000000..a6e8c4ad
--- /dev/null
+++ b/hwpf/fapi/include/buffer_base.H
@@ -0,0 +1,331 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_base.H
+ * @brief definitions for fapi2 buffer base class
+ */
+
+#ifndef __FAPI2_BUFFER_BASE__
+#define __FAPI2_BUFFER_BASE__
+
+#include <stdint.h>
+#include <initializer_list>
+#include <error_scope.H>
+#include <buffer_parameters.H>
+#include <buffer_traits.H>
+#include <return_code.H>
+
+namespace fapi2
+{
+ /// @brief Base class for buffers and variable buffers
+ /// @tparam T is the type of iv_data (std::vector, etc)
+ /// @tparam TT is the template trait, defaults to the trait for T
+ ///
+ /// Buffers can be of two styles; buffers made from an integral type and
+ /// buffers made from a container. Integral type buffers, while limited
+ /// in size, can be tightly controlled via the compiler by using c++
+ /// templates.
+ ///
+ /// C++ templates allow for very explicit control, but yield a
+ /// syntax different than the FAPI 1.x functional interface. For example,
+ /// a fapi2::buffer is defined as having a type:
+ /// @code
+ /// fapi2::buffer<uint64_t> new_buffer;
+ /// @endcode
+ /// defines a buffer with exactly 64 bits, and can be manipulated by the
+ /// compiler as a single intrgral value. These implementations result
+ /// in concise instruction streams, and a platform may choose to implement
+ /// all or some or none of the integral buffer types.
+ ///
+ /// Buffers which have containers as their underlying implementation
+ /// are found in the class fapi2::variable_buffer. variable_buffer is little
+ /// more than
+ /// @code
+ /// fapi2::buffer<fapi2::bits_container>
+ /// @endcode
+ /// where bits_container is the typedef of the underlying container (a
+ /// vector of uint32_t, for example)
+ ///
+ /// Examples:<br>
+ ///
+ /// * Simple uint64_t buffer
+ /// @code
+ /// const uint32_t x = 2;
+ ///
+ /// // this data buffer will contain data in a uint64_t type
+ /// fapi2::buffer<uint64_t> data;
+ ///
+ /// // Set using the template and a constant
+ /// data.setBit<x>();
+ ///
+ /// // Set using the template and a value
+ /// data.setBit<3>();
+ ///
+ /// // Set using the function interface, and a value
+ /// data.setBit(1);
+ ///
+ /// // compiler gets smart.
+ /// // movabs $0x7000000000000000,%rsi
+ /// @endcode
+ ///
+ /// * variable_buffer, same thing
+ /// @code
+ ///
+ /// const uint32_t x = 2;
+ ///
+ /// // Note: only 15 bits long
+ /// fapi2::variable_buffer data(15);
+ ///
+ ///
+ /// data.setBit(x);
+ /// data.setBit(3);
+ /// data.setBit(1);
+ /// @endcode
+ ///
+ /// * method chaining
+ /// Buffers support method chaining. So, rather than
+ /// this
+ /// @code
+ /// buffer<T> mask;
+ /// mask.setBit<B>();
+ /// mask.invert();
+ /// my_buffer &= mask;
+ /// @endcode
+ /// You can do
+ /// @code
+ /// my_buffer &= buffer<T>().setBit<B>.invert();
+ /// @endcode
+ ///
+ /// * buffer operations
+ /// @code
+ ///
+ /// // An 8 bit buffer, initialized with a value
+ /// fapi2::buffer<uint8_t> eight_bits = 0xAA;
+ /// fapi2::buffer<uint8_t> another_eight;
+ /// fapi2::buffer<uint16_t> sixteen_bits;
+ ///
+ /// // You can't assign an 8 bit buffer to a 16 bit buffer.
+ /// sixteen_bits = eight_bits; ERROR
+ ///
+ /// // But you can assign buffers of the same type
+ /// another_eight = eight_bits;
+ ///
+ /// // You can assign constants (or other known values) directly:
+ /// sixteen_bits = 0xAABB;
+ /// @endcode
+ ///
+ /// * Variable buffer operations
+ ///
+ /// @code
+ /// fapi2::variable_buffer data(16);
+ ///
+ /// // Very large buffers can be initialized rather than set bit by bit.
+ /// const fapi2::variable_buffer bit_settings_known(
+ /// {0xFFFF0000, 0xAABBF0F0,
+ /// 0xFFFF0000, 0xAABBF0F0,
+ /// 0xFFFF0000, 0xAABBF0F0,});
+ ///
+ /// // Assignment will expand or shrink the size automatically.
+ /// data = bit_settings_known;
+ ///
+ /// // You can assign directly to the buffer:
+ /// fapi2::variable_buffer other_bits;
+ /// const fapi2::container_unit x = 0xFF00AA55;
+ /// other_bits = {x, 0xDEADBEEF};
+ /// @endcode
+ ///
+ template <typename T, typename TT = bufferTraits<T> >
+ class buffer_base
+ {
+
+ public:
+
+ /// Shortcut typedef to get to our traits class
+ typedef typename TT::bits_type bits_type;
+ /// Shortcut typedef to get to our traits class
+ typedef typename TT::unit_type unit_type;
+
+ ///
+ /// @brief Default constructor
+ /// @note iv_data will get the "default" construction, which is
+ /// correct - 0 for integral types, an empty container for the others.
+ ///
+ buffer_base(void):
+ iv_data()
+ {}
+
+ virtual ~buffer_base(void)
+ {}
+
+#ifndef DOXYGEN
+ /// @brief Print the contents of the buffer to stdout
+ inline void print(void) const
+ { TT::print(iv_data); }
+#endif
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline operator T() const { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline operator T&() { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline T& operator()(void) { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return Reference to the contents of the buffer
+ ///
+ inline const T& operator()(void) const { return iv_data; }
+
+ ///
+ /// @brief Get a pointer to the buffer bits
+ /// @return Pointer to the buffer itself
+ ///
+ inline T* pointer(void) { return &iv_data; }
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Set an OT of data in buffer
+ /// @param[in] i_value sizeof(OT) bits of data
+ /// @param[in] i_offset Start OT (start word, for example) in buffer
+ /// - defaults to 0 (will by default write the left most element)
+ /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
+ /// @note This is is only available for integral types. To set a
+ /// variable_buffer into a variable_buffer, use insert()
+ ///
+ template< typename OT>
+ inline fapi2::ReturnCode set(OT i_value, const bits_type i_offset = 0)
+ {
+ // Compile time check to make sure OT isn't a variable buffer
+ static_assert( !std::is_same<bits_container, OT>::value,
+ "Can't use a variable_buffer as input to set()" );
+
+ //
+ // There's a gotcha in here. size<OT>() returns the size in the buffer
+ // in OT units *rounded up*. This is the actual size of the buffer, not
+ // the perceived size of a variable_buffer. This should be OK however,
+ // as what we're trying to prevent is overflow, which this should do.
+ //
+ const uint32_t length = TT:: template size<OT>(iv_data);
+ static const bits_type bits_in_value = parameterTraits<OT>::bit_length;
+ const bits_type bit_length = TT::bit_length(iv_data);
+
+ if (i_offset >= length)
+ {
+ return FAPI2_RC_OVERFLOW;
+ }
+
+ // Create mask if part of this byte is not in the valid part of the buffer,
+ // Shift it left by the amount of unused bits,
+ // Clear the unused bits
+ if (((i_offset + 1) == length) && (bit_length % bits_in_value)) {
+ i_value &= parameterTraits<OT>::mask << ((bits_in_value * length) - bit_length);
+ }
+
+ parameterTraits<OT>::template write_element<unit_type>(TT::get_address(iv_data), i_value, i_offset);
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Set and entire buffer to X's
+ /// @tparam X {0,1} depending if you want to clear (0)
+ /// or fill (1) a buffer
+ ///
+ template< uint8_t X >
+ inline void flush(void)
+ {
+ static_assert( (X == 1) || (X == 0), "bad argument to flush" );
+ (0 == X) ? TT::clear(iv_data) : TT::set(iv_data);
+ }
+
+ ///
+ /// @brief Invert entire buffer
+ /// @return buffer_base&, Useful for method chaining
+ ///
+ inline buffer_base& invert(void)
+ { TT::invert(iv_data); return *this; }
+
+ ///
+ /// @brief Bit reverse entire buffer
+ /// @return buffer_base&, Useful for method chaining
+ ///
+ inline buffer_base& reverse(void)
+ { TT::reverse(iv_data); return *this; }
+
+ //@}
+ protected:
+
+ ///
+ /// @brief Variable buffer constructor
+ /// @param[in] i_value number of *bits* (sizeof(container_units) * 8)
+ /// needed. Meaningless for integral types and thus protected.
+ ///
+ buffer_base(bits_type i_value);
+
+ ///
+ /// @brief Variable buffer construct from a list
+ /// @param[in] i_value an initializer list to initialize the container.
+ /// Meaningless for integral types and thus protected
+ ///
+ buffer_base(std::initializer_list<unit_type> i_value);
+
+ ///
+ /// @brief Clear the buffer
+ ///
+ inline void clear(void)
+ { TT::clear(iv_data); }
+
+ /// The contents of the buffer
+ T iv_data;
+ };
+
+ template <typename T, typename TT>
+ inline buffer_base<T, TT>::buffer_base(bits_type i_value):
+ iv_data( std::max(bits_type(1),
+ bits_type(i_value / 8 / sizeof(bits_type))))
+ {
+ }
+
+ template <typename T, typename TT>
+ inline buffer_base<T, TT>::buffer_base(std::initializer_list<unit_type> i_value):
+ iv_data(i_value)
+ {
+ }
+};
+
+
+
+#endif
diff --git a/hwpf/fapi/include/buffer_parameters.H b/hwpf/fapi/include/buffer_parameters.H
new file mode 100755
index 00000000..3dc41b26
--- /dev/null
+++ b/hwpf/fapi/include/buffer_parameters.H
@@ -0,0 +1,65 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_parameters.H
+ * @brief definitions for fapi2 buffer parameter types
+ */
+
+#ifndef __FAPI2_BUFFER_PARAM__
+#define __FAPI2_BUFFER_PARAM__
+
+#include <stdint.h>
+
+namespace fapi2
+{
+ /// @cond
+ /// @brief Traits of buffer parameters - things passed in
+ /// @tparam T is the type of i_value (typically an integral type)
+ template<typename T>
+ class parameterTraits
+ {
+ public:
+ enum
+ {
+ mask = T(~0),
+ bit_length = sizeof(T) * 8,
+ byte_length = sizeof(T),
+ };
+
+ template<typename U>
+ inline static void write_element(void* i_data, T i_value, uint32_t i_offset)
+ {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ T* ptr = (T*)i_data + (i_offset ^ ((sizeof(U) / sizeof(T)) - 1));
+#else
+ T* ptr = (T*)i_data + i_offset;
+#endif
+ *ptr = i_value;
+ }
+ };
+ /// @endcond
+};
+
+#endif
diff --git a/hwpf/fapi/include/buffer_traits.H b/hwpf/fapi/include/buffer_traits.H
new file mode 100755
index 00000000..5fa9f0b7
--- /dev/null
+++ b/hwpf/fapi/include/buffer_traits.H
@@ -0,0 +1,232 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_traits.H
+ * @brief trait definitions for fapi2 buffer base class
+ */
+
+#ifndef __FAPI2_BUFFER_TRAITS__
+#define __FAPI2_BUFFER_TRAITS__
+
+#include <stdint.h>
+#include <vector>
+#include <algorithm>
+#include <buffer_parameters.H>
+
+// for debug printing ... can be removed for flight
+#include <iostream>
+#include <iterator>
+
+namespace fapi2
+{
+ /// @cond
+ /// Types representing a container of bits. Used to create
+ /// variable_buffer.
+ typedef uint32_t container_unit;
+ typedef std::vector<container_unit> bits_container;
+
+ /// @brief Traits of buffers
+ // In general, we try to give buffers traits reflecting integral types. If
+ // this fails, the compiler will let someone know.
+ ///
+ /// @tparam T is the type of iv_data (std::vector, etc)
+ /// @tparam B is the type of the bit-specifier, typically uint32_t
+ template<typename T, typename B = uint32_t>
+ class bufferTraits
+ {
+ public:
+#ifndef DOXYGEN
+ ///
+ /// @brief Print a container of bits
+ /// @param[in] i_data the container of bits
+ ///
+ static inline void print(const T& i_data)
+ {
+ // convert to uint64_t to prevent uint8_t from being
+ // printed as a char.
+ std::cout << "\tdata is "
+ << std::hex
+ << static_cast<uint64_t>(i_data)
+ << std::dec << std::endl;
+ }
+#endif
+
+ ///
+ /// @brief Return the size of the buffer in E units
+ /// @tparam E, the element size.
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in E's rounded up
+ ///
+ template<typename E>
+ constexpr static B size(const T& i_buffer)
+ {
+ return (bit_length(i_buffer) +
+ (parameterTraits<E>::bit_length - 1)) /
+ parameterTraits<E>::bit_length;
+ }
+
+ ///
+ /// @brief Return the size of the buffer itself
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in bits (not units)
+ ///
+ constexpr static B bit_length(const T&)
+ { return sizeof(T) * 8; }
+
+ ///
+ /// @brief Clear the buffer
+ /// @param[in,out] io_buffer the buffer which to clear
+ ///
+ static inline void clear(T& io_buffer)
+ { io_buffer = static_cast<T>(0); }
+
+ ///
+ /// @brief Set the buffer
+ /// @param[in,out] io_buffer the buffer which to set
+ ///
+ static inline void set(T& io_buffer)
+ { io_buffer = static_cast<T>(~0); }
+
+ ///
+ /// @brief Invert the buffer
+ /// @param[in,out] io_buffer the buffer which to invert
+ ///
+ static inline void invert(T& io_buffer)
+ { io_buffer = ~io_buffer; }
+
+ ///
+ /// @brief Reverse the buffer
+ /// @param[in,out] io_buffer the buffer which to reverse
+ ///
+ static inline void reverse(T& io_buffer)
+ {
+ io_buffer =
+ ((io_buffer & 0xAAAAAAAAAAAAAAAA) >> 1) |
+ ((io_buffer & 0x5555555555555555) << 1);
+ }
+
+ ///
+ /// @brief Get the address of the buffer as an array
+ /// @param[in] i_buffer the buffer which to invert
+ /// @return The address of the first element of the buffer
+ ///
+ static inline void* get_address(T& i_buffer)
+ { return (void*)&i_buffer; }
+
+ typedef B bits_type;
+ typedef T unit_type;
+ enum { bits_per_unit = sizeof(unit_type) * 8 };
+ };
+
+ //
+ //
+ /// @brief Traits for buffers which are a container of bits
+ //
+ //
+ template<>
+ class bufferTraits<bits_container, uint32_t>
+ {
+ public:
+#ifndef DOXYGEN
+ ///
+ /// @brief Print a container of bits
+ /// @param[in] i_data the container of bits
+ ///
+ static inline void print(const bits_container& i_data)
+ {
+ std::cout << "\tdata is " << std::hex;
+ std::copy(i_data.begin(), i_data.end(),
+ std::ostream_iterator<container_unit>(std::cout, " "));
+ std::cout << std::dec << std::endl;
+ }
+#endif
+
+ ///
+ /// @brief Return the size of the buffer in E units
+ /// @tparam E, the element size.
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in E's rounded up
+ ///
+ template<typename E>
+ constexpr static uint32_t size(const bits_container& i_buffer)
+ {
+ return (bit_length(i_buffer) +
+ (parameterTraits<E>::bit_length - 1)) /
+ parameterTraits<E>::bit_length;
+ }
+
+ ///
+ /// @brief Return the size of the buffer itself
+ /// @param[in,out] io_buffer the buffer which to size
+ /// @return The size of the buffer in bits (not units)
+ ///
+ static inline uint32_t bit_length(const bits_container& i_buffer)
+ { return i_buffer.size() * sizeof(container_unit) * 8; }
+
+ ///
+ /// @brief Clear the buffer
+ /// @param[in,out] io_buffer the buffer which to clear
+ ///
+ static inline void clear(bits_container& io_buffer)
+ { io_buffer.assign(io_buffer.size(), 0); }
+
+ ///
+ /// @brief Set the buffer
+ /// @param[in,out] io_buffer the buffer which to set
+ ///
+ static inline void set(bits_container& io_buffer)
+ { io_buffer.assign(io_buffer.size(), ~0); }
+
+ ///
+ /// @brief Invert the buffer
+ /// @param[in,out] io_buffer the buffer which to invert
+ ///
+ static inline void invert(bits_container& io_buffer)
+ {
+ std::transform(io_buffer.begin(), io_buffer.end(),
+ io_buffer.begin(),
+ [](container_unit u) { return ~u; });
+ }
+
+ ///
+ /// @brief Get the address of the buffer as an array
+ /// @param[in] i_buffer the buffer which to invert
+ /// @return The address of the first element of the buffer
+ ///
+ static inline void* get_address(bits_container& i_buffer)
+ {
+ return (void*)&(i_buffer[0]);
+ }
+
+ typedef uint32_t bits_type;
+ typedef container_unit unit_type;
+ enum { bits_per_unit = sizeof(unit_type) * 8 };
+ };
+ /// @endcond
+};
+
+
+
+#endif
diff --git a/hwpf/fapi/include/collect_reg_ffdc.H b/hwpf/fapi/include/collect_reg_ffdc.H
new file mode 100755
index 00000000..495b2a3c
--- /dev/null
+++ b/hwpf/fapi/include/collect_reg_ffdc.H
@@ -0,0 +1,78 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* */
+/* 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 */
+/**
+ * @file collect_reg_ffdc.H
+ *
+ * @brief Defines the collectRegFfdc function that collects chip or
+ * chiplet register FFDC data. This is called automatically by
+ * FAPI_SET_HWP_ERROR (when a HWP creates an error) and
+ * FAPI_ADD_INFO_TO_HWP_ERROR (when an FFDC HWP adds error information
+ * to an existing error) if the error XML contains a
+ * <collectRegisterFfdc> element. This function should not be called
+ * directly by any user code. The function implementation is
+ * automatically generated from FAPI Error XML files.
+ */
+
+#ifndef FAPI2_COLLECT_REG_FFDC_H_
+#define FAPI2_COLLECT_REG_FFDC_H_
+
+#include <target.H>
+#include <return_code.H>
+#include <ffdc.H>
+#include <hwp_error_info.H>
+
+namespace fapi2
+{
+
+ ///
+ /// @brief Collects Register FFDC from a chip or chiplet
+ ///
+ /// @warning This should only be called by FAPI during FAPI_SET_HWP_ERROR or
+ /// FAPI_ADD_INFO_TO_HWP_ERROR
+ ///
+ /// @param[in] i_target Pointer to Target to collect FFDC from
+ /// @param[in] i_ffdcId FFDC Identifier
+ /// @param[out] o_rc Reference to ReturnCode that FFDC is added to
+ /// @param[in] i_child Specifies type of i_target's chiplet to collect
+ /// FFDC from. If this parameter is TARGET_TYPE_NONE
+ /// (default value), then register FFDC is collected
+ /// from i_target, else, register FFDC is collected
+ /// from all functional child chiplets i_target of
+ /// the specified type
+ /// @param[in] i_presChild When specified, register FFDC will be collected
+ /// from i_target's registers based on present chiplets
+ /// of this type.
+ /// @param[in] i_childOffsetMult Specifies the chiplet position offset multiplier.
+ /// This is used in calculating the scom register
+ /// addresses when collecting register FFDC based on
+ /// present child chiplets.
+ ///
+ void collectRegFfdc(const fapi2::Target<TARGET_TYPE_ALL>* i_target,
+ const fapi2::HwpFfdcId i_ffdcId,
+ fapi2::ReturnCode & o_rc,
+ const TargetType i_child = TARGET_TYPE_NONE,
+ const TargetType i_presChild = TARGET_TYPE_NONE,
+ uint32_t i_childOffsetMult = 0);
+}
+
+#endif
diff --git a/hwpf/fapi/include/error_info.H b/hwpf/fapi/include/error_info.H
new file mode 100755
index 00000000..b28ab011
--- /dev/null
+++ b/hwpf/fapi/include/error_info.H
@@ -0,0 +1,854 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] 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 */
+
+///
+/// @file error_info.H
+/// @brief Defines the Error Information structures and classes
+///
+
+#ifndef FAPI2_ERRORINFO_H_
+#define FAPI2_ERRORINFO_H_
+
+#include <stdint.h>
+#include <memory>
+#include <vector>
+#include <target.H>
+#include <assert.h>
+
+namespace fapi2
+{
+ class ReturnCode;
+
+ ///
+ /// @brief Type to hold the ffdc element in the ffdc class
+ /// Needed so that the size can be squirled away before the
+ /// macro is called.
+ ///
+ class ffdc_t
+ {
+ public:
+ ffdc_t(void)
+ {}
+
+ operator const void*() const { return iv_value.first; }
+ operator const uint8_t() const
+ { return *(reinterpret_cast<const uint8_t*>(iv_value.first)); }
+
+ int16_t size(void) const { return iv_value.second; }
+ int16_t& size(void) { return iv_value.second; }
+
+ const void* ptr(void) const { return iv_value.first; }
+ const void*& ptr(void) { return iv_value.first; }
+
+ private:
+ std::pair<const void*, int16_t> iv_value;
+ };
+
+ ///
+ /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a
+ /// special type that cannot simply be memcopied
+ enum ErrorInfoFfdcSize
+ {
+ EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer<T>
+ EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target
+ EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer
+ EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb
+ };
+
+ ///
+ /// @brief Enumeration of error log severity.
+ ///
+ enum errlSeverity_t
+ {
+ FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer
+ FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see
+ FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general
+ };
+
+ ///
+ /// @brief Enumeration of ErrorInfo types
+ ///
+ enum ErrorInfoType
+ {
+ EI_TYPE_FFDC = 0,
+ EI_TYPE_HW_CALLOUT = 1,
+ EI_TYPE_PROCEDURE_CALLOUT = 2,
+ EI_TYPE_BUS_CALLOUT = 3,
+ EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD
+ EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD
+ EI_TYPE_COLLECT_TRACE = 6,
+ EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1,
+ };
+
+ ///
+ /// @enum HwCallout
+ ///
+ /// This enumeration defines the possible Hardware Callouts that are not
+ /// represented by fapi2::Targets
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform callout value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace HwCallouts
+ {
+ enum HwCallout
+ {
+ // Where indicated, a HW Callout in FAPI Error XML must include a
+ // reference target that is used to identify the HW. e.g. for
+ // TOD_CLOCK, the proc chip that the clock is attached to must be
+ // specified
+ TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet)
+ MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet)
+ PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet)
+ PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet)
+ FLASH_CONTROLLER_PART = 4,
+ PNOR_PART = 5,
+ SBE_SEEPROM_PART = 6,
+ VPD_PART = 7,
+ LPC_SLAVE_PART = 8,
+ GPIO_EXPANDER_PART = 9,
+ SPIVID_SLAVE_PART = 10,
+ };
+ }
+
+ ///
+ /// @enum ProcedureCallout
+ ///
+ /// This enumeration defines the possible Procedure Callouts
+ /// These instruct the customer/customer-engineer what to do
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform callout value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace ProcedureCallouts
+ {
+ enum ProcedureCallout
+ {
+ CODE = 0, // Code problem
+ LVL_SUPPORT = 1, // Call next level of support
+ MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error
+ BUS_CALLOUT = 3, // Bus Called Out
+ };
+ }
+
+ ///
+ /// @enum CalloutPriority
+ ///
+ /// This enumeration defines the possible Procedure and Target callout priorities
+ ///
+ /// Note that platform code may depend on the enum values starting at 0 and
+ /// incrementing in order to efficiently convert to a platform priority value
+ /// so do not reorder without consulting all platforms
+ ///
+ namespace CalloutPriorities
+ {
+ enum CalloutPriority
+ {
+ LOW = 0,
+ MEDIUM = 1,
+ HIGH = 2,
+ };
+ }
+
+ ///
+ /// @enum Collect Trace
+ ///
+ /// This enumeration defines the possible firmware traces to collect
+ ///
+ namespace CollectTraces
+ {
+ const uint32_t TRACE_SIZE = 256; // limit collected trace size
+ enum CollectTrace
+ {
+ FSI = 1,
+ SCOM = 2,
+ SCAN = 3,
+ MBOX = 4,
+ };
+ }
+
+ ///
+ /// @brief Get FFDC Size
+ ///
+ /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of
+ /// FFDC data. If the data is of a special type that is handled differently
+ /// than types that are simply memcopied then it is handled by a template
+ /// specialization.
+ /// If this function template is instantiated with a pointer, the compile
+ /// will fail.
+ ///
+ /// @return uint16_t. Size of the FFDC data
+ ///
+ template<typename T>
+ inline uint16_t getErrorInfoFfdcSize(const T &)
+ {
+ static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE,
+ "FFDC too large to capture");
+ return sizeof(T);
+ }
+
+ ///
+ /// @brief Compile error if caller tries to get the FFDC size of a pointer
+ ///
+ template<typename T>
+ inline uint16_t getErrorInfoFfdcSize(const T*)
+ {
+ static_assert(std::is_pointer<T>::value,
+ "pointer passed to getErrorInfoFfdcSize");
+ }
+
+ ///
+ /// @brief Get FFDC Size specialization for fapi2::Target
+ ///
+ template<>
+ inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<TARGET_TYPE_ALL>*)
+ {
+ return EI_FFDC_SIZE_TARGET;
+ }
+
+ ///
+ /// @brief Get FFDC Size specialization for ffdc method arguments
+ /// @note The ffdc class sets the std::pair when the method is
+ /// called so the size has been calculated. All that needs to be
+ /// done here is to grab it. We do it this way so the macro definitions
+ /// can be the same whether the ffdc class is used or the old-school
+ /// locals.
+ ///
+ template<>
+ inline uint16_t getErrorInfoFfdcSize(const fapi2::ffdc_t& i_thing)
+ {
+ return i_thing.size();
+ }
+
+ ///
+ /// @class ErrorInfoFfdc
+ ///
+ /// This class contains a copy of some FFDC data
+ ///
+ class ErrorInfoFfdc
+ {
+ public:
+ ///
+ /// @brief Constructor
+ ///
+ /// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
+ /// @param[in] i_pFfdc Pointer to the FFDC to copy
+ /// @param[in] i_size Size of the FFDC to copy
+ ///
+ ErrorInfoFfdc(const uint32_t i_ffdcId,
+ const void* i_pFfdc,
+ const uint32_t i_size);
+
+ ///
+ /// @brief Get a pointer to the FfdcData
+ ///
+ /// @param[out] o_size Reference to uint32_t that is filled in with
+ /// the FFDC size
+ ///
+ /// @return void *. Pointer to the FFDC
+ ///
+ inline const void* getData(uint32_t & o_size) const
+ {
+ o_size = iv_size;
+ return iv_pFfdc.get();
+ }
+
+ ///
+ /// @brief Get a pointer to the FfdcData
+ /// @return void *. Pointer to the FFDC
+ ///
+ inline void* getData(void) const
+ { return iv_pFfdc.get(); }
+
+ ///
+ /// @brief Get the FFDC Identifier
+ ///
+ /// @return uint32_t The FFDC Identifier
+ ///
+ inline uint32_t getFfdcId(void)
+ { return iv_ffdcId; }
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ private:
+
+ // FFDC Identifier
+ uint32_t iv_ffdcId;
+
+ // Pointer to the FFDC
+ std::shared_ptr<uint8_t> iv_pFfdc;
+
+ // Size of the FFDC
+ uint32_t iv_size;
+
+ // Disabled
+ ErrorInfoFfdc(const ErrorInfoFfdc &) = delete;
+ ErrorInfoFfdc & operator=(const ErrorInfoFfdc &) = delete;
+ };
+
+ ///
+ /// @struct ErrorInfoHwCallout
+ ///
+ /// This struct contains hardware to callout
+ ///
+ struct ErrorInfoHwCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_hw Hardware to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ /// @param[in] i_refTarget Reference to reference target
+ ///
+ ErrorInfoHwCallout(
+ const HwCallouts::HwCallout i_hw,
+ const CalloutPriorities::CalloutPriority i_calloutPriority,
+ const Target<TARGET_TYPE_ALL> & i_refTarget);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The hw to callout
+ HwCallouts::HwCallout iv_hw;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // The reference target (needed for some HW callouts to identify what to
+ // callout). The target handle is NULL if there is no reference target.
+ Target<TARGET_TYPE_ALL> iv_refTarget;
+ };
+
+ ///
+ /// @struct ErrorInfoProcedureCallout
+ ///
+ /// This struct contains a procedure to callout
+ ///
+ struct ErrorInfoProcedureCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_procedure Procedure to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoProcedureCallout(
+ const ProcedureCallouts::ProcedureCallout i_procedure,
+ const CalloutPriorities::CalloutPriority i_calloutPriority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The procedure to callout
+ ProcedureCallouts::ProcedureCallout iv_procedure;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+ };
+
+ ///
+ /// @struct ErrorInfoBusCallout
+ ///
+ /// This struct contains a bus to callout
+ ///
+ struct ErrorInfoBusCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target1 Reference to target on one end of the bus
+ /// @param[in] i_target2 Reference to target on other end of the bus
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoBusCallout(
+ const Target<TARGET_TYPE_ALL> & i_target1,
+ const Target<TARGET_TYPE_ALL> & i_target2,
+ const CalloutPriorities::CalloutPriority i_calloutPriority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The targets on each end of the bus to callout
+ Target<TARGET_TYPE_ALL> iv_target1;
+ Target<TARGET_TYPE_ALL> iv_target2;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+ };
+
+ ///
+ /// @struct ErrorInfoCDG
+ ///
+ /// This struct contains a target to callout/deconfigure/GARD
+ ///
+ struct ErrorInfoCDG
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target Reference to the target to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ ///
+ ErrorInfoCDG(const Target<TARGET_TYPE_ALL> & i_target,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The target to callout/deconfigure/GARD
+ Target<TARGET_TYPE_ALL> iv_target;
+
+ // Callout Information
+ bool iv_callout;
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // Deconfigure Information
+ bool iv_deconfigure;
+
+ // GARD Information
+ bool iv_gard;
+ };
+
+ ///
+ /// @struct ErrorInfoChildrenCDG
+ ///
+ /// This struct contains children targets to callout/deconfigure/GARD
+ ///
+ /// Children by containment can be CDG (chiplets belonging to a parent chip)
+ /// e.g.
+ /// - PROC_CHIP -> EX_CHIPLET
+ /// - MEMBUF_CHIP -> MBA_CHIPLET
+ /// Children by affinity can be CDG.
+ /// Any from PROC_CHIP->MCS_CHIPLET->MEMBUF_CHIP->MBA_CHIPLET->DIMM e.g.
+ /// - PROC_CHIP->MEMBUF_CHIP
+ /// - MEMBUF_CHIP->DIMM
+ /// - MBA_CHIPLET->DIMM
+ /// Port and Number criteria can be applied to the child target as
+ /// detailed in the constructor
+ ///
+ struct ErrorInfoChildrenCDG
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_parent Reference to the parent target
+ /// @oaram[in] i_childType Child target type to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ /// @param[in] i_childPort Child Port
+ /// For DIMM children, the MBA port number
+ /// @param[in] i_childNum Child Number
+ /// For DIMM children, the dimm socket number
+ /// For Chip children, the chip position
+ /// For Chiplet children, the chiplet unit pos
+ ///
+ ErrorInfoChildrenCDG(const Target<TARGET_TYPE_ALL> & i_parentChip,
+ const TargetType i_childType,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority,
+ const uint8_t i_childPort, const uint8_t i_childNum);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The parent chip
+ Target<TARGET_TYPE_ALL> iv_parent;
+
+ // The child target types to c/d/g
+ TargetType iv_childType;
+
+ // Callout Information
+ bool iv_callout;
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // Deconfigure Information
+ bool iv_deconfigure;
+
+ // GARD Information
+ bool iv_gard;
+
+ // Child Port
+ static const uint8_t ALL_CHILD_PORTS = 0xff;
+ uint8_t iv_childPort;
+
+ // Child Number
+ static const uint8_t ALL_CHILD_NUMBERS = 0xff;
+ uint8_t iv_childNumber;
+ };
+
+ ///
+ /// @struct ErrorInfoCollectTrace
+ ///
+ /// This struct contains trace ID to add to the error log
+ ///
+ struct ErrorInfoCollectTrace
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_trace
+ ///
+ ErrorInfoCollectTrace(CollectTraces::CollectTrace i_traceId);
+
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // trace
+ CollectTraces::CollectTrace iv_eiTraceId;
+ };
+
+ ///
+ /// @struct ErrorInfo
+ ///
+ /// This struct defines the error information associated with a fapi2::ffdc
+ /// Users are allowed to access the data directly
+ ///
+ struct ErrorInfo
+ {
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // Vector of FFDC Data
+ std::vector<std::shared_ptr<ErrorInfoFfdc> > iv_ffdcs;
+
+ // Vector of Hardware to callout
+ std::vector<std::shared_ptr<ErrorInfoHwCallout> > iv_hwCallouts;
+
+ // Vector of procedures to callout
+ std::vector<std::shared_ptr<ErrorInfoProcedureCallout> >
+ iv_procedureCallouts;
+
+ // Vector of buses to callout
+ std::vector<std::shared_ptr<ErrorInfoBusCallout> > iv_busCallouts;
+
+ // Vector of targets to callout/deconfigure/GARD
+ std::vector<std::shared_ptr<ErrorInfoCDG> > iv_CDGs;
+
+ // Vector of children targets to callout/deconfigure/GARD
+ std::vector<std::shared_ptr<ErrorInfoChildrenCDG> > iv_childrenCDGs;
+
+ // Vector of traces to collect
+ std::vector<std::shared_ptr<ErrorInfoCollectTrace> > iv_traces;
+ };
+
+ ///
+ /// @brief Structure representing a single ErrorInfo entry.
+ ///
+ /// An array of these is passed to the addErrorInfo function when a HWP
+ /// generates an error by calling the FAPI_SET_HWP_ERROR macro
+ // Why aren't these inherited classes? Saves on allocation overhead.
+ // We create an array of ErrorInfoEntries as automatics when we start
+ // FFDC collection. If we did this as inherited classes it would either
+ // be allocating and deallocating or we'd need to allocate an array of
+ // the largest and map each struct in to it. That's messy to do without
+ // unions (that's what they're for) so we do it like this. The inherited
+ // model would result in a jump table anyway, so we're basically doing
+ // all of that by hand to avoid the mess.
+ //
+ struct ErrorInfoEntryFfdc
+ {
+ uint8_t iv_ffdcObjIndex;
+ uint16_t iv_ffdcSize;
+ uint32_t iv_ffdcId;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a hardware callout
+ ///
+ struct ErrorInfoEntryHwCallout
+ {
+ uint8_t iv_hw;
+ uint8_t iv_calloutPriority;
+ uint8_t iv_refObjIndex;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a procedure callout
+ ///
+ struct ErrorInfoEntryProcCallout
+ {
+ uint8_t iv_procedure;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+
+ ErrorInfoEntryProcCallout(uint8_t i_procedure, uint8_t i_calloutPriority):
+ iv_procedure(i_procedure),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ErrorInfoEntryProcCallout(void) = default;
+ };
+
+ ///
+ /// @brief Structure representing a bus callout
+ ///
+ struct ErrorInfoEntryBusCallout
+ {
+ uint8_t iv_endpoint1ObjIndex;
+ uint8_t iv_endpoint2ObjIndex;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a target callout
+ ///
+ struct ErrorInfoEntryTargetCDG
+ {
+ uint8_t iv_targetObjIndex;
+ uint8_t iv_callout;
+ uint8_t iv_deconfigure;
+ uint8_t iv_gard;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a child callout
+ ///
+ struct ErrorInfoEntryChildrenCDG
+ {
+ uint8_t iv_parentObjIndex;
+ uint8_t iv_callout;
+ uint8_t iv_deconfigure;
+ uint32_t iv_childType;
+ uint8_t iv_childPort;
+ uint8_t iv_childNumber;
+ uint8_t iv_gard;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing collected trace information
+ ///
+ struct ErrorInfoEntryCollectTrace
+ {
+ uint32_t iv_eieTraceId;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Union of all the error info types
+ ///
+ struct ErrorInfoEntry
+ {
+ uint8_t iv_type; // Value from ErrorInfoType
+ union
+ {
+ ErrorInfoEntryFfdc ffdc;
+ ErrorInfoEntryHwCallout hw_callout;
+ ErrorInfoEntryProcCallout proc_callout;
+ ErrorInfoEntryBusCallout bus_callout;
+ ErrorInfoEntryTargetCDG target_cdg;
+ ErrorInfoEntryChildrenCDG children_cdg;
+ ErrorInfoEntryCollectTrace collect_trace;
+ };
+
+ ///
+ /// @brief Add error information to the FFDC object
+ /// @param[in] i_info a shared pointer to the error info
+ /// @param[in] i_object the list of ffdc objects being collected
+ ///
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // "unhandled error info type");
+ assert(iv_type < EI_LAST_TYPE);
+
+ switch(iv_type)
+ {
+ case EI_TYPE_FFDC:
+ ffdc.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_HW_CALLOUT:
+ hw_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_PROCEDURE_CALLOUT:
+ proc_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_BUS_CALLOUT:
+ bus_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_CDG:
+ target_cdg.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_CHILDREN_CDG:
+ children_cdg.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_COLLECT_TRACE:
+ collect_trace.addErrorInfo(i_info, i_object);
+ break;
+ };
+ return;
+ }
+ };
+}
+
+#endif // FAPI2_ERRORINFO_H_
diff --git a/hwpf/fapi/include/error_scope.H b/hwpf/fapi/include/error_scope.H
new file mode 100755
index 00000000..d510c6de
--- /dev/null
+++ b/hwpf/fapi/include/error_scope.H
@@ -0,0 +1,104 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file error_scope.H
+ * @brief definitions which create a scope for automatic error handling
+ */
+
+#ifndef __FAPI2_ERROR_SCOPE__
+#define __FAPI2_ERROR_SCOPE__
+
+#include <stdint.h>
+#include <thread>
+#include <stdio.h>
+#include <return_code.H>
+
+/// @cond
+#define FAPI_VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N
+#define FAPI_VA_NARGS(...) FAPI_VA_NARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
+
+#define FAPI_TRY_IMPL2(count, ...) FAPI_TRY ## count (__VA_ARGS__)
+#define FAPI_TRY_IMPL(count, ...) FAPI_TRY_IMPL2(count, __VA_ARGS__)
+
+#define FAPI_TRY_NO_TRACE( __operation__ ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ goto clean_up; \
+ }
+
+// Why debug? Because this isn't a mechanism to gather FFDC
+// one should be using FAPI_ASSERT. However, it is nice to
+// have a conditional trace in the event of a failure in the
+// operation, so that's why this is here.
+#define FAPI_TRY_TRACE( __operation__, ... ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ FAPI_DBG(__VA_ARGS__); \
+ goto clean_up; \
+ }
+
+#define FAPI_TRY1 FAPI_TRY_NO_TRACE
+#define FAPI_TRY2 FAPI_TRY_TRACE
+#define FAPI_TRY3 FAPI_TRY_TRACE
+#define FAPI_TRY4 FAPI_TRY_TRACE
+#define FAPI_TRY5 FAPI_TRY_TRACE
+/// @endcond
+
+///
+/// @brief Wrapper to check an operation for an error state
+/// and jump to the label cleam_up if there is an error.
+/// @param[in] __operation__ an operation which returns a fapi::ReturnCode
+/// @param[in] ... vararg format/agruments for trace output (optional)
+/// @note This implementation does not support PIB error masks or
+/// FSP operational states.
+/// @warning The trace information is only going to be seen during
+/// debug, it's not an error or informational trace. This is because
+/// traces might not be seen in the field. If you want information
+/// you will see on a field error, use FAPI_ASSERT.
+///
+#ifdef DOXYGEN
+#define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL
+#else
+#define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__)
+#endif
+
+///
+/// @brief Assert a conditional is true.
+/// If it is not, the FFDC gathering function is called and the
+/// trace is output as a FAPI error trace.
+/// @param[in] __conditional__ the condition to assert
+/// @param[in] __ffdc__ the FFDC gathering function
+/// @param[in] ... varargs, as input to FAPI_ERR
+///
+#define FAPI_ASSERT( __conditional__, __ffdc__, ... ) \
+ if (! (__conditional__)) \
+ { \
+ (__ffdc__).execute(); \
+ FAPI_ERR(__VA_ARGS__); \
+ goto clean_up; \
+ }
+
+
+#endif
diff --git a/hwpf/fapi/include/ffdc.H b/hwpf/fapi/include/ffdc.H
new file mode 100755
index 00000000..fd79d92e
--- /dev/null
+++ b/hwpf/fapi/include/ffdc.H
@@ -0,0 +1,191 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file ffdc.H
+ * @brief Defines the FirstFailureData class
+ */
+
+#ifndef FAPI2_FFDC_H_
+#define FAPI2_FFDC_H_
+
+#include <memory>
+#include <hwp_return_codes.H>
+#include <plat_trace.H>
+#include <error_info.H>
+#include <target.H>
+#include <assert.h>
+
+using fapi2::TARGET_TYPE_ALL;
+
+namespace fapi2
+{
+ ///
+ /// @brief Check the type of a variable
+ ///
+ /// This function can be called to check that a variable type is as expected
+ /// @note This mechanism will allow for cast ctor's which other static type
+ /// checking might not.
+ ///
+ template<typename T>
+ inline
+ void checkType(const T &) {}
+
+ class ReturnCode;
+
+ ///
+ /// @class FirstFailureData
+ ///
+ /// This class provides storage and methods for creating and manipulating
+ /// FFDC.
+ /// It is not needed on all platforms - platforms which need this class have
+ /// specified this by forcing their fapi2::ReturnCode to be a subclass of
+ /// this class.
+ ///
+ template< class R = fapi2::ReturnCode >
+ class FirstFailureData
+ {
+ public:
+
+ ///
+ /// @brief Default constructor.
+ /// @note We don't create our error info be default. It will be created
+ /// when its needed in the setHwpError() method. Note that dereferencing
+ /// the error info without will create a problem.
+ ///
+ FirstFailureData(void):
+ iv_info( nullptr )
+ {}
+
+ ///
+ /// @brief Copy Constructor
+ ///
+ /// @param[in] i_right Reference to FirstFailureData to copy
+ /// @note Generates default copy constructor - no deep pointer
+ /// copies necessary.
+ ///
+ FirstFailureData(const FirstFailureData & i_right) = default;
+
+ ///
+ /// @brief Destructor
+ ///
+ ~FirstFailureData(void) = default;
+
+ ///
+ /// @brief Assignment Operator.
+ ///
+ /// @param[in] i_right Reference to FirstFailureData to assign from.
+ /// @return Reference to 'this' FirstFailureData
+ ///
+ FirstFailureData & operator=(const FirstFailureData & i_right) = default;
+
+ ///
+ /// @brief Sets a HWP error. Sets the rcValue to the supplied value (from
+ /// the HwpFirstFailureData enumeration) and deletes any
+ /// associated data.
+ ///
+ /// HWP code must call the FAPI_SET_HWP_ERROR macro rather than this
+ /// function
+ /// directly to generate an error so that any error information is
+ /// automatically added to the FirstFailureData
+ ///
+ /// @param[in] i_rcValue Error value to set
+ ///
+ inline void _setHwpError(const fapi2::HwpReturnCode i_rcValue)
+ {
+ FAPI_ERR("_setHwpError: Creating HWP error 0x%x", i_rcValue);
+ static_cast<R*>(this)->operator=(i_rcValue);
+
+ // Forget about any associated data (this is a new error)
+ iv_info.reset(new ErrorInfo());
+ }
+
+ ///
+ /// @brief Get a pointer to any PlatData. FirstFailureData is still
+ /// responsible for deletion of the data. The caller must not
+ /// delete
+ ///
+ /// This is called by PLAT. The expected use-case is to get a pointer to
+ /// a platform error log. The data pointer should be used immediately in
+ /// the same thread.
+ ///
+ /// @return void *. Pointer to any PlatData. If NULL then no data
+ ///
+ void* getData(void) const;
+
+ ///
+ /// @brief Get a pointer to any PlatData and release ownership from
+ /// FirstFailureData. The caller is responsible for deletion.
+ ///
+ /// This is called by PLAT. The expected use-case is to retrieve a
+ /// platform error log.
+ ///
+ /// @return void*. Pointer to any PlatData. If NULL then no data
+ ///
+ void* releaseData(void);
+
+ ///
+ /// @brief Add ErrorInfo
+ ///
+ /// This is called by the FAPI_SET_HWP_ERROR and macro to add ErrorInfo
+ /// to the FirstFailureData when a HWP generates an error. The function
+ /// is designed to add all the ErrorInfo at once rather than the
+ /// FAPI_SET_HWP_ERROR macro making multiple function calls to add each
+ /// piece of ErrorInfo individually in order to minimize code size
+ ///
+ /// @param[in] i_pObjects Pointer to array of const pointers to const
+ /// objects that are referred to by ErrorInfoEntry objects
+ /// @param[in] i_pEntries Pointer to array of ErrorInfoEntry objects
+ /// defining the ErrorInfo that needs to be added
+ /// @param[in] i_count Number of ErrorInfoEntry entries
+ ///
+ void addErrorInfo(const void* const * i_pObjects,
+ const ErrorInfoEntry* i_pEntries,
+ const uint8_t i_count);
+
+ ///
+ /// @brief Get a pointer to any ErrorInfo
+ ///
+ /// This is called by PLAT to find information about an error
+ ///
+ /// @return ErrorInfo *. Pointer to any ErrorInfo. If NULL then no info
+ ///
+ inline const fapi2::ErrorInfo* getErrorInfo(void) const
+ { return iv_info.get(); }
+
+ ///
+ /// @brief Forgets about any associated data (PlatData and ErrorInfo)
+ ///
+ /// If this is the only FirstFailureData pointing to the data then the
+ /// data is deleted
+ ///
+ inline void forgetData(void)
+ { iv_info = nullptr; }
+
+ private:
+
+ // Pointer to the data
+ std::shared_ptr<ErrorInfo> iv_info;
+ };
+
+};
+#endif // FAPI2_FFDC_H_
diff --git a/hwpf/fapi/include/hw_access.H b/hwpf/fapi/include/hw_access.H
new file mode 100755
index 00000000..570d540c
--- /dev/null
+++ b/hwpf/fapi/include/hw_access.H
@@ -0,0 +1,720 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file hw_access.H
+ *
+ * @brief Defines the hardware access functions that platform code must
+ * implement.
+ */
+
+#ifndef FAPI2_HWACCESS_H_
+#define FAPI2_HWACCESS_H_
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#include <fapiSpyIds.H>
+#endif
+
+#include <stdint.h>
+#include <thread>
+#include <buffer.H>
+#include <variable_buffer.H>
+#include <return_code.H>
+#include <target.H>
+
+#ifdef FAPI_SUPPORT_MULTI_SCOM
+#include <fapiMultiScom.H>
+#endif
+
+/// @cond
+typedef uint64_t spyId_t;
+typedef uint64_t scanRingId_t;
+/// @endcond
+
+namespace fapi2
+{
+
+ ///
+ /// @enum fapi2::ChipOpModifyMode
+ /// @brief Enumeration of modify modes used in HW access modify operations
+ ///
+ enum ChipOpModifyMode
+ {
+ CHIP_OP_MODIFY_MODE_OR = 1, ///< Modify or mode
+ CHIP_OP_MODIFY_MODE_AND = 2, ///< Modify and mode
+ CHIP_OP_MODIFY_MODE_XOR = 3, ///< Modify xor mode
+ };
+
+ ///
+ /// @enum fapi2::RingMode
+ /// @brief Enumeration of Ring access operation modes
+ /// This is a bitmap to allow the user to specify multiple modes.
+ ///
+ enum RingMode
+ {
+ RING_MODE_SET_PULSE = 0x00000001, ///< Set pulse
+ RING_MODE_NO_HEADER_CHECK = 0x00000002, ///< Dont' check header
+ // FUTURE_MODE = 0x00000004,
+ // FUTURE_MODE = 0x00000008,
+ };
+
+ //--------------------------------------------------------------------------
+ // PIB Error Functions
+ //--------------------------------------------------------------------------
+
+ /// @brief Sets the PIB error mask - platform dependant
+ /// @param[in] i_mask The new error mask
+ inline void setPIBErrorMask(uint8_t i_mask)
+ {
+ // Platform specific funtion needs to be defined here.
+ // For Cronus/FSP/Hostboot, this is a no-op.
+ return;
+ }
+
+ /// @brief Gets the PIB error mask - platform dependant
+ /// @return uint8_t The current PIB error mask
+ inline uint8_t getPIBErrorMask(void)
+ {
+ // Platform specific funtion needs to be defined here.
+ // For Cronus/FSP/Hostboot, this always returns 0
+ return 0;
+ }
+
+ //--------------------------------------------------------------------------
+ // Operational Mode Error Functions
+ //--------------------------------------------------------------------------
+
+ /// @enum OpModes operational Mode Error Functions
+ enum OpModes
+ {
+ // These are bit-masks in case they need to be or'd together
+ NORMAL = 0x00,
+ IGNORE_HW_ERROR = 0x01,
+ DO_NOT_DO_WAKEUP = 0x02,
+ };
+
+ /// @brief Sets the operational mode
+ /// @param[in] i_mode The new mode
+ inline void setOpMode(const OpModes i_mode)
+ {
+ // No-op for now. Should set thread-local operational mode
+ return;
+ }
+
+ /// @brief Gets the operational mode
+ /// @return the operational mode
+ inline OpModes getOpMode(void)
+ {
+ // No-op for now. Should read thread-local operational mode
+ return NORMAL;
+ }
+
+ //--------------------------------------------------------------------------
+ // HW Communication Functions
+ //--------------------------------------------------------------------------
+
+ /// @brief Reads a SCOM register from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode getScom(const Target<K>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& o_data)
+ {
+ o_data = 0x0000FEEDFACE0000;
+ std::cout << std::hex << " getScom "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "output data: " << uint64_t(o_data)
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a SCOM register on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putScom(const Target<K>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& i_data)
+ {
+ std::cout << std::hex << " putScom "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input data: " << uint64_t(i_data)
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Read-modify-write a SCOM register on a chip
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor).
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode modifyScom(const Target<K>& i_target,
+ const uint64_t i_address,
+ const buffer<uint64_t>& i_data,
+ const ChipOpModifyMode i_modifyMode)
+ {
+ fapi2::buffer<uint64_t> l_modifyDataBuffer = i_data;
+ std::cout << std::hex << " modifyScom "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input modifying data: " << uint64_t(l_modifyDataBuffer) << "; "
+ << "input ChipOpModifyMode: " << i_modifyMode
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a SCOM register under mask on a chip
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @param[in] i_mask Buffer that holds the mask value.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putScomUnderMask(const Target<K>& i_target,
+ const uint64_t i_address,
+ buffer<uint64_t>& i_data,
+ buffer<uint64_t>& i_mask)
+ {
+ std::cout << std::hex << " putScomUnderMask "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input data: " << uint64_t(i_data) << "; "
+ << "input mask: " << uint64_t(i_mask)
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Reads a CFAM register from a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode getCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ buffer<uint32_t>& o_data)
+ {
+ o_data = 0xFEED0CFA;
+ std::cout << std::hex << " getCfamRegister "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "output data: " << uint32_t(o_data)
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a CFAM register on a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ buffer<uint32_t>& i_data)
+ {
+ std::cout << std::hex << " putCfamRegister "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input data: " << uint32_t(i_data)
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Read-modify-write a CFAM register on a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to modify.
+ /// @param[in] i_data Buffer that holds data to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor).
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode modifyCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ const buffer<uint32_t>& i_data,
+ const ChipOpModifyMode i_modifyMode)
+ {
+ fapi2::buffer<uint32_t> l_modifyDataBuffer = i_data;
+ std::cout << std::hex << " modifyCfamRegister "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input modifying data: " << uint32_t(l_modifyDataBuffer) << "; "
+ << "input ChipOpModifyMode: " << i_modifyMode
+ << std::dec << std::endl;
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Reads a ring from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode getRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& o_data,
+ const RingMode i_ringMode = 0)
+ {
+ o_data.setBit(0);
+ o_data.setBit(3);
+ std::cout << std::hex << " getRing "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "ring address: " << i_address << "; "
+ << "ring mode: " << i_ringMode << "; "
+ << "output data:";
+ o_data.print();
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a ring to a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to write to.
+ /// @param[in] i_data Buffer that contains RS4 compressed ring data
+ /// to write into address
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& i_data,
+ const RingMode i_ringMode = 0)
+ {
+ std::cout << std::hex << " putRing "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "ring mode: " << i_ringMode << "; "
+ << "input data:";
+ i_data.print();
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+
+ /// @brief Writes a ring to a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to write to.
+ /// @param[in] i_data Pointer to location that contains RS4 compressed
+ // ring data to write into address
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ const void* i_data,
+ const RingMode i_ringMode = 0)
+ {
+ uint64_t* dataPtr = reinterpret_cast<uint64_t*>(const_cast<void*>(i_data));
+ std::cout << std::hex << " putRing (void*) "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "ring mode: " << i_ringMode << "; "
+ << "input data: " << (uint64_t)(*dataPtr)
+ << (uint64_t)*(dataPtr+1)
+ << (uint64_t)*(dataPtr+2)
+ << (uint64_t)*(dataPtr+3);
+ std::cout << std::dec << std::endl;
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Read-modify-write a ring on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to modify.
+ /// @param[in] i_data Buffer that contains RS4 compressed ring data
+ /// to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor)
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode modifyRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& i_data,
+ const ChipOpModifyMode i_modifyMode,
+ const RingMode i_ringMode = 0)
+ {
+ std::cout << std::hex << " modifyRing "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "address: " << i_address << "; "
+ << "input ChipOpModifyMode: " << i_modifyMode << "; "
+ << "ring mode: " << i_ringMode << "; "
+ << "input data: ";
+ i_data.print();
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @note
+ /// These spy access interfaces are only used in FSP and cronus
+ /// HB does not allow spy access
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
+ /// @brief Reads a spy from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy whose data to be read.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependant on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// 1. if the spy name contains a # procedure writers should replace
+ /// it with an __P__ for example -
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ /// becomes
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// 2. if the spy name has a number following a "." it must have an
+ /// underscore prepended to the number.
+ ///
+ /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
+ /// becomes
+ /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
+ ///
+ /// Example SPY name:
+ /// The hardware procedure should call the function like:
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// fapi::ReturnCode rc = fapiGetSpy( targ,
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
+ ///
+ /// @note The ID is not in quotes the fapi code will handle adding
+ /// the quotes for the cronus environment
+ ///
+#endif
+
+// Set to 1 for fapi2 API test
+#define FAPI_SUPPORT_SPY_AS_ENUM 1
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+
+#ifndef DOXYGEN
+#define fapiGetSpy(TARGET, ID, DATA) \
+ _fapiGetSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA )
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpy(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& o_data)
+ {
+ o_data.setBit(1);
+ o_data.setBit(4);
+ std::cout << std::hex << " _fapiGetSpy "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy ID: " << i_spyId << "; "
+ << "output data:";
+ o_data.print();
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+
+#ifndef DOXYGEN
+#define fapiGetSpy(TARGET, ID, DATA) _fapiGetSpy(TARGET, #ID, DATA)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpy(const Target<K>& i_target,
+ const char * const i_spyId,
+ variable_buffer& o_data);
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
+ /// @brief Writes a spy on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy to write data to.
+ /// @param[out] i_data Buffer that holds data to write into spy.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// 1. if the spy name contains a # procedure writers should replace
+ /// is with an __P__ for example -
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ /// becomes
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// 2. if the spy name has a number following a "." it must have an
+ /// underscore prepended to the number.
+ ///
+ /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
+ /// becomes
+ /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
+ ///
+ /// Example SPY name:
+ /// The hardware procedure should call the function like:
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// fapi::ReturnCode rc = fapiPutSpy( targ,
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
+ ///
+ /// @note The ID is not in quotes the fapi code will handle adding
+ /// the quotes for the cronus environment
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOXYGEN
+#define fapiPutSpy(TARGET, ID, DATA) \
+ _fapiPutSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpy(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& i_data)
+ {
+ std::cout << std::hex << " _fapiPutSpy "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy Id: " << i_spyId << "; "
+ << "input data:";
+ i_data.print();
+
+ return FAPI2_RC_SUCCESS;
+ }
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+#ifndef DOXYGEN
+#define fapiPutSpy(TARGET, ID, DATA) _fapiPutSpy(TARGET, #ID, DATA)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpy(const Target<K>& i_target,
+ const char* const i_spyId,
+ variable_buffer& i_data);
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING)
+
+ /// @brief Writes spy data into a buffer holding ring data image
+ /// This API is used by L2/L3 repair to put column repair data
+ /// into a ring buffer image.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy.
+ /// @param[in] i_data Buffer that holds spy data to write into ring
+ /// image.
+ /// @param[out] o_data Buffer that holds updated ring image.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// See fapiPutSpy for details on spy id specifics.
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOCUMENTATION
+#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiPutSpyImage(TARGET, \
+ FAPI_SPY_NAMES::ID.value, \
+ DATA1, DATA2)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& i_data,
+ variable_buffer& o_imageData)
+ {
+ std::cout << std::hex << " _fapiPutSpyImage "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy Id: " << i_spyId << "; "
+ << "input data: ";
+ i_data.print();
+
+ // Set fake output data
+ o_imageData.invert();
+
+ return FAPI2_RC_SUCCESS;
+ }
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+// fapiPutSpyImage function Cronus version
+#ifndef DOCUMENTATION
+#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiPutSpyImage(TARGET, #ID, \
+ DATA1,DATA2)
+#endif
+
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target,
+ const char* const i_spyId,
+ variable_buffer& i_data,
+ variable_buffer& o_imageData);
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING) || defined(DOXYGEN)
+ /// @brief Reads spy data from a ring image buffer
+ /// @param[in] i_target Target to operate on
+ /// @param[in] i_spyId The spy's id
+ /// @param[out] o_data Buffer that holds data read from ring image.
+ /// @param[in] i_imageData Buffer that holds ring image to read data
+ /// from.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// See fapiPutSpy for details on spy id specifics.
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOXYGEN
+#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiGetSpyImage(TARGET, \
+ FAPI_SPY_NAMES::ID.value, \
+ DATA1, DATA2)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpyImage(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& o_data,
+ const variable_buffer& i_imageData);
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+// fapiGetSpyImage function Cronus version
+#ifndef DOXYGEN
+#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiGetSpyImage(TARGET, \
+ #ID, DATA1,DATA2)
+#endif
+
+ inline fapi::ReturnCode _fapiGetSpyImage(
+ const fapi::Target& i_target,
+ const char* const i_spyId,
+ fapi::buffer<fapi::bits_container> & o_data,
+ const fapi::buffer<fapi::bits_container> & i_imageData);
+#endif
+
+#if defined(FAPI_SUPPORT_MULTI_SCOM) || defined(DOXYGEN)
+
+ /// @brief Performs a multiple SCOM operation
+ /// This interface performs multiple SCOM operations on a chip in the
+ /// order specified by the input MultiScom object.
+ /// See fapiMultiScom.H for details of how to populate the MultiScom
+ /// object with SCOM operations.
+ ///
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in,out] io_multiScomObj Reference to a MultiScom object,
+ /// pre-populated with SingleScomInfo entries
+ /// to perform multiple SCOMs on input target
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note This is a synchronous interface and would return after all the
+ /// SCOM operations are completed or on the first failed operation
+ ///
+ /// @note SCOMs will be performed in the order they were added to the
+ /// input MultiScom object
+ ///
+ /// @note In case of errors, the platform code is responsible to collect
+ /// and add all the required error info and FFDC into the error data
+ /// for debugging
+ ///
+ /// @note If the SCOM operations added are specific to a processor chip,
+ /// then the FSI Shift Engine configured in scatter-gather DMA mode
+ /// extension would be used to execute the SCOM operations in a
+ /// performance optimize mode. In this mode, the special
+ /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are
+ /// supported that allow a large bulk of SCOM access (in multiple of
+ /// 64 bits) for targets that support auto-increment. The
+ /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode
+ ///
+ /// @note If the SCOM operations added are specific to a memory buffer
+ /// chip, then the regular SCOM engine is used to execute the SCOM
+ /// operations. SCOM_WRITE_UNDER_MASK operation is supported in
+ /// this mode, but the special SCOM_BULK_READ_MODE and
+ /// SCOM_BULK_WRITE_MODE operations are not supported due to
+ /// hardware limitations.
+ ///
+ fapi::ReturnCode fapiMultiScom (const Target<K>& i_target,
+ MultiScom& io_multiScomObj);
+#endif // FAPI_SUPPORT_MULTI_SCOM
+
+};
+
+#endif // FAPI2HWACCESS_H_
diff --git a/hwpf/fapi/include/plat_trace.H b/hwpf/fapi/include/plat_trace.H
new file mode 100755
index 00000000..7c7dd3be
--- /dev/null
+++ b/hwpf/fapi/include/plat_trace.H
@@ -0,0 +1,64 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] 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 */
+/**
+ * @file plat_trace.H
+ * @brief Defines the FAPI2 trace macros.
+ *
+ * Note that platform code must provide the implementation.
+ *
+ * FAPI has provided a default implementation. Platform code must
+ * provide an alternate implementation if needed.
+ */
+
+#ifndef FAPI2_PLATTRACE_H_
+#define FAPI2_PLATTRACE_H_
+
+#include <stdio.h>
+
+#define MAX_ECMD_STRING_LEN 64
+
+// Information traces (go into fast trace buffer that can wrap often)
+#define FAPI_TRACE(_id_, _fmt_, _args_...) \
+ printf("%s: %s:%d ", _id_, __func__, __LINE__); \
+ printf(_fmt_, ##_args_); \
+ printf("\n")
+
+#define FAPI_INF(_fmt_, _args_...) FAPI_TRACE("inf", _fmt_, ##_args_)
+
+// Important traces (go into slow trace buffer that should not wrap often)
+#define FAPI_IMP(_fmt_, _args_...) FAPI_TRACE("imp", _fmt_, ##_args_)
+
+// Error traces (go into slow trace buffer that should not wrap often)
+#define FAPI_ERR(_fmt_, _args_...) FAPI_TRACE("err", _fmt_, ##_args_)
+
+// Debug traces (go into fast trace buffer that can wrap often)
+#define FAPI_DBG(_fmt_, _args_...) FAPI_TRACE("dbg", _fmt_, ##_args_)
+
+// Scan traces
+#define FAPI_SCAN(_fmt_, _args_...) FAPI_TRACE("scan", _fmt_, ##_args_)
+
+#define FAPI_MFG(_fmt_, _args_...) FAPI_TRACE("mfg", _fmt_, ##_args_)
+
+#endif // FAPI2_PLATTRACE_H_
diff --git a/hwpf/fapi/include/return_code.H b/hwpf/fapi/include/return_code.H
new file mode 100755
index 00000000..0442ca89
--- /dev/null
+++ b/hwpf/fapi/include/return_code.H
@@ -0,0 +1,180 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file return_code.H
+ * @brief definitions for fapi2 return codes
+ */
+
+#ifndef __FAPI2_RETURN_CODE__
+#define __FAPI2_RETURN_CODE__
+
+#include <stdint.h>
+
+// Remove this for platforms which don't support FFDC
+#include <ffdc.H>
+
+///
+/// @brief Set HWP Error macro
+///
+/// This macro should be used by a HWP to create an error. The ReturnCode's
+/// internal return code is set and any error information in the Error XML file
+/// is added to the ReturnCode
+///
+#define FAPI_SET_HWP_ERROR(RC, ERROR) \
+ RC._setHwpError(fapi2::ERROR); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+///
+/// @brief Add info to HWP Error macro
+///
+/// This macro should be used by an FFDC HWP to add error information from an
+/// Error XML file to an existing error.
+///
+#define FAPI_ADD_INFO_TO_HWP_ERROR(RC, ERROR) \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+namespace fapi2
+{
+ ///
+ /// @brief Enumeration of return codes
+ ///
+ enum ReturnCodes
+ {
+ ///< Success
+ FAPI2_RC_SUCCESS = 0,
+
+ // Flag bits indicating which code generated the error.
+ FAPI2_RC_FAPI2_MASK = 0x04000000, ///< FAPI2 mask
+ FAPI2_RC_PLAT_MASK = 0x02000000, ///< Platform mask
+ FAPI2_RC_HWP_MASK = 0x00000000, ///< HWP mask
+
+ //
+ // FAPI generated return codes
+ //
+
+ FAPI2_RC_INVALID_ATTR_GET = FAPI2_RC_FAPI2_MASK | 0x01,
+ ///< Initfile requested an attribute with an invalid attribute ID
+
+ FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI2_RC_FAPI2_MASK | 0x02,
+ ///< HWP requested a chip EC feature with an invalid attribute ID
+
+ FAPI2_RC_INVALID_MULTISCOM_LENGTH = FAPI2_RC_FAPI2_MASK | 0x03,
+ ///< Invalid multiscom parameters
+
+ FAPI2_RC_INVALID_PARAMETER = FAPI2_RC_FAPI2_MASK | 0x04,
+ ///< Invalid parameters to a FAPI2 function
+
+ FAPI2_RC_OVERFLOW = FAPI2_RC_FAPI2_MASK | 0x05,
+ ///< Overflow condition, typically a buffer operation
+
+ //
+ // PLAT generated return codes. Additional details may be contained in
+ // ReturnCode platData (this can only be looked at by PLAT code)
+ //
+
+ FAPI2_RC_PLAT_ERR_SEE_DATA = FAPI2_RC_PLAT_MASK | 0x01,
+ ///< Generic platform error
+
+ FAPI2_RC_PLAT_ERR_ADU_LOCKED = FAPI2_RC_PLAT_MASK | 0x02,
+ ///< Operation to AlterDisplay unit failed because it is locked
+
+ FAPI2_RC_PLAT_NOT_SUPPORTED_AT_RUNTIME = FAPI2_RC_PLAT_MASK | 0x03,
+ ///< Operation not supported by HB runtime
+ };
+
+ ///
+ /// @brief Class representing a FAPI2 ReturnCode
+ ///
+ /// @note Remove the inheritance relationship with FirstFailureData if
+ /// the platform doesn't support FFDC.
+ class ReturnCode : public FirstFailureData<ReturnCode>
+ {
+ public:
+
+ ///
+ /// @brief Constructor.
+ /// @param[in] i_rc the rc to set
+ ///
+ ReturnCode(const uint64_t i_rc = FAPI2_RC_SUCCESS):
+ iv_rc(i_rc)
+ {};
+
+ ///
+ /// @brief integral type conversion function. Returns the error code
+ /// @return The error code
+ ///
+ inline operator uint64_t() const { return iv_rc; }
+
+ ///
+ /// @brief Returns true iff iv_rc == SUCCESS
+ /// @return true or false
+ ///
+ inline operator bool() const { return iv_rc == FAPI2_RC_SUCCESS; }
+
+ ///
+ /// @brief Assignement operator
+ ///
+ inline ReturnCode& operator=(const uint64_t& rhs)
+ {
+ iv_rc = rhs;
+ return *this;
+ }
+
+ inline ReturnCode& operator=(const ReturnCodes& rhs)
+ {
+ iv_rc = rhs;
+ return *this;
+ }
+
+ inline bool operator==(const uint64_t& rhs) const
+ { return rhs == iv_rc; }
+
+ inline bool operator==(const ReturnCodes& rhs) const
+ { return rhs == iv_rc; }
+
+ inline bool operator!=(const uint64_t& rhs) const
+ { return rhs != iv_rc; }
+
+ inline bool operator!=(const ReturnCodes& rhs) const
+ { return rhs != iv_rc; }
+
+ private:
+ uint64_t iv_rc;
+ };
+
+ /// This implementation assumes no exception handling and leverages thread-local
+ /// storage. For platforms without thread support, a global variable will
+ /// suffice for the error state.
+ extern thread_local ReturnCode current_err; /// the current error state
+ extern thread_local uint64_t pib_error_mask; /// the pib mask
+ extern thread_local uint64_t operational_state; /// the operational mode
+
+};
+
+#endif
diff --git a/hwpf/fapi/include/target.H b/hwpf/fapi/include/target.H
new file mode 100755
index 00000000..1add61d6
--- /dev/null
+++ b/hwpf/fapi/include/target.H
@@ -0,0 +1,337 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file target.H
+ * @brief definitions for fapi2 targets
+ */
+
+#ifndef __FAPI2_TARGET__
+#define __FAPI2_TARGET__
+
+#include <stdint.h>
+#include <vector>
+#include <target_types.H>
+#include <stdio.h>
+
+namespace fapi2
+{
+ ///
+ /// @brief Enumeration of target state values (bitmask values)
+ ///
+ enum TargetState
+ {
+ TARGET_STATE_PRESENT = 0x00000001,
+ TARGET_STATE_FUNCTIONAL = 0x00000002,
+ };
+
+ ///
+ /// @brief Class representing a FAPI2 Target
+ /// @tparam K the type (Kind) of target
+ /// @tparam V the type of the target's Value
+ /// @remark TargetLite targets are uint64_t, Targets
+ /// are uintptr_t (void*).
+ ///
+ /// Assuming there are representations of a processor,
+ /// a membuf and a system here are some examples:
+ /// @code
+ /// #define PROCESSOR_CHIP_A 0xFFFF0000
+ /// #define MEMBUF_CHIP_B 0x0000FFFF
+ /// #define SYSTEM_C 0x0000AAAA
+ /// @endcode
+ ///
+ /// * To define a target:
+ /// @code
+ /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A);
+ /// fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> C(SYSTEM_C);
+ /// fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> B(MEMBUF_CHIP_B);
+ /// @endcode
+ ///
+ /// * Functions which take composite target types
+ /// @code
+ /// void takesProcOrMembuf(
+ /// const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP |
+ /// fapi2::TARGET_TYPE_MEMBUF_CHIP>& V );
+ ///
+ /// void takesAny(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& V );
+ ///
+ /// @endcode
+ ///
+ /// * Traversing the target "tree"
+ /// @code
+ /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A);
+ ///
+ /// // Get A's parent
+ /// A.getParent<fapi2::TARGET_TYPE_SYSTEM>();
+ ///
+ /// // Get the 0x53'd core
+ /// fapi2::getTarget<fapi2::TARGET_TYPE_CORE>(0x53);
+ ///
+ /// // Get all *my* present/functional children which are cores
+ /// A.getChildren<fapi2::TARGET_TYPE_CORE>();
+ ///
+ /// // Get all of the the cores relative to my base target
+ /// fapi2::getChildren<fapi2::TARGET_TYPE_CORE>();
+ /// @endcode
+ ///
+ /// * Invalid casts
+ /// @code
+ /// // Can't cast to a specialized target
+ /// fapi2::Target<fapi2::TARGET_TYPE_NONE> D(MEMBUF_CHIP_B);
+ /// takesProcOrMembuf( D );
+ ///
+ /// // Not one of the shared types
+ /// fapi2::Target<fapi2::TARGET_TYPE_ABUS_ENDPOINT> E;
+ /// takesProcOrMembuf( E );
+ /// @endcode
+ template<TargetType K, typename V = uint64_t>
+ class Target
+ {
+ public:
+
+ ///
+ /// @brief Create a Target, with a value
+ /// @param[in] Value the value (i.e., specific element this
+ /// target represents, or pointer)
+ /// @note Platforms can mangle the value and K to get a
+ /// single uint64_t in value which represents all the information
+ /// they might need. value( K | V ), for example
+ ///
+ Target(V Value = 0):
+ iv_handle(Value)
+ {}
+
+ ///
+ /// @brief Assignment Operator.
+ /// @param[in] i_right Reference to Target to assign from.
+ /// @return Reference to 'this' Target
+ ///
+ Target& operator=(const Target& i_right)
+ { iv_handle = i_right.iv_handle; return *this; }
+
+ ///
+ /// @brief Equality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if equal.
+ /// @note Platforms need to define this so that the physical
+ /// targets are determined to be equivilent rather than just the handles
+ ///
+ bool operator==(const Target& i_right) const
+ { return i_right.iv_handle == iv_handle; }
+
+ ///
+ /// @brief Inquality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if not equal.
+ /// @note Platforms need to define this so that the physical
+ /// targets are determined to be equivilent rather than just the handles
+ ///
+ bool operator!=(const Target& i_right) const
+ { return i_right.iv_handle != iv_handle; }
+
+ ///
+ /// @brief Get the handle.
+ /// @return V The target's handle, or value
+ ///
+ V get(void) const
+ { return iv_handle; }
+
+ ///
+ /// @brief Get the handle as a V
+ /// @return V The target's handle, or value
+ ///
+ inline operator V() const { return iv_handle; }
+
+ ///
+ /// @brief Get a target's value
+ /// @return V The target's handle, or value
+ ///
+ inline V& operator()(void) { return iv_handle; }
+
+ ///
+ /// @brief Get the target type
+ /// @return The type of target represented by this target
+ ///
+ inline TargetType getType(void) const { return iv_type; }
+
+ ///
+ /// @brief Get this target's immediate parent
+ /// @tparam T The type of the parent
+ /// @return Target<T> a target representing the parent
+ ///
+ template< TargetType T >
+ inline Target<T> getParent(void) const
+ {
+ // For testing
+ return Target<T>(iv_handle);
+ }
+
+ ///
+ /// @brief Get this target's children
+ /// @tparam T The type of the parent
+ /// @param[in] i_state The desired TargetState of the children
+ /// @return std::vector<Target<T> > a vector of present/functional
+ /// children
+ ///
+ template< TargetType T>
+ inline std::vector<Target<T> >
+ getChildren(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const
+ {
+ // For testing
+ return {Target<T>()};
+ }
+
+ ///
+ /// @brief Get the target at the other end of a bus - dimm included
+ /// @tparam T The type of the parent
+ /// @param[in] i_state The desired TargetState of the children
+ /// @return Target<T> a target representing the thing on the other end
+ /// @note Can be easily changed to a vector if needed
+ ///
+ template<TargetType T>
+ inline Target<T>
+ getOtherEnd(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const
+ {
+ // Implementation note: cast to a composite of
+ // bus types and the compiler will check if this is
+ // a good function at compile time
+ return Target<T>();
+ }
+
+ ///
+ /// @brief Copy from a Target<O> to a Target<K>
+ /// @tparam O the target type of the other
+ ///
+ template<TargetType O>
+ inline Target( const Target<O>& Other ):
+ Target<K, V>(Other.get())
+ {
+ static_assert( (K & O) != 0,
+ "unable to cast Target, no shared types");
+
+ static_assert( bitCount<K>::count >= bitCount<O>::count,
+ "unable to cast to specialized Target");
+ }
+
+ private:
+ // Don't use enums here as it makes it hard to assign
+ // in the platform target cast constructor.
+ static const TargetType iv_type = K;
+ V iv_handle;
+
+ };
+
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @tparam B The type of the buffer
+ /// @param[in] i_target Target<T>
+ /// @param[in] i_buffer buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template< TargetType T >
+ inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize)
+ {
+ snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target.get(), T);
+ }
+
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @tparam B The type of the buffer
+ /// @param[in] A pointer to the Target<T>
+ /// @param[in] The buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template< TargetType T >
+ inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize)
+ {
+ snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target->get(), T);
+ }
+
+ ///
+ /// @brief Get an enumerated target of a specific type
+ /// @tparam T The type of the target
+ /// @param[in] Ordinal representing the ordinal number of
+ /// the desired target
+ /// @return Target<T> the target requested
+ ///
+ template<TargetType T>
+ inline Target<T> getTarget(uint64_t Ordinal)
+ {
+ // For testing
+ return Target<T>(Ordinal);
+ }
+
+ // Why has the been removed? For starters, the API name
+ // is probably wrong as it's already been confused with
+ // Target::getChildren(). And if I'm going to change it
+ // I really want to see if we need it. I'm still not
+ // clear on whether we're alloing this traversal or not.
+#if 0
+ ///
+ /// @brief Get the base target's children
+ /// @tparam T The type of the target
+ /// @return std::vector<Target<T> > a vector of present/functional
+ /// children
+ ///
+ template<TargetType T>
+ inline std::vector<Target<T> > getChildren()
+ {
+ // For testing
+ return {Target<T>(), Target<T>()};
+ }
+#endif
+
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @tparam B The type of the buffer
+ /// @param[in] i_target Target<T>
+ /// @param[in] i_buffer buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template<TargetType T, typename B>
+ inline void toString(const Target<T>& i_target, B& i_buffer);
+
+ ///
+ /// @brief Check if the target is of a type, or in a type subset.
+ /// @tparam K the TargetType to check
+ /// @tparam T TargetType or TargetType composite to check against
+ /// @return True, iff K is a proper T
+ ///
+ template< TargetType K, TargetType T >
+ inline constexpr bool is_same(void)
+ { return (K & T) != 0; }
+
+
+};
+
+#endif
diff --git a/hwpf/fapi/include/target_types.H b/hwpf/fapi/include/target_types.H
new file mode 100755
index 00000000..f4cfd931
--- /dev/null
+++ b/hwpf/fapi/include/target_types.H
@@ -0,0 +1,105 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file target_types.H
+ * @brief definitions for fapi2 target types
+ */
+
+#ifndef __FAPI2_TARGET_TYPES__
+#define __FAPI2_TARGET_TYPES__
+
+/// FAPI namespace
+namespace fapi2
+{
+ ///
+ /// @enum fapi::TargetType
+ /// @brief Types, kinds, of targets
+ /// @note TYPE_NONE is used to represent empty/NULL targets in lists
+ /// or tables. TYPE_ALL is used to pass targets to methods which
+ /// can act generally on any type of target
+ ///
+ /// Target Kind
+ enum TargetType
+ {
+ TARGET_TYPE_NONE = 0x00000000, ///< No type
+ TARGET_TYPE_SYSTEM = 0x00000001, ///< System type
+ TARGET_TYPE_DIMM = 0x00000002, ///< DIMM type
+ TARGET_TYPE_PROC_CHIP = 0x00000004, ///< Processor type
+ TARGET_TYPE_MEMBUF_CHIP = 0x00000008, ///< Membuf type
+ TARGET_TYPE_EX = 0x00000010, ///< Ex type
+ TARGET_TYPE_MBA = 0x00000020, ///< MBA type
+ TARGET_TYPE_MCS = 0x00000040, ///< MCS type
+ TARGET_TYPE_XBUS = 0x00000080, ///< XBUS type
+ TARGET_TYPE_ABUS = 0x00000100, ///< ABUS type
+ TARGET_TYPE_L4 = 0x00000200, ///< L4 type
+ TARGET_TYPE_CORE = 0x00000400, ///< Core type
+ TARGET_TYPE_EQ = 0x00000800, ///< EQ type
+ TARGET_TYPE_MCA = 0x00001000, ///< MCA type
+ TARGET_TYPE_MCBIST = 0x00002000, ///< MCBIST type
+ TARGET_TYPE_MIA = 0x00004000, ///< MIA type
+ TARGET_TYPE_MIS = 0x00008000, ///< MIS type
+ TARGET_TYPE_DMI = 0x00010000, ///< DMI type
+ TARGET_TYPE_OBUS = 0x00020000, ///< OBUS type
+ TARGET_TYPE_NV = 0x00040000, ///< NV bus type
+ TARGET_TYPE_SBE = 0x00080000, ///< SBE type
+ TARGET_TYPE_PPE = 0x00100000, ///< PPE type
+ TARGET_TYPE_PERV = 0x00200000, ///< Pervasive type
+ TARGET_TYPE_PEC = 0x00400000, ///< PEC type
+ TARGET_TYPE_PHB = 0x00800000, ///< PHB type
+ TARGET_TYPE_EL = 0x01000000, ///< L3/L2 Caches
+
+ TARGET_TYPE_ALL = 0xFFFFFFFF, ///< Any/All types
+
+ // Mappings to target types found in the error xml files
+ TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX,
+ TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA,
+ TARGET_TYPE_MCS_CHIPLET = TARGET_TYPE_MCS,
+ TARGET_TYPE_XBUS_ENDPOINT = TARGET_TYPE_XBUS,
+ TARGET_TYPE_ABUS_ENDPOINT = TARGET_TYPE_ABUS,
+ };
+
+ /// @cond
+ constexpr TargetType operator|(TargetType x, TargetType y)
+ {
+ return static_cast<TargetType>(static_cast<int>(x) |
+ static_cast<int>(y));
+ }
+
+ template<uint64_t V>
+ class bitCount {
+ public:
+ // Don't use enums, too hard to compare
+ static const uint8_t count = bitCount<(V >> 1)>::count + (V & 1);
+ };
+
+ template<>
+ class bitCount<0> {
+ public:
+ static const uint8_t count = 0;
+ };
+ /// @endcond
+};
+
+#endif
diff --git a/hwpf/fapi/include/utils.H b/hwpf/fapi/include/utils.H
new file mode 100755
index 00000000..65806272
--- /dev/null
+++ b/hwpf/fapi/include/utils.H
@@ -0,0 +1,59 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] 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 */
+/**
+ * @file utils.H
+ * @brief Defines common fapi2 utilities
+ */
+
+#ifndef FAPI2_UTILS_H_
+#define FAPI2_UTILS_H_
+
+#include <stdint.h>
+#include <return_code.H>
+#include <error_info.H>
+
+namespace fapi2
+{
+ ///
+ /// @brief Log an error.
+ ///
+ /// @param[in,out] io_rc Reference to ReturnCode (Any references to data and error
+ /// target are removed and rc value is set to success after
+ /// function ends.)
+ /// @param[in] i_sev Fapi error log severity defaulted to unrecoverable
+ /// @param[in] i_unitTestError - flag to log error which does not cause a unit
+ /// test to fail.
+ ///
+ /// @note This function is called from the ffdc collection classes and no longer
+ /// needs to be called directly.
+ /// @note Implemented by platform code
+ ///
+ void logError(
+ fapi2::ReturnCode & io_rc,
+ fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,
+ bool i_unitTestError = false );
+};
+
+#endif // FAPI2_UTILS_H_
diff --git a/hwpf/fapi/include/variable_buffer.H b/hwpf/fapi/include/variable_buffer.H
new file mode 100755
index 00000000..a1280830
--- /dev/null
+++ b/hwpf/fapi/include/variable_buffer.H
@@ -0,0 +1,663 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file variable_buffer.H
+ * @brief definitions for fapi2 variable length buffers
+ */
+
+#ifndef __FAPI2_VARIABLE_BUFFER__
+#define __FAPI2_VARIABLE_BUFFER__
+
+#include <buffer_base.H>
+
+namespace fapi2
+{
+ /// @brief Get a 32 bit mask quickly
+ // This is one of the main reasons we static_assert in the ctor's
+ // to ensure the unit_type is 32 bits.
+ inline uint32_t fast_mask32(int32_t i_pos, int32_t i_len)
+ {
+ // generates an arbitrary 32-bit mask using two operations, not too shabby
+
+ static const uint32_t l_mask32[] = {
+ 0x00000000,
+ 0x80000000, 0xC0000000, 0xE0000000, 0xF0000000,
+ 0xF8000000, 0xFC000000, 0xFE000000, 0xFF000000,
+ 0xFF800000, 0xFFC00000, 0xFFE00000, 0xFFF00000,
+ 0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
+ 0xFFFF8000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000,
+ 0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00, 0xFFFFFF00,
+ 0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0, 0xFFFFFFF0,
+ 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE, 0xFFFFFFFF,
+ };
+ return l_mask32[i_len] >> i_pos;
+ }
+
+ //
+ // General set a series of bits in the buffer.
+ //
+
+ ///
+ /// @cond
+ /// @brief Internal bit inserting method.
+ /// @tparam unit_type The type of a unit of the arrays
+ /// @tparam bits_type The type of the bit counting values
+ /// @param[in] i_source The incoming data
+ /// @param[in] i_source_length The length in bits of the incoming data
+ /// @param[in] i_target The outgoing data
+ /// @param[in] i_target_length The length in bits of the outgoing data
+ /// @param[in] i_source_start_bit The starting bit location in the
+ /// incoming data
+ /// @param[in] i_target_start_bit The starting bit position in this
+ /// @param[in] i_length The length, in bits, the user wants copied.
+ ///
+ template<typename unit_type, typename bits_type>
+ inline fapi2::ReturnCode _insert(const unit_type* i_source,
+ bits_type i_source_length,
+ unit_type* i_target,
+ bits_type i_target_length,
+ bits_type i_source_start_bit,
+ bits_type i_target_start_bit,
+ bits_type i_length)
+ {
+ const bits_type bits_per_unit = fapi2::parameterTraits<unit_type>::bit_length;
+
+ // tartgetStart is defaulted to the sizeof(target) - (sizeof(source) - i_source_start_bit)
+ // which makes this act like insert from right
+ if (i_target_start_bit == ~0)
+ {
+ i_target_start_bit = (i_target_length - (i_source_length - i_source_start_bit));
+ }
+
+ // len defaults to (sizeof(OT) * 8) - i_source_start_bit
+ if (i_length == ~0)
+ {
+ i_length = i_source_length - i_source_start_bit;
+ }
+
+ // Check for overflow
+ if ((i_length + i_target_start_bit > i_target_length) ||
+ (i_length + i_source_start_bit > i_source_length))
+ {
+ return fapi2::FAPI2_RC_OVERFLOW;
+ }
+
+ do
+ {
+ const bits_type src_idx = i_source_start_bit / bits_per_unit;
+ const bits_type trg_idx = i_target_start_bit / bits_per_unit;
+
+ // "slop" = unaligned bits
+ const bits_type src_slop = i_source_start_bit % bits_per_unit;
+ const bits_type trg_slop = i_target_start_bit % bits_per_unit;
+
+ // "cnt" = largest number of bits to be moved each pass
+ bits_type cnt = std::min(i_length, bits_per_unit);
+ cnt = std::min(cnt, bits_per_unit - src_slop);
+ cnt = std::min(cnt, bits_per_unit - trg_slop);
+
+ // generate the source mask only once
+ bits_type mask = fast_mask32(src_slop, cnt);
+
+ // read the source bits only once
+ bits_type src_bits = i_source[src_idx] & mask;
+
+ // "shift" = amount of shifting needed for target alignment
+ int32_t shift = trg_slop - src_slop;
+
+ // ideally (i << -1) would yield (i >> 1), but it
+ // doesn't, so we need an extra branch here
+
+ if (shift < 0)
+ {
+ src_bits <<= -shift;
+ mask <<= -shift;
+ }
+ else
+ {
+ src_bits >>= shift;
+ mask >>= shift;
+ }
+
+ // clear source '0' bits in the target
+ i_target[trg_idx] &= ~mask;
+ // set source '1' bits in the target
+ i_target[trg_idx] |= src_bits;
+
+ i_source_start_bit += cnt;
+ i_target_start_bit += cnt;
+
+ i_length -= cnt;
+ } while (0 < i_length);
+
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+ /// @endcond
+
+ /// @brief Class representing a FAPI variable_buffer.
+ /// @remark Variable buffers are buffers which can be variable in length
+ /// (and "odd sized.") These best represent the FAPI 1.X ecmdDataBuffer,
+ /// however they are implemented using the same template techniques
+ /// as the new fapi::buffer.
+ /// @note Variable buffers are not (presently) declared as std::bitset
+ /// as bitsets' size is fixed at runtime. It is not clear if this is
+ /// acceptable for variable_buffers at this time.
+ /// @note Variable buffers are not (presently) declared as std::vector<bool>
+ /// as it would need to be implemented separate from std::vector, and
+ /// it's not clear it would give us any real advantage. Howevever, its is
+ /// more likely this will become a std::vector<bool> than a std::bitset.
+ class variable_buffer : public buffer_base<bits_container>
+ {
+
+ public:
+
+ ///
+ /// @brief Variable buffer constructor
+ /// @param[in] i_value number of *bits* (sizeof(uint_type) * 8)
+ /// needed.
+ variable_buffer(bits_type i_value = 0);
+
+ ///
+ /// @brief Variable buffer list constructor
+ /// @param[in] i_value an initializer list to initialize the container.
+ ///
+ variable_buffer(const std::initializer_list<unit_type>& i_value);
+
+ /// @name Bit/Word Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Return the length of the buffer in bits
+ /// @return Length in bits
+ ///
+ inline uint32_t getBitLength(void) const
+ { return iv_perceived_bit_length; }
+
+ ///
+ /// @brief Return the length of the buffer in OT units
+ /// @return Length in OT units rounded up
+ /// @tparam OT the type to get the length of. For example, if one
+ /// wanted the length in double words, OT would be uint64_t
+ /// (getLength<uint64_t>().) Similarly, to get the length in words,
+ /// getLength<uin32_t>().
+ ///
+ template< typename OT >
+ inline uint32_t getLength(void) const
+ {
+ static const uint32_t bits_in_ot = sizeof(OT) * 8;
+ return (getBitLength() + (bits_in_ot - 1)) / bits_in_ot;
+ }
+
+ ///
+ /// @brief Set a bit in the buffer
+ /// @param[in] i_bit the bit number to set.
+ /// @note 0 is left-most
+ /// @return FAPI2_RC_SUCCESS if OK
+ ///
+ inline fapi2::ReturnCode setBit(const bits_type& i_bit)
+ {
+ const bits_type index = i_bit / bits_per_unit;
+
+ if (index > iv_data.size())
+ {
+ return FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ iv_data[index] |=
+ unit_type(1) << (bits_per_unit - 1) -
+ (i_bit - (index * bits_per_unit));
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Clear a bit in buffer
+ /// @tparam SB Start bit in buffer to clear.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// clear
+ /// @return FAPI2_RC_SUCCESS on success
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type SB, bits_type L >
+ fapi2::ReturnCode clearBit(void);
+
+ ///
+ /// @brief Invert bit
+ /// @tparam SB Start bit in buffer to invert.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// invert, defaults to 1
+ /// @return FAPI2_RC_SUCCESS on success
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ fapi2::ReturnCode flipBit(void);
+
+ ///
+ /// @brief Get the value of a bit in the buffer
+ /// @tparam B Bit in buffer to get.
+ /// @return true/1 if bit is on, false/0 if bit is off
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline bool getBit(void) const
+ {
+ const bits_type index = B / bits_per_unit;
+ const unit_type mask = unit_type(1) << (bits_per_unit - 1) - (B - (index * bits_per_unit));
+ return iv_data[index] & mask;
+ }
+
+ ///
+ /// @brief Test if multiple bits are set
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return true if all bits in range are set - false if any
+ /// bit is clear
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bool isBitSet(void) const;
+
+ ///
+ /// @brief Test if multiple bits are clear
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return true if bit is clear - false if bit is set
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bool isBitClear(void) const;
+
+ ///
+ /// @brief Count number of bits set in a range
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return Number of bits set in range
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bits_type getNumBitsSet(void) const;
+
+ ///@}
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ // Note: Many (all?) of these are not needed and the compiler complains
+ // as the cast to T yields a better operator. There are here mainly for
+ // documenation purposes.
+
+ ///
+ /// @brief operator>>()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator>>(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator<<()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator<<(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator+()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator+(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator+=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator+=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator|=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator&=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator|(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator&(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator^=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator^=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator!=()
+ ///
+#ifdef DOXYGEN
+ bool operator!=(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator==()
+ /// @return true if and only if lhs == rhs
+ ///
+ inline bool operator==(const fapi2::bits_container& rhs) const
+ {
+ if (&iv_data == &rhs)
+ {
+ return true;
+ }
+
+ return iv_data == rhs;
+ }
+
+ ///
+ /// @brief Copy part of an element into the DataBuffer
+ /// @param[in] i_data OT value to copy into DataBuffer
+ /// @param[in] i_targetStart The position in this where the copy starts
+ /// @param[in] i_len How many bits to copy
+ /// @param[in] i_sourceStart The start positon in i_data, defaults to 0
+ /// @return FAPI2_RC_SUCCESS on success, FAPi2_RC_OVERFLOW otherwise
+ ///
+ template<typename OT>
+ fapi2::ReturnCode insert(const OT& i_data,
+ bits_type i_targetStart = 0,
+ bits_type i_len = ~0,
+ bits_type i_sourceStart = 0);
+
+ ///
+ /// @brief Copy in a right aligned (decimal) element
+ /// @param[in] i_data the incoming data
+ /// - data is taken right aligned
+ /// @param[in] i_targetStart The starting bit position in this
+ /// - Defaultst to 0
+ /// @param[in] i_len The length, in bits, the user wants copied.
+ /// - Defaults to all of the bits in the source which fit
+ /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
+ ///
+ template<typename OT>
+ fapi2::ReturnCode insertFromRight(const OT& i_data,
+ bits_type i_targetStart = 0,
+ bits_type i_len = ~0);
+
+ ///
+ /// @brief Copy data from this buffer into an OT
+ /// @tparam OT the type of the outgoing data
+ /// @param[out] o_out OT to copy into - data is placed left aligned
+ /// @param[in] i_start Start bit to copy from - defaults to 0
+ /// @param[in] i_len Length of bits to copy - defaults to filling o_out
+ /// @return FAPI2_RC_SUCCESS on success
+ ///
+ template< typename OT >
+ fapi2::ReturnCode extract(OT& o_out,
+ bits_type i_start = 0,
+ bits_type i_len = ~0) const;
+
+ ///
+ /// @brief Copy data from this buffer into an OT and right justify
+ /// @tparam OT the type of the outgoing data
+ /// @param[out] o_out OT to copy into - data is placed right aligned
+ /// @param[in] i_start Start bit to copy from - defaults to 0
+ /// @param[in] i_len Length of bits to copy - defaults to filling o_out
+ /// @return FAPI2_RC_SUCCESS on success
+ ///
+ template< typename OT >
+ fapi2::ReturnCode extractToRight(OT& o_out,
+ bits_type i_start = 0,
+ bits_type i_len = ~0) const;
+ ///@}
+
+ private:
+ // Just shorthand ...
+ static const bits_type bits_per_unit =
+ bufferTraits<bits_container>::bits_per_unit;
+
+ // The number of bits the user asked for. The actual size of the
+ // container might be larger.
+ bits_type iv_perceived_bit_length;
+
+ ///
+ /// @brief Internal bit extraction method.
+ /// @tparam OT The type of the destination
+ /// @param[in] i_start The starting bit position in this
+ /// @param[in] i_count The length, in bits, the user wants copied.
+ /// @param[out] o_dest Where to put the data
+ ///
+ template< typename OT >
+ fapi2::ReturnCode _extract(bits_type i_start,
+ bits_type i_count,
+ OT* o_dest) const;
+
+ ///
+ /// @brief Internal insertFromRight
+ /// @param[in] i_data, the incoming data
+ /// @param[in] i_data_length The length in bits of the incoming data
+ /// @param[in] i_target_start_bit The starting bit position in this
+ /// @param[in] i_length The length, in bits, the user wants copied.
+ ///
+ template<typename OT>
+ fapi2::ReturnCode _insertFromRight(const OT& i_data,
+ bits_type i_data_length,
+ bits_type i_targetStart,
+ bits_type i_len);
+
+ };
+
+ inline variable_buffer::
+ variable_buffer(bits_type i_value):
+ buffer_base(i_value),
+ iv_perceived_bit_length(i_value)
+ {
+ static_assert(std::is_same<unit_type, uint32_t>::value,
+ "code currently needs unit_type to be a unit32_t");
+ }
+
+ inline variable_buffer::
+ variable_buffer(const std::initializer_list<unit_type>& i_value):
+ buffer_base(i_value),
+ iv_perceived_bit_length(i_value.size() * sizeof(unit_type) * 8)
+ {
+ static_assert(std::is_same<unit_type, uint32_t>::value,
+ "code currently needs unit_type to be a unit32_t");
+ }
+
+
+
+ /// @cond
+ //
+ // Generic insert
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::insert(const OT& i_source,
+ bits_type i_targetStart,
+ bits_type i_len,
+ bits_type i_sourceStart)
+ {
+ return _insert((unit_type*)(&i_source), parameterTraits<OT>::bit_length,
+ &(iv_data[0]), getBitLength(),
+ i_sourceStart, i_targetStart, i_len);
+ }
+
+ //
+ // Insert another variable_bufer
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::insert(
+ const variable_buffer& i_data,
+ bits_type i_targetStart,
+ bits_type i_len,
+ bits_type i_sourceStart)
+ {
+ return _insert((unit_type*)&(i_data()[0]), i_data.getBitLength(),
+ &(iv_data[0]), getBitLength(),
+ i_sourceStart, i_targetStart, i_len);
+ }
+
+ //
+ // Generic insert from right
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::insertFromRight(
+ const OT& i_data,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ _insertFromRight(i_data, parameterTraits<OT>::bit_length, i_targetStart, i_len);
+ }
+
+ //
+ // variable_buffer insert from right
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::insertFromRight(
+ const variable_buffer& i_data,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ const bits_type bit_length_of_source = i_data.getBitLength();
+ _insertFromRight(i_data, bit_length_of_source, i_targetStart, i_len);
+ }
+
+
+
+
+ //
+ // Generic extract. Extract is an insert with the arguments reversed.
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::extract(
+ OT& i_data,
+ bits_type i_start,
+ bits_type i_len) const
+ {
+ // Needed to trick the compiler into matching the template below
+ const bits_type max_length = parameterTraits<OT>::bit_length;
+
+ // If thy didn't pass an i_len, assume they want all the data
+ // which will fit.
+ if (i_len == ~0)
+ {
+ i_len = max_length;
+ }
+
+ return _insert((container_unit*)&iv_data[0], getBitLength(),
+ &i_data, max_length,
+ i_start, 0U, i_len);
+ }
+
+ //
+ // Extract in to another variable_bufer
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::extract(
+ variable_buffer& i_data,
+ bits_type i_start,
+ bits_type i_len) const
+ {
+ // If thy didn't pass an i_len, assume they want all the data
+ // which will fit.
+ if (i_len == ~0)
+ {
+ i_len = i_data.getBitLength();
+ }
+ return _insert((container_unit*)&iv_data[0], getBitLength(),
+ &(i_data()[0]), i_data.getBitLength(),
+ i_start, 0U, i_len);
+ }
+
+
+
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::_insertFromRight(
+ const OT& i_data,
+ bits_type i_data_length,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ // If they didn't pass in a length, assume they want all the i_data
+ // which will fit.
+ if( i_len == ~0 )
+ {
+ // The longest the length can be is the length of the data
+ // This is the miniumum of the length of the data or the
+ // number of available bits
+ i_len = std::min(i_data_length, getBitLength() - i_targetStart);
+ }
+
+ // Source start is the length, counted from the right
+ return insert(i_data, i_targetStart, i_len, i_data_length - i_len);
+ }
+
+ //
+ // Invalid specializations of set
+ //
+ /// @cond
+ // Sepcialize the variable_buffer version to to "undefined" so the
+ // linker complains loudly if anyone calls it.
+#if 0
+ template<>
+ inline fapi2::ReturnCode buffer_base::set(
+ const variable_buffer& i_value,
+ bits_type i_offset);
+#endif
+ /// @endcond
+};
+
+
+#endif
diff --git a/hwpf/fapi/src/error_info.C b/hwpf/fapi/src/error_info.C
new file mode 100755
index 00000000..b4e35029
--- /dev/null
+++ b/hwpf/fapi/src/error_info.C
@@ -0,0 +1,410 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file error_info.C
+ * @brief Implements the error information classes
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <plat_trace.H>
+#include <error_info.H>
+#include <buffer.H>
+
+namespace fapi2
+{
+ ///
+ /// @brief Constructor
+ ///
+ /// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
+ /// @param[in] i_pFfdc Pointer to the FFDC to copy
+ /// @param[in] i_size Size of the FFDC to copy
+ ///
+ ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId,
+ const void* i_pFfdc,
+ const uint32_t i_size):
+ iv_ffdcId(i_ffdcId),
+ iv_size(i_size)
+ {
+ iv_pFfdc = std::shared_ptr<uint8_t>(new uint8_t[i_size]());
+
+ // If they passed us a NULL pointer they want to fill
+ // in the data themselves later.
+ if (i_pFfdc != nullptr)
+ {
+ memcpy(iv_pFfdc.get(), i_pFfdc, i_size);
+ }
+ }
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_hw Hardware to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ /// @param[in] i_refTarget Reference to reference target
+ ///
+ ErrorInfoHwCallout::ErrorInfoHwCallout(
+ const HwCallouts::HwCallout i_hw,
+ const CalloutPriorities::CalloutPriority i_calloutPriority,
+ const Target<TARGET_TYPE_ALL> & i_refTarget):
+ iv_hw(i_hw),
+ iv_calloutPriority(i_calloutPriority),
+ iv_refTarget(i_refTarget)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_procedure Procedure to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoProcedureCallout::ErrorInfoProcedureCallout(
+ const ProcedureCallouts::ProcedureCallout i_procedure,
+ const CalloutPriorities::CalloutPriority i_calloutPriority):
+ iv_procedure(i_procedure),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target1 Reference to target on one end of the bus
+ /// @param[in] i_target2 Reference to target on other end of the bus
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoBusCallout::ErrorInfoBusCallout(
+ const Target<TARGET_TYPE_ALL> & i_target1,
+ const Target<TARGET_TYPE_ALL> & i_target2,
+ const CalloutPriorities::CalloutPriority i_calloutPriority):
+ iv_target1(i_target1),
+ iv_target2(i_target2),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target Reference to the target to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ ///
+ ErrorInfoCDG::ErrorInfoCDG(
+ const Target<TARGET_TYPE_ALL> & i_target,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority):
+ iv_target(i_target),
+ iv_callout(i_callout),
+ iv_deconfigure(i_deconfigure),
+ iv_gard(i_gard),
+ iv_calloutPriority(i_priority)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_parent Reference to the parent target
+ /// @oaram[in] i_childType Child target type to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ /// @param[in] i_childPort Child Port
+ /// For DIMM children, the MBA port number
+ /// @param[in] i_childNum Child Number
+ /// For DIMM children, the dimm socket number
+ /// For Chip children, the chip position
+ /// For Chiplet children, the chiplet unit pos
+ ///
+ ErrorInfoChildrenCDG::ErrorInfoChildrenCDG(
+ const Target<TARGET_TYPE_ALL> & i_parentChip,
+ const TargetType i_childType,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority,
+ const uint8_t i_childPort, const uint8_t i_childNum):
+ iv_parent(i_parentChip),
+ iv_childType(i_childType),
+ iv_callout(i_callout),
+ iv_calloutPriority(i_priority),
+ iv_deconfigure(i_deconfigure),
+ iv_gard(i_gard),
+ iv_childPort(i_childPort),
+ iv_childNumber(i_childNum)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_trace
+ ///
+ ErrorInfoCollectTrace::ErrorInfoCollectTrace(
+ CollectTraces::CollectTrace i_traceId):
+ iv_eiTraceId(i_traceId)
+ {}
+
+
+ ///
+ /// @brief Collect target, buffer or generic FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryFfdc::addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_objects) const
+ {
+ // "variable buffer ffdc not yet implemented");
+ assert(iv_ffdcSize != EI_FFDC_SIZE_VBUF);
+
+ switch(iv_ffdcSize)
+ {
+ case EI_FFDC_SIZE_BUF:
+ {
+ const buffer<uint64_t>* object =
+ static_cast<const buffer<uint64_t>*>(i_objects[iv_ffdcObjIndex]);
+
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(
+ new ErrorInfoFfdc(iv_ffdcId, object,
+ sizeof(object))));
+
+ FAPI_DBG("addErrorInfo: Adding buffer id: 0x%x size: %lu buf: 0x%lx",
+ iv_ffdcId, sizeof(object), uint64_t(*object));
+ }
+ break;
+
+ case EI_FFDC_SIZE_TARGET:
+ {
+ Target<TARGET_TYPE_ALL> object =
+ *(static_cast<const Target<TARGET_TYPE_ALL>*>
+ (i_objects[iv_ffdcObjIndex]));
+
+ // Allocate an ErrorInfoFfdc but don't copy anything in to it.
+ // We can copy the target string once if we copy directly into
+ // the error info
+ ErrorInfoFfdc* e =
+ new ErrorInfoFfdc(iv_ffdcId, nullptr, MAX_ECMD_STRING_LEN);
+
+ toString(object, static_cast<char*>(e->getData()),
+ MAX_ECMD_STRING_LEN);
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(e));
+
+ FAPI_DBG("addErrorInfo: Adding target ffdc id: 0x%x %s",
+ iv_ffdcId, static_cast<char*>(e->getData()));
+ }
+ break;
+
+ default:
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(
+ new ErrorInfoFfdc(
+ iv_ffdcId,
+ i_objects[iv_ffdcObjIndex],
+ iv_ffdcSize)));
+ FAPI_DBG("addErrorInfo: Adding ffdc id 0x%x size: %d",
+ iv_ffdcId, iv_ffdcSize);
+ break;
+
+ };
+
+ return;
+ }
+
+ ///
+ /// @brief Collect h/w callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryHwCallout::addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // If the index is 0xFF, we use an empty target. Otherwise the
+ // target is taken from the object arrary with the given index.
+ const fapi2::Target<TARGET_TYPE_ALL> target =
+ iv_refObjIndex == 0xFF ?
+ fapi2::Target<TARGET_TYPE_ALL>() :
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_refObjIndex]));
+
+ ErrorInfoHwCallout* ei = new ErrorInfoHwCallout(
+ static_cast<HwCallouts::HwCallout>(iv_hw),
+ static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority),
+ target);
+
+ FAPI_DBG("addErrorInfo: Adding hw callout target: 0x%lx hw: %d, pri: %d",
+ ei->iv_refTarget.get(), ei->iv_hw, ei->iv_calloutPriority);
+
+ i_info->iv_hwCallouts.push_back(std::shared_ptr<ErrorInfoHwCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect proc callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryProcCallout::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoProcedureCallout* ei = new ErrorInfoProcedureCallout(
+ static_cast<ProcedureCallouts::ProcedureCallout>(iv_procedure),
+ static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority));
+
+ // Add the ErrorInfo
+ FAPI_DBG("addErrorInfo: Adding proc callout, proc: %d, pri: %d",
+ ei->iv_procedure, ei->iv_calloutPriority);
+
+ i_info->iv_procedureCallouts.push_back(
+ std::shared_ptr<ErrorInfoProcedureCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect bus callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryBusCallout::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // We need to add a procedure callout as well as a bus callout
+ ErrorInfoEntryProcCallout(ProcedureCallouts::BUS_CALLOUT,
+ iv_calloutPriority).addErrorInfo(i_info,
+ i_object);
+
+ // Now add our bus callout, but drop the priority by one.
+ ErrorInfoBusCallout* ei = new ErrorInfoBusCallout(
+ // First target
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_endpoint1ObjIndex])),
+
+ // Second target
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_endpoint2ObjIndex])),
+
+ // Priority, one lower.
+ (iv_calloutPriority == CalloutPriorities::HIGH) ?
+ CalloutPriorities::MEDIUM : CalloutPriorities::LOW);
+
+ FAPI_DBG("addErrorInfo: Adding bus callout t1: 0x%lx t2: 0x%lx, pri: %d",
+ ei->iv_target1.get(), ei->iv_target2.get(),
+ ei->iv_calloutPriority);
+
+ i_info->iv_busCallouts.push_back(
+ std::shared_ptr<ErrorInfoBusCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect h/w target cdg FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryTargetCDG::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoCDG* ei = new
+ ErrorInfoCDG(
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_targetObjIndex])),
+ iv_callout,
+ iv_deconfigure,
+ iv_gard,
+ static_cast<CalloutPriorities::CalloutPriority>
+ (iv_calloutPriority)
+ );
+
+ FAPI_DBG("addErrorInfo: Adding target 0x%lx cdg (%d:%d:%d), pri: %d",
+ ei->iv_target.get(),
+ ei->iv_callout, ei->iv_deconfigure,
+ ei->iv_gard, ei->iv_calloutPriority);
+
+ // Add the ErrorInfo
+ i_info->iv_CDGs.push_back(std::shared_ptr<ErrorInfoCDG>(ei));
+ }
+
+ ///
+ /// @brief Collect h/w children cdg FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryChildrenCDG::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoChildrenCDG* ei = new ErrorInfoChildrenCDG(
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_parentObjIndex])),
+ static_cast<fapi2::TargetType>(iv_childType),
+ iv_callout,
+ iv_deconfigure,
+ iv_gard,
+ static_cast<CalloutPriorities::CalloutPriority>
+ (iv_calloutPriority),
+ iv_childPort,
+ iv_childNumber);
+
+ FAPI_DBG("addErrorInfo: Adding children cdg (%d:%d:%d), type:"
+ " 0x%08x, pri: %d",
+ ei->iv_callout, ei->iv_deconfigure, ei->iv_gard,
+ ei->iv_childType, ei->iv_calloutPriority);
+
+ // Add the ErrorInfo
+ i_info->iv_childrenCDGs.push_back(
+ std::shared_ptr<ErrorInfoChildrenCDG>(ei));
+ }
+
+ ///
+ /// @brief Collect trace information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryCollectTrace::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoCollectTrace* ei = new ErrorInfoCollectTrace(
+ static_cast<CollectTraces::CollectTrace>(iv_eieTraceId));
+
+ FAPI_DBG("addErrorInfo: Adding trace: 0x%x", ei->iv_eiTraceId);
+
+ // Add the ErrorInfo
+ i_info->iv_traces.push_back(std::shared_ptr<ErrorInfoCollectTrace>(ei));
+ }
+
+};
diff --git a/hwpf/fapi/src/ffdc.C b/hwpf/fapi/src/ffdc.C
new file mode 100755
index 00000000..efe922ea
--- /dev/null
+++ b/hwpf/fapi/src/ffdc.C
@@ -0,0 +1,57 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file ffdc.C
+ * @brief Implements the FirstFailureData class
+ */
+
+#include <plat_trace.H>
+#include <ffdc.H>
+#include <error_info.H>
+
+namespace fapi2
+{
+
+ ///
+ /// @brief Add error information to this ffdc object
+ /// @param[in] A pointer to a list of objects
+ /// @param[in] A pointer to the list of entries
+ /// @param[in] The count of how many entries there are
+ /// @return void
+ ///
+ template<>
+ void FirstFailureData<ReturnCode>::addErrorInfo(
+ const void* const* i_pObjects,
+ const ErrorInfoEntry* i_pEntries,
+ const uint8_t i_count)
+ {
+ FAPI_DBG("%d entries", i_count);
+ for (uint32_t i = 0; i < i_count; i++)
+ {
+ i_pEntries[i].addErrorInfo(iv_info, i_pObjects);
+ }
+ }
+
+
+
+};
diff --git a/hwpf/fapi/src/plat_utils.C b/hwpf/fapi/src/plat_utils.C
new file mode 100755
index 00000000..d22a6350
--- /dev/null
+++ b/hwpf/fapi/src/plat_utils.C
@@ -0,0 +1,117 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file plat_utils.C
+ * @brief Implements fapi2 common utilities
+ */
+
+#include <stdint.h>
+#include <plat_trace.H>
+#include <return_code.H>
+#include <error_info.H>
+
+namespace fapi2
+{
+ ///
+ /// @brief Log an error.
+ ///
+ void logError(
+ fapi2::ReturnCode & io_rc,
+ fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,
+ bool i_unitTestError = false )
+ {
+ FAPI_DBG("logging 0x%lx.", uint64_t(io_rc));
+
+ // Iterate over the vectors and output what is in them.
+ const ErrorInfo* ei = io_rc.getErrorInfo();
+
+ FAPI_DBG("ffdcs: %lu", ei->iv_ffdcs.size());
+ for( auto i = ei->iv_ffdcs.begin(); i != ei->iv_ffdcs.end(); ++i )
+ {
+ uint32_t sz;
+ (*i)->getData(sz);
+ FAPI_DBG("\tid: 0x%x size %d", (*i)->getFfdcId(), sz);
+ }
+
+ FAPI_DBG("hwCallouts: %lu", ei->iv_hwCallouts.size());
+ for( auto i = ei->iv_hwCallouts.begin(); i != ei->iv_hwCallouts.end();
+ ++i )
+ {
+ FAPI_DBG("\thw: %d pri %d target: 0x%lx",
+ (*i)->iv_hw, (*i)->iv_calloutPriority,
+ (*i)->iv_refTarget.get());
+ }
+
+ FAPI_DBG("procedureCallouts: %lu", ei->iv_procedureCallouts.size());
+ for( auto i = ei->iv_procedureCallouts.begin();
+ i != ei->iv_procedureCallouts.end(); ++i )
+ {
+ FAPI_DBG("\tprocedure: %d pri %d",
+ (*i)->iv_procedure, (*i)->iv_calloutPriority);
+ }
+
+ FAPI_DBG("busCallouts: %lu", ei->iv_busCallouts.size());
+ for( auto i = ei->iv_busCallouts.begin(); i != ei->iv_busCallouts.end();
+ ++i )
+ {
+ FAPI_DBG("\tbus: t1: 0x%lx t2: 0x%lx pri: %d",
+ (*i)->iv_target1.get(), (*i)->iv_target2.get(),
+ (*i)->iv_calloutPriority);
+ }
+
+
+ FAPI_DBG("cdgs: %lu", ei->iv_CDGs.size());
+ for( auto i = ei->iv_CDGs.begin(); i != ei->iv_CDGs.end(); ++i )
+ {
+ FAPI_DBG("\ttarget: 0x%lx co: %d dc: %d gard: %d pri: %d",
+ (*i)->iv_target.get(),
+ (*i)->iv_callout,
+ (*i)->iv_deconfigure,
+ (*i)->iv_gard,
+ (*i)->iv_calloutPriority);
+
+ }
+
+ FAPI_DBG("childrenCDGs: %lu", ei->iv_childrenCDGs.size());
+ for( auto i = ei->iv_childrenCDGs.begin();
+ i != ei->iv_childrenCDGs.end(); ++i )
+ {
+ FAPI_DBG("\tchildren: parent 0x%lx co: %d dc: %d gard: %d pri: %d",
+ (*i)->iv_parent.get(),
+ (*i)->iv_callout,
+ (*i)->iv_deconfigure,
+ (*i)->iv_gard,
+ (*i)->iv_calloutPriority);
+ }
+
+ FAPI_DBG("traces: %lu", ei->iv_traces.size());
+ for( auto i = ei->iv_traces.begin(); i != ei->iv_traces.end(); ++i )
+ {
+ FAPI_DBG("\ttraces: 0x%x", (*i)->iv_eiTraceId);
+ }
+
+ // Release the ffdc information now that we're done with it.
+ io_rc.forgetData();
+
+ }
+};
diff --git a/hwpf/fapi/tools/parseErrorInfo.pl b/hwpf/fapi/tools/parseErrorInfo.pl
new file mode 100755
index 00000000..1e3dcbba
--- /dev/null
+++ b/hwpf/fapi/tools/parseErrorInfo.pl
@@ -0,0 +1,1479 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/hwpf/fapi/fapiParseErrorInfo.pl $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2011,2014
+# [+] 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
+# $Id: fapiParseErrorInfo.pl,v 1.30 2014/07/25 00:36:41 jmcgill Exp $
+# Purpose: This perl script will parse HWP Error XML files and create required
+# FAPI code.
+#
+# Author: CamVan Nguyen and Mike Jones
+# Reworked for fapi2/P9
+#
+# Usage:
+# fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Set PREFERRED_PARSER to XML::Parser. Otherwise it uses XML::SAX which contains
+# bugs that result in XML parse errors that can be fixed by adjusting white-
+# space (i.e. parse errors that do not make sense).
+#------------------------------------------------------------------------------
+$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
+
+#------------------------------------------------------------------------------
+# Specify perl modules to use
+#------------------------------------------------------------------------------
+use Digest::MD5 qw(md5_hex);
+use XML::Simple;
+my $xml = new XML::Simple (KeyAttr=>[]);
+
+# Uncomment to enable debug output
+use Data::Dumper;
+use Getopt::Long;
+
+my $target_ffdc_type = "fapi2::Target<fapi2::TARGET_TYPE_ALL>";
+my $buffer_ffdc_type = "fapi2::buffer";
+my $variable_buffer_ffdc_type = "fapi2::variable_buffer";
+my $ffdc_type = "fapi2::ffdc_t";
+
+# We want to keep the signatures for the ffdc gathering hwp so that
+# we can create members of the proper types for the ffdc classes.
+my %signatures = ("proc_extract_pore_halt_ffdc" => ["por_base_state",
+ "por_halt_type_t",
+ "por_ffdc_offset_t"],
+ "hwpTestFfdc1" => [$target_ffdc_type],
+ "proc_extract_pore_base_ffdc" => ["por_base_state", "por_sbe_base_state"],
+ "proc_tp_collect_dbg_data" => [$target_ffdc_type],
+ );
+
+# There are some names used in the XML files which exist in either
+# c++ keywords (case, for example) or macros (DOMAIN). The one's which
+# cause problems and need to be changed are here.
+#
+# DOMAIN is defined to 1 in math.h
+my %mangle_names = ("DOMAIN" => "FAPI2_DOMAIN");
+
+# A list of deprecated elements. These will report messages to the
+# user, and not define anything. They have not been found to be used,
+# but that doesn't mean they're not ...
+my %deprecated = ("RC_PROCPM_PMCINIT_TIMEOUT" => "CHIP_IN_ERROR is defined as a callout procedure");
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $arg_empty_ffdc = undef;
+my $arg_output_dir = undef;
+my $arg_use_variable_buffers = undef;
+
+# Get the options from the command line - the rest of @ARGV will
+# be filenames
+GetOptions("empty-ffdc-classes" => \$arg_empty_ffdc,
+ "output-dir=s" => \$arg_output_dir,
+ "use-variable-buffers" => \$arg_use_variable_buffers);
+
+my $numArgs = $#ARGV + 1;
+if (($numArgs < 1) || ($arg_output_dir eq undef))
+{
+ print ("Usage: parseErrorInfo.pl [--empty-ffdc-classes] [--use-variable-buffers] --output-dir=<output dir> <filename1> <filename2> ...\n");
+ print (" This perl script will parse HWP Error XML files and creates\n");
+ print (" the following files:\n");
+ print (" - hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)\n");
+ print (" - hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR\n");
+ print (" when a HWP generates an error)\n");
+ print (" - collect_reg_ffdc.C. Function to collect register FFDC\n");
+ print (" - set_sbe_error.H. Macro to create an SBE error\n");
+ print (" The --empty-ffdc-classes option is for platforms which don't collect ffdc.\n");
+ exit(1);
+}
+
+#------------------------------------------------------------------------------
+# Hashes containing error names/enum-values
+#------------------------------------------------------------------------------
+my %errNameToValueHash;
+my %errValuePresentHash;
+
+#------------------------------------------------------------------------------
+# Hashes containing ffdc names/enum-values
+#------------------------------------------------------------------------------
+my %ffdcNameToValueHash;
+my %ffdcValuePresentHash;
+
+#------------------------------------------------------------------------------
+# Subroutine that checks if an entry exists in an array. If it doesn't exist
+# then it is added. The index of the entry within the array is returned
+#------------------------------------------------------------------------------
+sub addEntryToArray
+{
+ my ($arrayref, $entry ) = @_;
+
+ my $match = 0;
+ my $index = 0;
+
+ foreach my $element (@$arrayref)
+ {
+ if ($element eq $entry)
+ {
+ $match = 1;
+ last;
+ }
+ else
+ {
+ $index++;
+ }
+ }
+
+ if (!($match))
+ {
+ push(@$arrayref, $entry);
+ }
+
+ return $index;
+}
+
+#------------------------------------------------------------------------------
+# Subroutine that figures out an error enum value from an error name and stores
+# it in global hashes
+#------------------------------------------------------------------------------
+sub setErrorEnumValue
+{
+ my $name = $_[0];
+
+ #--------------------------------------------------------------------------
+ # Check that the error name is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($errNameToValueHash{$name}))
+ {
+ # Two different errors with the same name!
+ print ("fapiParseErrorInfo.pl ERROR. Duplicate error name ", $name, "\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Figure out the error enum-value. This is a hash value generated from
+ # the error name. A hash is used for Cronus so that if a HWP is not
+ # recompiled against a new eCMD/Cronus version where the errors have
+ # changed then there will not be a mismatch in error values.
+ # This is a 24bit hash value because FAPI has a requirement that the
+ # top byte of the 32 bit error value be zero to store flags indicating
+ # the creator of the error
+ #--------------------------------------------------------------------------
+ my $errHash128Bit = md5_hex($name);
+ my $errHash24Bit = substr($errHash128Bit, 0, 6);
+
+ #--------------------------------------------------------------------------
+ # Check that the error enum-value is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($errValuePresentHash{$errHash24Bit}))
+ {
+ # Two different errors generate the same hash-value!
+ print ("fapiParseAttributeInfo.pl ERROR. Duplicate error hash value\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Update the hashes with the error name and ID
+ #--------------------------------------------------------------------------
+ $errValuePresentHash{$errHash24Bit} = 1;
+ $errNameToValueHash{$name} = $errHash24Bit;
+}
+
+#------------------------------------------------------------------------------
+# Subroutine that figures out an FFDC ID value from an FFDC name and stores it
+# in global hashes for use when creating the enumeration of FFDC IDs
+#------------------------------------------------------------------------------
+sub setFfdcIdValue
+{
+ my $name = $_[0];
+
+ #--------------------------------------------------------------------------
+ # Check that the FFDC name is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($ffdcNameToValueHash{$name}))
+ {
+ # Two different FFDCs with the same name!
+ print ("fapiParseErrorInfo.pl ERROR. Duplicate FFDC name ", $name, "\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Figure out the FFDC enum-value. This is a hash value generated from
+ # the FFDC name.
+ #--------------------------------------------------------------------------
+ my $ffdcHash128Bit = md5_hex($name);
+ my $ffdcHash32Bit = substr($ffdcHash128Bit, 0, 8);
+
+ #--------------------------------------------------------------------------
+ # Check that the error enum-value is not a duplicate
+ #--------------------------------------------------------------------------
+ if (exists($ffdcValuePresentHash{$ffdcHash32Bit}))
+ {
+ # Two different FFDCs generate the same hash-value!
+ print ("fapiParseAttributeInfo.pl ERROR. Duplicate FFDC hash value\n");
+ exit(1);
+ }
+
+ #--------------------------------------------------------------------------
+ # Update the hashes with the error name and ID
+ #--------------------------------------------------------------------------
+ $ffdcValuePresentHash{$ffdcHash32Bit} = 1;
+ $ffdcNameToValueHash{$name} = $ffdcHash32Bit;
+}
+
+#------------------------------------------------------------------------------
+# Subroutine to create ffdc methods
+#------------------------------------------------------------------------------
+sub addFfdcMethod
+{
+ my $methods = shift;
+ my $ffdc_uc = shift;
+ my $class_name = shift;
+ my $type = shift;
+ my $ffdc_lc = lc($ffdc_uc);
+
+ # If we didn't get a type passed in, this element will get an ffdc_t pair.
+ $type = $ffdc_type if ($type eq undef);
+
+ # Mangle the uppercase name if needed
+ $ffdc_uc = $mangle_names{$ffdc_uc} if ($mangle_names{$ffdc_uc} ne undef);
+
+ my $key = $ffdc_lc.$type;
+ my $key_target = $ffdc_lc.$target_ffdc_type;
+ my $key_ffdc = $ffdc_lc.$ffdc_type;
+
+ # Check to see if this element already has been recorded with this
+ # type or a target type. Note the effect we're shooting for here is
+ # to define the member if it's not been defined before *or* it's
+ # changing from an ffdc_t to a target due to other information in the xml
+ return if ($methods->{$key}{type} eq $type);
+ return if ($methods->{$key_target}{type} eq $target_ffdc_type);
+
+ # Just leave if this is a variable_buffer ans we're not supporting that.
+ return if (($type eq $variable_buffer_ffdc_type) && ($arg_use_variable_buffers eq undef));
+
+ # Set the proper type, and clear out any previous members/methods if
+ # we're going from an ffdc_t to a target.
+ $methods->{$key}{type} = $type;
+ delete $methods->{$key_ffdc} if ($type eq $target_ffdc_type);
+
+ my $method = "";
+ my $method_body = "";
+
+ if ($type eq $ffdc_type)
+ {
+ $method = "\n template< typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr >\n";
+ $method .= " $class_name& set_$ffdc_lc(const T& i_value)\n";
+ $method_body = " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
+
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ }
+
+ elsif ($type eq $buffer_ffdc_type)
+ {
+ # Two methods - one for integral buffers and one for variable_buffers
+ $method = "\n template< typename T >\n";
+ $method .= " $class_name& set_$ffdc_lc(const fapi2::buffer<T>& i_value)\n";
+ $method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
+
+ $methods->{$key}{member} = "$ffdc_type $ffdc_uc;\n ";
+ }
+
+ elsif ($type eq $variable_buffer_ffdc_type)
+ {
+ $method = "\n $class_name& set_$ffdc_lc(const fapi2::variable_buffer& i_value)\n";
+ $method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
+
+ # No need to add the member here, it was added with fapi2::buffer. And we can't have variable
+ # buffer support with out integral buffer support (can we?)
+ }
+
+ else
+ {
+ $method = "\n $class_name& set_$ffdc_lc(const $type& i_value)\n";
+ $method_body .= " {$ffdc_uc = &i_value; return *this;}\n\n";
+
+ $methods->{$key}{member} = "const $type* $ffdc_uc;\n ";
+ }
+
+ $method .= ($arg_empty_ffdc eq undef) ? $method_body : " {}\n\n";
+ $methods->{$key}{method} = $method;
+}
+
+#------------------------------------------------------------------------------
+# Open output files for writing
+#------------------------------------------------------------------------------
+my $rcFile = $arg_output_dir;
+$rcFile .= "/";
+$rcFile .= "hwp_return_codes.H";
+open(RCFILE, ">", $rcFile);
+
+my $eiFile = $arg_output_dir;
+$eiFile .= "/";
+$eiFile .= "hwp_error_info.H";
+open(EIFILE, ">", $eiFile);
+
+my $ecFile = $arg_output_dir;
+$ecFile .= "/";
+$ecFile .= "hwp_ffdc_classes.H";
+open(ECFILE, ">", $ecFile);
+
+my $crFile = $arg_output_dir;
+$crFile .= "/";
+$crFile .= "collect_reg_ffdc.C";
+open(CRFILE, ">", $crFile);
+
+my $sbFile = $arg_output_dir;
+$sbFile .= "/";
+$sbFile .= "set_sbe_error.H";
+open(SBFILE, ">", $sbFile);
+
+#------------------------------------------------------------------------------
+# Print start of file information to hwp_error_info.H
+#------------------------------------------------------------------------------
+print EIFILE "// hwp_error_info.H\n";
+print EIFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
+print EIFILE "#ifndef FAPI2_HWPERRORINFO_H_\n";
+print EIFILE "#define FAPI2_HWPERRORINFO_H_\n\n";
+print EIFILE "#include <target.H>\n";
+print EIFILE "#include <return_code.H>\n";
+print EIFILE "#include <plat_trace.H>\n";
+print EIFILE "/**\n";
+print EIFILE " * \@brief Error Information macros and HwpFfdcId enumeration\n";
+print EIFILE " *\/\n";
+
+#------------------------------------------------------------------------------
+# Print start of file information to hwp_ffdc_classes.H
+#------------------------------------------------------------------------------
+print ECFILE "// hwp_ffdc_classes.H\n";
+print ECFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
+print ECFILE "#ifndef FAPI2_HWP_FFDC_CLASSES_H_\n";
+print ECFILE "#define FAPI2_HWP_FFDC_CLASSES_H_\n\n";
+print ECFILE "#include <ffdc.H>\n";
+print ECFILE "#include <buffer.H>\n";
+print ECFILE "#include <variable_buffer.H>\n" if ($arg_use_variable_buffers ne undef);
+print ECFILE "#include <error_info.H>\n";
+print ECFILE "#include <utils.H>\n";
+print ECFILE "#include <hwp_error_info.H>\n";
+print ECFILE "#include <collect_reg_ffdc.H>\n";
+#print ECFILE "#include <proc_extract_sbe_rc.H>\n\n";
+print ECFILE "/**\n";
+print ECFILE " * \@brief FFDC gathering classes\n";
+print ECFILE " *\/\n";
+print ECFILE "namespace fapi2\n{\n";
+
+#------------------------------------------------------------------------------
+# Print start of file information to collectRegFfdc.C
+#------------------------------------------------------------------------------
+print CRFILE "// collect_reg_ffdc.C\n";
+print CRFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
+print CRFILE "#include <stdint.h>\n";
+print CRFILE "#include <vector>\n";
+
+print CRFILE "#include <buffer.H>\n";
+print CRFILE "#include <collect_reg_ffdc.H>\n";
+print CRFILE "#include <target.H>\n";
+print CRFILE "#include <return_code.H>\n";
+print CRFILE "#include <hw_access.H>\n";
+print CRFILE "#include <plat_trace.H>\n\n";
+
+print CRFILE "namespace fapi2\n";
+print CRFILE "{\n";
+print CRFILE "void collectRegFfdc(const fapi2::Target<TARGET_TYPE_ALL>* i_target,\n";
+print CRFILE " const fapi2::HwpFfdcId i_ffdcId,\n";
+print CRFILE " fapi2::ReturnCode & o_rc,\n";
+print CRFILE " const TargetType i_child,\n";
+print CRFILE " const TargetType i_presChild,\n";
+print CRFILE " uint32_t i_childOffsetMult)\n";
+print CRFILE "{\n";
+print CRFILE " FAPI_INF(\"collectRegFfdc. FFDC ID: 0x%x\", i_ffdcId);\n";
+print CRFILE " fapi2::ReturnCode l_rc;\n";
+print CRFILE " fapi2::buffer<uint64_t> l_buf;\n";
+print CRFILE " uint32_t l_cfamData = 0;\n";
+print CRFILE " uint64_t l_scomData = 0;\n";
+print CRFILE " std::vector<uint32_t> l_cfamAddresses;\n";
+print CRFILE " std::vector<uint64_t> l_scomAddresses;\n";
+print CRFILE " uint32_t l_ffdcSize = 0;\n\n";
+print CRFILE " switch (i_ffdcId)\n";
+print CRFILE " {\n";
+
+#------------------------------------------------------------------------------
+# Print start of file information to setSbeError.H
+#------------------------------------------------------------------------------
+print SBFILE "// setSbeError.H\n";
+print SBFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
+print SBFILE "// When SBE code creates an error, it produces an error value\n";
+print SBFILE "// that matches a value in the HwpReturnCode enum in\n";
+print SBFILE "// fapiHwpReturnCodes.H. The SBE uses the __ASSEMBLER__\n";
+print SBFILE "// primitives in hwpReturnCodes.H to do this. The function\n";
+print SBFILE "// that extracts the error value from the SBE needs to call\n";
+print SBFILE "// FAPI_SET_HWP_ERROR to create the error and get all the\n";
+print SBFILE "// actions in the error XML file performed, but that macro can\n";
+print SBFILE "// only be called with the enumerator, not the value. This\n";
+print SBFILE "// FAPI_SET_SBE_ERROR macro can be called instead, it calls\n";
+print SBFILE "// FAPI_SET_HWP_ERROR with the correct error enumerator.\n";
+print SBFILE "// Errors containing <sbeError/> in their XML are supported\n";
+print SBFILE "// in this macro.\n\n";
+print SBFILE "// Note that it is expected that this macro will be called\n";
+print SBFILE "// in one place (the function that extracts the error from\n";
+print SBFILE "// the SBE), if this changes and it is called in multiple\n";
+print SBFILE "// places then the macro could be turned into a function to\n";
+print SBFILE "// avoid the code size increase of expanding the macro in\n";
+print SBFILE "// multiple places. The function approach is slightly more\n";
+print SBFILE "// complicated, there is an extra C file and the function\n";
+print SBFILE "// must take a parameter for the generic chip ID in the error\n";
+print SBFILE "// XML.\n\n";
+print SBFILE "#ifndef FAPI2_SETSBEERROR_H_\n";
+print SBFILE "#define FAPI2_SETSBEERROR_H_\n\n";
+print SBFILE "#define FAPI_SET_SBE_ERROR(RC, ERRVAL)\\\n";
+print SBFILE "{\\\n";
+print SBFILE "switch (ERRVAL)\\\n";
+print SBFILE "{\\\n";
+
+#------------------------------------------------------------------------------
+# For each XML file
+#------------------------------------------------------------------------------
+foreach my $argnum (0 .. $#ARGV)
+{
+ my $infile = $ARGV[$argnum];
+ my $count = 0;
+
+ #--------------------------------------------------------------------------
+ # Read XML file. The ForceArray option ensures that there is an array of
+ # elements even if there is only one element
+ #--------------------------------------------------------------------------
+ my $errors = $xml->XMLin($infile, ForceArray =>
+ ['hwpError', 'collectFfdc', 'ffdc', 'callout', 'deconfigure', 'gard',
+ 'registerFfdc', 'collectRegisterFfdc', 'cfamRegister', 'scomRegister',
+ 'id','collectTrace', 'buffer']);
+
+ # Uncomment to get debug output of all errors
+ #print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
+
+ #--------------------------------------------------------------------------
+ # For each Error
+ #--------------------------------------------------------------------------
+ foreach my $err (@{$errors->{hwpError}})
+ {
+ # Hash of methods for the ffdc-gathering class
+ my %methods;
+
+ #----------------------------------------------------------------------
+ # Check that expected fields are present
+ #----------------------------------------------------------------------
+ if (! exists $err->{rc})
+ {
+ print ("parseErrorInfo.pl ERROR. rc missing\n");
+ exit(1);
+ }
+
+ if (! exists $err->{description})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. description missing\n");
+ exit(1);
+ }
+
+ #----------------------------------------------------------------------
+ # Check that this rc hasn't been deprecated
+ #----------------------------------------------------------------------
+ if ($deprecated{$err->{rc}} ne undef)
+ {
+ print "WARNING: $err->{rc} has been deprecated because $deprecated{$err->{rc}}\n";
+ next;
+ }
+
+ #----------------------------------------------------------------------
+ # Set the error enum value in a global hash
+ #---------------------------------------------------------------------
+ setErrorEnumValue($err->{rc});
+
+ #----------------------------------------------------------------------
+ # If this is an SBE error, add it to set_sbe_error.H
+ #----------------------------------------------------------------------
+ if (exists $err->{sbeError})
+ {
+ print SBFILE " case fapi2::$err->{rc}:\\\n";
+ print SBFILE " FAPI_SET_HWP_ERROR(RC, $err->{rc});\\\n";
+ print SBFILE " break;\\\n";
+ }
+
+ #----------------------------------------------------------------------
+ # Print the CALL_FUNCS_TO_COLLECT_FFDC macro to hwp_error_info.H
+ #----------------------------------------------------------------------
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC) ";
+
+ # For now, this code is removed. It appears to work just fine but
+ # will require more of the fapi2 infrastructure to be in place.
+ # Because the ffdc collection classes create members with real types,
+ # the declarations of the types need to be visible - and they're not
+ # right now. When we get further along, we can enable this code.
+=begin NO_FFDC_COLLECT_HWP
+ $count = 0;
+
+ foreach my $collectFfdc (@{$err->{collectFfdc}})
+ {
+ if ($count == 0)
+ {
+ print EIFILE "{ fapi2::ReturnCode l_tempRc; ";
+ }
+ $count++;
+
+ print EIFILE "FAPI_EXEC_HWP(l_tempRc, $collectFfdc, RC); ";
+
+ # collectFfdc is a string we're going to stuff into FAPI_EXEC_HWP
+ # but we need to create the arguments in the ffdc class. The first
+ # element inthe collectFfdc string is the function to call.
+ my @elements = split /,/, $collectFfdc;
+ my @signature = @{$signatures{@elements[0]}};
+ for (my $i = 1; $i <= $#elements; $i++)
+ {
+ @elements[$i] =~ s/^\s+|\s+$//g;
+ addFfdcMethod(\%methods, @elements[$i], lc($err->{rc}), @signature[$i-1]);
+ }
+ }
+
+ if ($count > 0)
+ {
+ print EIFILE "}";
+ }
+=cut NO_FFDC_COLLECT_HWP
+ print EIFILE "\n";
+
+ #----------------------------------------------------------------------
+ # Print the CALL_FUNCS_TO_COLLECT_REG_FFDC macro to hwp_error_info.H
+ #----------------------------------------------------------------------
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC) ";
+
+ foreach my $collectRegisterFfdc (@{$err->{collectRegisterFfdc}})
+ {
+ #------------------------------------------------------------------
+ # Check that expected fields are present
+ #------------------------------------------------------------------
+ if (! exists $collectRegisterFfdc->{id}[0])
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. id(s) missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ foreach my $id (@{$collectRegisterFfdc->{id}})
+ {
+ #---------------------------------------------------------------------------------
+ # Check FFDC register collection type: target, child, or based on present children
+ #---------------------------------------------------------------------------------
+ if (exists $collectRegisterFfdc->{target})
+ {
+ print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{target}, ";
+ print EIFILE "fapi2::$id, RC, fapi2::TARGET_TYPE_NONE, fapi2::TARGET_TYPE_NONE); ";
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{target},
+ lc($err->{rc}), $target_ffdc_type);
+ }
+ elsif (exists $collectRegisterFfdc->{childTargets})
+ {
+ if (! exists $collectRegisterFfdc->{childTargets}->{parent})
+ {
+ print ("parseErrorInfo.pl ERROR: parent missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ if (! exists $collectRegisterFfdc->{childTargets}->{childType})
+ {
+ print ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{childTargets}->{parent}, fapi2::$id, ";
+ print EIFILE "RC, fapi2::$collectRegisterFfdc->{childTargets}->{childType}, fapi2::TARGET_TYPE_NONE); ";
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{childTargets}->{parent},
+ lc($err->{rc}), $target_ffdc_type);
+ }
+ elsif (exists $collectRegisterFfdc->{basedOnPresentChildren})
+ {
+ if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{target})
+ {
+ print ("parseErrorInfo.pl ERROR: target missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childType})
+ {
+ print ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier})
+ {
+ print ("parseErrorInfo.pl ERROR: childPosOffsetMultiplier missing from collectRegisterFfdc\n");
+ exit(1);
+ }
+ print EIFILE "fapi2::collectRegFfdc($collectRegisterFfdc->{basedOnPresentChildren}->{target}, fapi2::$id, RC, ";
+ print EIFILE "fapi2::TARGET_TYPE_NONE, fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, ";
+ print EIFILE "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier}); ";
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{basedOnPresentChildren}->{target},
+ lc($err->{rc}), $target_ffdc_type);
+ }
+ else
+ {
+ print ("parseErrorInfo.pl ERROR: Invalid collectRegisterFfdc configuration\n");
+ exit(1);
+ }
+ }
+ }
+
+ print EIFILE "\n";
+
+ #----------------------------------------------------------------------
+ # Print the ADD_ERROR_INFO macro to hwp_error_info.H
+ #----------------------------------------------------------------------
+ print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) ";
+
+ # Array of EI Objects
+ my @eiObjects;
+
+ my $eiObjectStr = "const void * l_objects[] = {";
+ my $eiEntryStr = "";
+ my $eiEntryCount = 0;
+ my %cdgTargetHash; # Records the callout/deconfigure/gards for Targets
+ my %cdgChildHash; # Records the callout/deconfigure/gards for Children
+
+ # collect firmware trace
+ foreach my $collectTrace (@{$err->{collectTrace}})
+ {
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_COLLECT_TRACE; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].collect_trace.iv_eieTraceId = fapi2::CollectTraces::$collectTrace; \\\n";
+ $eiEntryCount++;
+ }
+
+ # Local FFDC
+ foreach my $ffdc (@{$err->{ffdc}})
+ {
+ # Set the FFDC ID value in a global hash. The name is <rc>_<ffdc>
+ my $ffdcName = $err->{rc} . "_";
+ $ffdcName = $ffdcName . $ffdc;
+ setFfdcIdValue($ffdcName);
+
+ # Add the FFDC data to the EI Object array if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $ffdc);
+
+ # Add a method to the ffdc-gathering class
+ addFfdcMethod(\%methods, $ffdc, lc($err->{rc}));
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi2::getErrorInfoFfdcSize($ffdc); \\\n";
+ $eiEntryCount++;
+ }
+
+ # Buffers, looks a lot like local ffdc
+ foreach my $buffer (@{$err->{buffer}})
+ {
+ # Set the FFDC ID value in a global hash. The name is <rc>_<ffdc>
+ my $bufferName = $err->{rc} . "_";
+ $bufferName = $bufferName . $buffer;
+ setFfdcIdValue($bufferName);
+
+ # Add the FFDC data to the EI Object array if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $buffer);
+
+ # Add a method to the ffdc-gathering class - one for each buffer type
+ addFfdcMethod(\%methods, $buffer, lc($err->{rc}), $buffer_ffdc_type);
+ addFfdcMethod(\%methods, $buffer, lc($err->{rc}), $variable_buffer_ffdc_type);
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$bufferName; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi2::getErrorInfoFfdcSize($buffer); \\\n";
+ $eiEntryCount++;
+ }
+
+ # Procedure/Target/Bus/Child callouts
+ foreach my $callout (@{$err->{callout}})
+ {
+ if (! exists $callout->{priority})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Callout priority missing\n");
+ exit(1);
+ }
+
+ my $elementsFound = 0;
+ if (exists $callout->{hw})
+ {
+ # HW Callout
+ if (! exists $callout->{hw}->{hwid})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. HW Callout hwid missing\n");
+ exit(1);
+ }
+
+ # Check that those HW callouts that need reference targets have them
+ if (($callout->{hw}->{hwid} eq "TOD_CLOCK") ||
+ ($callout->{hw}->{hwid} eq "MEM_REF_CLOCK") ||
+ ($callout->{hw}->{hwid} eq "PROC_REF_CLOCK") ||
+ ($callout->{hw}->{hwid} eq "PCI_REF_CLOCK"))
+ {
+ if (! exists $callout->{hw}->{refTarget})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Callout missing refTarget\n");
+ exit(1);
+ }
+ }
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_HW_CALLOUT; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_hw = fapi2::HwCallouts::$callout->{hw}->{hwid}; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ if (exists $callout->{hw}->{refTarget})
+ {
+ # Add the Targets to the objectlist if they don't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $callout->{hw}->{refTarget});
+ $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n";
+
+ # Add a method to the ffdc-gathering class
+ addFfdcMethod(\%methods, $callout->{hw}->{refTarget}, lc($err->{rc}));
+ }
+ else
+ {
+ $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = 0xff; \\\n";
+ }
+ $eiEntryCount++;
+ $elementsFound++;
+ }
+ if (exists $callout->{procedure})
+ {
+ # Procedure Callout
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_PROCEDURE_CALLOUT; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_procedure = fapi2::ProcedureCallouts::$callout->{procedure}; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ $eiEntryCount++;
+ $elementsFound++;
+ }
+ if (exists $callout->{bus})
+ {
+ # A Bus Callout consists of two targets separated by
+ # commas/spaces
+ my @targets = split(/\s*,\s*|\s+/, $callout->{bus});
+
+ if (scalar @targets != 2)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. did not find two targets in bus callout\n");
+ exit(1);
+ }
+
+ # Check the type of the Targets
+ print EIFILE "fapi2::checkType<const $target_ffdc_type *>($targets[0]); \\\n";
+ print EIFILE "fapi2::checkType<const $target_ffdc_type *>($targets[1]); \\\n";
+
+ # Add the Targets to the objectlist if they don't already exist
+ my $objNum1 = addEntryToArray(\@eiObjects, $targets[0]);
+
+ my $objNum2 = addEntryToArray(\@eiObjects, $targets[1]);
+
+ # Add a method to the ffdc-gathering class
+ addFfdcMethod(\%methods, $targets[0], lc($err->{rc}), $target_ffdc_type);
+ addFfdcMethod(\%methods, $targets[1], lc($err->{rc}), $target_ffdc_type);
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_BUS_CALLOUT; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint1ObjIndex = $objNum1; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint2ObjIndex = $objNum2; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ $eiEntryCount++;
+ $elementsFound++;
+ }
+ if (exists $callout->{target})
+ {
+ # Add the Target to cdgTargetHash to be processed with any
+ # deconfigure and GARD requests
+ $cdgTargetHash{$callout->{target}}{callout} = 1;
+ $cdgTargetHash{$callout->{target}}{priority} =
+ $callout->{priority};
+
+ $elementsFound++;
+ }
+ if (exists $callout->{childTargets})
+ {
+ # Check that the parent and childType subelements exist
+ if (! exists $callout->{childTargets}->{parent})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child Callout parent missing\n");
+ exit(1);
+ }
+
+ if (! exists $callout->{childTargets}->{childType})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child Callout childType missing\n");
+ exit(1);
+ }
+
+ # Add the child info to cdgChildHash to be processed with
+ # any deconfigure and GARD requests
+ my $parent = $callout->{childTargets}->{parent};
+ my $childType = $callout->{childTargets}->{childType};
+ $cdgChildHash{$parent}{$childType}{callout} = 1;
+ $cdgChildHash{$parent}{$childType}{priority} =
+ $callout->{priority};
+
+ $elementsFound++;
+
+ if (exists $callout->{childTargets}->{childPort})
+ {
+ my $childPort = $callout->{childTargets}->{childPort};
+
+ $cdgChildHash{$parent}{$childType}{childPort} = $childPort;
+ }
+
+ if (exists $callout->{childTargets}->{childNumber})
+ {
+ my $childNum = $callout->{childTargets}->{childNumber};
+ $cdgChildHash{$parent}{$childType}{childNumber} = $childNum;
+ }
+
+ }
+ if ($elementsFound == 0)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Callout incomplete\n");
+ exit(1);
+ }
+ elsif ($elementsFound > 1)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Callout has multiple elements\n");
+ exit(1);
+ }
+ } # callout
+
+ # Target/Child deconfigures
+ foreach my $deconfigure (@{$err->{deconfigure}})
+ {
+ my $elementsFound = 0;
+ if (exists $deconfigure->{target})
+ {
+ # Add the Target to cdgTargetHash to be processed with any
+ # callout and GARD requests
+ $cdgTargetHash{$deconfigure->{target}}{deconf} = 1;
+ $elementsFound++;
+ }
+ if (exists $deconfigure->{childTargets})
+ {
+ # Check that the parent and childType subelements exist
+ if (! exists $deconfigure->{childTargets}->{parent})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child Deconfigure parent missing\n");
+ exit(1);
+ }
+ if (! exists $deconfigure->{childTargets}->{childType})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child Deconfigure childType missing\n");
+ exit(1);
+ }
+
+ # Add the child info to cdgChildHash to be processed with
+ # any callout and GARD requests
+ my $parent = $deconfigure->{childTargets}->{parent};
+ my $childType = $deconfigure->{childTargets}->{childType};
+ $cdgChildHash{$parent}{$childType}{deconf} = 1;
+
+ $elementsFound++;
+
+ if ( exists $deconfigure->{childTargets}->{childPort})
+ {
+ my $childPort = $deconfigure->{childTargets}->{childPort};
+
+ $cdgChildHash{$parent}{$childType}{childPort} = $childPort;
+ }
+
+ if ( exists $deconfigure->{childTargets}->{childNumber})
+ {
+ my $childNum = $deconfigure->{childTargets}->{childNumber};
+ $cdgChildHash{$parent}{$childType}{childNumber} = $childNum;
+
+ }
+ }
+ if ($elementsFound == 0)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Deconfigure incomplete\n");
+ exit(1);
+ }
+ elsif ($elementsFound > 1)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Deconfigure has multiple elements\n");
+ exit(1);
+ }
+ } # deconfigure
+
+ # Target/Child Gards
+ foreach my $gard (@{$err->{gard}})
+ {
+ my $elementsFound = 0;
+ if (exists $gard->{target})
+ {
+ # Add the Target to cdgTargetHash to be processed with any
+ # callout and deconfigure requests
+ $cdgTargetHash{$gard->{target}}{gard} = 1;
+ $elementsFound++;
+ }
+ if (exists $gard->{childTargets})
+ {
+ # Check that the parent and childType subelements exist
+ if (! exists $gard->{childTargets}->{parent})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child GARD parent missing\n");
+ exit(1);
+ }
+ if (! exists $gard->{childTargets}->{childType})
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. Child GARD childType missing\n");
+ exit(1);
+ }
+
+ # Add the child info to cdgChildHash to be processed with
+ # any callout and deconfigure requests
+ my $parent = $gard->{childTargets}->{parent};
+ my $childType = $gard->{childTargets}->{childType};
+ $cdgChildHash{$parent}{$childType}{gard} = 1;
+
+ $elementsFound++;
+
+ if ( exists $gard->{childTargets}->{childPort})
+ {
+ my $childPort = $gard->{childTargets}->{childPort};
+
+ $cdgChildHash{$parent}{$childType}{childPort} = $childPort;
+
+ }
+
+ if ( exists $gard->{childTargets}->{childNumber})
+ {
+ my $childNum = $gard->{childTargets}->{childNumber};
+ $cdgChildHash{$parent}{$childType}{childNumber} = $childNum;
+ }
+ }
+ if ($elementsFound == 0)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. GARD incomplete\n");
+ exit(1);
+ }
+ elsif ($elementsFound > 1)
+ {
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. GARD has multiple elements\n");
+ exit(1);
+ }
+ } # gard
+
+ # Process the callout, deconfigures and GARDs for each Target
+ foreach my $cdg (keys %cdgTargetHash)
+ {
+ # Check the type
+ print EIFILE "fapi2::checkType<const $target_ffdc_type *>($cdg); \\\n";
+
+ my $callout = 0;
+ my $priority = 'LOW';
+ my $deconf = 0;
+ my $gard = 0;
+
+ if (exists $cdgTargetHash{$cdg}->{callout})
+ {
+ $callout = 1;
+ }
+ if (exists $cdgTargetHash{$cdg}->{priority})
+ {
+ $priority = $cdgTargetHash{$cdg}->{priority};
+ }
+ if (exists $cdgTargetHash{$cdg}->{deconf})
+ {
+ $deconf = 1;
+ }
+ if (exists $cdgTargetHash{$cdg}->{gard})
+ {
+ $gard = 1;
+ }
+
+ # Add the Target to the objectlist if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $cdg);
+
+ # Add a method to the ffdc-gathering class
+ addFfdcMethod(\%methods, $cdg, lc($err->{rc}), $target_ffdc_type);
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CDG; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_targetObjIndex = $objNum; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_callout = $callout; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_deconfigure = $deconf; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_gard = $gard; \\\n";
+ $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
+ $eiEntryCount++;
+ }
+
+ # Process the callout, deconfigures and GARDs for Child Targets
+ foreach my $parent (keys %cdgChildHash)
+ {
+ # Check the type
+ print EIFILE "fapi2::checkType<const $target_ffdc_type *>($parent); \\\n";
+
+ foreach my $childType (keys %{$cdgChildHash{$parent}})
+ {
+ my $callout = 0;
+ my $priority = 'LOW';
+ my $deconf = 0;
+ my $gard = 0;
+ my $childPort = 0xFF;
+ my $childNumber = 0xFF;
+
+ if (exists $cdgChildHash{$parent}{$childType}->{callout})
+ {
+ $callout = 1;
+ }
+ if (exists $cdgChildHash{$parent}->{$childType}->{priority})
+ {
+ $priority =
+ $cdgChildHash{$parent}->{$childType}->{priority};
+ }
+ if (exists $cdgChildHash{$parent}->{$childType}->{deconf})
+ {
+ $deconf = 1;
+ }
+ if (exists $cdgChildHash{$parent}->{$childType}->{childPort})
+ {
+ $childPort =
+ $cdgChildHash{$parent}->{$childType}->{childPort} ;
+ addFfdcMethod(\%methods, $childPort, lc($err->{rc}));
+ }
+ if (exists $cdgChildHash{$parent}->{$childType}->{childNumber})
+ {
+ $childNumber =
+ $cdgChildHash{$parent}->{$childType}->{childNumber} ;
+ addFfdcMethod(\%methods, $childNumber, lc($err->{rc}));
+ }
+ if (exists $cdgChildHash{$parent}->{$childType}->{gard})
+ {
+ $gard = 1;
+ }
+
+
+ # Add the Target to the objectlist if it doesn't already exist
+ my $objNum = addEntryToArray(\@eiObjects, $parent);
+ addFfdcMethod(\%methods, $parent, lc($err->{rc}), $target_ffdc_type);
+
+ # Add an EI entry to eiEntryStr
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CHILDREN_CDG; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_parentObjIndex = $objNum; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_callout = $callout; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_deconfigure = $deconf; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_childType = fapi2::$childType; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_childPort = $childPort; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_childNumber = $childNumber; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_gard = $gard; \\\n";
+ $eiEntryStr .=
+ " l_entries[$eiEntryCount].children_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
+ $eiEntryCount++;
+ }
+ }
+
+ # Add all objects to $eiObjectStr
+ my $objCount = 0;
+
+ foreach my $eiObject (@eiObjects)
+ {
+ if ($objCount > 0)
+ {
+ $eiObjectStr .= ", ";
+ }
+
+ if ($mangle_names{$eiObject} eq undef)
+ {
+ $eiObjectStr .= "$eiObject"
+ }
+ else
+ {
+ $eiObjectStr .= $mangle_names{$eiObject};
+ }
+
+ $objCount++;
+ }
+ $eiObjectStr .= "};";
+
+ # Print info to file
+ if ($eiEntryCount > 0)
+ {
+ print EIFILE "\\\n{ \\\n $eiObjectStr \\\n";
+ print EIFILE " fapi2::ErrorInfoEntry l_entries[$eiEntryCount]; \\\n";
+ print EIFILE "$eiEntryStr";
+ print EIFILE " RC.addErrorInfo(l_objects, l_entries, $eiEntryCount); \\\n}";
+ }
+
+ print EIFILE "\n";
+
+ #----------------------------------------------------------------------
+ # Print the return code class to hwp_error_info.H
+ #----------------------------------------------------------------------
+ # Remove the repeated whitespace and newlines other characters from the description
+ $err->{description} =~ s/^\s+|\s+$|"//g;
+ $err->{description} =~ tr{\n}{ };
+ $err->{description} =~ s/\h+/ /g;
+
+ #----------------------------------------------------------------------
+ # Print the return code class to hwp_error_info.H
+ #----------------------------------------------------------------------
+ my $class_name = lc($err->{rc});
+
+ # Class declaration
+ print ECFILE "\nclass $class_name\n{\n public:\n";
+
+ # Constructor. This traces the description. If this is too much, we can
+ # remove it.
+ if ($arg_empty_ffdc eq undef)
+ {
+ print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err):\n";
+ print ECFILE " iv_rc(i_rc),\n";
+ print ECFILE " iv_sev(i_sev)\n";
+ print ECFILE " { FAPI_ERR(\"$err->{description}\"); }\n";
+ }
+ else
+ {
+ print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err)\n";
+ print ECFILE " {}\n";
+ }
+
+ # Methods
+ foreach my $key (keys %methods)
+ {
+ print ECFILE $methods{$key}{method};
+ }
+
+ # Stick the execute method at the end of the other methods.
+ print ECFILE " void execute(void)\n";
+ print ECFILE " {\n";
+ print ECFILE " FAPI_SET_HWP_ERROR(iv_rc, $err->{rc});\n" if ($arg_empty_ffdc eq undef);
+ print ECFILE " fapi2::logError(iv_rc, iv_sev);\n" if ($arg_empty_ffdc eq undef);
+ print ECFILE " }\n\n";
+
+ # Instance variables
+ if ($arg_empty_ffdc eq undef)
+ {
+ print ECFILE " private:\n ";
+ foreach my $key (keys %methods)
+ {
+ print ECFILE $methods{$key}{member};
+ }
+
+ print ECFILE "fapi2::ReturnCode& iv_rc;\n";
+ print ECFILE " fapi2::errlSeverity_t iv_sev;\n";
+ }
+
+ print ECFILE "};\n\n\n\n";
+ }
+
+ #--------------------------------------------------------------------------
+ # For each registerFfdc.
+ #--------------------------------------------------------------------------
+ foreach my $registerFfdc (@{$errors->{registerFfdc}})
+ {
+ #----------------------------------------------------------------------
+ # Check that expected fields are present
+ #----------------------------------------------------------------------
+ if (! exists $registerFfdc->{id}[0])
+ {
+ print ("parseErrorInfo.pl ERROR. id missing from registerFfdc\n");
+ exit(1);
+ }
+
+ if (scalar @{$registerFfdc->{id}} > 1)
+ {
+ print ("parseErrorInfo.pl ERROR. multiple ids in registerFfdc\n");
+ exit(1);
+ }
+
+ #----------------------------------------------------------------------
+ # Set the FFDC ID value in a global hash
+ #----------------------------------------------------------------------
+ setFfdcIdValue($registerFfdc->{id}[0]);
+
+ #----------------------------------------------------------------------
+ # Generate code to capture the registers in collect_reg_ffdc.C
+ #----------------------------------------------------------------------
+ print CRFILE " case $registerFfdc->{id}[0]:\n";
+
+=begin NEED_P9_REGISTERS
+ # Look for CFAM Register addresses
+ foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}})
+ {
+ print CRFILE " l_cfamAddresses.push_back($cfamRegister);\n";
+ print CRFILE " l_ffdcSize += sizeof(l_cfamData);\n";
+ }
+
+ # Look for SCOM Register addresses
+ foreach my $scomRegister (@{$registerFfdc->{scomRegister}})
+ {
+ print CRFILE " l_scomAddresses.push_back($scomRegister);\n";
+ print CRFILE " l_ffdcSize += sizeof(l_scomData);\n";
+ }
+=cut NEED_P9_REGISTERS
+
+ print CRFILE " break;\n";
+ }
+
+}
+
+#------------------------------------------------------------------------------
+# Print end of file information to collect_reg_ffdc.C
+#------------------------------------------------------------------------------
+print CRFILE " default:\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Invalid FFDC ID 0x%x\", ";
+print CRFILE "i_ffdcId);\n";
+print CRFILE " return;\n";
+print CRFILE " }\n\n";
+
+=begin NEED_P9_REGISTERS
+
+print CRFILE " uint8_t * l_pBuf = NULL;\n";
+print CRFILE " uint8_t * l_pData = NULL;\n";
+print CRFILE " std::vector<fapi::Target> l_targets;\n";
+print CRFILE " uint32_t l_chipletPos32 = 0;\n";
+#---------------------------------------------------------------------------------------------------------
+# Populate chiplet vectors (if required by register collection method) and adjust buffer sizes accordingly
+#---------------------------------------------------------------------------------------------------------
+print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_child)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_child, l_targets, TARGET_STATE_FUNCTIONAL);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n";
+print CRFILE " return;\n";
+print CRFILE " }\n";
+print CRFILE " if (l_targets.empty())\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_INF(\"collect_reg_ffdc.C: Error: No functional chiplets found. \");\n";
+print CRFILE " return;\n";
+print CRFILE " }\n";
+print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
+print CRFILE " l_ffdcSize *= l_targets.size();\n";
+print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
+print CRFILE " l_pData = l_pBuf;\n";
+print CRFILE " }\n";
+print CRFILE " else if (fapi2::TARGET_TYPE_NONE != i_presChild)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_presChild, l_targets, TARGET_STATE_PRESENT);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n";
+print CRFILE " return;\n";
+print CRFILE " }\n";
+print CRFILE " if (l_targets.empty())\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_INF(\"collect_reg_ffdc.C: Error: No functional chiplets found. \");\n";
+print CRFILE " return;\n";
+print CRFILE " }\n";
+print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
+print CRFILE " l_ffdcSize *= l_targets.size();\n";
+print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
+print CRFILE " l_pData = l_pBuf;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
+print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
+print CRFILE " l_pData = l_pBuf;\n";
+print CRFILE " l_targets.push_back(i_target);\n";
+print CRFILE " }\n\n";
+#---------------------------------------------------------------------------------------------------------
+# Obtain target position and insert as the first word in the buffer
+#---------------------------------------------------------------------------------------------------------
+print CRFILE " bool l_targIsChiplet = i_target.isChiplet();\n\n";
+print CRFILE " for (std::vector<fapi::Target>::const_iterator targetIter = l_targets.begin();\n";
+print CRFILE " targetIter != l_targets.end(); ++targetIter)\n";
+print CRFILE " {\n";
+print CRFILE " if ((fapi2::TARGET_TYPE_NONE != i_child) ||\n";
+print CRFILE " (fapi2::TARGET_TYPE_NONE != i_presChild) ||\n";
+print CRFILE " (true == l_targIsChiplet))\n";
+print CRFILE " {\n";
+print CRFILE " uint8_t l_chipletPos = 0;\n";
+print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &(*targetIter), l_chipletPos);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error getting chiplet position\");\n";
+print CRFILE " l_chipletPos = 0xFF;\n";
+print CRFILE " }\n";
+ #-------------------------------------------------------------------------
+ # We print the target's position in the error log whether the target is a
+ # chip or chiplet, so we need to store the chiplet position in a uint32_t
+ # to have consitency in the buffer as ATTR_POS below returns a uint32_t
+ #-------------------------------------------------------------------------
+print CRFILE " l_chipletPos32 = l_chipletPos;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_POS, &(*targetIter), l_chipletPos32);\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error getting chip position\");\n";
+print CRFILE " l_chipletPos32 = 0xFFFFFFFF;\n";
+print CRFILE " }\n";
+print CRFILE " }\n";
+print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_chipletPos32;\n";
+print CRFILE " l_pData += sizeof(l_chipletPos32);\n";
+#---------------------------------------------------------------------------------------------------------
+# Instert cfam data (if any) related to this chip / chiplet into the buffer
+# If collecting FFDC based on present children, adjust the register address by the appropriate offset
+#---------------------------------------------------------------------------------------------------------
+print CRFILE " for (std::vector<uint32_t>::const_iterator cfamIter = l_cfamAddresses.begin();\n";
+print CRFILE " cfamIter != l_cfamAddresses.end(); ++cfamIter)\n";
+print CRFILE " {\n";
+print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_presChild)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetCfamRegister(i_target, (*cfamIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetCfamRegister(*targetIter, *cfamIter, l_buf);\n";
+print CRFILE " }\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: CFAM error for 0x%x\",";
+print CRFILE "*cfamIter);\n";
+print CRFILE " l_cfamData = 0xbaddbadd;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_cfamData = l_buf.getWord(0);\n";
+print CRFILE " }\n";
+print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_cfamData;\n";
+print CRFILE " l_pData += sizeof(l_cfamData);\n";
+print CRFILE " }\n\n";
+#---------------------------------------------------------------------------------------------------------
+# Instert any scom data (if any) related to this chip / chiplet into the buffer
+# If collecting FFDC based on present children, adjust the register address by the appropriate offset
+#---------------------------------------------------------------------------------------------------------
+print CRFILE " for (std::vector<uint64_t>::const_iterator scomIter = l_scomAddresses.begin();\n";
+print CRFILE " scomIter != l_scomAddresses.end(); ++scomIter)\n";
+print CRFILE " {\n";
+print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_presChild)\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetScom(i_target, (*scomIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_rc = fapiGetScom(*targetIter, *scomIter, l_buf);\n";
+print CRFILE " }\n";
+print CRFILE " if (l_rc)\n";
+print CRFILE " {\n";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: SCOM error for 0x%llx\",";
+print CRFILE "*scomIter);\n";
+print CRFILE " l_scomData = 0xbaddbaddbaddbaddULL;\n";
+print CRFILE " }\n";
+print CRFILE " else\n";
+print CRFILE " {\n";
+print CRFILE " l_scomData = l_buf.getDoubleWord(0);\n";
+print CRFILE " }\n";
+print CRFILE " *(reinterpret_cast<uint64_t *>(l_pData)) = l_scomData;\n";
+print CRFILE " l_pData += sizeof(l_scomData);\n";
+print CRFILE " }\n";
+print CRFILE " }\n\n";
+print CRFILE " o_rc.addEIFfdc(i_ffdcId, l_pBuf, l_ffdcSize);\n";
+print CRFILE " delete [] l_pBuf;\n";
+=cut NEED_P9_REGISTERS
+
+print CRFILE "}\n";
+print CRFILE "}\n";
+
+
+#------------------------------------------------------------------------------
+# Print the fapiHwpReturnCodes.H file
+#------------------------------------------------------------------------------
+print RCFILE "// fapiHwpReturnCodes.H\n";
+print RCFILE "// This file is generated by perl script parseErrorInfo.pl\n\n";
+print RCFILE "#ifndef FAPI2_HWPRETURNCODES_H_\n";
+print RCFILE "#define FAPI2_HWPRETURNCODES_H_\n\n";
+print RCFILE "#ifndef __ASSEMBLER__\n";
+print RCFILE "namespace fapi2\n";
+print RCFILE "{\n\n";
+print RCFILE "/**\n";
+print RCFILE " * \@brief Enumeration of HWP return codes\n";
+print RCFILE " *\/\n";
+print RCFILE "enum HwpReturnCode\n";
+print RCFILE "{\n";
+foreach my $key (keys %errNameToValueHash)
+{
+ print RCFILE " $key = 0x$errNameToValueHash{$key},\n";
+}
+print RCFILE "};\n\n";
+print RCFILE "}\n\n";
+print RCFILE "#else\n";
+foreach my $key (keys %errNameToValueHash)
+{
+ print RCFILE " .set $key, 0x$errNameToValueHash{$key}\n";
+}
+print RCFILE "#endif\n";
+print RCFILE "#endif\n";
+
+#------------------------------------------------------------------------------
+# Print the HwpFfdcId enumeration to hwp_error_info.H
+#------------------------------------------------------------------------------
+print EIFILE "namespace fapi2\n";
+print EIFILE "{\n\n";
+print EIFILE "/**\n";
+print EIFILE " * \@brief Enumeration of FFDC identifiers\n";
+print EIFILE " *\/\n";
+print EIFILE "enum HwpFfdcId\n";
+print EIFILE "{\n";
+foreach my $key (keys %ffdcNameToValueHash)
+{
+ print EIFILE " $key = 0x$ffdcNameToValueHash{$key},\n";
+}
+print EIFILE "};\n\n";
+print EIFILE "}\n\n";
+
+#------------------------------------------------------------------------------
+# Print end of file information to hwp_error_info.H
+#------------------------------------------------------------------------------
+print EIFILE "\n\n#endif\n";
+
+#------------------------------------------------------------------------------
+# Print end of file information to hwp_ffdc_classes.H
+#------------------------------------------------------------------------------
+print ECFILE "\n};\n"; # close the namespace
+print ECFILE "\n\n#endif\n";
+
+#------------------------------------------------------------------------------
+# Print end of file information to set_sbe_error.H
+#------------------------------------------------------------------------------
+print SBFILE " default:\\\n";
+print SBFILE " FAPI_SET_HWP_ERROR(RC, RC_SBE_UNKNOWN_ERROR);\\\n";
+print SBFILE " break;\\\n";
+print SBFILE "}\\\n";
+print SBFILE "}\n\n";
+print SBFILE "#endif\n";
+
+#------------------------------------------------------------------------------
+# Close output files
+#------------------------------------------------------------------------------
+close(RCFILE);
+close(EIFILE);
+close(ECFILE);
+close(CRFILE);
+close(SBFILE);
diff --git a/hwpf/fapi/xml/buffer_errors.xml b/hwpf/fapi/xml/buffer_errors.xml
new file mode 100755
index 00000000..b03b77e4
--- /dev/null
+++ b/hwpf/fapi/xml/buffer_errors.xml
@@ -0,0 +1,40 @@
+<!-- IBM_PROLOG_BEGIN_TAG -->
+<!-- This is an automatically generated prolog. -->
+<!-- -->
+<!-- $Source: src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml $ -->
+<!-- -->
+<!-- OpenPOWER HostBoot Project -->
+<!-- -->
+<!-- Contributors Listed Below - COPYRIGHT 2012,2015 -->
+<!-- [+] 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 -->
+
+<hwpErrors>
+
+ <hwpError>
+ <rc>RC_FAPI2_BUFFER</rc>
+ <description>
+ fapi2 error from a buffer operation
+ </description>
+ <buffer>BUFFER</buffer>
+ <callout>
+ <procedure>CODE</procedure>
+ <priority>HIGH</priority>
+ </callout>
+ </hwpError>
+
+</hwpErrors>
diff --git a/hwpf/plat/.empty b/hwpf/plat/.empty
index e69de29b..e69de29b 100644..100755
--- a/hwpf/plat/.empty
+++ b/hwpf/plat/.empty
diff --git a/hwpf/plat/include/array.H b/hwpf/plat/include/array.H
new file mode 100644
index 00000000..1b976f2b
--- /dev/null
+++ b/hwpf/plat/include/array.H
@@ -0,0 +1,174 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file array.H
+ * @brief definitions for fapi2 arrays
+ */
+
+#ifndef __FAPI2_ARRAY__
+#define __FAPI2_ARRAY__
+
+#include <stdint.h>
+#include <utility>
+#include <assert.h>
+#include <string.h>
+
+namespace fapi2
+{
+ ///
+ /// @brief Class representing a FAPI2 array
+ /// FAPI2 arrays are defined to be very lightweight but support
+ /// c++ container operations (iterators, bounds checking, assignment, etc.)
+ /// To avoid the code-bloat associated with std::vector templates,
+ /// fapi2::array is presently limited to 64-bit elements.
+ ///
+ /// To construct an array, you can either pass in an existing chunk
+ /// of memory, or let the container allocate memory for you:
+ /// fapi2::array foo(3, &PIB_MEM_BLOCK);
+ /// creates an array 3 x uit64_t in size, located at &PIB_MEM_BLOCK.
+ /// The memory pointed to by the address passed in is untouched
+ /// during creation. This allows for a light-weight overlay on top
+ /// of existing memory. It also means you need to initialize the space
+ /// yourself.
+ /// fapi2_array foo(3);
+ /// creates an array 3 x uint64_t in size, and that memory will be
+ /// allocated by the constructor and initiaized to 0's.
+ ///
+ ///
+ class array
+ {
+ public:
+
+ typedef uint64_t element_type;
+ typedef element_type* iterator;
+ typedef const element_type* const_iterator;
+
+ ///
+ /// @brief Create an array
+ /// @param[in] the size of the array
+ /// @param[in] a pointer to memory of appropriate size
+ /// defaults to nullptr which causes the platform to
+ /// allocate memory of size * element_type
+ /// @warning fapi2::arrays, like arrays, can not be re-sized after
+ /// creation.
+ ///
+ array(const uint32_t i_size, element_type* i_data = nullptr);
+
+ ///
+ /// @brief Destroy an array
+ ///
+ ~array(void);
+
+ ///
+ /// @brief operator[]
+ /// @param[in] the index of the element
+ /// @return a reference to the element in question.
+ /// @note array[0] = 0 works as well as foo = array[0]
+ ///
+ element_type& operator[](const uint32_t i_index);
+
+ ///
+ /// @brief operator=()
+ /// @param[in] the other array
+ /// @return a reference to this, after the assignement
+ ///
+ array& operator=(const array& i_other);
+
+ ///
+ /// @brief move operator=()
+ /// @note To use: new_array = std::move(old_array). old_array will be
+ /// destroyed and no copy will be made (moved)
+ ///
+ array& operator=(array&& i_other);
+
+ ///
+ /// @brief operator==()
+ ///
+ bool operator==(const array& i_other);
+
+ ///
+ /// @brief operator!=()
+ ///
+ __attribute__ ((always_inline))
+ bool operator!=(const array& i_other)
+ { return ! operator==(i_other); }
+
+ ///
+ /// @brief Return an iterator the to beginning of the array
+ /// @return An iterator to the beginning of the array
+ ///
+ __attribute__ ((always_inline))
+ iterator begin(void)
+ { return iv_data; }
+
+ ///
+ /// @brief Return an iterator the to end of the array
+ /// @return An iterator to the end of the array
+ ///
+ __attribute__ ((always_inline))
+ iterator end(void)
+ { return iv_data + size(); }
+
+ ///
+ /// @brief Return a const_iterator the to beginning of the array
+ /// @return A const_iterator to the beginning of the array
+ ///
+ __attribute__ ((always_inline))
+ const_iterator begin(void) const
+ { return iv_data; }
+
+ ///
+ /// @brief Return a const_iterator the to end of the array
+ /// @return A const_iterator to the end the array
+ ///
+ __attribute__ ((always_inline))
+ const_iterator end(void) const
+ { return iv_data + size(); }
+
+ private:
+
+ enum
+ {
+ // Bit in iv_size representing whether we delete in the dtor
+ delete_bit = 0x80000000,
+
+ // The resulting size limit
+ size_limit = 0x7FFFFFFF,
+ };
+
+ __attribute__ ((always_inline))
+ uint32_t size(void)
+ { return (iv_size & ~delete_bit); }
+
+ __attribute__ ((always_inline))
+ uint32_t size(void) const
+ { return (iv_size & ~delete_bit); }
+
+ uint32_t iv_size;
+ element_type* iv_data;
+ };
+}
+
+#endif
diff --git a/hwpf/plat/include/buffer.H b/hwpf/plat/include/buffer.H
new file mode 100644
index 00000000..382b9642
--- /dev/null
+++ b/hwpf/plat/include/buffer.H
@@ -0,0 +1,423 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer.H
+ * @brief definitions for fapi2 variable integral buffers
+ */
+
+#ifndef __FAPI2_INTEGRAL_BUFFER__
+#define __FAPI2_INTEGRAL_BUFFER__
+
+#include <buffer_base.H>
+#include <return_code.H>
+
+namespace fapi2
+{
+ /// @brief Class representing a FAPI buffer<T>
+ /// @note Buffers support method chaining. So, rather than
+ /// this
+ /// @code
+ /// buffer<T> mask;
+ /// mask.setBit<B>();
+ /// mask.invert();
+ /// my_buffer &= mask;
+ /// @endcode
+ /// You can do
+ /// @code
+ /// my_buffer &= buffer<T>().setBit<B>.invert();
+ /// @endcode
+ template <typename T>
+ class buffer : public buffer_base<T>
+ {
+ public:
+ /// Shortcut typedef to map to our traits class
+ typedef typename buffer_base<T, buffer>::bits_type bits_type;
+
+ ///
+ /// @brief Integral buffer assignment constructor
+ /// @param[in] i_value initial value of the buffer
+ /// Meaningless for variable types and thus protected.
+ ///
+ inline buffer(T i_value = 0)
+ {
+ // Why not an initializer list? That would force buffer_base<T>
+ // to have a ctor which took a T, and I want to avoid that in
+ // the generic case: this makes it more clear that the two
+ // ctor's (integral and container) behave very differently.
+ // variable_buffers also have a ctor which takes a single
+ // numerical value, and that represents a bit count, not an
+ // initial value.
+ this->iv_data = i_value;
+ }
+
+
+ /// @name Bit/Word Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Return the length of the buffer in bits
+ /// @return Length in bits
+ ///
+ inline constexpr uint32_t getBitLength(void) const
+ { return bufferTraits<T>::bit_length(this->iv_data); }
+
+ ///
+ /// @brief Return the length of the buffer in OT units
+ /// @return Length in OT units rounded up
+ /// @tparam OT the type to get the length of. For example, if one
+ /// wanted the length in double words, OT would be uint64_t
+ /// (getLength<uint64_t>().) Similarly, to get the length in words,
+ /// getLength<uin32_t>().
+ ///
+ template< typename OT >
+ inline constexpr uint32_t getLength(void) const
+ {
+ return bufferTraits<T>::template size<OT>(this->iv_data);
+ }
+
+ ///
+ /// @brief Templated setBit for integral types
+ /// @tparam B the bit number to set.
+ /// @return buffer& Useful for method chaining
+ /// @note 0 is left-most
+ /// @note Example: fapi2::buffer<uint64_t>().setBit<3>();
+ ///
+ template <bits_type B>
+ inline buffer& setBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ // Force iv_data to be dependent on the template type to force
+ // its look up in the second phase
+ this->iv_data |= (static_cast<T>(1)) << (bufferTraits<T>::bits_per_unit - B - 1);
+ return *this;
+ }
+
+ ///
+ /// @brief Clear a bit in buffer
+ /// @tparam B Bit in buffer to clear.
+ /// @return buffer& Useful for method chaining
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline buffer& clearBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ this->iv_data &= buffer<T>().setBit<B>().invert();
+ return *this;
+ }
+
+ ///
+ /// @brief Invert bit
+ /// @tparam B Bit in buffer to invert.
+ /// @return buffer& Useful for method chaining
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline buffer& flipBit(void)
+ {
+ static_assert((B >= 0) &&
+ (B < bufferTraits<T>::bits_per_unit), "failed range check");
+
+ this->iv_data ^= buffer<T>().setBit<B>();
+ return *this;
+ }
+
+ ///
+ /// @brief Set a bit in the buffer
+ /// @param[in] i_bit the bit number to set.
+ /// @note 0 is left-most
+ /// @return FAPI2_RC_SUCCESS if OK
+ ///
+ inline fapi2::ReturnCode setBit(const bits_type& i_bit)
+ {
+ if (i_bit >= bufferTraits<T>::bits_per_unit)
+ {
+ return FAPI2_RC_INVALID_PARAMETER;
+ }
+
+ // Force iv_data to be dependent on the template type to force
+ // its look up in the second phase
+ this->iv_data |=
+ (static_cast<T>(1)) << (bufferTraits<T>::bits_per_unit - i_bit - 1);
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Get the value of a bit in the buffer
+ /// @tparam B Bit in buffer to get.
+ /// @return true if bit is on, false if bit is off
+ ///
+ template< bits_type B >
+ inline bool getBit(void) const
+ {
+ return buffer<T>().setBit<B>() & this->iv_data;
+ }
+
+ ///@}
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ // Note: Many (all?) of these are not needed and the compiler complains
+ // as the cast to T yields a better operator. There are here mainly for
+ // documenation purposes.
+
+ ///
+ /// @brief operator>>()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator>>(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator<<()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator<<(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator+()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator+(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator+=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator+=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator|=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator&=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator|(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator&(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator^=()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator^=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator~()
+ ///
+#ifdef DOXYGEN
+ buffer<T>& operator~(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator==()
+ ///
+#ifdef DOXYGEN
+ bool operator==(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator!=()
+ ///
+#ifdef DOXYGEN
+ bool operator!=(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief Copy part of a OT into the DataBuffer
+ /// @tparam TS Start bit to insert into (target start)
+ /// @tparam L Length of bits to insert
+ /// @tparam SS Start bit in source
+ /// @tparam OT the type of the incoming (origin) data
+ /// @param[in] i_datain OT value to copy into DataBuffer
+ /// - data is taken left aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, bits_type SS, typename OT>
+ inline void insert(const OT i_datain)
+ {
+ const bits_type target_length = parameterTraits<T>::bit_length;
+ const bits_type source_length = parameterTraits<OT>::bit_length;
+
+ // Error if input data don't make sense
+ static_assert((TS + L) <= target_length,
+ "insert(): (Target Start + Len) is out of bounds");
+ static_assert((SS + L) <= source_length,
+ "insert(): (Source Start + Len) is out of bounds");
+ static_assert(TS < target_length,
+ "insert(): Target Start is out of bounds");
+ static_assert(SS < source_length,
+ "insert(): Source Start is out of bounds");
+
+ // Get mask value for Target buffer
+ // Note: Need "& ((T)-1) because bit shift left for Target buffer doesn't roll off
+ T mask =((T(~0) << (target_length - L)) & T(~0)) >> TS;
+
+ // Calculate the equivalent position of the input Source start for the size of the Target buffer.
+
+ // Assume OT is smaller (sizeof(T) > sizeof(OT))
+ uint64_t sourceShift = abs(TS - ((target_length - source_length) + SS));
+ uint64_t sourceAlign = T(i_datain) << sourceShift;
+
+ if (sizeof(T) == sizeof(OT))
+ {
+ sourceShift = abs(SS - TS);
+ sourceAlign = (SS > TS) ? ((T)i_datain) << sourceShift : ((T)i_datain) >> sourceShift;
+ }
+
+ if (sizeof(T) < sizeof(OT))
+ {
+ sourceShift = source_length - target_length;
+ if (SS <= sourceShift)
+ {
+ sourceShift = sourceShift + TS - SS;
+ sourceAlign = ((OT)i_datain) >> sourceShift;
+ }
+
+ // (SS > sourceShift)
+ else
+ {
+ if (sourceShift > TS)
+ {
+ sourceShift = SS - sourceShift - TS;
+ sourceAlign = OT(i_datain) << sourceShift;
+ }
+ else
+ {
+ sourceShift = SS - sourceShift;
+ sourceAlign = (sourceShift < TS) ? OT(i_datain) >> sourceShift : OT(i_datain);
+ }
+ }
+ }
+
+ this->iv_data = (this->iv_data & ~mask) | (sourceAlign & mask);
+ return;
+ }
+
+ ///
+ /// @brief Copy in a right aligned value
+ /// @tparam SB Start bit to insert into
+ /// @tparam L Length of bits to insert
+ /// @tparam OT the type of the incoming (origin) data
+ /// @param[in] i_datain OT value to copy into DataBuffer
+ /// - data is taken right aligned
+ /// @note Data is assumed to be aligned on the word boundary of L
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, typename OT>
+ inline void insertFromRight(const OT i_datain)
+ {
+ // Error if input data don't make sense
+ static_assert(L <= parameterTraits<OT>::bit_length,
+ "insertFromRight(): Len >= input buffer");
+ static_assert(TS < parameterTraits<T>::bit_length,
+ "insertFromRight(): Target Start is out of bounds");
+ static_assert((TS + L) <= parameterTraits<T>::bit_length,
+ "InsertFromRight(): (Target Start + Len) is out of bounds");
+
+ this->insert<TS, L, parameterTraits<OT>::bit_length - L>(i_datain);
+ return;
+ }
+
+ ///
+ /// @brief Copy data from this buffer into an OT
+ /// @tparam TS Start bit to insert into (target start)
+ /// @tparam L Length of bits to insert
+ /// @tparam SS Start bit in source
+ /// @tparam OT the type of the outgoing (target)
+ /// @param[out] o_out OT to copy into - data is placed left aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template<bits_type TS, bits_type L, bits_type SS, typename OT>
+ inline void extract(OT& o_out)
+ {
+ // Extraction is just an insert into o_out
+
+ buffer<OT> out(o_out);
+ out.insert<TS, L, SS>(this->iv_data);
+ o_out = out;
+ return;
+ }
+
+#if 0
+ ///
+ /// @brief Copy data from this buffer into an OT and right justify
+ /// @tparam OT the type of the outgoing data - defaults to T
+ /// @tparam SB Start bit to insert into - defaults to 0
+ /// @tparam SS Start bit in o_out - default value is zero
+ /// @tparam L Length of bits to copy - defaults to sizeof(OT) * 8
+ /// @param[out] o_out OT to copy into - data is placed right aligned
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @post Data is copied from specified location to o_out, right
+ /// aligned. Data is only right aligned if L < sizeof(bits_type)
+ ///
+ template< typename OT = T, bits_type L = parameterTraits<OT>::bit_length,
+ bits_type SB = 0, bits_type SS = 0 >
+ void extractFromRight(OT& o_out);
+#endif
+ ///@}
+ };
+};
+
+#endif
diff --git a/hwpf/plat/include/buffer_base.H b/hwpf/plat/include/buffer_base.H
new file mode 100644
index 00000000..45297a06
--- /dev/null
+++ b/hwpf/plat/include/buffer_base.H
@@ -0,0 +1,347 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_base.H
+ * @brief definitions for fapi2 buffer base class
+ */
+
+#ifndef __FAPI2_BUFFER_BASE__
+#define __FAPI2_BUFFER_BASE__
+
+#include <stdint.h>
+#include <initializer_list>
+#include <error_scope.H>
+#include <buffer_parameters.H>
+#include <buffer_traits.H>
+#include <return_code.H>
+
+namespace fapi2
+{
+ /// @brief Base class for buffers and variable buffers
+ /// @tparam T is the type of iv_data (std::vector, etc)
+ /// @tparam TT is the template trait, defaults to the trait for T
+ ///
+ /// Buffers can be of two styles; buffers made from an integral type and
+ /// buffers made from a container. Integral type buffers, while limited
+ /// in size, can be tightly controlled via the compiler by using c++
+ /// templates.
+ ///
+ /// C++ templates allow for very explicit control, but yield a
+ /// syntax different than the FAPI 1.x functional interface. For example,
+ /// a fapi2::buffer is defined as having a type:
+ /// @code
+ /// fapi2::buffer<uint64_t> new_buffer;
+ /// @endcode
+ /// defines a buffer with exactly 64 bits, and can be manipulated by the
+ /// compiler as a single intrgral value. These implementations result
+ /// in concise instruction streams, and a platform may choose to implement
+ /// all or some or none of the integral buffer types.
+ ///
+ /// Buffers which have containers as their underlying implementation
+ /// are found in the class fapi2::variable_buffer. variable_buffer is little
+ /// more than
+ /// @code
+ /// fapi2::buffer<fapi2::bits_container>
+ /// @endcode
+ /// where bits_container is the typedef of the underlying container (a
+ /// vector of uint32_t, for example)
+ ///
+ /// Examples:<br>
+ ///
+ /// * Simple uint64_t buffer
+ /// @code
+ /// const uint32_t x = 2;
+ ///
+ /// // this data buffer will contain data in a uint64_t type
+ /// fapi2::buffer<uint64_t> data;
+ ///
+ /// // Set using the template and a constant
+ /// data.setBit<x>();
+ ///
+ /// // Set using the template and a value
+ /// data.setBit<3>();
+ ///
+ /// // Set using the function interface, and a value
+ /// data.setBit(1);
+ ///
+ /// // compiler gets smart.
+ /// // movabs $0x7000000000000000,%rsi
+ /// @endcode
+ ///
+ /// * variable_buffer, same thing
+ /// @code
+ ///
+ /// const uint32_t x = 2;
+ ///
+ /// // Note: only 15 bits long
+ /// fapi2::variable_buffer data(15);
+ ///
+ ///
+ /// data.setBit(x);
+ /// data.setBit(3);
+ /// data.setBit(1);
+ /// @endcode
+ ///
+ /// * method chaining
+ /// Buffers support method chaining. So, rather than
+ /// this
+ /// @code
+ /// buffer<T> mask;
+ /// mask.setBit<B>();
+ /// mask.invert();
+ /// my_buffer &= mask;
+ /// @endcode
+ /// You can do
+ /// @code
+ /// my_buffer &= buffer<T>().setBit<B>.invert();
+ /// @endcode
+ ///
+ /// * buffer operations
+ /// @code
+ ///
+ /// // An 8 bit buffer, initialized with a value
+ /// fapi2::buffer<uint8_t> eight_bits = 0xAA;
+ /// fapi2::buffer<uint8_t> another_eight;
+ /// fapi2::buffer<uint16_t> sixteen_bits;
+ ///
+ /// // You can't assign an 8 bit buffer to a 16 bit buffer.
+ /// sixteen_bits = eight_bits; ERROR
+ ///
+ /// // But you can assign buffers of the same type
+ /// another_eight = eight_bits;
+ ///
+ /// // You can assign constants (or other known values) directly:
+ /// sixteen_bits = 0xAABB;
+ /// @endcode
+ ///
+ /// * Variable buffer operations
+ ///
+ /// @code
+ /// fapi2::variable_buffer data(16);
+ ///
+ /// // Very large buffers can be initialized rather than set bit by bit.
+ /// const fapi2::variable_buffer bit_settings_known(
+ /// {0xFFFF0000, 0xAABBF0F0,
+ /// 0xFFFF0000, 0xAABBF0F0,
+ /// 0xFFFF0000, 0xAABBF0F0,});
+ ///
+ /// // Assignment will expand or shrink the size automatically.
+ /// data = bit_settings_known;
+ ///
+ /// // You can assign directly to the buffer:
+ /// fapi2::variable_buffer other_bits;
+ /// const fapi2::container_unit x = 0xFF00AA55;
+ /// other_bits = {x, 0xDEADBEEF};
+ /// @endcode
+ ///
+ template <typename T, typename TT = bufferTraits<T> >
+ class buffer_base
+ {
+
+ public:
+
+ /// Shortcut typedef to get to our traits class
+ typedef typename TT::bits_type bits_type;
+ /// Shortcut typedef to get to our traits class
+ typedef typename TT::unit_type unit_type;
+
+ ///
+ /// @brief Default constructor
+ /// @note iv_data will get the "default" construction, which is
+ /// correct - 0 for integral types, an empty container for the others.
+ ///
+ buffer_base(void):
+ iv_data()
+ {}
+
+// @todo doesn't work for PPE
+// virtual ~buffer_base(void)
+ ~buffer_base(void)
+ {}
+
+#ifndef DOXYGEN
+ /// @brief Print the contents of the buffer to stdout
+ inline void print(void) const
+ { TT::print(iv_data); }
+#endif
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline operator T() const { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline operator T&() { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return The contents of the buffer
+ ///
+ inline T& operator()(void) { return iv_data; }
+
+ ///
+ /// @brief Get the contents of the buffer
+ /// @return Reference to the contents of the buffer
+ ///
+ inline const T& operator()(void) const { return iv_data; }
+
+ ///
+ /// @brief Get a pointer to the buffer bits
+ /// @return Pointer to the buffer itself
+ ///
+ inline T* pointer(void) { return &iv_data; }
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Set an OT of data in buffer
+ /// @param[in] i_value sizeof(OT) bits of data
+ /// @param[in] i_offset Start OT (start word, for example) in buffer
+ /// - defaults to 0 (will by default write the left most element)
+ /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
+ /// @note This is is only available for integral types. To set a
+ /// variable_buffer into a variable_buffer, use insert()
+ ///
+ template< typename OT>
+ inline fapi2::ReturnCode set(OT i_value, const bits_type i_offset = 0)
+ {
+ // Compile time check to make sure OT isn't a variable buffer
+ static_assert( !std::is_same<bits_container, OT>::value,
+ "Can't use a variable_buffer as input to set()" );
+
+ //
+ // There's a gotcha in here. size<OT>() returns the size in the buffer
+ // in OT units *rounded up*. This is the actual size of the buffer, not
+ // the perceived size of a variable_buffer. This should be OK however,
+ // as what we're trying to prevent is overflow, which this should do.
+ //
+ const uint32_t length = TT:: template size<OT>(iv_data);
+ static const bits_type bits_in_value = parameterTraits<OT>::bit_length;
+ const bits_type bit_length = TT::bit_length(iv_data);
+
+ if (i_offset >= length)
+ {
+ return FAPI2_RC_OVERFLOW;
+ }
+
+ // Create mask if part of this byte is not in the valid part of the buffer,
+ // Shift it left by the amount of unused bits,
+ // Clear the unused bits
+ if (((i_offset + 1) == length) && (bit_length % bits_in_value)) {
+ i_value &= parameterTraits<OT>::mask << ((bits_in_value * length) - bit_length);
+ }
+
+ parameterTraits<OT>::template write_element<unit_type>(TT::get_address(iv_data), i_value, i_offset);
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Set and entire buffer to X's
+ /// @tparam X {0,1} depending if you want to clear (0)
+ /// or fill (1) a buffer
+ ///
+ template< uint8_t X >
+ inline void flush(void)
+ {
+ static_assert( (X == 1) || (X == 0), "bad argument to flush" );
+ (0 == X) ? TT::clear(iv_data) : TT::set(iv_data);
+ }
+
+ ///
+ /// @brief Invert entire buffer
+ /// @return buffer_base&, Useful for method chaining
+ ///
+ inline buffer_base& invert(void)
+ { TT::invert(iv_data); return *this; }
+
+ ///
+ /// @brief Bit reverse entire buffer
+ /// @return buffer_base&, Useful for method chaining
+ ///
+ inline buffer_base& reverse(void)
+ { TT::reverse(iv_data); return *this; }
+
+ //@}
+ protected:
+
+ ///
+ /// @brief Variable buffer constructor
+ /// @param[in] i_value number of *bits* (sizeof(container_units) * 8)
+ /// needed. Meaningless for integral types and thus protected.
+ ///
+ buffer_base(bits_type i_value);
+
+ ///
+ /// @brief Variable buffer construct from a list
+ /// @param[in] i_value an initializer list to initialize the container.
+ /// Meaningless for integral types and thus protected
+ ///
+ buffer_base(std::initializer_list<unit_type> i_value);
+
+ ///
+ /// @brief Clear the buffer
+ ///
+ inline void clear(void)
+ { TT::clear(iv_data); }
+
+ /// The contents of the buffer
+ T iv_data;
+ };
+
+// ///
+// /// @brief Set and entire buffer to X's
+// /// @tparam X {0,1} depending if you want to clear (0)
+// /// or fill (1) a buffer
+// ///
+// template< typename T, typename TT = bufferTraits<T>, uint8_t X >
+// inline buffer_base<T, TT>& flush(void)
+// {
+// static_assert( (X == 1) || (X == 0), "bad argument to flush" );
+// (0 == X) ? TT::clear(iv_data) : TT::set(iv_data);
+// return *this;
+// }
+
+
+ template <typename T, typename TT>
+ inline buffer_base<T, TT>::buffer_base(bits_type i_value):
+ iv_data( std::max(bits_type(1),
+ bits_type(i_value / 8 / sizeof(bits_type))))
+ {
+ }
+
+ template <typename T, typename TT>
+ inline buffer_base<T, TT>::buffer_base(std::initializer_list<unit_type> i_value):
+ iv_data(i_value)
+ {
+ }
+};
+
+
+
+#endif
diff --git a/hwpf/plat/include/buffer_parameters.H b/hwpf/plat/include/buffer_parameters.H
new file mode 100644
index 00000000..3dc41b26
--- /dev/null
+++ b/hwpf/plat/include/buffer_parameters.H
@@ -0,0 +1,65 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_parameters.H
+ * @brief definitions for fapi2 buffer parameter types
+ */
+
+#ifndef __FAPI2_BUFFER_PARAM__
+#define __FAPI2_BUFFER_PARAM__
+
+#include <stdint.h>
+
+namespace fapi2
+{
+ /// @cond
+ /// @brief Traits of buffer parameters - things passed in
+ /// @tparam T is the type of i_value (typically an integral type)
+ template<typename T>
+ class parameterTraits
+ {
+ public:
+ enum
+ {
+ mask = T(~0),
+ bit_length = sizeof(T) * 8,
+ byte_length = sizeof(T),
+ };
+
+ template<typename U>
+ inline static void write_element(void* i_data, T i_value, uint32_t i_offset)
+ {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ T* ptr = (T*)i_data + (i_offset ^ ((sizeof(U) / sizeof(T)) - 1));
+#else
+ T* ptr = (T*)i_data + i_offset;
+#endif
+ *ptr = i_value;
+ }
+ };
+ /// @endcond
+};
+
+#endif
diff --git a/hwpf/plat/include/buffer_traits.H b/hwpf/plat/include/buffer_traits.H
new file mode 100644
index 00000000..08073fb6
--- /dev/null
+++ b/hwpf/plat/include/buffer_traits.H
@@ -0,0 +1,238 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file buffer_traits.H
+ * @brief trait definitions for fapi2 buffer base class
+ */
+
+#ifndef __FAPI2_BUFFER_TRAITS__
+#define __FAPI2_BUFFER_TRAITS__
+
+#include <stdint.h>
+#include <vector>
+#include <algorithm>
+#include <buffer_parameters.H>
+
+#ifdef __FAPI2_DEBUG__
+// for debug printing ... can be removed for flight
+#include <iostream>
+#endif
+#include <iterator>
+
+namespace fapi2
+{
+ /// @cond
+ /// Types representing a container of bits. Used to create
+ /// variable_buffer.
+ typedef uint32_t container_unit;
+ typedef std::vector<container_unit> bits_container;
+
+ /// @brief Traits of buffers
+ // In general, we try to give buffers traits reflecting integral types. If
+ // this fails, the compiler will let someone know.
+ ///
+ /// @tparam T is the type of iv_data (std::vector, etc)
+ /// @tparam B is the type of the bit-specifier, typically uint32_t
+ template<typename T, typename B = uint32_t>
+ class bufferTraits
+ {
+ public:
+#ifndef DOXYGEN
+#ifdef __FAPI2_DEBUG__
+ ///
+ /// @brief Print a container of bits
+ /// @param[in] i_data the container of bits
+ ///
+ static inline void print(const T& i_data)
+ {
+ // convert to uint64_t to prevent uint8_t from being
+ // printed as a char.
+ std::cout << "\tdata is "
+ << std::hex
+ << static_cast<uint64_t>(i_data)
+ << std::dec << std::endl;
+ }
+#endif
+#endif
+
+ ///
+ /// @brief Return the size of the buffer in E units
+ /// @tparam E, the element size.
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in E's rounded up
+ ///
+ template<typename E>
+ constexpr static B size(const T& i_buffer)
+ {
+ return (bit_length(i_buffer) +
+ (parameterTraits<E>::bit_length - 1)) /
+ parameterTraits<E>::bit_length;
+ }
+
+ ///
+ /// @brief Return the size of the buffer itself
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in bits (not units)
+ ///
+ constexpr static B bit_length(const T&)
+ { return sizeof(T) * 8; }
+
+ ///
+ /// @brief Clear the buffer
+ /// @param[in,out] io_buffer the buffer which to clear
+ ///
+ static inline void clear(T& io_buffer)
+ { io_buffer = static_cast<T>(0); }
+
+ ///
+ /// @brief Set the buffer
+ /// @param[in,out] io_buffer the buffer which to set
+ ///
+ static inline void set(T& io_buffer)
+ { io_buffer = static_cast<T>(~0); }
+
+ ///
+ /// @brief Invert the buffer
+ /// @param[in,out] io_buffer the buffer which to invert
+ ///
+ static inline void invert(T& io_buffer)
+ { io_buffer = ~io_buffer; }
+
+ ///
+ /// @brief Reverse the buffer
+ /// @param[in,out] io_buffer the buffer which to reverse
+ ///
+ static inline void reverse(T& io_buffer)
+ {
+ io_buffer =
+ ((io_buffer & 0xAAAAAAAAAAAAAAAA) >> 1) |
+ ((io_buffer & 0x5555555555555555) << 1);
+ }
+
+ ///
+ /// @brief Get the address of the buffer as an array
+ /// @param[in] i_buffer the buffer which to invert
+ /// @return The address of the first element of the buffer
+ ///
+ static inline void* get_address(T& i_buffer)
+ { return (void*)&i_buffer; }
+
+ typedef B bits_type;
+ typedef T unit_type;
+ enum { bits_per_unit = sizeof(unit_type) * 8 };
+ };
+
+ //
+ //
+ /// @brief Traits for buffers which are a container of bits
+ //
+ //
+ template<>
+ class bufferTraits<bits_container, uint32_t>
+ {
+ public:
+#ifndef DOXYGEN
+#ifdef __FAPI2_DEBUG__
+ ///
+ /// @brief Print a container of bits
+ /// @param[in] i_data the container of bits
+ ///
+ static inline void print(const bits_container& i_data)
+ {
+ std::cout << "\tdata is " << std::hex;
+ std::copy(i_data.begin(), i_data.end(),
+ std::ostream_iterator<container_unit>(std::cout, " "));
+ std::cout << std::dec << std::endl;
+ }
+#endif
+#endif
+
+ ///
+ /// @brief Return the size of the buffer in E units
+ /// @tparam E, the element size.
+ /// @param[in] io_buffer the buffer which to size
+ /// @return The size of the buffer in E's rounded up
+ ///
+ template<typename E>
+ constexpr static uint32_t size(const bits_container& i_buffer)
+ {
+ return (bit_length(i_buffer) +
+ (parameterTraits<E>::bit_length - 1)) /
+ parameterTraits<E>::bit_length;
+ }
+
+ ///
+ /// @brief Return the size of the buffer itself
+ /// @param[in,out] io_buffer the buffer which to size
+ /// @return The size of the buffer in bits (not units)
+ ///
+ static inline uint32_t bit_length(const bits_container& i_buffer)
+ { return i_buffer.size() * sizeof(container_unit) * 8; }
+
+ ///
+ /// @brief Clear the buffer
+ /// @param[in,out] io_buffer the buffer which to clear
+ ///
+ static inline void clear(bits_container& io_buffer)
+ { io_buffer.assign(io_buffer.size(), 0); }
+
+ ///
+ /// @brief Set the buffer
+ /// @param[in,out] io_buffer the buffer which to set
+ ///
+ static inline void set(bits_container& io_buffer)
+ { io_buffer.assign(io_buffer.size(), ~0); }
+
+ ///
+ /// @brief Invert the buffer
+ /// @param[in,out] io_buffer the buffer which to invert
+ ///
+ static inline void invert(bits_container& io_buffer)
+ {
+ std::transform(io_buffer.begin(), io_buffer.end(),
+ io_buffer.begin(),
+ [](container_unit u) { return ~u; });
+ }
+
+ ///
+ /// @brief Get the address of the buffer as an array
+ /// @param[in] i_buffer the buffer which to invert
+ /// @return The address of the first element of the buffer
+ ///
+ static inline void* get_address(bits_container& i_buffer)
+ {
+ return (void*)&(i_buffer[0]);
+ }
+
+ typedef uint32_t bits_type;
+ typedef container_unit unit_type;
+ enum { bits_per_unit = sizeof(unit_type) * 8 };
+ };
+ /// @endcond
+};
+
+
+
+#endif
diff --git a/hwpf/plat/include/error_scope.H b/hwpf/plat/include/error_scope.H
new file mode 100644
index 00000000..ccd2f080
--- /dev/null
+++ b/hwpf/plat/include/error_scope.H
@@ -0,0 +1,147 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file error_scope.H
+ * @brief definitions which create a scope for automatic error handling
+ */
+
+#ifndef __FAPI2_ERROR_SCOPE__
+#define __FAPI2_ERROR_SCOPE__
+
+#include <stdint.h>
+#include <thread>
+#include <stdio.h>
+#include <return_code.H>
+#include <plat_includes.H>
+
+
+extern "C"
+{
+#ifndef __noRC__
+ extern fapi2::ReturnCode G_current_err;
+#endif
+ extern uint64_t G_pib_error_mask;
+ extern uint64_t G_operational_state;
+}
+
+
+///
+/// @brief Place holder until more of the FAPI infrastructure
+/// can be compiled with this file
+/// @param[in] ... varargs, passed to a platform specific output function
+/// @note This is skeleton implementation for prototype purposes. This
+/// does not imply "printf" is used on any or all platforms.
+///
+#define FAPI_INF( ... )
+#define FAPI_ERR( ... ) PK_TRACE( __VA_ARGS__ )
+//#define FAPI_DBG( ... ) PK_TRACE( __VA_ARGS__ )
+#define FAPI_DBG( ... )
+
+/// @cond
+#define FAPI_VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N
+#define FAPI_VA_NARGS(...) FAPI_VA_NARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
+
+//#define FAPI_TRY_IMPL2(...) FAPI_TRY_TRACE (__VA_ARGS__)
+#define FAPI_TRY_IMPL2(count, ...) FAPI_TRY ## count (__VA_ARGS__)
+#define FAPI_TRY_IMPL(count, ...) FAPI_TRY_IMPL2(count, __VA_ARGS__)
+
+#ifndef __noRC__
+#define FAPI_TRY_NO_TRACE( __operation__ ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ goto clean_up; \
+ }
+#else
+#define FAPI_TRY_NO_TRACE( __operation__ ) \
+ (__operation__);
+#endif
+
+// Why debug? Because this isn't a mechanism to gather FFDC
+// one should be using FAPI_ASSERT. However, it is nice to
+// have a conditional trace in the event of a failure in the
+// operation, so that's why this is here.
+// if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS)
+#ifndef __noRC__
+#define FAPI_TRY_TRACE( __operation__, ... ) \
+ if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \
+ { \
+ FAPI_DBG(__VA_ARGS__); \
+ goto clean_up; \
+ }
+#define FAPI_CLEANUP() \
+clean_up:
+#else
+/// @todo: something is wrong needed the goto_cleanup
+#define FAPI_TRY_TRACE( __operation__, ... ) \
+ FAPI_DBG(__VA_ARGS__); \
+ (__operation__)
+
+#define FAPI_CLEANUP()
+
+#endif
+
+#define FAPI_TRY0 FAPI_TRY_NO_TRACE
+#define FAPI_TRY1 FAPI_TRY_TRACE
+#define FAPI_TRY2 FAPI_TRY_TRACE
+#define FAPI_TRY3 FAPI_TRY_TRACE
+#define FAPI_TRY4 FAPI_TRY_TRACE
+#define FAPI_TRY5 FAPI_TRY_TRACE
+/// @endcond
+
+///
+/// @brief Wrapper to check an operation for an error state
+/// and jump to the label cleam_up if there is an error.
+/// @param[in] __operation__ an operation which returns a fapi::ReturnCode
+/// @param[in] Optional vararg format/agruments for trace output.
+/// @note This implementation does not support PIB error masks or
+/// FSP operational states.
+/// @warning The trace information is only going to be seen during
+/// debug, it's not an error or informational trace. This is because
+/// traces might not be seen in the field. If you want information
+/// you will see on a field error, use FAPI_ASSERT.
+///
+#ifdef DOXYGEN
+#define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL
+#else
+#define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__)
+#endif
+
+///
+/// @brief Assert a conditional is true.
+/// If it is not, the FFDC gathering function is called and the
+/// trace is output as a FAPI error trace.
+/// @param[in] __conditional__ the condition to assert
+/// @param[in] __ffdc__ the FFDC gathering function
+/// @param[in] ... varargs, as input to FAPI_ERR
+///
+#define FAPI_ASSERT( __conditional__, __ffdc__, ... ) \
+ if (! (__conditional__)) \
+ { \
+ /* __ffdc__; */ \
+ FAPI_ERR(__VA_ARGS__); \
+ goto clean_up; \
+ }
+
+#endif // __FAPI2_ERROR_SCOPE__
diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H
new file mode 100644
index 00000000..dcf2607b
--- /dev/null
+++ b/hwpf/plat/include/fapi2.H
@@ -0,0 +1,44 @@
+/**
+ * @file fapi2.H
+ *
+ * @brief Includes all the header files necessary for the FAPI2 interface.
+ */
+
+
+#ifndef FAPI2_H_
+#define FAPI2_H_
+
+// Define which platforms will not have FAPI Return Codes
+#undef __noRC__
+#if defined (__CME__) || defined (__SGPE__) || defined (__PGPE__)
+#define __noRC__
+#endif
+
+// Determine if running on a PPE platform
+#ifndef __PPE__
+#if defined (__SBE__) || defined (__CME__) || defined (__SGPE__) || defined (__PGPE__)
+#define __PPE__
+#endif
+#endif
+
+#include <buffer.H>
+#include <buffer_base.H>
+#include <buffer_parameters.H>
+#include <buffer_traits.H>
+#include <error_scope.H>
+#include <hw_access.H>
+#include <return_code.H>
+#include <target.H>
+#include <target_types.H>
+#include <utils.H>
+//#include <variable_buffer.H>
+#include <fapi2AttributeService.H>
+#include <fapi2AttributeIds.H> // Generated file
+
+
+#endif // FAPI2_H_
+
+
+
+
+
diff --git a/hwpf/plat/include/fapi2Structs.H b/hwpf/plat/include/fapi2Structs.H
new file mode 100644
index 00000000..48d8062e
--- /dev/null
+++ b/hwpf/plat/include/fapi2Structs.H
@@ -0,0 +1,109 @@
+#ifndef fapiStructs_h
+#define fapiStructs_h
+// Copyright **********************************************************
+//
+// File fapiStructs.H
+//
+// IBM Confidential
+// OCO Source Materials
+// 9400 Licensed Internal Code
+// (C) COPYRIGHT IBM CORP. 1996
+//
+// The source code for this program is not published or otherwise
+// divested of its trade secrets, irrespective of what has been
+// deposited with the U.S. Copyright Office.
+//
+// End Copyright ******************************************************
+
+/**
+ * @file fapiStructs.H
+ * @brief fapi eCMD Extension Structures
+
+ * Extension Owner : John Farrugia
+*/
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+#include <string>
+
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+
+#define ECMD_FAPI_CAPI_VERSION "1.0" ///< eCMD FAPI Extension version
+
+
+
+#ifndef ECMD_PERLAPI
+
+namespace fapi
+{
+
+/**
+ * @brief Enumeration of fapi file types
+ */
+typedef enum {
+ FAPI_FILE_UNKNOWN, ///< Default for not initialized
+ FAPI_FILE_HWP
+} FileType_t;
+
+
+enum AttributeSource
+{
+ FAPI_ATTRIBUTE_SOURCE_UNKNOWN = 0x00000000,
+ FAPI_ATTRIBUTE_SOURCE_PLAT = 0x00000001,
+ FAPI_ATTRIBUTE_SOURCE_HWP = 0x00000002,
+};
+
+
+#define FAPI_ATTRIBUTE_TYPE_STRING 0x80000000
+#define FAPI_ATTRIBUTE_TYPE_UINT8 0x40000000
+#define FAPI_ATTRIBUTE_TYPE_UINT32 0x20000000
+#define FAPI_ATTRIBUTE_TYPE_UINT64 0x10000000
+#define FAPI_ATTRIBUTE_TYPE_UINT8ARY 0x04000000
+#define FAPI_ATTRIBUTE_TYPE_UINT32ARY 0x02000000
+#define FAPI_ATTRIBUTE_TYPE_UINT64ARY 0x01000000
+
+#define FAPI_ATTRIBUTE_MODE_CONST 0x80000000
+/**
+ @brief Used by the get/set configuration functions to return the data
+*/
+template<typename T>
+class Attribute
+{
+public:
+ // Constructor
+ Attribute();
+
+ // Destructor
+ ~Attribute();
+
+ //
+ /// @brief Assignment Operator.
+ /// @param[in] i_right Reference to Value to assign from.
+ /// @return Reference to 'this' Target
+ ///
+ Attribute<T>& operator=(const T& i_right)
+ {
+ this->value = i_right->value;
+ }
+
+private:
+ T value;
+
+};
+
+inline AttributeData::AttributeData() {}
+
+inline AttributeData::~AttributeData() {}
+
+} //namespace
+#endif // #ifndef ECMD_PERLAPI
+#endif
+
+
+
+
+
diff --git a/hwpf/plat/include/hw_access.H b/hwpf/plat/include/hw_access.H
new file mode 100644
index 00000000..90b567d0
--- /dev/null
+++ b/hwpf/plat/include/hw_access.H
@@ -0,0 +1,716 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file hw_access.H
+ *
+ * @brief Defines the hardware access functions for PPE platforms that
+ * don't leverage FAPI2 return codes.
+ */
+
+#ifndef FAPI2_HWACCESS_H_
+#define FAPI2_HWACCESS_H_
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#include <fapiSpyIds.H>
+#endif
+
+#include <stdint.h>
+#include <thread>
+#include <buffer.H>
+#include <variable_buffer.H>
+#include <return_code.H>
+#include <target.H>
+#include <utils.H>
+#include <plat_includes.H>
+
+//#include <fapi2Util.H>
+//#include <fapi2PlatTrace.H>
+
+#ifdef FAPI_SUPPORT_MULTI_SCOM
+#include <fapiMultiScom.H>
+#endif
+
+/// @cond
+typedef uint64_t spyId_t;
+typedef uint64_t scanRingId_t;
+/// @endcond
+
+namespace fapi2
+{
+
+ ///
+ /// @enum fapi2::ChipOpModifyMode
+ /// @brief Enumeration of modify modes used in HW access modify operations
+ ///
+ enum ChipOpModifyMode
+ {
+ CHIP_OP_MODIFY_MODE_OR = 1, ///< Modify or mode
+ CHIP_OP_MODIFY_MODE_AND = 2, ///< Modify and mode
+ CHIP_OP_MODIFY_MODE_XOR = 3, ///< Modify xor mode
+ };
+
+ ///
+ /// @enum fapi2::RingMode
+ /// @brief Enumeration of Ring access operation modes
+ /// This is a bitmap to allow the user to specify multiple modes.
+ ///
+ enum RingMode
+ {
+ RING_MODE_SET_PULSE = 0x00000001, ///< Set pulse
+ RING_MODE_NO_HEADER_CHECK = 0x00000002, ///< Dont' check header
+ // FUTURE_MODE = 0x00000004,
+ // FUTURE_MODE = 0x00000008,
+ };
+
+ //--------------------------------------------------------------------------
+ // PIB Error Functions
+ //--------------------------------------------------------------------------
+
+ /// @brief Sets the PIB error mask - platform dependant
+ /// @param[in] i_mask The new error mask
+ void setPIBErrorMask(uint8_t i_mask)
+ {
+ PLAT_SET_PIB_ERROR_MASK(i_mask);
+ }
+
+ /// @brief Gets the PIB error mask - platform dependant
+ /// @return uint8_t The current PIB error mask
+ uint8_t getPIBErrorMask(void)
+ {
+ PLAT_GET_PIB_ERROR_MASK(o_pib_mask);
+ return o_pib_mask;
+ }
+
+ //--------------------------------------------------------------------------
+ // Operational Mode Error Functions
+ //--------------------------------------------------------------------------
+
+ /// @enum OpModes operational Mode Error Functions
+ enum OpModes
+ {
+ // These are bit-masks in case they need to be or'd together
+ NORMAL = 0x00,
+ IGNORE_HW_ERROR = 0x01,
+ DO_NOT_DO_WAKEUP = 0x02,
+ };
+
+ /// @brief Sets the operational mode
+ /// @param[in] i_mode The new mode
+ inline void setOpMode(const OpModes i_mode)
+ {
+ // No-op for now. Should set thread-local operational mode
+ return;
+ }
+
+ /// @brief Gets the operational mode
+ /// @return the operational mode
+ inline OpModes getOpMode(void)
+ {
+ // No-op for now. Should read thread-local operational mode
+ return NORMAL;
+ }
+
+ //--------------------------------------------------------------------------
+ // HW Communication Functions
+ //--------------------------------------------------------------------------
+
+ /// @brief Reads a SCOM register from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline void getScom(const Target<K>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& o_data)
+ {
+ // PLAT_GETSCOM(i_target,
+// (uint32_t)(i_address & BITS(40,24)),
+// &(o_data()));
+
+// fapi2::ReturnCode l_rc;
+ PLAT_GETSCOM(current_err,
+ i_target,
+ (uint32_t)(i_address & BITS(40,24)),
+ &(o_data()));
+ }
+
+
+ /// @brief Writes a SCOM register on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline void putScom(const Target<K>& i_target, const uint64_t i_address,
+ buffer<uint64_t>& i_data)
+ {
+
+ PLAT_PUTSCOM(i_target,
+ (uint32_t)(i_address & BITS(40,24)),
+ &(i_data()));
+ }
+
+ /// @brief Read-modify-write a SCOM register on a chip
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor).
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline void modifyScom( const Target<K>& i_target,
+ const uint64_t i_address,
+ const buffer<uint64_t>& i_data,
+ const ChipOpModifyMode i_modifyMode)
+ {
+ fapi2::buffer<uint64_t> l_modifyDataBuffer;
+
+ PLAT_GETSCOM(i_target,
+ (uint32_t)(i_address & BITS(40,24)),
+ &(l_modifyDataBuffer()));
+
+ if ( i_modifyMode == CHIP_OP_MODIFY_MODE_OR)
+ {
+ l_modifyDataBuffer |= i_data;
+ }
+
+ if ( i_modifyMode == CHIP_OP_MODIFY_MODE_AND)
+ {
+ l_modifyDataBuffer &= i_data;
+ }
+
+ if ( i_modifyMode == CHIP_OP_MODIFY_MODE_XOR)
+ {
+ l_modifyDataBuffer ^= i_data;
+ }
+
+ PLAT_PUTSCOM(i_target,
+ (uint32_t)(i_address & BITS(40,24)),
+ &(l_modifyDataBuffer()));
+ return;
+ }
+
+ /// @brief Writes a SCOM register under mask on a chip
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address SCOM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @param[in] i_mask Buffer that holds the mask value.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline void putScomUnderMask(const Target<K>& i_target,
+ const uint64_t i_address,
+ buffer<uint64_t>& i_data,
+ buffer<uint64_t>& i_mask)
+ {
+ fapi2::buffer<uint64_t> l_modifyDataBuffer = i_data;
+
+ l_modifyDataBuffer &= i_mask;
+
+ PLAT_PUTSCOM(i_target,
+ (uint32_t)(i_address & BITS(40,24)),
+ &(l_modifyDataBuffer()));
+ return;
+ }
+
+
+ /// @brief Reads a CFAM register from a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode getCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ buffer<uint32_t>& o_data)
+ {
+ PLAT_GETCFAM(i_target.get(),
+ (uint32_t)(i_address & BITS(40,24)),
+ &(o_data()));
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a CFAM register on a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to write to.
+ /// @param[in] i_data Buffer that holds data to write into address.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ buffer<uint32_t>& i_data)
+ {
+ PLAT_PUTCFAM(i_target.get(),
+ (uint32_t)(i_address & BITS(40,24)),
+ &(i_data()));
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Read-modify-write a CFAM register on a chip.
+ /// CFAM register is 32-bit wide.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target HW target to operate on.
+ /// @param[in] i_address CFAM register address to modify.
+ /// @param[in] i_data Buffer that holds data to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor).
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode modifyCfamRegister(const Target<K>& i_target,
+ const uint32_t i_address,
+ const buffer<uint32_t>& i_data,
+ const ChipOpModifyMode i_modifyMode)
+ {
+ PLAT_MODCFAM(i_target.get(),
+ (uint32_t)(i_address & BITS(40,24)),
+ &(i_data()),
+ i_modifyMode);
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Reads a ring from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to read from.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode getRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& o_data,
+ const RingMode i_ringMode = 0)
+ {
+ o_data.setBit(0);
+ o_data.setBit(3);
+#ifndef __PPE__
+ std::cout << std::hex << " getRing "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "ring address: " << i_address << "; "
+ << "ring mode: " << i_ringMode << "; "
+ << "output data:";
+ o_data.print();
+#endif
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ /// @brief Writes a ring to a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to write to.
+ /// @param[in] i_data Buffer that contains RS4 compressed ring data
+ /// to write into address
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& i_data,
+ const RingMode i_ringMode = 0)
+ {
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+
+ /// @brief Writes a ring to a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to write to.
+ /// @param[in] i_data Pointer to location that contains RS4 compressed
+ // ring data to write into address
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode putRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ const void* i_data,
+ const RingMode i_ringMode = 0)
+ {
+ uint64_t* dataPtr = reinterpret_cast<uint64_t*>(const_cast<void*>(i_data));
+
+ return FAPI2_RC_SUCCESS;
+ }
+#ifndef __PPE__
+ /// @brief Read-modify-write a ring on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_address Ring address to modify.
+ /// @param[in] i_data Buffer that contains RS4 compressed ring data
+ /// to be modified.
+ /// @param[in] i_modifyMode The modify mode (or/and/xor)
+ /// @param[in] i_ringMode Ring operation mode.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ template< TargetType K >
+ inline ReturnCode modifyRing(const Target<K>& i_target,
+ const scanRingId_t i_address,
+ variable_buffer& i_data,
+ const ChipOpModifyMode i_modifyMode,
+ const RingMode i_ringMode = 0)
+ {
+
+ return FAPI2_RC_SUCCESS;
+ }
+#endif
+ /// @note
+ /// These spy access interfaces are only used in FSP and cronus
+ /// HB does not allow spy access
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING)
+ /// @brief Reads a spy from a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy whose data to be read.
+ /// @param[out] o_data Buffer that holds data read from HW target.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependant on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// 1. if the spy name contains a # procedure writers should replace
+ /// it with an __P__ for example -
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ /// becomes
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// 2. if the spy name has a number following a "." it must have an
+ /// underscore prepended to the number.
+ ///
+ /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
+ /// becomes
+ /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
+ ///
+ /// Example SPY name:
+ /// The hardware procedure should call the function like:
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// fapi::ReturnCode rc = fapiGetSpy( targ,
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
+ ///
+ /// @note The ID is not in quotes the fapi code will handle adding
+ /// the quotes for the cronus environment
+ ///
+#endif
+
+// Set to 1 for fapi2 API test
+#define FAPI_SUPPORT_SPY_AS_ENUM 1
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+
+#ifndef DOCUMENTATION
+#define fapiGetSpy(TARGET, ID, DATA) \
+ _fapiGetSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA )
+#endif
+
+#ifndef __PPE__
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpy(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& o_data)
+ {
+ o_data.setBit(1);
+ o_data.setBit(4);
+#ifndef __PPE__
+ std::cout << std::hex << " _fapiGetSpy "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy ID: " << i_spyId << "; "
+ << "output data:";
+ o_data.print();
+#endif
+ return FAPI2_RC_SUCCESS;
+ }
+#endif
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+
+#ifndef DOCUMENTATION
+#define fapiGetSpy(TARGET, ID, DATA) _fapiGetSpy(TARGET, #ID, DATA)
+#endif
+#ifndef __PPE__
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpy(const Target<K>& i_target,
+ const char * const i_spyId,
+ variable_buffer& o_data);
+#endif
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING)
+ /// @brief Writes a spy on a chip.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy to write data to.
+ /// @param[out] i_data Buffer that holds data to write into spy.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// 1. if the spy name contains a # procedure writers should replace
+ /// is with an __P__ for example -
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ /// becomes
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// 2. if the spy name has a number following a "." it must have an
+ /// underscore prepended to the number.
+ ///
+ /// EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY
+ /// becomes
+ /// EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY
+ ///
+ /// Example SPY name:
+ /// The hardware procedure should call the function like:
+ ///
+ /// ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS
+ ///
+ /// fapi::ReturnCode rc = fapiPutSpy( targ,
+ /// ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data );
+ ///
+ /// @note The ID is not in quotes the fapi code will handle adding
+ /// the quotes for the cronus environment
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOCUMENTATION
+#define fapiPutSpy(TARGET, ID, DATA) \
+ _fapiPutSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA)
+#endif
+
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpy(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& i_data)
+ {
+#ifndef __PPE__
+ std::cout << std::hex << " _fapiPutSpy "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy Id: " << i_spyId << "; "
+ << "input data:";
+ i_data.print();
+#endif
+ return FAPI2_RC_SUCCESS;
+ }
+
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+#ifndef DOCUMENTATION
+#define fapiPutSpy(TARGET, ID, DATA) _fapiPutSpy(TARGET, #ID, DATA)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpy(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& i_data)
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING)
+
+ /// @brief Writes spy data into a buffer holding ring data image
+ /// This API is used by L2/L3 repair to put column repair data
+ /// into a ring buffer image.
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in] i_spyId Id of the spy.
+ /// @param[in] i_data Buffer that holds spy data to write into ring
+ /// image.
+ /// @param[out] o_data Buffer that holds updated ring image.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// See fapiPutSpy for details on spy id specifics.
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOCUMENTATION
+#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiPutSpyImage(TARGET, \
+ FAPI_SPY_NAMES::ID.value, \
+ DATA1, DATA2)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& i_data,
+ variable_buffer& o_imageData)
+ {
+#ifndef __PPE__
+ std::cout << std::hex << " _fapiPutSpyImage "
+ << "target: {" << i_target.getType() << ","
+ << uint64_t(i_target) << "}; "
+ << "Spy Id: " << i_spyId << "; "
+ << "input data: ";
+ i_data.print();
+#endif
+ // Set fake output data
+ o_imageData.invert();
+
+ return FAPI2_RC_SUCCESS;
+ }
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+// fapiPutSpyImage function Cronus version
+#ifndef DOCUMENTATION
+#define fapiPutSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiPutSpyImage(TARGET, #ID, \
+ DATA1,DATA2)
+#endif
+
+ template< TargetType K >
+ inline ReturnCode _fapiPutSpyImage(const Target<K>& i_target,
+ const char* const i_spyId,
+ variable_buffer& i_data,
+ variable_buffer& o_imageData);
+#endif
+
+#if defined(FAPI_SUPPORT_SPY_AS_ENUM) || defined(FAPI_SUPPORT_SPY_AS_STRING)
+ /// @brief Reads spy data from a ring image buffer
+ /// @param[in] i_target Target to operate on
+ /// @param[in] i_spyId The spy's id
+ /// @param[out] o_data Buffer that holds data read from ring image.
+ /// @param[in] i_imageData Buffer that holds ring image to read data
+ /// from.
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note: The string version is only supported for cronus.
+ ///
+ /// The fapi design to support both FSP and cronus use of get and
+ /// put spy functions is dependent on the SPY names being expanded
+ /// to resemble a valid C identifier. This design places some
+ /// restrictions on the SPY names which can be used.
+ ///
+ /// See fapiPutSpy for details on spy id specifics.
+ ///
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_ENUM
+#ifndef DOCUMENTATION
+#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiGetSpyImage(TARGET, \
+ FAPI_SPY_NAMES::ID.value, \
+ DATA1, DATA2)
+#endif
+ template< TargetType K >
+ inline ReturnCode _fapiGetSpyImage(const Target<K>& i_target,
+ const spyId_t i_spyId,
+ variable_buffer& o_data,
+ const variable_buffer& i_imageData);
+#endif
+
+#ifdef FAPI_SUPPORT_SPY_AS_STRING
+// fapiGetSpyImage function Cronus version
+#ifndef DOCUMENTATION
+#define fapiGetSpyImage(TARGET, ID, DATA1, DATA2) \
+ _fapiGetSpyImage(TARGET, \
+ #ID, DATA1,DATA2)
+#endif
+
+ inline fapi::ReturnCode _fapiGetSpyImage(
+ const fapi::Target& i_target,
+ const char* const i_spyId,
+ fapi::buffer<fapi::bits_container> & o_data,
+ const fapi::buffer<fapi::bits_container> & i_imageData);
+#endif
+
+#ifdef FAPI_SUPPORT_MULTI_SCOM
+
+ /// @brief Performs a multiple SCOM operation
+ /// This interface performs multiple SCOM operations on a chip in the
+ /// order specified by the input MultiScom object.
+ /// See fapiMultiScom.H for details of how to populate the MultiScom
+ /// object with SCOM operations.
+ ///
+ /// @tparam K template parameter, passed in target.
+ /// @param[in] i_target Target to operate on.
+ /// @param[in,out] io_multiScomObj Reference to a MultiScom object,
+ /// pre-populated with SingleScomInfo entries
+ /// to perform multiple SCOMs on input target
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
+ ///
+ /// @note This is a synchronous interface and would return after all the
+ /// SCOM operations are completed or on the first failed operation
+ ///
+ /// @note SCOMs will be performed in the order they were added to the
+ /// input MultiScom object
+ ///
+ /// @note In case of errors, the platform code is responsible to collect
+ /// and add all the required error info and FFDC into the error data
+ /// for debugging
+ ///
+ /// @note If the SCOM operations added are specific to a processor chip,
+ /// then the FSI Shift Engine configured in scatter-gather DMA mode
+ /// extension would be used to execute the SCOM operations in a
+ /// performance optimize mode. In this mode, the special
+ /// SCOM_BULK_READ_MODE and SCOM_BULK_WRITE_MODE operations are
+ /// supported that allow a large bulk of SCOM access (in multiple of
+ /// 64 bits) for targets that support auto-increment. The
+ /// SCOM_WRITE_UNDER_MASK operation is not supported in this mode
+ ///
+ /// @note If the SCOM operations added are specific to a memory buffer
+ /// chip, then the regular SCOM engine is used to execute the SCOM
+ /// operations. SCOM_WRITE_UNDER_MASK operation is supported in
+ /// this mode, but the special SCOM_BULK_READ_MODE and
+ /// SCOM_BULK_WRITE_MODE operations are not supported due to
+ /// hardware limitations.
+ ///
+ inline fapi::ReturnCode fapiMultiScom (const Target<K>& i_target,
+ MultiScom& io_multiScomObj);
+#endif // FAPI_SUPPORT_MULTI_SCOM
+
+};
+
+#endif // FAPI2HWACCESS_H_
diff --git a/hwpf/plat/include/plat_hw_access.H b/hwpf/plat/include/plat_hw_access.H
new file mode 100644
index 00000000..9bfccfcc
--- /dev/null
+++ b/hwpf/plat/include/plat_hw_access.H
@@ -0,0 +1,78 @@
+/**
+ * @file plat_hw_access.H
+ *
+ * @brief Define platform specific calls for PPE Platforms that use the machine
+ * check function of the PPE to deal with errors (eg no explicit return codes
+ * returned)
+ */
+
+#ifndef PLATHWACCESS_H_
+#define PLATHWACCESS_H_
+
+#include <plat_includes.H>
+
+/// PIB Error Mask
+
+#define PLAT_SET_PIB_ERROR_MASK(_m_mask) \
+ { /* Read MSR */ \
+ uint32_t msr_data = mfmsr(); \
+ /* Set SEM field */ \
+ msr_data &= ~(BITS(0,8)); \
+ msr_data |= (uint32_t)(i_mask << 24); \
+ /* Write MSR */ \
+ mtmsr(msr_data); \
+ };
+
+#define PLAT_GET_PIB_ERROR_MASK(_m_mask) \
+ uint8_t _m_mask; \
+ uint32_t _sem = mfmsr(); \
+ _m_mask = (uint8_t)((_sem & MSR_SEM) >> (32-(MSR_SEM_START_BIT + MSR_SEM_LEN)));
+
+// Building block PPE instructions
+#define PPE_MFMSR(_m_data) \
+asm volatile \
+ ( \
+ "mfmsr %[data] \n" \
+ : [data]"=&r"(*_m_data) \
+ : "[data]"(*_m_data) \
+ );
+
+#define PPE_MTMSR(_m_data) \
+asm volatile \
+ ( \
+ "mtmsr %[data] \n" \
+ : [data]"=&r"(*_m_data) \
+ : "[data]"(*_m_data) \
+ );
+
+
+/// GetScom
+#define PLAT_GETSCOM(_m_rc, _m_base, _m_offset, _m_data) \
+ PPE_LVDX(_m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data)
+
+/// PutScom
+#define PLAT_PUTSCOM(_m_base, _m_offset, _m_data) \
+ PPE_STVDX(_m_rc, _m_base.getAddressOverlay(), (uint32_t)(_m_offset & BITS(40,24)), _m_data)
+
+/// ModifyScom
+#define PLAT_MODSCOM(_m_base, _m_offset, _m_data, _m_mode) \
+ PPE_STVDX(_m_base.getAddressOverlay(), _m_offset, _m_data)
+
+
+/// GetCFAM
+#define PLAT_GETCFAM(_m_base, _m_offset, _m_data) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "getCfamRegister is not supported by PPE platforms")
+
+/// PutCFAM
+#define PLAT_PUTCFAM(_m_base, _m_offset, _m_data) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "putCfamRegister is not supported by PPE platforms")
+
+/// ModifyCFAM
+#define PLAT_MODCFAM(_m_base, _m_offset, _m_data, _m_mode) \
+ static_assert( K == TARGET_TYPE_NONE, \
+ "modifyCfamRegister is not supported by PPE platforms")
+
+#endif // PLATHWACCESS_H_
+
diff --git a/hwpf/plat/include/plat_includes.H b/hwpf/plat/include/plat_includes.H
new file mode 100644
index 00000000..97074b67
--- /dev/null
+++ b/hwpf/plat/include/plat_includes.H
@@ -0,0 +1,40 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file plat_includes.H
+ * @brief Platform specific include to implement FAPI2 APIs
+ */
+
+#ifndef __PLAT_INCLUDES_H__
+#define __PLAT_INCLUDES_H__
+
+#include <plat_hw_access.H>
+
+#include <ppe42_scom.h>
+#include <ppe42_msr.h>
+//#include <pk.h>
+
+
+#endif // __PLAT_INCLUDES_H__
diff --git a/hwpf/plat/include/plat_target_definitions.H b/hwpf/plat/include/plat_target_definitions.H
new file mode 100644
index 00000000..c2ec0518
--- /dev/null
+++ b/hwpf/plat/include/plat_target_definitions.H
@@ -0,0 +1,112 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file plat_ppe_target.H
+ * @brief Definitions for fapi2 PPE targets
+ */
+
+#ifndef __FAPI2_PPE_TARGET__
+#define __FAPI2_PPE_TARGET__
+
+#define TARGET_CHIP(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP > _name((uint64_t)_index);
+
+#define TARGET_CHIP_PERV(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_PERV> _name((uint64_t)_index);
+
+#define TARGET_EQ(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_EQ> _name((uint64_t)_index);
+
+#define TARGET_CORE(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_CORE> _name((uint64_t)_index);
+
+#define TARGET_EX(_name, _index) \
+ fapi2::Target<fapi2::TARGET_TYPE_EX> _name((uint64_t)_index);
+
+namespace fapi2
+{
+
+ TARGET_CHIP (chip_target, 0);
+ TARGET_CHIP_PERV (perv_target, 1);
+ TARGET_CHIP_PERV (n0_target, 2);
+ TARGET_CHIP_PERV (n1_target, 3);
+ TARGET_CHIP_PERV (n2_target, 4);
+ TARGET_CHIP_PERV (n3_target, 5);
+ TARGET_CHIP_PERV (xb_target, 6);
+ TARGET_CHIP_PERV (mc0_target, 7);
+ TARGET_CHIP_PERV (mc1_target, 8);
+ TARGET_CHIP_PERV (ob0_target, 9);
+ TARGET_CHIP_PERV (ob1_target, 10);
+ TARGET_CHIP_PERV (ob2_target, 11);
+ TARGET_CHIP_PERV (ob3_target, 12);
+ TARGET_CHIP_PERV (pci0_target, 13);
+ TARGET_CHIP_PERV (pci1_target, 14);
+ TARGET_CHIP_PERV (pci2_target, 15);
+ TARGET_EQ (eq0_target, 0);
+ TARGET_EQ (eq1_target, 1);
+ TARGET_EQ (eq2_target, 2);
+ TARGET_EQ (eq3_target, 3);
+ TARGET_EQ (eq4_target, 4);
+ TARGET_EQ (eq5_target, 5);
+ TARGET_EX (ex0_target, 0);
+ TARGET_EX (ex1_target, 1);
+ TARGET_EX (ex2_target, 2);
+ TARGET_EX (ex3_target, 3);
+ TARGET_EX (ex4_target, 4);
+ TARGET_EX (ex5_target, 5);
+ TARGET_EX (ex6_target, 6);
+ TARGET_EX (ex7_target, 7);
+ TARGET_EX (ex8_target, 8);
+ TARGET_EX (ex9_target, 9);
+ TARGET_EX (ex10_target, 10);
+ TARGET_EX (ex11_target, 11);
+ TARGET_CORE (core0_target, 0);
+ TARGET_CORE (core1_target, 1);
+ TARGET_CORE (core2_target, 2);
+ TARGET_CORE (core3_target, 3);
+ TARGET_CORE (core4_target, 4);
+ TARGET_CORE (core5_target, 5);
+ TARGET_CORE (core6_target, 6);
+ TARGET_CORE (core7_target, 7);
+ TARGET_CORE (core8_target, 8);
+ TARGET_CORE (core9_target, 9);
+ TARGET_CORE (core10_target,10);
+ TARGET_CORE (core11_target,11);
+ TARGET_CORE (core12_target,12);
+ TARGET_CORE (core13_target,13);
+ TARGET_CORE (core14_target,14);
+ TARGET_CORE (core15_target,15);
+ TARGET_CORE (core16_target,16);
+ TARGET_CORE (core17_target,17);
+ TARGET_CORE (core18_target,18);
+ TARGET_CORE (core19_target,19);
+ TARGET_CORE (core20_target,20);
+ TARGET_CORE (core21_target,21);
+ TARGET_CORE (core22_target,22);
+ TARGET_CORE (core23_target,23);
+
+}; // fapi2 namespace
+
+#endif // __FAPI2_PPE_TARGET__
diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H
new file mode 100644
index 00000000..4931f790
--- /dev/null
+++ b/hwpf/plat/include/plat_target_parms.H
@@ -0,0 +1,62 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file plat_ppe_target.H
+ * @brief Definitions for fapi2 PPE targets
+ */
+
+#ifndef __FAPI2_PPE_TARGET_PARMS__
+#define __FAPI2_PPE_TARGET_PARMS__
+
+
+#ifndef __ASSEMBLER__
+
+const uint64_t CHIPLET_COUNT = 0x38;
+
+const uint64_t CHIP_TARGET_COUNT = 1;
+const uint64_t CHIP_TARGET_OFFSET = 0;
+
+const uint64_t PERV_TARGET_OFFSET = CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT;
+const uint64_t PERV_CHIPLET_OFFSET = 0x1;
+const uint64_t PERV_TARGET_COUNT = 15;
+
+const uint64_t EQ_TARGET_OFFSET = PERV_TARGET_OFFSET + PERV_TARGET_COUNT;
+const uint64_t EQ_CHIPLET_OFFSET = 0x10;
+const uint64_t EQ_TARGET_COUNT = 6;
+
+const uint64_t CORE_TARGET_OFFSET = EQ_TARGET_OFFSET + EQ_TARGET_COUNT;
+const uint64_t CORE_CHIPLET_OFFSET = 0x20;
+const uint64_t CORE_TARGET_COUNT = 24;
+
+const uint64_t EX_TARGET_OFFSET = CORE_TARGET_OFFSET + CORE_TARGET_COUNT;
+const uint64_t EX_CHIPLET_OFFSET = 0x10;
+const uint64_t EX_TARGET_COUNT = 12;
+
+
+const uint64_t TARGET_COUNT = EX_TARGET_OFFSET + EX_TARGET_COUNT;
+
+#endif
+
+#endif // __FAPI2_PPE_TARGET_PARMS__
diff --git a/hwpf/plat/include/return_code.H b/hwpf/plat/include/return_code.H
new file mode 100644
index 00000000..225f1b0a
--- /dev/null
+++ b/hwpf/plat/include/return_code.H
@@ -0,0 +1,187 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file return_code.H
+ * @brief definitions for fapi2 return codes
+ */
+
+#ifndef __FAPI2_RETURN_CODE__
+#define __FAPI2_RETURN_CODE__
+
+#include <stdint.h>
+
+// Remove this for platforms which don't support FFDC
+//#include <ffdc.H>
+
+///
+/// @brief Set HWP Error macro
+///
+/// This macro should be used by a HWP to create an error. The ReturnCode's
+/// internal return code is set and any error information in the Error XML file
+/// is added to the ReturnCode
+///
+#define FAPI_SET_HWP_ERROR(RC, ERROR) \
+ RC._setHwpError(fapi2::ERROR); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+///
+/// @brief Add info to HWP Error macro
+///
+/// This macro should be used by an FFDC HWP to add error information from an
+/// Error XML file to an existing error.
+///
+#define FAPI_ADD_INFO_TO_HWP_ERROR(RC, ERROR) \
+ ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \
+ ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \
+ ERROR##_ADD_ERROR_INFO(RC)
+
+namespace fapi2
+{
+ ///
+ /// @brief Enumeration of return codes
+ ///
+ enum ReturnCodes
+ {
+ ///< Success
+ FAPI2_RC_SUCCESS = 0,
+
+ // Flag bits indicating which code generated the error.
+ FAPI2_RC_FAPI2_MASK = 0x04000000, ///< FAPI2 mask
+ FAPI2_RC_PLAT_MASK = 0x02000000, ///< Platform mask
+ FAPI2_RC_HWP_MASK = 0x00000000, ///< HWP mask
+
+ //
+ // FAPI generated return codes
+ //
+
+ FAPI2_RC_INVALID_ATTR_GET = FAPI2_RC_FAPI2_MASK | 0x01,
+ ///< Initfile requested an attribute with an invalid attribute ID
+
+ FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI2_RC_FAPI2_MASK | 0x02,
+ ///< HWP requested a chip EC feature with an invalid attribute ID
+
+ FAPI2_RC_INVALID_MULTISCOM_LENGTH = FAPI2_RC_FAPI2_MASK | 0x03,
+ ///< Invalid multiscom parameters
+
+ FAPI2_RC_INVALID_PARAMETER = FAPI2_RC_FAPI2_MASK | 0x04,
+ ///< Invalid parameters to a FAPI2 function
+
+ FAPI2_RC_OVERFLOW = FAPI2_RC_FAPI2_MASK | 0x05,
+ ///< Overflow condition, typically a buffer operation
+
+ //
+ // PLAT generated return codes. Additional details may be contained in
+ // ReturnCode platData (this can only be looked at by PLAT code)
+ //
+
+ FAPI2_RC_PLAT_ERR_SEE_DATA = FAPI2_RC_PLAT_MASK | 0x01,
+ ///< Generic platform error
+
+ FAPI2_RC_PLAT_ERR_ADU_LOCKED = FAPI2_RC_PLAT_MASK | 0x02,
+ ///< Operation to AlterDisplay unit failed because it is locked
+
+ FAPI2_RC_PLAT_NOT_SUPPORTED_AT_RUNTIME = FAPI2_RC_PLAT_MASK | 0x03,
+ ///< Operation not supported by HB runtime
+ };
+
+
+ ///
+ /// @brief Class representing a FAPI2 ReturnCode
+ ///
+ /// @note Remove the inheritance relationship with FirstFailureData if
+ /// the platform doesn't support FFDC.
+ class ReturnCode
+ {
+ public:
+
+ ///
+ /// @brief Constructor.
+ /// @param[in] i_rc the rc to set
+ ///
+ ReturnCode(const uint32_t i_rc = FAPI2_RC_SUCCESS):
+ iv_rc(i_rc)
+ {};
+
+ ///
+ /// @brief integral type conversion function. Returns the error code
+ /// @return The error code
+ ///
+ inline operator uint32_t() const { return iv_rc; }
+
+ ///
+ /// @brief Returns true iff iv_rc == SUCCESS
+ /// @return true or false
+ ///
+ inline operator bool() const { return iv_rc == FAPI2_RC_SUCCESS; }
+
+ ///
+ /// @brief Assignement operator
+ ///
+ inline ReturnCode& operator=(const uint32_t& rhs)
+ {
+ iv_rc = rhs;
+ return *this;
+ }
+
+ inline ReturnCode& operator=(const ReturnCodes& rhs)
+ {
+ iv_rc = rhs;
+ return *this;
+ }
+
+ inline bool operator==(const uint32_t& rhs) const
+ { return rhs == iv_rc; }
+
+ inline bool operator==(const ReturnCodes& rhs) const
+ { return rhs == iv_rc; }
+
+ inline bool operator!=(const uint32_t& rhs) const
+ { return rhs != iv_rc; }
+
+ inline bool operator!=(const ReturnCodes& rhs) const
+ { return rhs != iv_rc; }
+
+ ReturnCode& insertPIBcode(const uint32_t& pibrc)
+ {
+ iv_rc = FAPI2_RC_PLAT_MASK | pibrc;
+ return *this;
+ }
+
+ private:
+ uint32_t iv_rc;
+ };
+
+ /// This implementation assumes no exception handling and leverages thread-local
+ /// storage. For platforms without thread support, a global variable will
+ /// suffice for the error state.
+ extern thread_local ReturnCode current_err; /// the current error state
+ extern thread_local uint32_t pib_error_mask; /// the pib mask
+ extern thread_local uint32_t operational_state; /// the operational mode
+
+};
+
+#endif
diff --git a/hwpf/plat/include/target.H b/hwpf/plat/include/target.H
new file mode 100644
index 00000000..1610069d
--- /dev/null
+++ b/hwpf/plat/include/target.H
@@ -0,0 +1,532 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file target.H
+ * @brief definitions for fapi2 targets
+ */
+
+#ifndef __FAPI2_TARGET__
+#define __FAPI2_TARGET__
+
+#include <stdint.h>
+//#include <vector>
+#include <target_types.H>
+#include <utils.H>
+#include "plat_target_parms.H"
+
+#define MC_ENABLE 0x1 << 6
+#define MC_WRITE 5
+#define MC_READ_OR 0
+#define MC_READ_AND 1
+
+#define EX_ADDRESS_MASK 0x0000FF00
+
+
+namespace fapi2
+{
+ ///
+ /// @brief Class representing a FAPI2 Target
+ /// @tparam K the type (Kind) of target
+ /// @tparam V the type of the target's Value
+ /// @remark TargetLite targets are uint64_t, Targets
+ /// are uintptr_t (void*).
+ ///
+ /// Assuming there are representations of a processor,
+ /// a membuf and a system here are some examples:
+ /// @code
+ /// #define PROCESSOR_CHIP_A 0xFFFF0000
+ /// #define MEMBUF_CHIP_B 0x0000FFFF
+ /// #define SYSTEM_C 0x0000AAAA
+ /// @endcode
+ ///
+ /// * To define a target:
+ /// @code
+ /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A);
+ /// fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> C(SYSTEM_C);
+ /// fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> B(MEMBUF_CHIP_B);
+ /// @endcode
+ ///
+ /// * Functions which take composite target types
+ /// @code
+ /// void takesProcOrMembuf(
+ /// const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP |
+ /// fapi2::TARGET_TYPE_MEMBUF_CHIP>& V );
+ ///
+ /// void takesAny(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& V );
+ ///
+ /// @endcode
+ ///
+ /// * Traversing the target "tree"
+ /// @code
+ /// fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> A(PROCESSOR_CHIP_A);
+ ///
+ /// // Get A's parent
+ /// A.getParent<fapi2::TARGET_TYPE_SYSTEM>();
+ ///
+ /// // Get the 0x53'd core
+ /// fapi2::getTarget<fapi2::TARGET_TYPE_CORE>(0x53);
+ ///
+ /// // Get all *my* present/functional children which are cores
+ /// A.getChildren<fapi2::TARGET_TYPE_CORE>();
+ ///
+ /// // Get all of the the cores relative to my base target
+ /// fapi2::getChildren<fapi2::TARGET_TYPE_CORE>();
+ /// @endcode
+ ///
+ /// * Invalid casts
+ /// @code
+ /// // Can't cast to a specialized target
+ /// fapi2::Target<fapi2::TARGET_TYPE_NONE> D(MEMBUF_CHIP_B);
+ /// takesProcOrMembuf( D );
+ ///
+ /// // Not one of the shared types
+ /// fapi2::Target<fapi2::TARGET_TYPE_ABUS_ENDPOINT> E;
+ /// takesProcOrMembuf( E );
+ /// @endcode
+ template<TargetType K, typename V = uint64_t>
+ class Target
+ {
+ public:
+
+ ///
+ /// @brief Create a Target, with a value
+ /// @param[in] V the value (i.e., specific element this
+ /// target represents, or pointer)
+ /// @note Platforms can mangle the value and K to get a
+ /// single uint64_t in value which represents all the information
+ /// they might need. value( K | V ), for example
+ ///
+
+ /// Default constructor is basically a TARGET_TYPE_ALL
+ Target()
+ {
+ this->iv_handle.fields.chiplet_num = 0;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ Target( V Value )
+ {
+ static_assert( ((K == TARGET_TYPE_CORE) &
+ (K == TARGET_TYPE_EQ) ) != true,
+ "TARGET_TYPE_CORE and TARGET_TYPE_EQ cannot be specified at the same time");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ this->iv_handle.fields.chiplet_num = Value;
+ this->iv_handle.fields.type = TARGET_TYPE_PROC_CHIP;
+ this->iv_handle.fields.type_target_num = Value; // TODO: check this
+// this->iv_address.fields.chiplet_num = Value;
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ this->iv_handle.fields.chiplet_num = Value;
+ this->iv_handle.fields.type = TARGET_TYPE_PERV | TARGET_TYPE_PROC_CHIP;
+ this->iv_handle.fields.type_target_num = Value; // TODO: check this
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ /*
+ if (Value > CORE_CHIPLET_COUNT)
+ {
+ PK_TRACE("Chiplet number is greater than CORE_CHIPLET_COUNT");
+ return -1;
+ }
+ */
+ this->iv_handle.fields.chiplet_num = Value + CORE_CHIPLET_OFFSET;
+ this->iv_handle.fields.type = TARGET_TYPE_CORE;
+ this->iv_handle.fields.type_target_num = Value;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ this->iv_handle.fields.chiplet_num = Value + EQ_CHIPLET_OFFSET;
+ this->iv_handle.fields.type = TARGET_TYPE_EQ;
+ this->iv_handle.fields.type_target_num = Value;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+
+ this->iv_handle.fields.chiplet_num = (Value / 2) + EX_CHIPLET_OFFSET;
+ this->iv_handle.fields.type = TARGET_TYPE_EX;
+ this->iv_handle.fields.type_target_num = Value;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_EQ_MC_WRITE)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_WRITE << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_WRITE;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_EQ_MC_READOR)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_READ_OR << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READOR;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_EQ_MC_READAND)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_READ_AND << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READAND;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_CORE_MC_WRITE)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_WRITE << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_WRITE;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_CORE_MC_READOR)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_READ_OR << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READOR;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K & TARGET_TYPE_CORE_MC_READAND)
+ {
+ this->iv_handle.fields.chiplet_num =
+ (((MC_ENABLE) |
+ ((MC_READ_AND << 3) | (Value & 0x07))) &
+ BITS(57,7));
+ this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READAND;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+ if(K == TARGET_TYPE_ALL)
+ {
+ this->iv_handle.fields.chiplet_num = Value;
+ this->iv_handle.fields.type = TARGET_TYPE_ALL;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+ }
+
+// if(K == TARGET_TYPE_ADDRESS)
+// {
+// this->iv_handle.fields.chiplet_num = Value;
+// this->iv_address.fields.chiplet_num = this->iv_handle.fields.chiplet_num;
+// }
+ }
+
+ ///
+ /// @brief Assignment Operator.
+ /// @param[in] i_right Reference to Target to assign from.
+ /// @return Reference to 'this' Target
+ ///
+ Target<K,V>& operator=(const Target<K,V>& i_right)
+ {
+ this->iv_handle.value = i_right->iv_handle.value;
+ this->iv_addresss.value = i_right->iv_address.value;
+ return *this;
+ }
+
+ ///
+ /// @brief Equality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if equal.
+ ///
+ bool operator==(const Target<K,V>& i_right) const
+ {
+ if (this->iv_handle.value == i_right->iv_handle.value)
+ return true;
+ else
+ return false;
+ }
+ ///
+ /// @brief Inquality Comparison Operator
+ /// @param[in] i_right Reference to Target to compare.
+ /// @return bool. True if equal.
+ ///
+ bool operator!=(const Target<K,V>& i_right) const
+ {
+ if (this->iv_handle.value != i_right->iv_handle.value)
+ return true;
+ else
+ return false;
+ }
+
+ ///
+ /// @brief Get the handle.
+ /// @return V The target's handle, or value
+ ///
+ V get(void) const
+ {
+ return this->iv_handle.value;
+ }
+
+ ///
+ /// @brief Get the handle as a V
+ /// @return V The target's handle, or value
+ ///
+ operator V() const
+ {
+ return this->iv_handle.value;
+ }
+
+ ///
+ /// @brief Get a target's value
+ /// @return V The target's handle, or value
+ ///
+ V& operator()(void)
+ {
+ return *this->iv_handle;
+ }
+
+ ///
+ /// @brief Get the target type
+ /// @return The type of target represented by this target
+ ///
+ TargetType getType(void) const
+ {
+ return (TargetType)this->iv_handle.fields.type;
+ }
+
+ ///
+ /// @brief Get address overlay to reduce runtime processing
+ /// @return Overlay as a type V
+ ///
+ V getAddressOverlay(void) const
+ {
+ return this->iv_handle.fields.address_overlay;
+ }
+
+
+#if 0
+ ///
+ /// @brief Get this target's immediate parent
+ /// @tparam T The type of the parent
+ /// @return Target<T> a target representing the parent
+ ///
+ template<TargetType T>
+ Target<T,V> getParent(void) const
+ {
+ static_assert((T & ~(TARGET_TYPE_PROC_CHIP | TARGET_TYPE_PERV) != 0),
+ "Only TARGET_TYPE_PROC_CHIP and TARGET_TYPE_PERV parent types supported");
+
+ static_assert( ((((T & TARGET_TYPE_PROC_CHIP) == 0) &
+ (T & TARGET_TYPE_PERV ) == 0) ),
+ "Either TARGET_TYPE_PROC_CHIP or TARGET_TYPE_PERV parent type must be specified");
+ }
+
+ ///
+ /// @brief Get this target's children
+ /// @tparam T The type of the parent
+ /// @return std::vector<Target<T> > a vector of present/functional
+ /// children
+ ///
+ template< TargetType T>
+ std::vector<Target<T,V> > getChildren(void) const
+ {
+ static_assert( ((T & ~TARGET_TYPE_PROC_CHIP) != 0 ) != true,
+ "Only TARGET_TYPE_CHIP and TARGET_TYPE_EQ child types supported");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ std::vector<Target<T,V> chip_children(CHIPLET_COUNT);
+ for (int i = 0; i < CHIPLET_COUNT; i++)
+ {
+ if (this->iv_handle.fields.type == TARGET_TYPE_PROC_CHIP &
+ this->iv_handle.fields.present = 1 &
+ this->iv_handle.fields.functional = 1 )
+ {
+ chip_children.push_back(this->iv_handle)
+ }
+ }
+ return chip_children;
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ this->iv_handle.fields.chiplet_num = Value;
+ // this->iv_handle.fields.type_perv = 1;
+ this->iv_handle.fields.type_target_num = 0;
+ }
+
+ }
+
+ ///
+ /// @brief Get the target at the other end of a bus - dimm included
+ /// @tparam T The type of the parent
+ /// @return Target<T> a target representing the thing on the other end
+ /// @note Can be easily changed to a vector if needed
+ ///
+ template<TargetType T>
+ Target<T,K> getOtherEnd(void) const
+ {
+ static_assert( false, "getOtherEnd() is not supported on PPE platforms");
+ }
+#endif
+
+ ///
+ /// @brief Copy from a Target<O> to a Target<K>
+ /// @tparam O the target type of the other
+ ///
+ template<TargetType O>
+ Target<K,V>( const Target<O>& Other ):
+ Target<K,V>(Other.get())
+ {
+ static_assert( (K & O) != 0,
+ "unable to cast Target, no shared types");
+
+ static_assert( bitCount<K>::count >= bitCount<O>::count,
+ "unable to cast to specialized Target");
+ }
+
+ private:
+
+// union {
+// V value;
+// struct {
+// #ifdef _BIG_ENDIAN
+// V chiplet_num : 8;
+// V _reserved_b24 : 24;
+// #else
+// V _reserved_b24 : 24;
+// V chiplet_num : 8;
+// #endif
+// } fields;
+//
+// } iv_address;
+//
+ union {
+ V value;
+ struct {
+#ifdef _BIG_ENDIAN
+ V chiplet_num : 8;
+ V type_target_num : 8;
+ V type : 8;
+ V _reserved_b6 : 6;
+ V present : 1;
+ V functional : 1;
+ V address_overlay : 32;
+#else
+ V address_overlay : 32;
+ V functional : 1;
+ V present : 1;
+ V _reserved_b6 : 6;
+ V type : 8;
+ V type_target_num : 8;
+ V chiplet_num : 8;
+#endif
+ } fields;
+ } iv_handle ;
+
+// uint64_t iv_present_children;
+// uint64_t iv_functional_children;
+
+ };
+
+
+#if 0
+ ///
+ /// @brief Return the string interpretation of this target
+ /// @tparam T The type of the target
+ /// @tparam B The type of the buffer
+ /// @param[in] The Target<T>
+ /// @param[in] The buffer
+ /// @return void
+ /// @post The contents of the buffer is replaced with the string
+ /// representation of the target
+ ///
+ template<TargetType T, typename B>
+ void toString(const Target<T>& i_target, B& i_buffer)
+ {
+ static_assert( false, "toString is not supported on PPE platforms");
+ }
+
+ ///
+ /// @brief Get an enumerated target of a specific type
+ /// @tparam T The type of the target
+ /// @param[in] uint64_t representing the ordinal number of
+ /// the desired target
+ /// @return Target<T> the target requested
+ ///
+ template<TargetType T>
+ Target<T> getTarget(uint64_t Ordinal)
+ {
+ // For testing
+ return Target<T>(Ordinal);
+ }
+#endif
+ // Why has the been removed? For starters, the API name
+ // is probably wrong as it's already been confused with
+ // Target::getChildren(). And if I'm going to change it
+ // I really want to see if we need it. I'm still not
+ // clear on whether we're alloing this traversal or not.
+#if 0
+ ///
+ /// @brief Get the base target's children
+ /// @tparam T The type of the target
+ /// @return std::vector<Target<T> > a vector of present/functional
+ /// children
+ ///
+ template<TargetType T>
+ std::vector<Target<T> > getChildren()
+ {
+ // For testing
+ return {Target<T>(), Target<T>()};
+ }
+#endif
+
+ ///
+ /// @brief Check if the target is of a type, or in a type subset.
+ /// @tparam K the TargetType to check
+ /// @tparam T TargetType or TargetType composite to check against
+ /// @return True, iff K is a proper T
+ ///
+ template< TargetType K, TargetType T >
+ constexpr bool is_same(void)
+ { return (K & T) != 0; }
+
+
+
+
+};
+//#include "plat_ppe_targets_hold.H"
+#endif
diff --git a/hwpf/plat/include/target_types.H b/hwpf/plat/include/target_types.H
new file mode 100644
index 00000000..a5d9526b
--- /dev/null
+++ b/hwpf/plat/include/target_types.H
@@ -0,0 +1,132 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file target_types.H
+ * @brief definitions for fapi2 target types
+ */
+
+#ifndef __FAPI2_TARGET_TYPES__
+#define __FAPI2_TARGET_TYPES__
+
+#ifndef __ASSEMBLER__
+
+
+/// FAPI namespace
+namespace fapi2
+{
+ ///
+ /// @enum fapi::TargetType
+ /// @brief Types, kinds, of targets
+ /// @note TYPE_NONE is used to represent empty/NULL targets in lists
+ /// or tables. TYPE_ALL is used to pass targets to methods which
+ /// can act generally on any type of target
+ ///
+ /// Target Kind
+ enum TargetType
+ {
+ TARGET_TYPE_NONE = 0x00, ///< No type
+ TARGET_TYPE_PROC_CHIP = 0x01, ///< Processor type
+ TARGET_TYPE_EX = 0x02, ///< Ex type
+ TARGET_TYPE_CORE = 0x04, ///< Core type
+ TARGET_TYPE_EQ = 0x08, ///< EQ type
+ TARGET_TYPE_PERV = 0x10, ///< Pervasive type
+ TARGET_TYPE_EQ_MC_WRITE = 0x20, ///< EQ Multicast Type
+ TARGET_TYPE_EQ_MC_READAND = 0x21, ///< EQ Multicast Read AND Type
+ TARGET_TYPE_EQ_MC_READOR = 0x22, ///< EQ Multicast Read OR Type
+ TARGET_TYPE_CORE_MC_WRITE = 0x23, ///< Core Multicast Type
+ TARGET_TYPE_CORE_MC_READAND = 0x24, ///< Core Multicast Read AND Type
+ TARGET_TYPE_CORE_MC_READOR = 0x25, ///< Core Multicast Read OR Type
+ TARGET_TYPE_CME_CORE0 = 0x40, ///< CME Core0 (CME only)
+ TARGET_TYPE_CME_CORE1 = 0x41, ///< CME Core1 (CME only)
+ TARGET_TYPE_ALL = 0xFF, ///< Any/All types
+
+
+// TARGET_TYPE_NONE = 0x00000000, ///< No type
+// TARGET_TYPE_SYSTEM = 0x00000001, ///< System type
+// TARGET_TYPE_DIMM = 0x00000002, ///< DIMM type
+// TARGET_TYPE_PROC_CHIP = 0x00000004, ///< Processor type
+// TARGET_TYPE_MEMBUF_CHIP = 0x00000008, ///< Membuf type
+// TARGET_TYPE_EX = 0x00000010, ///< Ex type
+// TARGET_TYPE_MBA = 0x00000020, ///< MBA type
+// TARGET_TYPE_MCS = 0x00000040, ///< MCS type
+// TARGET_TYPE_XBUS = 0x00000080, ///< XBUS type
+// TARGET_TYPE_ABUS = 0x00000100, ///< ABUS type
+// TARGET_TYPE_L4 = 0x00000200, ///< L4 type
+// TARGET_TYPE_CORE = 0x00000400, ///< Core type
+// TARGET_TYPE_EQ = 0x00000800, ///< EQ type
+// TARGET_TYPE_MCA = 0x00001000, ///< MCA type
+// TARGET_TYPE_MCBIST = 0x00002000, ///< MCBIST type
+// TARGET_TYPE_MIA = 0x00004000, ///< MIA type
+// TARGET_TYPE_MIS = 0x00008000, ///< MIS type
+// TARGET_TYPE_DMI = 0x00010000, ///< DMI type
+// TARGET_TYPE_OBUS = 0x00020000, ///< OBUS type
+// TARGET_TYPE_NV = 0x00040000, ///< NV bus type
+// TARGET_TYPE_SBE = 0x00080000, ///< SBE type
+// TARGET_TYPE_PPE = 0x00100000, ///< PPE type
+// TARGET_TYPE_PERV = 0x00200000, ///< Pervasive type
+// TARGET_TYPE_PEC = 0x00400000, ///< PEC type
+// TARGET_TYPE_PHB = 0x00800000, ///< PHB type
+// TARGET_TYPE_EQ_MC_WRITE = 0x01000000, ///< EQ Multicast Type
+// TARGET_TYPE_EQ_MC_READAND = 0x02000000, ///< EQ Multicast Read AND Type
+// TARGET_TYPE_EQ_MC_READOR = 0x04000000, ///< EQ Multicast Read OR Type
+// TARGET_TYPE_CORE_MC_WRITE = 0x08000000, ///< Core Multicast Type
+// TARGET_TYPE_CORE_MC_READAND = 0x10000000, ///< Core Multicast Read AND Type
+// TARGET_TYPE_CORE_MC_READOR = 0x20000000, ///< Core Multicast Read OR Type
+// TARGET_TYPE_CME_CORE0 = 0x40000000, ///< CME Core0 (CME only)
+// TARGET_TYPE_CME_CORE1 = 0x80000000, ///< CME Core1 (CME only)
+// TARGET_TYPE_ADDRESS = 0xAAAAAAAA, ///< Address Overlay Type
+// TARGET_TYPE_ALL = 0xFFFFFFFF, ///< Any/All types
+ };
+
+
+ /**
+ * @brief Typedef used when passing multiple TargetType values
+ */
+ typedef uint8_t TargetTypes_t;
+
+ /// @cond
+ constexpr TargetType operator|(TargetType x, TargetType y)
+ {
+ return static_cast<TargetType>(static_cast<int>(x) |
+ static_cast<int>(y));
+ }
+
+ template<uint64_t V>
+ class bitCount {
+ public:
+ // Don't use enums, too hard to compare
+ static const uint8_t count = bitCount<(V >> 1)>::count + (V & 1);
+ };
+
+ template<>
+ class bitCount<0> {
+ public:
+ static const uint8_t count = 0;
+ };
+ /// @endcond
+};
+
+#endif // __ASSEMBLER__
+#endif // __FAPI2_TARGET_TYPES__
diff --git a/hwpf/plat/include/utils.H b/hwpf/plat/include/utils.H
new file mode 100644
index 00000000..8a86e2ed
--- /dev/null
+++ b/hwpf/plat/include/utils.H
@@ -0,0 +1,56 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file utils.H
+ *
+ * @brief Defines common utility elements for FAPI2 use.
+ */
+
+#ifndef FAPI2_UTILS_H_
+#define FAPI2_UTILS_H_
+
+#ifdef __ASSEMBLER__
+
+#ifndef ULL
+#define ULL(x) x
+#endif
+
+#else
+
+#ifndef ULL
+#define ULL(x) x##ull
+
+#endif
+
+#endif // __ASSEMBLER
+
+/// Create a multi-bit mask of \a n bits starting at bit \a b
+#define BITS(b, n) ((ULL(0xffffffffffffffff) << (64 - (n))) >> (b))
+
+/// Create a single bit mask at bit \a b
+#define BIT(b) BITS((b), 1)
+
+
+#endif // FAPI2_UTILS_H_
diff --git a/hwpf/plat/include/variable_buffer.H b/hwpf/plat/include/variable_buffer.H
new file mode 100644
index 00000000..fa9e4a05
--- /dev/null
+++ b/hwpf/plat/include/variable_buffer.H
@@ -0,0 +1,670 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file variable_buffer.H
+ * @brief definitions for fapi2 variable length buffers
+ */
+
+#ifndef __FAPI2_VARIABLE_BUFFER__
+#define __FAPI2_VARIABLE_BUFFER__
+
+#include <buffer_base.H>
+
+namespace fapi2
+{
+ /// @brief Get a 32 bit mask quickly
+ // This is one of the main reasons we static_assert in the ctor's
+ // to ensure the unit_type is 32 bits.
+ inline uint32_t fast_mask32(int32_t i_pos, int32_t i_len)
+ {
+ // generates an arbitrary 32-bit mask using two operations, not too shabby
+
+ static const uint32_t l_mask32[] = {
+ 0x00000000,
+ 0x80000000, 0xC0000000, 0xE0000000, 0xF0000000,
+ 0xF8000000, 0xFC000000, 0xFE000000, 0xFF000000,
+ 0xFF800000, 0xFFC00000, 0xFFE00000, 0xFFF00000,
+ 0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
+ 0xFFFF8000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000,
+ 0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00, 0xFFFFFF00,
+ 0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0, 0xFFFFFFF0,
+ 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE, 0xFFFFFFFF,
+ };
+ return l_mask32[i_len] >> i_pos;
+ }
+
+ //
+ // General set a series of bits in the buffer.
+ //
+
+ ///
+ /// @cond
+ /// @brief Internal bit inserting method.
+ /// @tparam unit_type The type of a unit of the arrays
+ /// @tparam bits_type The type of the bit counting values
+ /// @param[in] i_source The incoming data
+ /// @param[in] i_source_length The length in bits of the incoming data
+ /// @param[in] i_target The outgoing data
+ /// @param[in] i_target_length The length in bits of the outgoing data
+ /// @param[in] i_source_start_bit The starting bit location in the
+ /// incoming data
+ /// @param[in] i_target_start_bit The starting bit position in this
+ /// @param[in] i_length The length, in bits, the user wants copied.
+ ///
+ template<typename unit_type, typename bits_type>
+ inline fapi2::ReturnCode _insert(const unit_type* i_source,
+ bits_type i_source_length,
+ unit_type* i_target,
+ bits_type i_target_length,
+ bits_type i_source_start_bit,
+ bits_type i_target_start_bit,
+ bits_type i_length)
+ {
+ const bits_type bits_per_unit = fapi2::parameterTraits<unit_type>::bit_length;
+
+ // tartgetStart is defaulted to the sizeof(target) - (sizeof(source) - i_source_start_bit)
+ // which makes this act like insert from right
+ if (i_target_start_bit == ~0)
+ {
+ i_target_start_bit = (i_target_length - (i_source_length - i_source_start_bit));
+ }
+
+ // len defaults to (sizeof(OT) * 8) - i_source_start_bit
+ if (i_length == ~0)
+ {
+ i_length = i_source_length - i_source_start_bit;
+ }
+
+ // Check for overflow
+ if ((i_length + i_target_start_bit > i_target_length) ||
+ (i_length + i_source_start_bit > i_source_length))
+ {
+ return fapi2::FAPI2_RC_OVERFLOW;
+ }
+
+ do
+ {
+ const bits_type src_idx = i_source_start_bit / bits_per_unit;
+ const bits_type trg_idx = i_target_start_bit / bits_per_unit;
+
+ // "slop" = unaligned bits
+ const bits_type src_slop = i_source_start_bit % bits_per_unit;
+ const bits_type trg_slop = i_target_start_bit % bits_per_unit;
+
+ // "cnt" = largest number of bits to be moved each pass
+ bits_type cnt = std::min(i_length, bits_per_unit);
+ cnt = std::min(cnt, bits_per_unit - src_slop);
+ cnt = std::min(cnt, bits_per_unit - trg_slop);
+
+ // generate the source mask only once
+ bits_type mask = fast_mask32(src_slop, cnt);
+
+ // read the source bits only once
+ bits_type src_bits = i_source[src_idx] & mask;
+
+ // "shift" = amount of shifting needed for target alignment
+ int32_t shift = trg_slop - src_slop;
+
+ // ideally (i << -1) would yield (i >> 1), but it
+ // doesn't, so we need an extra branch here
+
+ if (shift < 0)
+ {
+ src_bits <<= -shift;
+ mask <<= -shift;
+ }
+ else
+ {
+ src_bits >>= shift;
+ mask >>= shift;
+ }
+
+ // clear source '0' bits in the target
+ i_target[trg_idx] &= ~mask;
+ // set source '1' bits in the target
+ i_target[trg_idx] |= src_bits;
+
+ i_source_start_bit += cnt;
+ i_target_start_bit += cnt;
+
+ i_length -= cnt;
+ } while (0 < i_length);
+
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+ /// @endcond
+
+ /// @brief Class representing a FAPI variable_buffer.
+ /// @remark Variable buffers are buffers which can be variable in length
+ /// (and "odd sized.") These best represent the FAPI 1.X ecmdDataBuffer,
+ /// however they are implemented using the same template techniques
+ /// as the new fapi::buffer.
+ /// @note Variable buffers are not (presently) declared as std::bitset
+ /// as bitsets' size is fixed at runtime. It is not clear if this is
+ /// acceptable for variable_buffers at this time.
+ /// @note Variable buffers are not (presently) declared as std::vector<bool>
+ /// as it would need to be implemented separate from std::vector, and
+ /// it's not clear it would give us any real advantage. Howevever, its is
+ /// more likely this will become a std::vector<bool> than a std::bitset.
+ class variable_buffer : public buffer_base<bits_container>
+ {
+
+ public:
+
+ ///
+ /// @brief Variable buffer constructor
+ /// @param[in] i_value number of *bits* (sizeof(uint_type) * 8)
+ /// needed.
+ variable_buffer(bits_type i_value = 0);
+
+ ///
+ /// @brief Variable buffer list constructor
+ /// @param[in] i_value an initializer list to initialize the container.
+ ///
+ variable_buffer(const std::initializer_list<unit_type>& i_value);
+
+ /// @name Bit/Word Manipulation Functions
+ ///@{
+
+ ///
+ /// @brief Return the length of the buffer in bits
+ /// @return Length in bits
+ ///
+ inline uint32_t getBitLength(void) const
+ { return iv_perceived_bit_length; }
+
+ ///
+ /// @brief Return the length of the buffer in OT units
+ /// @return Length in OT units rounded up
+ /// @tparam OT the type to get the length of. For example, if one
+ /// wanted the length in double words, OT would be uint64_t
+ /// (getLength<uint64_t>().) Similarly, to get the length in words,
+ /// getLength<uin32_t>().
+ ///
+ template< typename OT >
+ inline uint32_t getLength(void) const
+ {
+ static const uint32_t bits_in_ot = sizeof(OT) * 8;
+ return (getBitLength() + (bits_in_ot - 1)) / bits_in_ot;
+ }
+
+ ///
+ /// @brief Set a bit in the buffer
+ /// @param[in] i_bit the bit number to set.
+ /// @note 0 is left-most
+ /// @return FAPI2_RC_SUCCESS if OK
+ ///
+ inline fapi2::ReturnCode setBit(const bits_type& i_bit)
+ {
+ const bits_type index = i_bit / bits_per_unit;
+
+ if (index > iv_data.size())
+ {
+ return FAPI2_RC_INVALID_PARAMETER;
+ }
+
+
+/// @todo: check with Brian no the correct parens
+ iv_data[index] |=
+ unit_type(1) << ((bits_per_unit - 1) -
+ (i_bit - (index * bits_per_unit)));
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ ///
+ /// @brief Clear a bit in buffer
+ /// @tparam SB Start bit in buffer to clear.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// clear
+ /// @return FAPI2_RC_SUCCESS on success
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type SB, bits_type L >
+ fapi2::ReturnCode clearBit(void);
+
+ ///
+ /// @brief Invert bit
+ /// @tparam SB Start bit in buffer to invert.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// invert, defaults to 1
+ /// @return FAPI2_RC_SUCCESS on success
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ fapi2::ReturnCode flipBit(void);
+
+ ///
+ /// @brief Get the value of a bit in the buffer
+ /// @tparam B Bit in buffer to get.
+ /// @return true/1 if bit is on, false/0 if bit is off
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ ///
+ template< bits_type B >
+ inline bool getBit(void) const
+ {
+ const bits_type index = B / bits_per_unit;
+ const unit_type mask = unit_type(1) << (bits_per_unit - 1) - (B - (index * bits_per_unit));
+ return iv_data[index] & mask;
+ }
+
+ ///
+ /// @brief Test if multiple bits are set
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return true if all bits in range are set - false if any
+ /// bit is clear
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bool isBitSet(void) const;
+
+ ///
+ /// @brief Test if multiple bits are clear
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return true if bit is clear - false if bit is set
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bool isBitClear(void) const;
+
+ ///
+ /// @brief Count number of bits set in a range
+ /// @tparam SB Start bit in buffer to test.
+ /// @tparam L Number of consecutive bits from start bit to
+ /// test, defaults to 1
+ /// @note Asserting that all the parameters are known at
+ /// compile time so this can be templated only. If that is not
+ /// the case we can add a function parameter version.
+ /// @return Number of bits set in range
+ ///
+ template< bits_type SB, bits_type L = 1 >
+ bits_type getNumBitsSet(void) const;
+
+ ///@}
+
+ /// @name Buffer Manipulation Functions
+ ///@{
+
+ // Note: Many (all?) of these are not needed and the compiler complains
+ // as the cast to T yields a better operator. There are here mainly for
+ // documenation purposes.
+
+ ///
+ /// @brief operator>>()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator>>(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator<<()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator<<(bits_type i_shiftnum);
+#endif
+
+ ///
+ /// @brief operator+()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator+(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator+=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator+=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator|=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator&=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator|()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator|(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator&()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator&(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator^=()
+ ///
+#ifdef DOXYGEN
+ variable_buffer<T>& operator^=(const T& rhs);
+#endif
+
+ ///
+ /// @brief operator!=()
+ ///
+#ifdef DOXYGEN
+ bool operator!=(const T& rhs) const;
+#endif
+
+ ///
+ /// @brief operator==()
+ /// @return true if and only if lhs == rhs
+ ///
+ inline bool operator==(const fapi2::bits_container& rhs) const
+ {
+ if (&iv_data == &rhs)
+ {
+ return true;
+ }
+
+ return iv_data == rhs;
+ }
+
+ ///
+ /// @brief Copy part of an element into the DataBuffer
+ /// @param[in] i_data OT value to copy into DataBuffer
+ /// @param[in] i_targetStart The position in this where the copy starts
+ /// @param[in] i_len How many bits to copy
+ /// @param[in] i_sourceStart The start positon in i_data, defaults to 0
+ /// @return FAPI2_RC_SUCCESS on success, FAPi2_RC_OVERFLOW otherwise
+ ///
+ template<typename OT>
+ fapi2::ReturnCode insert(const OT& i_data,
+ bits_type i_targetStart = 0,
+ bits_type i_len = ~0,
+ bits_type i_sourceStart = 0);
+
+ ///
+ /// @brief Copy in a right aligned (decimal) element
+ /// @param[in] i_data the incoming data
+ /// - data is taken right aligned
+ /// @param[in] i_targetStart The starting bit position in this
+ /// - Defaultst to 0
+ /// @param[in] i_len The length, in bits, the user wants copied.
+ /// - Defaults to all of the bits in the source which fit
+ /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise
+ ///
+ template<typename OT>
+ fapi2::ReturnCode insertFromRight(const OT& i_data,
+ bits_type i_targetStart = 0,
+ bits_type i_len = ~0);
+
+ ///
+ /// @brief Copy data from this buffer into an OT
+ /// @tparam OT the type of the outgoing data
+ /// @param[out] o_out OT to copy into - data is placed left aligned
+ /// @param[in] i_start Start bit to copy from - defaults to 0
+ /// @param[in] i_len Length of bits to copy - defaults to filling o_out
+ /// @return FAPI2_RC_SUCCESS on success
+ ///
+ template< typename OT >
+ fapi2::ReturnCode extract(OT& o_out,
+ bits_type i_start = 0,
+ bits_type i_len = ~0) const;
+
+ ///
+ /// @brief Copy data from this buffer into an OT and right justify
+ /// @tparam OT the type of the outgoing data
+ /// @param[out] o_out OT to copy into - data is placed right aligned
+ /// @param[in] i_start Start bit to copy from - defaults to 0
+ /// @param[in] i_len Length of bits to copy - defaults to filling o_out
+ /// @return FAPI2_RC_SUCCESS on success
+ ///
+ template< typename OT >
+ fapi2::ReturnCode extractToRight(OT& o_out,
+ bits_type i_start = 0,
+ bits_type i_len = ~0) const;
+ ///@}
+
+ private:
+ // Just shorthand ...
+ static const bits_type bits_per_unit =
+ bufferTraits<bits_container>::bits_per_unit;
+
+ // The number of bits the user asked for. The actual size of the
+ // container might be larger.
+ bits_type iv_perceived_bit_length;
+
+ ///
+ /// @brief Internal bit extraction method.
+ /// @tparam OT The type of the destination
+ /// @param[in] i_start The starting bit position in this
+ /// @param[in] i_count The length, in bits, the user wants copied.
+ /// @param[out] o_dest Where to put the data
+ ///
+ template< typename OT >
+ fapi2::ReturnCode _extract(bits_type i_start,
+ bits_type i_count,
+ OT* o_dest) const;
+
+ ///
+ /// @brief Internal insertFromRight
+ /// @param[in] i_data, the incoming data
+ /// @param[in] i_data_length The length in bits of the incoming data
+ /// @param[in] i_target_start_bit The starting bit position in this
+ /// @param[in] i_length The length, in bits, the user wants copied.
+ ///
+ template<typename OT>
+ fapi2::ReturnCode _insertFromRight(const OT& i_data,
+ bits_type i_data_length,
+ bits_type i_targetStart,
+ bits_type i_len);
+
+ };
+
+ inline variable_buffer::
+ variable_buffer(bits_type i_value):
+ buffer_base(i_value),
+ iv_perceived_bit_length(i_value)
+ {
+ static_assert(std::is_same<unit_type, uint32_t>::value,
+ "code currently needs unit_type to be a unit32_t");
+ }
+
+ inline variable_buffer::
+ variable_buffer(const std::initializer_list<unit_type>& i_value):
+ buffer_base(i_value),
+ iv_perceived_bit_length(i_value.size() * sizeof(unit_type) * 8)
+ {
+ static_assert(std::is_same<unit_type, uint32_t>::value,
+ "code currently needs unit_type to be a unit32_t");
+ }
+
+
+
+ /// @cond
+ //
+ // Generic insert
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::insert(const OT& i_source,
+ bits_type i_targetStart,
+ bits_type i_len,
+ bits_type i_sourceStart)
+ {
+ return _insert((unit_type*)(&i_source), parameterTraits<OT>::bit_length,
+ &(iv_data[0]), getBitLength(),
+ i_sourceStart, i_targetStart, i_len);
+ }
+
+ //
+ // Insert another variable_bufer
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::insert(
+ const variable_buffer& i_data,
+ bits_type i_targetStart,
+ bits_type i_len,
+ bits_type i_sourceStart)
+ {
+ return _insert((unit_type*)&(i_data()[0]), i_data.getBitLength(),
+ &(iv_data[0]), getBitLength(),
+ i_sourceStart, i_targetStart, i_len);
+ }
+
+ //
+ // Generic insert from right
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::insertFromRight(
+ const OT& i_data,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ /// @todo check with Brian on additional return
+ return _insertFromRight(i_data, parameterTraits<OT>::bit_length, i_targetStart, i_len);
+ }
+
+ //
+ // variable_buffer insert from right
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::insertFromRight(
+ const variable_buffer& i_data,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ const bits_type bit_length_of_source = i_data.getBitLength();
+ /// @todo check with Brian on additional return
+ return _insertFromRight(i_data, bit_length_of_source, i_targetStart, i_len);
+ }
+
+
+
+
+ //
+ // Generic extract. Extract is an insert with the arguments reversed.
+ //
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::extract(
+ OT& i_data,
+ bits_type i_start,
+ bits_type i_len) const
+ {
+ // Needed to trick the compiler into matching the template below
+ const bits_type max_length = parameterTraits<OT>::bit_length;
+
+ // If thy didn't pass an i_len, assume they want all the data
+ // which will fit.
+ if (i_len == ~0)
+ {
+ i_len = max_length;
+ }
+
+ return _insert((container_unit*)&iv_data[0], getBitLength(),
+ &i_data, max_length,
+ i_start, 0U, i_len);
+ }
+
+ //
+ // Extract in to another variable_bufer
+ //
+ template<>
+ inline fapi2::ReturnCode variable_buffer::extract(
+ variable_buffer& i_data,
+ bits_type i_start,
+ bits_type i_len) const
+ {
+ // If thy didn't pass an i_len, assume they want all the data
+ // which will fit.
+ // @todo Needed to add (bits_type) to compile. Not clear why this is
+ // different than other similar comparisons
+ // error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
+ if ( i_len == ~(bits_type)0 )
+ {
+ i_len = i_data.getBitLength();
+ }
+ return _insert((container_unit*)&iv_data[0], getBitLength(),
+ &(i_data()[0]), i_data.getBitLength(),
+ i_start, 0U, i_len);
+ }
+
+
+
+ template<typename OT>
+ inline fapi2::ReturnCode variable_buffer::_insertFromRight(
+ const OT& i_data,
+ bits_type i_data_length,
+ bits_type i_targetStart,
+ bits_type i_len)
+ {
+ // If they didn't pass in a length, assume they want all the i_data
+ // which will fit.
+ if( i_len == ~0 )
+ {
+ // The longest the length can be is the length of the data
+ // This is the miniumum of the length of the data or the
+ // number of available bits
+ i_len = std::min(i_data_length, getBitLength() - i_targetStart);
+ }
+
+ // Source start is the length, counted from the right
+ return insert(i_data, i_targetStart, i_len, i_data_length - i_len);
+ }
+
+ //
+ // Invalid specializations of set
+ //
+ /// @cond
+ // Sepcialize the variable_buffer version to to "undefined" so the
+ // linker complains loudly if anyone calls it.
+#if 0
+ template<>
+ inline fapi2::ReturnCode buffer_base::set(
+ const variable_buffer& i_value,
+ bits_type i_offset);
+#endif
+ /// @endcond
+};
+
+
+#endif
diff --git a/hwpf/plat/src/Makefile b/hwpf/plat/src/Makefile
new file mode 100644
index 00000000..ed98e93f
--- /dev/null
+++ b/hwpf/plat/src/Makefile
@@ -0,0 +1,21 @@
+# This Makefile is designed to be invoked with the -I argument set to
+# the location of the "pk.mk" for the build
+
+include img_defs.mk
+include fapi2ppefiles.mk
+
+
+OBJS := $(addprefix $(OBJDIR)/, $(FAPI2LIB_OBJECTS))
+
+all: $(OBJS)
+
+
+$(OBJS) $(OBJS:.o=.d): | $(OBJDIR)
+
+$(OBJDIR):
+ mkdir -p $(OBJDIR)
+
+ifneq ($(MAKECMDGOALS),clean)
+include $(OBJS:.o=.d)
+endif
+
diff --git a/hwpf/plat/src/array.C b/hwpf/plat/src/array.C
new file mode 100644
index 00000000..340d8d2f
--- /dev/null
+++ b/hwpf/plat/src/array.C
@@ -0,0 +1,145 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 */
+/**
+ * @file array.C
+ * @brief fapi2 arrays
+ */
+
+#include <stdint.h>
+#include <array.H>
+
+namespace fapi2
+{
+ /// @brief Create an array
+ array::array(const uint32_t i_size, element_type* i_data):
+ iv_size(i_size),
+ iv_data(i_data)
+ {
+#ifdef GREG
+ assert(iv_size <= size_limit);
+ if (iv_data == nullptr)
+ {
+ iv_data = new element_type[iv_size]();
+ iv_size |= delete_bit;
+ }
+#endif
+ // If the caller passed in a pointer, leave it be. Don't
+ // initialize it or anything. That will allow a placement
+ // operation where generic memory can use fapi2::array
+ // methods without much overhead.
+ }
+
+ /// @brief Destroy an array
+ array::~array(void)
+ {
+ if ((iv_size & delete_bit) != 0)
+ {
+#ifdef GREG
+ delete[] iv_data;
+#endif
+ }
+ }
+
+ /// @brief operator[]
+ array::element_type& array::operator[](const uint32_t i_index)
+ {
+#ifdef GREG
+ assert(i_index < size());
+#endif
+ return iv_data[i_index];
+ }
+
+ /// @brief operator=()
+ array& array::operator=(const array& i_other)
+ {
+#ifdef GREG
+ // Check to make sure it'll fit.
+ assert(i_other.size() <= size());
+#endif
+ // Our new size will be the other's size.
+ // Save of whether we should delete our iv_data ...
+ uint64_t l_our_delete_state = iv_size | delete_bit;
+
+ // ... our new size is the size (minus the delete state) of i_other
+ iv_size = i_other.size();
+
+ // ... do the copy ...
+#ifdef GREG
+ memcpy(iv_data, i_other.iv_data, iv_size * sizeof(element_type));
+#else
+ for(size_t i = 0; i < iv_size * sizeof(element_type); ++i)
+ {
+ iv_data[i] = i_other.iv_data[i];
+ }
+#endif
+
+ // ... and record our old delete state.
+ iv_size |= l_our_delete_state;
+
+ return *this;
+ }
+
+ /// @brief move operator=()
+ array& array::operator=(array&& i_other)
+ {
+ iv_size = i_other.iv_size;
+
+ // Make sure to clear the delete bit in the other. We
+ // don't want our memory to be deleted.
+ i_other.iv_size = i_other.size();
+
+ iv_data = std::move(i_other.iv_data);
+ return *this;
+ }
+
+ /// @brief operator==()
+ bool array::operator==(const array& i_other)
+ {
+ // If they're not the same size, they're not the same
+ if (size() != i_other.size())
+ {
+ return false;
+ }
+
+ // If they're the same size and point to the same memory, they're the same.
+ if (iv_data == i_other.iv_data)
+ {
+ return true;
+ }
+
+ auto oitr = i_other.begin();
+ auto iter = begin();
+
+ for(; iter != end(); ++iter, ++oitr)
+ {
+ if (*iter != *oitr)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/hwpf/plat/src/error_info.C b/hwpf/plat/src/error_info.C
new file mode 100644
index 00000000..9d44eb58
--- /dev/null
+++ b/hwpf/plat/src/error_info.C
@@ -0,0 +1,410 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file error_info.C
+ * @brief Implements the error information classes
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <plat_trace.H>
+#include <error_info.H>
+#include <buffer.H>
+
+namespace fapi2
+{
+ ///
+ /// @brief Constructor
+ ///
+ /// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
+ /// @param[in] i_pFfdc Pointer to the FFDC to copy
+ /// @param[in] i_size Size of the FFDC to copy
+ ///
+ ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId,
+ const void* i_pFfdc,
+ const uint32_t i_size):
+ iv_ffdcId(i_ffdcId),
+ iv_size(i_size)
+ {
+ iv_pFfdc = std::shared_ptr<uint8_t>(new uint8_t[i_size]());
+
+ // If they passed us a NULL pointer they want to fill
+ // in the data themselves later.
+ if (i_pFfdc != nullptr)
+ {
+ memcpy(iv_pFfdc.get(), i_pFfdc, i_size);
+ }
+ }
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_hw Hardware to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ /// @param[in] i_refTarget Reference to reference target
+ ///
+ ErrorInfoHwCallout::ErrorInfoHwCallout(
+ const HwCallouts::HwCallout i_hw,
+ const CalloutPriorities::CalloutPriority i_calloutPriority,
+ const Target<TARGET_TYPE_ALL> & i_refTarget):
+ iv_hw(i_hw),
+ iv_calloutPriority(i_calloutPriority),
+ iv_refTarget(i_refTarget)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_procedure Procedure to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoProcedureCallout::ErrorInfoProcedureCallout(
+ const ProcedureCallouts::ProcedureCallout i_procedure,
+ const CalloutPriorities::CalloutPriority i_calloutPriority):
+ iv_procedure(i_procedure),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target1 Reference to target on one end of the bus
+ /// @param[in] i_target2 Reference to target on other end of the bus
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoBusCallout::ErrorInfoBusCallout(
+ const Target<TARGET_TYPE_ALL> & i_target1,
+ const Target<TARGET_TYPE_ALL> & i_target2,
+ const CalloutPriorities::CalloutPriority i_calloutPriority):
+ iv_target1(i_target1),
+ iv_target2(i_target2),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target Reference to the target to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ ///
+ ErrorInfoCDG::ErrorInfoCDG(
+ const Target<TARGET_TYPE_ALL> & i_target,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority):
+ iv_target(i_target),
+ iv_callout(i_callout),
+ iv_calloutPriority(i_priority),
+ iv_deconfigure(i_deconfigure),
+ iv_gard(i_gard)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_parent Reference to the parent target
+ /// @oaram[in] i_childType Child target type to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ /// @param[in] i_childPort Child Port
+ /// For DIMM children, the MBA port number
+ /// @param[in] i_childNum Child Number
+ /// For DIMM children, the dimm socket number
+ /// For Chip children, the chip position
+ /// For Chiplet children, the chiplet unit pos
+ ///
+ ErrorInfoChildrenCDG::ErrorInfoChildrenCDG(
+ const Target<TARGET_TYPE_ALL> & i_parentChip,
+ const TargetType i_childType,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority,
+ const uint8_t i_childPort, const uint8_t i_childNum):
+ iv_parent(i_parentChip),
+ iv_childType(i_childType),
+ iv_callout(i_callout),
+ iv_calloutPriority(i_priority),
+ iv_deconfigure(i_deconfigure),
+ iv_gard(i_gard),
+ iv_childPort(i_childPort),
+ iv_childNumber(i_childNum)
+ {}
+
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_trace
+ ///
+ ErrorInfoCollectTrace::ErrorInfoCollectTrace(
+ CollectTraces::CollectTrace i_traceId):
+ iv_eiTraceId(i_traceId)
+ {}
+
+
+ ///
+ /// @brief Collect target, buffer or generic FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryFfdc::addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_objects) const
+ {
+ // "variable buffer ffdc not yet implemented");
+ assert(iv_ffdcSize != EI_FFDC_SIZE_VBUF);
+
+ switch(iv_ffdcSize)
+ {
+ case EI_FFDC_SIZE_BUF:
+ {
+ const buffer<uint64_t>* object =
+ static_cast<const buffer<uint64_t>*>(i_objects[iv_ffdcObjIndex]);
+
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(
+ new ErrorInfoFfdc(iv_ffdcId, object,
+ sizeof(object))));
+
+ FAPI_DBG("addErrorInfo: Adding buffer id: 0x%x size: %lu buf: 0x%lx",
+ iv_ffdcId, sizeof(object), uint64_t(*object));
+ }
+ break;
+
+ case EI_FFDC_SIZE_TARGET:
+ {
+ Target<TARGET_TYPE_ALL> object =
+ *(static_cast<const Target<TARGET_TYPE_ALL>*>
+ (i_objects[iv_ffdcObjIndex]));
+
+ // Allocate an ErrorInfoFfdc but don't copy anything in to it.
+ // We can copy the target string once if we copy directly into
+ // the error info
+ ErrorInfoFfdc* e =
+ new ErrorInfoFfdc(iv_ffdcId, nullptr, MAX_ECMD_STRING_LEN);
+
+ toString(object, static_cast<char*>(e->getData()),
+ MAX_ECMD_STRING_LEN);
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(e));
+
+ FAPI_DBG("addErrorInfo: Adding target ffdc id: 0x%x %s",
+ iv_ffdcId, static_cast<char*>(e->getData()));
+ }
+ break;
+
+ default:
+ i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(
+ new ErrorInfoFfdc(
+ iv_ffdcId,
+ i_objects[iv_ffdcObjIndex],
+ iv_ffdcSize)));
+ FAPI_DBG("addErrorInfo: Adding ffdc id 0x%x size: %d",
+ iv_ffdcId, iv_ffdcSize);
+ break;
+
+ };
+
+ return;
+ }
+
+ ///
+ /// @brief Collect h/w callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryHwCallout::addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // If the index is 0xFF, we use an empty target. Otherwise the
+ // target is taken from the object arrary with the given index.
+ const fapi2::Target<TARGET_TYPE_ALL> target =
+ iv_refObjIndex == 0xFF ?
+ fapi2::Target<TARGET_TYPE_ALL>() :
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_refObjIndex]));
+
+ ErrorInfoHwCallout* ei = new ErrorInfoHwCallout(
+ static_cast<HwCallouts::HwCallout>(iv_hw),
+ static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority),
+ target);
+
+ FAPI_DBG("addErrorInfo: Adding hw callout target: 0x%lx hw: %d, pri: %d",
+ ei->iv_refTarget.get(), ei->iv_hw, ei->iv_calloutPriority);
+
+ i_info->iv_hwCallouts.push_back(std::shared_ptr<ErrorInfoHwCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect proc callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryProcCallout::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* ) const
+ {
+ ErrorInfoProcedureCallout* ei = new ErrorInfoProcedureCallout(
+ static_cast<ProcedureCallouts::ProcedureCallout>(iv_procedure),
+ static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority));
+
+ // Add the ErrorInfo
+ FAPI_DBG("addErrorInfo: Adding proc callout, proc: %d, pri: %d",
+ ei->iv_procedure, ei->iv_calloutPriority);
+
+ i_info->iv_procedureCallouts.push_back(
+ std::shared_ptr<ErrorInfoProcedureCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect bus callout FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryBusCallout::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // We need to add a procedure callout as well as a bus callout
+ ErrorInfoEntryProcCallout(ProcedureCallouts::BUS_CALLOUT,
+ iv_calloutPriority).addErrorInfo(i_info,
+ i_object);
+
+ // Now add our bus callout, but drop the priority by one.
+ ErrorInfoBusCallout* ei = new ErrorInfoBusCallout(
+ // First target
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_endpoint1ObjIndex])),
+
+ // Second target
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_endpoint2ObjIndex])),
+
+ // Priority, one lower.
+ (iv_calloutPriority == CalloutPriorities::HIGH) ?
+ CalloutPriorities::MEDIUM : CalloutPriorities::LOW);
+
+ FAPI_DBG("addErrorInfo: Adding bus callout t1: 0x%lx t2: 0x%lx, pri: %d",
+ ei->iv_target1.get(), ei->iv_target2.get(),
+ ei->iv_calloutPriority);
+
+ i_info->iv_busCallouts.push_back(
+ std::shared_ptr<ErrorInfoBusCallout>(ei));
+ }
+
+ ///
+ /// @brief Collect h/w target cdg FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryTargetCDG::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoCDG* ei = new
+ ErrorInfoCDG(
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_targetObjIndex])),
+ iv_callout,
+ iv_deconfigure,
+ iv_gard,
+ static_cast<CalloutPriorities::CalloutPriority>
+ (iv_calloutPriority)
+ );
+
+ FAPI_DBG("addErrorInfo: Adding target 0x%lx cdg (%d:%d:%d), pri: %d",
+ ei->iv_target.get(),
+ ei->iv_callout, ei->iv_deconfigure,
+ ei->iv_gard, ei->iv_calloutPriority);
+
+ // Add the ErrorInfo
+ i_info->iv_CDGs.push_back(std::shared_ptr<ErrorInfoCDG>(ei));
+ }
+
+ ///
+ /// @brief Collect h/w children cdg FFDC information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryChildrenCDG::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ ErrorInfoChildrenCDG* ei = new ErrorInfoChildrenCDG(
+ *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*>
+ (i_object[iv_parentObjIndex])),
+ static_cast<fapi2::TargetType>(iv_childType),
+ iv_callout,
+ iv_deconfigure,
+ iv_gard,
+ static_cast<CalloutPriorities::CalloutPriority>
+ (iv_calloutPriority),
+ iv_childPort,
+ iv_childNumber);
+
+ FAPI_DBG("addErrorInfo: Adding children cdg (%d:%d:%d), type:"
+ " 0x%08x, pri: %d",
+ ei->iv_callout, ei->iv_deconfigure, ei->iv_gard,
+ ei->iv_childType, ei->iv_calloutPriority);
+
+ // Add the ErrorInfo
+ i_info->iv_childrenCDGs.push_back(
+ std::shared_ptr<ErrorInfoChildrenCDG>(ei));
+ }
+
+ ///
+ /// @brief Collect trace information to this ffdc
+ /// object
+ /// @param[in] A pointer to the error info we're collecting
+ /// @param[in] A pointer to the objects
+ /// @return void
+ ///
+ void ErrorInfoEntryCollectTrace::addErrorInfo(
+ std::shared_ptr<ErrorInfo> i_info,
+ const void* const* ) const
+ {
+ ErrorInfoCollectTrace* ei = new ErrorInfoCollectTrace(
+ static_cast<CollectTraces::CollectTrace>(iv_eieTraceId));
+
+ FAPI_DBG("addErrorInfo: Adding trace: 0x%x", ei->iv_eiTraceId);
+
+ // Add the ErrorInfo
+ i_info->iv_traces.push_back(std::shared_ptr<ErrorInfoCollectTrace>(ei));
+ }
+
+};
diff --git a/hwpf/plat/src/fapi2ppefiles.mk b/hwpf/plat/src/fapi2ppefiles.mk
new file mode 100644
index 00000000..cc391157
--- /dev/null
+++ b/hwpf/plat/src/fapi2ppefiles.mk
@@ -0,0 +1,24 @@
+# @file fapi2ppefiles.mk
+#
+# @brief mk for including fapi2 object files
+#
+# @page ChangeLogs Change Logs
+# @section fapi2ppefiles.mk
+# @verbatim
+#
+#
+# Change Log ******************************************************************
+# Flag Defect/Feature User Date Description
+# ------ -------------- ---------- ------------ -----------
+#
+# @endverbatim
+#
+##########################################################################
+# Object Files
+##########################################################################
+
+FAPI2-C-SOURCES = fapi2PlatAttributeService.C
+FAPI2-S-SOURCES =
+
+FAPI2LIB_OBJECTS += $(FAPI2-C-SOURCES:.C=.o) $(FAPI2-S-SOURCES:.S=.o)
+
diff --git a/hwpf/plat/src/ffdc.C b/hwpf/plat/src/ffdc.C
new file mode 100644
index 00000000..efe922ea
--- /dev/null
+++ b/hwpf/plat/src/ffdc.C
@@ -0,0 +1,57 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file ffdc.C
+ * @brief Implements the FirstFailureData class
+ */
+
+#include <plat_trace.H>
+#include <ffdc.H>
+#include <error_info.H>
+
+namespace fapi2
+{
+
+ ///
+ /// @brief Add error information to this ffdc object
+ /// @param[in] A pointer to a list of objects
+ /// @param[in] A pointer to the list of entries
+ /// @param[in] The count of how many entries there are
+ /// @return void
+ ///
+ template<>
+ void FirstFailureData<ReturnCode>::addErrorInfo(
+ const void* const* i_pObjects,
+ const ErrorInfoEntry* i_pEntries,
+ const uint8_t i_count)
+ {
+ FAPI_DBG("%d entries", i_count);
+ for (uint32_t i = 0; i < i_count; i++)
+ {
+ i_pEntries[i].addErrorInfo(iv_info, i_pObjects);
+ }
+ }
+
+
+
+};
diff --git a/hwpf/plat/src/plat_utils.C b/hwpf/plat/src/plat_utils.C
new file mode 100644
index 00000000..bc23c4b5
--- /dev/null
+++ b/hwpf/plat/src/plat_utils.C
@@ -0,0 +1,135 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* 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 */
+/**
+ * @file plat_utils.C
+ * @brief Implements fapi2 common utilities
+ */
+
+#include <stdint.h>
+#include <plat_trace.H>
+#include <return_code.H>
+#include <error_info.H>
+
+namespace fapi2
+{
+ ///
+ /// @brief Log an error.
+ ///
+ void logError(
+ fapi2::ReturnCode & io_rc,
+ fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE,
+ bool i_unitTestError = false )
+ {
+ // To keep the compiler from complaing about i_sevbeing unused.
+ static_cast<void>(i_sev);
+ static_cast<void>(i_unitTestError);
+
+ FAPI_DBG("logging 0x%lx.", uint64_t(io_rc));
+
+ // Iterate over the vectors and output what is in them.
+ const ErrorInfo* ei = io_rc.getErrorInfo();
+
+ FAPI_DBG("ffdcs: %lu", ei->iv_ffdcs.size());
+ for( auto i = ei->iv_ffdcs.begin(); i != ei->iv_ffdcs.end(); ++i )
+ {
+ uint32_t sz;
+ (*i)->getData(sz);
+ FAPI_DBG("\tid: 0x%x size %d", (*i)->getFfdcId(), sz);
+ }
+
+ FAPI_DBG("hwCallouts: %lu", ei->iv_hwCallouts.size());
+ for( auto i = ei->iv_hwCallouts.begin(); i != ei->iv_hwCallouts.end();
+ ++i )
+ {
+ FAPI_DBG("\thw: %d pri %d target: 0x%lx",
+ (*i)->iv_hw, (*i)->iv_calloutPriority,
+ (*i)->iv_refTarget.get());
+ }
+
+ FAPI_DBG("procedureCallouts: %lu", ei->iv_procedureCallouts.size());
+ for( auto i = ei->iv_procedureCallouts.begin();
+ i != ei->iv_procedureCallouts.end(); ++i )
+ {
+ FAPI_DBG("\tprocedure: %d pri %d",
+ (*i)->iv_procedure, (*i)->iv_calloutPriority);
+ }
+
+ FAPI_DBG("busCallouts: %lu", ei->iv_busCallouts.size());
+ for( auto i = ei->iv_busCallouts.begin(); i != ei->iv_busCallouts.end();
+ ++i )
+ {
+ FAPI_DBG("\tbus: t1: 0x%lx t2: 0x%lx pri: %d",
+ (*i)->iv_target1.get(), (*i)->iv_target2.get(),
+ (*i)->iv_calloutPriority);
+ }
+
+
+ FAPI_DBG("cdgs: %lu", ei->iv_CDGs.size());
+ for( auto i = ei->iv_CDGs.begin(); i != ei->iv_CDGs.end(); ++i )
+ {
+ FAPI_DBG("\ttarget: 0x%lx co: %d dc: %d gard: %d pri: %d",
+ (*i)->iv_target.get(),
+ (*i)->iv_callout,
+ (*i)->iv_deconfigure,
+ (*i)->iv_gard,
+ (*i)->iv_calloutPriority);
+
+ }
+
+ FAPI_DBG("childrenCDGs: %lu", ei->iv_childrenCDGs.size());
+ for( auto i = ei->iv_childrenCDGs.begin();
+ i != ei->iv_childrenCDGs.end(); ++i )
+ {
+ FAPI_DBG("\tchildren: parent 0x%lx co: %d dc: %d gard: %d pri: %d",
+ (*i)->iv_parent.get(),
+ (*i)->iv_callout,
+ (*i)->iv_deconfigure,
+ (*i)->iv_gard,
+ (*i)->iv_calloutPriority);
+ }
+
+ FAPI_DBG("traces: %lu", ei->iv_traces.size());
+ for( auto i = ei->iv_traces.begin(); i != ei->iv_traces.end(); ++i )
+ {
+ FAPI_DBG("\ttraces: 0x%x", (*i)->iv_eiTraceId);
+ }
+
+ // Release the ffdc information now that we're done with it.
+ io_rc.forgetData();
+
+ }
+
+ ///
+ /// @brief Delay this thread.
+ ///
+ ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles)
+ {
+ // void statements to keep the compiler from complaining
+ // about unused variables.
+ static_cast<void>(i_nanoSeconds);
+ static_cast<void>(i_simCycles);
+
+ // replace with platform specific implementation
+ return FAPI2_RC_SUCCESS;
+ }
+};
diff --git a/hwpf/plat/src/target.C b/hwpf/plat/src/target.C
new file mode 100644
index 00000000..fc5f4392
--- /dev/null
+++ b/hwpf/plat/src/target.C
@@ -0,0 +1,35 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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 <target.H>
+
+namespace fapi2
+{
+ std::vector Target::getChildren(void) const
+
+};
+
+
+
diff --git a/hwpf/plat/target_map b/hwpf/plat/target_map
new file mode 100755
index 00000000..4ea3c0d6
--- /dev/null
+++ b/hwpf/plat/target_map
@@ -0,0 +1,49 @@
+ TARGET_TYPE_NONE = 0x00000000,
+ TARGET_TYPE_SYSTEM = 0x00000001,
+ TARGET_TYPE_DIMM = 0x00000002,
+ TARGET_TYPE_PROC_CHIP = 0x00000004,
+ TARGET_TYPE_MEMBUF_CHIP = 0x00000008,
+ TARGET_TYPE_EX = 0x00000010,
+ TARGET_TYPE_MBA = 0x00000020,
+ TARGET_TYPE_MCS = 0x00000040,
+ TARGET_TYPE_XBUS = 0x00000080,
+ TARGET_TYPE_ABUS = 0x00000100,
+ TARGET_TYPE_L4 = 0x00000200,
+ TARGET_TYPE_CORE = 0x00000400,
+ TARGET_TYPE_EQ = 0x00000800,
+ TARGET_TYPE_MCA = 0x00001000,
+ TARGET_TYPE_MCBIST = 0x00002000,
+ TARGET_TYPE_MIA = 0x00004000,
+ TARGET_TYPE_MIS = 0x00008000,
+ TARGET_TYPE_DMI = 0x00010000,
+ TARGET_TYPE_OBUS = 0x00020000,
+ TARGET_TYPE_NV = 0x00040000,
+ TARGET_TYPE_SBE = 0x00080000,
+ TARGET_TYPE_PPE = 0x00100000,
+ TARGET_TYPE_PERV = 0x00200000,
+ TARGET_TYPE_PEC = 0x00400000,
+ TARGET_TYPE_PHB = 0x00800000,
+ TARGET_TYPE_ALL = 0xFFFFFFFF
+
+
+ Perv 0x01
+N0 0x02
+N1 0x03
+N2 0x04
+N3 0x05
+XB 0x06
+MC0 0x07
+MC1 0x08
+OB0 0x09
+OB1 0x0A
+OB2 0x0B
+OB3 0x0C
+PCI0 0x0D
+PCI1 0x0E
+PCI2 0x0F
+
+
+
+
+
+
OpenPOWER on IntegriCloud