Skip to content

Commit

Permalink
Attribute keyword to require override
Browse files Browse the repository at this point in the history
New tag added for attributes called <mrwRequired/> that will force
the MRW to supply a value for that attribute. If a value is not
supplied by the system owner then an error will be generated at
build time.

Change-Id: If9dede99a6afd1627ad2f331fa13e3bf583c0867
RTC: 42809
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66235
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Matt Raybuck authored and dcrowell77 committed Sep 26, 2018
1 parent e569e65 commit 3ee865b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/usr/targeting/common/xmltohb/attribute_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<persistency>non-volatile</persistency>
<readable/>
<no_export/>
<mrwRequired/>
</attribute>

<attribute>
Expand Down Expand Up @@ -2221,6 +2222,7 @@
<uint32_t/>
</simpleType>
<no_export/>
<mrwRequired/>
</attribute>

<enumerationType>
Expand Down Expand Up @@ -3770,6 +3772,17 @@
<readable/>
</attribute>

<!--attribute>
<id>MRW_REQUIRED_TEST</id>
<description>An attribute to test the mrwRequired keyword</description>
<persistency>non-volatile</persistency>
<simpleType>
<uint8_t>
<default>0</default>
</uint8_t>
</simpleType>
<mrwRequired/>
</attribute-->
<attribute>
<description>AVDD memory programming type
0 = POWERON - domain is programmed as part of regular power on sequence,
Expand Down Expand Up @@ -4909,6 +4922,7 @@
</simpleType>
<writeable/>
<no_export/>
<mrwRequired/>
</attribute>

<attribute>
Expand Down Expand Up @@ -5493,6 +5507,7 @@
</nativeType>
<persistency>non-volatile</persistency>
<readable/>
<mrwRequired/>
</attribute>

<attribute>
Expand Down
32 changes: 28 additions & 4 deletions src/usr/targeting/common/xmltohb/xmltohb.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ sub validateAttributes {
$elements{"global"} = { required => 0, isscalar => 0};
$elements{"range"} = { required => 0, isscalar => 0};
$elements{"ignoreEkb"} = { required => 0, isscalar => 0};
$elements{"mrwRequired"} = { required => 0, isscalar => 0};

# do NOT export attribute & its associated enum to serverwiz
$elements{"no_export"} = { required => 0, isscalar => 0};
Expand Down Expand Up @@ -6218,16 +6219,39 @@ sub generateTargetingImage {

# Update hash with any per-instance overrides, but only if that
# attribute has already been defined
foreach my $attr (@{$targetInstance->{attribute}})
foreach my $targetInstanceAttribute (@{$targetInstance->{attribute}})
{
if(exists $attrhash{$attr->{id}})
# if the default tag is missing from an attribute then verify that
# it is not required to be assigned a default value by the system
# owner.
if(!exists $targetInstanceAttribute->{default})
{
foreach my $attribute_type (@{$allAttributes->{attribute}})
{
if ($attribute_type->{id} eq $targetInstanceAttribute->{id})
{
if (exists $attribute_type->{mrwRequired})
{
croak("Error in Target instance "
. "\"$targetInstance->{id}\": "
. "Attribute \"$attribute_type->{id}\" with tag "
. "\"<mrwRequired/>\" is required to have an "
. "instance level override from either the MRW "
. "or MRW processing tools.");
}
last;
}
}
}

if(exists $attrhash{$targetInstanceAttribute->{id}})
{
$attrhash{ $attr->{id} } = $attr;
$attrhash{ $targetInstanceAttribute->{id} } = $targetInstanceAttribute;
}
else
{
croak("Target instance \"$targetInstance->{id}\" of type \" $targetInstance->{type} \" cannot "
. "override attribute \"$attr->{id}\" unless "
. "override attribute \"$targetInstanceAttribute->{id}\" unless "
. "the attribute has already been defined in the target "
. "type inheritance chain.");
}
Expand Down

0 comments on commit 3ee865b

Please sign in to comment.