Skip to content

Commit

Permalink
Remove enumeration types from FAPI attributes
Browse files Browse the repository at this point in the history
Enumerated attributes inside of TARGETING are always 4 bytes long.
FAPI attributes can be of arbitrary length, even if enumerations
are specified.  This means that we have a size mismatch if we use
an enumerated attribute as the direct map to a fapi attribute.
Instead, we should always use the same basic type that matches
the FAPI attribute, but still declare the enumeration so it can
be used for MRW settings.

Added an explicit failure in xmltohb.pl that will prevent us
from making this mistake again.

Change-Id: Iab855e0e93d2d56922175a1d6cb165eed4d665fa
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36240
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Feb 10, 2017
1 parent 574d484 commit 298daeb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 113 deletions.
23 changes: 4 additions & 19 deletions src/usr/targeting/common/genHwsvMrwXml.pl
Expand Up @@ -258,7 +258,10 @@
"FREQ_X_MHZ", $reqPol->{'proc_x_frequency'}->{content},
"PROC_EPS_TABLE_TYPE", $reqPol->{'proc_eps_table_type'},
"PROC_FABRIC_PUMP_MODE", $reqPol->{'proc_fabric_pump_mode'},
"PROC_X_BUS_WIDTH", $reqPol->{'proc_x_bus_width'},
"PROC_FABRIC_X_BUS_WIDTH", $reqPol->{'proc_fabric_x_bus_width'},
"PROC_FABRIC_A_BUS_WIDTH", $reqPol->{'proc_fabric_a_bus_width'},
"PROC_FABRIC_SMP_OPTICS_MODE", $reqPol->{'proc_fabric_smp_optics_mode'},
"PROC_FABRIC_CAPI_MODE", $reqPol->{'proc_fabric_capi_mode'},
"X_EREPAIR_THRESHOLD_FIELD", $reqPol->{'x-erepair-threshold-field'},
"A_EREPAIR_THRESHOLD_FIELD", $reqPol->{'a-erepair-threshold-field'},
"DMI_EREPAIR_THRESHOLD_FIELD", $reqPol->{'dmi-erepair-threshold-field'},
Expand Down Expand Up @@ -3076,24 +3079,6 @@ sub generate_sys
";
}

# Tuletas can now support multiple nest frequencies
if ($sysname =~ /tuleta/)
{
print "
<attribute><id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id>
<default>2000_MHZ_OR_2400_MHZ</default>
</attribute>
";
}
else
{
print "
<attribute><id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id>
<default>UNSUPPORTED_FREQ</default>
</attribute>
";
}

#adding XSCOM_BASE_ADDRESS to the system target for HDAT
print "
<attribute><id>XSCOM_BASE_ADDRESS</id>
Expand Down
164 changes: 75 additions & 89 deletions src/usr/targeting/common/xmltohb/attribute_types.xml
Expand Up @@ -2388,38 +2388,6 @@
</hwpfToHbAttrMap>
</attribute>

<enumerationType>
<id>PROC_X_BUS_WIDTH</id>
<description>Enumeration indicating the PROC_X_BUS_WIDTH</description>
<enumerator>
<name>W4BYTE</name>
<value>1</value>
</enumerator>
<enumerator>
<name>W8BYTE</name>
<value>2</value>
</enumerator>
</enumerationType>

<attribute>
<id>PROC_X_BUS_WIDTH</id>
<description>
System attribute.
Processor SMP X bus width.
Provided by the Machine Readable Workbook.
</description>
<simpleType>
<uint8_t></uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
<hasStringConversion/>
<readable/>
<hwpfToHbAttrMap>
<id>ATTR_PROC_X_BUS_WIDTH</id>
<macro>DIRECT</macro>
</hwpfToHbAttrMap>
</attribute>

<attribute>
<id>ALL_MCS_IN_INTERLEAVING_GROUP</id>
<description>
Expand Down Expand Up @@ -16393,10 +16361,9 @@ Measured in GB</description>
0x03 = PD_AND_STR
</description>
<simpleType>
<enumeration>
<id>MSS_MRW_POWER_CONTROL_REQUESTED</id>
<uint8_t>
<default>OFF</default>
</enumeration>
</uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
Expand Down Expand Up @@ -16444,10 +16411,9 @@ Measured in GB</description>
0x03 = PD_AND_STR
</description>
<simpleType>
<enumeration>
<id>MSS_MRW_IDLE_POWER_CONTROL_REQUESTED</id>
<uint8_t>
<default>OFF</default>
</enumeration>
</uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
Expand Down Expand Up @@ -17494,41 +17460,6 @@ Measured in GB</description>
</hwpfToHbAttrMap>
</attribute>

