xref: /csrg-svn/sys/dev/cdvar.h (revision 63144)
141480Smckusick /*
241480Smckusick  * Copyright (c) 1988 University of Utah.
3*63144Sbostic  * Copyright (c) 1990, 1993
4*63144Sbostic  *	The Regents of the University of California.  All rights reserved.
541480Smckusick  *
641480Smckusick  * This code is derived from software contributed to Berkeley by
741480Smckusick  * the Systems Programming Group of the University of Utah Computer
841480Smckusick  * Science Department.
941480Smckusick  *
1041480Smckusick  * %sccs.include.redist.c%
1141480Smckusick  *
1245481Smckusick  * from: Utah $Hdr: cdvar.h 1.1 90/07/09$
1341480Smckusick  *
14*63144Sbostic  *	@(#)cdvar.h	8.1 (Berkeley) 06/10/93
1541480Smckusick  */
1641480Smckusick 
1741480Smckusick #define	NCDISKS	8			/* max # of component disks */
1841480Smckusick 
1941480Smckusick /*
2041480Smckusick  * A concatenated disk is described at config time by this structure.
2141480Smckusick  */
2241480Smckusick struct cddevice {
2341480Smckusick 	int	cd_unit;		/* logical unit of this cd */
2441480Smckusick 	int	cd_interleave;		/* interleave (DEV_BSIZE blocks) */
2541480Smckusick 	int	cd_flags;		/* misc. information */
2641480Smckusick 	int	cd_dk;			/* disk number */
2741480Smckusick 	dev_t	cd_dev[NCDISKS];	/* component devices */
2841480Smckusick };
2941480Smckusick 
3041480Smckusick /* cd_flags */
3141480Smckusick #define	CDF_SWAP	0x01	/* interleave should be dmmax */
3241480Smckusick #define CDF_UNIFORM	0x02	/* use LCD of sizes for uniform interleave */
3341480Smckusick 
3441480Smckusick /*
3541480Smckusick  * Component info table.
3641480Smckusick  * Describes a single component of a concatenated disk.
3741480Smckusick  */
3841480Smckusick struct cdcinfo {
3941480Smckusick 	dev_t		ci_dev;	 /* devno */
4041480Smckusick 	size_t		ci_size; /* size */
4141480Smckusick };
4241480Smckusick 
4341480Smckusick /*
4441480Smckusick  * Interleave description table.
4541480Smckusick  * Computed at boot time to speed irregular-interleave lookups.
4641480Smckusick  * The idea is that we interleave in "groups".  First we interleave
4741480Smckusick  * evenly over all component disks up to the size of the smallest
4841480Smckusick  * component (the first group), then we interleave evenly over all
4941480Smckusick  * remaining disks up to the size of the next-smallest (second group),
5041480Smckusick  * and so on.
5141480Smckusick  *
5241480Smckusick  * Each table entry describes the interleave characteristics of one
5341480Smckusick  * of these groups.  For example if a concatenated disk consisted of
5441480Smckusick  * three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
5541480Smckusick  * DEV_BSIZE (1), the table would have three entries:
5641480Smckusick  *
5741480Smckusick  *	ndisk	startblk	startoff	dev
5841480Smckusick  *	3	0		0		0, 1, 2
5941480Smckusick  *	2	9		3		0, 2
6041480Smckusick  *	1	13		5		2
6141480Smckusick  *	0	-		-		-
6241480Smckusick  *
6341480Smckusick  * which says that the first nine blocks (0-8) are interleaved over
6441480Smckusick  * 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
6541480Smckusick  * the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
6641480Smckusick  * at component block 3, and the remaining blocks (13-14) are on disk
6741480Smckusick  * 2 starting at offset 5.
6841480Smckusick  */
6941480Smckusick struct cdiinfo {
7041480Smckusick 	int	ii_ndisk;	/* # of disks range is interleaved over */
7141480Smckusick 	daddr_t	ii_startblk;	/* starting scaled block # for range */
7241480Smckusick 	daddr_t	ii_startoff;	/* starting component offset (block #) */
7341480Smckusick 	char	ii_index[NCDISKS];/* ordered list of components in range */
7441480Smckusick };
7541480Smckusick 
7641480Smckusick #ifdef KERNEL
7741480Smckusick extern	struct cddevice cddevice[];
7841480Smckusick #endif
79