1#!/usr/local/bin/perl 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26#pragma ident "%Z%%M% %I% %E% SMI" 27# 28 29$num_bays = 48; 30$bay_label = "HD_ID_"; 31 32sub calc_sfx_prop 33{ 34 my $name = shift; 35 my $bay = shift; 36 my $sid = shift; 37 my @names = ( 38 "+PRSNT", "-PRSNT", 39 "+OK2RM", "-OK2RM", 40 "+FAULT", "-FAULT"); 41 my @masks = ( 42 "amask=0x0001", "dmask=0x0001", 43 "amask=0x0008", "dmask=0x0008", 44 "amask=0x0002", "dmask=0x0002"); 45 my @states = ( 46 "absent>present", "present>configured", 47 "configured>unconfigured", "unconfigured>configured", 48 "unconfigured>absent", "configured>absent", 49 "present>absent", "absent>configured"); 50 my @actions = ( 51 "+PRSNT&+OK2RM", "+PRSNT&-OK2RM", 52 "+OK2RM", "-OK2RM", 53 "-OK2RM&-PRSNT", "-OK2RM&-PRSNT", 54 "-OK2RM&-PRSNT", "-OK2RM&+PRSNT"); 55 56 printf "\n"; 57 printf " <propgroup name='%s-properties' version='1' " . 58 "name-stability='Private' data-stability='Private' >\n", $name; 59 printf " <propval name='fru-update-action' type='string' " . 60 "value='ipmi:fru gid=3 hdd=%d' />\n", $bay; 61 62 for ($i = 0; $i < 6; $i++) { 63 printf " <propval name='indicator-name-%d' " . 64 "type='string' value='%s' />\n", $i, $names[$i]; 65 printf " <propval name='indicator-action-%d' " . 66 "type='string' value='ipmi:state sid=%d %s' />\n", 67 $i, $sid, $masks[$i]; 68 } 69 70 for ($i = 0; $i < 8; $i++) { 71 printf " <propval name='indicator-rule-states-%d' " . 72 "type='string' value='%s' />\n", $i, $states[$i]; 73 printf " <propval name='indicator-rule-actions-%d' " . 74 "type='string' value='%s' />\n", $i, $actions[$i]; 75 } 76 printf " </propgroup>\n\n"; 77} 78 79print <<EOF; 80<topology name='disk' scheme='hc'> 81 <range name='bay' min='0' max='47'> 82 <facility name='locate' type='indicator' provider='fac_prov_ipmi' > 83 <propgroup name='facility' version='1' name-stability='Private' 84 data-stability='Private' > 85 <propval name='type' type='uint32' value='1' /> 86 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 87 proptype='string' > 88 <argval name='format' type='string' value='hdd\%d.ok2rm.led' /> 89 <argval name='offset' type='uint32' value='0' /> 90 <argval name='nparams' type='uint32' value='1' /> 91 </propmethod> 92 <propmethod name='thumper_locate_mode' version='0' 93 propname='mode' proptype='uint32' mutable='1'> 94 </propmethod> 95 </propgroup> 96 </facility> 97 <facility name='ok2rm' type='indicator' provider='fac_prov_ipmi' > 98 <propgroup name='facility' version='1' name-stability='Private' 99 data-stability='Private' > 100 <propval name='type' type='uint32' value='2' /> 101 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 102 proptype='string' > 103 <argval name='format' type='string' value='hdd\%d.state' /> 104 <argval name='offset' type='uint32' value='0' /> 105 <argval name='nparams' type='uint32' value='1' /> 106 </propmethod> 107 <propmethod name='thumper_indicator_mode' version='0' 108 propname='mode' proptype='uint32' mutable='1'> 109 </propmethod> 110 </propgroup> 111 </facility> 112 <facility name='service' type='indicator' provider='fac_prov_ipmi' > 113 <propgroup name='facility' version='1' name-stability='Private' 114 data-stability='Private' > 115 <propval name='type' type='uint32' value='0' /> 116 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 117 proptype='string' > 118 <argval name='format' type='string' value='hdd\%d.state' /> 119 <argval name='offset' type='uint32' value='0' /> 120 <argval name='nparams' type='uint32' value='1' /> 121 </propmethod> 122 <propmethod name='thumper_indicator_mode' version='0' propname='mode' 123 proptype='uint32' mutable='1'> 124 </propmethod> 125 </propgroup> 126 </facility> 127 <facility name='present' type='indicator' provider='fac_prov_ipmi' > 128 <propgroup name='facility' version='1' name-stability='Private' 129 data-stability='Private' > 130 <propval name='type' type='uint32' value='3' /> 131 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 132 proptype='string' > 133 <argval name='format' type='string' value='hdd\%d.state' /> 134 <argval name='offset' type='uint32' value='0' /> 135 <argval name='nparams' type='uint32' value='1' /> 136 </propmethod> 137 <propmethod name='thumper_indicator_mode' version='0' propname='mode' 138 proptype='uint32' mutable='1'> 139 </propmethod> 140 </propgroup> 141 </facility> 142EOF 143 144my @pci0=(1, 2, 0); 145my @pci1=(4, 3, 8, 7, 2, 1); 146 147for ($bay = 0; $bay < $num_bays; $bay++) { 148 $sid = 90 + $bay; 149 $target = (($bay/12) + (($bay & 1) << 2)); 150 $index = (($bay >> 2) % 3); 151 $p0 = $pci0[$index]; 152 $index = (($bay >> 1) % 6); 153 $p1 = $pci1[$index]; 154 155 $hpath = sprintf("/pci\@%x,0/pci1022,7458\@%x/pci11ab,11ab\@1", 156 $p0, $p1); 157 $tpath = sprintf("/disk\@%x,0", $target); 158 $apoint = sprintf(":%d", $target); 159 160 print <<EOF; 161 <node instance='$bay'> 162 <propgroup name='protocol' version='1' name-stability='Private' 163 data-stability='Private'> 164 <propval name='label' type='string' value='$bay_label$bay' /> 165 </propgroup> 166 <propgroup name='io' version='1' name-stability='Private' 167 data-stability='Private'> 168 <propval name='ap-path' type='string' value='/devices$hpath$apoint' /> 169 </propgroup> 170EOF 171 172 calc_sfx_prop("sfx4500", $bay, $sid); 173 174 print <<EOF; 175 <propgroup name='binding' version='1' name-stability='Private' 176 data-stability='Private'> 177 <propval name='occupant-path' type='string' 178 value='$hpath$tpath' /> 179 </propgroup> 180 </node> 181EOF 182} 183 184print <<EOF; 185 <dependents grouping='children'> 186 <range name='disk' min='0' max='0'> 187 <enum-method name='disk' version='1' /> 188 </range> 189 </dependents> 190 </range> 191</topology> 192EOF 193