root/dev/ata/wdvar.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


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

/* [<][>][^][v][top][bottom][index][help] */