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