ata-siliconimage.c (230627) | ata-siliconimage.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-siliconimage.c 230627 2012-01-27 21:52:59Z marius $"); | 28__FBSDID("$FreeBSD: head/sys/dev/ata/chipsets/ata-siliconimage.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> --- 45 unchanged lines hidden (view full) --- 82 83/* 84 * Silicon Image Inc. (SiI) (former CMD) chipset support functions 85 */ 86static int 87ata_sii_probe(device_t dev) 88{ 89 struct ata_pci_controller *ctlr = device_get_softc(dev); | 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> --- 45 unchanged lines hidden (view full) --- 82 83/* 84 * Silicon Image Inc. (SiI) (former CMD) chipset support functions 85 */ 86static int 87ata_sii_probe(device_t dev) 88{ 89 struct ata_pci_controller *ctlr = device_get_softc(dev); |
90 static struct ata_chip_id ids[] = | 90 static const struct ata_chip_id const ids[] = |
91 {{ ATA_SII3114, 0x00, SII_MEMIO, SII_4CH, ATA_SA150, "3114" }, 92 { ATA_SII3512, 0x02, SII_MEMIO, 0, ATA_SA150, "3512" }, 93 { ATA_SII3112, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, 94 { ATA_SII3112_1, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, 95 { ATA_SII3512, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3512" }, 96 { ATA_SII3112, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, 97 { ATA_SII3112_1, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, 98 { ATA_SII3124, 0x00, SII_PRBIO, SII_4CH, ATA_SA300, "3124" }, --- 168 unchanged lines hidden (view full) --- 267{ 268 device_t parent = device_get_parent(dev); 269 struct ata_pci_controller *ctlr = device_get_softc(parent); 270 struct ata_channel *ch = device_get_softc(dev); 271 int devno = (ch->unit << 1) + target; 272 int treg = 0x54 + ((devno < 3) ? (devno << 1) : 7); 273 int ureg = ch->unit ? 0x7b : 0x73; 274 int piomode; | 91 {{ ATA_SII3114, 0x00, SII_MEMIO, SII_4CH, ATA_SA150, "3114" }, 92 { ATA_SII3512, 0x02, SII_MEMIO, 0, ATA_SA150, "3512" }, 93 { ATA_SII3112, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, 94 { ATA_SII3112_1, 0x02, SII_MEMIO, 0, ATA_SA150, "3112" }, 95 { ATA_SII3512, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3512" }, 96 { ATA_SII3112, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, 97 { ATA_SII3112_1, 0x00, SII_MEMIO, SII_BUG, ATA_SA150, "3112" }, 98 { ATA_SII3124, 0x00, SII_PRBIO, SII_4CH, ATA_SA300, "3124" }, --- 168 unchanged lines hidden (view full) --- 267{ 268 device_t parent = device_get_parent(dev); 269 struct ata_pci_controller *ctlr = device_get_softc(parent); 270 struct ata_channel *ch = device_get_softc(dev); 271 int devno = (ch->unit << 1) + target; 272 int treg = 0x54 + ((devno < 3) ? (devno << 1) : 7); 273 int ureg = ch->unit ? 0x7b : 0x73; 274 int piomode; |
275 uint8_t piotimings[] = { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f }; 276 uint8_t udmatimings[][2] = { { 0x31, 0xc2 }, { 0x21, 0x82 }, 277 { 0x11, 0x42 }, { 0x25, 0x8a }, 278 { 0x15, 0x4a }, { 0x05, 0x0a } }; | 275 static const uint8_t piotimings[] = 276 { 0xa9, 0x57, 0x44, 0x32, 0x3f, 0x87, 0x32, 0x3f }; 277 static const uint8_t udmatimings[][2] = 278 { { 0x31, 0xc2 }, { 0x21, 0x82 }, { 0x11, 0x42 }, 279 { 0x25, 0x8a }, { 0x15, 0x4a }, { 0x05, 0x0a } }; |
279 280 mode = min(mode, ctlr->chip->max_dma); 281 if (mode >= ATA_UDMA0) { 282 u_int8_t umode = pci_read_config(parent, ureg, 1); 283 284 umode &= ~(target == 0 ? 0x35 : 0xca); 285 umode |= udmatimings[mode & ATA_MODE_MASK][target]; 286 pci_write_config(parent, ureg, umode, 1); --- 118 unchanged lines hidden (view full) --- 405 int rego = (ch->unit << 4) + (target << 1); 406 int mreg = ch->unit ? 0x84 : 0x80; 407 int mask = 0x03 << (target << 2); 408 int mval = pci_read_config(parent, mreg, 1) & ~mask; 409 int piomode; 410 u_int8_t preg = 0xa4 + rego; 411 u_int8_t dreg = 0xa8 + rego; 412 u_int8_t ureg = 0xac + rego; | 280 281 mode = min(mode, ctlr->chip->max_dma); 282 if (mode >= ATA_UDMA0) { 283 u_int8_t umode = pci_read_config(parent, ureg, 1); 284 285 umode &= ~(target == 0 ? 0x35 : 0xca); 286 umode |= udmatimings[mode & ATA_MODE_MASK][target]; 287 pci_write_config(parent, ureg, umode, 1); --- 118 unchanged lines hidden (view full) --- 406 int rego = (ch->unit << 4) + (target << 1); 407 int mreg = ch->unit ? 0x84 : 0x80; 408 int mask = 0x03 << (target << 2); 409 int mval = pci_read_config(parent, mreg, 1) & ~mask; 410 int piomode; 411 u_int8_t preg = 0xa4 + rego; 412 u_int8_t dreg = 0xa8 + rego; 413 u_int8_t ureg = 0xac + rego; |
413 u_int16_t piotimings[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 414 u_int16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 }; 415 u_int8_t udmatimings[] = { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 }; | 414 static const uint16_t piotimings[] = 415 { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 416 static const uint16_t dmatimings[] = { 0x2208, 0x10c2, 0x10c1 }; 417 static const uint8_t udmatimings[] = 418 { 0xf, 0xb, 0x7, 0x5, 0x3, 0x2, 0x1 }; |
416 417 mode = min(mode, ctlr->chip->max_dma); 418 419 if (ctlr->chip->cfg2 & SII_SETCLK) { 420 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 421 (pci_read_config(parent, 0x79, 1) & 422 (ch->unit ? 0x02 : 0x01))) { 423 ata_print_cable(dev, "controller"); --- 529 unchanged lines hidden --- | 419 420 mode = min(mode, ctlr->chip->max_dma); 421 422 if (ctlr->chip->cfg2 & SII_SETCLK) { 423 if (ata_dma_check_80pin && mode > ATA_UDMA2 && 424 (pci_read_config(parent, 0x79, 1) & 425 (ch->unit ? 0x02 : 0x01))) { 426 ata_print_cable(dev, "controller"); --- 529 unchanged lines hidden --- |