module          max_number_in_system
------          --------------------
sec              16

    system_attribute    values
    ----------------    ------
    condition           offline, initialising, online
    initialised         yes, no

    user_attribute      values
    --------------      ------
    location            NULL, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, \
			s11, s12, s13, s14, s15
    type                0030
    revision            A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, \
			Q, R, S, T, U, V, W, X, Y, Z, ZZ
    req_condition       offline, online
    scsichgme		off, on
    netchgme		off, on
    fault_acknowledged  no, yes
    description         "scsi and ethernet controller"
    alias		string

    state               function
    -----               --------
    not_here            if (location == NULL)
    uninitialised       if (initialised == no)
    offline             if (condition == offline && req_condition == offline)
    online              if (condition == online && req_condition == online)
    should_be_off       if (condition == online && req_condition == offline)
    should_be_off_inz   if (condition == initialising && req_condition == offline)
    should_be_on        if (condition == offline && req_condition == online)
    should_be_on_inz    if (condition == initialising && req_condition == online)

    transition      response
    ----------      --------
    offline -> should_be_on \
	sleep 3 ;\
	if /etc/cms/bin/right_module $name $location $type$revision ; \
	then \
	    echo "$name $number initialised no" > /dev/FTlog:cms ; \
	    /etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	    /etc/cms/bin/slotctl $location set chgme on ; \
	    /etc/cms/bin/poweron $location ; \
	    sleep 7 ; \
	    /etc/cms/bin/scsictl make $name$number: controller \
	      loc $location ; \
	    /etc/cms/bin/scsictl send $name$number try_online \
	      >/dev/null 2>&1 ; \
	    if [ "`/etc/cms/bin/scsictl send $name$number downloaded`" \
	      = '0' ] ; \
	    then \
		/etc/cms/bin/scsi_download $location ; \
	    fi ; \
            if [ "`/etc/cms/bin/ftctl -d /dev/FTbus:ctl read io_dma`" \
              = "on" ] ; \
            then \
                if [ "`/etc/cms/bin/ftctl -d /dev/FTslot:$location test dma64`" \
                  = "passed" ] ; \
                then \
                    /etc/cms/bin/ftctl -d /dev/FTslot:$location set dma64 on ; \
                fi ; \
            fi ; \
	    /etc/cms/bin/scsictl send $name$number online ; \
	    echo "$name $number initialised yes" > /dev/FTlog:cms ;\
	else \
	    echo "$name $number condition offline <R1000d>module of required type/revision not present" >/dev/FTlog:cms ; \
	    /etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	    /etc/cms/bin/slotctl $location set chgme on ; \
	fi

    uninitialised -> online \
	/etc/cms/bin/sysconfig -m $name -n $number \
	  -a fault_acknowledged -v no ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
	      = off ] ; \
	then \
	    /etc/cms/bin/slotctl $location set chgme off ; \
	fi ;

    should_be_on -> online \
	/etc/cms/bin/sysconfig -m $name -n $number \
	  -a fault_acknowledged -v no ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
	      = off ] ; \
	then \
	    /etc/cms/bin/slotctl $location set chgme off ; \
	fi ;

    online -> should_be_off \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	/etc/cms/bin/slotctl $location set chgme on ; \
	/etc/cms/bin/scsictl send $name$number offline ;

    online -> should_be_on \
	/etc/cms/bin/slotctl $location set power off ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	/etc/cms/bin/slotctl $location set chgme on ; \
	/etc/cms/bin/moduleinfo -e failure -l $location ; \
	/etc/cms/bin/phonehome $name $number $location $laststate $state ;

    uninitialised -> should_be_on \
	/etc/cms/bin/slotctl $location set power off ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	/etc/cms/bin/slotctl $location set chgme on ; \
	/etc/cms/bin/moduleinfo -e failure -l $location ; \
	/etc/cms/bin/phonehome $name $number $location $laststate $state ;

    should_be_on -> offline \
	if [ "`/etc/cms/bin/scsictl send $name$number condition`" != online ] ; \
	then \
	    /etc/cms/bin/slotctl $location set power off ; \
	    /etc/cms/bin/scsictl del $name$number ; \
	    /etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	    if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
		  = off ] ; \
	    then \
		/etc/cms/bin/slotctl $location set chgme off ; \
	    fi ; \
	fi

    should_be_off -> offline \
	/etc/cms/bin/slotctl $location set power off ; \
	/etc/cms/bin/scsictl del $name$number ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
	      = off ] ; \
	then \
	    /etc/cms/bin/slotctl $location set chgme off ; \
	fi ;

    should_be_off_inz -> offline \
	/etc/cms/bin/slotctl $location set power off ; \
	/etc/cms/bin/scsictl del $name$number ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
	      = off ] ; \
	then \
	    /etc/cms/bin/slotctl $location set chgme off ; \
	fi ;

    should_be_off -> online \
	/etc/cms/bin/sysconfig -m $name -n $number \
	  -a fault_acknowledged -v no ; \
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v off ; \
	if [ "`/etc/cms/bin/sysconfig -m $name -n $number -a netchgme -q`" \
	      = off ] ; \
	then \
	    /etc/cms/bin/slotctl $location set chgme off ; \
	fi ;

