/* $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: scsiioctl.h 1.5 89/08/07 $"

#ifndef	_SYS_SCSIIOCTL_H_

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

/*
 * SCSI Ioctl commands
 */
#define SIOC		('s'<<8)
#define SIOCSCSICMD	(SIOC | 0)	/* do SCSI command */
#define SIOCDEVDATA	(SIOC | 1)	/* get device specific info */

/*
 * structure returned for SIOCDEVDATA ioctl 
 */
struct scsidev {
	unchar scsi_devno;		/* logical SCSI_DEVNO(targ, lun) */
	unchar scsi_ctlr;		/* SCSI controller number */
};


/*
 * This section defines the scsi disk ioctl interface.
 */

#define b_sioctl	   b_resid
#define SCSI_IOCTLLEN(bp)  (((struct scsiioctl *)(bp)->b_sioctl)->sio_cmdlen)

/*
 * format of a 6 byte command descriptor block (CDB)
 */

struct cmd6 {
	unchar cmd_opcode;
	unchar cmd_lun;
	unchar cmd_lba[2];
	unchar cmd_length;
	unchar cmd_cb;
};

/*
 * format of a 10 byte command descriptor block (CDB)
 */

struct cmd10 {
	unchar cmd_opcode;
	unchar cmd_lun;
	unchar cmd_lba[4];
	unchar cmd_pad;
	unchar cmd_length[2];
	unchar cmd_cb;
};

/*
 * arguments to sdioctl().  This interface requires a packet which
 * contains the CDB in the first bytes and the data for the command
 * in the remaining bytes.
 */

struct scsiioctl {
	ulong sio_datalength;
	ulong sio_addr;
	ulong sio_cmdlen;
	union {
		struct cmd6 cmd6;
		struct cmd10 cmd10;
	} sio_cmd;
};

#define sio_cmd6	sio_cmd.cmd6
#define sio_cmd10	sio_cmd.cmd10

struct reassarg {		/* used for REASSIGN BLOCKS */
	short  pad;
	unchar length[2];
	unchar defect[4];
};

struct defect_hdr {		/* read defect data header */
	unchar pad;
	unchar type;
	ushort length;
};

#define	_SYS_SCSIIOCTL_H_
#endif	/* _SYS_SCSIIOCTL_H_ */
