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