1#!/usr/bin/perl -w 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 2009 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26 27$num_bays = 48; 28$bay_label = "HD_ID_"; 29 30sub calc_sfx_prop 31{ 32 my $name = shift; 33 my $bay = shift; 34 my $sid = shift; 35 my @names = ( 36 "+PRSNT", "-PRSNT", 37 "+OK2RM", "-OK2RM", 38 "+FAULT", "-FAULT"); 39 my @masks = ( 40 "amask=0x0001", "dmask=0x0001", 41 "amask=0x0008", "dmask=0x0008", 42 "amask=0x0002", "dmask=0x0002"); 43 my @states = ( 44 "absent>present", "present>configured", 45 "configured>unconfigured", "unconfigured>configured", 46 "unconfigured>absent", "configured>absent", 47 "present>absent", "absent>configured"); 48 my @actions = ( 49 "+PRSNT&+OK2RM", "+PRSNT&-OK2RM", 50 "+OK2RM", "-OK2RM", 51 "-OK2RM&-PRSNT", "-OK2RM&-PRSNT", 52 "-OK2RM&-PRSNT", "-OK2RM&+PRSNT"); 53 54 printf "\n"; 55 printf " <propgroup name='%s-properties' version='1' " . 56 "name-stability='Private' data-stability='Private' >\n", $name; 57 printf " <propval name='fru-update-action' type='string' " . 58 "value='ipmi:fru gid=3 hdd=%d' />\n", $bay; 59 60 for ($i = 0; $i < 6; $i++) { 61 printf " <propval name='indicator-name-%d' " . 62 "type='string' value='%s' />\n", $i, $names[$i]; 63 printf " <propval name='indicator-action-%d' " . 64 "type='string' value='ipmi:state sid=%d %s' />\n", 65 $i, $sid, $masks[$i]; 66 } 67 68 for ($i = 0; $i < 8; $i++) { 69 printf " <propval name='indicator-rule-states-%d' " . 70 "type='string' value='%s' />\n", $i, $states[$i]; 71 printf " <propval name='indicator-rule-actions-%d' " . 72 "type='string' value='%s' />\n", $i, $actions[$i]; 73 } 74 printf " </propgroup>\n\n"; 75} 76 77print <<EOF; 78<topology name='disk' scheme='hc'> 79 <range name='bay' min='0' max='47'> 80 <facility name='locate' type='indicator' provider='fac_prov_ipmi' > 81 <propgroup name='facility' version='1' name-stability='Private' 82 data-stability='Private' > 83 <propval name='type' type='uint32' value='1' /> 84 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 85 proptype='string_array' > 86 <argval name='format' type='string_array'> 87 <argitem value='hdd\%d.ok2rm.led' /> 88 </argval> 89 <argval name='offset' type='uint32' value='0' /> 90 <argval name='nparams' type='uint32' value='1' /> 91 </propmethod> 92 <propmethod name='bay_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_array' > 103 <argval name='format' type='string_array'> 104 <argitem value='hdd\%d.state' /> 105 </argval> 106 <argval name='offset' type='uint32' value='0' /> 107 <argval name='nparams' type='uint32' value='1' /> 108 </propmethod> 109 <propmethod name='bay_indicator_mode' version='0' 110 propname='mode' proptype='uint32' mutable='1'> 111 </propmethod> 112 </propgroup> 113 </facility> 114 <facility name='service' type='indicator' provider='fac_prov_ipmi' > 115 <propgroup name='facility' version='1' name-stability='Private' 116 data-stability='Private' > 117 <propval name='type' type='uint32' value='0' /> 118 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 119 proptype='string_array' > 120 <argval name='format' type='string_array'> 121 <argitem value='hdd\%d.state' /> 122 </argval> 123 <argval name='offset' type='uint32' value='0' /> 124 <argval name='nparams' type='uint32' value='1' /> 125 </propmethod> 126 <propmethod name='bay_indicator_mode' version='0' propname='mode' 127 proptype='uint32' mutable='1'> 128 </propmethod> 129 </propgroup> 130 </facility> 131 <facility name='present' type='indicator' provider='fac_prov_ipmi' > 132 <propgroup name='facility' version='1' name-stability='Private' 133 data-stability='Private' > 134 <propval name='type' type='uint32' value='3' /> 135 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 136 proptype='string_array' > 137 <argval name='format' type='string_array'> 138 <argitem value='hdd\%d.state' /> 139 </argval> 140 <argval name='offset' type='uint32' value='0' /> 141 <argval name='nparams' type='uint32' value='1' /> 142 </propmethod> 143 <propmethod name='x4500_present_mode' version='0' propname='mode' 144 proptype='uint32' mutable='1'> 145 </propmethod> 146 </propgroup> 147 </facility> 148EOF 149 150my @pci0=(1, 2, 0); 151my @pci1=(4, 3, 8, 7, 2, 1); 152 153for ($bay = 0; $bay < $num_bays; $bay++) { 154 $sid = 90 + $bay; 155 $target = (($bay/12) + (($bay & 1) << 2)); 156 $index = (($bay >> 2) % 3); 157 $p0 = $pci0[$index]; 158 $index = (($bay >> 1) % 6); 159 $p1 = $pci1[$index]; 160 161 $hpath = sprintf("/pci\@%x,0/pci1022,7458\@%x/pci11ab,11ab\@1", 162 $p0, $p1); 163 $tpath = sprintf("/disk\@%x,0", $target); 164 $apoint = sprintf(":%d", $target); 165 166 print <<EOF; 167 <node instance='$bay'> 168 <propgroup name='protocol' version='1' name-stability='Private' 169 data-stability='Private'> 170 <propval name='label' type='string' value='$bay_label$bay' /> 171 </propgroup> 172 <propgroup name='io' version='1' name-stability='Private' 173 data-stability='Private'> 174 <propval name='ap-path' type='string' value='/devices$hpath$apoint' /> 175 </propgroup> 176EOF 177 178 calc_sfx_prop("sfx4500", $bay, $sid); 179 180 print <<EOF; 181 <propgroup name='binding' version='1' name-stability='Private' 182 data-stability='Private'> 183 <propval name='occupant-path' type='string' 184 value='$hpath$tpath' /> 185 </propgroup> 186 </node> 187EOF 188} 189 190print <<EOF; 191 <dependents grouping='children'> 192 <range name='disk' min='0' max='0'> 193 <enum-method name='disk' version='1' /> 194 </range> 195 </dependents> 196 </range> 197</topology> 198EOF 199