# This is a script for diagnostics for Indy, in the asrs
report=4
hinv -v

cpusc {


        echo "----------------------------------------------------\n"
        if(tlb){
                $failed=1;
                wait;
        }

        echo "----------------------------------------------------\n"
        if(utlb){
                $failed=1;
                wait;
        }

        echo "----------------------------------------------------\n"
        if(dcache1){
                echo "Failure detected in dcache1 test\n"
                $failed=1;
                wait;
        }

        echo "----------------------------------------------------\n"
        $tmp=icache1
        if($tmp) {
                echo "Failure detected in icache1 test\n"
                $failed=1;
                wait;
        }

        echo "----------------------------------------------------\n"
        $tmp=icache2
        if($tmp) {
                echo "Failure detected in icache2 test\n"
                $failed=1;
                wait;
        }
        
	echo "----------------------------------------------------\n"
        $tmp=scache1
        if($tmp) {
                echo "Failure detected in scache1 test\n"
                $failed=1;
                wait;
        }
        
	echo "----------------------------------------------------\n"	
	$tmp=scache2
        if($tmp) {
                echo "Failure detected in scache2 test\n"
                $failed=1;
                wait;
        }

        echo "----------------------------------------------------\n"
        if(fpu) {
                $failed=1;
                wait;
        }
       
	echo "----------------------------------------------------\n"
        if ($failed) {
                echo "CPU CARD TEST FAILED";
		boot -n -f bootp()cpu.fail;
                wait;
                $cpufailed=1;
                }
                else
                {
                        echo "CPU CARD TEST PASSED";
			boot -n -f bootp()cpu.pass;
                }
        fi

}


