Home | History | Annotate | Line # | Download | only in ata
wdvar.h revision 1.29
      1 /*	$NetBSD: wdvar.h,v 1.29 2005/02/27 00:26:59 perry Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1998, 2001 Manuel Bouyer.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Manuel Bouyer.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef _DEV_ATA_WDVAR_H_
     33 #define	_DEV_ATA_WDVAR_H_
     34 
     35 #ifdef _KERNEL_OPT
     36 #include "opt_wd_softbadsect.h"
     37 #endif
     38 
     39 struct wd_softc {
     40 	/* General disk infos */
     41 	struct device sc_dev;
     42 	struct disk sc_dk;
     43 	struct bufq_state sc_q;
     44 	struct callout sc_restart_ch;
     45 	int sc_quirks;			/* any quirks drive might have */
     46 	/* IDE disk soft states */
     47 	struct ata_bio sc_wdc_bio; /* current transfer */
     48 	struct buf *sc_bp; /* buf being transfered */
     49 	struct ata_drive_datas *drvp; /* Our controller's infos */
     50 	const struct ata_bustype *atabus;
     51 	int openings;
     52 	struct ataparams sc_params;/* drive characteristics found */
     53 	int sc_flags;
     54 #define	WDF_WLABEL	0x004 /* label is writable */
     55 #define	WDF_LABELLING	0x008 /* writing label */
     56 /*
     57  * XXX Nothing resets this yet, but disk change sensing will when ATA-4 is
     58  * more fully implemented.
     59  */
     60 #define WDF_LOADED	0x010 /* parameters loaded */
     61 #define WDF_WAIT	0x020 /* waiting for resources */
     62 #define WDF_LBA		0x040 /* using LBA mode */
     63 #define WDF_KLABEL	0x080 /* retain label after 'full' close */
     64 #define WDF_LBA48	0x100 /* using 48-bit LBA mode */
     65 	u_int64_t sc_capacity;
     66 	int cyl; /* actual drive parameters */
     67 	int heads;
     68 	int sectors;
     69 	int retries; /* number of xfer retry */
     70 
     71 	void *sc_sdhook;		/* our shutdown hook */
     72 
     73 #ifdef WD_SOFTBADSECT
     74 	SLIST_HEAD(, disk_badsectors)	sc_bslist;
     75 	u_int sc_bscount;
     76 #endif
     77 #if NRND > 0
     78 	rndsource_element_t	rnd_source;
     79 #endif
     80 };
     81 
     82 #define sc_drive sc_wdc_bio.drive
     83 #define sc_mode sc_wdc_bio.mode
     84 #define sc_multi sc_wdc_bio.multi
     85 #define sc_badsect sc_wdc_bio.badsect
     86 
     87 #endif /* _DEV_ATA_WDVAR_H_ */
     88