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