memory {


	echo "----------------------------------------------------\n"
	$tmp=memtest2
	if($tmp) {
		echo "Failure detected in memtest test\n"
		boot -n -f bootp()memtest.fail;
		$failed=1;
		wait;
		}	
		else
		{
			boot -n -f bootp()memtest.pass;
		}
	fi
	echo "----------------------------------------------------\n"
	$tmp=ldram -p
	if($tmp) {
		echo "Failure detected in ldram with parity test\n"
		boot -n -f bootp()ldram_parity.fail;
		$failed=1;
		wait;
		}	
		else
		{
			boot -n -f bootp()ldram_parity.pass;
		}
	fi
	echo "----------------------------------------------------\n"
	$tmp=dram
	if($tmp) {
		echo "Failure detected in dram test\n"
		boot -n -f bootp()dram.fail;
		$failed=1;
		wait;
		}
		else
		{
			boot -n -f bootp()dram.pass;
		}
	fi
	echo "----------------------------------------------------\n"
	$tmp=dram -p
	if($tmp) {
		echo "Failure detected in dram with parity test\n"
		boot -n -f bootp()dram_parity.fail;
		$failed=1;
		wait;
		}
		else
		{
			boot -n -f bootp()dram_parity.pass;
		}
	fi
	echo "----------------------------------------------------\n"
	if(pargenlog) {
		$failed=1;
		boot -n -f bootp()pargen.fail;
		wait;
		}
		else
		{
			boot -n -f bootp()pargen.pass;
		}
	fi
	echo "----------------------------------------------------\n"
	if(blk) {
		$failed=1;
		boot -n -f bootp()blk.fail;
		wait;
		}
		else
		{
			boot -n -f bootp()blk.pass;
		}
	fi
	echo "----------------------------------------------------\n"

        $tmp=khlow
        if($tmp) {
                echo "Failure detected in Knaizuk Hartmann Low Test\n"
                $failed=1;
                boot -n -f bootp()khlow.fail;
		wait;
        	}
		else
		{
			boot -n -f bootp()khlow.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 3
        if($tmp) {
                echo "Failure detected in Knaizuk Hartmann Test\n"
                $failed=1;
                boot -n -f bootp()kh.fail;
		wait;
        	}
		else
		{
			boot -n -f bootp()kh.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 5
        if($tmp) {
                echo "Failure detected in Knaizuk Hartmann Parity  Test\n"
                $failed=1;
                boot -n -f bootp()khpar.fail;
		wait;
		}
		else
		{
			boot -n -f bootp()khpar.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 10
        if($tmp) {
                echo "Failure detected in Threebit Memory Test\n"
                $failed=1;
                boot -n -f bootp()threebit.fail;
		wait;
		}
		else
		{
			boot -n -f bootp()threebit.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 12
        if($tmp) {
                echo "Failure detected in Knaizuk Hartmann Doubleword Test\n"
                $failed=1;
                boot -n -f bootp()doubleword.fail;
		wait;
        	}
		else
		{
			boot -n -f bootp()doubleword.pass;
		}
	fi

	echo "----------------------------------------------------\n"
        $tmp=memtest2 11
        if($tmp) {
                echo "Failure detected in Butterfly Test\n"
                $failed=1;
		boot -n -f bootp()butterfly.fail;
                wait;
		}
		else
		{
			boot -n -f bootp()butterfly.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 8
        if($tmp) {
                echo "Failure detected in March X Test\n"
                $failed=1;
                boot -n -f bootp()marchx.fail
		wait;
        	}
		else
		{
			boot -n -f bootp()marchx.pass;
		}
	fi
	echo "----------------------------------------------------\n"
        $tmp=memtest2 9
        if($tmp) {
                echo "Failure detected in March Y Test\n"
                $failed=1;
                boot -n -f bootp()marchy.fail;
		wait;
		}
		else
		{
			boot -n -f bootp()marchy.pass;
		}
	fi
#	if(dram2) {
#		$failed=1;
#		wait;
#	}
	
#	echo "----------------------------------------------------\n"
#	if(shift) {
#		$failed=1;
#		wait;
#	}

	if ($failed) 
		{ 
		boot -n -f bootp()mem.fail
		}
		else  
		{
		boot -n -f bootp()mem.pass
		}
	fi

}


unix {
	echo "<<<< About to to boot UNIX......>>>>"
	boot -n -f bootp()start_unix
	boot dksc(0,1,0)unix;
#	boot -f dksc(0,1,8)sash dksc(0,1,0)unix;
     }

# Initialize variables used by ng1.
$err=0
$ng1failed=0
$ng1_rex3_failed=0
$ng1_bt445_failed=0
$ng1_cmap_failed=0
$ng1_xmap9_failed=0
$ng1_vc2_failed=0
$ng1_vram_failed=0
$ng1_cid_failed=0
$ng1_dma_failed=0
$ng1_dma_result=-1

# Start of NG1 diagnostics

ng1 {
        $ng1failed=0;
        $err=0;
        buffon

        ng1_probe;
        ng1_setboard 0;
# Test Rex3
        if(ng1_rexregs) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_rex3_failed = 1;
                $err=1;
        }
# Test bt445
        if(ng1_bt445test) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_bt445_failed =1;
                $err=1;
        }
# Test cmap
        if(ng1_cmaptest) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_cmap_failed = 1;
                $err=1;
        }
# Test Xmap9
        if(ng1_xmap9test) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_xmap9_failed = 1;
                $err=1;
        }
# Test VC2
        if(ng1_vc2test) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }

                $ng1_vc2_failed = 1;
                $err=1;
        }
# Test VRAM
        if(ng1_vram) {
                 if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_vram_failed = 1;
                $err=1;
        }
# Test CID
        if(ng1_cid) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_cid_failed = 1;
                $err=1;
        }
