xref: /original-bsd/sys/dev/cdvar.h (revision da6ea800)
16df4657fSmckusick /*
26df4657fSmckusick  * Copyright (c) 1988 University of Utah.
3*da6ea800Sbostic  * Copyright (c) 1990, 1993
4*da6ea800Sbostic  *	The Regents of the University of California.  All rights reserved.
56df4657fSmckusick  *
66df4657fSmckusick  * This code is derived from software contributed to Berkeley by
76df4657fSmckusick  * the Systems Programming Group of the University of Utah Computer
86df4657fSmckusick  * Science Department.
96df4657fSmckusick  *
106df4657fSmckusick  * %sccs.include.redist.c%
116df4657fSmckusick  *
12ce985625Smckusick  * from: Utah $Hdr: cdvar.h 1.1 90/07/09$
136df4657fSmckusick  *
14*da6ea800Sbostic  *	@(#)cdvar.h	8.1 (Berkeley) 06/10/93
156df4657fSmckusick  */
166df4657fSmckusick 
176df4657fSmckusick #define	NCDISKS	8			/* max # of component disks */
186df4657fSmckusick 
196df4657fSmckusick /*
206df4657fSmckusick  * A concatenated disk is described at config time by this structure.
216df4657fSmckusick  */
226df4657fSmckusick struct cddevice {
236df4657fSmckusick 	int	cd_unit;		/* logical unit of this cd */
246df4657fSmckusick 	int	cd_interleave;		/* interleave (DEV_BSIZE blocks) */
256df4657fSmckusick 	int	cd_flags;		/* misc. information */
266df4657fSmckusick 	int	cd_dk;			/* disk number */
276df4657fSmckusick 	dev_t	cd_dev[NCDISKS];	/* component devices */
286df4657fSmckusick };
296df4657fSmckusick 
306df4657fSmckusick /* cd_flags */
316df4657fSmckusick #define	CDF_SWAP	0x01	/* interleave should be dmmax */
326df4657fSmckusick #define CDF_UNIFORM	0x02	/* use LCD of sizes for uniform interleave */
336df4657fSmckusick 
346df4657fSmckusick /*
356df4657fSmckusick  * Component info table.
366df4657fSmckusick  * Describes a single component of a concatenated disk.
376df4657fSmckusick  */
386df4657fSmckusick struct cdcinfo {
396df4657fSmckusick 	dev_t		ci_dev;	 /* devno */
406df4657fSmckusick 	size_t		ci_size; /* size */
416df4657fSmckusick };
426df4657fSmckusick 
436df4657fSmckusick /*
446df4657fSmckusick  * Interleave description table.
456df4657fSmckusick  * Computed at boot time to speed irregular-interleave lookups.
466df4657fSmckusick  * The idea is that we interleave in "groups".  First we interleave
476df4657fSmckusick  * evenly over all component disks up to the size of the smallest
486df4657fSmckusick  * component (the first group), then we interleave evenly over all
496df4657fSmckusick  * remaining disks up to the size of the next-smallest (second group),
506df4657fSmckusick  * and so on.
516df4657fSmckusick  *
526df4657fSmckusick  * Each table entry describes the interleave characteristics of one
536df4657fSmckusick  * of these groups.  For example if a concatenated disk consisted of
546df4657fSmckusick  * three components of 5, 3, and 7 DEV_BSIZE blocks interleaved at
556df4657fSmckusick  * DEV_BSIZE (1), the table would have three entries:
566df4657fSmckusick  *
576df4657fSmckusick  *	ndisk	startblk	startoff	dev
586df4657fSmckusick  *	3	0		0		0, 1, 2
596df4657fSmckusick  *	2	9		3		0, 2
606df4657fSmckusick  *	1	13		5		2
616df4657fSmckusick  *	0	-		-		-
626df4657fSmckusick  *
636df4657fSmckusick  * which says that the first nine blocks (0-8) are interleaved over
646df4657fSmckusick  * 3 disks (0, 1, 2) starting at block offset 0 on any component disk,
656df4657fSmckusick  * the next 4 blocks (9-12) are interleaved over 2 disks (0, 2) starting
666df4657fSmckusick  * at component block 3, and the remaining blocks (13-14) are on disk
676df4657fSmckusick  * 2 starting at offset 5.
686df4657fSmckusick  */
696df4657fSmckusick struct cdiinfo {
706df4657fSmckusick 	int	ii_ndisk;	/* # of disks range is interleaved over */
716df4657fSmckusick 	daddr_t	ii_startblk;	/* starting scaled block # for range */
726df4657fSmckusick 	daddr_t	ii_startoff;	/* starting component offset (block #) */
736df4657fSmckusick 	char	ii_index[NCDISKS];/* ordered list of components in range */
746df4657fSmckusick };
756df4657fSmckusick 
766df4657fSmckusick #ifdef KERNEL
776df4657fSmckusick extern	struct cddevice cddevice[];
786df4657fSmckusick #endif
79