Loading drivers/scsi/libata-core.c +49 −29 Original line number Original line Diff line number Diff line Loading @@ -65,7 +65,7 @@ static unsigned int ata_dev_init_params(struct ata_port *ap, struct ata_device *dev, struct ata_device *dev, u16 heads, u16 heads, u16 sectors); u16 sectors); static void ata_set_mode(struct ata_port *ap); static int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); static unsigned int ata_dev_set_xfermode(struct ata_port *ap, static unsigned int ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); struct ata_device *dev); static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); Loading Loading @@ -1382,6 +1382,7 @@ static int ata_bus_probe(struct ata_port *ap) { { unsigned int classes[ATA_MAX_DEVICES]; unsigned int classes[ATA_MAX_DEVICES]; int i, rc, found = 0; int i, rc, found = 0; struct ata_device *dev; ata_port_probe(ap); ata_port_probe(ap); Loading Loading @@ -1411,8 +1412,7 @@ static int ata_bus_probe(struct ata_port *ap) /* read IDENTIFY page and configure devices */ /* read IDENTIFY page and configure devices */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { struct ata_device *dev = &ap->device[i]; dev = &ap->device[i]; dev->class = classes[i]; dev->class = classes[i]; if (!ata_dev_enabled(dev)) if (!ata_dev_enabled(dev)) Loading @@ -1432,20 +1432,26 @@ static int ata_bus_probe(struct ata_port *ap) found = 1; found = 1; } } if (!found) /* configure transfer mode */ goto err_out_disable; if (ap->ops->set_mode) { /* FIXME: make ->set_mode handle no device case and if (ap->ops->set_mode) * return error code and failing device on failure as * ata_set_mode() does. */ if (found) ap->ops->set_mode(ap); ap->ops->set_mode(ap); else rc = 0; ata_set_mode(ap); } else { while (ata_set_mode(ap, &dev)) if (ap->flags & ATA_FLAG_PORT_DISABLED) ata_dev_disable(ap, dev); goto err_out_disable; } for (i = 0; i < ATA_MAX_DEVICES; i++) if (ata_dev_enabled(&ap->device[i])) return 0; return 0; err_out_disable: /* no device present, disable port */ ata_port_disable(ap); ap->ops->port_disable(ap); ap->ops->port_disable(ap); return -ENODEV; return -ENODEV; } } Loading Loading @@ -1788,16 +1794,22 @@ static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) /** /** * ata_set_mode - Program timings and issue SET FEATURES - XFER * ata_set_mode - Program timings and issue SET FEATURES - XFER * @ap: port on which timings will be programmed * @ap: port on which timings will be programmed * @r_failed_dev: out paramter for failed device * * * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If * ata_set_mode() fails, pointer to the failing device is * returned in @r_failed_dev. * * * LOCKING: * LOCKING: * PCI/etc. bus probe sem. * PCI/etc. bus probe sem. * * RETURNS: * 0 on success, negative errno otherwise */ */ static void ata_set_mode(struct ata_port *ap) static int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) { { struct ata_device *dev; struct ata_device *dev; int i, rc, used_dma = 0, found = 0; int i, rc = 0, used_dma = 0, found = 0; /* step 1: calculate xfer_mask */ /* step 1: calculate xfer_mask */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { Loading @@ -1820,7 +1832,7 @@ static void ata_set_mode(struct ata_port *ap) used_dma = 1; used_dma = 1; } } if (!found) if (!found) return; goto out; /* step 2: always set host PIO timings */ /* step 2: always set host PIO timings */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { Loading @@ -1832,7 +1844,7 @@ static void ata_set_mode(struct ata_port *ap) printk(KERN_WARNING "ata%u: dev %u no PIO support\n", printk(KERN_WARNING "ata%u: dev %u no PIO support\n", ap->id, dev->devno); ap->id, dev->devno); rc = -EINVAL; rc = -EINVAL; goto err_out; goto out; } } dev->xfer_mode = dev->pio_mode; dev->xfer_mode = dev->pio_mode; Loading Loading @@ -1863,7 +1875,7 @@ static void ata_set_mode(struct ata_port *ap) rc = ata_dev_set_mode(ap, dev); rc = ata_dev_set_mode(ap, dev); if (rc) if (rc) goto err_out; goto out; } } /* Record simplex status. If we selected DMA then the other /* Record simplex status. If we selected DMA then the other Loading @@ -1876,10 +1888,10 @@ static void ata_set_mode(struct ata_port *ap) if (ap->ops->post_set_mode) if (ap->ops->post_set_mode) ap->ops->post_set_mode(ap); ap->ops->post_set_mode(ap); return; out: if (rc) err_out: *r_failed_dev = dev; ata_port_disable(ap); return rc; } } /** /** Loading Loading @@ -2134,9 +2146,11 @@ void ata_bus_reset(struct ata_port *ap) static int sata_phy_resume(struct ata_port *ap) static int sata_phy_resume(struct ata_port *ap) { { unsigned long timeout = jiffies + (HZ * 5); unsigned long timeout = jiffies + (HZ * 5); u32 sstatus; u32 scontrol, sstatus; scr_write_flush(ap, SCR_CONTROL, 0x300); scontrol = scr_read(ap, SCR_CONTROL); scontrol = (scontrol & 0x0f0) | 0x300; scr_write_flush(ap, SCR_CONTROL, scontrol); /* Wait for phy to become ready, if necessary. */ /* Wait for phy to become ready, if necessary. */ do { do { Loading Loading @@ -2249,10 +2263,14 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes) */ */ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) { { u32 scontrol; DPRINTK("ENTER\n"); DPRINTK("ENTER\n"); /* Issue phy wake/reset */ /* Issue phy wake/reset */ scr_write_flush(ap, SCR_CONTROL, 0x301); scontrol = scr_read(ap, SCR_CONTROL); scontrol = (scontrol & 0x0f0) | 0x301; scr_write_flush(ap, SCR_CONTROL, scontrol); /* /* * Couldn't find anything in SATA I/II specs, but AHCI-1.1 * Couldn't find anything in SATA I/II specs, but AHCI-1.1 Loading Loading @@ -4452,8 +4470,10 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) int ata_device_resume(struct ata_port *ap, struct ata_device *dev) int ata_device_resume(struct ata_port *ap, struct ata_device *dev) { { if (ap->flags & ATA_FLAG_SUSPENDED) { if (ap->flags & ATA_FLAG_SUSPENDED) { struct ata_device *failed_dev; ap->flags &= ~ATA_FLAG_SUSPENDED; ap->flags &= ~ATA_FLAG_SUSPENDED; ata_set_mode(ap); while (ata_set_mode(ap, &failed_dev)) ata_dev_disable(ap, failed_dev); } } if (!ata_dev_enabled(dev)) if (!ata_dev_enabled(dev)) return 0; return 0; Loading Loading
drivers/scsi/libata-core.c +49 −29 Original line number Original line Diff line number Diff line Loading @@ -65,7 +65,7 @@ static unsigned int ata_dev_init_params(struct ata_port *ap, struct ata_device *dev, struct ata_device *dev, u16 heads, u16 heads, u16 sectors); u16 sectors); static void ata_set_mode(struct ata_port *ap); static int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); static unsigned int ata_dev_set_xfermode(struct ata_port *ap, static unsigned int ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); struct ata_device *dev); static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); Loading Loading @@ -1382,6 +1382,7 @@ static int ata_bus_probe(struct ata_port *ap) { { unsigned int classes[ATA_MAX_DEVICES]; unsigned int classes[ATA_MAX_DEVICES]; int i, rc, found = 0; int i, rc, found = 0; struct ata_device *dev; ata_port_probe(ap); ata_port_probe(ap); Loading Loading @@ -1411,8 +1412,7 @@ static int ata_bus_probe(struct ata_port *ap) /* read IDENTIFY page and configure devices */ /* read IDENTIFY page and configure devices */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { struct ata_device *dev = &ap->device[i]; dev = &ap->device[i]; dev->class = classes[i]; dev->class = classes[i]; if (!ata_dev_enabled(dev)) if (!ata_dev_enabled(dev)) Loading @@ -1432,20 +1432,26 @@ static int ata_bus_probe(struct ata_port *ap) found = 1; found = 1; } } if (!found) /* configure transfer mode */ goto err_out_disable; if (ap->ops->set_mode) { /* FIXME: make ->set_mode handle no device case and if (ap->ops->set_mode) * return error code and failing device on failure as * ata_set_mode() does. */ if (found) ap->ops->set_mode(ap); ap->ops->set_mode(ap); else rc = 0; ata_set_mode(ap); } else { while (ata_set_mode(ap, &dev)) if (ap->flags & ATA_FLAG_PORT_DISABLED) ata_dev_disable(ap, dev); goto err_out_disable; } for (i = 0; i < ATA_MAX_DEVICES; i++) if (ata_dev_enabled(&ap->device[i])) return 0; return 0; err_out_disable: /* no device present, disable port */ ata_port_disable(ap); ap->ops->port_disable(ap); ap->ops->port_disable(ap); return -ENODEV; return -ENODEV; } } Loading Loading @@ -1788,16 +1794,22 @@ static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) /** /** * ata_set_mode - Program timings and issue SET FEATURES - XFER * ata_set_mode - Program timings and issue SET FEATURES - XFER * @ap: port on which timings will be programmed * @ap: port on which timings will be programmed * @r_failed_dev: out paramter for failed device * * * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If * ata_set_mode() fails, pointer to the failing device is * returned in @r_failed_dev. * * * LOCKING: * LOCKING: * PCI/etc. bus probe sem. * PCI/etc. bus probe sem. * * RETURNS: * 0 on success, negative errno otherwise */ */ static void ata_set_mode(struct ata_port *ap) static int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) { { struct ata_device *dev; struct ata_device *dev; int i, rc, used_dma = 0, found = 0; int i, rc = 0, used_dma = 0, found = 0; /* step 1: calculate xfer_mask */ /* step 1: calculate xfer_mask */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { Loading @@ -1820,7 +1832,7 @@ static void ata_set_mode(struct ata_port *ap) used_dma = 1; used_dma = 1; } } if (!found) if (!found) return; goto out; /* step 2: always set host PIO timings */ /* step 2: always set host PIO timings */ for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) { Loading @@ -1832,7 +1844,7 @@ static void ata_set_mode(struct ata_port *ap) printk(KERN_WARNING "ata%u: dev %u no PIO support\n", printk(KERN_WARNING "ata%u: dev %u no PIO support\n", ap->id, dev->devno); ap->id, dev->devno); rc = -EINVAL; rc = -EINVAL; goto err_out; goto out; } } dev->xfer_mode = dev->pio_mode; dev->xfer_mode = dev->pio_mode; Loading Loading @@ -1863,7 +1875,7 @@ static void ata_set_mode(struct ata_port *ap) rc = ata_dev_set_mode(ap, dev); rc = ata_dev_set_mode(ap, dev); if (rc) if (rc) goto err_out; goto out; } } /* Record simplex status. If we selected DMA then the other /* Record simplex status. If we selected DMA then the other Loading @@ -1876,10 +1888,10 @@ static void ata_set_mode(struct ata_port *ap) if (ap->ops->post_set_mode) if (ap->ops->post_set_mode) ap->ops->post_set_mode(ap); ap->ops->post_set_mode(ap); return; out: if (rc) err_out: *r_failed_dev = dev; ata_port_disable(ap); return rc; } } /** /** Loading Loading @@ -2134,9 +2146,11 @@ void ata_bus_reset(struct ata_port *ap) static int sata_phy_resume(struct ata_port *ap) static int sata_phy_resume(struct ata_port *ap) { { unsigned long timeout = jiffies + (HZ * 5); unsigned long timeout = jiffies + (HZ * 5); u32 sstatus; u32 scontrol, sstatus; scr_write_flush(ap, SCR_CONTROL, 0x300); scontrol = scr_read(ap, SCR_CONTROL); scontrol = (scontrol & 0x0f0) | 0x300; scr_write_flush(ap, SCR_CONTROL, scontrol); /* Wait for phy to become ready, if necessary. */ /* Wait for phy to become ready, if necessary. */ do { do { Loading Loading @@ -2249,10 +2263,14 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes) */ */ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) { { u32 scontrol; DPRINTK("ENTER\n"); DPRINTK("ENTER\n"); /* Issue phy wake/reset */ /* Issue phy wake/reset */ scr_write_flush(ap, SCR_CONTROL, 0x301); scontrol = scr_read(ap, SCR_CONTROL); scontrol = (scontrol & 0x0f0) | 0x301; scr_write_flush(ap, SCR_CONTROL, scontrol); /* /* * Couldn't find anything in SATA I/II specs, but AHCI-1.1 * Couldn't find anything in SATA I/II specs, but AHCI-1.1 Loading Loading @@ -4452,8 +4470,10 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) int ata_device_resume(struct ata_port *ap, struct ata_device *dev) int ata_device_resume(struct ata_port *ap, struct ata_device *dev) { { if (ap->flags & ATA_FLAG_SUSPENDED) { if (ap->flags & ATA_FLAG_SUSPENDED) { struct ata_device *failed_dev; ap->flags &= ~ATA_FLAG_SUSPENDED; ap->flags &= ~ATA_FLAG_SUSPENDED; ata_set_mode(ap); while (ata_set_mode(ap, &failed_dev)) ata_dev_disable(ap, failed_dev); } } if (!ata_dev_enabled(dev)) if (!ata_dev_enabled(dev)) return 0; return 0; Loading