xref: /illumos-gate/usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4540/Sun-Fire-X4540-disk-hc-topology.xmlgen (revision eb6b10e69fa5ba733da194d3ad71a0e63338be29)
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 = 48;
28$bay_label = "HD_ID_";
29
30sub calc_sfx_prop
31{
32	my $name = shift;
33	my $bay = shift;
34	my $sid = shift;
35	my @names = (
36	    "+PRSNT",			"-PRSNT",
37	    "+OK2RM",			"-OK2RM",
38	    "+FAULT",			"-FAULT");
39	my @masks = (
40	    "amask=0x0001",		"dmask=0x0001",
41	    "amask=0x0008",		"dmask=0x0008",
42	    "amask=0x0002",		"dmask=0x0002");
43	my @states = (
44	    "absent>present",		"present>configured",
45	    "configured>unconfigured",	"unconfigured>configured",
46	    "unconfigured>absent",	"configured>absent",
47	    "present>absent",		"absent>configured");
48	my @actions = (
49	    "+PRSNT&+OK2RM",	"+PRSNT&-OK2RM",
50	    "+OK2RM",			"-OK2RM",
51	    "-OK2RM&-PRSNT",	"-OK2RM&-PRSNT",
52	    "-OK2RM&-PRSNT",	"-OK2RM&+PRSNT");
53
54	printf "\n";
55	printf "      <propgroup name='%s-properties' version='1' " .
56		"name-stability='Private' data-stability='Private' >\n", $name;
57	printf "        <propval name='fru-update-action' type='string' " .
58		"value='ipmi:fru gid=3 hdd=%d' />\n", $bay;
59
60	for ($i = 0; $i < 6; $i++) {
61		printf "        <propval name='indicator-name-%d' " .
62			"type='string' value='%s' />\n", $i, $names[$i];
63		printf "        <propval name='indicator-action-%d' " .
64			"type='string' value='ipmi:state sid=%d %s' />\n",
65			$i, $sid, $masks[$i];
66	}
67
68	for ($i = 0; $i < 8; $i++) {
69		printf "        <propval name='indicator-rule-states-%d' " .
70			"type='string' value='%s' />\n", $i, $states[$i];
71		printf "        <propval name='indicator-rule-actions-%d' " .
72			"type='string' value='%s' />\n", $i, $actions[$i];
73	}
74	printf "      </propgroup>\n\n";
75}
76
77print <<EOF;
78<topology name='disk' scheme='hc'>
79  <range name='bay' min='0' max='47'>
80    <facility name='locate' type='indicator' provider='fac_prov_ipmi' >
81      <propgroup name='facility' version='1' name-stability='Private'
82	data-stability='Private' >
83	<propval name='type' type='uint32' value='1' />
84	<propmethod name='ipmi_entity' version='0' propname='entity_ref'
85	  proptype='string_array' >
86	  <argval name='format' type='string_array'>
87	      <argitem value='DBP/HDD\%d/OK2RM' />
88	      <argitem value='hdd\%d.ok2rm.led' />
89	  </argval>
90	  <argval name='offset' type='uint32' value='0' />
91	  <argval name='nparams' type='uint32' value='1' />
92	</propmethod>
93	<propmethod name='bay_locate_mode' version='0'
94	  propname='mode' proptype='uint32' mutable='1'>
95	</propmethod>
96      </propgroup>
97    </facility>
98    <facility name='ok2rm' type='indicator' provider='fac_prov_ipmi' >
99      <propgroup name='facility' version='1' name-stability='Private'
100	data-stability='Private' >
101	<propval name='type' type='uint32' value='2' />
102	<propmethod name='ipmi_entity' version='0' propname='entity_ref'
103	  proptype='string_array' >
104	  <argval name='format' type='string_array'>
105	      <argitem value='DBP/HDD\%d/STATE' />
106	      <argitem value='hdd\%d.state' />
107	      <argitem value='DBP/HDD\%d/OK2RM' />
108	      <argitem value='hdd\%d.ok2rm.led' />
109	  </argval>
110	  <argval name='offset' type='uint32' value='0' />
111	  <argval name='nparams' type='uint32' value='1' />
112	</propmethod>
113	<propmethod name='bay_indicator_mode' version='0'
114	  propname='mode' proptype='uint32' mutable='1'>
115	</propmethod>
116      </propgroup>
117    </facility>
118    <facility name='service' type='indicator' provider='fac_prov_ipmi' >
119      <propgroup name='facility' version='1' name-stability='Private'
120	data-stability='Private' >
121	<propval name='type' type='uint32' value='0' />
122	<propmethod name='ipmi_entity' version='0' propname='entity_ref'
123	  proptype='string_array' >
124	  <argval name='format' type='string_array'>
125	      <argitem value='DBP/HDD\%d/STATE' />
126	      <argitem value='hdd\%d.state' />
127	      <argitem value='DBP/HDD\%d/SVC' />
128	      <argitem value='hdd\%d.fail.led' />
129	  </argval>
130	  <argval name='offset' type='uint32' value='0' />
131	  <argval name='nparams' type='uint32' value='1' />
132	</propmethod>
133	<propmethod name='bay_indicator_mode' version='0' propname='mode'
134	  proptype='uint32' mutable='1'>
135	</propmethod>
136      </propgroup>
137    </facility>
138EOF
139
140my @pci0=(0, 0, 0, 0x3c, 0x3c, 0x3c);
141my @pci1=(0x377, 0x375, 0x376, 0x377, 0x375, 0x376);
142my @pci2=(0xa, 0xb, 0xf, 0xa, 0xb, 0xf);
143
144for ($bay = 0; $bay < $num_bays; $bay++) {
145	$sid = 90 + $bay;
146	$target = $bay % 8;
147	$controller = $bay / 8;
148
149	# set hba path, target path, bay path, and attachment point
150	$hpath = sprintf("/pci\@%x,0/pci10de,%x\@%x/pci1000,1000\@0",
151	    $pci0[$controller], $pci1[$controller], $pci2[$controller]);
152	$tpath = sprintf("/sd\@%x,0", $target);
153	$apoint = sprintf(":scsi::dsk/c%dt%dd0",
154	    $controller + 1, $target);
155
156	print <<EOF;
157    <node instance='$bay'>
158      <propgroup name='protocol' version='1' name-stability='Private'
159        data-stability='Private'>
160	<propval name='label' type='string' value='$bay_label$bay' />
161      </propgroup>
162      <propgroup name='io' version='1' name-stability='Private'
163        data-stability='Private'>
164	<propval name='ap-path' type='string' value='/devices$hpath$apoint' />
165      </propgroup>
166EOF
167
168	calc_sfx_prop("sfx4500", $bay, $sid);
169
170	print <<EOF;
171      <propgroup name='binding' version='1' name-stability='Private'
172        data-stability='Private'>
173	<propval name='occupant-path' type='string'
174	  value='$hpath$tpath' />
175      </propgroup>
176    </node>
177EOF
178}
179
180print <<EOF;
181    <dependents grouping='children'>
182      <range name='disk' min='0' max='0'>
183	<enum-method name='disk' version='1' />
184      </range>
185    </dependents>
186  </range>
187</topology>
188EOF
189