xref: /original-bsd/sys/hp300/dev/sdvar.h (revision 3705696b)
1 /*
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Van Jacobson of Lawrence Berkeley Laboratory.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)sdvar.h	8.1 (Berkeley) 06/10/93
11  */
12 
13 struct sdinfo {
14 	struct	disklabel si_label;	/* label */
15 	int	si_bopen;		/* mask of open block devs */
16 	int	si_copen;		/* mask of open char devs */
17 	int	si_open;		/* composite mask of open devs */
18 };
19 
20 struct	sd_softc {
21 	struct	hp_device *sc_hd;
22 	struct	devqueue sc_dq;
23 	int	sc_format_pid;	/* process using "format" mode */
24 	short	sc_flags;
25 	short	sc_type;	/* drive type */
26 	short	sc_punit;	/* physical unit (scsi lun) */
27 	u_short	sc_bshift;	/* convert device blocks to DEV_BSIZE blks */
28 	u_int	sc_blks;	/* number of blocks on device */
29 	int	sc_blksize;	/* device block size in bytes */
30 	u_int	sc_wpms;	/* average xfer rate in 16 bit wds/sec. */
31 	struct	sdinfo sc_info;	/* disklabel and related info */
32 };
33 
34 /* sc_flags values */
35 #define	SDF_ALIVE	0x01
36 #define SDF_OPENING	0x02
37 #define SDF_CLOSING	0x04
38 #define SDF_WANTED	0x08
39 #define SDF_WLABEL	0x10
40 #define SDF_RMEDIA	0x20
41 #define SDF_ERROR	0x40
42 
43 struct sdstats {
44 	long	sdresets;
45 	long	sdtransfers;
46 	long	sdpartials;
47 };
48 
49 #define	sdunit(x)	(minor(x) >> 3)
50 #define sdpart(x)	(minor(x) & 0x7)
51 #define	sdpunit(x)	((x) & 7)
52 #define sdlabdev(d)	(dev_t)(((int)(d)&~7)|2)	/* sd?c */
53 
54 #define	b_cylin		b_resid
55 
56 #define	SDRETRY		2
57