From 59a58400b22274c58e3512e09468e45daebc1436 Mon Sep 17 00:00:00 2001 From: Van Lee Date: Sun, 29 Apr 2012 09:52:23 -0500 Subject: Common Attributes and FSP attributes seperation Change-Id: Ic286a6f700c909b89d296074fcf22d1c6d2ae0f8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/961 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- .../targeting/common/xmltohb/attribute_types.xml | 217 ++-- src/usr/targeting/xmltohb/TULETA.mrw.xml | 3 +- src/usr/targeting/xmltohb/genHwsvMrwXml.pl | 1137 ++++++++++++++++++++ src/usr/targeting/xmltohb/genTuletaMrwXml.pl | 986 ----------------- 4 files changed, 1245 insertions(+), 1098 deletions(-) create mode 100755 src/usr/targeting/xmltohb/genHwsvMrwXml.pl delete mode 100755 src/usr/targeting/xmltohb/genTuletaMrwXml.pl (limited to 'src') diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index f05b18c82..d8825cf8b 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -1,30 +1,30 @@ @@ -50,23 +50,23 @@ UNIT 4 - + DEV 5 - + SYS 6 - + LOGICAL_CARD 7 - + MAX 8 - + NA @@ -198,7 +198,7 @@ POWER8 112 - + NA @@ -288,14 +288,14 @@ non-volatile - + SCRATCH_UINT8_1 Scratch attribute that can be used for dev/test - 0 + 0 volatile-zeroed @@ -588,18 +588,18 @@ PRIMARY_CAPABILITIES Attribute which describes capabilities of a target - Structure which defines a target's primary capabilities. - A target can only support at most FSI SCOM and one of the other two SCOM + Structure which defines a target's primary capabilities. + A target can only support at most FSI SCOM and one of the other two SCOM types. Applicable for all targets. Structure is read-only. supportsFsiScom - 0b0: Target does not support FSI SCOM; + 0b0: Target does not support FSI SCOM; 0b1: Target supports FSI SCOM uint8_t 1 - 0 + 0 supportsXscom @@ -622,7 +622,7 @@ uint8_t 5 0 - + non-volatile @@ -632,13 +632,13 @@ SCOM_SWITCHES Attribute storing information about which SCOM path to use - Structure which defines which SCOM to use at a point in - time. Only applicable if target supports one or more SCOM types. Only - one bit (of the first three) can ever be set at any one time. + Structure which defines which SCOM to use at a point in + time. Only applicable if target supports one or more SCOM types. Only + one bit (of the first three) can ever be set at any one time. useFsiScom - 0b0: Do not use FSI SCOM at this time. 0b1: Use FSI + 0b0: Do not use FSI SCOM at this time. 0b1: Use FSI SCOM at this time uint8_t 1 @@ -646,7 +646,7 @@ useXscom - 0b0: Do not use XSCOM at this time. 0b1: Use XSCOM at + 0b0: Do not use XSCOM at this time. 0b1: Use XSCOM at this time uint8_t 1 @@ -654,7 +654,7 @@ useInbandScom - 0b0: Do not use inband SCOM at this time. 0b1: Use + 0b0: Do not use inband SCOM at this time. 0b1: Use inband SCOM at this time uint8_t 1 @@ -688,8 +688,8 @@ XSCOM_CHIP_INFO Attribute which describes XSCOM chip info - Structure which defines chip info necessary for XSCOM. - Only applicable for chip targets which support XSCOM. Structure is + Structure which defines chip info necessary for XSCOM. + Only applicable for chip targets which support XSCOM. Structure is read-only nodeId @@ -829,8 +829,8 @@ HWAS_STATE - HardWare Availability Service State Attribute. - Keeps track of Target values poweredOn, present, functional, + HardWare Availability Service State Attribute. + Keeps track of Target values poweredOn, present, functional, changedSinceLastIPL, and gardLevel struct - so far contains 4 booleans and a 4-bit GARD level @@ -845,7 +845,7 @@ present - Target is present in the system. + Target is present in the system. comes up as Not PRESENT. uint8_t 1 @@ -861,21 +861,21 @@ changedSinceLastIPL - Target has changed since last IPL. + Target has changed since last IPL. comes up as FALSE. uint8_t 1 0 - + gardLevel - GARD Level. This is a 4-bit value. + GARD Level. This is a 4-bit value. comes up as 0 uint8_t 4 0 - + volatile @@ -891,61 +891,61 @@ fsiPath Entity path for testing purposes EntityPath - physical:sys-0 + physical:sys-0 className Class for testing purposes CLASS - CHIP + CHIP uint8 Test uint8 uint8_t - 0xAB + 0xAB uint16 Test uint16 uint16_t - 0xABCD + 0xABCD uint32 Test uint32 uint32_t - 0xABCDEF01 + 0xABCDEF01 uint64 Test uint64 uint64_t - 0xABCDEF0123456789 + 0xABCDEF0123456789 int8 Test int8 int8_t - -124 + -124 int16 Test int16 int16_t - -32764 + -32764 int32 Test int32 int32_t - -2147483644 + -2147483644 int64 Test int64 int64_t - -9223372036854775804 + -9223372036854775804 non-volatile @@ -976,7 +976,7 @@ - + ISTEP_MODE If True, puts HostBoot into SPLess SingleStep mode. @@ -1604,7 +1604,7 @@ 0 - + 2,2,4 volatile-zeroed @@ -1622,10 +1622,10 @@ 0 - + volatile-zeroed - + ATTR_EFF_DRAM_WR_VREF @@ -1640,9 +1640,9 @@ 0 - + volatile-zeroed - + ATTR_EFF_CEN_DRV_IMP_DQ_DQS @@ -1659,7 +1659,7 @@ volatile-zeroed - + ATTR_EFF_CEN_DRV_IMP_CMD @@ -1676,7 +1676,7 @@ volatile-zeroed - + ATTR_EFF_CEN_DRV_IMP_CNTL @@ -1693,7 +1693,7 @@ volatile-zeroed - + ATTR_EFF_CEN_RCV_IMP_DQ_DQS @@ -1710,7 +1710,7 @@ volatile-zeroed - + ATTR_EFF_CEN_SLEW_RATE_DQ_DQS @@ -1727,7 +1727,7 @@ volatile-zeroed - + ATTR_EFF_CEN_SLEW_RATE_CMD @@ -1744,7 +1744,7 @@ volatile-zeroed - + ATTR_EFF_CEN_SLEW_RATE_CNTL @@ -1761,7 +1761,7 @@ volatile-zeroed - + ATTR_EFF_CEN_RD_VREF @@ -1796,7 +1796,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_DENSITY @@ -1813,7 +1813,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRCD @@ -1830,7 +1830,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRRD @@ -1847,7 +1847,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRP @@ -1864,7 +1864,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRAS @@ -1881,7 +1881,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRC @@ -1915,7 +1915,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRFC @@ -1932,7 +1932,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TWTR @@ -1949,7 +1949,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TRTP @@ -1966,7 +1966,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_TFAW @@ -1977,13 +1977,13 @@ EFF_DRAM_BL DRAM Burst Length. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_BL @@ -2000,7 +2000,7 @@ volatile-zeroed - + ATTR_EFF_DRAM_CL @@ -2011,13 +2011,13 @@ EFF_DRAM_AL DRAM Additive Latency. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_AL @@ -2028,13 +2028,13 @@ EFF_DRAM_CWL DRAM CAS Write Latency. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_CWL @@ -2045,13 +2045,13 @@ EFF_DRAM_RBT DRAM Read Burst Type. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_RBT @@ -2062,13 +2062,13 @@ EFF_DRAM_TM DRAM Test Mode. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_TM @@ -2079,13 +2079,13 @@ EFF_DRAM_DLL_RESET DRAM DLL Reset. Initialized and used by HWPs. - + 0 volatile-zeroed - + ATTR_EFF_DRAM_DLL_RESET @@ -2096,7 +2096,7 @@ EFF_DRAM_WR DRAM Write Recovery. Initialized and used by HWPs. - + 0 @@ -2113,7 +2113,7 @@ EFF_DRAM_DLL_PPD DRAM DLL Precharge PD. Initialized and used by HWPs. - + 0 @@ -2130,7 +2130,7 @@ EFF_DRAM_DLL_ENABLE DRAM DLL Enable. Initialized and used by HWPs. - + 0 @@ -2147,7 +2147,7 @@ EFF_DRAM_TDQS DRAM TDQS. Initialized and used by HWPs. - + 0 @@ -2164,7 +2164,7 @@ EFF_DRAM_WR_LVL_ENABLE DRAM Write Level Enable. Initialized and used by HWPs. - + 0 @@ -2181,7 +2181,7 @@ EFF_DRAM_OUTPUT_BUFFER DRAM output buffer. Initialized and used by HWPs. - + 0 @@ -2198,7 +2198,7 @@ EFF_DRAM_PASR DRAM Partial Array Self-Refresh. Initialized and used by HWPs. - + 0 @@ -2215,7 +2215,7 @@ EFF_DRAM_ASR DRAM Auto Self-Refresh. Initialized and used by HWPs. - + 0 @@ -2232,7 +2232,7 @@ EFF_DRAM_SRT DRAM Self-Refresh Temperature Range. Initialized and used by HWPs. - + 0 @@ -2249,7 +2249,7 @@ EFF_MPR_LOC Multi Purpose Register Location. Initialized and used by HWPs. - + 0 @@ -2266,7 +2266,7 @@ EFF_MPR_MODE Multi Purpose Register Mode. Initialized and used by HWPs. - + 0 @@ -2283,7 +2283,7 @@ EFF_DIMM_RCD_CNTL_WORD_0_15 DIMM RCD Control Word. Initialized and used by HWPs. - + 0 @@ -2386,7 +2386,7 @@ MSS_THROTTLE_NUMERATOR DIMM throttle numerator. Initialized and used by HWPs. - + 0 @@ -2404,7 +2404,7 @@ MSS_THROTTLE_DENOMINATOR DIMM throttle denominator. Initialized and used by HWPs. - + 0 @@ -2422,7 +2422,7 @@ MSS_THROTTLE_CHANNEL_NUMERATOR Channel throttle numerator. Initialized and used by HWPs. - + 0 @@ -2440,7 +2440,7 @@ MSS_THROTTLE_CHANNEL_DENOMINATOR Channel throttle denominator. Initialized and used by HWPs. - + 0 @@ -2458,7 +2458,7 @@ MSS_WATT_TARGET Channel total memory watts. Initialized and used by HWPs. - + 0 @@ -2907,7 +2907,7 @@ ATTR_CHIP_UNIT_POS DIRECT - + POSITION @@ -3000,7 +3000,6 @@ PROC_EPS_TABLE_TYPE - EPS_TYPE_LE non-volatile @@ -3037,7 +3036,6 @@ PROC_FABRIC_PUMP_MODE - MODE1 non-volatile @@ -3072,7 +3070,6 @@ PROC_X_BUS_WIDTH - W8BYTE non-volatile @@ -3215,7 +3212,7 @@ System attribute. The frequency of a processor's PB chiplet in MHz. This is the same for all PB chiplets in the system. - The corresponding HWPF attribute: + The corresponding HWPF attribute: - Is set by a HWP that runs after SBE HWPs setup the PB PLL. It reads ATTR_FREQ_PROC_REFCLOCK and the PB PLL settings. @@ -3310,18 +3307,18 @@ Attribute which describes what the SP is or is not doing in this system - Structure which defines a system's SP functions. + Structure which defines a system's SP functions. Applicable for System target only. Structure is read-only. fsiSlaveInit - 0b0: SP does not initialize FSI slave logic, Hostboot must; + 0b0: SP does not initialize FSI slave logic, Hostboot must; 0b1: SP does initialize FSI slave logic so Hostboot should not uint8_t 1 - 1 + 1 mailboxEnabled @@ -3339,8 +3336,8 @@ uint8_t 6 0 - - + + non-volatile diff --git a/src/usr/targeting/xmltohb/TULETA.mrw.xml b/src/usr/targeting/xmltohb/TULETA.mrw.xml index e8c502f8d..5121c43ec 100644 --- a/src/usr/targeting/xmltohb/TULETA.mrw.xml +++ b/src/usr/targeting/xmltohb/TULETA.mrw.xml @@ -20,8 +20,7 @@ Origin: 30 IBM_PROLOG_END --> - - + diff --git a/src/usr/targeting/xmltohb/genHwsvMrwXml.pl b/src/usr/targeting/xmltohb/genHwsvMrwXml.pl new file mode 100755 index 000000000..f1b2d3367 --- /dev/null +++ b/src/usr/targeting/xmltohb/genHwsvMrwXml.pl @@ -0,0 +1,1137 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/targeting/xmltohb/genHwsvMrwXml.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 other- +# wise divested of its trade secrets, irrespective of what has +# been deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END +# Author: Van Lee vanlee@us.ibm.com +# +# Usage: +# +# genHwsvMrwXml.pl --system=systemname --mrwdir=pathname +# [--build=hb] [--outfile=XmlFilename] +# --system=systemname +# Specify which system MRW XML to be generated +# --mrwdir=pathname +# Specify the complete dir pathname of the MRW. +# --build=hb +# Specify HostBoot build (hb) +# --outfile=XmlFilename +# Specify the filename for the output XML. If omitted, the output +# is written to STDOUT which can be saved by redirection. +# +# Purpose: +# +# This perl script processes the various xml files of the Tuleta MRW to +# extract the needed information for generating the final xml file. +# + +use strict; +use XML::Simple; +use Data::Dumper; + +my $mrwdir = ""; +my $sysname = ""; +my $usage = 0; +my $outFile = ""; +my $build = "fsp"; +use Getopt::Long; +GetOptions( "mrwdir:s" => \$mrwdir, + "system:s" => \$sysname, + "outfile:s" => \$outFile, + "build:s" => \$build, + "help" => \$usage, ); + +if ($usage || ($mrwdir eq "")) +{ + display_help(); + exit 0; +} + +if ($outFile ne "") +{ + open OUTFILE, '+>', $outFile || + die "ERROR: unable to create $outFile\n"; + select OUTFILE; +} + +my $SYSNAME = uc($sysname); + +open (FH, "<$mrwdir/${sysname}-power-busses.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-power-busses.xml\n"; +close (FH); + +my $powerbus = XMLin("$mrwdir/${sysname}-power-busses.xml"); + +my @pbus; +foreach my $i (@{$powerbus->{'power-bus'}}) +{ + my $endp1 = $i->{'description'}; + my $endp2 = $endp1; + $endp1 =~ s/^(.*) to.*/$1/; + $endp2 =~ s/.* to (.*)\s*$/$1/; + push @pbus, [ lc($endp1), lc($endp2) ]; + push @pbus, [ lc($endp2), lc($endp1) ]; +} + +open (FH, "<$mrwdir/${sysname}-cec-chips.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-cec-chips.xml\n"; +close (FH); + +my $devpath = XMLin("$mrwdir/${sysname}-cec-chips.xml", + KeyAttr=>'instance-path'); + +open (FH, "<$mrwdir/${sysname}-system-policy.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-system-policy.xml\n"; +close (FH); + +my $policy = XMLin("$mrwdir/${sysname}-system-policy.xml"); + +open (FH, "<$mrwdir/${sysname}-targets.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-targets.xml\n"; +close (FH); + +my $eTargets = XMLin("$mrwdir/${sysname}-targets.xml"); + +# Capture all targets into the @Targets array +use constant NAME_FIELD => 0; +use constant NODE_FIELD => 1; +use constant POS_FIELD => 2; +use constant UNIT_FIELD => 3; +use constant PATH_FIELD => 4; +use constant LOC_FIELD => 5; +my @Targets; +foreach my $i (@{$eTargets->{target}}) +{ + push @Targets, [ $i->{'ecmd-common-name'}, $i->{node}, $i->{position}, + $i->{'chip-unit'}, $i->{'instance-path'}, $i->{location} ]; +} + +open (FH, "<$mrwdir/${sysname}-fsi-busses.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-fsi-busses.xml\n"; +close (FH); + +my $fsiBus = XMLin("$mrwdir/${sysname}-fsi-busses.xml"); + +# Capture all FSI connections into the @Fsis array +use constant FSI_TYPE_FIELD => 0; +use constant FSI_LINK_FIELD => 1; +use constant FSI_TARGET_FIELD => 2; +my @Fsis; +foreach my $i (@{$fsiBus->{'fsi-bus'}}) +{ + push @Fsis, [ $i->{master}->{type}, $i->{master}->{link}, + "n$i->{slave}->{target}->{node}:p$i->{slave}->{target}->{position}" ]; +} + +open (FH, "<$mrwdir/${sysname}-memory-busses.xml") || + die "ERROR: unable to open $mrwdir/${sysname}-memory-busses.xml\n"; +close (FH); + +my $memBus = XMLin("$mrwdir/${sysname}-memory-busses.xml"); + +# Capture all memory buses info into the @Membuses array +use constant MCS_TARGET_FIELD => 0; +use constant CENTAUR_TARGET_FIELD => 1; +use constant DIMM_TARGET_FIELD => 2; +use constant DIMM_PATH_FIELD => 3; +use constant CFSI_LINK_FIELD => 4; +my @Membuses; +foreach my $i (@{$memBus->{'memory-bus'}}) +{ + push @Membuses, [ + "n$i->{mcs}->{target}->{node}:p$i->{mcs}->{target}->{position}:mcs" . + $i->{mcs}->{target}->{chipUnit}, + "n$i->{mba}->{target}->{node}:p$i->{mba}->{target}->{position}:mba" . + $i->{mba}->{target}->{chipUnit}, + "n$i->{dimm}->{target}->{node}:p$i->{dimm}->{target}->{position}", + $i->{dimm}->{'instance-path'}, $i->{'fsi-link'} ]; +} + +# Sort physical DIMM order +my @Memfields; +my @SMembuses; +for my $i ( 0 .. $#Membuses ) +{ + for (my $j = 0; $j <= $#Membuses; $j++ ) + { + my $k = $Membuses[$j][DIMM_PATH_FIELD]; + $k =~ s/.*dimm-(.*).*$/$1/; + if ($k == $i) + { + for my $l ( 0 .. CFSI_LINK_FIELD ) + { + $Memfields[$l] = $Membuses[$j][$l]; + } + push @SMembuses, [ @Memfields ]; + $j = $#Membuses; + } + } +} + +# Find master processor's node and proc. The FSP master is always connected to +# the msater processor. The master processor's node is used as the system node + +my $node = 0; +my $Mproc = 0; +for my $i ( 0 .. $#Fsis ) +{ + if ((lc($Fsis[$i][FSI_TYPE_FIELD]) eq "fsp master") && + (lc($Fsis[$i][FSI_TARGET_FIELD]) eq "n[0-9]+:p[0-9]+")) + { + $node = $Fsis[$i][FSI_TARGET_FIELD]; + $Mproc = $node; + $node =~ s/n(.*):p.*/$1/; + $Mproc =~ s/.*p(.*)/$1/; + } +} + +# Generate @STargets array from the @Targets array to have the order as shown +# belows. The rest of the codes assume that this order is in place +# +# pu +# ex (one or more EX of pu before it) +# mcs (one or more MCS of pu before it) +# (Repeat for remaining pu) +# memb +# mba (to for membuf before it) +# (Repeat for remaining membuf) +# + +my @fields; +my @STargets; +for my $i ( 0 .. $#Targets ) +{ + if ($Targets[$i][NAME_FIELD] eq "pu") + { + for my $k ( 0 .. LOC_FIELD ) + { + $fields[$k] = $Targets[$i][$k]; + } + push @STargets, [ @fields ]; + + my $position = $Targets[$i][POS_FIELD]; + + for my $j ( 0 .. $#Targets ) + { + if (($Targets[$j][NAME_FIELD] eq "ex") && + ($Targets[$j][POS_FIELD] eq $position)) + { + for my $k ( 0 .. LOC_FIELD ) + { + $fields[$k] = $Targets[$j][$k]; + } + push @STargets, [ @fields ]; + } + } + + for my $j ( 0 .. $#Targets ) + { + if (($Targets[$j][NAME_FIELD] eq "mcs") && + ($Targets[$j][POS_FIELD] eq $position)) + { + for my $k ( 0 .. LOC_FIELD ) + { + $fields[$k] = $Targets[$j][$k]; + } + push @STargets, [ @fields ]; + } + } + } +} + +for my $i ( 0 .. $#Targets ) +{ + if ($Targets[$i][NAME_FIELD] eq "memb") + { + for my $k ( 0 .. LOC_FIELD ) + { + $fields[$k] = $Targets[$i][$k]; + } + push @STargets, [ @fields ]; + + my $position = $Targets[$i][POS_FIELD]; + + for my $j ( 0 .. $#Targets ) + { + if (($Targets[$j][NAME_FIELD] eq "mba") && + ($Targets[$j][POS_FIELD] eq $position)) + { + for my $k ( 0 .. LOC_FIELD ) + { + $fields[$k] = $Targets[$j][$k]; + } + push @STargets, [ @fields ]; + } + } + } +} + +# Finally, generate the xml file. +print "\n"; + +print "\n"; + +# First, generate system target (always sys0) +my $sys = 0; +generate_sys(); + +# Second, generate system node using the master processor's node +generate_system_node(); + +# Third, generate the proc, ex-chiplet, mcs-chiplet, pervasive-bus, powerbus, +# pcie bus and A/X-bus. +my $ex_count = 0; +my $mcs_count = 0; +for (my $do_core = 0, my $i = 0; $i <= $#STargets; $i++) +{ + if ($STargets[$i][NAME_FIELD] eq "pu") + { + my $proc = $STargets[$i][POS_FIELD]; + my $ipath = $STargets[$i][PATH_FIELD]; + if ($proc eq $Mproc) + { + generate_master_proc($proc, $ipath); + } + else + { + my $fsi; + for (my $j = 0; $j <= $#Fsis; $j++) + { + if ($Fsis[$j][FSI_TARGET_FIELD] eq "n${node}:p$proc") + { + $fsi = $Fsis[$j][FSI_LINK_FIELD]; + last; + } + } + generate_slave_proc($proc, $fsi, $ipath); + } + } + elsif ($STargets[$i][NAME_FIELD] eq "ex") + { + my $proc = $STargets[$i][POS_FIELD]; + my $ex = $STargets[$i][UNIT_FIELD]; + if ($do_core == 0) + { + if ($ex_count == 0) + { + print "\n\n"; + } + generate_ex($proc, $ex); + $ex_count++; + if ($STargets[$i+1][NAME_FIELD] eq "mcs") + { + $do_core = 1; + $i -= $ex_count; + $ex_count = 0; + } + } + else + { + if ($ex_count == 0) + { + print "\n\n"; + } + generate_ex_core($proc,$ex); + $ex_count++; + if ($STargets[$i+1][NAME_FIELD] eq "mcs") + { + $do_core = 0; + $ex_count = 0; + } + } + } + elsif ($STargets[$i][NAME_FIELD] eq "mcs") + { + my $proc = $STargets[$i][POS_FIELD]; + my $mcs = $STargets[$i][UNIT_FIELD]; + if ($mcs_count == 0) + { + print "\n\n"; + } + generate_mcs($proc,$mcs); + $mcs_count++; + if (($STargets[$i+1][NAME_FIELD] eq "pu") || + ($STargets[$i+1][NAME_FIELD] eq "memb")) + { + $mcs_count = 0; + generate_pervasive_bus($proc); + generate_powerbus($proc); + generate_pcies($proc); + generate_ax_buses($proc, "A"); + generate_ax_buses($proc, "X"); + } + } +} + +# Fourth, generate the Centaur, MBS, and MBA + +my $memb; +my $membMcs; + +for my $i ( 0 .. $#STargets ) +{ + if ($STargets[$i][NAME_FIELD] eq "memb") + { + $memb = $STargets[$i][POS_FIELD]; + my $ipath = $STargets[$i][PATH_FIELD]; + my $centaur = "n${node}:p${memb}"; + my $found = 0; + my $cfsi; + for my $j ( 0 .. $#Membuses ) + { + my $mba = $Membuses[$j][CENTAUR_TARGET_FIELD]; + $mba =~ s/(.*):mba.*$/$1/; + if ($mba eq $centaur) + { + $membMcs = $Membuses[$j][MCS_TARGET_FIELD]; + $cfsi = $Membuses[$j][CFSI_LINK_FIELD]; + $found = 1; + last; + } + } + if ($found == 0) + { + die "ERROR. Can't locate Centaur from memory bus table\n"; + } + generate_centaur( $memb, $membMcs, $cfsi, $ipath ); + } + elsif ($STargets[$i][NAME_FIELD] eq "mba") + { + my $mba = $STargets[$i][UNIT_FIELD]; + generate_mba( $memb, $membMcs, $mba ); + if ($mba == 1) + { + print "\n\n" + } + } +} + +# Fifth, generate DIMM targets + +print "\n\n"; + +for my $i ( 0 .. $#SMembuses ) +{ + my $proc = $SMembuses[$i][MCS_TARGET_FIELD]; + my $mcs = $proc; + $proc =~ s/.*:p(.*):.*/$1/; + $mcs =~ s/.*mcs(.*)/$1/; + my $ctaur = $SMembuses[$i][CENTAUR_TARGET_FIELD]; + my $mba = $ctaur; + $ctaur =~ s/.*:p(.*):mba.*$/$1/; + $mba =~ s/.*:mba(.*)$/$1/; + my $pos = $SMembuses[$i][DIMM_TARGET_FIELD]; + $pos =~ s/.*:p(.*)/$1/; + my $dimm = $SMembuses[$i][DIMM_PATH_FIELD]; + $dimm =~ s/.*dimm-(.*)/$1/; + print "\n\n"; + for my $id ( 0 .. 7 ) + { + my $dimmid = $dimm; + $dimmid <<= 3; + $dimmid |= $id; + $dimmid = sprintf ("%d", $dimmid); + generate_dimm( $proc, $mcs, $ctaur, $pos, $dimmid, $id ); + } +} + +print "\n\n"; + +# All done! +#close ($outFH); +exit 0; + +########## Subroutines ############## + +sub generate_sys +{ + my $proc_refclk = $policy->{'required-policy-settings'}->{'processor-refclock-frequency'}->{content}; + my $mem_refclk = $policy->{'required-policy-settings'}->{'memory-refclock-frequency'}->{content}; + + print " + + + + sys$sys + sys-sys-power8 + + PHYS_PATH + physical:sys-$sys + + + AFFINITY_PATH + affinity:sys-$sys + + + PROC_EPS_TABLE_TYPE + EPS_TYPE_LE + + + PROC_FABRIC_PUMP_MODE + MODE1 + + + PROC_X_BUS_WIDTH + W8BYTE + + + ALL_MCS_IN_INTERLEAVING_GROUP + 1 + + + FREQ_PROC_REFCLOCK + $proc_refclk + + + FREQ_MEM_REFCLOCK + $mem_refclk + + + FREQ_CORE_FLOOR + 2500 + + + SP_FUNCTIONS + + fsiSlaveInit1 + mailboxEnabled1 + reserved0 + + + +"; +} + +sub generate_system_node +{ + print " + + + + sys${sys}node${node} + enc-node-power8 + HUID0x00020000 + + PHYS_PATH + physical:sys-$sys/node-$node + + + AFFINITY_PATH + affinity:sys-$sys/node-$node + + +"; +} + +sub generate_master_proc +{ + my ($proc, $ipath) = @_; + my $scompath = $devpath->{chip}->{$ipath}->{'scom-path'}; + my $scanpath = $devpath->{chip}->{$ipath}->{'scan-path'}; + my $scomsize = length($scompath) + 1; + my $scansize = length($scanpath) + 1; + my $mboxpath = ""; + my $mboxsize = 0; + if (exists $devpath->{chip}->{$ipath}->{'mailbox-path'}) + { + $mboxpath = $devpath->{chip}->{$ipath}->{'mailbox-path'}; + $mboxsize = length($mboxpath) + 1; + } + my $uidstr = sprintf("0x%02X07%04X",${node},${proc}+${node}*8); + print " + + + + sys${sys}node${node}proc${proc} + chip-processor-murano + HUID${uidstr} + POSITION${proc} + SCOM_SWITCHES + + useFsiScom0 + useXscom1 + useInbandScom0 + reserved0 + + + + XSCOM_CHIP_INFO + + nodeId$node + chipId$proc + + + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc + + + FABRIC_NODE_ID + $node + + + FABRIC_CHIP_ID + $proc + + VPD_REC_NUM$proc"; + + if ($build eq "fsp") + { + print " + + FSP_SCOM_DEVICE_PATH + $scompath + $scomsize + + + FSP_SCAN_DEVICE_PATH + $scanpath + $scansize + "; + } + + if (($mboxsize != 0) && ($build eq "fsp")) + { + print " + + FSP_MBOX_DEVICE_PATH + $mboxpath + $mboxsize + "; + } + print "\n\n"; +} + +sub generate_slave_proc +{ + my ($proc, $fsi, $ipath) = @_; + my $uidstr = sprintf("0x%02X07%04X",${node},$proc+${node}*8); + my $scompath = $devpath->{chip}->{$ipath}->{'scom-path'}; + my $scanpath = $devpath->{chip}->{$ipath}->{'scan-path'}; + my $scomsize = length($scompath) + 1; + my $scansize = length($scanpath) + 1; + my $mboxpath = ""; + my $mboxsize = 0; + if (exists $devpath->{chip}->{$ipath}->{'mailbox-path'}) + { + $mboxpath = $devpath->{chip}->{$ipath}->{'mailbox-path'}; + $mboxsize = length($mboxpath) + 1; + } + print " + + + + sys${sys}node${node}proc$proc + chip-processor-murano + HUID${uidstr} + POSITION$proc + SCOM_SWITCHES + + useFsiScom1 + useXscom0 + useInbandScom0 + reserved0 + + + + XSCOM_CHIP_INFO + + nodeId$node + chipId$Mproc + + + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc + + + FABRIC_NODE_ID + $node + + + FABRIC_CHIP_ID + $proc + + + + FSI_MASTER_CHIP + physical:sys-$sys/node-$node/proc-$Mproc + + + FSI_MASTER_TYPE + MFSI + + + FSI_MASTER_PORT + $fsi + + + FSI_SLAVE_CASCADE + 0 + + + FSI_OPTION_FLAGS + 0 + + VPD_REC_NUM$proc"; + + if ($build eq "fsp") + { + print " + + FSP_SCOM_DEVICE_PATH + $scompath + $scomsize + + + FSP_SCAN_DEVICE_PATH + $scanpath + $scansize + "; + } + + if (($mboxsize != 0) && ($build eq "fsp")) + { + print " + + FSP_MBOX_DEVICE_PATH + $mboxpath + $mboxsize + "; + } + print "\n\n"; +} + +sub generate_ex +{ + my ($proc, $ex) = @_; + my $uidstr = sprintf("0x%02X0A%04X",${node},$ex+$proc*16+${node}*8*16); + print " + + sys${sys}node${node}proc${proc}ex$ex + unit-ex-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/ex-$ex + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/ex-$ex + + + CHIP_UNIT + $ex + + +"; +} + +sub generate_ex_core +{ + my ($proc, $ex) = @_; + my $uidstr = sprintf("0x%02X0B%04X",${node},$ex+$proc*16+${node}*8*16); + print " + + sys${sys}node${node}proc${proc}ex${ex}core0 + unit-core-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/ex-$ex/core-0 + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/ex-$ex/core-0 + + + CHIP_UNIT + $ex + + +"; +} + +sub generate_mcs +{ + my ($proc, $mcs) = @_; + my $uidstr = sprintf("0x%02X0F%04X",${node},$mcs+$proc*8+${node}*8*8); + print " + + sys${sys}node${node}proc${proc}mcs$mcs + unit-mcs-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/mcs-$mcs + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs + + + CHIP_UNIT + $mcs + + +"; +} + +sub generate_pervasive_bus +{ + my $proc = shift; + my $uidstr = sprintf("0x%02X13%04X",${node},$proc+${node}*8); + print " + + + + sys${sys}node${node}proc${proc}pervasive0 + unit-pervasive-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/pervasive-0 + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/pervasive-0 + + +"; +} + +sub generate_powerbus +{ + my $proc = shift; + my $uidstr = sprintf("0x%02X14%04X",${node},$proc+${node}*8); + print " + + + + sys${sys}node${node}proc${proc}powerbus0 + unit-powerbus-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/powerbus-0 + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/powerbus-0 + + +"; +} + +sub generate_pcies +{ + my $proc = shift; + my $proc_name = "n${node}:p${proc}"; + print "\n\n"; + for my $i ( 0 .. 2 ) + { + generate_a_pcie( $proc, $i ); + } +} + +sub generate_a_pcie +{ + my ($proc, $phb) = @_; + my $uidstr = sprintf("0x%02X17%04X",${node},$phb+$proc*3+${node}*8*3); + print " + + sys${sys}node${node}proc${proc}pci${phb} + unit-pci-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/pci-$phb + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/pci-$phb + + + CHIP_UNIT + $phb + + +"; +} + +sub generate_ax_buses +{ + my ($proc, $type) = @_; + + my $proc_name = "n${node}p${proc}"; + print "\n\n"; + my $maxbus = ($type eq "A") ? 2 : 3; + my $typenum = ($type eq "A") ? 0x16 : 0x15; + $type = lc( $type ); + for my $i ( 0 .. $maxbus ) + { + my $uidstr = sprintf( "0x%02X%02X%04X", + ${node}, + $typenum, + $i+$proc*($maxbus+1)+${node}*8*($maxbus+1)); + my $peer = 0; + my $p_proc = 0; + my $p_port = 0; + foreach my $j ( @pbus ) + { + if ($j->[0] eq "n${node}:p${proc}:${type}${i}") + { + #$peer = 1; + $p_proc = $j->[1]; + $p_port = $p_proc; + $p_proc =~ s/^.*:p(.*):.*$/$1/; + $p_port =~ s/.*:p.*:.(.*)$/$1/; + last; + } + } + print " + + sys${sys}node${node}proc${proc}${type}bus$i + unit-${type}bus-murano + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/proc-$proc/${type}bus-$i + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/${type}bus-$i + + + CHIP_UNIT + $i + "; + if ($peer) + { + print " + + PEER_TARGET + affinity:sys-$sys/node-$node/proc-$p_proc/${type}bus-$p_port + "; + } + print "\n\n"; + } +} + +sub generate_centaur +{ + my ($ctaur, $mcs, $cfsi, $ipath) = @_; + my $scompath = $devpath->{chip}->{$ipath}->{'scom-path'}; + my $scanpath = $devpath->{chip}->{$ipath}->{'scan-path'}; + my $scomsize = length($scompath) + 1; + my $scansize = length($scanpath) + 1; + my $proc = $mcs; + $proc =~ s/.*:p(.*):.*/$1/g; + $mcs =~ s/.*:.*:mcs(.*)/$1/g; + + my $uidstr = sprintf("0x%02X06%04X",${node},$mcs+$proc*8+${node}*8*8); + + print " + + + + sys${sys}node${node}membuf${ctaur} + chip-membuf-centaur + HUID${uidstr} + POSITION$ctaur + + PHYS_PATH + physical:sys-$sys/node-$node/membuf-$ctaur + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur + + + + + FSI_MASTER_CHIP + physical:sys-$sys/node-$node/proc-$proc + + + FSI_MASTER_TYPE + CMFSI + + + FSI_MASTER_PORT + $cfsi + + + FSI_SLAVE_CASCADE + 0 + + + FSI_OPTION_FLAGS + 0 + "; + + if ($build eq "fsp") + { + print " + + FSP_SCOM_DEVICE_PATH + $scompath + $scomsize + + + FSP_SCAN_DEVICE_PATH + $scanpath + $scansize + "; + } + print "\n\n"; + + $uidstr = sprintf("0x%02X10%04X",${node},$mcs+$proc*8+${node}*8*8); + print " + + + + sys${sys}node${node}membuf${ctaur}mbs0 + unit-mbs-centaur + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/membuf-$ctaur/mbs-0 + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur/mbs-0 + + +"; +} + +sub generate_mba +{ + my ($ctaur, $mcs, $mba) = @_; + my $proc = $mcs; + $proc =~ s/.*:p(.*):.*/$1/g; + $mcs =~ s/.*:.*:mcs(.*)/$1/g; + + if ($mba == 0) + { + print "\n\n"; + } + + my $uidstr = sprintf("0x%02X11%04X",${node},$mba+$mcs*2+$proc*8*2+${node}*8*8*2); + + print " + + sys${sys}node${node}membuf${ctaur}mbs0mba$mba + unit-mba-centaur + HUID${uidstr} + + PHYS_PATH + physical:sys-$sys/node-$node/membuf-$ctaur/mbs-0/mba-$mba + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur/mbs-0/mba-$mba + + + CHIP_UNIT + $mba + + +"; +} + +# Since each Centaur has only one dimm, it is assumed to be attached to port 0 +# of the MBA0 chiplet. +sub generate_dimm +{ + my ($proc, $mcs, $ctaur, $pos, $dimm, $id) = @_; + + my $x = $id; + $x = int ($x / 4); + my $y = $id; + $y = int(($y - 4 * $x) / 2); + my $z = $id; + $z = $z % 2; + #$x = sprintf ("%d", $x); + #$y = sprintf ("%d", $y); + #$z = sprintf ("%d", $z); + my $uidstr = sprintf("0x%02X03%04X",${node},$dimm+${node}*512); + + print " + + sys${sys}node${node}dimm$dimm + lcard-dimm-cdimm + HUID${uidstr} + + POSITION + $dimm + + + PHYS_PATH + physical:sys-$sys/node-$node/dimm-$dimm + + + AFFINITY_PATH + affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$pos/mbs-0/mba-$x/mem_port-$y/dimm-$z + + + MBA_PORT + $y + + + MBA_DIMM + $z + + VPD_REC_NUM$dimm + +"; +} + +sub display_help +{ + use File::Basename; + my $scriptname = basename($0); + print STDERR " +Usage: + + $scriptname --help + $scriptname --system=sysname --mrwdir=pathname + [--build=hb] [--outfile=XmlFilename] + --system=systemname + Specify which system MRW XML to be generated + --mrwdir=pathname + Specify the complete dir pathname of the MRW. + --build=hb + Specify HostBoot build (hb) + --outfile=XmlFilename + Specify the filename for the output XML. If omitted, the output + is written to STDOUT which can be saved by redirection. +\n"; +} diff --git a/src/usr/targeting/xmltohb/genTuletaMrwXml.pl b/src/usr/targeting/xmltohb/genTuletaMrwXml.pl deleted file mode 100755 index e3339d0df..000000000 --- a/src/usr/targeting/xmltohb/genTuletaMrwXml.pl +++ /dev/null @@ -1,986 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/targeting/xmltohb/genTuletaMrwXml.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 other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. -# -# Origin: 30 -# -# IBM_PROLOG_END - -# -# Author: Van Lee vanlee@us.ibm.com -# -# Usage: -# -# genTuletaMrwXml.pl --mrwdir=pathname [--outfile=XmlFilename] -# --mrwdir=pathname -# Specify the complete dir pathname of the MRW. -# --outfile=XmlFilename -# Specify the filename for the output XML. If omitted, the output -# is written to STDOUT which can be saved by redirection. -# -# Purpose: -# -# This perl script processes the various xml files of the Tuleta MRW to -# extract the needed information for generating the final xml file. -# - -use constant SYSTEM => "TULETA"; -use strict; -use XML::Simple; -use Data::Dumper; - -my $mrwdir = ""; -my $usage = 0; -my $outFile = ""; -use Getopt::Long; -GetOptions( "mrwdir:s" => \$mrwdir, - "outfile:s" => \$outFile, - "help" => \$usage, ); - -if ($usage || ($mrwdir eq "")) -{ - display_help(); - exit 0; -} - -if ($outFile ne "") -{ - open OUTFILE, '+>', $outFile || - die "ERROR: unable to create $outFile\n"; - select OUTFILE; -} - -open (FH, "<$mrwdir/" . lc(SYSTEM) . "-system-policy.xml") || - die "ERROR: unable to open $mrwdir/" . lc(SYSTEM) . "-system-policy.xml\n"; -close (FH); - -my $policy = XMLin("$mrwdir/" . lc(SYSTEM) . "-system-policy.xml"); - -open (FH, "<$mrwdir/" . lc(SYSTEM) . "-targets.xml") || - die "ERROR: unable to open $mrwdir/" . lc(SYSTEM) . "-targets.xml\n"; -close (FH); - -my $eTargets = XMLin("$mrwdir/" . lc(SYSTEM) . "-targets.xml"); - -# Capture all targets into the @Targets array -use constant NAME_FIELD => 0; -use constant NODE_FIELD => 1; -use constant POS_FIELD => 2; -use constant UNIT_FIELD => 3; -use constant LOC_FIELD => 4; -my @Targets; -foreach my $i (@{$eTargets->{target}}) -{ - push @Targets, [ $i->{'ecmd-common-name'}, $i->{node}, $i->{position}, - $i->{'chip-unit'}, $i->{location} ]; -} - -open (FH, "<$mrwdir/" . lc(SYSTEM) . "-fsi-busses.xml") || - die "ERROR: unable to open $mrwdir/" . lc(SYSTEM) . "-fsi-busses.xml\n"; -close (FH); - -my $fsiBus = XMLin("$mrwdir/" . lc(SYSTEM) . "-fsi-busses.xml"); - -# Capture all FSI connections into the @Fsis array -use constant FSI_TYPE_FIELD => 0; -use constant FSI_LINK_FIELD => 1; -use constant FSI_TARGET_FIELD => 2; -my @Fsis; -foreach my $i (@{$fsiBus->{'fsi-bus'}}) -{ - push @Fsis, [ $i->{master}->{type}, $i->{master}->{link}, - "n$i->{slave}->{target}->{node}:p$i->{slave}->{target}->{position}" ]; -} - -open (FH, "<$mrwdir/" . lc(SYSTEM) . "-memory-busses.xml") || - die "ERROR: unable to open $mrwdir/" . lc(SYSTEM) . "-memory-busses.xml\n"; -close (FH); - -my $memBus = XMLin("$mrwdir/" . lc(SYSTEM) . "-memory-busses.xml"); - -# Capture all memory buses info into the @Membuses array -use constant MCS_TARGET_FIELD => 0; -use constant CENTAUR_TARGET_FIELD => 1; -use constant DIMM_TARGET_FIELD => 2; -use constant DIMM_PATH_FIELD => 3; -use constant CFSI_LINK_FIELD => 4; -my @Membuses; -foreach my $i (@{$memBus->{'memory-bus'}}) -{ - push @Membuses, [ - "n$i->{mcs}->{target}->{node}:p$i->{mcs}->{target}->{position}:mcs" . - $i->{mcs}->{target}->{chipUnit}, - "n$i->{mba}->{target}->{node}:p$i->{mba}->{target}->{position}:mba" . - $i->{mba}->{target}->{chipUnit}, - "n$i->{dimm}->{target}->{node}:p$i->{dimm}->{target}->{position}", - $i->{dimm}->{'instance-path'}, $i->{'fsi-link'} ]; -} - -# Sort physical DIMM order -my @Memfields; -my @SMembuses; -for my $i ( 0 .. $#Membuses ) -{ - for (my $j = 0; $j <= $#Membuses; $j++ ) - { - my $k = $Membuses[$j][DIMM_PATH_FIELD]; - $k =~ s/.*dimm-(.*).*$/$1/; - if ($k == $i) - { - for my $l ( 0 .. CFSI_LINK_FIELD ) - { - $Memfields[$l] = $Membuses[$j][$l]; - } - push @SMembuses, [ @Memfields ]; - $j = $#Membuses; - } - } -} - -# Find master processor's node and proc. The FSP master is always connected to -# the msater processor. The master processor's node is used as the system node - -my $node = 0; -my $Mproc = 0; -for my $i ( 0 .. $#Fsis ) -{ - if ((lc($Fsis[$i][FSI_TYPE_FIELD]) eq "fsp master") && - (lc($Fsis[$i][FSI_TARGET_FIELD]) eq "n[0-9]+:p[0-9]+")) - { - $node = $Fsis[$i][FSI_TARGET_FIELD]; - $Mproc = $node; - $node =~ s/n(.*):p.*/$1/; - $Mproc =~ s/.*p(.*)/$1/; - } -} - -# Generate @STargets array from the @Targets array to have the order as shown -# belows. The rest of the codes assume that this order is in place -# -# pu -# ex (one or more EX of pu before it) -# mcs (one or more MCS of pu before it) -# (Repeat for remaining pu) -# memb -# mba (to for membuf before it) -# (Repeat for remaining membuf) -# - -my @fields; -my @STargets; -for my $i ( 0 .. $#Targets ) -{ - if ($Targets[$i][NAME_FIELD] eq "pu") - { - for my $k ( 0 .. LOC_FIELD ) - { - $fields[$k] = $Targets[$i][$k]; - } - push @STargets, [ @fields ]; - - my $position = $Targets[$i][POS_FIELD]; - - for my $j ( 0 .. $#Targets ) - { - if (($Targets[$j][NAME_FIELD] eq "ex") && - ($Targets[$j][POS_FIELD] eq $position)) - { - for my $k ( 0 .. LOC_FIELD ) - { - $fields[$k] = $Targets[$j][$k]; - } - push @STargets, [ @fields ]; - } - } - - for my $j ( 0 .. $#Targets ) - { - if (($Targets[$j][NAME_FIELD] eq "mcs") && - ($Targets[$j][POS_FIELD] eq $position)) - { - for my $k ( 0 .. LOC_FIELD ) - { - $fields[$k] = $Targets[$j][$k]; - } - push @STargets, [ @fields ]; - } - } - } -} - -for my $i ( 0 .. $#Targets ) -{ - if ($Targets[$i][NAME_FIELD] eq "memb") - { - for my $k ( 0 .. LOC_FIELD ) - { - $fields[$k] = $Targets[$i][$k]; - } - push @STargets, [ @fields ]; - - my $position = $Targets[$i][POS_FIELD]; - - for my $j ( 0 .. $#Targets ) - { - if (($Targets[$j][NAME_FIELD] eq "mba") && - ($Targets[$j][POS_FIELD] eq $position)) - { - for my $k ( 0 .. LOC_FIELD ) - { - $fields[$k] = $Targets[$j][$k]; - } - push @STargets, [ @fields ]; - } - } - } -} - -# Finally, generate the xml file. -print "\n"; - -print "\n"; - -# First, generate system target (always sys0) -my $sys = 0; -generate_sys(); - -# Second, generate system node using the master processor's node -generate_system_node(); - -# Third, generate the proc, ex-chiplet, mcs-chiplet, pervasive-bus, powerbus, -# pcie bus and A/X-bus. -my $ex_count = 0; -my $mcs_count = 0; -for (my $do_core = 0, my $i = 0; $i <= $#STargets; $i++) -{ - if ($STargets[$i][NAME_FIELD] eq "pu") - { - my $proc = $STargets[$i][POS_FIELD]; - if ($proc eq $Mproc) - { - generate_master_proc($Mproc); - } - else - { - my $fsi; - for (my $j = 0; $j <= $#Fsis; $j++) - { - if ($Fsis[$j][FSI_TARGET_FIELD] eq "n${node}:p$proc") - { - $fsi = $Fsis[$j][FSI_LINK_FIELD]; - $j = $#Fsis; - } - } - generate_slave_proc($proc, $fsi); - } - } - elsif ($STargets[$i][NAME_FIELD] eq "ex") - { - my $proc = $STargets[$i][POS_FIELD]; - my $ex = $STargets[$i][UNIT_FIELD]; - if ($do_core == 0) - { - if ($ex_count == 0) - { - print "\n\n"; - } - generate_ex($proc, $ex); - $ex_count++; - if ($STargets[$i+1][NAME_FIELD] eq "mcs") - { - $do_core = 1; - $i -= $ex_count; - $ex_count = 0; - } - } - else - { - if ($ex_count == 0) - { - print "\n\n"; - } - generate_ex_core($proc,$ex); - $ex_count++; - if ($STargets[$i+1][NAME_FIELD] eq "mcs") - { - $do_core = 0; - $ex_count = 0; - } - } - } - elsif ($STargets[$i][NAME_FIELD] eq "mcs") - { - my $proc = $STargets[$i][POS_FIELD]; - my $mcs = $STargets[$i][UNIT_FIELD]; - if ($mcs_count == 0) - { - print "\n\n"; - } - generate_mcs($proc,$mcs); - $mcs_count++; - if (($STargets[$i+1][NAME_FIELD] eq "pu") || - ($STargets[$i+1][NAME_FIELD] eq "memb")) - { - $mcs_count = 0; - generate_pervasive_bus($proc); - generate_powerbus($proc); - generate_pcies($proc); - generate_ax_buses($proc, "A"); - generate_ax_buses($proc, "X"); - } - } -} - -# Fourth, generate the Centaur, MBS, and MBA - -my $memb; -my $membMcs; - -for my $i ( 0 .. $#STargets ) -{ - if ($STargets[$i][NAME_FIELD] eq "memb") - { - $memb = $STargets[$i][POS_FIELD]; - my $centaur = "n${node}:p${memb}"; - my $found = 0; - my $cfsi; - for my $j ( 0 .. $#Membuses ) - { - my $mba = $Membuses[$j][CENTAUR_TARGET_FIELD]; - $mba =~ s/(.*):mba.*$/$1/; - if ($mba eq $centaur) - { - $membMcs = $Membuses[$j][MCS_TARGET_FIELD]; - $cfsi = $Membuses[$j][CFSI_LINK_FIELD]; - $found = 1; - } - } - if ($found == 0) - { - die "ERROR. Can't locate Centaur from memory bus table\n"; - } - generate_centaur( $memb, $membMcs, $cfsi ); - } - elsif ($STargets[$i][NAME_FIELD] eq "mba") - { - my $mba = $STargets[$i][UNIT_FIELD]; - generate_mba( $memb, $membMcs, $mba ); - if ($mba == 1) - { - print "\n\n" - } - } -} - -# Fifth, generate DIMM targets - -print "\n\n"; - -for my $i ( 0 .. $#SMembuses ) -{ - my $proc = $SMembuses[$i][MCS_TARGET_FIELD]; - my $mcs = $proc; - $proc =~ s/.*:p(.*):.*/$1/; - $mcs =~ s/.*mcs(.*)/$1/; - my $ctaur = $SMembuses[$i][CENTAUR_TARGET_FIELD]; - my $mba = $ctaur; - $ctaur =~ s/.*:p(.*):mba.*$/$1/; - $mba =~ s/.*:mba(.*)$/$1/; - my $pos = $SMembuses[$i][DIMM_TARGET_FIELD]; - $pos =~ s/.*:p(.*)/$1/; - my $dimm = $SMembuses[$i][DIMM_PATH_FIELD]; - $dimm =~ s/.*dimm-(.*)/$1/; - print "\n\n"; - for my $id ( 0 .. 7 ) - { - my $dimmid = $dimm; - $dimmid <<= 3; - $dimmid |= $id; - $dimmid = sprintf ("%d", $dimmid); - generate_dimm( $proc, $mcs, $ctaur, $pos, $dimmid, $id ); - } -} - -print "\n"; - -# All done! -#close ($outFH); -exit 0; - -########## Subroutines ############## - -sub generate_sys -{ - my $proc_refclk = $policy->{'required-policy-settings'}->{'processor-refclock-frequency'}->{content}; - my $mem_refclk = $policy->{'required-policy-settings'}->{'memory-refclock-frequency'}->{content}; - - print " - - - - sys$sys - sys-sys-power8 - - PHYS_PATH - physical:sys-$sys - - - AFFINITY_PATH - affinity:sys-$sys - - - PROC_EPS_TABLE_TYPE - EPS_TYPE_LE - - - PROC_FABRIC_PUMP_MODE - MODE1 - - - PROC_X_BUS_WIDTH - W8BYTE - - - ALL_MCS_IN_INTERLEAVING_GROUP - 1 - - - FREQ_PROC_REFCLOCK - $proc_refclk - - - FREQ_MEM_REFCLOCK - $mem_refclk - - - FREQ_CORE_FLOOR - 2500 - - - SP_FUNCTIONS - - fsiSlaveInit1 - mailboxEnabled1 - reserved0 - - - -"; -} - -sub generate_system_node -{ - print " - - - - sys${sys}node${node} - enc-node-power8 - HUID0x00020000 - - PHYS_PATH - physical:sys-$sys/node-$node - - - AFFINITY_PATH - affinity:sys-$sys/node-$node - - -"; -} - -sub generate_master_proc -{ - my $uidstr = sprintf("0x%02X07%04X",${node},${Mproc}+${node}*8); - print " - - - - sys${sys}node${node}proc${Mproc} - chip-processor-murano - HUID${uidstr} - POSITION${Mproc} - SCOM_SWITCHES - - useFsiScom0 - useXscom1 - useInbandScom0 - reserved0 - - - - XSCOM_CHIP_INFO - - nodeId$node - chipId$Mproc - - - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$Mproc - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$Mproc - - - FABRIC_NODE_ID - $node - - - FABRIC_CHIP_ID - $Mproc - - VPD_REC_NUM$Mproc - -"; -} - -sub generate_slave_proc -{ - my ($proc, $fsi) = @_; - my $uidstr = sprintf("0x%02X07%04X",${node},$proc+${node}*8); - print " - - - - sys${sys}node${node}proc$proc - chip-processor-murano - HUID${uidstr} - POSITION$proc - SCOM_SWITCHES - - useFsiScom1 - useXscom0 - useInbandScom0 - reserved0 - - - - XSCOM_CHIP_INFO - - nodeId$node - chipId$Mproc - - - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc - - - FABRIC_NODE_ID - $node - - - FABRIC_CHIP_ID - $proc - - - - FSI_MASTER_CHIP - physical:sys-$sys/node-$node/proc-$Mproc - - - FSI_MASTER_TYPE - MFSI - - - FSI_MASTER_PORT - $fsi - - - FSI_SLAVE_CASCADE - 0 - - - FSI_OPTION_FLAGS - 0 - - VPD_REC_NUM$proc - -"; -} - -sub generate_ex -{ - my ($proc, $ex) = @_; - my $uidstr = sprintf("0x%02X0A%04X",${node},$ex+$proc*16+${node}*8*16); - print " - - sys${sys}node${node}proc${proc}ex$ex - unit-ex-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/ex-$ex - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/ex-$ex - - - CHIP_UNIT - $ex - - -"; -} - -sub generate_ex_core -{ - my ($proc, $ex) = @_; - my $uidstr = sprintf("0x%02X0B%04X",${node},$ex+$proc*16+${node}*8*16); - print " - - sys${sys}node${node}proc${proc}ex${ex}core0 - unit-core-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/ex-$ex/core-0 - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/ex-$ex/core-0 - - - CHIP_UNIT - $ex - - -"; -} - -sub generate_mcs -{ - my ($proc, $mcs) = @_; - my $uidstr = sprintf("0x%02X0F%04X",${node},$mcs+$proc*8+${node}*8*8); - print " - - sys${sys}node${node}proc${proc}mcs$mcs - unit-mcs-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/mcs-$mcs - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs - - - CHIP_UNIT - $mcs - - -"; -} - -sub generate_pervasive_bus -{ - my $proc = shift; - my $uidstr = sprintf("0x%02X13%04X",${node},$proc+${node}*8); - print " - - - - sys${sys}node${node}proc${proc}pervasive0 - unit-pervasive-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/pervasive-0 - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/pervasive-0 - - -"; -} - -sub generate_powerbus -{ - my $proc = shift; - my $uidstr = sprintf("0x%02X14%04X",${node},$proc+${node}*8); - print " - - - - sys${sys}node${node}proc${proc}powerbus0 - unit-powerbus-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/powerbus-0 - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/powerbus-0 - - -"; -} - -sub generate_pcies -{ - my $proc = shift; - my $proc_name = "n${node}:p${proc}"; - print "\n\n"; - for my $i ( 0 .. 2 ) - { - generate_a_pcie( $proc, $i ); - } -} - -sub generate_a_pcie -{ - my ($proc, $phb) = @_; - my $uidstr = sprintf("0x%02X17%04X",${node},$phb+$proc*3+${node}*8*3); - print " - - sys${sys}node${node}proc${proc}pci${phb} - unit-pci-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/pci-$phb - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/pci-$phb - - - CHIP_UNIT - $phb - - -"; -} - -sub generate_ax_buses -{ - my ($proc, $type) = @_; - - my $proc_name = "n${node}p${proc}"; - print "\n\n"; - my $maxbus = ($type eq "A") ? 2 : 3; - my $typenum = ($type eq "A") ? 0x16 : 0x15; - $type = lc( $type ); - for my $i ( 0 .. $maxbus ) - { - my $uidstr = sprintf( "0x%02X%02X%04X", - ${node}, - $typenum, - $i+$proc*($maxbus+1)+${node}*8*($maxbus+1)); - print " - - sys${sys}node${node}proc${proc}${type}bus$i - unit-${type}bus-murano - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/proc-$proc/${type}bus-$i - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/${type}bus-$i - - - CHIP_UNIT - $i - - -"; - } -} - -sub generate_centaur -{ - my ($ctaur, $mcs, $cfsi) = @_; - my $proc = $mcs; - $proc =~ s/.*:p(.*):.*/$1/g; - $mcs =~ s/.*:.*:mcs(.*)/$1/g; - - my $uidstr = sprintf("0x%02X06%04X",${node},$mcs+$proc*8+${node}*8*8); - - print " - - - - sys${sys}node${node}membuf${ctaur} - chip-membuf-centaur - HUID${uidstr} - POSITION$ctaur - - PHYS_PATH - physical:sys-$sys/node-$node/membuf-$ctaur - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur - - - - - FSI_MASTER_CHIP - physical:sys-$sys/node-$node/proc-$proc - - - FSI_MASTER_TYPE - CMFSI - - - FSI_MASTER_PORT - $cfsi - - - FSI_SLAVE_CASCADE - 0 - - - FSI_OPTION_FLAGS - 0 - - -"; - - $uidstr = sprintf("0x%02X10%04X",${node},$mcs+$proc*8+${node}*8*8); - print " - - - - sys${sys}node${node}membuf${ctaur}mbs0 - unit-mbs-centaur - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/membuf-$ctaur/mbs-0 - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur/mbs-0 - - -"; -} - -sub generate_mba -{ - my ($ctaur, $mcs, $mba) = @_; - my $proc = $mcs; - $proc =~ s/.*:p(.*):.*/$1/g; - $mcs =~ s/.*:.*:mcs(.*)/$1/g; - - if ($mba == 0) - { - print "\n\n"; - } - - my $uidstr = sprintf("0x%02X11%04X",${node},$mba+$mcs*2+$proc*8*2+${node}*8*8*2); - - print " - - sys${sys}node${node}membuf${ctaur}mbs0mba$mba - unit-mba-centaur - HUID${uidstr} - - PHYS_PATH - physical:sys-$sys/node-$node/membuf-$ctaur/mbs-0/mba-$mba - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$ctaur/mbs-0/mba-$mba - - - CHIP_UNIT - $mba - - -"; -} - -# Since each Centaur has only one dimm, it is assumed to be attached to port 0 -# of the MBA0 chiplet. -sub generate_dimm -{ - my ($proc, $mcs, $ctaur, $pos, $dimm, $id) = @_; - - my $x = $id; - $x = int ($x / 4); - my $y = $id; - $y = int(($y - 4 * $x) / 2); - my $z = $id; - $z = $z % 2; - #$x = sprintf ("%d", $x); - #$y = sprintf ("%d", $y); - #$z = sprintf ("%d", $z); - my $uidstr = sprintf("0x%02X03%04X",${node},$dimm+${node}*512); - - print " - - sys${sys}node${node}dimm$dimm - lcard-dimm-cdimm - HUID${uidstr} - - POSITION - $dimm - - - PHYS_PATH - physical:sys-$sys/node-$node/dimm-$dimm - - - AFFINITY_PATH - affinity:sys-$sys/node-$node/proc-$proc/mcs-$mcs/membuf-$pos/mbs-0/mba-$x/mem_port-$y/dimm-$z - - - MBA_PORT - $y - - - MBA_DIMM - $z - - VPD_REC_NUM$dimm - -"; -} - -sub display_help -{ - use File::Basename; - my $scriptname = basename($0); - print STDERR " -Usage: - - $scriptname --help - $scriptname --mrwdir=pathname [--outfile=XmlFilename] - --mrwdir=pathname - Specify the complete dir pathname of the MRW. - --outfile=XmlFilename - Specify the filename for the output XML. If omitted, the output - is written to STDOUT which can be saved by redirection. -\n"; -} -- cgit v1.2.3