1*d91236feSeschrock#!/usr/local/bin/perl
2*d91236feSeschrock#
3*d91236feSeschrock# CDDL HEADER START
4*d91236feSeschrock#
5*d91236feSeschrock# The contents of this file are subject to the terms of the
6*d91236feSeschrock# Common Development and Distribution License (the "License").
7*d91236feSeschrock# You may not use this file except in compliance with the License.
8*d91236feSeschrock#
9*d91236feSeschrock# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*d91236feSeschrock# or http://www.opensolaris.org/os/licensing.
11*d91236feSeschrock# See the License for the specific language governing permissions
12*d91236feSeschrock# and limitations under the License.
13*d91236feSeschrock#
14*d91236feSeschrock# When distributing Covered Code, include this CDDL HEADER in each
15*d91236feSeschrock# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*d91236feSeschrock# If applicable, add the following below this CDDL HEADER, with the
17*d91236feSeschrock# fields enclosed by brackets "[]" replaced with your own identifying
18*d91236feSeschrock# information: Portions Copyright [yyyy] [name of copyright owner]
19*d91236feSeschrock#
20*d91236feSeschrock# CDDL HEADER END
21*d91236feSeschrock#
22*d91236feSeschrock#
23*d91236feSeschrock# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*d91236feSeschrock# Use is subject to license terms.
25*d91236feSeschrock#
26*d91236feSeschrock
27*d91236feSeschrock$num_bays = 4;
28*d91236feSeschrock$bay_label = "HD";
29*d91236feSeschrock
30*d91236feSeschrockprint <<EOF;
31*d91236feSeschrock<topology name='disk' scheme='hc'>
32*d91236feSeschrock  <range name='bay' min='0' max='3'>
33*d91236feSeschrockEOF
34*d91236feSeschrock
35*d91236feSeschrock$controller = 0;
36*d91236feSeschrockfor ($bay = 0; $bay < $num_bays; $bay++) {
37*d91236feSeschrock	$hpath = "/pci\@0,0/pci1022,7450\@2/pci1000,3060\@3";
38*d91236feSeschrock	$tpath = sprintf("/sd\@%x,0", $bay);
39*d91236feSeschrock	$apoint = sprintf(":scsi::dsk/c%dt%dd0",
40*d91236feSeschrock	    $controller + 1, $bay);
41*d91236feSeschrock
42*d91236feSeschrock	print <<EOF;
43*d91236feSeschrock    <node instance='$bay'>
44*d91236feSeschrock      <propgroup name='protocol' version='1' name-stability='Private'
45*d91236feSeschrock        data-stability='Private'>
46*d91236feSeschrock	<propval name='label' type='string' value='$bay_label$bay' />
47*d91236feSeschrock      </propgroup>
48*d91236feSeschrock      <propgroup name='io' version='1' name-stability='Private'
49*d91236feSeschrock        data-stability='Private'>
50*d91236feSeschrock	<propval name='ap-path' type='string' value='/devices$hpath$apoint' />
51*d91236feSeschrock      </propgroup>
52*d91236feSeschrock      <propgroup name='binding' version='1' name-stability='Private'
53*d91236feSeschrock        data-stability='Private'>
54*d91236feSeschrock	<propval name='occupant-path' type='string'
55*d91236feSeschrock	  value='$hpath$tpath' />
56*d91236feSeschrock      </propgroup>
57*d91236feSeschrock    </node>
58*d91236feSeschrockEOF
59*d91236feSeschrock}
60*d91236feSeschrock
61*d91236feSeschrockprint <<EOF;
62*d91236feSeschrock    <dependents grouping='children'>
63*d91236feSeschrock      <range name='disk' min='0' max='0'>
64*d91236feSeschrock	<enum-method name='disk' version='1' />
65*d91236feSeschrock      </range>
66*d91236feSeschrock    </dependents>
67*d91236feSeschrock  </range>
68*d91236feSeschrock</topology>
69*d91236feSeschrockEOF
70