Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[PATCH] libata: Remove dependence on host_set->dev for SAS
[PATCH] libata: ata_scsi_ioctl cleanup
[PATCH] libata: ata_scsi_queuecmd cleanup
[libata] export ata_dev_pair; trim trailing whitespace
[PATCH] libata: add ata_dev_pair helper
[PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
[PATCH] libata: make ata_set_mode() responsible for failure handling
[PATCH] libata: use ata_dev_disable() in ata_bus_probe()
[PATCH] libata: implement ata_dev_disable()
[PATCH] libata: check if port is disabled after internal command
[PATCH] libata: make per-dev transfer mode limits per-dev
[PATCH] libata: add per-dev pio/mwdma/udma_mask
[PATCH] libata: implement ata_unpack_xfermask()
[libata] Move some bmdma-specific code to libata-bmdma.c
[libata sata_uli] kill scr_addr abuse
[libata sata_nv] eliminate duplicate codepaths with iomap
[libata sata_nv] cleanups: convert #defines to enums; remove in-file history
[libata sata_sil24] cleanups: use pci_iomap(), kzalloc()

+548 -503
+3 -3
drivers/scsi/ata_piix.c
··· 742 742 /** 743 743 * piix_check_450nx_errata - Check for problem 450NX setup 744 744 * @ata_dev: the PCI device to check 745 - * 745 + * 746 746 * Check for the present of 450NX errata #19 and errata #25. If 747 747 * they are found return an error code so we can turn off DMA 748 748 */ ··· 753 753 u16 cfg; 754 754 u8 rev; 755 755 int no_piix_dma = 0; 756 - 756 + 757 757 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL) 758 758 { 759 759 /* Look for 450NX PXB. Check for problem configurations ··· 772 772 if(no_piix_dma == 2) 773 773 dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n"); 774 774 return no_piix_dma; 775 - } 775 + } 776 776 777 777 static void __devinit piix_init_sata_map(struct pci_dev *pdev, 778 778 struct ata_port_info *pinfo)
+236 -2
drivers/scsi/libata-bmdma.c
··· 418 418 return inb(ap->ioaddr.altstatus_addr); 419 419 } 420 420 421 + /** 422 + * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction 423 + * @qc: Info associated with this ATA transaction. 424 + * 425 + * LOCKING: 426 + * spin_lock_irqsave(host_set lock) 427 + */ 428 + 429 + static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) 430 + { 431 + struct ata_port *ap = qc->ap; 432 + unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 433 + u8 dmactl; 434 + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 435 + 436 + /* load PRD table addr. */ 437 + mb(); /* make sure PRD table writes are visible to controller */ 438 + writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); 439 + 440 + /* specify data direction, triple-check start bit is clear */ 441 + dmactl = readb(mmio + ATA_DMA_CMD); 442 + dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); 443 + if (!rw) 444 + dmactl |= ATA_DMA_WR; 445 + writeb(dmactl, mmio + ATA_DMA_CMD); 446 + 447 + /* issue r/w command */ 448 + ap->ops->exec_command(ap, &qc->tf); 449 + } 450 + 451 + /** 452 + * ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction 453 + * @qc: Info associated with this ATA transaction. 454 + * 455 + * LOCKING: 456 + * spin_lock_irqsave(host_set lock) 457 + */ 458 + 459 + static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) 460 + { 461 + struct ata_port *ap = qc->ap; 462 + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 463 + u8 dmactl; 464 + 465 + /* start host DMA transaction */ 466 + dmactl = readb(mmio + ATA_DMA_CMD); 467 + writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); 468 + 469 + /* Strictly, one may wish to issue a readb() here, to 470 + * flush the mmio write. However, control also passes 471 + * to the hardware at this point, and it will interrupt 472 + * us when we are to resume control. So, in effect, 473 + * we don't care when the mmio write flushes. 474 + * Further, a read of the DMA status register _immediately_ 475 + * following the write may not be what certain flaky hardware 476 + * is expected, so I think it is best to not add a readb() 477 + * without first all the MMIO ATA cards/mobos. 478 + * Or maybe I'm just being paranoid. 479 + */ 480 + } 481 + 482 + /** 483 + * ata_bmdma_setup_pio - Set up PCI IDE BMDMA transaction (PIO) 484 + * @qc: Info associated with this ATA transaction. 485 + * 486 + * LOCKING: 487 + * spin_lock_irqsave(host_set lock) 488 + */ 489 + 490 + static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) 491 + { 492 + struct ata_port *ap = qc->ap; 493 + unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 494 + u8 dmactl; 495 + 496 + /* load PRD table addr. */ 497 + outl(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); 498 + 499 + /* specify data direction, triple-check start bit is clear */ 500 + dmactl = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 501 + dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); 502 + if (!rw) 503 + dmactl |= ATA_DMA_WR; 504 + outb(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 505 + 506 + /* issue r/w command */ 507 + ap->ops->exec_command(ap, &qc->tf); 508 + } 509 + 510 + /** 511 + * ata_bmdma_start_pio - Start a PCI IDE BMDMA transaction (PIO) 512 + * @qc: Info associated with this ATA transaction. 513 + * 514 + * LOCKING: 515 + * spin_lock_irqsave(host_set lock) 516 + */ 517 + 518 + static void ata_bmdma_start_pio (struct ata_queued_cmd *qc) 519 + { 520 + struct ata_port *ap = qc->ap; 521 + u8 dmactl; 522 + 523 + /* start host DMA transaction */ 524 + dmactl = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 525 + outb(dmactl | ATA_DMA_START, 526 + ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 527 + } 528 + 529 + 530 + /** 531 + * ata_bmdma_start - Start a PCI IDE BMDMA transaction 532 + * @qc: Info associated with this ATA transaction. 533 + * 534 + * Writes the ATA_DMA_START flag to the DMA command register. 535 + * 536 + * May be used as the bmdma_start() entry in ata_port_operations. 537 + * 538 + * LOCKING: 539 + * spin_lock_irqsave(host_set lock) 540 + */ 541 + void ata_bmdma_start(struct ata_queued_cmd *qc) 542 + { 543 + if (qc->ap->flags & ATA_FLAG_MMIO) 544 + ata_bmdma_start_mmio(qc); 545 + else 546 + ata_bmdma_start_pio(qc); 547 + } 548 + 549 + 550 + /** 551 + * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 552 + * @qc: Info associated with this ATA transaction. 553 + * 554 + * Writes address of PRD table to device's PRD Table Address 555 + * register, sets the DMA control register, and calls 556 + * ops->exec_command() to start the transfer. 557 + * 558 + * May be used as the bmdma_setup() entry in ata_port_operations. 559 + * 560 + * LOCKING: 561 + * spin_lock_irqsave(host_set lock) 562 + */ 563 + void ata_bmdma_setup(struct ata_queued_cmd *qc) 564 + { 565 + if (qc->ap->flags & ATA_FLAG_MMIO) 566 + ata_bmdma_setup_mmio(qc); 567 + else 568 + ata_bmdma_setup_pio(qc); 569 + } 570 + 571 + 572 + /** 573 + * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. 574 + * @ap: Port associated with this ATA transaction. 575 + * 576 + * Clear interrupt and error flags in DMA status register. 577 + * 578 + * May be used as the irq_clear() entry in ata_port_operations. 579 + * 580 + * LOCKING: 581 + * spin_lock_irqsave(host_set lock) 582 + */ 583 + 584 + void ata_bmdma_irq_clear(struct ata_port *ap) 585 + { 586 + if (!ap->ioaddr.bmdma_addr) 587 + return; 588 + 589 + if (ap->flags & ATA_FLAG_MMIO) { 590 + void __iomem *mmio = 591 + ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; 592 + writeb(readb(mmio), mmio); 593 + } else { 594 + unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; 595 + outb(inb(addr), addr); 596 + } 597 + } 598 + 599 + 600 + /** 601 + * ata_bmdma_status - Read PCI IDE BMDMA status 602 + * @ap: Port associated with this ATA transaction. 603 + * 604 + * Read and return BMDMA status register. 605 + * 606 + * May be used as the bmdma_status() entry in ata_port_operations. 607 + * 608 + * LOCKING: 609 + * spin_lock_irqsave(host_set lock) 610 + */ 611 + 612 + u8 ata_bmdma_status(struct ata_port *ap) 613 + { 614 + u8 host_stat; 615 + if (ap->flags & ATA_FLAG_MMIO) { 616 + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 617 + host_stat = readb(mmio + ATA_DMA_STATUS); 618 + } else 619 + host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 620 + return host_stat; 621 + } 622 + 623 + 624 + /** 625 + * ata_bmdma_stop - Stop PCI IDE BMDMA transfer 626 + * @qc: Command we are ending DMA for 627 + * 628 + * Clears the ATA_DMA_START flag in the dma control register 629 + * 630 + * May be used as the bmdma_stop() entry in ata_port_operations. 631 + * 632 + * LOCKING: 633 + * spin_lock_irqsave(host_set lock) 634 + */ 635 + 636 + void ata_bmdma_stop(struct ata_queued_cmd *qc) 637 + { 638 + struct ata_port *ap = qc->ap; 639 + if (ap->flags & ATA_FLAG_MMIO) { 640 + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 641 + 642 + /* clear start/stop bit */ 643 + writeb(readb(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, 644 + mmio + ATA_DMA_CMD); 645 + } else { 646 + /* clear start/stop bit */ 647 + outb(inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD) & ~ATA_DMA_START, 648 + ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 649 + } 650 + 651 + /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 652 + ata_altstatus(ap); /* dummy read */ 653 + } 654 + 421 655 #ifdef CONFIG_PCI 422 656 static struct ata_probe_ent * 423 657 ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port) ··· 941 707 * @pdev: PCI device 942 708 * 943 709 * Some PCI ATA devices report simplex mode but in fact can be told to 944 - * enter non simplex mode. This implements the neccessary logic to 710 + * enter non simplex mode. This implements the neccessary logic to 945 711 * perform the task on such devices. Calling it on other devices will 946 712 * have -undefined- behaviour. 947 713 */ ··· 966 732 { 967 733 /* Filter out DMA modes if the device has been configured by 968 734 the BIOS as PIO only */ 969 - 735 + 970 736 if (ap->ioaddr.bmdma_addr == 0) 971 737 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 972 738 return xfer_mask;
+162 -307
drivers/scsi/libata-core.c
··· 64 64 static unsigned int ata_dev_init_params(struct ata_port *ap, 65 65 struct ata_device *dev); 66 66 static void ata_set_mode(struct ata_port *ap); 67 - static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); 68 - static unsigned int ata_dev_xfermask(struct ata_port *ap, 69 - struct ata_device *dev); 67 + static unsigned int ata_dev_set_xfermode(struct ata_port *ap, 68 + struct ata_device *dev); 69 + static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); 70 70 71 71 static unsigned int ata_unique_id = 1; 72 72 static struct workqueue_struct *ata_wq; ··· 190 190 * ata_rwcmd_protocol - set taskfile r/w commands and protocol 191 191 * @qc: command to examine and configure 192 192 * 193 - * Examine the device configuration and tf->flags to calculate 193 + * Examine the device configuration and tf->flags to calculate 194 194 * the proper read/write commands and protocol to use. 195 195 * 196 196 * LOCKING: ··· 203 203 u8 cmd; 204 204 205 205 int index, fua, lba48, write; 206 - 206 + 207 207 fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0; 208 208 lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; 209 209 write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; ··· 250 250 return ((pio_mask << ATA_SHIFT_PIO) & ATA_MASK_PIO) | 251 251 ((mwdma_mask << ATA_SHIFT_MWDMA) & ATA_MASK_MWDMA) | 252 252 ((udma_mask << ATA_SHIFT_UDMA) & ATA_MASK_UDMA); 253 + } 254 + 255 + /** 256 + * ata_unpack_xfermask - Unpack xfer_mask into pio, mwdma and udma masks 257 + * @xfer_mask: xfer_mask to unpack 258 + * @pio_mask: resulting pio_mask 259 + * @mwdma_mask: resulting mwdma_mask 260 + * @udma_mask: resulting udma_mask 261 + * 262 + * Unpack @xfer_mask into @pio_mask, @mwdma_mask and @udma_mask. 263 + * Any NULL distination masks will be ignored. 264 + */ 265 + static void ata_unpack_xfermask(unsigned int xfer_mask, 266 + unsigned int *pio_mask, 267 + unsigned int *mwdma_mask, 268 + unsigned int *udma_mask) 269 + { 270 + if (pio_mask) 271 + *pio_mask = (xfer_mask & ATA_MASK_PIO) >> ATA_SHIFT_PIO; 272 + if (mwdma_mask) 273 + *mwdma_mask = (xfer_mask & ATA_MASK_MWDMA) >> ATA_SHIFT_MWDMA; 274 + if (udma_mask) 275 + *udma_mask = (xfer_mask & ATA_MASK_UDMA) >> ATA_SHIFT_UDMA; 253 276 } 254 277 255 278 static const struct ata_xfer_ent { ··· 393 370 if (highbit >= 0 && highbit < ARRAY_SIZE(xfer_mode_str)) 394 371 return xfer_mode_str[highbit]; 395 372 return "<n/a>"; 373 + } 374 + 375 + static void ata_dev_disable(struct ata_port *ap, struct ata_device *dev) 376 + { 377 + if (ata_dev_present(dev)) { 378 + printk(KERN_WARNING "ata%u: dev %u disabled\n", 379 + ap->id, dev->devno); 380 + dev->class++; 381 + } 396 382 } 397 383 398 384 /** ··· 1019 987 1020 988 ata_qc_free(qc); 1021 989 990 + /* XXX - Some LLDDs (sata_mv) disable port on command failure. 991 + * Until those drivers are fixed, we detect the condition 992 + * here, fail the command with AC_ERR_SYSTEM and reenable the 993 + * port. 994 + * 995 + * Note that this doesn't change any behavior as internal 996 + * command failure results in disabling the device in the 997 + * higher layer for LLDDs without new reset/EH callbacks. 998 + * 999 + * Kill the following code as soon as those drivers are fixed. 1000 + */ 1001 + if (ap->flags & ATA_FLAG_PORT_DISABLED) { 1002 + err_mask |= AC_ERR_SYSTEM; 1003 + ata_port_probe(ap); 1004 + } 1005 + 1022 1006 return err_mask; 1023 1007 } 1024 1008 ··· 1055 1007 return 0; 1056 1008 if (speed > 2) 1057 1009 return 1; 1058 - 1010 + 1059 1011 /* If we have no drive specific rule, then PIO 2 is non IORDY */ 1060 1012 1061 1013 if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE */ ··· 1353 1305 if (print_info) 1354 1306 printk(KERN_INFO "ata%u(%u): applying bridge limits\n", 1355 1307 ap->id, dev->devno); 1356 - ap->udma_mask &= ATA_UDMA5; 1308 + dev->udma_mask &= ATA_UDMA5; 1357 1309 dev->max_sectors = ATA_MAX_SECTORS; 1358 1310 } 1359 1311 ··· 1364 1316 return 0; 1365 1317 1366 1318 err_out_nosup: 1367 - printk(KERN_WARNING "ata%u: dev %u not supported, ignoring\n", 1368 - ap->id, dev->devno); 1369 1319 DPRINTK("EXIT, err\n"); 1370 1320 return rc; 1371 1321 } ··· 1430 1384 } 1431 1385 1432 1386 if (ata_dev_configure(ap, dev, 1)) { 1433 - dev->class++; /* disable device */ 1387 + ata_dev_disable(ap, dev); 1434 1388 continue; 1435 1389 } 1436 1390 ··· 1576 1530 } 1577 1531 1578 1532 /** 1533 + * ata_dev_pair - return other device on cable 1534 + * @ap: port 1535 + * @adev: device 1536 + * 1537 + * Obtain the other device on the same cable, or if none is 1538 + * present NULL is returned 1539 + */ 1540 + 1541 + struct ata_device *ata_dev_pair(struct ata_port *ap, struct ata_device *adev) 1542 + { 1543 + struct ata_device *pair = &ap->device[1 - adev->devno]; 1544 + if (!ata_dev_present(pair)) 1545 + return NULL; 1546 + return pair; 1547 + } 1548 + 1549 + /** 1579 1550 * ata_port_disable - Disable port. 1580 1551 * @ap: Port to be disabled. 1581 1552 * ··· 1620 1557 * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). 1621 1558 * These were taken from ATA/ATAPI-6 standard, rev 0a, except 1622 1559 * for PIO 5, which is a nonstandard extension and UDMA6, which 1623 - * is currently supported only by Maxtor drives. 1560 + * is currently supported only by Maxtor drives. 1624 1561 */ 1625 1562 1626 1563 static const struct ata_timing ata_timing[] = { ··· 1635 1572 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, 1636 1573 1637 1574 /* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */ 1638 - 1575 + 1639 1576 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 }, 1640 1577 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 }, 1641 1578 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 }, 1642 - 1579 + 1643 1580 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 }, 1644 1581 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, 1645 1582 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, ··· 1692 1629 for (t = ata_timing; t->mode != speed; t++) 1693 1630 if (t->mode == 0xFF) 1694 1631 return NULL; 1695 - return t; 1632 + return t; 1696 1633 } 1697 1634 1698 1635 int ata_timing_compute(struct ata_device *adev, unsigned short speed, ··· 1702 1639 struct ata_timing p; 1703 1640 1704 1641 /* 1705 - * Find the mode. 1642 + * Find the mode. 1706 1643 */ 1707 1644 1708 1645 if (!(s = ata_timing_find_mode(speed))) ··· 1760 1697 return 0; 1761 1698 } 1762 1699 1763 - static void ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) 1700 + static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) 1764 1701 { 1765 - if (!ata_dev_present(dev) || (ap->flags & ATA_FLAG_PORT_DISABLED)) 1766 - return; 1702 + unsigned int err_mask; 1703 + int rc; 1767 1704 1768 1705 if (dev->xfer_shift == ATA_SHIFT_PIO) 1769 1706 dev->flags |= ATA_DFLAG_PIO; 1770 1707 1771 - ata_dev_set_xfermode(ap, dev); 1708 + err_mask = ata_dev_set_xfermode(ap, dev); 1709 + if (err_mask) { 1710 + printk(KERN_ERR 1711 + "ata%u: failed to set xfermode (err_mask=0x%x)\n", 1712 + ap->id, err_mask); 1713 + return -EIO; 1714 + } 1772 1715 1773 - if (ata_dev_revalidate(ap, dev, 0)) { 1774 - printk(KERN_ERR "ata%u: failed to revalidate after set " 1775 - "xfermode, disabled\n", ap->id); 1776 - ata_port_disable(ap); 1716 + rc = ata_dev_revalidate(ap, dev, 0); 1717 + if (rc) { 1718 + printk(KERN_ERR 1719 + "ata%u: failed to revalidate after set xfermode\n", 1720 + ap->id); 1721 + return rc; 1777 1722 } 1778 1723 1779 1724 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", ··· 1790 1719 printk(KERN_INFO "ata%u: dev %u configured for %s\n", 1791 1720 ap->id, dev->devno, 1792 1721 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode))); 1722 + return 0; 1793 1723 } 1794 1724 1795 1725 static int ata_host_set_pio(struct ata_port *ap) ··· 1850 1778 /* step 1: calculate xfer_mask */ 1851 1779 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1852 1780 struct ata_device *dev = &ap->device[i]; 1853 - unsigned int xfer_mask; 1781 + unsigned int pio_mask, dma_mask; 1854 1782 1855 1783 if (!ata_dev_present(dev)) 1856 1784 continue; 1857 1785 1858 - xfer_mask = ata_dev_xfermask(ap, dev); 1786 + ata_dev_xfermask(ap, dev); 1859 1787 1860 - dev->pio_mode = ata_xfer_mask2mode(xfer_mask & ATA_MASK_PIO); 1861 - dev->dma_mode = ata_xfer_mask2mode(xfer_mask & (ATA_MASK_MWDMA | 1862 - ATA_MASK_UDMA)); 1788 + /* TODO: let LLDD filter dev->*_mask here */ 1789 + 1790 + pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); 1791 + dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); 1792 + dev->pio_mode = ata_xfer_mask2mode(pio_mask); 1793 + dev->dma_mode = ata_xfer_mask2mode(dma_mask); 1863 1794 } 1864 1795 1865 1796 /* step 2: always set host PIO timings */ ··· 1874 1799 ata_host_set_dma(ap); 1875 1800 1876 1801 /* step 4: update devices' xfer mode */ 1877 - for (i = 0; i < ATA_MAX_DEVICES; i++) 1878 - ata_dev_set_mode(ap, &ap->device[i]); 1802 + for (i = 0; i < ATA_MAX_DEVICES; i++) { 1803 + struct ata_device *dev = &ap->device[i]; 1879 1804 1880 - if (ap->flags & ATA_FLAG_PORT_DISABLED) 1881 - return; 1805 + if (!ata_dev_present(dev)) 1806 + continue; 1807 + 1808 + if (ata_dev_set_mode(ap, dev)) 1809 + goto err_out; 1810 + } 1882 1811 1883 1812 if (ap->ops->post_set_mode) 1884 1813 ap->ops->post_set_mode(ap); ··· 2078 1999 */ 2079 2000 msleep(150); 2080 2001 2081 - 2082 - /* Before we perform post reset processing we want to see if 2002 + 2003 + /* Before we perform post reset processing we want to see if 2083 2004 the bus shows 0xFF because the odd clown forgets the D7 pulldown 2084 2005 resistor */ 2085 - 2006 + 2086 2007 if (ata_check_status(ap) == 0xFF) 2087 2008 return 1; /* Positive is failure for some reason */ 2088 2009 ··· 2651 2572 "SanDisk SDP3B-64", NULL, 2652 2573 "SANYO CD-ROM CRD", NULL, 2653 2574 "HITACHI CDR-8", NULL, 2654 - "HITACHI CDR-8335", NULL, 2575 + "HITACHI CDR-8335", NULL, 2655 2576 "HITACHI CDR-8435", NULL, 2656 - "Toshiba CD-ROM XM-6202B", NULL, 2657 - "TOSHIBA CD-ROM XM-1702BC", NULL, 2658 - "CD-532E-A", NULL, 2659 - "E-IDE CD-ROM CR-840", NULL, 2660 - "CD-ROM Drive/F5A", NULL, 2661 - "WPI CDD-820", NULL, 2577 + "Toshiba CD-ROM XM-6202B", NULL, 2578 + "TOSHIBA CD-ROM XM-1702BC", NULL, 2579 + "CD-532E-A", NULL, 2580 + "E-IDE CD-ROM CR-840", NULL, 2581 + "CD-ROM Drive/F5A", NULL, 2582 + "WPI CDD-820", NULL, 2662 2583 "SAMSUNG CD-ROM SC-148C", NULL, 2663 - "SAMSUNG CD-ROM SC", NULL, 2584 + "SAMSUNG CD-ROM SC", NULL, 2664 2585 "SanDisk SDP3B-64", NULL, 2665 2586 "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL, 2666 2587 "_NEC DV5800A", NULL, 2667 2588 "SAMSUNG CD-ROM SN-124", "N001" 2668 2589 }; 2669 - 2590 + 2670 2591 static int ata_strim(char *s, size_t len) 2671 2592 { 2672 2593 len = strnlen(s, len); ··· 2709 2630 * @ap: Port on which the device to compute xfermask for resides 2710 2631 * @dev: Device to compute xfermask for 2711 2632 * 2712 - * Compute supported xfermask of @dev. This function is 2713 - * responsible for applying all known limits including host 2714 - * controller limits, device blacklist, etc... 2633 + * Compute supported xfermask of @dev and store it in 2634 + * dev->*_mask. This function is responsible for applying all 2635 + * known limits including host controller limits, device 2636 + * blacklist, etc... 2715 2637 * 2716 2638 * LOCKING: 2717 2639 * None. 2718 - * 2719 - * RETURNS: 2720 - * Computed xfermask. 2721 2640 */ 2722 - static unsigned int ata_dev_xfermask(struct ata_port *ap, 2723 - struct ata_device *dev) 2641 + static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev) 2724 2642 { 2725 2643 unsigned long xfer_mask; 2726 2644 int i; ··· 2730 2654 struct ata_device *d = &ap->device[i]; 2731 2655 if (!ata_dev_present(d)) 2732 2656 continue; 2657 + xfer_mask &= ata_pack_xfermask(d->pio_mask, d->mwdma_mask, 2658 + d->udma_mask); 2733 2659 xfer_mask &= ata_id_xfermask(d->id); 2734 2660 if (ata_dma_blacklisted(d)) 2735 2661 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); ··· 2741 2663 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, " 2742 2664 "disabling DMA\n", ap->id, dev->devno); 2743 2665 2744 - return xfer_mask; 2666 + ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, 2667 + &dev->udma_mask); 2745 2668 } 2746 2669 2747 2670 /** ··· 2755 2676 * 2756 2677 * LOCKING: 2757 2678 * PCI/etc. bus probe sem. 2679 + * 2680 + * RETURNS: 2681 + * 0 on success, AC_ERR_* mask otherwise. 2758 2682 */ 2759 2683 2760 - static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) 2684 + static unsigned int ata_dev_set_xfermode(struct ata_port *ap, 2685 + struct ata_device *dev) 2761 2686 { 2762 2687 struct ata_taskfile tf; 2688 + unsigned int err_mask; 2763 2689 2764 2690 /* set up set-features taskfile */ 2765 2691 DPRINTK("set features - xfer mode\n"); ··· 2776 2692 tf.protocol = ATA_PROT_NODATA; 2777 2693 tf.nsect = dev->xfer_mode; 2778 2694 2779 - if (ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0)) { 2780 - printk(KERN_ERR "ata%u: failed to set xfermode, disabled\n", 2781 - ap->id); 2782 - ata_port_disable(ap); 2783 - } 2695 + err_mask = ata_exec_internal(ap, dev, &tf, DMA_NONE, NULL, 0); 2784 2696 2785 - DPRINTK("EXIT\n"); 2697 + DPRINTK("EXIT, err_mask=%x\n", err_mask); 2698 + return err_mask; 2786 2699 } 2787 2700 2788 2701 /** ··· 2856 2775 2857 2776 if (qc->flags & ATA_QCFLAG_SG) { 2858 2777 if (qc->n_elem) 2859 - dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); 2778 + dma_unmap_sg(ap->dev, sg, qc->n_elem, dir); 2860 2779 /* restore last sg */ 2861 2780 sg[qc->orig_n_elem - 1].length += qc->pad_len; 2862 2781 if (pad_buf) { ··· 2867 2786 } 2868 2787 } else { 2869 2788 if (qc->n_elem) 2870 - dma_unmap_single(ap->host_set->dev, 2789 + dma_unmap_single(ap->dev, 2871 2790 sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), 2872 2791 dir); 2873 2792 /* restore sg */ ··· 3078 2997 goto skip_map; 3079 2998 } 3080 2999 3081 - dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, 3000 + dma_address = dma_map_single(ap->dev, qc->buf_virt, 3082 3001 sg->length, dir); 3083 3002 if (dma_mapping_error(dma_address)) { 3084 3003 /* restore sg */ ··· 3166 3085 } 3167 3086 3168 3087 dir = qc->dma_dir; 3169 - n_elem = dma_map_sg(ap->host_set->dev, sg, pre_n_elem, dir); 3088 + n_elem = dma_map_sg(ap->dev, sg, pre_n_elem, dir); 3170 3089 if (n_elem < 1) { 3171 3090 /* restore last sg */ 3172 3091 lsg->length += qc->pad_len; ··· 3697 3616 if (qc->tf.command != ATA_CMD_PACKET) 3698 3617 printk(KERN_WARNING "ata%u: PIO error\n", ap->id); 3699 3618 3700 - /* make sure qc->err_mask is available to 3619 + /* make sure qc->err_mask is available to 3701 3620 * know what's wrong and recover 3702 3621 */ 3703 3622 WARN_ON(qc->err_mask == 0); ··· 4146 4065 } 4147 4066 4148 4067 /** 4149 - * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction 4150 - * @qc: Info associated with this ATA transaction. 4151 - * 4152 - * LOCKING: 4153 - * spin_lock_irqsave(host_set lock) 4154 - */ 4155 - 4156 - static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) 4157 - { 4158 - struct ata_port *ap = qc->ap; 4159 - unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 4160 - u8 dmactl; 4161 - void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 4162 - 4163 - /* load PRD table addr. */ 4164 - mb(); /* make sure PRD table writes are visible to controller */ 4165 - writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); 4166 - 4167 - /* specify data direction, triple-check start bit is clear */ 4168 - dmactl = readb(mmio + ATA_DMA_CMD); 4169 - dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); 4170 - if (!rw) 4171 - dmactl |= ATA_DMA_WR; 4172 - writeb(dmactl, mmio + ATA_DMA_CMD); 4173 - 4174 - /* issue r/w command */ 4175 - ap->ops->exec_command(ap, &qc->tf); 4176 - } 4177 - 4178 - /** 4179 - * ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction 4180 - * @qc: Info associated with this ATA transaction. 4181 - * 4182 - * LOCKING: 4183 - * spin_lock_irqsave(host_set lock) 4184 - */ 4185 - 4186 - static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) 4187 - { 4188 - struct ata_port *ap = qc->ap; 4189 - void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 4190 - u8 dmactl; 4191 - 4192 - /* start host DMA transaction */ 4193 - dmactl = readb(mmio + ATA_DMA_CMD); 4194 - writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); 4195 - 4196 - /* Strictly, one may wish to issue a readb() here, to 4197 - * flush the mmio write. However, control also passes 4198 - * to the hardware at this point, and it will interrupt 4199 - * us when we are to resume control. So, in effect, 4200 - * we don't care when the mmio write flushes. 4201 - * Further, a read of the DMA status register _immediately_ 4202 - * following the write may not be what certain flaky hardware 4203 - * is expected, so I think it is best to not add a readb() 4204 - * without first all the MMIO ATA cards/mobos. 4205 - * Or maybe I'm just being paranoid. 4206 - */ 4207 - } 4208 - 4209 - /** 4210 - * ata_bmdma_setup_pio - Set up PCI IDE BMDMA transaction (PIO) 4211 - * @qc: Info associated with this ATA transaction. 4212 - * 4213 - * LOCKING: 4214 - * spin_lock_irqsave(host_set lock) 4215 - */ 4216 - 4217 - static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) 4218 - { 4219 - struct ata_port *ap = qc->ap; 4220 - unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 4221 - u8 dmactl; 4222 - 4223 - /* load PRD table addr. */ 4224 - outl(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); 4225 - 4226 - /* specify data direction, triple-check start bit is clear */ 4227 - dmactl = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 4228 - dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); 4229 - if (!rw) 4230 - dmactl |= ATA_DMA_WR; 4231 - outb(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 4232 - 4233 - /* issue r/w command */ 4234 - ap->ops->exec_command(ap, &qc->tf); 4235 - } 4236 - 4237 - /** 4238 - * ata_bmdma_start_pio - Start a PCI IDE BMDMA transaction (PIO) 4239 - * @qc: Info associated with this ATA transaction. 4240 - * 4241 - * LOCKING: 4242 - * spin_lock_irqsave(host_set lock) 4243 - */ 4244 - 4245 - static void ata_bmdma_start_pio (struct ata_queued_cmd *qc) 4246 - { 4247 - struct ata_port *ap = qc->ap; 4248 - u8 dmactl; 4249 - 4250 - /* start host DMA transaction */ 4251 - dmactl = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 4252 - outb(dmactl | ATA_DMA_START, 4253 - ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 4254 - } 4255 - 4256 - 4257 - /** 4258 - * ata_bmdma_start - Start a PCI IDE BMDMA transaction 4259 - * @qc: Info associated with this ATA transaction. 4260 - * 4261 - * Writes the ATA_DMA_START flag to the DMA command register. 4262 - * 4263 - * May be used as the bmdma_start() entry in ata_port_operations. 4264 - * 4265 - * LOCKING: 4266 - * spin_lock_irqsave(host_set lock) 4267 - */ 4268 - void ata_bmdma_start(struct ata_queued_cmd *qc) 4269 - { 4270 - if (qc->ap->flags & ATA_FLAG_MMIO) 4271 - ata_bmdma_start_mmio(qc); 4272 - else 4273 - ata_bmdma_start_pio(qc); 4274 - } 4275 - 4276 - 4277 - /** 4278 - * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 4279 - * @qc: Info associated with this ATA transaction. 4280 - * 4281 - * Writes address of PRD table to device's PRD Table Address 4282 - * register, sets the DMA control register, and calls 4283 - * ops->exec_command() to start the transfer. 4284 - * 4285 - * May be used as the bmdma_setup() entry in ata_port_operations. 4286 - * 4287 - * LOCKING: 4288 - * spin_lock_irqsave(host_set lock) 4289 - */ 4290 - void ata_bmdma_setup(struct ata_queued_cmd *qc) 4291 - { 4292 - if (qc->ap->flags & ATA_FLAG_MMIO) 4293 - ata_bmdma_setup_mmio(qc); 4294 - else 4295 - ata_bmdma_setup_pio(qc); 4296 - } 4297 - 4298 - 4299 - /** 4300 - * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. 4301 - * @ap: Port associated with this ATA transaction. 4302 - * 4303 - * Clear interrupt and error flags in DMA status register. 4304 - * 4305 - * May be used as the irq_clear() entry in ata_port_operations. 4306 - * 4307 - * LOCKING: 4308 - * spin_lock_irqsave(host_set lock) 4309 - */ 4310 - 4311 - void ata_bmdma_irq_clear(struct ata_port *ap) 4312 - { 4313 - if (!ap->ioaddr.bmdma_addr) 4314 - return; 4315 - 4316 - if (ap->flags & ATA_FLAG_MMIO) { 4317 - void __iomem *mmio = 4318 - ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; 4319 - writeb(readb(mmio), mmio); 4320 - } else { 4321 - unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; 4322 - outb(inb(addr), addr); 4323 - } 4324 - } 4325 - 4326 - 4327 - /** 4328 - * ata_bmdma_status - Read PCI IDE BMDMA status 4329 - * @ap: Port associated with this ATA transaction. 4330 - * 4331 - * Read and return BMDMA status register. 4332 - * 4333 - * May be used as the bmdma_status() entry in ata_port_operations. 4334 - * 4335 - * LOCKING: 4336 - * spin_lock_irqsave(host_set lock) 4337 - */ 4338 - 4339 - u8 ata_bmdma_status(struct ata_port *ap) 4340 - { 4341 - u8 host_stat; 4342 - if (ap->flags & ATA_FLAG_MMIO) { 4343 - void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 4344 - host_stat = readb(mmio + ATA_DMA_STATUS); 4345 - } else 4346 - host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 4347 - return host_stat; 4348 - } 4349 - 4350 - 4351 - /** 4352 - * ata_bmdma_stop - Stop PCI IDE BMDMA transfer 4353 - * @qc: Command we are ending DMA for 4354 - * 4355 - * Clears the ATA_DMA_START flag in the dma control register 4356 - * 4357 - * May be used as the bmdma_stop() entry in ata_port_operations. 4358 - * 4359 - * LOCKING: 4360 - * spin_lock_irqsave(host_set lock) 4361 - */ 4362 - 4363 - void ata_bmdma_stop(struct ata_queued_cmd *qc) 4364 - { 4365 - struct ata_port *ap = qc->ap; 4366 - if (ap->flags & ATA_FLAG_MMIO) { 4367 - void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 4368 - 4369 - /* clear start/stop bit */ 4370 - writeb(readb(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, 4371 - mmio + ATA_DMA_CMD); 4372 - } else { 4373 - /* clear start/stop bit */ 4374 - outb(inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD) & ~ATA_DMA_START, 4375 - ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 4376 - } 4377 - 4378 - /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 4379 - ata_altstatus(ap); /* dummy read */ 4380 - } 4381 - 4382 - /** 4383 4068 * ata_host_intr - Handle host interrupt for given (port, task) 4384 4069 * @ap: Port on which interrupt arrived (possibly...) 4385 4070 * @qc: Taskfile currently active in engine ··· 4353 4506 * Flush the cache on the drive, if appropriate, then issue a 4354 4507 * standbynow command. 4355 4508 */ 4356 - int ata_device_suspend(struct ata_port *ap, struct ata_device *dev) 4509 + int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state) 4357 4510 { 4358 4511 if (!ata_dev_present(dev)) 4359 4512 return 0; 4360 4513 if (dev->class == ATA_DEV_ATA) 4361 4514 ata_flush_cache(ap, dev); 4362 4515 4363 - ata_standby_drive(ap, dev); 4516 + if (state.event != PM_EVENT_FREEZE) 4517 + ata_standby_drive(ap, dev); 4364 4518 ap->flags |= ATA_FLAG_SUSPENDED; 4365 4519 return 0; 4366 4520 } ··· 4381 4533 4382 4534 int ata_port_start (struct ata_port *ap) 4383 4535 { 4384 - struct device *dev = ap->host_set->dev; 4536 + struct device *dev = ap->dev; 4385 4537 int rc; 4386 4538 4387 4539 ap->prd = dma_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, GFP_KERNEL); ··· 4414 4566 4415 4567 void ata_port_stop (struct ata_port *ap) 4416 4568 { 4417 - struct device *dev = ap->host_set->dev; 4569 + struct device *dev = ap->dev; 4418 4570 4419 4571 dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); 4420 4572 ata_pad_free(ap, dev); ··· 4480 4632 ap->host = host; 4481 4633 ap->ctl = ATA_DEVCTL_OBS; 4482 4634 ap->host_set = host_set; 4635 + ap->dev = ent->dev; 4483 4636 ap->port_no = port_no; 4484 4637 ap->hard_port_no = 4485 4638 ent->legacy_mode ? ent->hard_port_no : port_no; ··· 4496 4647 INIT_WORK(&ap->port_task, NULL, NULL); 4497 4648 INIT_LIST_HEAD(&ap->eh_done_q); 4498 4649 4499 - for (i = 0; i < ATA_MAX_DEVICES; i++) 4500 - ap->device[i].devno = i; 4650 + for (i = 0; i < ATA_MAX_DEVICES; i++) { 4651 + struct ata_device *dev = &ap->device[i]; 4652 + dev->devno = i; 4653 + dev->pio_mask = UINT_MAX; 4654 + dev->mwdma_mask = UINT_MAX; 4655 + dev->udma_mask = UINT_MAX; 4656 + } 4501 4657 4502 4658 #ifdef ATA_IRQ_TRAP 4503 4659 ap->stats.unhandled_irq = 1; ··· 4696 4842 * ata_host_set_remove - PCI layer callback for device removal 4697 4843 * @host_set: ATA host set that was removed 4698 4844 * 4699 - * Unregister all objects associated with this host set. Free those 4845 + * Unregister all objects associated with this host set. Free those 4700 4846 * objects. 4701 4847 * 4702 4848 * LOCKING: ··· 4968 5114 EXPORT_SYMBOL_GPL(ata_std_probe_reset); 4969 5115 EXPORT_SYMBOL_GPL(ata_drive_probe_reset); 4970 5116 EXPORT_SYMBOL_GPL(ata_dev_revalidate); 5117 + EXPORT_SYMBOL_GPL(ata_dev_classify); 5118 + EXPORT_SYMBOL_GPL(ata_dev_pair); 4971 5119 EXPORT_SYMBOL_GPL(ata_port_disable); 4972 5120 EXPORT_SYMBOL_GPL(ata_ratelimit); 4973 5121 EXPORT_SYMBOL_GPL(ata_busy_sleep); ··· 4980 5124 EXPORT_SYMBOL_GPL(ata_scsi_slave_config); 4981 5125 EXPORT_SYMBOL_GPL(ata_scsi_release); 4982 5126 EXPORT_SYMBOL_GPL(ata_host_intr); 4983 - EXPORT_SYMBOL_GPL(ata_dev_classify); 4984 5127 EXPORT_SYMBOL_GPL(ata_id_string); 4985 5128 EXPORT_SYMBOL_GPL(ata_id_c_string); 4986 5129 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
+35 -44
drivers/scsi/libata-scsi.c
··· 256 256 scsi_cmd[14] = args[0]; 257 257 258 258 /* Good values for timeout and retries? Values below 259 - from scsi_ioctl_send_command() for default case... */ 259 + from scsi_ioctl_send_command() for default case... */ 260 260 if (scsi_execute_req(scsidev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr, 261 261 (10*HZ), 5)) 262 262 rc = -EIO; ··· 267 267 268 268 int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) 269 269 { 270 - struct ata_port *ap; 271 - struct ata_device *dev; 272 270 int val = -EINVAL, rc = -EINVAL; 273 - 274 - ap = (struct ata_port *) &scsidev->host->hostdata[0]; 275 - if (!ap) 276 - goto out; 277 - 278 - dev = ata_scsi_find_dev(ap, scsidev); 279 - if (!dev) { 280 - rc = -ENODEV; 281 - goto out; 282 - } 283 271 284 272 switch (cmd) { 285 273 case ATA_IOC_GET_IO32: ··· 297 309 break; 298 310 } 299 311 300 - out: 301 312 return rc; 302 313 } 303 314 ··· 401 414 return ata_device_resume(ap, dev); 402 415 } 403 416 404 - int ata_scsi_device_suspend(struct scsi_device *sdev) 417 + int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) 405 418 { 406 419 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 407 420 struct ata_device *dev = &ap->device[sdev->id]; 408 421 409 - return ata_device_suspend(ap, dev); 422 + return ata_device_suspend(ap, dev, state); 410 423 } 411 424 412 425 /** ··· 425 438 * LOCKING: 426 439 * spin_lock_irqsave(host_set lock) 427 440 */ 428 - void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, 441 + void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, 429 442 u8 *ascq) 430 443 { 431 444 int i; ··· 482 495 /* Look for drv_err */ 483 496 for (i = 0; sense_table[i][0] != 0xFF; i++) { 484 497 /* Look for best matches first */ 485 - if ((sense_table[i][0] & drv_err) == 498 + if ((sense_table[i][0] & drv_err) == 486 499 sense_table[i][0]) { 487 500 *sk = sense_table[i][1]; 488 501 *asc = sense_table[i][2]; ··· 505 518 } 506 519 } 507 520 /* No error? Undecoded? */ 508 - printk(KERN_WARNING "ata%u: no sense translation for status: 0x%02x\n", 521 + printk(KERN_WARNING "ata%u: no sense translation for status: 0x%02x\n", 509 522 id, drv_stat); 510 523 511 524 /* We need a sensible error return here, which is tricky, and one ··· 1137 1150 1138 1151 DPRINTK("block %u track %u cyl %u head %u sect %u\n", 1139 1152 (u32)block, track, cyl, head, sect); 1140 - 1141 - /* Check whether the converted CHS can fit. 1142 - Cylinder: 0-65535 1153 + 1154 + /* Check whether the converted CHS can fit. 1155 + Cylinder: 0-65535 1143 1156 Head: 0-15 1144 1157 Sector: 1-255*/ 1145 - if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect)) 1158 + if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect)) 1146 1159 goto out_of_range; 1147 - 1160 + 1148 1161 tf->command = ATA_CMD_VERIFY; 1149 1162 tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */ 1150 1163 tf->lbal = sect; ··· 1276 1289 tf->lbal = block & 0xff; 1277 1290 1278 1291 tf->device |= ATA_LBA; 1279 - } else { 1292 + } else { 1280 1293 /* CHS */ 1281 1294 u32 sect, head, cyl, track; 1282 1295 ··· 1296 1309 DPRINTK("block %u track %u cyl %u head %u sect %u\n", 1297 1310 (u32)block, track, cyl, head, sect); 1298 1311 1299 - /* Check whether the converted CHS can fit. 1300 - Cylinder: 0-65535 1312 + /* Check whether the converted CHS can fit. 1313 + Cylinder: 0-65535 1301 1314 Head: 0-15 1302 1315 Sector: 1-255*/ 1303 1316 if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect)) ··· 1684 1697 1685 1698 if (buflen > (ATA_SERNO_LEN + num + 3)) { 1686 1699 /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */ 1687 - rbuf[num + 0] = 2; 1700 + rbuf[num + 0] = 2; 1688 1701 rbuf[num + 3] = ATA_SERNO_LEN; 1689 1702 num += 4; 1690 1703 ata_id_string(args->id, (unsigned char *) rbuf + num, ··· 1694 1707 if (buflen > (sat_model_serial_desc_len + num + 3)) { 1695 1708 /* SAT defined lu model and serial numbers descriptor */ 1696 1709 /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ 1697 - rbuf[num + 0] = 2; 1698 - rbuf[num + 1] = 1; 1710 + rbuf[num + 0] = 2; 1711 + rbuf[num + 1] = 1; 1699 1712 rbuf[num + 3] = sat_model_serial_desc_len; 1700 1713 num += 4; 1701 1714 memcpy(rbuf + num, "ATA ", 8); ··· 2584 2597 #endif 2585 2598 } 2586 2599 2600 + static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 2601 + struct ata_port *ap, struct ata_device *dev) 2602 + { 2603 + if (dev->class == ATA_DEV_ATA) { 2604 + ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, 2605 + cmd->cmnd[0]); 2606 + 2607 + if (xlat_func) 2608 + ata_scsi_translate(ap, dev, cmd, done, xlat_func); 2609 + else 2610 + ata_scsi_simulate(ap, dev, cmd, done); 2611 + } else 2612 + ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); 2613 + } 2614 + 2587 2615 /** 2588 2616 * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device 2589 2617 * @cmd: SCSI command to be sent ··· 2633 2631 ata_scsi_dump_cdb(ap, cmd); 2634 2632 2635 2633 dev = ata_scsi_find_dev(ap, scsidev); 2636 - if (unlikely(!dev)) { 2634 + if (likely(dev)) 2635 + __ata_scsi_queuecmd(cmd, done, ap, dev); 2636 + else { 2637 2637 cmd->result = (DID_BAD_TARGET << 16); 2638 2638 done(cmd); 2639 - goto out_unlock; 2640 2639 } 2641 2640 2642 - if (dev->class == ATA_DEV_ATA) { 2643 - ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, 2644 - cmd->cmnd[0]); 2645 - 2646 - if (xlat_func) 2647 - ata_scsi_translate(ap, dev, cmd, done, xlat_func); 2648 - else 2649 - ata_scsi_simulate(ap, dev, cmd, done); 2650 - } else 2651 - ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); 2652 - 2653 - out_unlock: 2654 2641 spin_unlock(&ap->host_set->lock); 2655 2642 spin_lock(shost->host_lock); 2656 2643 return 0;
+59 -116
drivers/scsi/sata_nv.c
··· 29 29 * NV-specific details such as register offsets, SATA phy location, 30 30 * hotplug info, etc. 31 31 * 32 - * 0.10 33 - * - Fixed spurious interrupts issue seen with the Maxtor 6H500F0 500GB 34 - * drive. Also made the check_hotplug() callbacks return whether there 35 - * was a hotplug interrupt or not. This was not the source of the 36 - * spurious interrupts, but is the right thing to do anyway. 37 - * 38 - * 0.09 39 - * - Fixed bug introduced by 0.08's MCP51 and MCP55 support. 40 - * 41 - * 0.08 42 - * - Added support for MCP51 and MCP55. 43 - * 44 - * 0.07 45 - * - Added support for RAID class code. 46 - * 47 - * 0.06 48 - * - Added generic SATA support by using a pci_device_id that filters on 49 - * the IDE storage class code. 50 - * 51 - * 0.03 52 - * - Fixed a bug where the hotplug handlers for non-CK804/MCP04 were using 53 - * mmio_base, which is only set for the CK804/MCP04 case. 54 - * 55 - * 0.02 56 - * - Added support for CK804 SATA controller. 57 - * 58 - * 0.01 59 - * - Initial revision. 60 32 */ 61 33 62 34 #include <linux/config.h> ··· 46 74 #define DRV_NAME "sata_nv" 47 75 #define DRV_VERSION "0.8" 48 76 49 - #define NV_PORTS 2 50 - #define NV_PIO_MASK 0x1f 51 - #define NV_MWDMA_MASK 0x07 52 - #define NV_UDMA_MASK 0x7f 53 - #define NV_PORT0_SCR_REG_OFFSET 0x00 54 - #define NV_PORT1_SCR_REG_OFFSET 0x40 77 + enum { 78 + NV_PORTS = 2, 79 + NV_PIO_MASK = 0x1f, 80 + NV_MWDMA_MASK = 0x07, 81 + NV_UDMA_MASK = 0x7f, 82 + NV_PORT0_SCR_REG_OFFSET = 0x00, 83 + NV_PORT1_SCR_REG_OFFSET = 0x40, 55 84 56 - #define NV_INT_STATUS 0x10 57 - #define NV_INT_STATUS_CK804 0x440 58 - #define NV_INT_STATUS_PDEV_INT 0x01 59 - #define NV_INT_STATUS_PDEV_PM 0x02 60 - #define NV_INT_STATUS_PDEV_ADDED 0x04 61 - #define NV_INT_STATUS_PDEV_REMOVED 0x08 62 - #define NV_INT_STATUS_SDEV_INT 0x10 63 - #define NV_INT_STATUS_SDEV_PM 0x20 64 - #define NV_INT_STATUS_SDEV_ADDED 0x40 65 - #define NV_INT_STATUS_SDEV_REMOVED 0x80 66 - #define NV_INT_STATUS_PDEV_HOTPLUG (NV_INT_STATUS_PDEV_ADDED | \ 67 - NV_INT_STATUS_PDEV_REMOVED) 68 - #define NV_INT_STATUS_SDEV_HOTPLUG (NV_INT_STATUS_SDEV_ADDED | \ 69 - NV_INT_STATUS_SDEV_REMOVED) 70 - #define NV_INT_STATUS_HOTPLUG (NV_INT_STATUS_PDEV_HOTPLUG | \ 71 - NV_INT_STATUS_SDEV_HOTPLUG) 85 + NV_INT_STATUS = 0x10, 86 + NV_INT_STATUS_CK804 = 0x440, 87 + NV_INT_STATUS_PDEV_INT = 0x01, 88 + NV_INT_STATUS_PDEV_PM = 0x02, 89 + NV_INT_STATUS_PDEV_ADDED = 0x04, 90 + NV_INT_STATUS_PDEV_REMOVED = 0x08, 91 + NV_INT_STATUS_SDEV_INT = 0x10, 92 + NV_INT_STATUS_SDEV_PM = 0x20, 93 + NV_INT_STATUS_SDEV_ADDED = 0x40, 94 + NV_INT_STATUS_SDEV_REMOVED = 0x80, 95 + NV_INT_STATUS_PDEV_HOTPLUG = (NV_INT_STATUS_PDEV_ADDED | 96 + NV_INT_STATUS_PDEV_REMOVED), 97 + NV_INT_STATUS_SDEV_HOTPLUG = (NV_INT_STATUS_SDEV_ADDED | 98 + NV_INT_STATUS_SDEV_REMOVED), 99 + NV_INT_STATUS_HOTPLUG = (NV_INT_STATUS_PDEV_HOTPLUG | 100 + NV_INT_STATUS_SDEV_HOTPLUG), 72 101 73 - #define NV_INT_ENABLE 0x11 74 - #define NV_INT_ENABLE_CK804 0x441 75 - #define NV_INT_ENABLE_PDEV_MASK 0x01 76 - #define NV_INT_ENABLE_PDEV_PM 0x02 77 - #define NV_INT_ENABLE_PDEV_ADDED 0x04 78 - #define NV_INT_ENABLE_PDEV_REMOVED 0x08 79 - #define NV_INT_ENABLE_SDEV_MASK 0x10 80 - #define NV_INT_ENABLE_SDEV_PM 0x20 81 - #define NV_INT_ENABLE_SDEV_ADDED 0x40 82 - #define NV_INT_ENABLE_SDEV_REMOVED 0x80 83 - #define NV_INT_ENABLE_PDEV_HOTPLUG (NV_INT_ENABLE_PDEV_ADDED | \ 84 - NV_INT_ENABLE_PDEV_REMOVED) 85 - #define NV_INT_ENABLE_SDEV_HOTPLUG (NV_INT_ENABLE_SDEV_ADDED | \ 86 - NV_INT_ENABLE_SDEV_REMOVED) 87 - #define NV_INT_ENABLE_HOTPLUG (NV_INT_ENABLE_PDEV_HOTPLUG | \ 88 - NV_INT_ENABLE_SDEV_HOTPLUG) 102 + NV_INT_ENABLE = 0x11, 103 + NV_INT_ENABLE_CK804 = 0x441, 104 + NV_INT_ENABLE_PDEV_MASK = 0x01, 105 + NV_INT_ENABLE_PDEV_PM = 0x02, 106 + NV_INT_ENABLE_PDEV_ADDED = 0x04, 107 + NV_INT_ENABLE_PDEV_REMOVED = 0x08, 108 + NV_INT_ENABLE_SDEV_MASK = 0x10, 109 + NV_INT_ENABLE_SDEV_PM = 0x20, 110 + NV_INT_ENABLE_SDEV_ADDED = 0x40, 111 + NV_INT_ENABLE_SDEV_REMOVED = 0x80, 112 + NV_INT_ENABLE_PDEV_HOTPLUG = (NV_INT_ENABLE_PDEV_ADDED | 113 + NV_INT_ENABLE_PDEV_REMOVED), 114 + NV_INT_ENABLE_SDEV_HOTPLUG = (NV_INT_ENABLE_SDEV_ADDED | 115 + NV_INT_ENABLE_SDEV_REMOVED), 116 + NV_INT_ENABLE_HOTPLUG = (NV_INT_ENABLE_PDEV_HOTPLUG | 117 + NV_INT_ENABLE_SDEV_HOTPLUG), 89 118 90 - #define NV_INT_CONFIG 0x12 91 - #define NV_INT_CONFIG_METHD 0x01 // 0 = INT, 1 = SMI 119 + NV_INT_CONFIG = 0x12, 120 + NV_INT_CONFIG_METHD = 0x01, // 0 = INT, 1 = SMI 92 121 93 - // For PCI config register 20 94 - #define NV_MCP_SATA_CFG_20 0x50 95 - #define NV_MCP_SATA_CFG_20_SATA_SPACE_EN 0x04 122 + // For PCI config register 20 123 + NV_MCP_SATA_CFG_20 = 0x50, 124 + NV_MCP_SATA_CFG_20_SATA_SPACE_EN = 0x04, 125 + }; 96 126 97 127 static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 98 128 static irqreturn_t nv_interrupt (int irq, void *dev_instance, ··· 148 174 PCI_CLASS_STORAGE_RAID<<8, 0xffff00, GENERIC }, 149 175 { 0, } /* terminate list */ 150 176 }; 151 - 152 - #define NV_HOST_FLAGS_SCR_MMIO 0x00000001 153 177 154 178 struct nv_host_desc 155 179 { ··· 304 332 305 333 static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg) 306 334 { 307 - struct ata_host_set *host_set = ap->host_set; 308 - struct nv_host *host = host_set->private_data; 309 - 310 335 if (sc_reg > SCR_CONTROL) 311 336 return 0xffffffffU; 312 337 313 - if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) 314 - return readl((void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); 315 - else 316 - return inl(ap->ioaddr.scr_addr + (sc_reg * 4)); 338 + return ioread32((void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); 317 339 } 318 340 319 341 static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 320 342 { 321 - struct ata_host_set *host_set = ap->host_set; 322 - struct nv_host *host = host_set->private_data; 323 - 324 343 if (sc_reg > SCR_CONTROL) 325 344 return; 326 345 327 - if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) 328 - writel(val, (void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); 329 - else 330 - outl(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 346 + iowrite32(val, (void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); 331 347 } 332 348 333 349 static void nv_host_stop (struct ata_host_set *host_set) 334 350 { 335 351 struct nv_host *host = host_set->private_data; 336 - struct pci_dev *pdev = to_pci_dev(host_set->dev); 337 352 338 353 // Disable hotplug event interrupts. 339 354 if (host->host_desc->disable_hotplug) ··· 328 369 329 370 kfree(host); 330 371 331 - if (host_set->mmio_base) 332 - pci_iounmap(pdev, host_set->mmio_base); 372 + ata_pci_host_stop(host_set); 333 373 } 334 374 335 375 static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ··· 340 382 int pci_dev_busy = 0; 341 383 int rc; 342 384 u32 bar; 385 + unsigned long base; 343 386 344 387 // Make sure this is a SATA controller by counting the number of bars 345 388 // (NVIDIA SATA controllers will always have six bars). Otherwise, ··· 385 426 386 427 probe_ent->private_data = host; 387 428 388 - if (pci_resource_flags(pdev, 5) & IORESOURCE_MEM) 389 - host->host_flags |= NV_HOST_FLAGS_SCR_MMIO; 390 - 391 - if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) { 392 - unsigned long base; 393 - 394 - probe_ent->mmio_base = pci_iomap(pdev, 5, 0); 395 - if (probe_ent->mmio_base == NULL) { 396 - rc = -EIO; 397 - goto err_out_free_host; 398 - } 399 - 400 - base = (unsigned long)probe_ent->mmio_base; 401 - 402 - probe_ent->port[0].scr_addr = 403 - base + NV_PORT0_SCR_REG_OFFSET; 404 - probe_ent->port[1].scr_addr = 405 - base + NV_PORT1_SCR_REG_OFFSET; 406 - } else { 407 - 408 - probe_ent->port[0].scr_addr = 409 - pci_resource_start(pdev, 5) | NV_PORT0_SCR_REG_OFFSET; 410 - probe_ent->port[1].scr_addr = 411 - pci_resource_start(pdev, 5) | NV_PORT1_SCR_REG_OFFSET; 429 + probe_ent->mmio_base = pci_iomap(pdev, 5, 0); 430 + if (!probe_ent->mmio_base) { 431 + rc = -EIO; 432 + goto err_out_free_host; 412 433 } 434 + 435 + base = (unsigned long)probe_ent->mmio_base; 436 + 437 + probe_ent->port[0].scr_addr = base + NV_PORT0_SCR_REG_OFFSET; 438 + probe_ent->port[1].scr_addr = base + NV_PORT1_SCR_REG_OFFSET; 413 439 414 440 pci_set_master(pdev); 415 441 ··· 411 467 return 0; 412 468 413 469 err_out_iounmap: 414 - if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) 415 - pci_iounmap(pdev, probe_ent->mmio_base); 470 + pci_iounmap(pdev, probe_ent->mmio_base); 416 471 err_out_free_host: 417 472 kfree(host); 418 473 err_out_free_ent:
+1 -1
drivers/scsi/sata_sil.c
··· 371 371 if (quirks & SIL_QUIRK_UDMA5MAX) { 372 372 printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", 373 373 ap->id, dev->devno, model_num); 374 - ap->udma_mask &= ATA_UDMA5; 374 + dev->udma_mask &= ATA_UDMA5; 375 375 return; 376 376 } 377 377 }
+11 -14
drivers/scsi/sata_sil24.c
··· 342 342 .udma_mask = 0x3f, /* udma0-5 */ 343 343 .port_ops = &sil24_ops, 344 344 }, 345 - /* sil_3132 */ 345 + /* sil_3132 */ 346 346 { 347 347 .sht = &sil24_sht, 348 348 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | ··· 842 842 static void sil24_host_stop(struct ata_host_set *host_set) 843 843 { 844 844 struct sil24_host_priv *hpriv = host_set->private_data; 845 + struct pci_dev *pdev = to_pci_dev(host_set->dev); 845 846 846 - iounmap(hpriv->host_base); 847 - iounmap(hpriv->port_base); 847 + pci_iounmap(pdev, hpriv->host_base); 848 + pci_iounmap(pdev, hpriv->port_base); 848 849 kfree(hpriv); 849 850 } 850 851 ··· 872 871 goto out_disable; 873 872 874 873 rc = -ENOMEM; 875 - /* ioremap mmio registers */ 876 - host_base = ioremap(pci_resource_start(pdev, 0), 877 - pci_resource_len(pdev, 0)); 874 + /* map mmio registers */ 875 + host_base = pci_iomap(pdev, 0, 0); 878 876 if (!host_base) 879 877 goto out_free; 880 - port_base = ioremap(pci_resource_start(pdev, 2), 881 - pci_resource_len(pdev, 2)); 878 + port_base = pci_iomap(pdev, 2, 0); 882 879 if (!port_base) 883 880 goto out_free; 884 881 885 882 /* allocate & init probe_ent and hpriv */ 886 - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); 883 + probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); 887 884 if (!probe_ent) 888 885 goto out_free; 889 886 890 - hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL); 887 + hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); 891 888 if (!hpriv) 892 889 goto out_free; 893 890 894 - memset(probe_ent, 0, sizeof(*probe_ent)); 895 891 probe_ent->dev = pci_dev_to_dev(pdev); 896 892 INIT_LIST_HEAD(&probe_ent->node); 897 893 ··· 905 907 probe_ent->mmio_base = port_base; 906 908 probe_ent->private_data = hpriv; 907 909 908 - memset(hpriv, 0, sizeof(*hpriv)); 909 910 hpriv->host_base = host_base; 910 911 hpriv->port_base = port_base; 911 912 ··· 1008 1011 1009 1012 out_free: 1010 1013 if (host_base) 1011 - iounmap(host_base); 1014 + pci_iounmap(pdev, host_base); 1012 1015 if (port_base) 1013 - iounmap(port_base); 1016 + pci_iounmap(pdev, port_base); 1014 1017 kfree(probe_ent); 1015 1018 kfree(hpriv); 1016 1019 pci_release_regions(pdev);
+27 -10
drivers/scsi/sata_uli.c
··· 44 44 uli_5287 = 1, 45 45 uli_5281 = 2, 46 46 47 + uli_max_ports = 4, 48 + 47 49 /* PCI configuration registers */ 48 50 ULI5287_BASE = 0x90, /* sata0 phy SCR registers */ 49 51 ULI5287_OFFS = 0x10, /* offset from sata0->sata1 phy regs */ 50 52 ULI5281_BASE = 0x60, /* sata0 phy SCR registers */ 51 53 ULI5281_OFFS = 0x60, /* offset from sata0->sata1 phy regs */ 54 + }; 55 + 56 + struct uli_priv { 57 + unsigned int scr_cfg_addr[uli_max_ports]; 52 58 }; 53 59 54 60 static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); ··· 143 137 144 138 static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) 145 139 { 146 - return ap->ioaddr.scr_addr + (4 * sc_reg); 140 + struct uli_priv *hpriv = ap->host_set->private_data; 141 + return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); 147 142 } 148 143 149 144 static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) ··· 189 182 int rc; 190 183 unsigned int board_idx = (unsigned int) ent->driver_data; 191 184 int pci_dev_busy = 0; 185 + struct uli_priv *hpriv; 192 186 193 187 if (!printed_version++) 194 188 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); ··· 218 210 goto err_out_regions; 219 211 } 220 212 213 + hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); 214 + if (!hpriv) { 215 + rc = -ENOMEM; 216 + goto err_out_probe_ent; 217 + } 218 + 219 + probe_ent->private_data = hpriv; 220 + 221 221 switch (board_idx) { 222 222 case uli_5287: 223 - probe_ent->port[0].scr_addr = ULI5287_BASE; 224 - probe_ent->port[1].scr_addr = ULI5287_BASE + ULI5287_OFFS; 223 + hpriv->scr_cfg_addr[0] = ULI5287_BASE; 224 + hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; 225 225 probe_ent->n_ports = 4; 226 226 227 227 probe_ent->port[2].cmd_addr = pci_resource_start(pdev, 0) + 8; ··· 237 221 probe_ent->port[2].ctl_addr = 238 222 (pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS) + 4; 239 223 probe_ent->port[2].bmdma_addr = pci_resource_start(pdev, 4) + 16; 240 - probe_ent->port[2].scr_addr = ULI5287_BASE + ULI5287_OFFS*4; 224 + hpriv->scr_cfg_addr[2] = ULI5287_BASE + ULI5287_OFFS*4; 241 225 242 226 probe_ent->port[3].cmd_addr = pci_resource_start(pdev, 2) + 8; 243 227 probe_ent->port[3].altstatus_addr = 244 228 probe_ent->port[3].ctl_addr = 245 229 (pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS) + 4; 246 230 probe_ent->port[3].bmdma_addr = pci_resource_start(pdev, 4) + 24; 247 - probe_ent->port[3].scr_addr = ULI5287_BASE + ULI5287_OFFS*5; 231 + hpriv->scr_cfg_addr[3] = ULI5287_BASE + ULI5287_OFFS*5; 248 232 249 233 ata_std_ports(&probe_ent->port[2]); 250 234 ata_std_ports(&probe_ent->port[3]); 251 235 break; 252 236 253 237 case uli_5289: 254 - probe_ent->port[0].scr_addr = ULI5287_BASE; 255 - probe_ent->port[1].scr_addr = ULI5287_BASE + ULI5287_OFFS; 238 + hpriv->scr_cfg_addr[0] = ULI5287_BASE; 239 + hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; 256 240 break; 257 241 258 242 case uli_5281: 259 - probe_ent->port[0].scr_addr = ULI5281_BASE; 260 - probe_ent->port[1].scr_addr = ULI5281_BASE + ULI5281_OFFS; 243 + hpriv->scr_cfg_addr[0] = ULI5281_BASE; 244 + hpriv->scr_cfg_addr[1] = ULI5281_BASE + ULI5281_OFFS; 261 245 break; 262 246 263 247 default: ··· 274 258 275 259 return 0; 276 260 261 + err_out_probe_ent: 262 + kfree(probe_ent); 277 263 err_out_regions: 278 264 pci_release_regions(pdev); 279 - 280 265 err_out: 281 266 if (!pci_dev_busy) 282 267 pci_disable_device(pdev);
+2 -2
drivers/scsi/sata_vsc.c
··· 230 230 handled += ata_host_intr(ap, qc); 231 231 } else if (is_vsc_sata_int_err(i, int_status)) { 232 232 /* 233 - * On some chips (i.e. Intel 31244), an error 233 + * On some chips (i.e. Intel 31244), an error 234 234 * interrupt will sneak in at initialization 235 235 * time (phy state changes). Clearing the SCR 236 236 * error register is not required, but it prevents 237 - * the phy state change interrupts from recurring 237 + * the phy state change interrupts from recurring 238 238 * later. 239 239 */ 240 240 u32 err_status;
+1 -1
drivers/scsi/scsi_sysfs.c
··· 286 286 return err; 287 287 288 288 if (sht->suspend) 289 - err = sht->suspend(sdev); 289 + err = sht->suspend(sdev, state); 290 290 291 291 return err; 292 292 }
+10 -2
include/linux/libata.h
··· 358 358 unsigned int max_sectors; /* per-device max sectors */ 359 359 unsigned int cdb_len; 360 360 361 + /* per-dev xfer mask */ 362 + unsigned int pio_mask; 363 + unsigned int mwdma_mask; 364 + unsigned int udma_mask; 365 + 361 366 /* for CHS addressing */ 362 367 u16 cylinders; /* Number of cylinders */ 363 368 u16 heads; /* Number of heads */ ··· 400 395 401 396 struct ata_host_stats stats; 402 397 struct ata_host_set *host_set; 398 + struct device *dev; 403 399 404 400 struct work_struct port_task; 405 401 ··· 521 515 extern int ata_scsi_release(struct Scsi_Host *host); 522 516 extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 523 517 extern int ata_scsi_device_resume(struct scsi_device *); 524 - extern int ata_scsi_device_suspend(struct scsi_device *); 518 + extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); 525 519 extern int ata_device_resume(struct ata_port *, struct ata_device *); 526 - extern int ata_device_suspend(struct ata_port *, struct ata_device *); 520 + extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state); 527 521 extern int ata_ratelimit(void); 528 522 extern unsigned int ata_busy_sleep(struct ata_port *ap, 529 523 unsigned long timeout_pat, ··· 574 568 struct block_device *bdev, 575 569 sector_t capacity, int geom[]); 576 570 extern int ata_scsi_slave_config(struct scsi_device *sdev); 571 + extern struct ata_device *ata_dev_pair(struct ata_port *ap, 572 + struct ata_device *adev); 577 573 578 574 /* 579 575 * Timing helpers
+1 -1
include/scsi/scsi_host.h
··· 286 286 * suspend support 287 287 */ 288 288 int (*resume)(struct scsi_device *); 289 - int (*suspend)(struct scsi_device *); 289 + int (*suspend)(struct scsi_device *, pm_message_t state); 290 290 291 291 /* 292 292 * Name of proc directory