/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

#ident	"$Header: rtt.c 1.9 90/04/24 $"

/* $Log:	rtt.c,v $
 */

#include <sys/types.h>
#include <sys/cfg.h>
#include <sys/slic.h>
#include <sys/slicreg.h>
#include <sys/mftpr.h>
#include "sec.h"

extern void sec_rtofw();
extern void at386_rtofw();
extern void ssm_rtofw();

/* 
 * Return to controller board firmware monitor.
 * Determine type of controller board and 
 * invoke its device dependent shutdown routine.
 */
rtt()
{
	register struct config_desc *cd = CD_LOC;

	if (cd->c_sys.sd_type == SYSTYP_S1)
		at386_rtofw();
#if defined(BOOTXX) || defined(SCED_DIAGS)
	else
		sec_rtofw();
#else /* BOOTXX || SCED_DIAGS */
	else if (cd->c_cons->cd_type == SLB_SCSIBOARD) 
		sec_rtofw();
	else
		ssm_rtofw();
#endif /* BOOTXX || SCED_DIAGS */
}

/*
 * SEC board dependent return to firmware.
 * Included in this module to inhibit inclusion of
 * rest of sec.c in some, but not all, bootstraps.
 */
static void
sec_rtofw()
{
	register struct config_desc *cd = CD_LOC;
	register struct sec_powerup *in;

	in = (struct sec_powerup *)cd->c_cons->cd_sc_init_queue;
	in->pu_cib.cib_inst = SINST_RETTODIAG;
	in->pu_cib.cib_status = (int *)0;
	mIntr(cd->c_cons->cd_slic, 5, SDEV_SCSIBOARD);
	for (;;)
		/* spin till shut down by firmware */;
}
