summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/hwpf')
-rw-r--r--src/usr/hwpf/fapi/fapiAttributeService.C187
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseAttributeInfo.pl144
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseErrorInfo.pl79
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCode.C192
-rw-r--r--src/usr/hwpf/fapi/fapiReturnCodeDataRef.C85
-rw-r--r--src/usr/hwpf/fapi/fapiTarget.C118
-rw-r--r--src/usr/hwpf/fapi/makefile13
-rw-r--r--src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml50
-rw-r--r--src/usr/hwpf/hwp/fapiHwpErrorInfo.xml15
-rw-r--r--src/usr/hwpf/hwp/fapiTestHwp.C121
-rw-r--r--src/usr/hwpf/hwp/makefile11
-rw-r--r--src/usr/hwpf/makefile16
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwAccess.C142
-rw-r--r--src/usr/hwpf/plat/fapiPlatHwpInvoker.C84
-rw-r--r--src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C28
-rw-r--r--src/usr/hwpf/plat/fapiPlatSystemConfig.C72
-rw-r--r--src/usr/hwpf/plat/fapiPlatTarget.C50
-rw-r--r--src/usr/hwpf/plat/fapiPlatUtil.C39
-rw-r--r--src/usr/hwpf/plat/makefile16
-rw-r--r--src/usr/hwpf/test/fapirctest.H461
-rw-r--r--src/usr/hwpf/test/fapitargettest.H266
-rw-r--r--src/usr/hwpf/test/hwpftest.H94
-rw-r--r--src/usr/hwpf/test/makefile11
23 files changed, 2294 insertions, 0 deletions
diff --git a/src/usr/hwpf/fapi/fapiAttributeService.C b/src/usr/hwpf/fapi/fapiAttributeService.C
new file mode 100644
index 000000000..c48557398
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiAttributeService.C
@@ -0,0 +1,187 @@
+/**
+ * @file fapiAttributeService.C
+ *
+ * @brief Implements the AttributeService functions.
+ */
+
+#include <stdio.h>
+#include <fapiAttributeService.H>
+#include <fapiPlatTrace.H>
+
+namespace fapi
+{
+
+namespace AttributeService
+{
+
+//******************************************************************************
+// Get string
+//******************************************************************************
+template<>
+ReturnCode _get<char *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ char * & o_value)
+{
+ FAPI_ERR("Get string attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint8_t
+//******************************************************************************
+template<>
+ReturnCode _get<uint8_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint8_t & o_value)
+{
+ FAPI_ERR("Get uint8 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint32_t
+//******************************************************************************
+template<>
+ReturnCode _get<uint32_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint32_t & o_value)
+{
+ FAPI_ERR("Get uint32 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint64_t
+//******************************************************************************
+template<>
+ReturnCode _get<uint64_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint64_t & o_value)
+{
+ FAPI_ERR("Get uint64 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint8_t array
+//******************************************************************************
+template<>
+ReturnCode _get<uint8_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint8_t * const o_pValues)
+{
+ FAPI_ERR("Get uint8 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint32_t array
+//******************************************************************************
+template<>
+ReturnCode _get<uint32_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint32_t * const o_pValues)
+{
+ FAPI_ERR("Get uint32 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Get uint64_t array
+//******************************************************************************
+template<>
+ReturnCode _get<uint64_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ uint64_t * const o_pValues)
+{
+ FAPI_ERR("Get uint64 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set string
+//******************************************************************************
+template<>
+ReturnCode _set<char *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const char * const i_pValue)
+{
+ FAPI_ERR("Set string attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint8_t
+//******************************************************************************
+template<>
+ReturnCode _set<uint8_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint8_t i_value)
+{
+ FAPI_ERR("Set uint8 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint32_t
+//******************************************************************************
+template<>
+ReturnCode _set<uint32_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint32_t i_value)
+{
+ FAPI_ERR("Set uint32 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint64_t
+//******************************************************************************
+template<>
+ReturnCode _set<uint64_t> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint64_t i_value)
+{
+ FAPI_ERR("Set uint64 attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint8_t array
+//******************************************************************************
+template<>
+ReturnCode _set<uint8_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint8_t * const i_pValues)
+{
+ FAPI_ERR("Set uint8 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint32_t array
+//******************************************************************************
+template<>
+ReturnCode _set<uint32_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint32_t * const i_pValues)
+{
+ FAPI_ERR("Set uint32 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// Set uint64_t array
+//******************************************************************************
+template<>
+ReturnCode _set<uint64_t *> (const AttributeId i_id,
+ const Target * const i_pTarget,
+ const uint64_t * const i_pValues)
+{
+ FAPI_ERR("Set uint64 array attribute not implemented");
+ return FAPI_RC_NOT_IMPLEMENTED;
+}
+
+} // namespace AttributeService
+
+} // namespace fapi
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
new file mode 100755
index 000000000..8151b0ef6
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
@@ -0,0 +1,144 @@
+#!/usr/bin/perl
+
+#
+# Usage:
+# fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN>
+
+use strict;
+
+my $numArgs = $#ARGV + 1;
+#print $numArgs, "\n";
+
+if ($numArgs < 1)
+{
+ print ("Usage: fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN>\n");
+ print (" This perl script will parse attribute XML files,\n");
+ print (" pull out the attribute IDs/types and create a header file\n");
+ print (" fapiAttributeIds.H containing the information.\n");
+ exit(1);
+}
+
+
+
+# use module
+use XML::Simple;
+#use Data::Dumper;
+
+#open output file for writing
+open(OUTFILE, ">fapiAttributeIds.H");
+print OUTFILE "// fapiAttributeIds.H\n";
+print OUTFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n";
+print OUTFILE "#ifndef FAPIATTRIBUTEIDS_H_\n";
+print OUTFILE "#define FAPIATTRIBUTEIDS_H_\n\n";
+print OUTFILE "namespace fapi\n";
+print OUTFILE "{\n\n";
+print OUTFILE "\/**\n";
+print OUTFILE " * \@brief Enumeration of attribute IDs\n";
+print OUTFILE " *\/\n";
+print OUTFILE "enum AttributeId\n";
+print OUTFILE "{\n";
+
+# create object
+my $xml = new XML::Simple (KeyAttr=>[]);
+
+#for each Hwp Attribute XML file
+my $infile;
+foreach $infile(@ARGV)
+{
+ #print filename
+ #print $ifile, "\n\n";
+
+ # read XML file
+ my $attributes = $xml->XMLin($infile);
+
+ # print output
+ #print Dumper($attributes);
+ #print "\n";
+
+ # print attribute id to file
+ my $attr;
+ foreach $attr (@{$attributes->{attribute}})
+ {
+ if ($attr->{id})
+ {
+ print OUTFILE " ", $attr->{id}, ",\n";
+ }
+ else
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. Attribute ID missing\n");
+ exit(1);
+ }
+ };
+}
+
+print OUTFILE "};\n\n";
+
+print OUTFILE "\/**\n";
+print OUTFILE " * \@brief Typedefs for the attribute value types\n";
+print OUTFILE " *\/\n";
+
+#for each Hwp Attribute XML file
+foreach $infile(@ARGV)
+{
+ # read XML file
+ my $attributes = $xml->XMLin($infile);
+
+ # print attribute id to file
+ my $attr;
+ foreach $attr (@{$attributes->{attribute}})
+ {
+ print OUTFILE "typedef ";
+
+ if ($attr->{valueType} eq 'uint8')
+ {
+ if ($attr->{array})
+ {
+ print OUTFILE "uint8_t * ";
+ }
+ else
+ {
+ print OUTFILE "uint8_t ";
+ }
+ }
+ elsif ($attr->{valueType} eq 'uint32')
+ {
+ if ($attr->{array})
+ {
+ print OUTFILE "uint32_t * ";
+ }
+ else
+ {
+ print OUTFILE "uint32_t ";
+ }
+ }
+ elsif ($attr->{valueType} eq 'uint64')
+ {
+ if ($attr->{array})
+ {
+ print OUTFILE "uint64_t * ";
+ }
+ else
+ {
+ print OUTFILE "uint64_t ";
+ }
+ }
+ elsif ($attr->{valueType} eq 'string')
+ {
+ print OUTFILE "char * ";
+ }
+ else
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. valueType not recognized: ");
+ print $attr->{valueType}, "\n";
+ exit(1);
+ }
+
+ print OUTFILE $attr->{id}, "_Type;\n";
+ };
+}
+
+print OUTFILE "\n}\n\n";
+print OUTFILE "#endif\n";
+
+#close output file
+close(OUTFILE);
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
new file mode 100755
index 000000000..e0dc8b652
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+
+#
+# Usage:
+# fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN>
+
+use strict;
+
+my $numArgs = $#ARGV + 1;
+#print $numArgs, "\n";
+
+if ($numArgs < 1)
+{
+ print ("Usage: fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN>\n");
+ print (" This perl script will parse HWP Error XML files,\n");
+ print (" pull out the error Return Codes and create a header file\n");
+ print (" hwp/fapiHwpReturnCodes.H containing an enumeration of them.\n");
+ exit(1);
+}
+
+
+
+# use module
+use XML::Simple;
+#use Data::Dumper;
+
+#open output file for writing
+open(OUTFILE, ">fapiHwpReturnCodes.H");
+print OUTFILE "// fapiHwpReturnCodes.H\n";
+print OUTFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n";
+print OUTFILE "#ifndef FAPIHWPRETURNCODES_H_\n";
+print OUTFILE "#define FAPIHWPRETURNCODES_H_\n\n";
+print OUTFILE "namespace fapi\n";
+print OUTFILE "{\n\n";
+print OUTFILE "/**\n";
+print OUTFILE " * \@brief Enumeration of HWP return codes\n";
+print OUTFILE " *\/\n";
+print OUTFILE "enum HwpReturnCode\n";
+print OUTFILE "{\n";
+
+# create object
+my $xml = new XML::Simple (KeyAttr=>[]);
+my $infile;
+
+#for each Hwp Attribute XML file
+foreach $infile(@ARGV)
+{
+ #print filename
+ #print $ifile, "\n\n";
+
+ # read XML file
+ my $errors = $xml->XMLin($infile);
+
+ # print output
+ #print Dumper($errors);
+ #print "\n";
+
+ # print return code to file
+ my $err;
+ foreach $err (@{$errors->{hwpError}})
+ {
+ if ($err->{id})
+ {
+ print OUTFILE " ", $err->{id}, ",\n";
+ }
+ else
+ {
+ print ("fapiParseErrorInfo.pl ERROR. ID missing\n");
+ exit(1);
+ }
+ };
+}
+
+print OUTFILE "};\n\n";
+print OUTFILE "}\n\n";
+print OUTFILE "#endif\n";
+
+#close output file
+close(OUTFILE);
diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C
new file mode 100644
index 000000000..b32ae0f2f
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiReturnCode.C
@@ -0,0 +1,192 @@
+/**
+ * @file fapiReturnCode.C
+ *
+ * @brief Implements the ReturnCode class.
+ */
+
+#include <fapiReturnCode.H>
+#include <fapiReturnCodeDataRef.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// Default Constructor
+//******************************************************************************
+ReturnCode::ReturnCode() :
+ iv_rcValue(FAPI_RC_SUCCESS), iv_pDataRef(NULL)
+{
+
+}
+
+//******************************************************************************
+// Constructor
+//******************************************************************************
+ReturnCode::ReturnCode(const uint32_t i_rcValue) :
+ iv_rcValue(i_rcValue), iv_pDataRef(NULL)
+{
+
+}
+
+//******************************************************************************
+// Copy Constructor
+//******************************************************************************
+ReturnCode::ReturnCode(const ReturnCode & i_right) :
+ iv_rcValue(i_right.iv_rcValue), iv_pDataRef(i_right.iv_pDataRef)
+{
+ // Note shallow copy (in initializer list) of iv_pDataRef pointer. Both
+ // ReturnCodes now points to the same ReturnCodeDataRef
+
+ if (iv_pDataRef)
+ {
+ // Increase the ReturnCodeDataRef reference count
+ (void) iv_pDataRef->incRefCount();
+ }
+}
+
+//******************************************************************************
+// Destructor
+//******************************************************************************
+ReturnCode::~ReturnCode()
+{
+ // Remove interest in any pointed to ReturnCodeDataRef
+ (void) removeData();
+}
+
+//******************************************************************************
+// Assignment Operator
+//******************************************************************************
+ReturnCode & ReturnCode::operator=(const ReturnCode & i_right)
+{
+ // Test for self assignment
+ if (this != &i_right)
+ {
+ // Remove interest in any pointed to ReturnCodeDataRef
+ (void) removeData();
+
+ // Copy instance variables. Note shallow copy of iv_pDataRef pointer.
+ // Both ReturnCodes now points to the same ReturnCodeDataRef
+ iv_rcValue = i_right.iv_rcValue;
+ iv_pDataRef = i_right.iv_pDataRef;
+
+ if (iv_pDataRef)
+ {
+ // Increase the ReturnCodeDataRef reference count
+ (void) iv_pDataRef->incRefCount();
+ }
+ }
+ return *this;
+}
+
+//******************************************************************************
+// Assignment Operator
+//******************************************************************************
+ReturnCode & ReturnCode::operator=(const uint32_t i_rcValue)
+{
+ iv_rcValue = i_rcValue;
+ return *this;
+}
+
+//******************************************************************************
+// ok function
+//******************************************************************************
+bool ReturnCode::ok() const
+{
+ return (iv_rcValue == FAPI_RC_SUCCESS);
+}
+
+//******************************************************************************
+// returnCode_t cast
+//******************************************************************************
+ReturnCode::operator uint32_t() const
+{
+ return iv_rcValue;
+}
+
+//******************************************************************************
+// getData function
+//******************************************************************************
+void * ReturnCode::getData() const
+{
+ const void * l_pData = NULL;
+
+ if (iv_pDataRef)
+ {
+ // Get the data
+ l_pData = iv_pDataRef->getData();
+ }
+
+ // Remove the constness and return
+ return const_cast<void *>(l_pData);
+}
+
+//******************************************************************************
+// releaseData function
+//******************************************************************************
+void * ReturnCode::releaseData()
+{
+ const void * l_pData = NULL;
+
+ if (iv_pDataRef)
+ {
+ // Release the data
+ l_pData = iv_pDataRef->releaseData();
+
+ // Remove interest in pointed to ReturnCodeDataRef
+ (void) removeData();
+ }
+
+ // Remove the constness and return
+ return const_cast<void *>(l_pData);
+}
+
+//******************************************************************************
+// setData function
+//******************************************************************************
+void ReturnCode::setData(const void * i_pData)
+{
+ // Remove interest in pointed to ReturnCodeDataRef
+ (void) removeData();
+
+ // Create new ReturnCodeDataRef which points to the data
+ iv_pDataRef = new ReturnCodeDataRef(i_pData);
+}
+
+//******************************************************************************
+// getCreator function
+//******************************************************************************
+ReturnCode::returnCodeCreator ReturnCode::getCreator() const
+{
+ returnCodeCreator l_creator = CREATOR_HWP;
+
+ if ((iv_rcValue & FAPI_RC_FAPI_MASK) || (iv_rcValue & FAPI_RC_ECMD_MASK))
+ {
+ l_creator = CREATOR_FAPI;
+ }
+ else if (iv_rcValue & FAPI_RC_PLAT_MASK)
+ {
+ l_creator = CREATOR_PLAT;
+ }
+
+ return l_creator;
+}
+
+//******************************************************************************
+// removeData function
+//******************************************************************************
+void ReturnCode::removeData()
+{
+ if (iv_pDataRef)
+ {
+ // Decrement the ReturnCodeDataRef refcount
+ if (iv_pDataRef->decRefCountCheckZero())
+ {
+ // Refcount decremented to zero. No other ReturnCode points to the
+ // ReturnCodeDataRef object, delete it
+ delete iv_pDataRef;
+ }
+ iv_pDataRef = NULL;
+ }
+}
+
+}
diff --git a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C
new file mode 100644
index 000000000..910d1653e
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C
@@ -0,0 +1,85 @@
+/**
+ * @file fapiReturnCodeDataRef.C
+ *
+ * @brief Implements the FAPI part of the ReturnCodeDataRef class.
+ */
+
+#include <fapiReturnCodeDataRef.H>
+#include <fapiUtil.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// Constructor
+//******************************************************************************
+ReturnCodeDataRef::ReturnCodeDataRef(const void * i_pData) :
+ iv_refCount(1), iv_pData(i_pData)
+{
+
+}
+
+//******************************************************************************
+// Destructor
+//******************************************************************************
+ReturnCodeDataRef::~ReturnCodeDataRef()
+{
+ if (iv_refCount != 0)
+ {
+ FAPI_ERR("ReturnCodeDataRef. Bug. Destruct with refcount");
+ fapiAssert(false);
+ }
+ else
+ {
+ // Call platform implemented deleteData
+ (void) deleteData();
+ }
+}
+
+//******************************************************************************
+// incRefCount function
+//******************************************************************************
+void ReturnCodeDataRef::incRefCount()
+{
+ FAPI_DBG("ReturnCodeDataRef::incRefCount: iv_refCount = %i on entry", iv_refCount);
+ iv_refCount++;
+}
+
+//******************************************************************************
+// decRefCountCheckZero function
+//******************************************************************************
+bool ReturnCodeDataRef::decRefCountCheckZero()
+{
+ FAPI_DBG("ReturnCodeDataRef::decRefCountCheckZero: iv_refCount = %i on entry", iv_refCount);
+
+ if (iv_refCount == 0)
+ {
+ FAPI_ERR("ReturnCodeDataRef. Bug. Dec with zero refcount");
+ fapiAssert(false);
+ }
+ else
+ {
+ iv_refCount--;
+ }
+ return (iv_refCount == 0);
+}
+
+//******************************************************************************
+// getData function
+//******************************************************************************
+const void * ReturnCodeDataRef::getData() const
+{
+ return iv_pData;
+}
+
+//******************************************************************************
+// releaseData function
+//******************************************************************************
+const void * ReturnCodeDataRef::releaseData()
+{
+ const void * l_pData = iv_pData;
+ iv_pData = NULL;
+ return l_pData;
+}
+
+}
diff --git a/src/usr/hwpf/fapi/fapiTarget.C b/src/usr/hwpf/fapi/fapiTarget.C
new file mode 100644
index 000000000..463a13ed3
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiTarget.C
@@ -0,0 +1,118 @@
+/**
+ * @file fapiTarget.C
+ *
+ * @brief Implements the FAPI part of the Target class.
+ */
+
+#include <fapiTarget.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// Default Constructor
+//******************************************************************************
+Target::Target() :
+ iv_type(TARGET_TYPE_NONE), iv_pHandle(NULL)
+{
+
+}
+
+//******************************************************************************
+// Constructor.
+//******************************************************************************
+Target::Target(const TargetType i_type,
+ const void * i_pHandle) :
+ iv_type(i_type), iv_pHandle(i_pHandle)
+{
+
+}
+
+//******************************************************************************
+// Copy Constructor
+//******************************************************************************
+Target::Target(const Target & i_right) :
+ iv_type(i_right.iv_type)
+{
+ (void) copyHandle(i_right);
+}
+
+//******************************************************************************
+// Destructor
+//******************************************************************************
+Target::~Target()
+{
+ (void) deleteHandle();
+}
+
+//******************************************************************************
+// Assignment Operator
+//******************************************************************************
+Target & Target::operator=(const Target & i_right)
+{
+ // Test for self assignment
+ if (this != &i_right)
+ {
+ iv_type = i_right.iv_type;
+ (void) copyHandle(i_right);
+ }
+ return *this;
+}
+
+//******************************************************************************
+// Equality Comparison Operator
+//******************************************************************************
+bool Target::operator==(const Target & i_right) const
+{
+ bool l_equal = false;
+
+ if (iv_type == i_right.iv_type)
+ {
+ l_equal = compareHandle(i_right);
+ }
+
+ return l_equal;
+}
+
+//******************************************************************************
+// Inequality Comparison Operator
+//******************************************************************************
+bool Target::operator!=(const Target & i_right) const
+{
+ // Determine inequality by calling the equality comparison operator
+ return (!(*this == i_right));
+}
+
+//******************************************************************************
+// Get the handle.
+//******************************************************************************
+void * Target::get() const
+{
+ return const_cast<void *>(iv_pHandle);
+}
+
+//******************************************************************************
+// Set the handle.
+//******************************************************************************
+void Target::set(const void * i_pHandle)
+{
+ iv_pHandle = i_pHandle;
+}
+
+//******************************************************************************
+// Get the target type
+//******************************************************************************
+TargetType Target::getType() const
+{
+ return iv_type;
+}
+
+//******************************************************************************
+// Set the target type
+//******************************************************************************
+void Target::setType(const TargetType i_type)
+{
+ iv_type = i_type;
+}
+
+}
diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile
new file mode 100644
index 000000000..59df28b20
--- /dev/null
+++ b/src/usr/hwpf/fapi/makefile
@@ -0,0 +1,13 @@
+ROOTPATH = ../../../..
+MODULE = fapi
+
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+
+OBJS = fapiAttributeService.o \
+ fapiReturnCode.o \
+ fapiReturnCodeDataRef.o \
+ fapiTarget.o
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
new file mode 100644
index 000000000..d1316bc0f
--- /dev/null
+++ b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
@@ -0,0 +1,50 @@
+<!-- XML file specifying HW Procedure requested attributes. -->
+<!-- This is just the initial test version. HWPs will replace with an official version. -->
+
+<attributes>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT8</id>
+ <description>Test Attribute UINT8</description>
+ <valueType>uint8</valueType>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT32</id>
+ <description>Test Attribute UINT32</description>
+ <valueType>uint32</valueType>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT64</id>
+ <description>Test Attribute UINT64</description>
+ <valueType>uint64</valueType>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT8_ARRAY</id>
+ <description>Test Attribute UINT8 ARRAY</description>
+ <valueType>uint8</valueType>
+ <array>3</array>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT32_ARRAY</id>
+ <description>Test Attribute UINT32 ARRAY</description>
+ <valueType>uint32</valueType>
+ <array>4</array>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_UINT64_ARRAY</id>
+ <description>Test Attribute UINT64 ARRAY</description>
+ <valueType>uint64</valueType>
+ <array>5</array>
+ </attribute>
+ <!-- *********************************************************************** -->
+ <attribute>
+ <id>ATTR_TEST_STRING</id>
+ <description>Test Attribute STRING</description>
+ <valueType>string</valueType>
+ </attribute>
+</attributes>
diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
new file mode 100644
index 000000000..e4c5e68b1
--- /dev/null
+++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml
@@ -0,0 +1,15 @@
+<!-- XML file specifying HW Procedure generated errors. -->
+<!-- This is just the initial test version. HWPs will replace with an official version. -->
+
+<hwpErrors>
+ <!-- *********************************************************************** -->
+ <hwpError>
+ <id>RC_TEST_ERROR_A</id>
+ <description>Test Error A</description>
+ </hwpError>
+ <!-- *********************************************************************** -->
+ <hwpError>
+ <id>RC_TEST_ERROR_B</id>
+ <description>Test Error B</description>
+ </hwpError>
+</hwpErrors>
diff --git a/src/usr/hwpf/hwp/fapiTestHwp.C b/src/usr/hwpf/hwp/fapiTestHwp.C
new file mode 100644
index 000000000..54dff5a66
--- /dev/null
+++ b/src/usr/hwpf/hwp/fapiTestHwp.C
@@ -0,0 +1,121 @@
+/**
+ * @file fapiTestHwp.C
+ *
+ * @brief Implements test Hardware Procedures.
+ */
+
+#include <fapiTestHwp.H>
+
+extern "C"
+{
+
+//******************************************************************************
+// hwpIsP7ChipletClockOn function
+//******************************************************************************
+fapi::ReturnCode hwpIsP7EM0ChipletClockOn(const fapi::Target & i_chip,
+ bool & o_clocksOn)
+{
+ // Ported from a combination of
+ // hwsvClockAlgP7.C : hwsvClockQueryOnP7 (main HWP)
+ // hwsvClockAlgP7.C : isChipletClockOn (sub function)
+
+ // Attempt to call the attribute get/set functions for the test attributes
+ fapi::ReturnCode l_rc;
+
+ // Test getting and setting attributes
+ {
+ char * l_pString = NULL;
+ uint8_t l_uint8 = 0;
+ uint32_t l_uint32 = 0;
+ uint64_t l_uint64 = 0;
+ uint8_t l_pUint8Array[3] = {0};
+ uint32_t l_pUint32Array[4] = {0};
+ uint64_t l_pUint64Array[5] = {0};
+
+ // All of the following should currently compile (not checking RC which
+ // should be FAPI_RC_NOT_IMPLEMENTED). The get/set functions do not
+ // currently do anything so passing NULL will work.
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING, &i_chip, l_pString);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8, &i_chip, l_uint8);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32, &i_chip, l_uint32);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, &i_chip, l_uint64);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8_ARRAY, &i_chip, l_pUint8Array);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32_ARRAY, &i_chip, l_pUint32Array);
+ l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_pUint64Array);
+
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, l_pString);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, "test-string");
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8, &i_chip, l_uint8);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32, &i_chip, l_uint32);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, &i_chip, l_uint64);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8_ARRAY, &i_chip, l_pUint8Array);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32_ARRAY, &i_chip, l_pUint32Array);
+ l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_pUint64Array);
+
+ // All of the following should not compile due to wrong types used
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING, &i_chip, l_uint8);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING, &i_chip, l_uint32);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING, &i_chip, l_uint64);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING, &i_chip, l_pUint8Array);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8, &i_chip, l_pString);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32, &i_chip, l_uint8);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, &i_chip, l_pUint8Array);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, &i_chip, l_pUint64Array);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8_ARRAY, &i_chip, l_pString);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32_ARRAY, &i_chip, l_uint8);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_uint64);
+ //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_pUint32Array);
+
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, l_uint8);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, l_uint32);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, l_uint64);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING, &i_chip, l_pUint64Array);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8, &i_chip, l_pString);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32, &i_chip, l_uint64);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, &i_chip, l_pUint32Array);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, &i_chip, l_pUint64Array);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8_ARRAY, &i_chip, l_pString);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32_ARRAY, &i_chip, l_uint8);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_uint64);
+ //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64_ARRAY, &i_chip, l_pUint8Array);
+
+ l_rc = fapi::FAPI_RC_SUCCESS;
+ }
+
+ // Constants
+ const uint64_t EM_CLOCK_STATUS_MASK = 0xEEC0000000000000ULL;
+ const uint32_t EM0_CHIPLET_BASE_ADDR = 0x06000000;
+ const uint32_t CHIPLET_CLOCK_ON_SCOM_ADDR = 0x00030008;
+
+ // Set caller's result to default
+ o_clocksOn = false;
+
+ // Figure out the scom address and create a 64 bit data buffer
+ uint32_t l_addr = (EM0_CHIPLET_BASE_ADDR | CHIPLET_CLOCK_ON_SCOM_ADDR);
+ ecmdDataBufferBase l_data(64);
+
+ // Perform a GetScom operation on the chip
+ l_rc = GetScom(i_chip, l_addr, l_data);
+
+ if (l_rc != fapi::FAPI_RC_SUCCESS)
+ {
+ FAPI_ERR("hwpIsP7EM0ChipletClockOn: Error from GetScomChip");
+ }
+ else
+ {
+ if (!(l_data.getDoubleWord(0) & EM_CLOCK_STATUS_MASK))
+ {
+ FAPI_INF("hwpIsP7EM0ChipletClockOn: Clocks are on");
+ o_clocksOn = true;
+ }
+ else
+ {
+ FAPI_INF("hwpIsP7EM0ChipletClockOn: Clocks are off");
+ }
+ }
+
+ return l_rc;
+}
+
+
+} // extern "C"
diff --git a/src/usr/hwpf/hwp/makefile b/src/usr/hwpf/hwp/makefile
new file mode 100644
index 000000000..ef38aa8c9
--- /dev/null
+++ b/src/usr/hwpf/hwp/makefile
@@ -0,0 +1,11 @@
+ROOTPATH = ../../../..
+MODULE = hwp
+
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+
+OBJS = fapiTestHwp.o
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile
new file mode 100644
index 000000000..be8828a60
--- /dev/null
+++ b/src/usr/hwpf/makefile
@@ -0,0 +1,16 @@
+ROOTPATH = ../../..
+MODULE = hwpf
+
+GENFILES = fapiHwpReturnCodes.H fapiAttributeIds.H
+
+SUBDIRS = fapi.d hwp.d plat.d test.d
+
+include ${ROOTPATH}/config.mk
+
+${GENDIR}/fapiHwpReturnCodes.H : fapi/fapiParseErrorInfo.pl hwp/fapiHwpErrorInfo.xml
+ $^
+ mv $(notdir $@) $@
+
+${GENDIR}/fapiAttributeIds.H : fapi/fapiParseAttributeInfo.pl hwp/fapiHwpAttributeInfo.xml
+ $^
+ mv $(notdir $@) $@
diff --git a/src/usr/hwpf/plat/fapiPlatHwAccess.C b/src/usr/hwpf/plat/fapiPlatHwAccess.C
new file mode 100644
index 000000000..d1058520c
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatHwAccess.C
@@ -0,0 +1,142 @@
+/**
+ * @file fapiPlatHwAccess.C
+ *
+ * @brief Implements the fapiHwAccess.H functions.
+ *
+ * Note that platform code must provide the implementation.
+ */
+
+#include <fapiHwAccess.H>
+#include <fapiPlatTrace.H>
+#include <errl/errlentry.H>
+#include <targeting/targetservice.H>
+#include <devicefw/userif.H>
+
+extern "C"
+{
+
+//******************************************************************************
+// GetScom function
+//******************************************************************************
+fapi::ReturnCode GetScom(const fapi::Target& i_target,
+ const uint64_t i_address,
+ ecmdDataBufferBase & o_data)
+{
+ FAPI_DBG(ENTER_MRK "GetScom");
+
+ fapi::ReturnCode l_rc;
+ errlHndl_t l_err = NULL;
+
+ // Extract the component pointer
+ TARGETING::Target* l_target = reinterpret_cast<TARGETING::Target*>(i_target.get());
+
+ // Perform SCOM read
+ uint64_t l_data = 0;
+ size_t l_size = sizeof(uint64_t);
+ l_err = deviceRead(l_target,
+ &l_data,
+ l_size,
+ DEVICE_SCOM_ADDRESS(i_address));
+ if (l_err)
+ {
+ // Add the error log pointer as data to the ReturnCode
+ FAPI_ERR("GetScom: HostBoot GetScom returns error");
+ l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
+ l_rc.setData(reinterpret_cast<void *> (l_err));
+ }
+ else
+ {
+ o_data.setDoubleWord(0, l_data);
+ }
+
+ FAPI_DBG(EXIT_MRK "GetScom");
+ return l_rc;
+}
+
+//******************************************************************************
+// PutScom function
+//******************************************************************************
+fapi::ReturnCode PutScom(const fapi::Target& i_target,
+ const uint64_t i_address,
+ ecmdDataBufferBase & i_data)
+{
+ FAPI_DBG(ENTER_MRK "PutScom");
+ fapi::ReturnCode l_rc;
+ errlHndl_t l_err = NULL;
+
+ // Extract the component pointer
+ TARGETING::Target* l_target = reinterpret_cast<TARGETING::Target*>(i_target.get());
+
+ // Perform SCOM read
+ uint64_t l_data = i_data.getDoubleWord(0);
+ size_t l_size = sizeof(uint64_t);
+ l_err = deviceWrite(l_target,
+ &l_data,
+ l_size,
+ DEVICE_SCOM_ADDRESS(i_address));
+ if (l_err)
+ {
+ // Add the error log pointer as data to the ReturnCode
+ FAPI_ERR("Putscom: HostBoot Putscom returns error");
+ l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
+ l_rc.setData(reinterpret_cast<void *> (l_err));
+ }
+
+ FAPI_DBG(EXIT_MRK "PutScom");
+ return l_rc;
+}
+
+//@todo - Implement these functions later
+#if 0
+//******************************************************************************
+// PutScomUnderMask function
+//******************************************************************************
+fapi::ReturnCode PutScomUnderMask(const fapi::Target& i_target,
+ const uint64_t i_address,
+ ecmdDataBufferBase & i_data,
+ ecmdDataBufferBase & i_mask)
+{
+ FAPI_DBG(ENTER_MRK "PutScomUnderMask");
+
+ FAPI_DBG(EXIT_MRK "PutScomUnderMask");
+}
+
+//******************************************************************************
+// GetCfamRegister function
+//******************************************************************************
+fapi::ReturnCode GetCfamRegister(const fapi::Target& i_target,
+ const uint32_t i_address,
+ ecmdDataBufferBase & o_data)
+{
+ FAPI_DBG(ENTER_MRK "GetCfamRegister");
+
+ FAPI_DBG(EXIT_MRK "GetCfamRegister");
+}
+
+//******************************************************************************
+// PutCfamRegister function
+//******************************************************************************
+fapi::ReturnCode PutCfamRegister(const fapi::Target& i_target,
+ const uint32_t i_address,
+ ecmdDataBufferBase & i_data)
+{
+ FAPI_DBG(ENTER_MRK "PutCfamRegister");
+
+ FAPI_DBG(EXIT_MRK "PutCfamRegister");
+}
+
+//******************************************************************************
+// ModifyCfamRegister function
+//******************************************************************************
+fapi::ReturnCode ModifyCfamRegister(const fapi::Target& i_target,
+ const uint32_t i_address,
+ ecmdDataBufferBase & i_data,
+ const fapi::ChipOpModifyMode i_modifyMode)
+{
+ FAPI_DBG(ENTER_MRK "ModifyCfamRegister");
+
+ FAPI_DBG(EXIT_MRK "ModifyCfamRegister");
+}
+#endif
+
+} // extern "C"
diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
new file mode 100644
index 000000000..d6d8cbaad
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C
@@ -0,0 +1,84 @@
+/**
+ * @file fapiPlatHwpInvoker.C
+ *
+ * @brief Implements the platform specific HW Procedure invoker functions.
+ */
+
+#include <fapiPlatHwpInvoker.H>
+#include <fapiReturnCode.H>
+#include <fapiPlatTrace.H>
+#include <fapiTestHwp.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// rcToErrl function
+//******************************************************************************
+errlHndl_t rcToErrl(ReturnCode i_rc)
+{
+ errlHndl_t l_err = NULL;
+
+ ReturnCode::returnCodeCreator l_creator = i_rc.getCreator();
+
+ if (l_creator == ReturnCode::CREATOR_PLAT)
+ {
+ // Release the errlHndl_t
+ l_err = reinterpret_cast<errlHndl_t> (i_rc.releaseData());
+ }
+ else
+ {
+ //@todo Figure out how to convert FAPI/HWP error to Host Boot error log
+ }
+
+ return l_err;
+}
+
+
+//******************************************************************************
+// invokeHwpIsP7EM0ChipletClockOn function
+//******************************************************************************
+errlHndl_t invokeHwpIsP7EM0ChipletClockOn(TARGETING::Target* i_target,
+ bool & o_clocksOn)
+{
+
+ FAPI_DBG(ENTER_MRK "HostBootHwpIsP7EM0ChipletClockOn");
+
+ errlHndl_t l_err = NULL;
+
+ // Create a generic Target object
+ Target l_target(TARGET_TYPE_PROC_CHIP, reinterpret_cast<void *> (i_target));
+
+ //@todo
+ // Double check to see if any locking is needed here.
+ // Lower XSCOM already has a mutex lock.
+
+ // Call the HWP executor macro
+ ReturnCode l_rc;
+ FAPI_EXEC_HWP(l_rc, hwpIsP7EM0ChipletClockOn, l_target, o_clocksOn);
+
+ if (l_rc != FAPI_RC_SUCCESS)
+ {
+ FAPI_ERR("hwpIsP7EM0ChipletClockOn: Error (0x%x) from "
+ "execHwpIsP7EM0ChipletClockOn",
+ static_cast<uint32_t> (l_rc));
+ l_err = rcToErrl(l_rc);
+ }
+ else
+ {
+ if (o_clocksOn)
+ {
+ FAPI_INF("hwpIsP7EM0ChipletClockOn: Clocks are on");
+ }
+ else
+ {
+ FAPI_INF("hwpIsP7EM0ChipletClockOn: Clocks are off");
+ }
+ }
+
+ FAPI_DBG(EXIT_MRK "HostBootHwpIsP7EM0ChipletClockOn");
+
+ return l_err;
+}
+
+} // End namespace
diff --git a/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C
new file mode 100644
index 000000000..9906f781f
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C
@@ -0,0 +1,28 @@
+/**
+ * @file platReturnCodeDataRef.C
+ *
+ * @brief Implements the platform part of the ReturnCodeDataRef class.
+ *
+ * Note that platform code must provide the implementation. FAPI has provided
+ * an example for platforms that do not attach ReturnCodeData to a ReturnCode.
+ */
+
+#include <fapiReturnCodeDataRef.H>
+#include <fapiPlatTrace.H>
+#include <errl/errlentry.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// deleteData function
+//******************************************************************************
+void ReturnCodeDataRef::deleteData()
+{
+ FAPI_DBG("ReturnCodeDataRef::deleteData");
+
+ // FSP platform uses iv_pData to point at a FipS error log.
+ delete (reinterpret_cast<errlHndl_t>(const_cast<void *>(iv_pData)));
+}
+
+}
diff --git a/src/usr/hwpf/plat/fapiPlatSystemConfig.C b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
new file mode 100644
index 000000000..05fbd6250
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatSystemConfig.C
@@ -0,0 +1,72 @@
+/**
+ * @file fapiPlatSystemConfig.C
+ *
+ * @brief Implements the fapiSystemConfig.H functions.
+ *
+ * Note that platform code must provide the implementation.
+ */
+
+#include <fapiSystemConfig.H>
+#include <fapiPlatTrace.H>
+
+extern "C"
+{
+
+//******************************************************************************
+// GetFunctionalChiplets function
+//******************************************************************************
+fapi::ReturnCode GetFunctionalChiplets(const fapi::Target& i_target,
+ const fapi::TargetType i_chipletType,
+ std::vector<fapi::Target> & o_chiplets)
+{
+ FAPI_DBG(ENTER_MRK "GetFunctionalChiplets");
+
+ FAPI_DBG(EXIT_MRK "GetFunctionalChiplets");
+
+ return fapi::FAPI_RC_PLAT_NOT_IMPLEMENTED;
+}
+
+//******************************************************************************
+// GetExistingChiplets function
+//******************************************************************************
+fapi::ReturnCode GetExistingChiplets(const fapi::Target& i_target,
+ const fapi::TargetType i_chipletType,
+ std::vector<fapi::Target> & o_chiplets)
+{
+ FAPI_DBG(ENTER_MRK "GetExistingChiplets");
+
+ FAPI_DBG(EXIT_MRK "GetExistingChiplets");
+
+ return fapi::FAPI_RC_PLAT_NOT_IMPLEMENTED;
+
+}
+
+//******************************************************************************
+// GetFunctionalDimms function
+//******************************************************************************
+fapi::ReturnCode GetFunctionalDimms(const fapi::Target& i_target,
+ std::vector<fapi::Target> & o_dimms)
+{
+ FAPI_DBG(ENTER_MRK "GetFunctionalDimms");
+
+ FAPI_DBG(EXIT_MRK "GetFunctionalDimms");
+
+ return fapi::FAPI_RC_PLAT_NOT_IMPLEMENTED;
+
+}
+
+//******************************************************************************
+// GetExistingDimms function
+//******************************************************************************
+fapi::ReturnCode GetExistingDimms(const fapi::Target& i_target,
+ std::vector<fapi::Target> & o_dimms)
+{
+ FAPI_DBG(ENTER_MRK "GetExistingDimms");
+
+ FAPI_DBG(EXIT_MRK "GetExistingDimms");
+
+ return fapi::FAPI_RC_PLAT_NOT_IMPLEMENTED;
+
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/plat/fapiPlatTarget.C b/src/usr/hwpf/plat/fapiPlatTarget.C
new file mode 100644
index 000000000..0fff06556
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatTarget.C
@@ -0,0 +1,50 @@
+/**
+ * @file platTarget.C
+ *
+ * @brief Implements the platform part of the Target class.
+ *
+ * Note that platform code must provide the implementation.
+ *
+ * FAPI has provided a default implementation for platforms that use the
+ * handle pointer to point to a Component that is not created/deleted when a
+ * Target object is created/deleted (i.e. two Target objects that reference
+ * the same component have the same pointer). It could be possible for a
+ * platform specific ID structure to be created and pointed to each time a new
+ * Target is created, in that case, the pointed to object's type needs to be
+ * be known in order to do a deep compare/copy and a delete.
+ */
+
+#include <fapiTarget.H>
+
+namespace fapi
+{
+
+//******************************************************************************
+// Compare the handle
+//
+// If the pointers point to the same component then the handles are the same
+//******************************************************************************
+bool Target::compareHandle(const Target & i_right) const
+{
+ return (iv_pHandle == i_right.iv_pHandle);
+}
+
+//******************************************************************************
+// Copy the handle
+//
+// Note shallow copy of iv_pHandle. Both Targets point to the same component
+//******************************************************************************
+void Target::copyHandle(const Target & i_right)
+{
+ iv_pHandle = i_right.iv_pHandle;
+}
+
+//******************************************************************************
+// Delete the handle
+//******************************************************************************
+void Target::deleteHandle()
+{
+ // Intentionally does nothing. The component must not be deleted
+}
+
+}
diff --git a/src/usr/hwpf/plat/fapiPlatUtil.C b/src/usr/hwpf/plat/fapiPlatUtil.C
new file mode 100644
index 000000000..b8d47619a
--- /dev/null
+++ b/src/usr/hwpf/plat/fapiPlatUtil.C
@@ -0,0 +1,39 @@
+/**
+ * @file platUtil.C
+ *
+ * @brief Implements the fapiUtil.H utility functions.
+ *
+ * Note that platform code must provide the implementation.
+ */
+
+#include <trace/interface.H>
+#include <fapi.H>
+
+//******************************************************************************
+// Trace descriptors
+//******************************************************************************
+trace_desc_t* g_fapiInfTd;
+trace_desc_t* g_fapiImpTd;
+trace_desc_t* g_fapiErrTd;
+trace_desc_t* g_fapiDbgTd;
+
+//******************************************************************************
+// Global TracInit objects. Construction will initialize the trace buffer
+//******************************************************************************
+TRAC_INIT(&g_fapiInfTd, FAPI_INF_TRACE_NAME, 4096);
+TRAC_INIT(&g_fapiImpTd, FAPI_IMP_TRACE_NAME, 4096);
+TRAC_INIT(&g_fapiErrTd, FAPI_ERR_TRACE_NAME, 4096);
+TRAC_INIT(&g_fapiDbgTd, FAPI_DBG_TRACE_NAME, 4096);
+
+namespace fapi
+{
+
+//******************************************************************************
+// fapiAssert
+//******************************************************************************
+void fapiAssert(bool i_expression)
+{
+ assert(i_expression);
+}
+
+}
diff --git a/src/usr/hwpf/plat/makefile b/src/usr/hwpf/plat/makefile
new file mode 100644
index 000000000..1353ad9b9
--- /dev/null
+++ b/src/usr/hwpf/plat/makefile
@@ -0,0 +1,16 @@
+ROOTPATH = ../../../..
+MODULE = plat
+
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+
+OBJS = fapiPlatHwAccess.o \
+ fapiPlatHwpInvoker.o \
+ fapiPlatReturnCodeDataRef.o \
+ fapiPlatSystemConfig.o \
+ fapiPlatTarget.o \
+ fapiPlatUtil.o
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/test/fapirctest.H b/src/usr/hwpf/test/fapirctest.H
new file mode 100644
index 000000000..140882483
--- /dev/null
+++ b/src/usr/hwpf/test/fapirctest.H
@@ -0,0 +1,461 @@
+#ifndef __FAPItestRc_H
+#define __FAPItestRc_H
+
+/**
+ * @file fapitestRc.H
+ *
+ * @brief Test case for FAPI return codes
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <fapi.H>
+
+using namespace fapi;
+
+class FapitestRc: public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief Test FAPI return codes #1
+ */
+ void testRc1(void)
+ {
+ // Create ReturnCode using default constructor
+ ReturnCode l_rc;
+
+ // Ensure that the embedded return code is success
+ if (l_rc != FAPI_RC_SUCCESS)
+ {
+ TS_FAIL("testRc1. ReturnCode init is not FAPI_RC_SUCCESS");
+ }
+ else
+ {
+ // Ensure that OK function works
+ if (l_rc.ok() == false)
+ {
+ TS_FAIL("testRc1. ok() returned false");
+ }
+ else
+ {
+ // Ensure that testing l_rc works
+ if (l_rc)
+ {
+ TS_FAIL("testRc1. testing rc returned true");
+ }
+ }
+ }
+ return;
+ }
+
+
+ /**
+ * @brief Test FAPI return codes #2
+ */
+ void testRc2()
+ {
+
+ // Create ReturnCode using default constructor
+ ReturnCode l_rc;
+
+ // Set the return code to a FAPI code
+ l_rc = FAPI_RC_FAPI_MASK | 0x05;
+
+ // Ensure that the creator is FAPI
+ ReturnCode::returnCodeCreator l_creator = l_rc.getCreator();
+
+ if (l_creator != ReturnCode::CREATOR_FAPI)
+ {
+ TS_FAIL("testRc2. Creator is not CREATOR_FAPI");
+ }
+ else
+ {
+ // Set the return code to a PLAT code
+ l_rc = FAPI_RC_PLAT_ERR_SEE_DATA;
+
+ // Ensure that the creator is PLAT
+ l_creator = l_rc.getCreator();
+
+ if (l_creator != ReturnCode::CREATOR_PLAT)
+ {
+ TS_FAIL("testRc2. Creator is not CREATOR_PLAT");
+ }
+ else
+ {
+ l_rc = 5;
+
+ // Ensure that the creator is HWP
+ l_creator = l_rc.getCreator();
+
+ if (l_creator != ReturnCode::CREATOR_HWP)
+ {
+ TS_FAIL("testRc2. Creator is not CREATOR_HWP");
+ }
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #3
+ */
+ void testRc3()
+ {
+ uint32_t l_code = 4;
+
+ // Create ReturnCode specifying a return code
+ ReturnCode l_rc(l_code);
+
+ // Ensure that the embedded return code is as expected
+ uint32_t l_codeCheck = l_rc;
+
+ if (l_codeCheck != l_code)
+ {
+ TS_FAIL("testRc3. Code is not set as desired");
+ }
+ else
+ {
+ // Ensure that ok function returns false
+ if (l_rc.ok())
+ {
+ TS_FAIL("testRc3. ok returned true");
+ }
+ else
+ {
+ // Ensure that testing l_rc works
+ if (!l_rc)
+ {
+ TS_FAIL("testRc3. testing rc returned false");
+ }
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #4
+ */
+ void testRc4()
+ {
+ uint32_t l_code = 6;
+ uint32_t l_code2 = 7;
+
+ // Create similar ReturnCodes
+ ReturnCode l_rc(l_code);
+ ReturnCode l_rc2(l_code);
+
+ // Ensure that the equality comparison returns true
+ if (!(l_rc == l_rc2))
+ {
+ TS_FAIL("testRc4. Equality comparison false");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns false
+ if (l_rc != l_rc2)
+ {
+ TS_FAIL("testRc4.Inequality comparison true");
+ }
+ else
+ {
+ // Change the code of l_rc2
+ l_rc2 = l_code2;
+
+ // Ensure that the equality comparison returns false
+ if (l_rc == l_rc2)
+ {
+ TS_FAIL("testRc4. Equality comparison true");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns true
+ if (!(l_rc != l_rc2))
+ {
+ TS_FAIL("testRc4. Inequality comparison false");
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #5
+ */
+ void testRc5()
+ {
+ uint32_t l_code = 6;
+ uint32_t l_code2 = 7;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Ensure that the equality comparison returns true when comparing to the
+ // same return code value
+ if (!(l_rc == l_code))
+ {
+ TS_FAIL("testRc5. 1. Equality comparison false");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns false when comparing to
+ // the same return code value
+ if (l_rc != l_code)
+ {
+ TS_FAIL("testRc5. 2. Inequality comparison true");
+ }
+ else
+ {
+ // Ensure that the equality comparison returns false when comparing
+ // to a different return code value
+ if (l_rc == l_code2)
+ {
+ TS_FAIL("testRc5. 3. Equality comparison true");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns true when
+ // comparing to a different return code value
+ if (!(l_rc != l_code2))
+ {
+ TS_FAIL("testRc5. 4. Inequality comparison false");
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #6
+ */
+ void testRc6()
+ {
+ uint32_t l_code = 6;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Ensure that the getData function returns NULL
+ void * l_pData = reinterpret_cast<void *> (0x12345678);
+
+ l_pData = l_rc.getData();
+ if (l_pData != NULL)
+ {
+ TS_FAIL("testRc6. getData did not return NULL");
+ }
+ else
+ {
+ // Ensure that the releaseData function returns NULL
+ l_pData = reinterpret_cast<void *> (0x12345678);
+
+ l_pData = l_rc.releaseData();
+
+ if (l_pData != NULL)
+ {
+ TS_FAIL("testRc6. releaseData did not return NULL");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #7
+ */
+ void testRc7()
+ {
+ uint32_t l_code = 10;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Assign ReturnCodeData. Note that this should really be an errlHndl_t,
+ // because the FSP deleteData function will attempt to delete an error
+ // log, but this is just for test, the data will be released before the
+ // ReturnCode is destructed.
+ uint32_t l_myData = 6;
+ void * l_pMyData = reinterpret_cast<void *> (&l_myData);
+ (void) l_rc.setData(l_pMyData);
+
+ // Ensure that getData retrieves the ReturnCodeData
+ void * l_pMyDataCheck = l_rc.getData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc7. getData returned unexpected data ptr");
+ }
+ else
+ {
+ // Ensure that getData retrieves the ReturnCodeData again
+ l_pMyDataCheck = NULL;
+ l_pMyDataCheck = l_rc.getData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc7. getData returned unexpected data ptr");
+ }
+ }
+
+ // Release the data to avoid ReturnCode from deleting in on destruction
+ l_pMyDataCheck = l_rc.releaseData();
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #8
+ */
+ void testRc8()
+ {
+ uint32_t l_code = 10;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Assign ReturnCodeData. Note that this should really be an errlHndl_t,
+ // because the FSP deleteData function will attempt to delete an error
+ // log, but this is just for test, the data will be released before the
+ // ReturnCode is destructed.
+ uint32_t l_myData = 6;
+ void * l_pMyData = reinterpret_cast<void *> (&l_myData);
+ (void) l_rc.setData(l_pMyData);
+
+ // Ensure that releaseData retrieves the ReturnCodeData
+ void * l_pMyDataCheck = l_rc.releaseData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc8. getData returned unexpected data ptr");
+ }
+ else
+ {
+ // Ensure that releaseData now returns NULL
+ l_pMyDataCheck = NULL;
+ l_pMyDataCheck = l_rc.releaseData();
+
+ if (l_pMyDataCheck != NULL)
+ {
+ TS_FAIL("testRc8. getData returned non NULL ptr");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #9
+ */
+ void testRc9()
+ {
+ uint32_t l_code = 10;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Assign ReturnCodeData. Note that this should really be an errlHndl_t,
+ // because the FSP deleteData function will attempt to delete an error
+ // log, but this is just for test, the data will be released before the
+ // ReturnCode is destructed.
+ uint32_t l_myData = 6;
+ void * l_pMyData = reinterpret_cast<void *> (&l_myData);
+ (void) l_rc.setData(l_pMyData);
+
+ // Create a ReturnCode using the copy constructor
+ ReturnCode l_rc2(l_rc);
+
+ // Ensure that the two ReturnCodes are the same
+ if (l_rc != l_rc2)
+ {
+ TS_FAIL("testRc9. ReturnCodes differ");
+ }
+ else
+ {
+ // Ensure that getData retrieves the ReturnCodeData from l_rc
+ void * l_pMyDataCheck = l_rc.getData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc9. getData returned unexpected data ptr (1)");
+ }
+ else
+ {
+ // Ensure that getData retrieves the ReturnCodeData from l_rc2
+ l_pMyDataCheck = NULL;
+ l_pMyDataCheck = l_rc2.getData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc9. getData returned unexpected data ptr (2)");
+ }
+ }
+ }
+
+ // Release the data to avoid ReturnCode from deleting in on destruction.
+ // This will release the data from both copies of the ReturnCode.
+ (void) l_rc.releaseData();
+
+ return;
+ }
+
+ /**
+ * @brief Test FAPI return codes #10
+ */
+ void testRc10()
+ {
+ uint32_t l_code = 10;
+
+ // Create a ReturnCode
+ ReturnCode l_rc(l_code);
+
+ // Assign ReturnCodeData. Note that this should really be an errlHndl_t,
+ // because the FSP deleteData function will attempt to delete an error
+ // log, but this is just for test, the data will be released before the
+ // ReturnCode is destructed.
+ uint32_t l_myData = 6;
+ void * l_pMyData = reinterpret_cast<void *> (&l_myData);
+ (void) l_rc.setData(l_pMyData);
+
+ // Create a ReturnCode using the assignment operator
+ ReturnCode l_rc2;
+ l_rc2 = l_rc;
+
+ // Ensure that the two ReturnCodes are the same
+ if (l_rc != l_rc2)
+ {
+ TS_FAIL("testRc10. ReturnCodes differ");
+ }
+ else
+ {
+ // Ensure that releaseData retrieves the ReturnCodeData from l_rc
+ void * l_pMyDataCheck = l_rc.releaseData();
+
+ if (l_pMyDataCheck != l_pMyData)
+ {
+ TS_FAIL("testRc10. releaseData returned unexpected data ptr");
+ }
+ else
+ {
+ // Ensure that releaseData retrieves NULL from l_rc2
+ l_pMyDataCheck = NULL;
+ l_pMyDataCheck = l_rc2.releaseData();
+
+ if (l_pMyDataCheck != NULL)
+ {
+ TS_FAIL("testRc10. releaseData returned non NULL ptr");
+ }
+ }
+ }
+
+ return;
+ }
+
+
+
+};
+
+#endif
diff --git a/src/usr/hwpf/test/fapitargettest.H b/src/usr/hwpf/test/fapitargettest.H
new file mode 100644
index 000000000..6cd8fd9b8
--- /dev/null
+++ b/src/usr/hwpf/test/fapitargettest.H
@@ -0,0 +1,266 @@
+#ifndef __FAPITARGETTEST_H
+#define __FAPITARGETTEST_H
+
+/**
+ * @file fapitargettest.H
+ *
+ * @brief Test case for FAPI targets
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <fapi.H>
+
+using namespace fapi;
+
+class FapiTargetTest: public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief Test target #1
+ */
+ void testTarget1()
+ {
+ // Create Target using default constructor
+ Target l_target;
+
+ // Ensure that the handle pointer is NULL
+ void * l_pHandle = l_target.get();
+
+ if (l_pHandle != NULL)
+ {
+ TS_FAIL("testTarget1. Handle is not NULL");
+ }
+ else
+ {
+ // Ensure that the type is TARGET_TYPE_NONE
+ TargetType l_type = l_target.getType();
+ if (l_type != TARGET_TYPE_NONE)
+ {
+ TS_FAIL("testTarget1. Type is not TARGET_TYPE_NONE");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test target #2
+ */
+ void testTarget2()
+ {
+ uint8_t l_handle = 7;
+ void * l_pHandle = reinterpret_cast<void *>(&l_handle);
+
+ // Create Target
+ Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+
+ // Ensure that the handle pointer is as expected
+ void * l_pHandleCheck = l_target.get();
+
+ if (l_pHandleCheck != l_pHandle)
+ {
+ TS_FAIL("testTarget2. Handle is not as expected");
+ }
+ else
+ {
+ // Ensure that the type is TARGET_TYPE_DIMM
+ TargetType l_type = l_target.getType();
+
+ if (l_type != TARGET_TYPE_DIMM)
+ {
+ TS_FAIL("testTarget2. Type is not TARGET_TYPE_DIMM");
+ }
+ }
+
+ // Set the handle pointer to NULL to prevent any problem on destruction
+ l_target.set(NULL);
+
+ return;
+ }
+
+ /**
+ * @brief Test target #3
+ */
+ void testTarget3()
+ {
+ // Create Target using default constructor
+ Target l_target;
+
+ // Set the handle
+ uint8_t l_handle = 7;
+ void * l_pHandle = reinterpret_cast<void *>(&l_handle);
+ l_target.set(l_pHandle);
+
+ // Ensure that the handle pointer is as expected
+ void * l_pHandleCheck = l_target.get();
+
+ if (l_pHandleCheck != l_pHandle)
+ {
+ TS_FAIL("testTarget3. Handle is not as expected");
+ }
+ else
+ {
+ // Set the type
+ l_target.setType(TARGET_TYPE_DIMM);
+
+ // Ensure that the type is TARGET_TYPE_DIMM
+ TargetType l_type = l_target.getType();
+
+ if (l_type != TARGET_TYPE_DIMM)
+ {
+ TS_FAIL("testTarget3. Type is not TARGET_TYPE_DIMM");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test target #4
+ */
+ void testTarget4()
+ {
+ // Create Target
+ uint8_t l_handle = 7;
+ void * l_pHandle = reinterpret_cast<void *>(&l_handle);
+ Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+
+ // Create Target using copy constructor
+ Target l_target2(l_target);
+
+ // Ensure that the target types are the same
+ TargetType l_type = l_target.getType();
+ TargetType l_type2 = l_target2.getType();
+
+ if (l_type != l_type2)
+ {
+ TS_FAIL("testTarget4. Types are not the same ");
+ }
+ else
+ {
+ // Ensure that the handles are the same
+ void * l_han1 = l_target.get();
+ void * l_han2 = l_target2.get();
+
+ if (l_han1 != l_han2)
+ {
+ TS_FAIL("testTarget4. Handles are not the same");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test target #5
+ */
+ void testTarget5()
+ {
+ // Create Target
+ uint8_t l_handle = 7;
+ void * l_pHandle = reinterpret_cast<void *>(&l_handle);
+ Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+
+ // Create Target using assignment operator
+ Target l_target2;
+ l_target2 = l_target;
+
+ // Ensure that the target types are the same
+ TargetType l_type = l_target.getType();
+ TargetType l_type2 = l_target2.getType();
+
+ if (l_type != l_type2)
+ {
+ TS_FAIL("testTarget5. Types are not the same");
+ }
+ else
+ {
+ // Ensure that the handles are the same
+ void * l_han1 = l_target.get();
+ void * l_han2 = l_target2.get();
+
+ if (l_han1 != l_han2)
+ {
+ TS_FAIL("testTarget5. Handles are not the same");
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * @brief Test target #6
+ */
+ void testTarget6()
+ {
+ // Create similar Targets
+ uint8_t l_handle = 7;
+ void * l_pHandle = reinterpret_cast<void *>(&l_handle);
+ Target l_target(TARGET_TYPE_DIMM, l_pHandle);
+ Target l_target2(TARGET_TYPE_DIMM, l_pHandle);
+
+ // Ensure that the equality comparison returns true
+ if (!(l_target == l_target2))
+ {
+ TS_FAIL("testTarget6. 1. Equality comparison false");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns false
+ if (l_target != l_target2)
+ {
+ TS_FAIL("testTarget6. 2. Inequality comparison true");
+ }
+ else
+ {
+ // Change the target type of l_target2
+ (void)l_target2.setType(TARGET_TYPE_PROC_CHIP);
+
+ // Ensure that the equality comparison returns false
+ if (l_target == l_target2)
+ {
+ TS_FAIL("testTarget6. 3. Equality comparison true");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns true
+ if (!(l_target != l_target2))
+ {
+ TS_FAIL("testTarget6. 4. Inequality comparison false");
+ }
+ else
+ {
+ // Reset the target type of l_target2
+ (void)l_target2.setType(TARGET_TYPE_DIMM);
+
+ // Change the handle of l_target
+ uint8_t l_handle2 = 7;
+ void * l_pHandle2 = reinterpret_cast<void *>(&l_handle2);
+ (void)l_target.set(l_pHandle2);
+
+ // Ensure that the equality comparison returns false
+ if (l_target == l_target2)
+ {
+ TS_FAIL("testTarget6. 5. Equality comparison true");
+ }
+ else
+ {
+ // Ensure that the inequality comparison returns true
+ if (!(l_target != l_target2))
+ {
+ TS_FAIL("testTarget6. 6. Inequality comparison "
+ "false");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+};
+
+#endif
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
new file mode 100644
index 000000000..fa9a1c555
--- /dev/null
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -0,0 +1,94 @@
+#ifndef __HWPFTEST_H
+#define __HWPFTEST_H
+
+/**
+ * @file hwpftest.H
+ *
+ * @brief Test case for HWPF implementation
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <fapi.H>
+#include <fapiPlatHwpInvoker.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <targeting/targetservice.H>
+
+using namespace fapi;
+using namespace TARGETING;
+
+class HwpfTest: public CxxTest::TestSuite
+{
+public:
+
+ /**
+ * @brief Test HWPF trace
+ */
+ void testHwpf1()
+ {
+ // Trace into all the FAPI trace buffers
+ uint32_t l_val = 4;
+ const char * l_pStr = "test-str";
+
+ FAPI_INF("Test INF Trace");
+ FAPI_INF("Test INF Trace. hex: 0x%x", l_val);
+ FAPI_INF("Test INF Trace. string: %s", l_pStr);
+ FAPI_INF("Test INF Trace. 0x%x, %s", l_val, l_pStr);
+
+ FAPI_IMP("Test IMP Trace");
+ FAPI_IMP("Test IMP Trace. hex: 0x%x", l_val);
+ FAPI_IMP("Test IMP Trace. string: %s", l_pStr);
+ FAPI_IMP("Test IMP Trace. 0x%x, %s", l_val, l_pStr);
+
+ FAPI_ERR("Test ERR Trace");
+ FAPI_ERR("Test ERR Trace. hex: 0x%x", l_val);
+ FAPI_ERR("Test ERR Trace. string: %s", l_pStr);
+ FAPI_ERR("Test ERR Trace. 0x%x, %s", l_val, l_pStr);
+
+ FAPI_DBG("Test DBG Trace");
+ FAPI_DBG("Test DBG Trace. hex: 0x%x", l_val);
+ FAPI_DBG("Test DBG Trace. string: %s", l_pStr);
+ FAPI_DBG("Test DBG Trace. 0x%x, %s", l_val, l_pStr);
+
+ return;
+ }
+
+
+ /**
+ * @brief Test HWPF: calling a procedure
+ */
+ void testHwpf2()
+ {
+ // Call a test hardware procedure
+ errlHndl_t l_err = NULL;
+
+ // Set processor chip to the master
+ TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+
+ // Call the hardware procedure
+ bool l_clocksOn = false;
+ l_err = invokeHwpIsP7EM0ChipletClockOn(l_testTarget, l_clocksOn);
+ if (l_err)
+ {
+ TS_FAIL("testHwpf2: Unit Test failed. HWP failed. Error logged");
+ // Commit/delete error
+ errlCommit(l_err);
+ }
+ else
+ {
+ if (l_clocksOn)
+ {
+ TS_TRACE("testHwpf2: Success. Clocks are on");
+ }
+ else
+ {
+ TS_TRACE("testHwpf2: Success. Clocks are off");
+ }
+ }
+
+ return;
+ }
+
+};
+
+#endif
diff --git a/src/usr/hwpf/test/makefile b/src/usr/hwpf/test/makefile
new file mode 100644
index 000000000..c32529276
--- /dev/null
+++ b/src/usr/hwpf/test/makefile
@@ -0,0 +1,11 @@
+ROOTPATH = ../../../..
+
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
+
+MODULE = testhwpf
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
+
OpenPOWER on IntegriCloud