/* $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: sd_space.c 1.17 90/01/25 $"

/*
 * sd_space.c
 *	scsi disk device driver configuration file
 */

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

#include "sys/types.h"
#include "sys/param.h"
#include "sys/devsw.h"
#include "sys/buf.h"
#include "sys/sec.h"
#include "sys/sd.h"
#include "sys/sd_device.h"

/*
 * Configure the device's tuning parameters.
 *
 * The number to the far right in the table below will be the 
 * unit number portion of the devices major/minor pair.
 *
 * The structure of the minor number is
 * bits 0-2 are the partition table index; 3-7 is the index into
 * the binary configuration table.
 *
 * buf_sz:	currently used to handle ioctl return information.
 * partab:	partition table entry for each unit.
 * num_iat:	number of iat's which are calloc'd for operation.
 *		This parameter must be large enough to handle all device
 *		programs allocated to allow low and thresh to work properly and
 *		should be set to (num_device_progs*(CLSIZE>=7?7:CLSIZE))
 *		Where the maximum raw transfer size will be constrained to
 *		a minimum of ((num_iat-1)*CLBYTES).
 * low:		once all device programs have been filled out the interrupt
 *		procedure will not queue any more until the queue has drained
 *		off to below low. Minimum value is 2.
 * thresh:	number of device programs to place in the queue maximum on
 *		each strategy or interrupt call to the start procedure. This
 *		allow the queue to be filled up at a controlled rate.
 *
 * NOTE: The partition table entry(below) must contain a valid partition
 *	 table that has the proper number of entries(above).
 *	 UNPREDICTABLE DRIVER ACTION AND RESULTS WILL OCCUR OTHERWISE.
 */

#define sdpart0 ((struct scsid_partition *)0)

struct sd_bconf sdbconf[] = {				/*
buf_sz,	partab,		num_iat, low,	thresh, bps		   */
{128,	sdpart0,	129,	5,	2,	60*17 },	/*0*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*1*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*2*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*3*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*4*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*5*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*6*/
{128,	sdpart0,	129,	5,	2,	60*17 },	/*7*/
};

int	sdretrys = 4;	/* Number of retrys before allowing a hard error   */

#ifdef SDDEBUG
/*
 * spin time for async timeouts which should never occur in a
 * production system unless there is bad hardware (target adapter)
 * which never comes back or timeouts.
 */
int	sdspintime = 2000000;
#endif	/* SDDEBUG  */

/*
 * bit patterns expected in results from INQUIRY command.  To identify
 * units on a target adaptor, byte 3 must be sdinq_targformat; CCS
 * disks will have byte 3 = sdinq_ccsformat.  Byte 0 must be sddevtype
 * on all recognized SCSI disks.
 */

unchar	sddevtype = 0;
unchar	sdinq_targformat = 0x0;
unchar	sdinq_ccsformat = 0x1;

/*
 * DON'T CHANGE ANY THING BELOW THIS LINE OR ALL BETS ARE OFF!
 */
int	sdmaxminor = sizeof(sdbconf)/sizeof(struct sd_bconf);
int	sdsensebuf_sz = 32 * sizeof(char);
#include "sys/autoconf.h"
#include "config.h"

int sd_req_size = 4;
int sd_doneq_size = 4;
int sd_flags = 0;
unchar sd_bin = 5;

/* All sec_scsi devices use the same configuration */
extern struct device_config sec_scsi_config[];

/* autoconfig structure linking device configuration with busses */
struct dev_on_bus sd_on_busses[] = {
	{ SEC_SCSI, 1, sec_scsi_config }, 
	{ NOBUS,},
};


/* device operations */

extern	int	sdopen();
extern	int	sdclose();
extern	int	sdstrat();
extern	int	sdminphys();
extern	int	sdsize();
extern	int	sdprint();
extern	int	sdread();
extern	int	sdwrite();
extern	int	sdioctl();
extern	int	sdfirstsect();
extern	int	nulldev();
extern	int	nostrmsgio();
extern	int	nostrpoll();

struct	devops	sddevops = {
	sdopen,				/* d_open */
	sdclose,			/* d_close */
	sdstrat,			/* d_strat */
	sdminphys,			/* d_minphys */
	sdsize,				/* d_size */
	sdprint,			/* d_print */
	sdread,				/* d_read */
	sdwrite,			/* d_write */
	sdioctl,			/* d_ioctl */
	nulldev,			/* d_mmap */
	nulldev,			/* d__intr */
	NULL,				/* d_str */
	nostrmsgio,			/* d_strmsgio */
	nostrpoll,			/* d_strpoll */
	sdfirstsect,			/* d_firstsect */
};
