1 /* $NetBSD: wdvar.h,v 1.38 2009/12/17 21:03:10 bouyer 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 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef _DEV_ATA_WDVAR_H_ 28 #define _DEV_ATA_WDVAR_H_ 29 30 #ifdef _KERNEL_OPT 31 #include "opt_wd_softbadsect.h" 32 #endif 33 34 struct wd_softc { 35 /* General disk infos */ 36 device_t sc_dev; 37 struct disk sc_dk; 38 struct bufq_state *sc_q; 39 struct callout sc_restart_ch; 40 int sc_quirks; /* any quirks drive might have */ 41 /* IDE disk soft states */ 42 struct ata_bio sc_wdc_bio; /* current transfer */ 43 struct buf *sc_bp; /* buf being transfered */ 44 struct ata_drive_datas *drvp; /* Our controller's infos */ 45 const struct ata_bustype *atabus; 46 int openings; 47 struct ataparams sc_params;/* drive characteristics found */ 48 int sc_flags; 49 #define WDF_WLABEL 0x004 /* label is writable */ 50 #define WDF_LABELLING 0x008 /* writing label */ 51 /* 52 * XXX Nothing resets this yet, but disk change sensing will when ATA-4 is 53 * more fully implemented. 54 */ 55 #define WDF_LOADED 0x010 /* parameters loaded */ 56 #define WDF_WAIT 0x020 /* waiting for resources */ 57 #define WDF_LBA 0x040 /* using LBA mode */ 58 #define WDF_KLABEL 0x080 /* retain label after 'full' close */ 59 #define WDF_LBA48 0x100 /* using 48-bit LBA mode */ 60 u_int64_t sc_capacity; /* full capacity of the device */ 61 u_int32_t sc_capacity28; /* capacity accessible with LBA28 commands */ 62 63 int retries; /* number of xfer retry */ 64 65 #ifdef WD_SOFTBADSECT 66 SLIST_HEAD(, disk_badsectors) sc_bslist; 67 u_int sc_bscount; 68 #endif 69 #if NRND > 0 70 rndsource_element_t rnd_source; 71 #endif 72 }; 73 74 #define sc_drive sc_wdc_bio.drive 75 #define sc_mode sc_wdc_bio.mode 76 #define sc_multi sc_wdc_bio.multi 77 #define sc_badsect sc_wdc_bio.badsect 78 79 #endif /* _DEV_ATA_WDVAR_H_ */ 80