# Change Bus width to 64 & run DMA tests
        ng1_setvisual 0;
        ng1_color 0;
        ng1_block 0 0 105 105;
        ng1_buswidth 64;
        ng1_rwpacked 1;
        ng1_rwdouble 1;
        $ng1_dma_result=ng1_dmatest 0 0 100 100;
        if($ng1_dma_result == -1) {
                if (!$report) {
                        emfail 2;
                        wait;
                        exit;
                }
                $ng1_dma_failed = 1;
                $err=1;
        }
        ng1_buswidth 32;
        resetcons
        buffoff
        echo "************************* RESULTS ******************************"

        if($ng1_rex3_failed) {
                echo "Rex3 Register r/w tests failed.";
                $ng1failed = 1;
        }
        if($ng1_cmap_failed) {
                echo "Cmap r/w tests failed.";
                $ng1failed = 1;
        }
        if($ng1_xmap9_failed) {
                echo "Xmap9 r/w tests failed.";
                $ng1failed = 1;
        }
        if($ng1_vc2_failed) {
                echo "VC2 r/w tests failed.";
                $ng1failed = 1;
        }
        if($ng1_vram_failed) {
                echo "VRAM test failed.";
                $ng1failed = 1;
        }
        if($ng1_cid_failed) {
                echo "CID test failed.";
                $ng1failed = 1;
        }
        if($ng1_dma_failed) {
                echo "DMA tests failed.";
                $ng1failed = 1;
        }

        if (!$err) echo "REX3, CMAP, XMAP9, VC2, VRAM, CID & DMA Test Passed.\n"
        if ($ng1failed) {
		echo "ERROR: Failure detected on NG1 board."
		boot -n -f bootp()ng1.fail
	}
        else 
	{
		echo "NG1 graphics board tests passed"
		boot -n -f bootp()ng1.pass
	}
        fi
        echo " *****************END OF THE TEST *****************"
}

# END OF NG1 SUPPORT
# Start of GR2 diagnostics 
# Initialize variables used by GR2.
$stride_failed=0 ;
$zb_failed=0 ;
$gr2_failed=0;
$chkbt457_failed=0;
$bp_failed=0;
$shramre3_failed=0;
$cpushram_failed=0;
$cpure3_failed=0;
$ctxsw_failed=0;
$vdma_failed=0;
$quad_failed=0;
$fourquad_failed=0;
$mon=0;

$test_xmap_failed = 0;
$test_xmap_clut_failed = 0;

gr2_vhwinit {
	gr2_videoclk 0x47
	if ($mon ==1 ) gr2_initclock 0x132;
	else gr2_initclock 0x107;
	fi
	gr2_wrconfig 0x0
	gr2_delay 3
	gr2_wrconfig 0x1
	gr2_vinitdac
}

gr2_initre {
	$a = gr2_getGR2ver;
	if ($a < 4) gr2_wrfifo 0 0;
	else if ($a == 4) gr2_wrfifo 0 1;
	else gr2_wrfifo 0 2;
}

gr2_initsys {
	gr2_reset
	gr2_vhwinit
	$mon = gr2_getMonType;
	if ($mon == 1) gr2_initvc1 4;
	else gr2_initvc1 20;
	fi
	gr2_xcol
	gr2_inithq
	gr2_load_ucode ge
	gr2_load_ucode hq
	gr2_unstall
	gr2_initre
}

clear {
	gr2_wrfifo 35 0
	gr2_wrfifo 6 0
}
gr2_quad {
	gr2_wrfifo 33 0
}

gr2_fourquad {
	gr2_wrfifo 34 0
}

test_xmap {
	gr2_initsys;
	$a=gr2_txmap;
	return $a;
}

test_xmap_clut {
	gr2_initsys;
	$a=gr2_txmap_clut;
	return $a;
}

gr2_vdma {
	gr2_initsys;
	$b=gr2_cachefdma 32 1;
	$b=$b+gr2_cachefdma 256 1;
	$b=$b+gr2_cachefdma 512 1;
	$b=$b+gr2_cachefdma 128 1;
	$b=$b+gr2_yzoomdma ;
	$b=$b+gr2_yzoomdma 32 32;
	$b=$b+gr2_yzoomdma 128 128;
	$b=$b+gr2_yzoomdma 256 256;
	$b=$b+gr2_stridedma;
	$b=$b+gr2_stridedma 32 32;
	$b=$b+gr2_stridedma 256 1;
	$b=$b+gr2_stridedma 512 0;

	return $b;
}

