1#!/usr/bin/perl -w
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 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27$num_bays = 4;
28$bay_label = "HD";
29
30print <<EOF;
31<topology name='disk' scheme='hc'>
32  <range name='bay' min='0' max='3'>
33EOF
34
35$controller = 0;
36for ($bay = 0; $bay < $num_bays; $bay++) {
37	$hpath = "/pci\@0,0/pci1022,7458\@11/pci1000,3060\@4";
38	$tpath = sprintf("/sd\@%x,0", $bay);
39	$apoint = sprintf(":scsi::dsk/c%dt%dd0",
40	    $controller + 1, $bay);
41
42	print <<EOF;
43    <node instance='$bay'>
44      <propgroup name='protocol' version='1' name-stability='Private'
45        data-stability='Private'>
46	<propval name='label' type='string' value='$bay_label$bay' />
47      </propgroup>
48      <propgroup name='io' version='1' name-stability='Private'
49        data-stability='Private'>
50	<propval name='ap-path' type='string' value='/devices$hpath$apoint' />
51      </propgroup>
52      <propgroup name='binding' version='1' name-stability='Private'
53        data-stability='Private'>
54	<propval name='occupant-path' type='string'
55	  value='$hpath$tpath' />
56      </propgroup>
57    </node>
58EOF
59}
60
61print <<EOF;
62    <dependents grouping='children'>
63      <range name='disk' min='0' max='0'>
64	<enum-method name='disk' version='1' />
65      </range>
66    </dependents>
67  </range>
68</topology>
69EOF
70