Home | History | Annotate | Line # | Download | only in ata
wdvar.h revision 1.3.10.1
      1  1.3.10.1  thorpej /*	$NetBSD: wdvar.h,v 1.3.10.1 1999/10/20 22:03:14 thorpej Exp $	*/
      2       1.2   bouyer 
      3       1.2   bouyer /*
      4       1.2   bouyer  * Copyright (c) 1998 Manuel Bouyer.
      5       1.2   bouyer  *
      6       1.2   bouyer  * Redistribution and use in source and binary forms, with or without
      7       1.2   bouyer  * modification, are permitted provided that the following conditions
      8       1.2   bouyer  * are met:
      9       1.2   bouyer  * 1. Redistributions of source code must retain the above copyright
     10       1.2   bouyer  *    notice, this list of conditions and the following disclaimer.
     11       1.2   bouyer  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.2   bouyer  *    notice, this list of conditions and the following disclaimer in the
     13       1.2   bouyer  *    documentation and/or other materials provided with the distribution.
     14       1.2   bouyer  * 3. All advertising materials mentioning features or use of this software
     15       1.2   bouyer  *    must display the following acknowledgement:
     16       1.2   bouyer  *	This product includes software developed by the University of
     17       1.2   bouyer  *	California, Berkeley and its contributors.
     18       1.2   bouyer  * 4. Neither the name of the University nor the names of its contributors
     19       1.2   bouyer  *    may be used to endorse or promote products derived from this software
     20       1.2   bouyer  *    without specific prior written permission.
     21       1.2   bouyer  *
     22       1.2   bouyer  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23       1.2   bouyer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24       1.2   bouyer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25       1.2   bouyer  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26       1.2   bouyer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27       1.2   bouyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28       1.2   bouyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29       1.2   bouyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30       1.2   bouyer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31       1.2   bouyer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32       1.2   bouyer  * SUCH DAMAGE.
     33       1.2   bouyer  *
     34       1.2   bouyer  */
     35       1.2   bouyer 
     36       1.2   bouyer /* Params needed by the controller to perform an ATA bio */
     37       1.2   bouyer struct ata_bio {
     38       1.2   bouyer     volatile u_int16_t flags; /* cmd flags */
     39       1.2   bouyer #define ATA_NOSLEEP 0x0001 /* Can't sleep */
     40       1.2   bouyer #define ATA_POLL    0x0002 /* poll for completion */
     41       1.2   bouyer #define ATA_ITSDONE 0x0004 /* the transfer is as done as it gets */
     42       1.2   bouyer #define ATA_SINGLE  0x0008 /* transfer has to be done in single-sector mode */
     43       1.2   bouyer #define ATA_LBA     0x0010 /* tranfert uses LBA adressing */
     44       1.2   bouyer #define ATA_READ    0x0020 /* tranfert is a read (otherwise a write) */
     45       1.3   bouyer #define ATA_CORR    0x0040 /* transfer had a corrected error */
     46       1.3   bouyer     int multi; /* number of blocks to transfer in multi-mode */
     47       1.2   bouyer     struct disklabel *lp; /* pointer to drive's label info */
     48       1.2   bouyer     daddr_t blkno; /* block addr */
     49       1.2   bouyer     daddr_t blkdone; /* number of blks transfered */
     50       1.2   bouyer     daddr_t nblks; /* number of block currently transfering */
     51       1.2   bouyer     int     nbytes; /* number of bytes currently transfering */
     52       1.2   bouyer     long    bcount; /* total number of bytes */
     53       1.2   bouyer     char*   databuf; /* data buffer adress */
     54       1.2   bouyer     volatile int error;
     55       1.2   bouyer #define NOERROR 0 /* There was no error (r_error invalid) */
     56       1.2   bouyer #define ERROR   1 /* check r_error */
     57       1.2   bouyer #define ERR_DF	2 /* Drive fault */
     58       1.2   bouyer #define ERR_DMA 3 /* DMA error */
     59       1.2   bouyer #define TIMEOUT 4 /* device timed out */
     60  1.3.10.1  thorpej #define ERR_NODEV 5 /* device has been gone */
     61       1.2   bouyer     u_int8_t r_error; /* copy of error register */
     62       1.2   bouyer     daddr_t badsect[127];    /* 126 plus trailing -1 marker */
     63       1.2   bouyer };
     64       1.2   bouyer 
     65       1.2   bouyer /* drive states stored in ata_drive_datas */
     66       1.2   bouyer #define RECAL          0
     67       1.2   bouyer #define RECAL_WAIT     1
     68       1.2   bouyer #define PIOMODE	       2
     69       1.2   bouyer #define PIOMODE_WAIT   3
     70       1.2   bouyer #define DMAMODE        4
     71       1.2   bouyer #define DMAMODE_WAIT   5
     72       1.2   bouyer #define GEOMETRY       6
     73       1.2   bouyer #define GEOMETRY_WAIT  7
     74       1.2   bouyer #define MULTIMODE      8
     75       1.2   bouyer #define MULTIMODE_WAIT 9
     76       1.2   bouyer #define READY          10
     77       1.2   bouyer 
     78       1.2   bouyer int wdc_ata_bio __P((struct ata_drive_datas*, struct ata_bio*));
     79       1.2   bouyer 
     80       1.2   bouyer void wddone __P((void *));
     81