diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiAttributeService.H | 40 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCodes.H | 3 | ||||
-rwxr-xr-x | src/include/usr/hwpf/hwp/fapiTestHwpAttr.H | 5 | ||||
-rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H | 1 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 194 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/makefile | 3 | ||||
-rwxr-xr-x | src/usr/hwpf/hwp/fapiTestHwpAttr.C | 69 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/makefile | 3 | ||||
-rw-r--r-- | src/usr/hwpf/makefile | 4 | ||||
-rw-r--r-- | src/usr/hwpf/test/hwpftest.H | 23 | ||||
-rw-r--r-- | src/usr/targeting/xmltohb/attribute_types.xml | 211 | ||||
-rw-r--r-- | src/usr/targeting/xmltohb/target_types.xml | 12 | ||||
-rwxr-xr-x | src/usr/targeting/xmltohb/xmltohb.pl | 22 |
13 files changed, 508 insertions, 82 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiAttributeService.H b/src/include/usr/hwpf/fapi/fapiAttributeService.H index 2fe5ba517..e623a2e8a 100644 --- a/src/include/usr/hwpf/fapi/fapiAttributeService.H +++ b/src/include/usr/hwpf/fapi/fapiAttributeService.H @@ -36,6 +36,7 @@ * mjjones 06/22/2011 Major updates * mjjones 09/06/2011 Remove support for strings * mjjones 09/22/2011 Fixed example + * mjjones 10/13/2011 Added fapiGetInitFileAttr */ #ifndef FAPIATTRIBUTESERVICE_H_ @@ -69,17 +70,44 @@ * attribute. */ #define FAPI_ATTR_GET(ID, PTARGET, VAL) \ - (fapi::AttributeCheck::checkIdType<fapi::ID##_Type>(fapi::ID, VAL), \ + (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ ID##_GETMACRO(ID, PTARGET, VAL)) #define FAPI_ATTR_SET(ID, PTARGET, VAL) \ - (fapi::AttributeCheck::checkIdType<fapi::ID##_Type>(fapi::ID, VAL), \ + (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ ID##_SETMACRO(ID, PTARGET, VAL)) namespace fapi { -namespace AttributeCheck -{ +/** + * @brief Get an InitFile attribute + * + * This function gets a copy of an attribute. In the case of an array attribute, + * The value in the specified index is retrieved. This should be used by the + * InitFile HWP only, that HWP processes a binary InitFile and therefore needs + * to read a variable ID of a variable data type. Standard HWPs should use the + * FAPI_ATTR_GET macro which automatically checks the type for correct usage. + * + * If there are ever attributes with more than 4 dimensions then this function + * will need to be updated. + * + * @param[in] i_id AttributeID + * @param[in] i_pTarget Pointer to fapi::Target (can be NULL for system) + * @param[out] o_val Reference to uint64_t where attribute value is set + * @param[in] i_arrayIndex1 If array attribute then index1 + * @param[in] i_arrayIndex2 If at least 2D array attribute then index2 + * @param[in] i_arrayIndex3 If at least 3D array attribute then index3 + * @param[in] i_arrayIndex4 If at least 4D array attribute then index4 + * + * @return ReturnCode. Zero if success + */ +ReturnCode fapiGetInitFileAttr(const AttributeId i_id, + Target * i_pTarget, + uint64_t & o_val, + const uint32_t i_arrayIndex1 = 0, + const uint32_t i_arrayIndex2 = 0, + const uint32_t i_arrayIndex3 = 0, + const uint32_t i_arrayIndex4 = 0); /** * @brief Check the ID and TYPE @@ -87,9 +115,7 @@ namespace AttributeCheck * This is called by FAPI code to check at compile time that a FAPI attribute * access is using the correct data type and a valid AttributeId */ -template<typename T> void checkIdType(AttributeId, T &) {} - -} +template<typename T> void fapiCheckIdType(AttributeId, T &) {} } diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodes.H b/src/include/usr/hwpf/fapi/fapiReturnCodes.H index 3c31a72c0..438f768c8 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCodes.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCodes.H @@ -35,7 +35,7 @@ * mjjones 06/30/2011 Add FAPI_RC_ATTR_UNIT_TEST_FAIL * mjjones 08/10/2011 Add FAPI_RC_FFDC_HWP_NOT_FOUND * mjjones 09/23/2011 Remove FAPI_RC_FFDC_HWP_NOT_FOUND - * + * mjjones 10/07/2011 Add FAPI_RC_INVALID_ATTR_GET */ #ifndef FAPIRETURNCODES_H_ @@ -62,6 +62,7 @@ enum // FAPI generated return codes FAPI_RC_NOT_IMPLEMENTED = FAPI_RC_FAPI_MASK | 0x01, FAPI_RC_ATTR_UNIT_TEST_FAIL = FAPI_RC_FAPI_MASK | 0x02, + FAPI_RC_INVALID_ATTR_GET = FAPI_RC_FAPI_MASK | 0x03, // PLAT generated return codes FAPI_RC_PLAT_ERR_SEE_DATA = FAPI_RC_PLAT_MASK | 0x01, diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H b/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H index 5fc5a360c..cdf7e6afb 100755 --- a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H +++ b/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H @@ -31,6 +31,7 @@ * Flag Defect/Feature User Date Description * ------ -------------- ---------- ----------- ---------------------------- * mjjones 06/30/2011 Created. + * mjjones 10/07/2011 Removed target param */ #ifndef FAPITESTHWPATTR_H_ @@ -46,11 +47,9 @@ extern "C" /** * @brief HWP that exercises attributes * - * @param[in] i_target Reference to target (unused by HWP) - * * @return ReturnCode */ -fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target); +fapi::ReturnCode hwpTestAttributes(); } // extern "C" diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H index 69e904e23..aeef2a485 100644 --- a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H +++ b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H @@ -38,6 +38,7 @@ #include <fapiTestHwpError.H> #include <fapiTestHwpFfdc.H> #include <fapiTestHwpConfig.H> +#include <fapiTestHwpAttr.H> /** * @brief HWP Executor macro diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 1f8ae4430..6ee3fbc8b 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -40,6 +40,7 @@ # mjjones 06/23/11 Parse more info # mjjones 07/05/11 Take output dir as parameter # mjjones 09/06/11 Remove string/defaultVal support +# mjjones 10/07/11 Create fapiAttributeService.C # # End Change Log ****************************************************** @@ -71,30 +72,49 @@ my $xml = new XML::Simple (KeyAttr=>[]); #use Data::Dumper; #------------------------------------------------------------------------------ -# Open output file for writing +# Open output files for writing #------------------------------------------------------------------------------ -my $outputFile = $ARGV[0]; -$outputFile .= "/"; -$outputFile .= "fapiAttributeIds.H"; -open(OUTFILE, ">", $outputFile); +my $aiFile = $ARGV[0]; +$aiFile .= "/"; +$aiFile .= "fapiAttributeIds.H"; +open(AIFILE, ">", $aiFile); + +my $asFile = $ARGV[0]; +$asFile .= "/"; +$asFile .= "fapiAttributeService.C"; +open(ASFILE, ">", $asFile); #------------------------------------------------------------------------------ -# Print Start of file information +# Print Start of file information to 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 AIFILE "// fapiAttributeIds.H\n"; +print AIFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n"; +print AIFILE "#ifndef FAPIATTRIBUTEIDS_H_\n"; +print AIFILE "#define FAPIATTRIBUTEIDS_H_\n\n"; +print AIFILE "namespace fapi\n"; +print AIFILE "{\n\n"; +print AIFILE "\/**\n"; +print AIFILE " * \@brief Enumeration of attribute IDs\n"; +print AIFILE " *\/\n"; +print AIFILE "enum AttributeId\n{\n"; #------------------------------------------------------------------------------ -# Print AttributeId enumeration start +# Print Start of file information to fapiAttributeService.C #------------------------------------------------------------------------------ -print OUTFILE "\/**\n"; -print OUTFILE " * \@brief Enumeration of attribute IDs\n"; -print OUTFILE " *\/\n"; -print OUTFILE "enum AttributeId\n{\n"; +print ASFILE "// fapiAttributeService.C\n"; +print ASFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n"; +print ASFILE "#include <fapiAttributeService.H>\n\n"; +print ASFILE "namespace fapi\n"; +print ASFILE "{\n\n"; +print ASFILE "ReturnCode fapiGetInitFileAttr(const AttributeId i_id,\n"; +print ASFILE " Target * i_pTarget,\n"; +print ASFILE " uint64_t & o_val,\n"; +print ASFILE " const uint32_t i_arrayIndex1,\n"; +print ASFILE " const uint32_t i_arrayIndex2,\n"; +print ASFILE " const uint32_t i_arrayIndex3,\n"; +print ASFILE " const uint32_t i_arrayIndex4)\n"; +print ASFILE "{\n"; +print ASFILE " ReturnCode l_rc;\n\n"; #------------------------------------------------------------------------------ # For each XML file @@ -115,7 +135,7 @@ foreach my $argnum (1 .. $#ARGV) foreach my $attr (@{$attributes->{attribute}}) { #---------------------------------------------------------------------- - # Print the AttributeId + # Print the AttributeId to fapiAttributeIds.H #---------------------------------------------------------------------- if (! exists $attr->{id}) { @@ -123,49 +143,41 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } - print OUTFILE " ", $attr->{id}, ",\n"; + print AIFILE " ", $attr->{id}, ",\n"; }; -} - -#------------------------------------------------------------------------------ -# Print AttributeId enumeration end -#------------------------------------------------------------------------------ -print OUTFILE "};\n\n"; -#------------------------------------------------------------------------------ -# Print Attribute Information comment -#------------------------------------------------------------------------------ -print OUTFILE "\/**\n"; -print OUTFILE " * \@brief Attribute Information\n"; -print OUTFILE " *\/\n"; - -#------------------------------------------------------------------------------ -# For each XML file -#------------------------------------------------------------------------------ -foreach my $argnum (1 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; + #-------------------------------------------------------------------------- + # Print AttributeId enumeration end to fapiAttributeIds.H + #-------------------------------------------------------------------------- + print AIFILE "};\n\n"; - # read XML file - my $attributes = $xml->XMLin($infile); + #-------------------------------------------------------------------------- + # Print Attribute Information comment to fapiAttributeIds.H + #-------------------------------------------------------------------------- + print AIFILE "\/**\n"; + print AIFILE " * \@brief Attribute Information\n"; + print AIFILE " *\/\n"; #-------------------------------------------------------------------------- # For each Attribute #-------------------------------------------------------------------------- + my $attCount = 0; + foreach my $attr (@{$attributes->{attribute}}) { #---------------------------------------------------------------------- - # Print a comment with the attribute description + # Print a comment with the attribute description to fapiAttributeIds.H #---------------------------------------------------------------------- if ($attr->{description}) { - print OUTFILE "// $attr->{id}: $attr->{description}\n"; + print AIFILE "// $attr->{id}: $attr->{description}\n"; } #---------------------------------------------------------------------- # Figure out the attribute array dimensions (if arry) #---------------------------------------------------------------------- my $arrayDimensions = ""; + my $numArrayDimensions = 0; if ($attr->{array}) { # Figure out the array dimensions @@ -174,11 +186,12 @@ foreach my $argnum (1 .. $#ARGV) foreach my $val (@vals) { $arrayDimensions .= "[${val}]"; + $numArrayDimensions++; } } #---------------------------------------------------------------------- - # Print the typedef for each attribute's value type + # Print the typedef for each attribute's val type to fapiAttributeIds.H #---------------------------------------------------------------------- if (! exists $attr->{valueType}) { @@ -188,15 +201,15 @@ foreach my $argnum (1 .. $#ARGV) if ($attr->{valueType} eq 'uint8') { - print OUTFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n"; + print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n"; } elsif ($attr->{valueType} eq 'uint32') { - print OUTFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n"; + print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n"; } elsif ($attr->{valueType} eq 'uint64') { - print OUTFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n"; + print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n"; } else { @@ -206,33 +219,33 @@ foreach my $argnum (1 .. $#ARGV) } #---------------------------------------------------------------------- - # Print if the platform initializes the value + # Print if the platform initializes the value to fapiAttributeIds.H #---------------------------------------------------------------------- if (exists $attr->{platInit}) { - print OUTFILE "#define $attr->{id}_PLATINIT true\n" + print AIFILE "#define $attr->{id}_PLATINIT true\n" } else { - print OUTFILE "#define $attr->{id}_PLATINIT false\n" + print AIFILE "#define $attr->{id}_PLATINIT false\n" } #---------------------------------------------------------------------- - # Print the value enumeration (if it is specified) + # Print the value enumeration (if specified) to fapiAttributeIds.H #---------------------------------------------------------------------- if (exists $attr->{enum}) { - print OUTFILE "enum $attr->{id}_Enum\n{\n"; + print AIFILE "enum $attr->{id}_Enum\n{\n"; # Values must be separated by white space my @vals = split(' ', $attr->{enum}); foreach my $val (@vals) { - print OUTFILE " $attr->{id}_${val},\n"; + print AIFILE " $attr->{id}_${val},\n"; } - print OUTFILE "};\n"; + print AIFILE "};\n"; } #---------------------------------------------------------------------- @@ -241,23 +254,82 @@ foreach my $argnum (1 .. $#ARGV) #---------------------------------------------------------------------- if (! exists $attr->{writeable}) { - print OUTFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n"; + print AIFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n"; } #---------------------------------------------------------------------- - # Print newline between each attribute's information + # Print newline between each attribute's info to fapiAttributeIds.H #---------------------------------------------------------------------- - print OUTFILE "\n"; + print AIFILE "\n"; + + #---------------------------------------------------------------------- + # Print the attribute get code to fapiAttributeService.C + # *** TODO *** + # Currently, all attributes are supported in fapiGetInitFileAttr() in + # fapiAttributeService.C. Ideally only the initfile attributes should + # be supported to minimize code size. Need to figure out how to do this + #---------------------------------------------------------------------- + if ($attCount > 0) + { + print ASFILE " else "; + } + else + { + print ASFILE " "; + } + $attCount++; + + print ASFILE "if (i_id == $attr->{id})\n"; + print ASFILE " {\n"; + print ASFILE " $attr->{id}_Type l_attr;\n"; + print ASFILE " l_rc = FAPI_ATTR_GET($attr->{id}, i_pTarget, l_attr);\n"; + print ASFILE " o_val = l_attr"; + + if ($numArrayDimensions >= 5) + { + print ("fapiParseAttributeInfo.pl ERROR. More than 4 array dimensions!!\n"); + exit(1); + } + else + { + for (my $i = 0; $i < $numArrayDimensions; $i++) + { + print ASFILE "[i_arrayIndex"; + print ASFILE $i+1; + print ASFILE "]"; + } + } + + print ASFILE ";\n"; + print ASFILE " }\n"; }; } #------------------------------------------------------------------------------ -# Print End of file information +# Print End of file information to fapiAttributeIds.H #------------------------------------------------------------------------------ -print OUTFILE "}\n\n"; -print OUTFILE "#endif\n"; +print AIFILE "}\n\n"; +print AIFILE "#endif\n"; + +#------------------------------------------------------------------------------ +# Print End of file information to fapiAttributeService.C +#-------------------------------------------------------------------------- +print ASFILE " else\n"; +print ASFILE " {\n"; +print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n"; +print ASFILE " l_rc = FAPI_RC_INVALID_ATTR_GET;\n"; +print ASFILE " }\n\n"; +print ASFILE " if (l_rc)\n"; +print ASFILE " {\n"; +print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Error getting attr\");\n"; +print ASFILE " }\n\n"; +print ASFILE " return l_rc;\n"; +print ASFILE "}\n\n"; +print ASFILE "}\n"; + #------------------------------------------------------------------------------ -# Close output file +# Close output files #------------------------------------------------------------------------------ -close(OUTFILE); +close(AIFILE); +close(ASFILE); diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile index 31124d43b..de126cf31 100644 --- a/src/usr/hwpf/fapi/makefile +++ b/src/usr/hwpf/fapi/makefile @@ -32,7 +32,8 @@ OBJS = fapiReturnCode.o \ fapiReturnCodeDataRef.o \ fapiTarget.o \ fapiHwAccess.o \ - fapiErrorInfo.o + fapiErrorInfo.o \ + fapiAttributeService.o include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C index d8693d610..dd07721a5 100755 --- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C +++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C @@ -34,6 +34,8 @@ * mjjones 06/30/2011 Created. * mjjones 09/07/2011 Update to test scratch attrs * mjjones 10/06/2011 Updates traces + * mjjones 10/07/2011 Removed target param + * Test scratch attributes * */ @@ -45,7 +47,7 @@ extern "C" //****************************************************************************** // hwpTestAttributes function //****************************************************************************** -fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target) +fapi::ReturnCode hwpTestAttributes() { FAPI_INF("hwpTestAttributes: Start HWP"); @@ -960,6 +962,71 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target) } //---------------------------------------------------------------------- + // Test getting scratch attributes with the fapiGetInitFileAttr function + //---------------------------------------------------------------------- + uint64_t l_val = 0; + fapi::AttributeId l_id; + fapi::AttributeId l_ids[] = {fapi::ATTR_SCRATCH_UINT8_1, + fapi::ATTR_SCRATCH_UINT8_2, + fapi::ATTR_SCRATCH_UINT32_1, + fapi::ATTR_SCRATCH_UINT32_2, + fapi::ATTR_SCRATCH_UINT64_1, + fapi::ATTR_SCRATCH_UINT64_2, + fapi::ATTR_SCRATCH_UINT8_ARRAY_1, + fapi::ATTR_SCRATCH_UINT8_ARRAY_2, + fapi::ATTR_SCRATCH_UINT32_ARRAY_1, + fapi::ATTR_SCRATCH_UINT32_ARRAY_2, + fapi::ATTR_SCRATCH_UINT64_ARRAY_1, + fapi::ATTR_SCRATCH_UINT64_ARRAY_2}; + + for (uint32_t i = 0; i < 12; i++) + { + l_val = 7; + l_id = l_ids[i]; + l_rc = fapiGetInitFileAttr(l_id, NULL, l_val); + + if (l_rc) + { + FAPI_ERR("hwpTestAttributes: ID: %d. Error 0x%x from fapiGetInitFileAttr", + l_ids[i], static_cast<uint32_t>(l_rc)); + break; + } + + if (l_val != 0) + { + l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; + FAPI_ERR("hwpTestAttributes: ID: %d. Get returned %d", + l_ids[i], static_cast<uint32_t>(l_val)); + break; + } + } + + if (l_rc) + { + break; + } + + //---------------------------------------------------------------------- + // Test getting an invalid scratch attribute + //---------------------------------------------------------------------- + fapi::AttributeId l_badId = static_cast<fapi::AttributeId>(0xff); + l_rc = fapiGetInitFileAttr(l_badId, NULL, l_val); + + if (l_rc) + { + FAPI_INF("hwpTestAttributes: Logging expected error 0x%x from fapiGetInitFileAttr", + static_cast<uint32_t>(l_rc)); + fapiLogError(l_rc); + break; + } + else + { + FAPI_ERR("hwpTestAttributes: Did not get error from fapiGetInitFileAttr"); + l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; + break; + } + + //---------------------------------------------------------------------- // Test invalid accesses //---------------------------------------------------------------------- diff --git a/src/usr/hwpf/hwp/makefile b/src/usr/hwpf/hwp/makefile index 4eb0da718..25ed0e18d 100644 --- a/src/usr/hwpf/hwp/makefile +++ b/src/usr/hwpf/hwp/makefile @@ -31,6 +31,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat OBJS = fapiTestHwp.o \ fapiTestHwpError.o \ fapiTestHwpFfdc.o \ - fapiTestHwpConfig.o + fapiTestHwpConfig.o \ + fapiTestHwpAttr.o include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile index 96d42c7e5..1842daae7 100644 --- a/src/usr/hwpf/makefile +++ b/src/usr/hwpf/makefile @@ -24,7 +24,7 @@ ROOTPATH = ../../.. MODULE = hwpf FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiHwpErrorInfo.H -FAPI_ATTR_TARGETS = fapiAttributeIds.H +FAPI_ATTR_TARGETS = fapiAttributeIds.H fapiAttributeService.C GENFILES = ${FAPI_ERROR_TARGETS} ${FAPI_ATTR_TARGETS} SUBDIRS = fapi.d hwp.d plat.d test.d @@ -36,7 +36,7 @@ $(call GENTARGET, $(FAPI_ERROR_TARGETS)) : \ fapi/fapiParseErrorInfo.pl hwp/fapiHwpErrorInfo.xml $< $(dir $@) $(filter-out $<,$^) -# fapiParseAttributeInfo.pl produces a single output file: FAPI_ATTR_TARGETS +# fapiParseAttributeInfo.pl produces multiple output files: FAPI_ATTR_TARGETS $(call GENTARGET, $(FAPI_ATTR_TARGETS)) : \ fapi/fapiParseAttributeInfo.pl hwp/fapiHwpAttributeInfo.xml $< $(dir $@) $(filter-out $<,$^) diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H index eaf2fbc36..cfc9abd27 100644 --- a/src/usr/hwpf/test/hwpftest.H +++ b/src/usr/hwpf/test/hwpftest.H @@ -130,7 +130,28 @@ public: } else { - TS_TRACE("testHwpf3: Unit Test failed. hwpTestConfig passed. Error logged"); + TS_TRACE("testHwpf3: Unit Test passed. hwpTestConfig passed. Error logged"); + } + } + + /** + * @brief Test HWPF Attributes: call a test procedure that exercises the FAPI + * scratch attributes + */ + void testHwpf4() + { + errlHndl_t l_err = NULL; + + FAPI_INVOKE_HWP(l_err, hwpTestAttributes); + + if (l_err) + { + TS_FAIL("testHwpf4: Unit Test failed. hwpTestAttributes failed. Error logged"); + errlCommit(l_err); + } + else + { + TS_TRACE("testHwpf4: Unit Test passed. hwpTestAttributes passed. Error logged"); } } diff --git a/src/usr/targeting/xmltohb/attribute_types.xml b/src/usr/targeting/xmltohb/attribute_types.xml index 72bbee8ec..7bcc2c840 100644 --- a/src/usr/targeting/xmltohb/attribute_types.xml +++ b/src/usr/targeting/xmltohb/attribute_types.xml @@ -231,6 +231,217 @@ </attribute> <attribute> + <id>SCRATCH_UINT8_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint8_t> + <default>0</default> + </uint8_t> + </simpleType> + <!-- TODO All scratch attributes should be volatile-zeroed. Need Patrick kernel fix --> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT8_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT8_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint8_t> + <default>0</default> + </uint8_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT8_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT32_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint32_t> + <default>0</default> + </uint32_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT32_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT32_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint32_t> + <default>0</default> + </uint32_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT32_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT64_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint64_t> + <default>0</default> + </uint64_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT64_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT64_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint64_t> + <default>0</default> + </uint64_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT64_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT8_ARRAY_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint8_t> + <default>0</default> + </uint8_t> + <array>32</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT8_ARRAY_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT8_ARRAY_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint8_t> + <default>0</default> + </uint8_t> + <array>2, 3, 4</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT8_ARRAY_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT32_ARRAY_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint32_t> + <default>0</default> + </uint32_t> + <array>8</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT32_ARRAY_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT32_ARRAY_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint32_t> + <default>0</default> + </uint32_t> + <array>2,3</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT32_ARRAY_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT64_ARRAY_1</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint64_t> + <default>0</default> + </uint64_t> + <array>4</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT64_ARRAY_1</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> + <id>SCRATCH_UINT64_ARRAY_2</id> + <description>Scratch attribute that can be used for dev/test</description> + <simpleType> + <uint64_t> + <default>0</default> + </uint64_t> + <array>2,2</array> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_SCRATCH_UINT64_ARRAY_2</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> <id>DUMMY_RW</id> <description>Dummy attribute with read/write permissions</description> <simpleType> diff --git a/src/usr/targeting/xmltohb/target_types.xml b/src/usr/targeting/xmltohb/target_types.xml index bacadeec1..14b624893 100644 --- a/src/usr/targeting/xmltohb/target_types.xml +++ b/src/usr/targeting/xmltohb/target_types.xml @@ -46,6 +46,18 @@ <attribute><id>CLASS</id><default>SYS</default></attribute> <attribute><id>TYPE</id><default>SYS</default></attribute> <attribute><id>MODEL</id><default>POWER8</default></attribute> + <attribute><id>SCRATCH_UINT8_1</id></attribute> + <attribute><id>SCRATCH_UINT8_2</id></attribute> + <attribute><id>SCRATCH_UINT32_1</id></attribute> + <attribute><id>SCRATCH_UINT32_2</id></attribute> + <attribute><id>SCRATCH_UINT64_1</id></attribute> + <attribute><id>SCRATCH_UINT64_2</id></attribute> + <attribute><id>SCRATCH_UINT8_ARRAY_1</id></attribute> + <attribute><id>SCRATCH_UINT8_ARRAY_2</id></attribute> + <attribute><id>SCRATCH_UINT32_ARRAY_1</id></attribute> + <attribute><id>SCRATCH_UINT32_ARRAY_2</id></attribute> + <attribute><id>SCRATCH_UINT64_ARRAY_1</id></attribute> + <attribute><id>SCRATCH_UINT64_ARRAY_2</id></attribute> <attribute><id>DUMMY_RW</id></attribute> <attribute> <id>XSCOM_BASE_ADDRESS</id> diff --git a/src/usr/targeting/xmltohb/xmltohb.pl b/src/usr/targeting/xmltohb/xmltohb.pl index db866fbb3..e9fcaa4b1 100755 --- a/src/usr/targeting/xmltohb/xmltohb.pl +++ b/src/usr/targeting/xmltohb/xmltohb.pl @@ -400,11 +400,25 @@ sub writeFapiPlatAttrMacrosHeaderFileContent { foreach my $fapiAttr (@{$fapiAttributes->{attribute}}) { if( (exists $fapiAttr->{id}) - && ($fapiAttr->{id} eq $hwpfToHbAttrMap->{id}) - && (exists $fapiAttr->{platInit}) ) + && ($fapiAttr->{id} eq $hwpfToHbAttrMap->{id}) ) { - # FAPI doesn't have a 'readable' element, so assume FAPI - # attribute is always readable + # Check that non-platInit attributes are in the + # volatile-zeroed section and have a direct mapping + if (! exists $fapiAttr->{platInit}) + { + if ($hwpfToHbAttrMap->{macro} ne "DIRECT") + { + fatal("FAPI platInit attr '$hwpfToHbAttrMap->{id}' is '$hwpfToHbAttrMap->{macro}', it must be DIRECT"); + } + + # TODO Until kernel patch, they are in the volatile section + if ($attribute->{persistency} ne "volatile") + { + fatal("FAPI platInit attr '$hwpfToHbAttrMap->{id}' is '$attribute->{persistency}', it must be volatile-zeroed"); + } + } + + # All FAPI attributes are readable $fapiReadable = 1; if(exists $fapiAttr->{writeable}) |