12eeaed14Srobj#!/usr/bin/perl -w 22eeaed14Srobj# 32eeaed14Srobj# CDDL HEADER START 42eeaed14Srobj# 52eeaed14Srobj# The contents of this file are subject to the terms of the 62eeaed14Srobj# Common Development and Distribution License (the "License"). 72eeaed14Srobj# You may not use this file except in compliance with the License. 82eeaed14Srobj# 92eeaed14Srobj# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 102eeaed14Srobj# or http://www.opensolaris.org/os/licensing. 112eeaed14Srobj# See the License for the specific language governing permissions 122eeaed14Srobj# and limitations under the License. 132eeaed14Srobj# 142eeaed14Srobj# When distributing Covered Code, include this CDDL HEADER in each 152eeaed14Srobj# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 162eeaed14Srobj# If applicable, add the following below this CDDL HEADER, with the 172eeaed14Srobj# fields enclosed by brackets "[]" replaced with your own identifying 182eeaed14Srobj# information: Portions Copyright [yyyy] [name of copyright owner] 192eeaed14Srobj# 202eeaed14Srobj# CDDL HEADER END 212eeaed14Srobj# 222eeaed14Srobj# 23e5dcf7beSRobert Johnston# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 242eeaed14Srobj# Use is subject to license terms. 252eeaed14Srobj# 262eeaed14Srobj 272eeaed14Srobj# 282eeaed14Srobj# The fan topologies can be quite complicated, but are ultimately regular. This 292eeaed14Srobj# perl file uses some simplified internal structures to generate an .xml file 302eeaed14Srobj# without the maintenance overhead. 312eeaed14Srobj# 322eeaed14Srobj 332eeaed14Srobjuse Getopt::Std; 342eeaed14Srobjuse strict; 352eeaed14Srobj 362eeaed14Srobj# 372eeaed14Srobj# Master table of platforms. 382eeaed14Srobj# 392eeaed14Srobjmy @platforms = ( 402eeaed14Srobj # 412eeaed14Srobj # Galaxy 1/2 platforms. 422eeaed14Srobj # 432eeaed14Srobj # These systems have 2 fan-connector boards. Each fan-connector board has 3 442eeaed14Srobj # fan modules. Each fan module is an individual FRU. The fan-connector 452eeaed14Srobj # boards are also FRUs. 462eeaed14Srobj # 472eeaed14Srobj { 482eeaed14Srobj set => "Sun-Fire-X4100-Server|Sun-Fire-X4200-Server|" . 492eeaed14Srobj "Sun-Fire-X4100-M2|Sun-Fire-X4200-M2", 502eeaed14Srobj topology => [ 512eeaed14Srobj { 522eeaed14Srobj label => "FT %d", 532eeaed14Srobj count => 2, 542eeaed14Srobj fru => "self" 552eeaed14Srobj }, { 56825ba0f2Srobj fac_enum => 1, 57825ba0f2Srobj provider => "fac_prov_ipmi", 582eeaed14Srobj count => 3, 592eeaed14Srobj label => "FT %d FM %d", 602eeaed14Srobj entity_ref => "ft%d.fm%d.led", 61825ba0f2Srobj entity_ref_nparams => 2, 62825ba0f2Srobj fm_service_indctr => "ft%d.fm%d.led", 632eeaed14Srobj fru => "self" 642eeaed14Srobj } 652eeaed14Srobj ] 662eeaed14Srobj }, 672eeaed14Srobj 682eeaed14Srobj # 692eeaed14Srobj # Thumper platforms 702eeaed14Srobj # 712eeaed14Srobj # These systems have 5 fan modules, with each fan module containing 2 fans. 722eeaed14Srobj # The FRUs for the individual fans are the containing fan module. 732eeaed14Srobj # 742eeaed14Srobj { 752eeaed14Srobj set => "Sun-Fire-X4500|Sun-Fire-X4540", 762eeaed14Srobj topology => [ 772eeaed14Srobj { 78825ba0f2Srobj fac_enum => 0, 79825ba0f2Srobj provider => "fac_prov_ipmi", 802eeaed14Srobj label => "FT %d", 812eeaed14Srobj count => 5, 822eeaed14Srobj fru => "self", 83*88045cffSRobert Johnston entity_ref => "FT%d/PRSNT,ft%d.prsnt", 84825ba0f2Srobj entity_ref_nparams => 1, 85*88045cffSRobert Johnston fm_service_indctr => "FT%d/SVC,ft%d.service.led", 86*88045cffSRobert Johnston fm_ok2rm_indctr => "FT%d/OK,ft%d.ok2rm.led", 872eeaed14Srobj }, { 88825ba0f2Srobj fac_enum => 1, 89825ba0f2Srobj provider => "fac_prov_ipmi", 902eeaed14Srobj count => 2, 91*88045cffSRobert Johnston entity_ref => "FT%d/FAN%d/TACH,ft%d.f%d.speed", 92825ba0f2Srobj entity_ref_nparams => 2, 932eeaed14Srobj fru => "parent" 942eeaed14Srobj } 952eeaed14Srobj ] 962eeaed14Srobj }, 972eeaed14Srobj 982eeaed14Srobj # 992eeaed14Srobj # Fan Module/Fan topology for all G1N/G2N platforms. 1002eeaed14Srobj # 101825ba0f2Srobj # There are two fan boards, which are FRU's. Each fan board has 102825ba0f2Srobj # 3 fan modules for a total of 6 fan modules, with each fan module 103825ba0f2Srobj # containing 2 fans. The FRU's for the individual fans are the 104825ba0f2Srobj # containing fan module. 1052eeaed14Srobj # 1062eeaed14Srobj # Unfortunately, the IPMI topology on these systems is rather broken, and 1072eeaed14Srobj # all the SDRs that should be separate entities in fact refer to the same 1082eeaed14Srobj # entity IDs. So we have to use the alternative 'entity_present' option 1092eeaed14Srobj # using a single SDR record. 1102eeaed14Srobj # 1112eeaed14Srobj { 1122eeaed14Srobj set => "Sun-Fire-X4240|Sun-Fire-X4440", 1132eeaed14Srobj topology => [ 1142eeaed14Srobj { 1152eeaed14Srobj count => 2, 116825ba0f2Srobj label => "FANBD%d", 1172eeaed14Srobj fru => "self" 1182eeaed14Srobj }, { 119825ba0f2Srobj label => "FANBD%d FM%d", 1202eeaed14Srobj count => 3, 1212eeaed14Srobj fru => "self", 122e5dcf7beSRobert Johnston provider => "fac_prov_ipmi", 123*88045cffSRobert Johnston entity_present => "FB%d/FM%d/PRSNT,fb%d.fm%d.prsnt", 124*88045cffSRobert Johnston fm_service_indctr=> "FB%d/FM%d/SERVICE,fb%d.fm%d.led", 125e5dcf7beSRobert Johnston entity_ref_nparams => 2 1262eeaed14Srobj }, { 127e5dcf7beSRobert Johnston fac_enum => 1, 1282eeaed14Srobj count => 2, 129e5dcf7beSRobert Johnston fru => "parent", 130e5dcf7beSRobert Johnston provider => "fac_prov_ipmi", 131*88045cffSRobert Johnston entity_ref => "FB%d/FM%d/F%d/TACH,fb%d.fm%d.f%d.speed", 132*88045cffSRobert Johnston entity_present => "FB%d/FM%d/PRSNT,fb%d.fm%d.prsnt", 133e5dcf7beSRobert Johnston entity_ref_nparams => 3 1342eeaed14Srobj } 1352eeaed14Srobj 1362eeaed14Srobj ] 137825ba0f2Srobj }, 138825ba0f2Srobj 139825ba0f2Srobj # 140*88045cffSRobert Johnston # Fan Module/Fan topology for the Sun Fire X4600/X4600 M2 platforms. 141825ba0f2Srobj # 142825ba0f2Srobj # These systems have 4 fan assemblies with a single fan per assembly. 143825ba0f2Srobj # Each fan assembly is a FRU. The fan assemblies have a service LED 144825ba0f2Srobj # but no other indicators. 145825ba0f2Srobj # 146825ba0f2Srobj { 147e5dcf7beSRobert Johnston set => "Sun-Fire-X4600|Sun-Fire-X4600-M2", 148825ba0f2Srobj topology => [ 149825ba0f2Srobj { 150825ba0f2Srobj fac_enum => 1, 151825ba0f2Srobj provider => "fac_prov_ipmi", 152825ba0f2Srobj count => 4, 153825ba0f2Srobj label => "FT %d", 154825ba0f2Srobj fru => "self", 155825ba0f2Srobj entity_ref => "ft%d.fm0.prsnt", 156825ba0f2Srobj entity_ref_nparams => 1, 157825ba0f2Srobj fm_service_indctr => "ft%d.fm0.led" 158825ba0f2Srobj } 159825ba0f2Srobj ] 1607fcedef2SRobert Johnston }, 1617fcedef2SRobert Johnston 1627fcedef2SRobert Johnston # 163*88045cffSRobert Johnston # Fan Module/Fan topology for Sun Fire X4140. 16480f1b0f5SRobert Johnston # 16580f1b0f5SRobert Johnston # There are two fan boards, which are FRU's. The first fanboard has 4 16680f1b0f5SRobert Johnston # fanmodules (which are also FRU's). The second fan board has 3 fan 16780f1b0f5SRobert Johnston # modules. Each fanmodule contains two fans. 16880f1b0f5SRobert Johnston # 16980f1b0f5SRobert Johnston { 17080f1b0f5SRobert Johnston set => "Sun-Fire-X4140", 17180f1b0f5SRobert Johnston topology => [ 17280f1b0f5SRobert Johnston { 17380f1b0f5SRobert Johnston count => 2, 17480f1b0f5SRobert Johnston label => "FANBD%d", 17580f1b0f5SRobert Johnston fru => "self", 17680f1b0f5SRobert Johnston }, { 17780f1b0f5SRobert Johnston fac_enum => 1, 17880f1b0f5SRobert Johnston provider => "fac_prov_ipmi", 17980f1b0f5SRobert Johnston label => "FANBD%d FM%d", 18080f1b0f5SRobert Johnston count => 4, 18180f1b0f5SRobert Johnston fru => "self", 182*88045cffSRobert Johnston fm_service_indctr=> "FB%d/FM%d/SERVICE,fb%d.fm%d.led", 18380f1b0f5SRobert Johnston entity_ref_nparams => 2 18480f1b0f5SRobert Johnston }, { 18580f1b0f5SRobert Johnston fac_enum => 1, 18680f1b0f5SRobert Johnston provider => "fac_prov_ipmi", 18780f1b0f5SRobert Johnston count => 2, 18880f1b0f5SRobert Johnston fru => "parent", 189*88045cffSRobert Johnston entity_ref => "FB%d/FM%d/F%d/TACH,fb%d.fm%d.f%d.speed", 19080f1b0f5SRobert Johnston entity_ref_nparams => 3 19180f1b0f5SRobert Johnston } 19280f1b0f5SRobert Johnston 19380f1b0f5SRobert Johnston ] 19480f1b0f5SRobert Johnston }, 19580f1b0f5SRobert Johnston # 196*88045cffSRobert Johnston # Fan Module/Fan topology for the Sun Fire X4150. 1977fcedef2SRobert Johnston # 1987fcedef2SRobert Johnston # There are two fan boards, which are FRU's. The first fanboard has 4 1997fcedef2SRobert Johnston # fanmodules (which are also FRU's). The second fan board has 3 fan 2007fcedef2SRobert Johnston # modules. Each fanmodule contains two fans. 2017fcedef2SRobert Johnston # 2027fcedef2SRobert Johnston { 2037fcedef2SRobert Johnston set => "SUN-FIRE-X4150", 2047fcedef2SRobert Johnston topology => [ 2057fcedef2SRobert Johnston { 2067fcedef2SRobert Johnston count => 2, 2077fcedef2SRobert Johnston label => "FANBD%d", 2087fcedef2SRobert Johnston fru => "self", 2097fcedef2SRobert Johnston entity_present => "FB%d/PRSRNT" 2107fcedef2SRobert Johnston }, { 2117fcedef2SRobert Johnston label => "FANBD%d FM%d", 2127fcedef2SRobert Johnston count => 4, 2137fcedef2SRobert Johnston fru => "self", 2147fcedef2SRobert Johnston provider => "fac_prov_ipmi", 2157fcedef2SRobert Johnston entity_ref => "FB%d/FM%d/PRSNT", 2167fcedef2SRobert Johnston fm_service_indctr=> "", 2177fcedef2SRobert Johnston entity_ref_nparams => 2 2187fcedef2SRobert Johnston }, { 2197fcedef2SRobert Johnston fac_enum => 1, 2207fcedef2SRobert Johnston count => 2, 2217fcedef2SRobert Johnston fru => "parent", 2227fcedef2SRobert Johnston provider => "fac_prov_ipmi", 2237fcedef2SRobert Johnston entity_ref => "FB%d/FM%d/F%d/TACH", 2247fcedef2SRobert Johnston entity_ref_nparams => 3 2257fcedef2SRobert Johnston } 2267fcedef2SRobert Johnston 2277fcedef2SRobert Johnston ] 2287fcedef2SRobert Johnston }, 2297fcedef2SRobert Johnston # 2307fcedef2SRobert Johnston # Fan Module/Fan topology for Duradi 2U. 2317fcedef2SRobert Johnston # 2327fcedef2SRobert Johnston # There are two fan boards, which are FRU's. Both fanboards have 3 2337fcedef2SRobert Johnston # fanmodules (which are also FRU's). Each fanmodule contains two fans. 2347fcedef2SRobert Johnston # 2357fcedef2SRobert Johnston { 236*88045cffSRobert Johnston set => "SUN-FIRE-X4250|SUN-FIRE-X4450", 2377fcedef2SRobert Johnston topology => [ 2387fcedef2SRobert Johnston { 2397fcedef2SRobert Johnston count => 2, 2407fcedef2SRobert Johnston label => "FANBD%d", 2417fcedef2SRobert Johnston fru => "self", 2427fcedef2SRobert Johnston entity_present => "FB%d/PRSRNT" 2437fcedef2SRobert Johnston }, { 2447fcedef2SRobert Johnston label => "FANBD%d FM%d", 2457fcedef2SRobert Johnston count => 3, 2467fcedef2SRobert Johnston fru => "self", 2477fcedef2SRobert Johnston provider => "fac_prov_ipmi", 2487fcedef2SRobert Johnston entity_ref => "FB%d/FM%d/PRSNT", 2497fcedef2SRobert Johnston fm_service_indctr=> "", 2507fcedef2SRobert Johnston entity_ref_nparams => 2 2517fcedef2SRobert Johnston }, { 2527fcedef2SRobert Johnston fac_enum => 1, 2537fcedef2SRobert Johnston count => 2, 2547fcedef2SRobert Johnston fru => "parent", 2557fcedef2SRobert Johnston provider => "fac_prov_ipmi", 2567fcedef2SRobert Johnston entity_ref => "FB%d/FM%d/F%d/TACH", 2577fcedef2SRobert Johnston entity_ref_nparams => 3 2587fcedef2SRobert Johnston } 2597fcedef2SRobert Johnston 2607fcedef2SRobert Johnston ] 2612eeaed14Srobj } 2622eeaed14Srobj); 2632eeaed14Srobj 2642eeaed14Srobj# 2652eeaed14Srobj# Process an entry in the topology list. We are passed the indentation level, 2667fcedef2SRobert Johnston# the current topology array, the set list, and any pushed indices. This is 2677fcedef2SRobert Johnston# called recursively. 2682eeaed14Srobj# 2692eeaed14Srobjsub process_topology 2702eeaed14Srobj{ 2717fcedef2SRobert Johnston my ($indent, $toporef, $set, @indices) = @_; 2722eeaed14Srobj my @topo = @$toporef; 2732eeaed14Srobj my $level = shift @topo; 2742eeaed14Srobj my $type = $#topo == -1 ? "fan" : "fanmodule"; 2752eeaed14Srobj 276d91236feSeschrock printf("%*s<range name='%s' min='%d' max='%d'>\n", 2772eeaed14Srobj $indent, "", $type, 0, $level->{count} - 1); 2782eeaed14Srobj $indent += 2; 2792eeaed14Srobj 2802eeaed14Srobj for (my $i = 0; $i < $level->{count}; $i++) { 2817fcedef2SRobert Johnston # 28280f1b0f5SRobert Johnston # Special case code for the 1U version of Durado and Duradi, 28380f1b0f5SRobert Johnston # both of which have an assymetric fan topology 2847fcedef2SRobert Johnston # 28580f1b0f5SRobert Johnston last if ((($set eq "SUN-FIRE-X4150") || ($set eq "Sun-Fire-X4140")) 28680f1b0f5SRobert Johnston && ($type eq "fanmodule") && ($#indices == 0) 28780f1b0f5SRobert Johnston && ($indices[0] == 1) && ($i == 3)); 2887fcedef2SRobert Johnston 2892eeaed14Srobj push @indices, $i; 2902eeaed14Srobj 291d91236feSeschrock printf("%*s<node instance='%d'>\n", $indent, "", $i); 2922eeaed14Srobj 2932eeaed14Srobj $indent += 2; 2942eeaed14Srobj 295825ba0f2Srobj # Facility enumerator 296825ba0f2Srobj if ($level->{fac_enum}) { 297d91236feSeschrock printf("%*s<fac-enum provider='", 298825ba0f2Srobj $indent, ""); 2997fcedef2SRobert Johnston printf($level->{provider}); 300d91236feSeschrock printf("' />\n"); 301825ba0f2Srobj } 302825ba0f2Srobj 303825ba0f2Srobj # Facility nodes for service and ok2rm LED's 304825ba0f2Srobj if ($level->{fm_service_indctr}) { 305d91236feSeschrock printf("%*s<facility name='service' type='indicator' ". 306825ba0f2Srobj "provider='fac_prov_ipmi' >\n", $indent+2, ""); 307d91236feSeschrock printf("%*s<propgroup name='facility' version='1' ". 308825ba0f2Srobj "name-stability='Private' data-stability='Private' >\n", 309825ba0f2Srobj $indent+4, ""); 310d91236feSeschrock printf("%*s<propval name='type' type='uint32' ". 31180f1b0f5SRobert Johnston "value='0' />\n", $indent+6, ""); 312d91236feSeschrock printf("%*s<propmethod name='ipmi_entity' version='0' ". 313*88045cffSRobert Johnston "propname='entity_ref' proptype='string_array' >\n", 314825ba0f2Srobj $indent+6, ""); 315*88045cffSRobert Johnston 316*88045cffSRobert Johnston printf("%*s<argval name='format' type='string_array'>\n", 317*88045cffSRobert Johnston $indent+8, ""); 318*88045cffSRobert Johnston my @refs = split(/\,/, $level->{fm_service_indctr}); 319*88045cffSRobert Johnston foreach my $ref (@refs) { 320*88045cffSRobert Johnston printf("%*s<argitem value='", $indent+10, ""); 321*88045cffSRobert Johnston printf($ref, @indices); 322*88045cffSRobert Johnston printf("' />\n"); 323*88045cffSRobert Johnston } 324*88045cffSRobert Johnston 325*88045cffSRobert Johnston printf("%*s</argval>\n", $indent+8, ""); 326d91236feSeschrock printf("%*s<argval name='offset' type='uint32' ". 327825ba0f2Srobj "value='0' />\n", $indent+8, ""); 328d91236feSeschrock printf("%*s<argval name='nparams' type='uint32' ". 329825ba0f2Srobj "value='%d' />\n", $indent+8, "", 330825ba0f2Srobj $level->{entity_ref_nparams}); 331d91236feSeschrock printf("%*s</propmethod>\n", $indent+6, ""); 332d91236feSeschrock printf("%*s<propmethod name='ipmi_indicator_mode' ". 333825ba0f2Srobj "version='0' propname='mode' proptype='uint32' ". 334825ba0f2Srobj "mutable='1' >\n", $indent+6, ""); 335d91236feSeschrock printf("%*s</propmethod>\n", $indent+6, ""); 336d91236feSeschrock printf("%*s</propgroup>\n", $indent+4, ""); 337d91236feSeschrock printf("%*s</facility>\n", $indent+2, ""); 338825ba0f2Srobj } 339825ba0f2Srobj if ($level->{fm_ok2rm_indctr}) { 340d91236feSeschrock printf("%*s<facility name='ok2rm' type='indicator' ". 341825ba0f2Srobj "provider='fac_prov_ipmi' >\n", $indent+2, ""); 342d91236feSeschrock printf("%*s<propgroup name='facility' version='1' ". 343825ba0f2Srobj "name-stability='Private' data-stability='Private' >\n", 344825ba0f2Srobj $indent+4, ""); 345d91236feSeschrock printf("%*s<propval name='type' type='uint32' ". 346825ba0f2Srobj "value='2' />\n", $indent+6, ""); 347d91236feSeschrock printf("%*s<propmethod name='ipmi_entity' version='0' ". 348*88045cffSRobert Johnston "propname='entity_ref' proptype='string_array' >\n", 349825ba0f2Srobj $indent+6, ""); 350*88045cffSRobert Johnston 351*88045cffSRobert Johnston printf("%*s<argval name='format' type='string_array'>\n", 352*88045cffSRobert Johnston $indent+8, ""); 353*88045cffSRobert Johnston my @refs = split(/\,/, $level->{fm_ok2rm_indctr}); 354*88045cffSRobert Johnston foreach my $ref (@refs) { 355*88045cffSRobert Johnston printf("%*s<argitem value='", $indent+10, ""); 356*88045cffSRobert Johnston printf($ref, @indices); 357*88045cffSRobert Johnston printf("' />\n"); 358*88045cffSRobert Johnston } 359*88045cffSRobert Johnston printf("%*s</argval>\n", $indent+8, ""); 360d91236feSeschrock printf("%*s<argval name='offset' type='uint32' ". 361825ba0f2Srobj "value='0' />\n", $indent+8, ""); 362d91236feSeschrock printf("%*s<argval name='nparams' type='uint32' ". 363825ba0f2Srobj "value='%d' />\n", $indent+8, "", 364825ba0f2Srobj $level->{entity_ref_nparams}); 365d91236feSeschrock printf("%*s</propmethod>\n", $indent+6, ""); 366d91236feSeschrock printf("%*s<propmethod name='ipmi_indicator_mode' ". 367825ba0f2Srobj "version='0' propname='mode' proptype='uint32' mutable='1' >\n", 368825ba0f2Srobj $indent+6, ""); 369d91236feSeschrock printf("%*s</propmethod>\n", $indent+6, ""); 370d91236feSeschrock printf("%*s</propgroup>\n", $indent+4, ""); 371d91236feSeschrock printf("%*s</facility>\n", $indent+2, ""); 372825ba0f2Srobj } 373d91236feSeschrock 3742eeaed14Srobj # Protocol properties (label, fmri) 375d91236feSeschrock printf("%*s<propgroup name='protocol' version='1' " . 3762eeaed14Srobj "name-stability='Private' data-stability='Private'>\n", 3772eeaed14Srobj $indent, ""); 3782eeaed14Srobj 3792eeaed14Srobj $indent += 2; 3802eeaed14Srobj 3812eeaed14Srobj if ($level->{label}) { 382d91236feSeschrock printf("%*s<propval name='label' type='string' " . 3832eeaed14Srobj "value='", $indent, ""); 384d91236feSeschrock printf($level->{label}, @indices); 385d91236feSeschrock printf("' />\n"); 3862eeaed14Srobj } 3872eeaed14Srobj 388d91236feSeschrock printf("%*s<propmethod name='ipmi_fru_fmri' " . 3892eeaed14Srobj "version='0' propname='FRU' proptype='fmri'>\n", 3902eeaed14Srobj $indent, ""); 391d91236feSeschrock printf("%*s<argval name='entity' type='string' " . 3922eeaed14Srobj "value='%s' />\n", $indent + 2, "", $level->{fru}); 393d91236feSeschrock printf("%*s</propmethod>\n", $indent, ""); 3942eeaed14Srobj 3952eeaed14Srobj $indent -= 2; 3962eeaed14Srobj 397d91236feSeschrock printf("%*s</propgroup>\n", $indent, ""); 3982eeaed14Srobj 3992eeaed14Srobj # 400825ba0f2Srobj # Entity references (if any) 4012eeaed14Srobj # 402e5dcf7beSRobert Johnston if ($level->{entity_ref}) { 403e5dcf7beSRobert Johnston my $val = $level->{entity_ref}; 404d91236feSeschrock printf("%*s<propgroup name='ipmi' version='1' " . 4052eeaed14Srobj "name-stability='Private' " . 4062eeaed14Srobj "data-stability='Private' >\n", $indent, ""); 407*88045cffSRobert Johnston 408e5dcf7beSRobert Johnston printf("%*s<propval name='entity_ref' ". 409*88045cffSRobert Johnston "type='string_array'>\n", $indent + 2, ""); 410*88045cffSRobert Johnston my @refs = split(/\,/, $val); 411*88045cffSRobert Johnston foreach my $ref (@refs) { 412*88045cffSRobert Johnston printf("%*s<propitem value='", $indent+4, ""); 413*88045cffSRobert Johnston printf($ref, @indices); 414e5dcf7beSRobert Johnston printf("' />\n"); 415*88045cffSRobert Johnston } 416*88045cffSRobert Johnston printf("%*s</propval>\n", $indent+2, ""); 417e5dcf7beSRobert Johnston printf("%*s</propgroup>\n", $indent, ""); 418e5dcf7beSRobert Johnston } 419e5dcf7beSRobert Johnston if ($level->{entity_present}) { 420e5dcf7beSRobert Johnston my $val = $level->{entity_present}; 421e5dcf7beSRobert Johnston printf("%*s<propgroup name='ipmi' version='1' " . 422e5dcf7beSRobert Johnston "name-stability='Private' " . 423e5dcf7beSRobert Johnston "data-stability='Private' >\n", $indent, ""); 424*88045cffSRobert Johnston 425e5dcf7beSRobert Johnston printf("%*s<propval name='entity_present' " . 426*88045cffSRobert Johnston "type='string_array'>\n", $indent + 2, ""); 427*88045cffSRobert Johnston my @refs = split(/\,/, $val); 428*88045cffSRobert Johnston foreach my $ref (@refs) { 429*88045cffSRobert Johnston printf("%*s<propitem value='", $indent+4, ""); 430*88045cffSRobert Johnston printf($ref, @indices); 431d91236feSeschrock printf("' />\n"); 432*88045cffSRobert Johnston } 433*88045cffSRobert Johnston printf("%*s</propval>\n", $indent+4, ""); 434d91236feSeschrock printf("%*s</propgroup>\n", $indent, ""); 4352eeaed14Srobj } 4362eeaed14Srobj 437825ba0f2Srobj # 438825ba0f2Srobj # Post-process IPMI enumerator method 439825ba0f2Srobj # 440d91236feSeschrock printf("%*s<enum-method name='ipmi' version='1' ". 441825ba0f2Srobj "/>\n", $indent, ""); 4422eeaed14Srobj 4432eeaed14Srobj # 4442eeaed14Srobj # Children (if any) 4452eeaed14Srobj # 4462eeaed14Srobj if ($#topo != -1) { 447d91236feSeschrock printf("%*s<dependents grouping='children'>\n", 4482eeaed14Srobj $indent, ""); 4497fcedef2SRobert Johnston process_topology($indent + 2, \@topo, $set, @indices); 450d91236feSeschrock printf("%*s</dependents>\n", $indent, ""); 4512eeaed14Srobj } 4522eeaed14Srobj 4532eeaed14Srobj $indent -= 2; 4542eeaed14Srobj 455d91236feSeschrock printf("%*s</node>\n", $indent, ""); 4562eeaed14Srobj pop @indices; 4572eeaed14Srobj } 4582eeaed14Srobj 4592eeaed14Srobj $indent -= 2; 460d91236feSeschrock printf("%*s</range>\n", $indent, ""); 4612eeaed14Srobj} 4622eeaed14Srobj 4632eeaed14Srobj# 4642eeaed14Srobj# Process a single platform file. 4652eeaed14Srobj# 4662eeaed14Srobjsub process_platform 4672eeaed14Srobj{ 4682eeaed14Srobj my ($desc) = @_; 4692eeaed14Srobj my $indent = 2; 4702eeaed14Srobj 471d91236feSeschrock printf("%*s<set type='product' setlist='%s'>\n", $indent, "", 4722eeaed14Srobj $desc->{set}); 4732eeaed14Srobj 4747fcedef2SRobert Johnston process_topology($indent + 2, $desc->{topology}, $desc->{set}); 4752eeaed14Srobj 476d91236feSeschrock printf("%*s</set>\n", $indent, ""); 4772eeaed14Srobj} 4782eeaed14Srobj 479d91236feSeschrockprint "<topology name='fan' scheme='hc'>\n"; 4802eeaed14Srobj 4812eeaed14Srobjmy $desc; 4822eeaed14Srobjforeach $desc (@platforms) { 4832eeaed14Srobj process_platform($desc); 4842eeaed14Srobj} 4852eeaed14Srobj 486d91236feSeschrockprint "</topology>\n"; 487