ata_kauai.c (217756) | ata_kauai.c (249213) |
---|---|
1/*- 2 * Copyright 2004 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. --- 12 unchanged lines hidden (view full) --- 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 */ 28#include <sys/cdefs.h> | 1/*- 2 * Copyright 2004 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. --- 12 unchanged lines hidden (view full) --- 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 */ 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/ata_kauai.c 217756 2011-01-23 17:20:11Z nwhitehorn $"); | 29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/ata_kauai.c 249213 2013-04-06 19:12:49Z marius $"); |
30 31/* 32 * Mac 'Kauai' PCI ATA controller 33 */ | 30 31/* 32 * Mac 'Kauai' PCI ATA controller 33 */ |
34#include "opt_ata.h" | |
35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/bus.h> 40#include <sys/malloc.h> 41#include <sys/sema.h> 42#include <sys/taskqueue.h> --- 51 unchanged lines hidden (view full) --- 94 DEVMETHOD(device_attach, ata_kauai_attach), 95 DEVMETHOD(device_detach, bus_generic_detach), 96 DEVMETHOD(device_shutdown, bus_generic_shutdown), 97 DEVMETHOD(device_suspend, bus_generic_suspend), 98 DEVMETHOD(device_resume, bus_generic_resume), 99 100 /* ATA interface */ 101 DEVMETHOD(ata_setmode, ata_kauai_setmode), | 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> --- 51 unchanged lines hidden (view full) --- 93 DEVMETHOD(device_attach, ata_kauai_attach), 94 DEVMETHOD(device_detach, bus_generic_detach), 95 DEVMETHOD(device_shutdown, bus_generic_shutdown), 96 DEVMETHOD(device_suspend, bus_generic_suspend), 97 DEVMETHOD(device_resume, bus_generic_resume), 98 99 /* ATA interface */ 100 DEVMETHOD(ata_setmode, ata_kauai_setmode), |
102 { 0, 0 } | 101 DEVMETHOD_END |
103}; 104 105struct ata_kauai_softc { 106 struct ata_dbdma_channel sc_ch; 107 108 struct resource *sc_memr; 109 110 int shasta; --- 4 unchanged lines hidden (view full) --- 115}; 116 117static driver_t ata_kauai_driver = { 118 "ata", 119 ata_kauai_methods, 120 sizeof(struct ata_kauai_softc), 121}; 122 | 102}; 103 104struct ata_kauai_softc { 105 struct ata_dbdma_channel sc_ch; 106 107 struct resource *sc_memr; 108 109 int shasta; --- 4 unchanged lines hidden (view full) --- 114}; 115 116static driver_t ata_kauai_driver = { 117 "ata", 118 ata_kauai_methods, 119 sizeof(struct ata_kauai_softc), 120}; 121 |
123DRIVER_MODULE(ata, pci, ata_kauai_driver, ata_devclass, 0, 0); | 122DRIVER_MODULE(ata, pci, ata_kauai_driver, ata_devclass, NULL, NULL); |
124MODULE_DEPEND(ata, ata, 1, 1, 1); 125 126/* 127 * PCI ID search table 128 */ | 123MODULE_DEPEND(ata, ata, 1, 1, 1); 124 125/* 126 * PCI ID search table 127 */ |
129static struct kauai_pci_dev { 130 u_int32_t kpd_devid; 131 char *kpd_desc; | 128static const struct kauai_pci_dev { 129 u_int32_t kpd_devid; 130 const char *kpd_desc; |
132} kauai_pci_devlist[] = { 133 { 0x0033106b, "Uninorth2 Kauai ATA Controller" }, 134 { 0x003b106b, "Intrepid Kauai ATA Controller" }, 135 { 0x0043106b, "K2 Kauai ATA Controller" }, 136 { 0x0050106b, "Shasta Kauai ATA Controller" }, 137 { 0x0069106b, "Intrepid-2 Kauai ATA Controller" }, 138 { 0, NULL } 139}; --- 7 unchanged lines hidden (view full) --- 147 148static const u_int pio_timing_kauai[] = { 149 0x08000a92, /* PIO0 */ 150 0x0800060f, /* PIO1 */ 151 0x0800038b, /* PIO2 */ 152 0x05000249, /* PIO3 */ 153 0x04000148 /* PIO4 */ 154}; | 131} kauai_pci_devlist[] = { 132 { 0x0033106b, "Uninorth2 Kauai ATA Controller" }, 133 { 0x003b106b, "Intrepid Kauai ATA Controller" }, 134 { 0x0043106b, "K2 Kauai ATA Controller" }, 135 { 0x0050106b, "Shasta Kauai ATA Controller" }, 136 { 0x0069106b, "Intrepid-2 Kauai ATA Controller" }, 137 { 0, NULL } 138}; --- 7 unchanged lines hidden (view full) --- 146 147static const u_int pio_timing_kauai[] = { 148 0x08000a92, /* PIO0 */ 149 0x0800060f, /* PIO1 */ 150 0x0800038b, /* PIO2 */ 151 0x05000249, /* PIO3 */ 152 0x04000148 /* PIO4 */ 153}; |
154 |
|
155static const u_int pio_timing_shasta[] = { 156 0x0a000c97, /* PIO0 */ 157 0x07000712, /* PIO1 */ 158 0x040003cd, /* PIO2 */ 159 0x0400028b, /* PIO3 */ 160 0x0400010a /* PIO4 */ 161}; 162 163static const u_int dma_timing_kauai[] = { 164 0x00618000, /* WDMA0 */ 165 0x00209000, /* WDMA1 */ 166 0x00148000 /* WDMA2 */ 167}; | 155static const u_int pio_timing_shasta[] = { 156 0x0a000c97, /* PIO0 */ 157 0x07000712, /* PIO1 */ 158 0x040003cd, /* PIO2 */ 159 0x0400028b, /* PIO3 */ 160 0x0400010a /* PIO4 */ 161}; 162 163static const u_int dma_timing_kauai[] = { 164 0x00618000, /* WDMA0 */ 165 0x00209000, /* WDMA1 */ 166 0x00148000 /* WDMA2 */ 167}; |
168 |
|
168static const u_int dma_timing_shasta[] = { 169 0x00820800, /* WDMA0 */ 170 0x0028b000, /* WDMA1 */ 171 0x001ca000 /* WDMA2 */ 172}; 173 174static const u_int udma_timing_kauai[] = { 175 0x000070c1, /* UDMA0 */ 176 0x00005d81, /* UDMA1 */ 177 0x00004a61, /* UDMA2 */ 178 0x00003a51, /* UDMA3 */ 179 0x00002a31, /* UDMA4 */ 180 0x00002921 /* UDMA5 */ 181}; | 169static const u_int dma_timing_shasta[] = { 170 0x00820800, /* WDMA0 */ 171 0x0028b000, /* WDMA1 */ 172 0x001ca000 /* WDMA2 */ 173}; 174 175static const u_int udma_timing_kauai[] = { 176 0x000070c1, /* UDMA0 */ 177 0x00005d81, /* UDMA1 */ 178 0x00004a61, /* UDMA2 */ 179 0x00003a51, /* UDMA3 */ 180 0x00002a31, /* UDMA4 */ 181 0x00002921 /* UDMA5 */ 182}; |
183 |
|
182static const u_int udma_timing_shasta[] = { 183 0x00035901, /* UDMA0 */ 184 0x000348b1, /* UDMA1 */ 185 0x00033881, /* UDMA2 */ 186 0x00033861, /* UDMA3 */ 187 0x00033841, /* UDMA4 */ 188 0x00033031, /* UDMA5 */ 189 0x00033021 /* UDMA6 */ --- 173 unchanged lines hidden (view full) --- 363 struct ata_kauai_softc *sc = device_get_softc(request->parent); 364 365 bus_write_4(sc->sc_memr, UDMA_CONFIG_REG, sc->udmaconf[request->unit]); 366 bus_write_4(sc->sc_memr, PIO_CONFIG_REG, 367 sc->wdmaconf[request->unit] | sc->pioconf[request->unit]); 368 369 return ata_begin_transaction(request); 370} | 184static const u_int udma_timing_shasta[] = { 185 0x00035901, /* UDMA0 */ 186 0x000348b1, /* UDMA1 */ 187 0x00033881, /* UDMA2 */ 188 0x00033861, /* UDMA3 */ 189 0x00033841, /* UDMA4 */ 190 0x00033031, /* UDMA5 */ 191 0x00033021 /* UDMA6 */ --- 173 unchanged lines hidden (view full) --- 365 struct ata_kauai_softc *sc = device_get_softc(request->parent); 366 367 bus_write_4(sc->sc_memr, UDMA_CONFIG_REG, sc->udmaconf[request->unit]); 368 bus_write_4(sc->sc_memr, PIO_CONFIG_REG, 369 sc->wdmaconf[request->unit] | sc->pioconf[request->unit]); 370 371 return ata_begin_transaction(request); 372} |
371 | |