diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2012-09-20 13:37:58 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-10-04 16:55:00 -0500 |
commit | bfa5e295bc0fc0335358eabca0737c8fdf834e4a (patch) | |
tree | 84b9a118703e8a6796f6db8db3364cfa48f9fa45 | |
parent | 9c88d3c004d60d016c4d3bf5a3c2988cce7121c9 (diff) | |
download | talos-hostboot-bfa5e295bc0fc0335358eabca0737c8fdf834e4a.tar.gz talos-hostboot-bfa5e295bc0fc0335358eabca0737c8fdf834e4a.zip |
Update SPY FAPI functions to take meaningful spy name instead of integer ID
Change-Id: I5fb9d797600d5ab9f02509b480f11ac104486ef4
RTC: 48208
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1891
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiHwAccess.H | 168 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiPlatHwAccess.H | 97 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl | 299 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiHwAccess.C | 107 |
4 files changed, 516 insertions, 155 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiHwAccess.H b/src/include/usr/hwpf/fapi/fapiHwAccess.H index 46cf255b6..f0a26a2b3 100644 --- a/src/include/usr/hwpf/fapi/fapiHwAccess.H +++ b/src/include/usr/hwpf/fapi/fapiHwAccess.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/hwpf/fapi/fapiHwAccess.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/hwpf/fapi/fapiHwAccess.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** * @file fapiHwAccess.H * @@ -42,6 +41,8 @@ * mjjones 11/10/2011 Use ecmdDataBufferBase * 836579 thi May 22,2012 Spy/Ring supports * mjjones 07/12/2012 Add mode options to Ring funcs + * rjknight 09/20/2012 Update fapiSpy interfaces to + * allow string inputs for cronus */ #ifndef FAPIHWACCESS_H_ @@ -207,11 +208,9 @@ fapi::ReturnCode fapiModifyRing(const fapi::Target& i_target, // -------------------------------------------------------------------------- // NOTE: -// These spy access interfaces are only used in FSP. +// These spy access interfaces are only used in FSP and cronus // HB does not allow spy access -#ifndef _NO_SPY_ACCESS - /** * @brief Reads a Spy from a target * @param[in] i_target Target to read spy from @@ -219,12 +218,57 @@ fapi::ReturnCode fapiModifyRing(const fapi::Target& i_target, * @param[out] o_data Storage for output data * * @return ReturnCode. Zero on success, else platform specified error - - */ -fapi::ReturnCode fapiGetSpy(const fapi::Target& i_target, + * + * @note: The string version is only supported for cronus. + * + * The fapi design to support both FSP and cronus use of get and + * put spy funcions is dependant on the SPY names being expanded + * to resemble a valid C identifier. This design places some + * restrictions on the SPY names which can be used. + * + * 1. if the spy name contains a # procedure writers should replade it + * with an __P__ for example - + * + * ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + * becomes + * ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + * + * 2. if the spy name has a number following a "." it must have an + * uinderscore prepended to the number. + * + * EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + * becomes + * EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + * + * Example SPY name: + * The hardware procedure should call the function like: + * + * ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + * + * fapi::ReturnCode rc = fapiGetSpy( targ, + * ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + * + * NOTE: the ID is not in quotes the fapi code will handle adding the + * quotes for the cronus environment + * +*/ +#ifdef FAPI_SUPPORT_SPY_AS_ENUM + +#define fapiGetSpy(TARGET, ID, DATA) _fapiGetSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA ) +fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, const uint32_t i_spyId, ecmdDataBufferBase & o_data); +#endif + +#ifdef FAPI_SUPPORT_SPY_AS_STRING +#define fapiGetSpy(TARGET, ID, DATA) _fapiGetSpy(TARGET, #ID, DATA) +fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, + const char * const i_spyId, + ecmdDataBufferBase & o_data); +#endif + +#ifdef FAPI_SUPPORT_SPY_AS_ENUM /** * @brief Writes a spy on a target * @param[in] i_target Target to operate on @@ -233,33 +277,51 @@ fapi::ReturnCode fapiGetSpy(const fapi::Target& i_target, * address * * @return ReturnCode. Zero on success, else platform specified error - */ -fapi::ReturnCode fapiPutSpy(const fapi::Target& i_target, + * + * @note: The string version is only supported for cronus. + * + * The fapi design to support both FSP and cronus use of get and + * put spy funcions is dependant on the SPY names being expanded + * to resemble a valid C identifier. This design places some + * restrictions on the SPY names which can be used. + * + * 1. if the spy name contains a # procedure writers should replade it + * with an __P__ for example - + * + * ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + * becomes + * ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS + * + * 2. if the spy name has a number following a "." it must have an + * uinderscore prepended to the number. + * + * EH.TPCHIP.2KX100_ARY_CLK_EDGES_DLY + * becomes + * EH.TPCHIP._2KX100_ARY_CLK_EDGES_DLY + * + * Example SPY name: + * The hardware procedure should call the function like: + * + * ABUS.RX0.RXPACKS#0.RXPACK.RD.LC.LC.ACT_DIS + * + * fapi::ReturnCode rc = fapiPutSpy( targ, + * ABUS.RX0.RXPACKS__P__0.RXPACK.RD.LC.LC.ACT_DIS, data ); + * + * NOTE: the ID is not in quotes the fapi code will handle adding the + * quotes for the cronus environment + * +*/ +#define fapiPutSpy(TARGET, ID, DATA) _fapiPutSpy(TARGET, FAPI_SPY_NAMES::ID.value, DATA) +fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, const uint32_t i_spyId, ecmdDataBufferBase & i_data); +#endif -/** - * @brief Read spy Enum data from a target - * @param[in] i_target Target to read spy enum from - * @param[in] i_spyId The spy's id - * @param[out] o_enumVal Spy enum value - * - * @return ReturnCode. Zero on success, else platform specified error - */ -fapi::ReturnCode fapiGetSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - uint32_t& o_enumVal); - -/** - * @brief Write spy enum data to a target - * @param[in] i_target The chip or logical unit target - * @param[in] i_spyId The spy's id - * @param[in] i_enumVal Spy enum value to write - */ -fapi::ReturnCode fapiPutSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - const uint32_t i_enumVal); - +#ifdef FAPI_SUPPORT_SPY_AS_STRING +#define fapiPutSpy(TARGET, ID, DATA) _fapiPutSpy(TARGET, #ID, DATA) +fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, + const char* const i_spyId, + ecmdDataBufferBase & i_data); #endif } // extern "C" diff --git a/src/include/usr/hwpf/fapi/fapiPlatHwAccess.H b/src/include/usr/hwpf/fapi/fapiPlatHwAccess.H index 091a30f9b..adcb3c877 100644 --- a/src/include/usr/hwpf/fapi/fapiPlatHwAccess.H +++ b/src/include/usr/hwpf/fapi/fapiPlatHwAccess.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/hwpf/fapi/fapiPlatHwAccess.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/hwpf/fapi/fapiPlatHwAccess.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** * @file fapiPlatHwAccess.H * @@ -219,7 +218,6 @@ fapi::ReturnCode platModifyRing(const fapi::Target& i_target, // These spy access interfaces are only used in FSP. // HB does not allow spy access -#ifndef _NO_SPY_ACCESS /** * @brief Platform-level implementation called by fapiGetSpy() * Hardware procedures writers will not call this function. @@ -230,10 +228,30 @@ fapi::ReturnCode platModifyRing(const fapi::Target& i_target, * * @return ReturnCode. Zero on success, else platform specified error */ +#ifdef FAPI_SUPPORT_SPY_AS_ENUM fapi::ReturnCode platGetSpy(const fapi::Target& i_target, const uint32_t i_spyId, ecmdDataBufferBase & o_data); +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING +/** + * @brief Reads a Spy from a target + * @param[in] i_target Target to read spy from + * @param[in] i_spyId The spy's id + * @param[out] o_data Storage for output data + * + * @return ReturnCode. Zero on success, else platform specified error + * + * @note: This is only supported in the cronus environment + * it will not compile in FSP code + */ +fapi::ReturnCode platGetSpy(const fapi::Target& i_target, + const char * const i_spyId, + ecmdDataBufferBase & o_data); +#endif + +#ifdef FAPI_SUPPORT_SPY_AS_ENUM /** * @brief Platform-level implementation called by fapiPutSpy() * Hardware procedures writers will not call this function. @@ -248,33 +266,12 @@ fapi::ReturnCode platGetSpy(const fapi::Target& i_target, fapi::ReturnCode platPutSpy(const fapi::Target& i_target, const uint32_t i_spyId, ecmdDataBufferBase & i_data); +#endif -/** - * @brief Platform-level implementation called by fapiGetSpyEnum() - * Hardware procedures writers will not call this function. - * - * @param[in] i_target Target to read spy enum from - * @param[in] i_spyId The spy's id - * @param[out] o_enumVal Spy enum value - * - * @return ReturnCode. Zero on success, else platform specified error - */ -fapi::ReturnCode platGetSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - uint32_t& o_enumVal); - -/** - * @brief Platform-level implementation called by fapiPutSpyEnum() - * Hardware procedures writers will not call this function. - * - * @param[in] i_target The chip or logical unit target - * @param[in] i_spyId The spy's id - * @param[in] i_enumVal Spy enum value to write - */ -fapi::ReturnCode platPutSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - const uint32_t i_enumVal); - +#ifdef FAPI_SUPPORT_SPY_AS_STRING +fapi::ReturnCode platPutSpy(const fapi::Target& i_target, + const char * const i_spyId, + ecmdDataBufferBase & i_data); #endif } // extern "C" diff --git a/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl b/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl new file mode 100755 index 000000000..643e7d179 --- /dev/null +++ b/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl @@ -0,0 +1,299 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2012 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +use strict; +use warnings; + + +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV+1; +print $numArgs; + +if ($numArgs < 2) +{ + print ("Usage: fapiCreateFapiSpyIds.pl <input file> <output directory>\n"); + print (" This script will parse the spy id files and create a set of nested\n"); + print (" structures in the file fapiSpyIds.H which the FSP will use.\n"); + exit(1); +} + +#------------------------------------------------------------------------------ +# Globals +#------------------------------------------------------------------------------ +my $spyIdFile = $ARGV[0]; +my $outDir = $ARGV[1]; +my $outFile = "fapiSpyIds.H"; +my $UTFile = "fapiSpyIdsUT.C"; +$outFile = $outDir . $outFile; +my %structureNames; +my $somenumber; +my %currentmembers; + +#------------------------------------------------------------------------------ +# Prototypes +#------------------------------------------------------------------------------ +sub buildStructures( \@ ); +sub createTest(); +sub addTest($$); +sub closeTest(); + +#------------------------------------------------------------------------------ +# Open input and output files for our use. +#------------------------------------------------------------------------------ +open(IDFILE, "<", $spyIdFile) or die "ERROR $? : cant open $spyIdFile : $!"; +open(OUTFILE, ">", $outFile) or die "ERROR $? : can't open $outFile : $!"; +open(UTFILE, ">", $UTFile) or die "ERROR $? : can't open $outFile : $!"; + +# direct the printf output to the file +select OUTFILE; +#select STDOUT; + +createTest(); +# read in the entire file to an array +my (@lines) = <IDFILE>; + +#------------------------------------------------------------------------------ +# Process every line in the file one at a time +#------------------------------------------------------------------------------ +foreach my $line (@lines) +{ + $line =~s/^\s+|\s+$//g; + my @tokens = split(/,/, $line ); + + $tokens[1]=~s/\}//; + $tokens[1]=~s/\"//g; + + # replace a # with __P__ + $tokens[1]=~s/\#/__P__/g; + + # fix a case like this ABC.2CD ==> ABC._2CD + $tokens[1]=~s/(\.)([0-9])/$1_$2/; + + #get rid of the parens + $tokens[0]=~s/\{//; + + my $structure=$tokens[1]; + my $number=$tokens[0]; + + #create a hash for later use + $structureNames{ $structure } = $number; + +} + +#sort the hash based on the structure name +my @keys = sort { ( $a cmp $b); } ( keys %structureNames ); + +my @array = @keys; + +#init the key to some value.. +my $current = @keys; +my @name; +my @spaces; + +push(@spaces," "); +push(@spaces," "); + +# start the file off with a namespace +printf "#ifndef __FAPI_SPY_IDS_H__\n"; +printf "#define __FAPI_SPY_IDS_H__ \n\n"; +printf "namespace FAPI_SPY_NAMES \n { \n\n"; + +# look at every entry in the array of names.. +foreach my $value (@array) +{ + # segment the name and then search for all + # entries which have the first value the same + # and then process those values + my @members = split(/\./, $value ); + my $member = $members[0]; + @name = (); + + my $size = @members; + + #once we go in here we wont need to look at this value again + if( $member ne $current ) + { + push(@name,$member); + + if( $size > 1 ) + { + + # add some readability; + printf "@spaces"; + my $extern = "extern struct " . $member . "_component \n"; + printf "$extern"; + printf "@spaces"; + printf"{\n"; + # grab every value out of the array which matches our query + my @selected = @keys; + @selected = grep( m/^$member\b/, @selected); + # modify the stucture names to remove the first member + my @filtered = map { (my $new = $_) =~ s/$member\.//; $new} @selected; + $current = $member; + # passing the shortend structure names + buildStructures( @filtered ); + printf "@spaces"; + printf"} $member;\n"; + } + else + { + # make the structure back into a name and use it go get + # the value from the hash we made eariler -- its a global + my $name = join(".", @name ); + my $number = 0; + $number = $structureNames{ $name }; + my $struct = "struct " . $member . "_comp"; + addTest( $name, $number ); + printf "@spaces"; + printf "$struct\n"; + printf "@spaces"; + printf "{\n"; + printf "@spaces"; + printf" static const unsigned int value = $number;\n"; + printf "@spaces"; + printf "} $member;\n"; + } + } + +} +# close out the namespace in the file +printf "};\n"; +printf "#endif\n"; +close OUTFILE; +close IDFILE; +closeTest(); +#done + +#------------------------------------------------------------------------------ +# Subroutines +#------------------------------------------------------------------------------ +sub buildStructures( \@ ) +{ + my( $structures ) = @_; + + my @structures = @$structures; + + my $current = 0; + my $member = 0; + + push( @spaces, " " ); + push( @spaces, " " ); + + foreach my $value (@structures ) + { + my @members = split(/\./, $value ); + my $member = $members[0]; + push( @name, $member ); + + my $size = @members; + #once we go in here we wont need to look at this value again + if( $member ne $current ) + { + if( $size > 1 ) + { + $somenumber += 1; + my $struct = "struct " . $member . "_comp" . $somenumber . "\n"; + printf "@spaces"; + printf $struct; + printf "@spaces"; + printf "{\n"; + # grab every value out of the array which matches our query + my @selected = grep( m/^$member\b/, @structures); + my @filtered = map { (my $new = $_) =~ s/$member\.//; $new} @selected; + $current = $member; + buildStructures( @filtered ); + #take off the last struture member name + #from the array + printf "@spaces"; + printf ("} $member;\n"); + } + else + { + # make the structure back into a name and use it go get + # the value from the hash we made eariler -- its a global + my $name = join(".", @name ); + my $number = 0; + $number = $structureNames{ $name }; + my $struct = "struct " . $member . "_comp"; + addTest( $name, $number ); + printf "@spaces"; + printf "$struct\n"; + printf "@spaces"; + printf "{\n"; + printf "@spaces"; + printf" static const unsigned int value = $number;\n"; + printf "@spaces"; + printf "} $member;\n"; + } + } + pop(@name); + } + pop( @spaces ); + pop( @spaces ); + +} + + +sub createTest() +{ + printf( UTFILE "#include <fapiSpyIds.H>\n"); + printf( UTFILE "#include \"s1_reduced.h\"\n\n"); + printf( UTFILE "#include <iostream>\n\n"); + printf( UTFILE "#define fspSpyId(DATA) FAPI_SPY_NAMES::DATA.value\n"); + printf( UTFILE "int main( void )\n { \n"); + printf( UTFILE "unsigned int totalTests = 0; \n"); + printf( UTFILE "unsigned int failedTests = 0; \n"); +} +sub closeTest() +{ + + printf( UTFILE "if( failedTests )\n { \n"); + printf( UTFILE "std::cout << failedTests << \" of \" << totalTests << \" tests failed \" << std::endl;" ); + printf( UTFILE "}\n"); + printf( UTFILE "else { std::cout << \"+++++ SUCCESS +++++\" << std::endl; \ + std::cout << totalTests << \" TESTS PASSED\" << std::endl; }" ); + printf( UTFILE "\n\n}\n"); + close(UTFILE); +} + +sub addTest( $$ ) +{ + my( $name, $number ) = @_; + + # create a name which the FSP understands + my $fspName = $name; + $fspName =~ s/__P__/_/g; + $fspName =~ s/\._/\./g; + $fspName =~ s/\./_/g; + + $fspName = "SPY_" . $fspName; + + $fspName =~ s/ //g; +# $fspName =~ s/__/_/g; + + printf( UTFILE "totalTests++; if ( fspSpyId( $name ) != $fspName)\n"); + printf( UTFILE "{ std::cout << \"spy values dont match\" << std::endl; failedTests++; }\n"); + +} diff --git a/src/usr/hwpf/fapi/fapiHwAccess.C b/src/usr/hwpf/fapi/fapiHwAccess.C index b7f48bc18..4174cd8f5 100644 --- a/src/usr/hwpf/fapi/fapiHwAccess.C +++ b/src/usr/hwpf/fapi/fapiHwAccess.C @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/usr/hwpf/fapi/fapiHwAccess.C $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/fapi/fapiHwAccess.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** * @file fapiHwAccess.C * @@ -43,8 +42,9 @@ * toEcmdString * 836579 thi May 18,2012 Spy/ring supports * mjjones 07/12/2012 Add Pulse mode option to Ring funcs + * rjknight 09/20/2012 Update fapiGetSpy to take + * a string as input */ - #include <fapi.H> #include <fapiPlatHwAccess.H> @@ -362,13 +362,13 @@ fapi::ReturnCode fapiModifyRing(const fapi::Target& i_target, // -------------------------------------------------------------------------- // NOTE: -// These spy access interfaces are only used in FSP. +// These spy access interfaces are only used in FSP and cronus. // HB does not allow spy access -#ifndef _NO_SPY_ACCESS //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiGetSpy(const fapi::Target& i_target, +#ifdef FAPI_SUPPORT_SPY_AS_ENUM +fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, const uint32_t i_spyId, ecmdDataBufferBase & o_data) { @@ -393,92 +393,95 @@ fapi::ReturnCode fapiGetSpy(const fapi::Target& i_target, return l_rc; } +#endif -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiPutSpy(const fapi::Target& i_target, - const uint32_t i_spyId, - ecmdDataBufferBase & i_data) +#ifdef FAPI_SUPPORT_SPY_AS_STRING +fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, + const char * i_spyId, + ecmdDataBufferBase & o_data) { fapi::ReturnCode l_rc; bool l_traceit = platIsScanTraceEnabled(); // call the platform implementation - l_rc = platPutSpy( i_target, i_spyId, i_data ); + l_rc = platGetSpy( i_target, i_spyId, o_data ); if (l_rc) { - FAPI_ERR("fapiPutSpy failed - Target %s, SpyId 0x%.8X", i_target.toEcmdString(), i_spyId); + FAPI_ERR("fapiGetSpy failed - Target %s, SpyId %s", i_target.toEcmdString(), i_spyId); } if( l_traceit ) { - FAPI_SCAN( "TRACE : PUTSPY : %s : %.8X %.16llX", + FAPI_SCAN( "TRACE : GETSPY : %s : %s %.16llX", i_target.toEcmdString(), i_spyId, - i_data.getDoubleWord(0)); + o_data.getDoubleWord(0)); } return l_rc; } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_ENUM //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiGetSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - uint32_t& o_enumVal) +fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, + const uint32_t i_spyId, + ecmdDataBufferBase & i_data) { fapi::ReturnCode l_rc; bool l_traceit = platIsScanTraceEnabled(); // call the platform implementation - l_rc = platGetSpyEnum( i_target, i_spyId, o_enumVal ); + l_rc = platPutSpy( i_target, i_spyId, i_data ); if (l_rc) { - FAPI_ERR("fapiGetSpyEnum failed - Target %s, SpyId 0x%.8X", i_target.toEcmdString(), i_spyId); + FAPI_ERR("fapiPutSpy failed - Target %s, SpyId 0x%.8X", i_target.toEcmdString(), i_spyId); } if( l_traceit ) { - FAPI_SCAN( "TRACE : GETSPYENUM : %s : %.8X %.8X", + FAPI_SCAN( "TRACE : PUTSPY : %s : %.8X %.16llX", i_target.toEcmdString(), i_spyId, - o_enumVal); + i_data.getDoubleWord(0)); } return l_rc; } +#endif +#ifdef FAPI_SUPPORT_SPY_AS_STRING //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiPutSpyEnum(const fapi::Target& i_target, - const uint32_t i_spyId, - const uint32_t i_enumVal) +fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, + const char * const i_spyId, + ecmdDataBufferBase & i_data) { fapi::ReturnCode l_rc; bool l_traceit = platIsScanTraceEnabled(); // call the platform implementation - l_rc = platPutSpyEnum( i_target, i_spyId, i_enumVal ); + l_rc = platPutSpy( i_target, i_spyId, i_data ); if (l_rc) { - FAPI_ERR("fapiPutSpyEnum failed - Target %s, SpyId 0x%.8X, EnumVal %d", - i_target.toEcmdString(), i_spyId, i_enumVal); + FAPI_ERR("fapiPutSpy failed - Target %s, SpyId %s.8X", i_target.toEcmdString(), i_spyId); } if( l_traceit ) { - FAPI_SCAN( "TRACE : PUTSPYENUM : %s : %.8X %.8X", + FAPI_SCAN( "TRACE : PUTSPY : %s : %s %.16llX", i_target.toEcmdString(), i_spyId, - i_enumVal); + i_data.getDoubleWord(0)); } return l_rc; } - #endif + } // extern "C" |