1 /* $NetBSD: wdvar.h,v 1.6.38.1 2007/10/03 19:23:05 garbled Exp $ */
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * Copyright (c) 2001 Dynarc AB, Sweden. All rights reserved.
7 * This code is derived from software written by Anders Magnusson,
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _STAND_WDVAR_H
34 #define _STAND_WDVAR_H
36 #include <dev/ic/wdcreg.h>
37 #include <dev/ata/atareg.h>
38 #include <dev/pci/pciidereg.h>
40 #include <mips/cpuregs.h>
42 #include <sys/disklabel.h>
43 #include <sys/bootblock.h>
45 #define WDC_TIMEOUT 2000000
46 #define PCIIDE_CHANNEL_NDEV 2
47 #define NUNITS (PCIIDE_CHANNEL_NDEV * PCIIDE_NUM_CHANNELS)
48 #define WDC_NPORTS 8 /* XXX */
49 #define WDC_NSHADOWREG 2 /* XXX */
52 volatile uint8_t *c_cmdbase
;
53 volatile uint8_t *c_ctlbase
;
54 volatile uint8_t *c_cmdreg
[WDC_NPORTS
+ WDC_NSHADOWREG
];
55 volatile uint16_t *c_data
;
60 #define WDC_READ_REG(chp, reg) *(chp)->c_cmdreg[(reg)]
61 #define WDC_WRITE_REG(chp, reg, val) *(chp)->c_cmdreg[(reg)] = (val)
62 #define WDC_READ_CTLREG(chp, reg) (chp)->c_ctlbase[(reg)]
63 #define WDC_WRITE_CTLREG(chp, reg, val) (chp)->c_ctlbase[(reg)] = (val)
64 #define WDC_READ_DATA(chp) *(chp)->c_data
67 #define WDF_LBA 0x0001
68 #define WDF_LBA48 0x0002
76 struct ataparams sc_params
;
77 struct disklabel sc_label
;
78 struct wdc_channel sc_channel
;
82 uint8_t drive
; /* drive id */
84 uint8_t r_command
; /* Parameters to upload to registers */
97 int wdc_init(struct wd_softc
*, u_int
*);
98 int wdccommand(struct wd_softc
*, struct wdc_command
*);
99 int wdccommandext(struct wd_softc
*, struct wdc_command
*);
100 int wdc_exec_read(struct wd_softc
*, uint8_t, daddr_t
, void *);
101 int wdc_exec_identify(struct wd_softc
*, void *);
103 int pciide_init(struct wdc_channel
*, u_int
*);
105 #endif /* _STAND_WDVAR_H */