diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2012-08-03 00:06:06 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-08-08 15:01:31 -0500 |
commit | 11257ecc65544f5a19fece9050db7bcf1431240c (patch) | |
tree | 8070187eb5aa727225ca15a387735a60658ee0f8 /src/usr/targeting | |
parent | d1a017d3dc236be6787eb0831f278be91b3fc5f9 (diff) | |
download | talos-hostboot-11257ecc65544f5a19fece9050db7bcf1431240c.tar.gz talos-hostboot-11257ecc65544f5a19fece9050db7bcf1431240c.zip |
Support tactical FSP specific section
- Support single FSP attribute section (final support in story 35451)
- Add new targeting service code
- Added unsupported section check to attribute resource provider
- Updated targeting image compiler to create FSP specific section
Change-Id: I11bed7638a6f4743c3199c36cb12a24f09d0bd66
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1472
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting')
-rw-r--r-- | src/usr/targeting/attrrp.C | 81 | ||||
-rwxr-xr-x | src/usr/targeting/common/xmltohb/xmltohb.pl | 89 |
2 files changed, 141 insertions, 29 deletions
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index aae2f3915..4e54d4f8a 100644 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -378,9 +378,48 @@ namespace TARGETING // Create VMM block for each section, assign permissions. for (size_t i = 0; i < iv_sectionCount; i++) { - int rc = 0; + uint64_t l_perm = 0; + switch(iv_sections[i].type) + { + case SECTION_TYPE_PNOR_RO: + l_perm = READ_ONLY; + break; + + case SECTION_TYPE_PNOR_RW: + l_perm = WRITABLE | WRITE_TRACKED; + break; + + case SECTION_TYPE_HEAP_PNOR_INIT: + l_perm = WRITABLE; + break; + + case SECTION_TYPE_HEAP_ZERO_INIT: + l_perm = WRITABLE | ALLOCATE_FROM_ZERO; + break; + + default: + + /*@ + * @errortype + * @moduleid TARG_MOD_ATTRRP + * @reasoncode TARG_RC_UNHANDLED_ATTR_SEC_TYPE + * @userdata1 Section type + * + * @devdesc Found unhandled attribute section type + */ + l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE, + TARG_MOD_ATTRRP, + TARG_RC_UNHANDLED_ATTR_SEC_TYPE, + iv_sections[i].type); + break; + } - rc = mm_alloc_block((iv_sections[i].type == + if(l_errl) + { + break; + } + + int rc = mm_alloc_block((iv_sections[i].type == SECTION_TYPE_HEAP_ZERO_INIT ? NULL : iv_msgQ), reinterpret_cast<void*>( @@ -407,31 +446,15 @@ namespace TARGETING break; } - uint64_t l_perm = 0; - switch(iv_sections[i].type) + if(iv_sections[i].type == SECTION_TYPE_PNOR_RW) { - case SECTION_TYPE_PNOR_RO: - l_perm = READ_ONLY; - break; - - case SECTION_TYPE_PNOR_RW: - l_perm = WRITABLE | WRITE_TRACKED; - /* - * Register this memory range to be FLUSHed during - * a shutdown. - */ - INITSERVICE::registerBlock( - reinterpret_cast<void*>(iv_sections[i].vmmAddress), - iv_sections[i].size,ATTR_PRIORITY); - break; - - case SECTION_TYPE_HEAP_PNOR_INIT: - l_perm = WRITABLE; - break; - - case SECTION_TYPE_HEAP_ZERO_INIT: - l_perm = WRITABLE | ALLOCATE_FROM_ZERO; - break; + /* + * Register this memory range to be FLUSHed during + * a shutdown. + */ + INITSERVICE::registerBlock( + reinterpret_cast<void*>(iv_sections[i].vmmAddress), + iv_sections[i].size,ATTR_PRIORITY); } rc = mm_set_permission(reinterpret_cast<void*>( @@ -460,8 +483,12 @@ namespace TARGETING break; } + } // End iteration through each section + + if(l_errl) + { + break; } - if (l_errl) break; // Catch errorlog fall-outs from inside for-loop. } while (false); diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index d5685190a..c162e3899 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -69,6 +69,7 @@ my $cfgMan = 0; my $cfgVerbose = 0; my $cfgShortEnums = 1; my $cfgBigEndian = 1; +my $cfgIncludeFspAttributes = 0; GetOptions("hb-xml-file:s" => \$cfgHbXmlFile, "src-output-dir:s" => \$cfgSrcOutputDir, @@ -78,6 +79,7 @@ GetOptions("hb-xml-file:s" => \$cfgHbXmlFile, "vmm-consts-file:s" => \$cfgVmmConstsFile, "short-enums!" => \$cfgShortEnums, "big-endian!" => \$cfgBigEndian, + "include-fsp-attributes!" => \$cfgIncludeFspAttributes, "help" => \$cfgHelp, "man" => \$cfgMan, "verbose" => \$cfgVerbose ) || pod2usage(-verbose => 0); @@ -105,6 +107,7 @@ if($cfgVerbose) print STDOUT "VMM constants file = $cfgVmmConstsFile\n"; print STDOUT "Short enums = $cfgShortEnums\n"; print STDOUT "Big endian = $cfgBigEndian\n"; + print STDOUT "include-fsp-attributes = $cfgIncludeFspAttributes\n", } ################################################################################ @@ -682,6 +685,10 @@ namespace TARGETING // Targeting heap section intialized to zero SECTION_TYPE_HEAP_ZERO_INIT = 0x03, + + // FSP section + // TODO RTC: 35451 + SECTION_TYPE_FSP = 0x04, }; struct TargetingSection @@ -3279,6 +3286,10 @@ sub generateTargetingImage { my $heapPnorInitBaseAddr = $pnorRwBaseAddress + $vmmSectionOffset; my $heapZeroInitBaseAddr = $heapPnorInitBaseAddr + $vmmSectionOffset; + # TODO RTC: 35451 + # Split "fsp" into additional sections + my $fspBaseAddr = $heapZeroInitBaseAddr + $vmmSectionOffset; + # Reserve 256 bytes for the header, then keep track of PNOR RO offset my $headerSize = 256; my $offset = $headerSize; @@ -3377,6 +3388,12 @@ sub generateTargetingImage { my $heapPnorInitBinData; my $rwAttrBinData; my $rwOffset = 0; + + # TODO RTC: 35451 + # Split into more granular sections + my $fspOffset = 0; + my $fspBinData; + my $attributePointerBinData; my $targetsBinData; @@ -3453,7 +3470,13 @@ sub generateTargetingImage { } my $section; - if( exists $attributeDef->{writeable} + # TODO RTC: 35451 + # Split "fsp" into more sections later + if( exists $attributeDef->{fspOnly} ) + { + $section = "fsp"; + } + elsif( exists $attributeDef->{writeable} && $attributeDef->{persistency} eq "non-volatile" ) { $section = "pnor-rw"; @@ -3565,6 +3588,27 @@ sub generateTargetingImage { $heapPnorInitBinData .= $heapPnorInitData; } + # TODO RTC: 35451 + # Split FSP section into more granular sections + elsif($section eq "fsp") + { + my ($fspData,$alignment) = packAttribute( + $attributes, + $attributeDef,$attrhash{$attributeId}->{default}); + + # Align the data as necessary + my $pads = ($alignment - ($fspOffset + % $alignment)) % $alignment; + $fspBinData .= pack ("@".$pads); + $fspOffset += $pads; + + $attributePointerBinData .= pack8byte( + $fspOffset + $fspBaseAddr); + + $fspOffset += (length $fspData); + + $fspBinData .= $fspData; + } else { fatal("Could not find a suitable section."); @@ -3608,6 +3652,19 @@ sub generateTargetingImage { $sectionHoH{ heapZeroInit }{ type } = 3; $sectionHoH{ heapZeroInit }{ size } = sizeBlockAligned($heapZeroInitOffset,$blockSize,1); + + # TODO RTC: 35451 + # Split "fsp" into additional sections + if($cfgIncludeFspAttributes) + { + # zeroInitSection occupies no space in the binary, so set the FSP + # section address to that of the zeroInitSection + $sectionHoH{ fsp }{ offset } = + $sectionHoH{heapZeroInit}{offset}; + $sectionHoH{ fsp }{ type } = 4; + $sectionHoH{ fsp }{ size } = + sizeBlockAligned($fspOffset,$blockSize,1); + } my $numSections = keys %sectionHoH; @@ -3626,7 +3683,15 @@ sub generateTargetingImage { $headerBinData .= pack4byte($numSections); $headerBinData .= pack4byte($offsetToSections); - foreach my $section ("pnorRo","pnorRw","heapPnorInit","heapZeroInit") + # TODO RTC: 35451 + # Split "fsp" into additional sections + my @sections = ("pnorRo","pnorRw","heapPnorInit","heapZeroInit"); + if($cfgIncludeFspAttributes) + { + push(@sections,"fsp"); + } + + foreach my $section (@sections) { $headerBinData .= pack1byte($sectionHoH{$section}{type}); $headerBinData .= pack4byte($sectionHoH{$section}{offset}); @@ -3667,6 +3732,16 @@ sub generateTargetingImage { $outFile .= pack("@".($sectionHoH{heapPnorInit}{size} - $heapPnorInitOffset)); + # TODO RTC: 35451 + # Serialize FSP section to multiple of 4k page size (pad if + # necessary) + if($cfgIncludeFspAttributes) + { + $outFile .= $fspBinData; + $outFile .= pack("@".($sectionHoH{fsp}{size} + - $fspOffset)); + } + return $outFile; } @@ -3746,6 +3821,16 @@ uses the binary image or enumerations from generated header files must not be compiled with short enumeration support. Every enumeration will consume 4 bytes by default +=item B<--include-fsp-attributes> + +Emits FSP specific attributes and targets into the generated binaries and +generated code. + +=item B<--noinclude-fsp-attributes> + +Omits FSP specific attributes and targets from the generated binaries and +generated code. This is the default behavior. + =item B<--verbose> Prints out some internal workings |