/* $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: ccs.h 1.6 90/11/08 $ */

/*
 * ccs.h - standalone header for Common Command Set SCSI disks
 */

/*
 * Mode Sense - Mode Select data
 */

struct sd_modes {
	u_char sdm_sdlength;	/* sense data length */
	u_char sdm_type;	/* medium type */
	u_char sdm_pad0;
	u_char sdm_bdlength;	/* block descriptor length */
	u_char sdm_density;	/* density code */
	u_char sdm_nblks[3];	/* number of blocks */
	u_char sdm_pad1;
	u_char sdm_blength[3];	/* block length */
				/* error recovery page - page code 1 */
	u_char sdm_pgcode;	/* page code */
	u_char sdm_pglength;	/* page length */
	u_char sdm_bits;	/* various error-recovery bits */
	u_char sdm_retry;	/* retry count */
	u_char sdm_corr;	/* correction span */
	u_char sdm_headoff;	/* head offset count */
	u_char sdm_dsoff;	/* data strobe offset count */
	u_char sdm_recov;	/* recovery time limit */
};

/*
 * mode sense/select page codes
 */

#define SDM_MODES	0x0	/* just return block descriptor */
#define SDM_ERROR	0x1	/* error recovery page */
#define SDM_CONN	0x2	/* disconnect/reconnect page */
#define SDM_FORMAT	0x3	/* format parameter page */
#define SDM_GEOM	0x4	/* rigid disk drive geometry page */
#define SDM_ALL		0x3f	/* return all of the above pages */

/*
 * Mode Sense page control fields
 */

#define	SDM_PCF_CURRENT	0x00	/* report current values */
#define	SDM_PCF_CHANGE	0x40	/* report changeable values */
#define	SDM_PCF_DEFAULT	0x80	/* report default values */
#define	SDM_PCF_SAVED	0xC0	/* report saved values */

/*
 * sdm_bits defines
 */

#define SDE_DCR		0x1	/* Disable Correction */
#define SDE_DTE		0x2	/* Disable transfer on error */
#define SDE_PER		0x4	/* Post error */
#define SDE_EEC		0x8	/* Enable early correction */
#define SDE_RC		0x10	/* Read continuous */
#define SDE_TB		0x20	/* Transfer block */
#define SDE_ARRE	0x40	/* Automatic read reallocation enabled */
#define SDE_AWRE	0x80	/* Automatic write reallocation enabled */

/*
 * misc mode select/sense defines
 */

#define SDM_PF		0x10	/* Page Format bit for MODE SELECT */

/*
 * field sizes for inquiry command
 */

#define SDQ_VEND	8
#define SDQ_PROD	16
#define SDQ_REV		4

/*
 * Inquiry command returned data
 */

struct sdinq {
	u_char	sdq_devtype[3];
	u_char	sdq_format;		/* 0 for adaptec, 1 for CCS */
	u_char	sdq_length;		/* additional length - 31 for CCS */
	u_char	sdq_pad[3];
	char	sdq_vendor[SDQ_VEND];	/* name of the vendor */
	char	sdq_product[SDQ_PROD];	/* product ID */
	char	sdq_revision[SDQ_REV];	/* product fw rev level */
};

#define CCS_FORMAT      0x01
/*
 * flavors of disk formatting.
 */

#define SDF_FORMPG	0x10	/* format with both P and G lists and Data */
#define SDF_FORMPG_ND   0x00    /* format with both P and G lists */

