module          max_number_in_system
------          --------------------
ioset               8

    system_attribute    values
    ----------------    ------
    condition           offline, initialising, online, broken
    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                0031, 0032, 0033, 0245, 0317
    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         "disk and ethernet module"
    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 || condition == broken) && 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)
    broken		if (condition == broken && req_condition == online)


    transition      response
    ----------      --------
    offline -> should_be_on \
        echo "$name $number initialised no" > /dev/FTlog:cms ; \
	sleep 3 ;\
	/etc/cms/bin/sysconfig -m $name -n $number -a scsichgme -v on ; \
	/etc/cms/bin/slotctl $location set chgme on ; \
	if /etc/cms/bin/right_module $name $location $type$revision ; \
	then \
	    /etc/cms/bin/poweron $location ; \
	    sleep 7 ; \
	    /etc/cms/bin/scsictl make $name$number: $name 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 ; \
	else \
	    echo "$name $number condition offline <R1000d>module of required type/revision not present" >/dev/FTlog:cms ; \
	fi ; \
	echo "$name $number initialised yes" > /dev/FTlog:cms ;

    uninitialised -> online \
	/etc/cms/bin/sysconfig -m $name -n $number \
	  -a fault_acknowledged -v no ;

    should_be_on -> online \
	/etc/cms/bin/sysconfig -m $name -n $number \
	  -a fault_acknowledged -v no ;

    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

 
    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 ;

    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 ;

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

    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 ;
	
    broken -> online \
	/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 ;

    broken -> should_be_off \
        /etc/cms/bin/scsictl send $name$number offline
 
