#!/usr/local/bin/perl
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
$num_bays = 48;
$bay_label = "HD_ID_";
sub calc_sfx_prop
{
my $name = shift;
my $bay = shift;
my $sid = shift;
my @names = (
"+PRSNT", "-PRSNT",
"+OK2RM", "-OK2RM",
"+FAULT", "-FAULT");
my @masks = (
"amask=0x0001", "dmask=0x0001",
"amask=0x0008", "dmask=0x0008",
"amask=0x0002", "dmask=0x0002");
my @states = (
"absent>present", "present>configured",
"configured>unconfigured", "unconfigured>configured",
"unconfigured>absent", "configured>absent",
"present>absent", "absent>configured");
my @actions = (
"+PRSNT&+OK2RM", "+PRSNT&-OK2RM",
"+OK2RM", "-OK2RM",
"-OK2RM&-PRSNT", "-OK2RM&-PRSNT",
"-OK2RM&-PRSNT", "-OK2RM&+PRSNT");
printf "\n";
printf " \n", $name;
printf " \n", $bay;
for ($i = 0; $i < 6; $i++) {
printf " \n", $i, $names[$i];
printf " \n",
$i, $sid, $masks[$i];
}
for ($i = 0; $i < 8; $i++) {
printf " \n", $i, $states[$i];
printf " \n", $i, $actions[$i];
}
printf " \n\n";
}
print <
EOF
my @pci0=(1, 2, 0);
my @pci1=(4, 3, 8, 7, 2, 1);
for ($bay = 0; $bay < $num_bays; $bay++) {
$sid = 90 + $bay;
$target = (($bay/12) + (($bay & 1) << 2));
$index = (($bay >> 2) % 3);
$p0 = $pci0[$index];
$index = (($bay >> 1) % 6);
$p1 = $pci1[$index];
$hpath = sprintf("/pci\@%x,0/pci1022,7458\@%x/pci11ab,11ab\@1",
$p0, $p1);
$tpath = sprintf("/disk\@%x,0", $target);
$apoint = sprintf(":%d", $target);
print <
EOF
calc_sfx_prop("sfx4500", $bay, $sid);
print <
EOF
}
print <
EOF