wdvar.h revision 1.7 1 1.7 wiz /* $NetBSD: wdvar.h,v 1.7 2001/07/08 18:06:45 wiz 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.6 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.6 bouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.6 bouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.6 bouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.6 bouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.6 bouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.6 bouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.6 bouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.6 bouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.6 bouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.2 bouyer *
33 1.2 bouyer */
34 1.2 bouyer
35 1.2 bouyer /* Params needed by the controller to perform an ATA bio */
36 1.2 bouyer struct ata_bio {
37 1.2 bouyer volatile u_int16_t flags; /* cmd flags */
38 1.2 bouyer #define ATA_NOSLEEP 0x0001 /* Can't sleep */
39 1.2 bouyer #define ATA_POLL 0x0002 /* poll for completion */
40 1.2 bouyer #define ATA_ITSDONE 0x0004 /* the transfer is as done as it gets */
41 1.2 bouyer #define ATA_SINGLE 0x0008 /* transfer has to be done in single-sector mode */
42 1.7 wiz #define ATA_LBA 0x0010 /* transfer uses LBA adressing */
43 1.7 wiz #define ATA_READ 0x0020 /* transfer is a read (otherwise a write) */
44 1.3 bouyer #define ATA_CORR 0x0040 /* transfer had a corrected error */
45 1.3 bouyer int multi; /* number of blocks to transfer in multi-mode */
46 1.2 bouyer struct disklabel *lp; /* pointer to drive's label info */
47 1.2 bouyer daddr_t blkno; /* block addr */
48 1.7 wiz daddr_t blkdone; /* number of blks transferred */
49 1.7 wiz daddr_t nblks; /* number of block currently transferring */
50 1.7 wiz int nbytes; /* number of bytes currently transferring */
51 1.2 bouyer long bcount; /* total number of bytes */
52 1.2 bouyer char* databuf; /* data buffer adress */
53 1.2 bouyer volatile int error;
54 1.2 bouyer #define NOERROR 0 /* There was no error (r_error invalid) */
55 1.2 bouyer #define ERROR 1 /* check r_error */
56 1.2 bouyer #define ERR_DF 2 /* Drive fault */
57 1.2 bouyer #define ERR_DMA 3 /* DMA error */
58 1.2 bouyer #define TIMEOUT 4 /* device timed out */
59 1.4 enami #define ERR_NODEV 5 /* device has been gone */
60 1.2 bouyer u_int8_t r_error; /* copy of error register */
61 1.2 bouyer daddr_t badsect[127]; /* 126 plus trailing -1 marker */
62 1.2 bouyer };
63 1.2 bouyer
64 1.2 bouyer int wdc_ata_bio __P((struct ata_drive_datas*, struct ata_bio*));
65 1.2 bouyer
66 1.2 bouyer void wddone __P((void *));
67