<enumerationType>
<id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id>
<description>Enumeration of MRW_NEST_CAPABLE_FREQUENCIES_SYS</description>
<enumerator>
<name>UNSUPPORTED_FREQ</name>
<value>0</value>
</enumerator>
<enumerator>
<name>2000_MHZ</name>
<value>1</value>
</enumerator>
<enumerator>
<name>2400_MHZ</name>
<value>2</value>
</enumerator>
<enumerator>
<name>2000_MHZ_OR_2400_MHZ</name>
<value>3</value>
</enumerator>
</enumerationType>

<attribute>
<id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id>
<description>The NEST frequencies that the system can support. This is a bit-wise value that represents which of the possible nest frequencies are supported. : 2.0GHz, 2.4GHz, or both. New frequencies should be added in ascending order.
</description>
<simpleType>
<enumeration>
<id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id>
<default>UNSUPPORTED_FREQ</default>
</enumeration>
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
</attribute>

<attribute>
<id>WOF_ENABLED</id>
<description>
Expand Down Expand Up @@ -19755,9 +19686,9 @@ Measured in GB</description>
Platform default: FALSE
</description>
<simpleType>
<enumeration>
<id>SYSTEM_WOF_ENABLED</id>
</enumeration>
<uint8_t>
<default>OFF</default>
</uint8_t>
</simpleType>
<hwpfToHbAttrMap>
<id>ATTR_SYSTEM_WOF_ENABLED</id>
Expand Down Expand Up @@ -21226,6 +21157,22 @@ Measured in GB</description>
</hwpfToHbAttrMap>
</attribute>

<enumerationType>
<id>PROC_FABRIC_A_BUS_WIDTH</id>
<description>
Enumeration indicating the PROC_FABRIC_A_BUS_WIDTH
</description>
<!-- Note: Values must match numbers from nest_attributes.xml -->
<enumerator>
<name>2_BYTE</name>
<value>1</value>
</enumerator>
<enumerator>
<name>4_BYTE</name>
<value>2</value>
</enumerator>
</enumerationType>

<attribute>
<id>PROC_FABRIC_A_BUS_WIDTH</id>
<!-- <targetType>TARGET_TYPE_SYSTEM</targetType> -->
Expand All @@ -21234,7 +21181,7 @@ Measured in GB</description>
Provided by the MRW.
2_BYTE = 0x01, 4_BYTE = 0x02
</description>
<simpleType><uint8_t></uint8_t></simpleType>
<simpleType><uint8_t><default>4_BYTE</default></uint8_t></simpleType>
<persistency>non-volatile</persistency>
<readable/>
<hwpfToHbAttrMap>
Expand All @@ -21248,6 +21195,7 @@ Measured in GB</description>
<description>
Enumeration indicating the PROC_FABRIC_X_BUS_WIDTH
</description>
<!-- Note: Values must match numbers from nest_attributes.xml -->
<enumerator>
<name>2_BYTE</name>
<value>1</value>
Expand All @@ -21267,10 +21215,7 @@ Measured in GB</description>
2_BYTE = 0x01, 4_BYTE = 0x02
</description>
<simpleType>
<enumeration>
<id>PROC_FABRIC_X_BUS_WIDTH</id>
<default>4_BYTE</default>
</enumeration>
<uint8_t><default>4_BYTE</default></uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
<readable/>
Expand Down Expand Up @@ -21324,6 +21269,22 @@ Measured in GB</description>
</hwpfToHbAttrMap>
</attribute>

<enumerationType>
<id>PROC_FABRIC_SMP_OPTICS_MODE</id>
<description>
Enumeration indicating the PROC_FABRIC_SMP_OPTICS_MODE
</description>
<!-- Note: Values must match numbers from nest_attributes.xml -->
<enumerator>
<name>OPTICS_IS_X_BUS</name>
<value>0x0</value>
</enumerator>
<enumerator>
<name>OPTICS_IS_A_BUS</name>
<value>0x1</value>
</enumerator>
</enumerationType>

<attribute>
<id>PROC_FABRIC_SMP_OPTICS_MODE</id>
<!-- <targetType>TARGET_TYPE_SYSTEM</targetType> -->
Expand All @@ -21336,7 +21297,7 @@ Measured in GB</description>
</description>
<simpleType>
<uint8_t>
<default>0</default>
<default>OPTICS_IS_X_BUS</default>
</uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
Expand All @@ -21347,6 +21308,22 @@ Measured in GB</description>
</hwpfToHbAttrMap>
</attribute>

<enumerationType>
<id>PROC_FABRIC_CAPI_MODE</id>
<description>
Enumeration indicating the PROC_FABRIC_CAPI_MODE
</description>
<!-- Note: Values must match numbers from nest_attributes.xml -->
<enumerator>
<name>OFF</name>
<value>0x0</value>
</enumerator>
<enumerator>
<name>ON</name>
<value>0x1</value>
</enumerator>
</enumerationType>

