wdvar.h revision 1.2 1 /* $NetBSD: wdvar.h,v 1.2 1998/10/12 16:09:17 bouyer Exp $ */
2
3 /*
4 * Copyright (c) 1998 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 the University of
17 * California, Berkeley and its contributors.
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 REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
35
36 /* Params needed by the controller to perform an ATA bio */
37 struct ata_bio {
38 volatile u_int16_t flags; /* cmd flags */
39 #define ATA_NOSLEEP 0x0001 /* Can't sleep */
40 #define ATA_POLL 0x0002 /* poll for completion */
41 #define ATA_ITSDONE 0x0004 /* the transfer is as done as it gets */
42 #define ATA_SINGLE 0x0008 /* transfer has to be done in single-sector mode */
43 #define ATA_LBA 0x0010 /* tranfert uses LBA adressing */
44 #define ATA_READ 0x0020 /* tranfert is a read (otherwise a write) */
45 #define ATA_CORR 0x0040 /* transfert had a corrected error */
46 int multi; /* number of blocks to transfert in multi-mode */
47 struct disklabel *lp; /* pointer to drive's label info */
48 daddr_t blkno; /* block addr */
49 daddr_t blkdone; /* number of blks transfered */
50 daddr_t nblks; /* number of block currently transfering */
51 int nbytes; /* number of bytes currently transfering */
52 long bcount; /* total number of bytes */
53 char* databuf; /* data buffer adress */
54 volatile int error;
55 #define NOERROR 0 /* There was no error (r_error invalid) */
56 #define ERROR 1 /* check r_error */
57 #define ERR_DF 2 /* Drive fault */
58 #define ERR_DMA 3 /* DMA error */
59 #define TIMEOUT 4 /* device timed out */
60 u_int8_t r_error; /* copy of error register */
61 daddr_t badsect[127]; /* 126 plus trailing -1 marker */
62 };
63
64 /* drive states stored in ata_drive_datas */
65 #define RECAL 0
66 #define RECAL_WAIT 1
67 #define PIOMODE 2
68 #define PIOMODE_WAIT 3
69 #define DMAMODE 4
70 #define DMAMODE_WAIT 5
71 #define GEOMETRY 6
72 #define GEOMETRY_WAIT 7
73 #define MULTIMODE 8
74 #define MULTIMODE_WAIT 9
75 #define READY 10
76
77 int wdc_ata_bio __P((struct ata_drive_datas*, struct ata_bio*));
78
79 void wddone __P((void *));
80