xref: /original-bsd/sys/news3400/iodev/sdreg.h (revision 0dc589e4)
10353ce09Smckusick /*
2*0dc589e4Sbostic  * Copyright (c) 1992, 1993
3*0dc589e4Sbostic  *	The Regents of the University of California.  All rights reserved.
40353ce09Smckusick  *
50353ce09Smckusick  * This code is derived from software contributed to Berkeley by
60353ce09Smckusick  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
70353ce09Smckusick  *
80353ce09Smckusick  * %sccs.include.redist.c%
90353ce09Smckusick  *
100353ce09Smckusick  * from: $Hdr: sdreg.h,v 4.300 91/06/09 06:38:28 root Rel41 $ SONY
110353ce09Smckusick  *
12*0dc589e4Sbostic  *	@(#)sdreg.h	8.1 (Berkeley) 06/11/93
130353ce09Smckusick  */
140353ce09Smckusick 
150353ce09Smckusick /*
160353ce09Smckusick  * Copyright (c) 1989- by SONY Corporation.
170353ce09Smckusick  */
180353ce09Smckusick /*
190353ce09Smckusick  *	sdreg.h
200353ce09Smckusick  */
210353ce09Smckusick 
220353ce09Smckusick #ifndef __SDREG__
230353ce09Smckusick #define __SDREG__ 1
240353ce09Smckusick 
250353ce09Smckusick #define	MAXSLAVE	8
260353ce09Smckusick #define	PNUM		8
270353ce09Smckusick #define	RSEN_CNT	32
280353ce09Smckusick 
290353ce09Smckusick /******************************************************/
300353ce09Smckusick /*
310353ce09Smckusick  *	software control structure / controller
320353ce09Smckusick  */
330353ce09Smckusick struct sdc_softc {
340353ce09Smckusick /*00*/	int	sdc_wticks;
350353ce09Smckusick /*04*/	int	sdc_state;
360353ce09Smckusick #define SDCS_NORMAL	0x0
370353ce09Smckusick #define SDCS_RSENSE	0x1
380353ce09Smckusick #define SDCS_ECC	0x2
390353ce09Smckusick #define SDCS_RASREAD	0x4
400353ce09Smckusick #define SDCS_RASBLK	0x8
410353ce09Smckusick #define SDCS_RASWRITE	0x10
420353ce09Smckusick #define SDCS_RETRY	0x20
430353ce09Smckusick #define SDCS_PREVRMB	0x40
440353ce09Smckusick #define SDCS_LOSTDATA	0x1000
450353ce09Smckusick #define SDCS_ECC_HOLD	0x100000
460353ce09Smckusick #define SDCS_ECCOFF	0x200000
470353ce09Smckusick #define SDCS_REZERO	0x400000
480353ce09Smckusick #define	SDCS_OPEN_WAIT	0x20000000
490353ce09Smckusick #define SDCS_SCUNLOCK	0x40000000
500353ce09Smckusick #define SDCS_IOCTL	0x80000000
510353ce09Smckusick /*08*/	int	sdc_nhrderr;
520353ce09Smckusick /*0c*/	int	sdc_retrycnt;
530353ce09Smckusick /*10*/	int	sdc_softas;
540353ce09Smckusick /*14*/	int	sdc_timeo;
550353ce09Smckusick /*18*/	int	sdc_countcc;
560353ce09Smckusick /*1c*/	int	sdc_firmware;
570353ce09Smckusick #define	SDCFW_DEFMODE	0x1
580353ce09Smckusick #define	SDCFW_CACHE	0x2
590353ce09Smckusick #define	SDCFW_AWRE	0x4
600353ce09Smckusick #define	SDCFW_ARRE	0x8
610353ce09Smckusick #define	SDCFW_OLDWREN3	0x10
620353ce09Smckusick #define	SDCFW_WANTED	0x20
630353ce09Smckusick #define	SDCFW_BUSY	0x40
640353ce09Smckusick #define	SDCFW_RMB	0x80
650353ce09Smckusick #define	SDCFW_CDBUGS	0x100
660353ce09Smckusick #define	SDCFW_CONTR	0x200
670353ce09Smckusick #define	SDCFW_DEVMASK	0xf0000000
680353ce09Smckusick #define	SDCFW_HD	0x10000000
690353ce09Smckusick #define	SDCFW_MO	0x20000000
700353ce09Smckusick #define	SDCFW_CD	0x40000000
710353ce09Smckusick /*20*/
720353ce09Smckusick };
730353ce09Smckusick 
740353ce09Smckusick /*
750353ce09Smckusick  *	software control structure / drive
760353ce09Smckusick  */
770353ce09Smckusick struct sdd_softc {
780353ce09Smckusick /*00*/	int	sdd_sectsize;
790353ce09Smckusick /*04*/	int	sdd_nsect;
800353ce09Smckusick /*08*/	int	sdd_badsect;
810353ce09Smckusick /*0c*/	int	sdd_flags;
820353ce09Smckusick #define	SDDF_DSKCHGD	0x0
830353ce09Smckusick #define	SDDF_SAMEDSK	0x1
840353ce09Smckusick #define	SDDF_WPROTECT	0x2
850353ce09Smckusick #define	SDDF_XUSE	0x4
860353ce09Smckusick #define	SDDF_NONFMT	0x8
870353ce09Smckusick #define	SDDF_FMTDONE	0x10
880353ce09Smckusick #define	SDDF_REQ_EJECT	0x20
890353ce09Smckusick #define	SDDF_ERASEOFF	0x40
900353ce09Smckusick #define SDDF_VBADSECT	0x80
910353ce09Smckusick #define SDDF_SKIPCHECK	0x100
920353ce09Smckusick #define	SDDF_SYNCTR	0x200
930353ce09Smckusick #define	SDDF_INHRMV	0x400
940353ce09Smckusick #define	SDDF_GETTMP	0x800
950353ce09Smckusick #define	SDDF_AUDIO_START	0x80000000
960353ce09Smckusick /*10*/	int	sdd_start;		/* for removable disk */
970353ce09Smckusick /*14*/	int	sdd_stoptime;		/* for removable disk */
980353ce09Smckusick 	daddr_t	sdd_lastblk;
990353ce09Smckusick };
1000353ce09Smckusick 
1010353ce09Smckusick struct sdst {
1020353ce09Smckusick /*00*/	short	nsect;			/* # sectors / track */
1030353ce09Smckusick /*02*/	short	ntrak;			/* # tracks / cylinder */
1040353ce09Smckusick /*04*/	short	nspc;			/* # sectors / cylinder */
1050353ce09Smckusick /*06*/	short	ncyl;			/* # cylinders */
1060353ce09Smckusick /*08*/	short	rps;			/* # revolutions / second */
1070353ce09Smckusick /*0a*/	short	xxxx;			/* reserved */
1080353ce09Smckusick /*0c*/	struct	size *sizes;		/* partition table */
1090353ce09Smckusick /*10*/
1100353ce09Smckusick };
1110353ce09Smckusick 
1120353ce09Smckusick struct size {
1130353ce09Smckusick /*00*/	daddr_t	sd_nblocks;
1140353ce09Smckusick /*04*/	daddr_t	sd_blkoff;
1150353ce09Smckusick /*08*/
1160353ce09Smckusick };
1170353ce09Smckusick 
1180353ce09Smckusick /*
1190353ce09Smckusick  * Device configuration table.
1200353ce09Smckusick  */
1210353ce09Smckusick struct sddevinfo {
1220353ce09Smckusick /*00*/	int		id_len;		/* identify length */
1230353ce09Smckusick /*04*/	char		*id_name;	/* vendor & product ID */
1240353ce09Smckusick /*08*/	char		*revs;		/* revision */
1250353ce09Smckusick /*0c*/	int		capacity;	/* drive capacity */
1260353ce09Smckusick /*10*/	char		*call_name;	/* device nickname */
1270353ce09Smckusick /*14*/	int		type;		/* device type code */
1280353ce09Smckusick #define		UNKNOWN_DISK	0
1290353ce09Smckusick /**/
1300353ce09Smckusick #define		WREN3_101	110
1310353ce09Smckusick #define		WREN3_182	111
1320353ce09Smckusick #define		WREN3_101_HH	112
1330353ce09Smckusick #define		WREN4_286	120
1340353ce09Smckusick #define		WREN5_170_HH	130
1350353ce09Smckusick #define		WREN6_415_HH	141
1360353ce09Smckusick #define		ST1480N		171
1370353ce09Smckusick /**/
1380353ce09Smckusick #define		DK515C_78	210
1390353ce09Smckusick #define		DK516C_16	211
1400353ce09Smckusick #define		DK312C_25	220
1410353ce09Smckusick #define		DK312C_20	221
1420353ce09Smckusick /**/
1430353ce09Smckusick #define		SRD_2040Z	310
1440353ce09Smckusick #define		SMO_S501	330	/* format mode 2 */
1450353ce09Smckusick #define		SMO_S501_ISO	331	/* format mode 3 (spare band 1024) */
1460353ce09Smckusick #define		SMO_S501_ISO2	332	/* format mode 3 (spare band 2048) */
1470353ce09Smckusick /**/
1480353ce09Smckusick #define		XT_8760S	810
1490353ce09Smckusick /**/
1500353ce09Smckusick /*18*/	int		firm_flags;	/* firmware spec */
1510353ce09Smckusick # define	FIRM_CACHE_ON	0x01
1520353ce09Smckusick # define	FIRM_CACHE_OFF	0x02
1530353ce09Smckusick # define	FIRM_SYNCTR	0x04
1540353ce09Smckusick # define	FIRM_AWRE	0x08
1550353ce09Smckusick # define	FIRM_ARRE	0x10
1560353ce09Smckusick /*1c*/	int		tr_period;	/* synchronous transfer period */
1570353ce09Smckusick /*20*/	int		tr_offset;	/* synchronous transfer offset */
1580353ce09Smckusick /*24*/	struct sc_ureq	**setup_cmds;	/* device setup commands */
1590353ce09Smckusick /*28*/	struct sdst	*sdstp;		/* device specifications */
1600353ce09Smckusick #define calc_disk_sizes	NULL
1610353ce09Smckusick /*2c*/	char		*ERP_page;	/* normal Error Recovery Parameters */
1620353ce09Smckusick /*30*/	char		*max_ERP_page;	/* max Error Recovery Parameters */
1630353ce09Smckusick /*34*/	char		**other_pages;	/* Other Parameters */
1640353ce09Smckusick /*38*/	int		fmt_opts;	/* Format options */
1650353ce09Smckusick # define	FMT_DLFMT	0x07	/* Defect list format */
1660353ce09Smckusick # define	FMT_DLF_BLK	0x00		/* block format */
1670353ce09Smckusick # define	FMT_DLF_IDX	0x04		/* bytes from index format */
1680353ce09Smckusick # define	FMT_DLF_PHYS	0x05		/* physical sector format */
1690353ce09Smckusick # define	FMT_DCRT	0x20	/* Disable Certification */
1700353ce09Smckusick /*3c*/
1710353ce09Smckusick };
1720353ce09Smckusick 
1730353ce09Smckusick #ifdef news1800
1740353ce09Smckusick # define	SYNC_TR_OFS	4
1750353ce09Smckusick #else
1760353ce09Smckusick # define	SYNC_TR_OFS	0
1770353ce09Smckusick #endif
1780353ce09Smckusick 
1790353ce09Smckusick /*********************************************************/
1800353ce09Smckusick 
1810353ce09Smckusick /*
1820353ce09Smckusick  *	MODE SELECT/SENSE bit assign
1830353ce09Smckusick  */
1840353ce09Smckusick #define	SDM_PG_NULL	0x00	/* product unique not used */
1850353ce09Smckusick #define	SDM_PG_ERR	0x01	/* error recovery parameters */
1860353ce09Smckusick #define	SDM_PG_CNCT	0x02	/* disconnect/reconnect control parameters */
1870353ce09Smckusick #define	SDM_PG_FMT1	0x03	/* direct access device format parameters */
1880353ce09Smckusick #define	SDM_PG_GEOM	0x04	/* rigid disk drive geometry parameters */
1890353ce09Smckusick 
1900353ce09Smckusick #define	SDM_PG_CACHE1	0x08	/* cache control parameters */
1910353ce09Smckusick 
1920353ce09Smckusick #define	SDM_PG_CACHE2	0x38	/* cache control parameters */
1930353ce09Smckusick 
1940353ce09Smckusick #define	SDM_PG_FMT2	0x20	/* format parameters */
1950353ce09Smckusick 
1960353ce09Smckusick #define	SDM_PG_MODIFY	0x20	/* modification parameters */
1970353ce09Smckusick 
1980353ce09Smckusick #define	SDM_PAGE	0x00	/* page cache mode */
1990353ce09Smckusick #define	SDM_RING	0x10	/* ring cache mode */
2000353ce09Smckusick #define	SDM_RCD		0x01	/* Read Cache Disable */
2010353ce09Smckusick 
2020353ce09Smckusick #define	SDM_STOD	0x08	/* SCSI Time Out Delay*/
2030353ce09Smckusick #define	SDM_ESDT	0x04	/* enable SCSI data timeout */
2040353ce09Smckusick 
2050353ce09Smckusick #define	SDM_PF		0x10	/* page format */
2060353ce09Smckusick 
2070353ce09Smckusick #define	SDM_PC_CUR	0x00	/* page control field (current value) */
2080353ce09Smckusick #define	SDM_PC_CHG	0x40	/* page control field (changeable value) */
2090353ce09Smckusick #define	SDM_PC_DEF	0x80	/* page control field (default value) */
2100353ce09Smckusick #define	SDM_PC_SAVE	0xc0	/* page control field (saved value) */
2110353ce09Smckusick 
2120353ce09Smckusick #define	SDM_PCODE_ER	SDM_PG_ERR
2130353ce09Smckusick #define	SDM_PCODE_CON	SDM_PG_CNCT
2140353ce09Smckusick #define	SDM_PCODE_FMT	SDM_PG_FMT2
2150353ce09Smckusick #define	SDM_PCODE_ALL	0x3f
2160353ce09Smckusick 
2170353ce09Smckusick #define	SDM_DCR		0x01	/* Disable Correction */
2180353ce09Smckusick #define	SDM_DTE		0x02	/* Disable Transfer on Error */
2190353ce09Smckusick #define	SDM_PER		0x04	/* Post Error */
2200353ce09Smckusick #define	SDM_EEC		0x08	/* Enable Early Correction */
2210353ce09Smckusick #define	SDM_RC		0x10	/* Read Continuous */
2220353ce09Smckusick #define	SDM_TB		0x20	/* Transfer Block */
2230353ce09Smckusick #define	SDM_ARRE	0x40	/* automatic read reallocate enable */
2240353ce09Smckusick #define	SDM_AWRE	0x80	/* automatic write reallocate enable */
2250353ce09Smckusick 
2260353ce09Smckusick /*
2270353ce09Smckusick  *	READ DEFECT LIST bit assign
2280353ce09Smckusick  */
2290353ce09Smckusick #define	SDDL_PLIST	0x10	/* primary defect list */
2300353ce09Smckusick #define	SDDL_GLIST	0x08	/* grown defect list  */
2310353ce09Smckusick #define	SDDL_PHYSFMT	0x05	/* physical sector format */
2320353ce09Smckusick 
2330353ce09Smckusick /*
2340353ce09Smckusick  *	FORMAT UNIT bit assign
2350353ce09Smckusick  */
2360353ce09Smckusick #define	SDF_FMTDAT	0x10	/* format data */
2370353ce09Smckusick #define	SDF_CMPLST	0x08	/* complete list */
2380353ce09Smckusick 
2390353ce09Smckusick #define	SDF_BLKFMT	0x10	/* block format */
2400353ce09Smckusick #define	SDF_PHYSFMT	0x15	/* physical sector format */
2410353ce09Smckusick #define	SDF_MKCDA	0x02	/* make controll data area */
2420353ce09Smckusick #define	SDF_MKPLST	0x01	/* make P list */
2430353ce09Smckusick 
2440353ce09Smckusick /*
2450353ce09Smckusick  *	PREVENT/ALLOW MEDIUM REMOVAL bit assign
2460353ce09Smckusick  */
2470353ce09Smckusick #define	SDRMV_PREV	0x01	/* prevent medium removal */
2480353ce09Smckusick #define	SDRMV_ALLOW	0x00	/* allow medium removal */
2490353ce09Smckusick 
2500353ce09Smckusick /*
2510353ce09Smckusick  *	START/STOP UNIT bit assign
2520353ce09Smckusick  */
2530353ce09Smckusick #define	SDSS_STOP	0x00	/* stop unit */
2540353ce09Smckusick #define	SDSS_START	0x01	/* start unit */
2550353ce09Smckusick #define	SDSS_EJECT	0x02	/* eject */
2560353ce09Smckusick 
2570353ce09Smckusick /*********************************************************/
2580353ce09Smckusick /*
2590353ce09Smckusick  *	IOCTL DEFINES
2600353ce09Smckusick  */
2610353ce09Smckusick #define	SDIOC_PRVRMV	_IO('D', 0)		/* prevent medium removal */
2620353ce09Smckusick #define	SDIOC_ALWRMV	_IO('D', 1)		/* allow medium removal */
2630353ce09Smckusick #define	SDIOC_FORMAT	_IOWR('D', 2, struct fmt_data)	/* format unit */
2640353ce09Smckusick struct fmt_data {
2650353ce09Smckusick /*00*/	int	noglist;			/* ignore G-list flag */
2660353ce09Smckusick /*04*/	u_char	*dlh;				/* defect list header */
2670353ce09Smckusick /*08*/
2680353ce09Smckusick };
2690353ce09Smckusick 
2700353ce09Smckusick #define	SDIOC_GSTOPT	_IOR('D', 3, int)		/* get stop time */
2710353ce09Smckusick #define	SDIOC_SSTOPT	_IOW('D', 4, int)		/* set stop time */
2720353ce09Smckusick 
2730353ce09Smckusick #define	SDIOC_SEJECT	_IO('D', 5)		/* set medium eject request */
2740353ce09Smckusick 
2750353ce09Smckusick #define	SDIOC_SXUSE	_IO('D', 6)		/* set exclusive use */
2760353ce09Smckusick #define	SDIOC_RXUSE	_IO('D', 7)		/* reset exclusive use */
2770353ce09Smckusick #define	SDIOC_ERSOFF	_IO('D', 8)		/* no erase before write */
2780353ce09Smckusick #define	SDIOC_ERSON	_IO('D', 9)		/* erase before write */
2790353ce09Smckusick 
2800353ce09Smckusick #define	SDIOC_INQUIRY	_IOR('D', 10, struct sc_inq)
2810353ce09Smckusick #define	SDIOC_RCAP	_IOR('D', 11, int)
2820353ce09Smckusick 
2830353ce09Smckusick #define	SDIOC_ECODE	_IOW('D', 14, int)	/* extend ecode on/off */
2840353ce09Smckusick 
2850353ce09Smckusick #define	SDIOC_GFLAGS	_IOR('D', 15, int)	/* get ii->ii_flags */
2860353ce09Smckusick #define	SDIOC_SFLAGS	_IOW('D', 16, int)	/* set ii->ii_flags */
2870353ce09Smckusick 
2880353ce09Smckusick /*
2890353ce09Smckusick  * ii->ii_flags bits assign
2900353ce09Smckusick  */
2910353ce09Smckusick #define SD_F_ENW	0x01			/* enable write open */
2920353ce09Smckusick #define SD_F_ECODE	0x02			/* enable extend code */
2930353ce09Smckusick #define	SD_F_WRTVRFY	0x04			/* execute write & verify */
2940353ce09Smckusick #define	SD_F_IGNLABEL	0x08			/* ignore disklabel/diskinfo */
2950353ce09Smckusick #define	SD_F_EOLBA	0x10			/* error if outside LBA */
2960353ce09Smckusick 
2970353ce09Smckusick #define	SDIOC_RASBLK	_IOW('D', 17, int)	/* reassign block */
2980353ce09Smckusick #define	SDIOC_GNICKNAME	_IOW('D', 18, char *)	/* get device nickname */
2990353ce09Smckusick #define	SDIOC_GTYPINDEX	_IOR('D', 19, int)	/* get ii->ii_type */
3000353ce09Smckusick 
3010353ce09Smckusick #define	SDIOC_SSYNCPARAM	_IOW('D', 20, struct sync_param)
3020353ce09Smckusick 						/* set sync tr param */
3030353ce09Smckusick #define	SDIOC_GSYNCPARAM	_IOR('D', 21, struct sync_param)
3040353ce09Smckusick 						/* get sync tr param */
3050353ce09Smckusick struct sync_param {
3060353ce09Smckusick 	int	tr_period;
3070353ce09Smckusick 	int	tr_offset;
3080353ce09Smckusick };
3090353ce09Smckusick 
3100353ce09Smckusick #define	SDIOC_FORMAT2	_IOWR('D', 22, struct sc_ureq)	/* format unit */
3110353ce09Smckusick 
3120353ce09Smckusick #endif /* !__SDREG__ */
313