<attribute>
<id>PROC_FABRIC_CAPI_MODE</id>
<!-- <targetType>TARGET_TYPE_SYSTEM</targetType> -->
Expand All @@ -21358,7 +21335,7 @@ Measured in GB</description>
</description>
<simpleType>
<uint8_t>
<default>0</default>
<default>OFF</default>
</uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
Expand All @@ -21369,6 +21346,19 @@ Measured in GB</description>
</hwpfToHbAttrMap>
</attribute>


<enumerationType>
<id>PROC_FABRIC_ADDR_BAR_MODE</id>
<description>
Enumeration indicating the PROC_FABRIC_ADDR_BAR_MODE
</description>
<!-- Note: Values must match numbers from nest_attributes.xml -->
<enumerator>
<name>LARGE_SYSTEM</name>
<value>0x0</value>
</enumerator>
</enumerationType>

<attribute>
<id>PROC_FABRIC_ADDR_BAR_MODE</id>
<!-- <targetType>TARGET_TYPE_SYSTEM</targetType> -->
Expand All @@ -21379,7 +21369,7 @@ Measured in GB</description>
</description>
<simpleType>
<uint8_t>
<default>0</default>
<default>LARGE_SYSTEM</default>
</uint8_t>
</simpleType>
<persistency>non-volatile</persistency>
Expand Down Expand Up @@ -29830,11 +29820,7 @@ Measured in GB</description>
reaction
p9_hcd_cache procedures to power on VDMs before CME booting
</description>
<simpleType>
<enumeration>
<id>VDM_ENABLE</id>
</enumeration>
</simpleType>
<simpleType><uint8_t></uint8_t></simpleType>
<readable/>
<persistency>non-volatile</persistency>
<hwpfToHbAttrMap>
Expand Down
4 changes: 4 additions & 0 deletions src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml
Expand Up @@ -155,6 +155,10 @@
<id>SYSTEM_RESCLK_STEP_DELAY</id>
<default>0x32</default>
</attribute>
<attribute>
<id>PROC_FABRIC_X_BUS_WIDTH</id>
<default>4_BYTE</default>
</attribute>
</targetInstance>

<!-- System node 0 -->
Expand Down
2 changes: 0 additions & 2 deletions src/usr/targeting/common/xmltohb/target_types.xml
Expand Up @@ -602,7 +602,6 @@
<attribute><id>ISTEP_PAUSE_CONFIG</id></attribute>
<attribute><id>FRU_ID</id></attribute>
<attribute><id>BMC_FRU_ID</id></attribute>
<attribute><id>MRW_NEST_CAPABLE_FREQUENCIES_SYS</id></attribute>
<attribute><id>PROC_REFCLOCK_RCVR_TERM</id></attribute>
<attribute><id>PCI_REFCLOCK_RCVR_TERM</id></attribute>
<attribute><id>MIN_FREQ_MHZ</id></attribute>
Expand All @@ -621,7 +620,6 @@
<attribute><id>MSS_MBA_CACHELINE_INTERLEAVE_MODE</id></attribute>
<attribute><id>PROC_EPS_TABLE_TYPE</id></attribute>
<attribute><id>PROC_FABRIC_PUMP_MODE</id></attribute>
<attribute><id>PROC_X_BUS_WIDTH</id></attribute>
<attribute><id>X_EREPAIR_THRESHOLD_FIELD</id></attribute>
<attribute><id>A_EREPAIR_THRESHOLD_FIELD</id></attribute>
<attribute><id>DMI_EREPAIR_THRESHOLD_FIELD</id></attribute>
Expand Down
11 changes: 8 additions & 3 deletions src/usr/targeting/common/xmltohb/xmltohb.pl
Expand Up @@ -877,7 +877,12 @@ sub writeFapi2PlatAttrMacrosHeaderFileContent {
$fapiWriteable = 1;
}

if(!exists $attribute->{simpleType}->{enumeration})
if(exists $attribute->{simpleType}->{enumeration})
{
die "Do not use enumerations for FAPI types! ".
$attribute->{id}."\n";
}
else
{
$typeSection .= " static_assert(sizeof(TARGETING::ATTR_". $attribute->{id}."_type) ==
sizeof(fapi2::". $fapiAttr->{id}."_Type), \"Size of attribute ATTR_". $attribute->{id}."_type is not equal to the size of ".
Expand Down Expand Up @@ -4349,8 +4354,8 @@ sub enumNameToValue {

print STDOUT $enumeration;

fatal("dc99> Could not convert enumerator name \"$enumeratorName\"into "
. "enumerator value in \"$enumerationName\". enum="); #dc99
fatal("Could not convert enumerator name \"$enumeratorName\"into "
. "enumerator value in \"$enumerationName\". enum=");
}

if($enumeratorValue < 0)
Expand Down

0 comments on commit 298daeb

Please sign in to comment.