/* $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.
 */

/* $Header: vlsi.h 1.1 90/04/30 $ */

/*
 * vlsi.h
 *	VLSI performance driver ioctl and misc driver parameters.
 */

/* $Log:	vlsi.h,v $
 */

/*
 * Driver info
 */

struct vlsiinfo {
	sema_t	vi_mutex;
	unchar	vi_state;		/* Current state (see defines below) */
	unchar	vi_ncmc;		/* total number of CMCs in system */
	unchar	vi_cmcrev;		/* CMC rev (minimum rev if mixed) */
	unchar	vi_nprocbic;		/* total number of processor BICs */
	unchar	*vi_proc_ncmc;		/* number of CMCs on each processor */
	unchar	*vi_procbic_slic;	/* SLIC id for each processor BIC */
	uint	*vi_data;		/* data buffer */
};

/*
 * VLSI performance counter driver states
 */

#define VLSI_INUSE	0x1		/* Currently in use (open) */
#define VLSI_STARTED	0x2		/* counter are running */

/*
 * Number of counters on each chip
 */
#define VLSI_BIC_CNTRS	1		/* 1 counter on each BIC */
#define VLSI_CMC_CNTRS	2		/* 2 counters on each CMC */

/*
 * Information needed to setup up a BIC counter
 */
struct bic_cntr_setup {
	unchar	bs_bicnum;		/* which BIC in list of BICs */
	unchar	bs_select0;
	unchar	bs_mask0;
	unchar	bs_select1;
	unchar	bs_mask1;
};

/*
 * Information needed to setup up a CMC counter
 */
struct cmc_cntr_setup {
	unchar	cs_cntr;		/* which of the two CMC counters */
	unchar	cs_select;		/* select register setting */
	ulong	cs_mask;		/*   mask register    "  (bits 0:23) */
};

/*
 * VLSI perf config information (for return via ioctl)
 */
struct vlsi_cfg {
	unchar  vc_nprocbic;		/* number of processor BICs available */
	unchar	vc_ncmc;		/* total number of CMCs */
	unchar	vc_cmcrev;		/* "global" CMC rev */
};

/* 
 * IO controls.
 *
 * VLSIIOCGETCMCP passes in a ptr and the driver does its own copyout()
 */

#define	IOCVLSI		('V'<<8)
#define	VLSIIOCSTART	(IOCVLSI|0)			/* start counters */
#define	VLSIIOCSTOP	(IOCVLSI|1)			/* stop  counters */
#define	VLSIIOCGETCFG	(IOCVLSI|2)			/* get vlsi config */
#define	VLSIIOCGETCMCP	(IOCVLSI|3)			/* get CMCs/proc */
#define	VLSIIOCSETCMC	(IOCVLSI|4)			/* setup CMC counter */
#define	VLSIIOCSETPROCBIC (IOCVLSI|5)			/* setup BIC cntr */
