ata-ite.c (230132) | ata-ite.c (233282) |
---|---|
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> | 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 230132 2012-01-15 13:23:18Z uqs $"); | 28__FBSDID("$FreeBSD: head/sys/dev/ata/chipsets/ata-ite.c 233282 2012-03-21 16:59:39Z 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> --- 15 unchanged lines hidden (view full) --- 52#include <ata_if.h> 53 54/* local prototypes */ 55static int ata_ite_chipinit(device_t dev); 56static int ata_ite_ch_attach(device_t dev); 57static int ata_ite_821x_setmode(device_t dev, int target, int mode); 58static int ata_ite_8213_setmode(device_t dev, int target, int mode); 59 | 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> --- 15 unchanged lines hidden (view full) --- 52#include <ata_if.h> 53 54/* local prototypes */ 55static int ata_ite_chipinit(device_t dev); 56static int ata_ite_ch_attach(device_t dev); 57static int ata_ite_821x_setmode(device_t dev, int target, int mode); 58static int ata_ite_8213_setmode(device_t dev, int target, int mode); 59 |
60 | |
61/* 62 * Integrated Technology Express Inc. (ITE) chipset support functions 63 */ 64static int 65ata_ite_probe(device_t dev) 66{ 67 struct ata_pci_controller *ctlr = device_get_softc(dev); | 60/* 61 * Integrated Technology Express Inc. (ITE) chipset support functions 62 */ 63static int 64ata_ite_probe(device_t dev) 65{ 66 struct ata_pci_controller *ctlr = device_get_softc(dev); |
68 static struct ata_chip_id ids[] = | 67 static const struct ata_chip_id const ids[] = |
69 {{ ATA_IT8213F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8213F" }, 70 { ATA_IT8212F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8212F" }, 71 { ATA_IT8211F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8211F" }, 72 { 0, 0, 0, 0, 0, 0}}; 73 74 if (pci_get_vendor(dev) != ATA_ITE_ID) 75 return ENXIO; 76 --- 50 unchanged lines hidden (view full) --- 127ata_ite_821x_setmode(device_t dev, int target, int mode) 128{ 129 device_t parent = device_get_parent(dev); 130 struct ata_pci_controller *ctlr = device_get_softc(parent); 131 struct ata_channel *ch = device_get_softc(dev); 132 int devno = (ch->unit << 1) + target; 133 int piomode; 134 uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); | 68 {{ ATA_IT8213F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8213F" }, 69 { ATA_IT8212F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8212F" }, 70 { ATA_IT8211F, 0x00, 0x00, 0x00, ATA_UDMA6, "IT8211F" }, 71 { 0, 0, 0, 0, 0, 0}}; 72 73 if (pci_get_vendor(dev) != ATA_ITE_ID) 74 return ENXIO; 75 --- 50 unchanged lines hidden (view full) --- 126ata_ite_821x_setmode(device_t dev, int target, int mode) 127{ 128 device_t parent = device_get_parent(dev); 129 struct ata_pci_controller *ctlr = device_get_softc(parent); 130 struct ata_channel *ch = device_get_softc(dev); 131 int devno = (ch->unit << 1) + target; 132 int piomode; 133 uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); |
135 u_int8_t udmatiming[] = | 134 static const uint8_t udmatiming[] = |
136 { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; | 135 { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; |
137 u_int8_t chtiming[] = | 136 static const uint8_t chtiming[] = |
138 { 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 }; 139 140 mode = min(mode, ctlr->chip->max_dma); 141 /* check the CBLID bits for 80 conductor cable detection */ 142 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 143 (pci_read_config(parent, 0x40, 2) & 144 (ch->unit ? (1<<3) : (1<<2)))) { 145 ata_print_cable(dev, "controller"); --- 31 unchanged lines hidden (view full) --- 177 int piomode; 178 u_int16_t reg40 = pci_read_config(parent, 0x40, 2); 179 u_int8_t reg44 = pci_read_config(parent, 0x44, 1); 180 u_int8_t reg48 = pci_read_config(parent, 0x48, 1); 181 u_int16_t reg4a = pci_read_config(parent, 0x4a, 2); 182 u_int16_t reg54 = pci_read_config(parent, 0x54, 2); 183 u_int16_t mask40 = 0, new40 = 0; 184 u_int8_t mask44 = 0, new44 = 0; | 137 { 0xaa, 0xa3, 0xa1, 0x33, 0x31, 0x88, 0x32, 0x31 }; 138 139 mode = min(mode, ctlr->chip->max_dma); 140 /* check the CBLID bits for 80 conductor cable detection */ 141 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 142 (pci_read_config(parent, 0x40, 2) & 143 (ch->unit ? (1<<3) : (1<<2)))) { 144 ata_print_cable(dev, "controller"); --- 31 unchanged lines hidden (view full) --- 176 int piomode; 177 u_int16_t reg40 = pci_read_config(parent, 0x40, 2); 178 u_int8_t reg44 = pci_read_config(parent, 0x44, 1); 179 u_int8_t reg48 = pci_read_config(parent, 0x48, 1); 180 u_int16_t reg4a = pci_read_config(parent, 0x4a, 2); 181 u_int16_t reg54 = pci_read_config(parent, 0x54, 2); 182 u_int16_t mask40 = 0, new40 = 0; 183 u_int8_t mask44 = 0, new44 = 0; |
185 u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; 186 u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; | 184 static const uint8_t timings[] = 185 { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; 186 static const uint8_t utimings[] = 187 { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; |
187 188 mode = min(mode, ctlr->chip->max_dma); 189 190 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 191 !(reg54 & (0x10 << target))) { 192 ata_print_cable(dev, "controller"); 193 mode = ATA_UDMA2; 194 } --- 40 unchanged lines hidden --- | 188 189 mode = min(mode, ctlr->chip->max_dma); 190 191 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 192 !(reg54 & (0x10 << target))) { 193 ata_print_cable(dev, "controller"); 194 mode = ATA_UDMA2; 195 } --- 40 unchanged lines hidden --- |