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 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' > 86 <argval name='format' type='string' value='hdd\%d.ok2rm.led' /> 87 <argval name='offset' type='uint32' value='0' /> 88 <argval name='nparams' type='uint32' value='1' /> 89 </propmethod> 90 <propmethod name='thumper_locate_mode' version='0' 91 propname='mode' proptype='uint32' mutable='1'> 92 </propmethod> 93 </propgroup> 94 </facility> 95 <facility name='ok2rm' type='indicator' provider='fac_prov_ipmi' > 96 <propgroup name='facility' version='1' name-stability='Private' 97 data-stability='Private' > 98 <propval name='type' type='uint32' value='2' /> 99 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 100 proptype='string' > 101 <argval name='format' type='string' value='hdd\%d.state' /> 102 <argval name='offset' type='uint32' value='0' /> 103 <argval name='nparams' type='uint32' value='1' /> 104 </propmethod> 105 <propmethod name='thumper_indicator_mode' version='0' 106 propname='mode' proptype='uint32' mutable='1'> 107 </propmethod> 108 </propgroup> 109 </facility> 110 <facility name='service' type='indicator' provider='fac_prov_ipmi' > 111 <propgroup name='facility' version='1' name-stability='Private' 112 data-stability='Private' > 113 <propval name='type' type='uint32' value='0' /> 114 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 115 proptype='string' > 116 <argval name='format' type='string' value='hdd\%d.state' /> 117 <argval name='offset' type='uint32' value='0' /> 118 <argval name='nparams' type='uint32' value='1' /> 119 </propmethod> 120 <propmethod name='thumper_indicator_mode' version='0' propname='mode' 121 proptype='uint32' mutable='1'> 122 </propmethod> 123 </propgroup> 124 </facility> 125 <facility name='present' type='indicator' provider='fac_prov_ipmi' > 126 <propgroup name='facility' version='1' name-stability='Private' 127 data-stability='Private' > 128 <propval name='type' type='uint32' value='3' /> 129 <propmethod name='ipmi_entity' version='0' propname='entity_ref' 130 proptype='string' > 131 <argval name='format' type='string' value='hdd\%d.state' /> 132 <argval name='offset' type='uint32' value='0' /> 133 <argval name='nparams' type='uint32' value='1' /> 134 </propmethod> 135 <propmethod name='thumper_indicator_mode' version='0' propname='mode' 136 proptype='uint32' mutable='1'> 137 </propmethod> 138 </propgroup> 139 </facility> 140EOF 141 142my @pci0=(0, 0, 0, 0x3c, 0x3c, 0x3c); 143my @pci1=(0x377, 0x375, 0x376, 0x377, 0x375, 0x376); 144my @pci2=(0xa, 0xb, 0xf, 0xa, 0xb, 0xf); 145 146for ($bay = 0; $bay < $num_bays; $bay++) { 147 $sid = 90 + $bay; 148 $target = $bay % 8; 149 $controller = $bay / 8; 150 151 # set hba path, target path, bay path, and attachment point 152 $hpath = sprintf("/pci\@%x,0/pci10de,%x\@%x/pci1000,1000\@0", 153 $pci0[$controller], $pci1[$controller], $pci2[$controller]); 154 $tpath = sprintf("/sd\@%x,0", $target); 155 $apoint = sprintf(":scsi::dsk/c%dt%dd0", 156 $controller + 1, $target); 157 158 print <<EOF; 159 <node instance='$bay'> 160 <propgroup name='protocol' version='1' name-stability='Private' 161 data-stability='Private'> 162 <propval name='label' type='string' value='$bay_label$bay' /> 163 </propgroup> 164 <propgroup name='io' version='1' name-stability='Private' 165 data-stability='Private'> 166 <propval name='ap-path' type='string' value='/devices$hpath$apoint' /> 167 </propgroup> 168EOF 169 170 calc_sfx_prop("sfx4500", $bay, $sid); 171 172 print <<EOF; 173 <propgroup name='binding' version='1' name-stability='Private' 174 data-stability='Private'> 175 <propval name='occupant-path' type='string' 176 value='$hpath$tpath' /> 177 </propgroup> 178 </node> 179EOF 180} 181 182print <<EOF; 183 <dependents grouping='children'> 184 <range name='disk' min='0' max='0'> 185 <enum-method name='disk' version='1' /> 186 </range> 187 </dependents> 188 </range> 189</topology> 190EOF 191