Home | History | Annotate | Line # | Download | only in scsipi
sdvar.h revision 1.4
      1  1.4  thorpej /*	$NetBSD: sdvar.h,v 1.4 1998/06/10 22:17:40 thorpej Exp $	*/
      2  1.1      cgd 
      3  1.1      cgd /*
      4  1.1      cgd  * Copyright (c) 1994, 1995, 1997 Charles M. Hannum.  All rights reserved.
      5  1.1      cgd  *
      6  1.1      cgd  * Redistribution and use in source and binary forms, with or without
      7  1.1      cgd  * modification, are permitted provided that the following conditions
      8  1.1      cgd  * are met:
      9  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     10  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     11  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     13  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     14  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     15  1.1      cgd  *    must display the following acknowledgement:
     16  1.1      cgd  *	This product includes software developed by Charles M. Hannum.
     17  1.1      cgd  * 4. The name of the author may not be used to endorse or promote products
     18  1.1      cgd  *    derived from this software without specific prior written permission.
     19  1.1      cgd  *
     20  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.1      cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.1      cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.1      cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.1      cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.1      cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.1      cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.1      cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.1      cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.1      cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.1      cgd  */
     31  1.1      cgd 
     32  1.1      cgd /*
     33  1.1      cgd  * Originally written by Julian Elischer (julian (at) dialix.oz.au)
     34  1.1      cgd  * for TRW Financial Systems for use under the MACH(2.5) operating system.
     35  1.1      cgd  *
     36  1.1      cgd  * TRW Financial Systems, in accordance with their agreement with Carnegie
     37  1.1      cgd  * Mellon University, makes this software available to CMU to distribute
     38  1.1      cgd  * or use in any manner that they see fit as long as this message is kept with
     39  1.1      cgd  * the software. For this reason TFS also grants any other persons or
     40  1.1      cgd  * organisations permission to use or modify this software.
     41  1.1      cgd  *
     42  1.1      cgd  * TFS supplies this software to be publicly redistributed
     43  1.1      cgd  * on the understanding that TFS is not responsible for the correct
     44  1.1      cgd  * functioning of this software in any circumstances.
     45  1.1      cgd  *
     46  1.1      cgd  * Ported to run under 386BSD by Julian Elischer (julian (at) dialix.oz.au) Sept 1992
     47  1.1      cgd  */
     48  1.1      cgd 
     49  1.1      cgd #define	SDRETRIES	4
     50  1.1      cgd 
     51  1.1      cgd struct sd_ops;
     52  1.1      cgd 
     53  1.1      cgd struct sd_softc {
     54  1.1      cgd 	struct device sc_dev;
     55  1.1      cgd 	struct disk sc_dk;
     56  1.1      cgd 
     57  1.1      cgd 	int flags;
     58  1.1      cgd #define	SDF_LOCKED	0x01
     59  1.1      cgd #define	SDF_WANTED	0x02
     60  1.1      cgd #define	SDF_WLABEL	0x04		/* label is writable */
     61  1.1      cgd #define	SDF_LABELLING	0x08		/* writing label */
     62  1.1      cgd #define	SDF_ANCIENT	0x10		/* disk is ancient; for minphys */
     63  1.1      cgd 	struct scsipi_link *sc_link;	/* contains our targ, lun, etc. */
     64  1.1      cgd 	struct disk_parms {
     65  1.1      cgd 		u_long	heads;		/* number of heads */
     66  1.1      cgd 		u_long	cyls;		/* number of cylinders */
     67  1.1      cgd 		u_long	sectors;	/* number of sectors/track */
     68  1.1      cgd 		u_long	blksize;	/* number of bytes/sector */
     69  1.1      cgd 		u_long	disksize;	/* total number sectors */
     70  1.1      cgd 		u_long	rot_rate;	/* rotational rate, in RPM */
     71  1.1      cgd 	} params;
     72  1.1      cgd 	struct buf buf_queue;
     73  1.1      cgd 	u_int8_t type;
     74  1.1      cgd 	const struct sd_ops *sc_ops;	/* our bus-dependent ops vector */
     75  1.4  thorpej 
     76  1.4  thorpej 	void *sc_sdhook;		/* our shutdown hook */
     77  1.1      cgd 
     78  1.1      cgd #if NRND > 0
     79  1.1      cgd 	rndsource_element_t rnd_source;
     80  1.1      cgd #endif
     81  1.1      cgd };
     82  1.1      cgd 
     83  1.1      cgd struct sd_ops {
     84  1.1      cgd 	int	(*sdo_get_parms) __P((struct sd_softc *, struct disk_parms *,
     85  1.1      cgd 		    int));
     86  1.1      cgd };
     87  1.1      cgd #define	SDGP_RESULT_OK		0	/* paramters obtained */
     88  1.1      cgd #define	SDGP_RESULT_OFFLINE	1	/* no media, or otherwise losing */
     89  1.1      cgd #define	SDGP_RESULT_UNFORMATTED	2	/* unformatted media (max params) */
     90  1.1      cgd 
     91  1.1      cgd void sdattach __P((struct device *, struct sd_softc *, struct scsipi_link *,
     92  1.1      cgd     const struct sd_ops *));
     93