Deleted Added
sdiff udiff text old ( 200459 ) new ( 200753 )
full compact
1/*-
2 * Copyright (c) 1998 - 2008 S�ren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/ata/chipsets/ata-ite.c 200459 2009-12-13 00:13:21Z marius $");
29
30#include "opt_ata.h"
31#include <sys/param.h>
32#include <sys/module.h>
33#include <sys/systm.h>
34#include <sys/kernel.h>
35#include <sys/ata.h>
36#include <sys/bus.h>

--- 63 unchanged lines hidden (view full) ---

100 /* set PCI mode and 66Mhz reference clock */
101 pci_write_config(dev, 0x50, pci_read_config(dev, 0x50, 1) & ~0x83, 1);
102
103 /* set default active & recover timings */
104 pci_write_config(dev, 0x54, 0x31, 1);
105 pci_write_config(dev, 0x56, 0x31, 1);
106
107 ctlr->setmode = ata_ite_821x_setmode;
108 }
109 ctlr->ch_attach = ata_ite_ch_attach;
110 return 0;
111}
112
113static int
114ata_ite_ch_attach(device_t dev)
115{

--- 8 unchanged lines hidden (view full) ---

124static int
125ata_ite_821x_setmode(device_t dev, int target, int mode)
126{
127 device_t parent = device_get_parent(dev);
128 struct ata_pci_controller *ctlr = device_get_softc(parent);
129 struct ata_channel *ch = device_get_softc(dev);
130 int devno = (ch->unit << 1) + target;
131 int piomode;
132 u_int8_t udmatiming[] =
133 { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 };
134 u_int8_t chtiming[] =
135 { 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 };
136
137 mode = min(mode, ctlr->chip->max_dma);
138 /* check the CBLID bits for 80 conductor cable detection */
139 if (mode > ATA_UDMA2 && (pci_read_config(parent, 0x40, 2) &

--- 13 unchanged lines hidden (view full) ---

153 piomode = ATA_PIO4;
154 } else {
155 /* disable UDMA mode */
156 pci_write_config(parent, 0x50,
157 pci_read_config(parent, 0x50, 1) |
158 (1 << (devno + 3)), 1);
159 piomode = mode;
160 }
161 /* set active and recover timing (shared between master & slave) */
162 if (pci_read_config(parent, 0x54 + (ch->unit << 2), 1) <
163 chtiming[ata_mode2idx(piomode)])
164 pci_write_config(parent, 0x54 + (ch->unit << 2),
165 chtiming[ata_mode2idx(piomode)], 1);
166 return (mode);
167}
168
169static int
170ata_ite_8213_setmode(device_t dev, int target, int mode)
171{
172 device_t parent = device_get_parent(dev);
173 struct ata_pci_controller *ctlr = device_get_softc(parent);

--- 57 unchanged lines hidden ---