Deleted Added
full compact
ata_macio.c (200171) ata_macio.c (249213)
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/powerpc/powermac/ata_macio.c 200171 2009-12-06 00:10:13Z mav $
28 */
29
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/ata_macio.c 249213 2013-04-06 19:12:49Z marius $");
30
30/*
31 * Mac-io ATA controller
32 */
31/*
32 * Mac-io ATA controller
33 */
33#include "opt_ata.h"
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/module.h>
38#include <sys/bus.h>
39#include <sys/malloc.h>
40#include <sys/sema.h>
41#include <sys/taskqueue.h>

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

80#define DMA_REC_MIN 1
81#define DMA_ACT_MIN 1
82
83struct ide_timings {
84 int cycle; /* minimum cycle time [ns] */
85 int active; /* minimum command active time [ns] */
86};
87
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/module.h>
38#include <sys/bus.h>
39#include <sys/malloc.h>
40#include <sys/sema.h>
41#include <sys/taskqueue.h>

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

80#define DMA_REC_MIN 1
81#define DMA_ACT_MIN 1
82
83struct ide_timings {
84 int cycle; /* minimum cycle time [ns] */
85 int active; /* minimum command active time [ns] */
86};
87
88struct ide_timings pio_timings[5] = {
88static const struct ide_timings pio_timings[5] = {
89 { 600, 180 }, /* PIO 0 */
90 { 390, 150 }, /* PIO 1 */
91 { 240, 105 }, /* PIO 2 */
92 { 180, 90 }, /* PIO 3 */
93 { 120, 75 } /* PIO 4 */
94};
95
96static const struct ide_timings dma_timings[3] = {

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

117
118static device_method_t ata_macio_methods[] = {
119 /* Device interface */
120 DEVMETHOD(device_probe, ata_macio_probe),
121 DEVMETHOD(device_attach, ata_macio_attach),
122
123 /* ATA interface */
124 DEVMETHOD(ata_setmode, ata_macio_setmode),
89 { 600, 180 }, /* PIO 0 */
90 { 390, 150 }, /* PIO 1 */
91 { 240, 105 }, /* PIO 2 */
92 { 180, 90 }, /* PIO 3 */
93 { 120, 75 } /* PIO 4 */
94};
95
96static const struct ide_timings dma_timings[3] = {

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

117
118static device_method_t ata_macio_methods[] = {
119 /* Device interface */
120 DEVMETHOD(device_probe, ata_macio_probe),
121 DEVMETHOD(device_attach, ata_macio_attach),
122
123 /* ATA interface */
124 DEVMETHOD(ata_setmode, ata_macio_setmode),
125 { 0, 0 }
125 DEVMETHOD_END
126};
127
128struct ata_macio_softc {
129 struct ata_dbdma_channel sc_ch;
130
131 int rev;
132 int max_mode;
133 struct resource *sc_mem;

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

138};
139
140static driver_t ata_macio_driver = {
141 "ata",
142 ata_macio_methods,
143 sizeof(struct ata_macio_softc),
144};
145
126};
127
128struct ata_macio_softc {
129 struct ata_dbdma_channel sc_ch;
130
131 int rev;
132 int max_mode;
133 struct resource *sc_mem;

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

138};
139
140static driver_t ata_macio_driver = {
141 "ata",
142 ata_macio_methods,
143 sizeof(struct ata_macio_softc),
144};
145
146DRIVER_MODULE(ata, macio, ata_macio_driver, ata_devclass, 0, 0);
146DRIVER_MODULE(ata, macio, ata_macio_driver, ata_devclass, NULL, NULL);
147MODULE_DEPEND(ata, ata, 1, 1, 1);
148
149static int
150ata_macio_probe(device_t dev)
151{
152 const char *type = ofw_bus_get_type(dev);
153 const char *name = ofw_bus_get_name(dev);
154 struct ata_macio_softc *sc;

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

327 struct ata_macio_softc *sc = device_get_softc(request->parent);
328
329 bus_write_4(sc->sc_mem, ATA_MACIO_TIMINGREG,
330 sc->udmaconf[request->unit] | sc->wdmaconf[request->unit]
331 | sc->pioconf[request->unit]);
332
333 return ata_begin_transaction(request);
334}
147MODULE_DEPEND(ata, ata, 1, 1, 1);
148
149static int
150ata_macio_probe(device_t dev)
151{
152 const char *type = ofw_bus_get_type(dev);
153 const char *name = ofw_bus_get_name(dev);
154 struct ata_macio_softc *sc;

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

327 struct ata_macio_softc *sc = device_get_softc(request->parent);
328
329 bus_write_4(sc->sc_mem, ATA_MACIO_TIMINGREG,
330 sc->udmaconf[request->unit] | sc->wdmaconf[request->unit]
331 | sc->pioconf[request->unit]);
332
333 return ata_begin_transaction(request);
334}
335