1#!/bin/ksh 2# 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright (c) 2018, Joyent, Inc. 15# 16 17# 18# Generate the topology map for an expanderless system with 24 bays. HBAs are 19# in slots 2, 4, and 6. Additionally, there are two rear-facing SATA drive 20# bays, connected to the SATA headers on the motherboard. 21# 22 23function do_sas_node 24{ 25 cat <<EOF 26 <node instance='${1}'> 27 <facility name='fail' type='indicator' provider='fac_prov_mptsas' > 28 <propgroup name='facility' version='1' name-stability='Private' 29 data-stability='Private' > 30 <propval name='type' type='uint32' value='0' /> 31 <propmethod name='mptsas_led_mode' version='0' propname='mode' 32 proptype='uint32' mutable='1'> 33 </propmethod> 34 </propgroup> 35 </facility> 36 <facility name='ident' type='indicator' provider='fac_prov_mptsas' > 37 <propgroup name='facility' version='1' name-stability='Private' 38 data-stability='Private' > 39 <propval name='type' type='uint32' value='1' /> 40 <propmethod name='mptsas_led_mode' version='0' propname='mode' 41 proptype='uint32' mutable='1'> 42 </propmethod> 43 </propgroup> 44 </facility> 45 <facility name='ok2rm' type='indicator' provider='fac_prov_mptsas' > 46 <propgroup name='facility' version='1' name-stability='Private' 47 data-stability='Private' > 48 <propval name='type' type='uint32' value='2' /> 49 <propmethod name='mptsas_led_mode' version='0' propname='mode' 50 proptype='uint32' mutable='1'> 51 </propmethod> 52 </propgroup> 53 </facility> 54 <propgroup name='protocol' version='1' name-stability='Private' 55 data-stability='Private'> 56 <propval name='label' type='string' value='${2}' /> 57 </propgroup> 58 <propgroup name='binding' version='1' name-stability='Private' 59 data-stability='Private'> 60 <propval name='driver' type='string' value='mpt_sas' /> 61 <propval name='devctl' type='string' value='${3}' /> 62 <propval name='enclosure' type='uint32' value='${4}' /> 63 <propval name='slot' type='uint32' value='${5}' /> 64 </propgroup> 65 </node> 66EOF 67} 68 69function do_sata_node 70{ 71 bay=$1 72 bay_inst=$2 73 # 74 # There are six SATA headers on the motherboard, which represent 75 # targets 0-5. The two rear-facing SATA bays are connected to the two 76 # headers associated with targets 4 and 5. 77 # 78 (( target = bay + 4 )) 79 hpath="/pci@0,0/pci15d9,981@11,5" 80 tpath="/disk@${target},0" 81 cat <<EOF 82 <node instance='$bay_inst'> 83 <propgroup name='protocol' version='1' name-stability='Private' 84 data-stability='Private'> 85 <propval name='label' type='string' value='Rear Disk $bay' /> 86 </propgroup> 87 <propgroup name='io' version='1' name-stability='Private' 88 data-stability='Private'> 89 <propval name='ap-path' type='string' value='/devices${hpath}:$target' /> 90 </propgroup> 91 <propgroup name='binding' version='1' name-stability='Private' 92 data-stability='Private'> 93 <propval name='occupant-path' type='string' 94 value='$hpath$tpath' /> 95 </propgroup> 96 </node> 97EOF 98} 99 100 101cat <<EOF 102<topology name='disk' scheme='hc'> 103 <range name='bay' min='0' max='25'> 104EOF 105 106enclosure=1 107bay=0 108slot=0 109devctl0='/devices/pci@7d,0/pci8086,2030@0/pci15d9,808@0:devctl' 110while (( slot <= 7 )); do 111 do_sas_node $bay "Front Disk $bay" "$devctl0" $enclosure $slot 112 (( bay = bay + 1 )) 113 (( slot = slot + 1 )) 114done 115 116slot=0 117devctl0='/devices/pci@cd,0/pci8086,2030@0/pci15d9,808@0:devctl' 118while (( slot <= 7 )); do 119 do_sas_node $bay "Front Disk $bay" "$devctl0" $enclosure $slot 120 (( bay = bay + 1 )) 121 (( slot = slot + 1 )) 122done 123 124slot=0 125devctl0='/devices/pci@56,0/pci8086,2030@0/pci15d9,808@0:devctl' 126while (( slot <= 7 )); do 127 do_sas_node $bay "Front Disk $bay" "$devctl0" $enclosure $slot 128 (( bay = bay + 1 )) 129 (( slot = slot + 1 )) 130done 131 132do_sata_node 0 24 133do_sata_node 1 25 134 135cat <<EOF 136 <dependents grouping='children'> 137 <range name='disk' min='0' max='0'> 138 <enum-method name='disk' version='1' /> 139 </range> 140 </dependents> 141 </range> 142</topology> 143EOF 144