summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2013-08-24 17:18:12 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-08-26 14:06:15 -0500
commitc17858f405d536a746c16ae056d07d2460e9693a (patch)
treec4568408ae8b64b41fde0c9e2f816c52436e5666
parent25b123db517b4682a94f7cd19257e5a8c232d87f (diff)
downloadtalos-hostboot-c17858f405d536a746c16ae056d07d2460e9693a.tar.gz
talos-hostboot-c17858f405d536a746c16ae056d07d2460e9693a.zip
Added support for FSP mutex attributes
- Added FSP util::Mutex attribute APIs to targeting API - Added FSP util::Mutex attribute support to attribute compiler Change-Id: I612a2796107f60e8e480c182ab804f9902f2326a RTC: 71408 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5910 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/targeting/common/target.H46
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl68
2 files changed, 109 insertions, 5 deletions
diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H
index 866920010..f41a96e4c 100644
--- a/src/include/usr/targeting/common/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -67,6 +67,11 @@ namespace fapi
}
}
+namespace util
+{
+ class Mutex;
+}
+
namespace TARGETING
{
@@ -83,6 +88,7 @@ typedef std::vector<Target> TargetList;
class Target
{
+
public: // Constructors and destructors
/**
@@ -125,6 +131,7 @@ class Target
// at compile time if the attribute is not readable) away
if(AttributeTraits<A>::readable) { }
if(AttributeTraits<A>::notHbMutex) { }
+ if(AttributeTraits<A>::notFspMutex) { }
return _tryGetAttr(A,sizeof(o_attrValue),&o_attrValue);
}
@@ -214,6 +221,20 @@ class Target
mutex_t* getHbMutexAttr() const;
/**
+ * @brief Returns pointer to fsp mutex attribute associated with the
+ * target
+ *
+ * @pre Target service must be initialized and the mutex attribute
+ * must exist. If not initailized then it will be null pointer.
+ *
+ * @post See brief section
+ *
+ * @return Pointer to the specified mutex attribute
+ */
+ template<const ATTRIBUTE_ID A>
+ util::Mutex* getFspMutexAttr() const;
+
+ /**
* @brief Returns pointer to a mutex attribute associated with the
* target, if it exists
*
@@ -394,6 +415,22 @@ class Target
const ATTRIBUTE_ID i_attribute) const;
/**
+ * @brief Returns pointer to fsp mutex attribute associated with the
+ * target
+ *
+ * @param[in] i_attribute Mutex attribute to return
+ *
+ * @pre Target service must be initialized and the mutex attribute
+ * must exist
+ *
+ * @post See brief section
+ *
+ * @return Pointer to the specified mutex attribute
+ */
+ util::Mutex* _getFspMutexAttr(
+ const ATTRIBUTE_ID i_attribute) const;
+
+ /**
* @brief Returns pointer to a mutex attribute associated with the
* target, if it exists
*
@@ -517,6 +554,15 @@ mutex_t* Target::getHbMutexAttr() const
}
template<const ATTRIBUTE_ID A>
+util::Mutex* Target::getFspMutexAttr() const
+{
+ if(AttributeTraits<A>::fspMutex) { }
+ if(AttributeTraits<A>::readable) { }
+ if(AttributeTraits<A>::writeable) { }
+ return _getFspMutexAttr(A);
+}
+
+template<const ATTRIBUTE_ID A>
bool Target::tryGetHbMutexAttr(
mutex_t*& o_pMutex) const
{
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index 0dd2ff734..4ad92f5cf 100755
--- a/src/usr/targeting/common/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -153,7 +153,7 @@ if( !($cfgSrcOutputDir =~ "none") )
or fatal ("Trait file: \"$cfgSrcOutputDir"
. "attributetraits.H\" could not be opened.");
my $traitFile = *TRAIT_FILE;
- writeTraitFileHeader($traitFile);
+ writeTraitFileHeader($attributes,$traitFile);
writeTraitFileTraits($attributes,$traitFile);
writeTraitFileFooter($traitFile);
close $traitFile;
@@ -1476,7 +1476,7 @@ VERBATIM
################################################################################
sub writeTraitFileHeader {
- my($outFile) = @_;
+ my($attributes,$outFile) = @_;
print $outFile <<VERBATIM;
@@ -1499,6 +1499,20 @@ print $outFile <<VERBATIM;
// STD
#include <stdint.h>
#include <stdlib.h>
+VERBATIM
+
+foreach my $attribute (@{$attributes->{attribute}})
+{
+ #check if fspmutex is present?
+ if( (exists $attribute->{simpleType})
+ && (exists $attribute->{simpleType}->{fspmutex}) )
+ {
+ print $outFile "#include <utilmutex.H>\n";
+ last; # don't need to look at any others.
+ }
+}
+
+print $outFile <<VERBATIM;
#include <targeting/common/entitypath.H>
namespace TARGETING
@@ -1570,6 +1584,17 @@ sub writeTraitFileTraits {
$traits .= " notHbMutex,";
}
+ # Mark the attribute as being a fsp mutex or non-fsp mutex
+ if( (exists $attribute->{simpleType})
+ && (exists $attribute->{simpleType}->{fspmutex}) )
+ {
+ $traits .= " fspMutex,";
+ }
+ else
+ {
+ $traits .= " notFspMutex,";
+ }
+
chop($traits);
# Build value type
@@ -1734,7 +1759,9 @@ sub writeAttrErrlCFile {
# things we'll skip:
if(!(exists $attribute->{readable}) || # write-only attributes
!(exists $attribute->{writeable}) || # read-only attributes
- (exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex})) # mutex attributes
+ (exists $attribute->{simpleType} && (
+ (exists $attribute->{simpleType}->{hbmutex}) ||
+ (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes
) {
print $outFile " case (ATTR_",$attribute->{id},"): { break; }\n";
next;
@@ -1900,7 +1927,9 @@ sub writeAttrErrlCFile {
# things we'll skip:
if(!(exists $attribute->{readable}) || # write-only attributes
!(exists $attribute->{writeable}) || # read-only attributes
- (exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex})) # mutex attributes
+ (exists $attribute->{simpleType} && (
+ (exists $attribute->{simpleType}->{hbmutex}) ||
+ (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes
) {
next;
}
@@ -2015,7 +2044,9 @@ sub writeAttrErrlHFile {
# things we'll skip:
if(!(exists $attribute->{readable}) || # write-only attributes
!(exists $attribute->{writeable}) || # read-only attributes
- (exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex})) # mutex attributes
+ (exists $attribute->{simpleType} && (
+ (exists $attribute->{simpleType}->{hbmutex}) ||
+ (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes
) {
print $outFile " //not readable\n";
}
@@ -2047,6 +2078,12 @@ sub writeAttrErrlHFile {
elsif(exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex}) ) {
print $outFile " //Mutex attributes - skipping\n";
}
+ # makes no sense to dump fsp mutex attributes, so skipping
+ elsif( (exists $attribute->{simpleType})
+ && (exists $attribute->{simpleType}->{fspmutex}) )
+ {
+ print $outFile " //Mutex attributes - skipping\n";
+ }
# any complicated types just get dumped as raw hex binary
elsif(exists $attribute->{complexType}) {
#print $outFile " //complexType\n";
@@ -3002,6 +3039,26 @@ sub null {
}
################################################################################
+# Enforce special fsp mutex restrictions
+################################################################################
+
+sub enforceFspMutex {
+ my($attribute,$value) = @_;
+
+ if($value != 0)
+ {
+ fatal("FSP mutex attribute default must always be 0, "
+ . "was $value instead.");
+ }
+
+ if($attribute->{persistency} ne "volatile-zeroed")
+ {
+ fatal("FSP mutex attribute persistency must be volatile-zeroed, "
+ . "was $attribute->{persistency} instead");
+ }
+}
+
+################################################################################
# Enforce special host boot mutex restrictions
################################################################################
@@ -3077,6 +3134,7 @@ sub simpleTypeProperties {
$typesHoH{"enumeration"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "XMLTOHB_USE_PARENT_ATTR_ID" , bytes => 0, bits => 0 , default => \&defaultEnum , alignment => 1, specialPolicies =>\&null, packfmt => "packEnumeration"};
$typesHoH{"hbmutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "mutex_t*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceHbMutex, packfmt =>\&pack8byte};
$typesHoH{"Target_t"} = { supportsArray => 0, canBeHex => 1, complexTypeSupport => 0, typeName => "TARGETING::Target*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&null, packfmt =>\&pack8byte};
+ $typesHoH{"fspmutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "util::Mutex*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceFspMutex, packfmt =>\&pack8byte};
$g_simpleTypeProperties_cache = \%typesHoH;
OpenPOWER on IntegriCloud