gr2 {

	# Too verbose with report=4
	report=3;

	$stride_failed=0 ;
	$zb_failed=0 ;
	$gr2_failed=0;
	$chkbt457_failed=0;
	$bp_failed=0;
	$shramre3_failed=0;
	$cpushram_failed=0;
	$cpure3_failed=0;
	$ctxsw_failed=0;
	$vdma_failed=0;
	$quad_failed=0;
	$fourquad_failed=0;

	$test_xmap_failed = 0;
	$test_xmap_clut_failed = 0;

	gr2_reset;
	buffon


# HQ2 internal register 19  must read 0xdeadbeef
	report = 2;
	gr2_rdhqint 19;
	report = 1;

# Test VC1 SRAM 
	gr2_vhwinit
	report =4 
	if (gr2_vc1_sram) {
		echo "VC1 SRAM test failded";
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test ram 0 at Ge7 at 0
	$tmp = gr2_tram 0;
	if ($tmp) {
		echo "GE7 at 0 RAM0 test failed"
		resetcons;
		buffoff;
		$err = 1;
        	wait;
	}
# Test ram 0 at Ge7 at 1
	$tmp = gr2_tram 1;
	if ($tmp) {
		echo "GE7 at 1 RAM0 test failed"
		resetcons;
		buffoff;
		$err = 1;
        	wait;
	}
# Test ram 0 at Ge7 at 2
       $tmp = gr2_tram 2;
       if ($tmp) {
		echo "GE7 at 2 RAM0 test failed"
		resetcons;
		buffoff;
		$err = 1;
        	wait;
	}
# Test ram 0 at Ge7 at 3
	$tmp = gr2_tram 3 ;
	if ($tmp) {
		echo "GE7 at 3 RAM0 test failed"
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test ram 0 at Ge7 at 4
	$tmp = gr2_tram 4 ;
	if ($tmp) {
		echo "GE7 at 4 RAM0 test failed"
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test ram 0 at Ge7 at 5
	$tmp = gr2_tram 5 ;
	if ($tmp) {
		echo "GE7 at 5 RAM0 test failed"
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test ram 0 at Ge7 at 6
	$tmp = gr2_tram 6 ;
	if ($tmp) {
		echo "GE7 at 6 RAM0 test failed"
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test ram 0 at Ge7 at 7
	$tmp = gr2_tram 7 ;
	if ($tmp) {
		echo "GE7 at 7 RAM0 test failed"
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test shram  
	$tmp = gr2_tram 8 ;
	if ($tmp) {
		echo "Share ram test failed "; 
		resetcons;
		buffoff;
        	wait;
		$err = 1;
	}
# Test Hq2uram
	$tmp = gr2_tram 9 ;
	if ($tmp) {
		echo "HQ2 uram test failed "; 
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
# Test ge7uram
	$tmp = gr2_tram 10;
	if ($tmp) {
		echo "GE7 uram test failed "; 
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
	gr2_initsys;
	clear;

# Test HQ2
	if(gr2_hq2test) {
		echo "HQ2 test failed "; 
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
# Test shareram using Ucode
	if (gr2_shram) {
		echo "Shram test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
# Test internal GE7 ram
	if (gr2_ram12) {
		echo "GE7 internal test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
# Test seedrom 
	if (gr2_seedrom) {
		echo "GE7 seedrom test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
# Test the squaroot rom
	if (gr2_sqrom) {
		echo "GE7 sqrom test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
	gr2_initsys ;

# Test Ge 7 bus
	if (gr2_gebus) {
		echo "GE7 bus test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}

# Test ge floating point unit
	if (gr2_gefloat) {
		echo "GE7 floating point test failed"
		resetcons;
		buffoff;
        	wait;
	    	$err = 1;
	}
	gr2_initsys;
	clear;

	if ( $err ) {
		echo "HQ & GE Tests failed\n";
		resetcons;
		buffoff;
		wait;
		$err=0
		$gr2_failed=1
	}
	else {
		resetcons;
		buffoff;
		echo "HQ & GE Tests passed\n"
	}
	buffon

# Test bt457 
	if (gr2_chkbt457) {
		resetcons;
		buffoff;
        	wait;
	    	$chkbt457_failed = 1;
	    	$err=1;
	}
# Test bitplane VM2
	gr2_initsys
	if (gr2_bp) {
	    $bp_failed = 1;
	    $err=1;
	    resetcons;
	    buffoff;
	    wait;
	}
# Test Shared ram and Re
	gr2_initsys
	$tmp = gr2_shramre3
	if ($tmp) {
		resetcons;
		buffoff;
        	wait;
	    	$shramre3_failed =1;
	    	$err=1;
	}
# Test DMA between host and GE7 shared ram
	gr2_initsys
	clear
	$tmp = gr2_cpushram
	if ($tmp) {
		resetcons;
		buffoff;
        	wait;
	    	$cpushram_failed =1;
	    	$err=1;
	}
# Test DMA between host and and RE3
	resetcons
	buffon
	gr2_initsys
	$tmp = gr2_cpure3
	if ($tmp) {
		resetcons;
		buffoff;
        	wait;
	    	$cpure3_failed =1;
	    	$err=1;
	}
# Test GE7 context switching
	if(gr2_ctxsw) {
		resetcons;
		buffoff;
        	wait;
	    	$ctxsw_failed =1;
	    	$err=1;
	}
	clear;
# Test quad drawing
	$tmp = gr2_quad
	if ($tmp) {
		resetcons;
		buffoff;
        	wait;
	    	$quad_failed =1;
	    	$err=1;
	}
	$tmp = gr2_fourquad
	if ($tmp) {
		resetcons;
		buffoff;
        	wait;
	    	$fourquad_failed = 1;
	    	$err=1;
	}
	clear;

	if ($chkbt457_failed) echo "Bt457 test failed";
	if ($bp_failed)  echo "bitplane test failed";
	if ($shramre3_failed) echo "shramre3 test failed"
	if ($cpushram_failed) echo "CPU shram test failed";
	if ($cpure3_failed) echo "cpure3 test failed ";
	if ($ctxsw_failed) echo "context switching test failed ";
	if ($vdma_failed) echo "vdma controller test failed ";
	if ($quad_failed) echo "quad test failed";
	if ($fourquad_failed) echo "fourquad test failed";

	if ($err)
	{
	    if (!$report) {
		emfail 2;
		wait;
		exit;
	    }	
	    echo "******  PRESS RETURN TO CONTINUE OR ^C TO EXIT ************"
	    $err=0
	    $gr2_failed=1
	    resetcons;
	    buffoff;
	    wait;
	}
	else {
		resetcons;
		buffoff;
		echo "BT457, Bit-Plane, DMA and QUADs Tests Passed.\n"
	}
	buffon

# Test stridedma between shram and re3
	gr2_initsys
	$tmp = gr2_stride
	if ($tmp)  {
	    $stride_failed =1 ;
	    $err=1;
	    resetcons;
	    buffoff;
	    wait;
	}
# Test Zbuffer
	gr2_initsys
	$tmp=gr2_zb
	if($tmp)  {
	    $zb_failed =1;
	    $err=1;
	    resetcons;
	    buffoff;
	    wait;
	}
	resetcons
	buffoff
	echo "************************* RESULTS ********************************"
	if ($stride_failed)  {
	    echo "stride test failed";
	    $gr2_failed = 1;
	    wait;
	}
	if ($zb_failed) { 
	    echo "Zbuffer test failed";
	    $gr2_failed = 1;
	    wait;
	}
	if (!$gr2_failed) echo "Stride DMA, and Z-Buffer Test Passed.\n"
# Test Xmap 
	buffon
	echo "testing XMAP"
	if (test_xmap) {
    	    $test_xmap_failed =1;
	    $err=1;
	    resetcons;
	    buffoff;
	    wait;
	}
# Test Xmap CLUT 
	if (test_xmap_clut) {
	    $test_xmap_clut_failed =1;
	    $err=1;
	    resetcons;
	    buffoff;
	    wait;
	}
	resetcons
	buffoff
	echo "************************* RESULTS ********************************"
	if ($test_xmap_failed) {
	    echo "test_xmap test failed";
	    $gr2_failed = 1;
	}
	if ($test_xmap_clut_failed) {
	    echo "test_xmap_clut test failed";
	    $gr2_failed = 1;
	}
	if (!$err) echo "XMAPs Test Passed.\n"


	if ($gr2_failed) {
		echo "ERROR: Failure detected on graphics board."
		wait;
	}
	else echo "graphics board tests passed"
	fi
	echo " *****************END OF THE TEST *****************"

	# Restore verbosity
	report=4
}

# END OF GR2 SUPPORT


ip {


        echo "----------------------------------------------------\n"
        if (is_symphony)
		{
			$tmp=hpc3 0
		}
		else
		{
			$tmp=hpc3
		}
		fi
	if ($tmp)
		{
                $failed=1;
                wait;
        }

	echo "----------------------------------------------------\n"

	if(int2) {
		$failed=1;
		wait;
	}
#	echo "----------------------------------------------------\n"
#	if(!clock) {
#		$failed=1;
#		wait;
#	}



	# illegal i3 e1 e2
	
# Duart External tests turned off and internal tests turned on  rwaits 9/23/92
# originally -i0, -i1 on -i2 off, -e0 off -e2, -e3 on
	echo "----------------------------------------------------\n"
	$tmp=duart -i0;
	
	if($tmp) {
		#boot -n -f bootp()duart.fail
		$failed=1;
		wait;
	}
	
	$tmp= duart -i1;
	
	if($tmp) {
		#boot -n -f bootp()duart.fail
		$failed=1;
		wait;
	}
	
	
	#boot -n -f bootp()duart.pass
#	echo "----------------------------------------------------\n"
	
#loop back needed, fails otherwise
#        $tmp= duart -e0;
#	if($tmp) {
#		$failed=1;
#		wait;
#		}

#	echo "----------------------------------------------------\n"
#	$tmp= duart -e1;
#	if ($tmp) {
#		$failed=1;
#		wait;
#	}
	echo "----------------------------------------------------\n"

	$tmp = led 0;
	
	if($tmp){
		#boot -n -f bootp()led.fail
		$failed=1;
		wait;
	}
	
	$tmp = led 1;
	if($tmp){
		#boot -n -f bootp()led.fail
		$failed=1;
		wait;
	}
	
	echo "----------------------------------------------------\n"
	
	if(parity){
		#boot -n -f bootp()parity.fail
		$failed=1;
		wait;
	}
	
	echo "----------------------------------------------------\n"
	$status1 = scsi;
	if($status1) {
		#boot -n -f bootp()scsi.fail
		$failed=1;
		wait;
	}
	
#	echo "----------------------------------------------------\n"
#	if(!timer){
#		$failed=1;
#		wait;
#	}
	

	echo "----------------------------------------------------\n"
#	if(print3){
#		$failed=1;
#		wait;
#	}
	if ($failed) { 
			boot -n -f bootp()ip.fail 
			} 
	else 	
		{ 
			boot -n -f bootp()ip.pass 
		}
	fi
	
}	


indy {
	$failed=0;

	cpusc;


	ip;

# Removed per Kerry 6/30/93
#	echo "Running ISDN test"
#	if(isdn_dis) {
#		boot -n -f bootp()isdn_dis.fail
#		$failed=1;
#	}


	memory;


	ng1;

	
	if($failed) {
		echo "FAILURES DETECTED IN IP24\n"
		}
	else
		{
		$cpu_failed=0;
		echo "ALL TESTS IN IP24 PASSED\n";
		boot -n -f bootp()start_unix

#		Typo . . . 
#		Pat 3/1/94
#		boot dkc(0,1,0)unix;
		boot dksc(0,1,0)unix; 
	}
	fi
}


pf {
    $pffailed = 0;
    echo "Pixel Formatter host to shared ram test"
    if (pf_hst_ram) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter 68302 register test"
    if (pf_regs) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter 68302 ROM checksum test"
    if (pf_rom_chksum) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter 68302 address line test"
    if (pf_adr_line) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter shared Memory test"
    if (pf_shrd_mem) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter 68302 internal ram test"
    if (pf_intrn_ram) {
        $pffailed = 1;
        wait;
    }
    echo "Pixel Formatter unshared Memory test"
    if (pf_unshrd_mem) {
        $pffailed = 1;
        wait;
    }
}


s1  {
        $skipvino=1;
        $failed=0;
	$pffailed=0;
	msglog_start;
        cpusc;
        ip;
        memory;
	if (is_symphony) {
		pf;
# Commented out following line so UNIX will boot after PF TEST
# -Pat 2/28/94
#		$failed = 1;
	}
	if (!$failed) {
		unix;
	}
}





#Start of Galileo diagnostics
CheckSlot {
        $tmp = gr2_setboard 0;
        if ($tmp) {
		echo "GR2 Board Found in slot 0."
		return 0
        }

        $tmp = gr2_setboard 1;
        if ($tmp) {
		echo "GR2 Board Found in slot 1."
		return 0
        }

	$tmp = ng1_setboard 0;
	if ($tmp) {
		echo "NG1 Board Found in slot 0."
		return 0
	}

	$tmp = ng1_setboard 1;
	if ($tmp) {
		echo "NG1 Board Found in slot 1."
		return 0
	}
}

cc1 {
	CheckSlot;
	echo "CC1 Frame Buffer Test";
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "CC1 Memory Test";
	$status = cc1_mem;
	if ($status)  {
		wait;
	}
	echo "CC1 (DMA MODE)Memory Test";
	$status = cc1_dma;
	if ($status) {
		wait;
	}
}

ab1_red {
	CheckSlot;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "AB1 Red Channel Memory Test ";
	ab1_rmem;
}

ab1_blue {
	CheckSlot;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "AB1 Blue Channel Memory Test ";
	ab1_bmem;
}

ab1_green {
	CheckSlot;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "AB1 Green Channel Memory Test ";
	ab1_gmem;
}

ab1 {
	CheckSlot;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "AB1 Memory Test (Red, Green, Blue)";
	status = ab1_mem;
	if ($status)  {
		wait;
	}
}

kva {
	CheckSlot;
    	echo "Voltage changed to 4.75 V\n"
    	chg_volt 0;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "Test Display Control Bus";
	$status = ev1_dcb;
	if ($status)
		wait;
	echo "CC1 Memory Test";
	cc1;
	echo "AB1 Memory Test (Red, Green, Blue)";
	ab1;

    	echo "Voltage changed to 5.25 V\n"
    	chg_volt 2;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "Test Display Control Bus";
	$status = ev1_dcb;
	if ($status)
		wait;
	echo "CC1 Memory Test";
	cc1;
	echo "AB1 Memory Test (Red, Green, Blue)";
	ab1;

    	echo "Voltage changed to 5.0 V\n"
    	chg_volt 1;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	} 
	echo "Galileo Board Initialized Properly"
	echo "Test Display Control Bus";
	$status = ev1_dcb;
	if ($status)
		wait;
	echo "CC1 Memory Test";
	cc1;
	echo "AB1 Memory Test (Red, Green, Blue)";
	ab1;
	unix;
}
kv {
	CheckSlot;
	$status =ev1_init ;
	if ($status)  {
		echo " Galileo Board Initialization FAILED"
		return ($status);
	}
	echo "Galileo Board Initialized Properly"
	echo "Test Display Control Bus";
	$status = ev1_dcb;
	if ($status) {
		wait;
	}
	echo "CC1 Memory Test";
	cc1;
	echo "AB1 Memory Test (Red, Green, Blue)";
	ab1;
}

#END of Galileo diagnostics

$isserver=!ng1_probe && vino_probe && audio_hal2rev

if($isserver) {
	s1;
	}
	else {
	indy;
	}

