Commit 5b8f2587 authored by Linus Torvalds's avatar Linus Torvalds

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

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  sata_sil: add Large Block Transfer support
  [libata] ata_piix: cleanup dmi strings checking
  DMI: add dmi_match
  libata: blacklist NCQ on OCZ CORE 2 SSD (resend)
  [libata] Update kernel-doc comments to match source code
  libata: perform port detach in EH
  libata: when restoring SControl during detach do the PMP links first
  libata: beef up iterators
parents 526ea064 c7e324f1
...@@ -1119,14 +1119,14 @@ static void ahci_start_port(struct ata_port *ap) ...@@ -1119,14 +1119,14 @@ static void ahci_start_port(struct ata_port *ap)
/* turn on LEDs */ /* turn on LEDs */
if (ap->flags & ATA_FLAG_EM) { if (ap->flags & ATA_FLAG_EM) {
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
emp = &pp->em_priv[link->pmp]; emp = &pp->em_priv[link->pmp];
ahci_transmit_led_message(ap, emp->led_state, 4); ahci_transmit_led_message(ap, emp->led_state, 4);
} }
} }
if (ap->flags & ATA_FLAG_SW_ACTIVITY) if (ap->flags & ATA_FLAG_SW_ACTIVITY)
ata_port_for_each_link(link, ap) ata_for_each_link(link, ap, EDGE)
ahci_init_sw_activity(link); ahci_init_sw_activity(link);
} }
...@@ -1361,7 +1361,7 @@ static ssize_t ahci_led_show(struct ata_port *ap, char *buf) ...@@ -1361,7 +1361,7 @@ static ssize_t ahci_led_show(struct ata_port *ap, char *buf)
struct ahci_em_priv *emp; struct ahci_em_priv *emp;
int rc = 0; int rc = 0;
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
emp = &pp->em_priv[link->pmp]; emp = &pp->em_priv[link->pmp];
rc += sprintf(buf, "%lx\n", emp->led_state); rc += sprintf(buf, "%lx\n", emp->led_state);
} }
...@@ -1941,7 +1941,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) ...@@ -1941,7 +1941,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
u32 serror; u32 serror;
/* determine active link */ /* determine active link */
ata_port_for_each_link(link, ap) ata_for_each_link(link, ap, EDGE)
if (ata_link_active(link)) if (ata_link_active(link))
break; break;
if (!link) if (!link)
......
...@@ -57,10 +57,7 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused) ...@@ -57,10 +57,7 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
if (pdev->vendor == PCI_VENDOR_ID_CENATEK) if (pdev->vendor == PCI_VENDOR_ID_CENATEK)
dma_enabled = 0xFF; dma_enabled = 0xFF;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (!ata_dev_enabled(dev))
continue;
/* We don't really care */ /* We don't really care */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = XFER_MW_DMA_0; dev->dma_mode = XFER_MW_DMA_0;
......
...@@ -1072,20 +1072,13 @@ static int piix_broken_suspend(void) ...@@ -1072,20 +1072,13 @@ static int piix_broken_suspend(void)
* matching is necessary because dmi_system_id.matches is * matching is necessary because dmi_system_id.matches is
* limited to four entries. * limited to four entries.
*/ */
if (dmi_get_system_info(DMI_SYS_VENDOR) && if (dmi_match(DMI_SYS_VENDOR, "TOSHIBA") &&
dmi_get_system_info(DMI_PRODUCT_NAME) && dmi_match(DMI_PRODUCT_NAME, "000000") &&
dmi_get_system_info(DMI_PRODUCT_VERSION) && dmi_match(DMI_PRODUCT_VERSION, "000000") &&
dmi_get_system_info(DMI_PRODUCT_SERIAL) && dmi_match(DMI_PRODUCT_SERIAL, "000000") &&
dmi_get_system_info(DMI_BOARD_VENDOR) && dmi_match(DMI_BOARD_VENDOR, "TOSHIBA") &&
dmi_get_system_info(DMI_BOARD_NAME) && dmi_match(DMI_BOARD_NAME, "Portable PC") &&
dmi_get_system_info(DMI_BOARD_VERSION) && dmi_match(DMI_BOARD_VERSION, "Version A0"))
!strcmp(dmi_get_system_info(DMI_SYS_VENDOR), "TOSHIBA") &&
!strcmp(dmi_get_system_info(DMI_PRODUCT_NAME), "000000") &&
!strcmp(dmi_get_system_info(DMI_PRODUCT_VERSION), "000000") &&
!strcmp(dmi_get_system_info(DMI_PRODUCT_SERIAL), "000000") &&
!strcmp(dmi_get_system_info(DMI_BOARD_VENDOR), "TOSHIBA") &&
!strcmp(dmi_get_system_info(DMI_BOARD_NAME), "Portable PC") &&
!strcmp(dmi_get_system_info(DMI_BOARD_VERSION), "Version A0"))
return 1; return 1;
return 0; return 0;
......
...@@ -89,7 +89,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap) ...@@ -89,7 +89,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap)
ap->link.device->acpi_handle = NULL; ap->link.device->acpi_handle = NULL;
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
acpi_integer adr = SATA_ADR(ap->port_no, link->pmp); acpi_integer adr = SATA_ADR(ap->port_no, link->pmp);
link->device->acpi_handle = link->device->acpi_handle =
...@@ -129,8 +129,8 @@ static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) ...@@ -129,8 +129,8 @@ static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev)
struct ata_link *tlink; struct ata_link *tlink;
struct ata_device *tdev; struct ata_device *tdev;
ata_port_for_each_link(tlink, ap) ata_for_each_link(tlink, ap, EDGE)
ata_link_for_each_dev(tdev, tlink) ata_for_each_dev(tdev, tlink, ALL)
tdev->flags |= ATA_DFLAG_DETACH; tdev->flags |= ATA_DFLAG_DETACH;
} }
...@@ -588,12 +588,9 @@ int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm) ...@@ -588,12 +588,9 @@ int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm)
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, &ap->link) { ata_for_each_dev(dev, &ap->link, ENABLED) {
unsigned long xfer_mask, udma_mask; unsigned long xfer_mask, udma_mask;
if (!ata_dev_enabled(dev))
continue;
xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); xfer_mask = ata_acpi_gtm_xfermask(dev, gtm);
ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask); ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask);
...@@ -893,7 +890,7 @@ void ata_acpi_on_resume(struct ata_port *ap) ...@@ -893,7 +890,7 @@ void ata_acpi_on_resume(struct ata_port *ap)
* use values set by _STM. Cache _GTF result and * use values set by _STM. Cache _GTF result and
* schedule _GTF. * schedule _GTF.
*/ */
ata_link_for_each_dev(dev, &ap->link) { ata_for_each_dev(dev, &ap->link, ALL) {
ata_acpi_clear_gtf(dev); ata_acpi_clear_gtf(dev);
if (ata_dev_enabled(dev) && if (ata_dev_enabled(dev) &&
ata_dev_get_GTF(dev, NULL) >= 0) ata_dev_get_GTF(dev, NULL) >= 0)
...@@ -904,7 +901,7 @@ void ata_acpi_on_resume(struct ata_port *ap) ...@@ -904,7 +901,7 @@ void ata_acpi_on_resume(struct ata_port *ap)
* there's no reason to evaluate IDE _GTF early * there's no reason to evaluate IDE _GTF early
* without _STM. Clear cache and schedule _GTF. * without _STM. Clear cache and schedule _GTF.
*/ */
ata_link_for_each_dev(dev, &ap->link) { ata_for_each_dev(dev, &ap->link, ALL) {
ata_acpi_clear_gtf(dev); ata_acpi_clear_gtf(dev);
if (ata_dev_enabled(dev)) if (ata_dev_enabled(dev))
dev->flags |= ATA_DFLAG_ACPI_PENDING; dev->flags |= ATA_DFLAG_ACPI_PENDING;
...@@ -932,8 +929,8 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) ...@@ -932,8 +929,8 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
if (state.event == PM_EVENT_ON) if (state.event == PM_EVENT_ON)
acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0); acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0);
ata_link_for_each_dev(dev, &ap->link) { ata_for_each_dev(dev, &ap->link, ENABLED) {
if (dev->acpi_handle && ata_dev_enabled(dev)) if (dev->acpi_handle)
acpi_bus_set_power(dev->acpi_handle, acpi_bus_set_power(dev->acpi_handle,
state.event == PM_EVENT_ON ? state.event == PM_EVENT_ON ?
ACPI_STATE_D0 : ACPI_STATE_D3); ACPI_STATE_D0 : ACPI_STATE_D3);
......
This diff is collapsed.
This diff is collapsed.
...@@ -321,7 +321,7 @@ static void sata_pmp_quirks(struct ata_port *ap) ...@@ -321,7 +321,7 @@ static void sata_pmp_quirks(struct ata_port *ap)
if (vendor == 0x1095 && devid == 0x3726) { if (vendor == 0x1095 && devid == 0x3726) {
/* sil3726 quirks */ /* sil3726 quirks */
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
/* Class code report is unreliable and SRST /* Class code report is unreliable and SRST
* times out under certain configurations. * times out under certain configurations.
*/ */
...@@ -336,7 +336,7 @@ static void sata_pmp_quirks(struct ata_port *ap) ...@@ -336,7 +336,7 @@ static void sata_pmp_quirks(struct ata_port *ap)
} }
} else if (vendor == 0x1095 && devid == 0x4723) { } else if (vendor == 0x1095 && devid == 0x4723) {
/* sil4723 quirks */ /* sil4723 quirks */
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
/* class code report is unreliable */ /* class code report is unreliable */
if (link->pmp < 2) if (link->pmp < 2)
link->flags |= ATA_LFLAG_ASSUME_ATA; link->flags |= ATA_LFLAG_ASSUME_ATA;
...@@ -348,7 +348,7 @@ static void sata_pmp_quirks(struct ata_port *ap) ...@@ -348,7 +348,7 @@ static void sata_pmp_quirks(struct ata_port *ap)
} }
} else if (vendor == 0x1095 && devid == 0x4726) { } else if (vendor == 0x1095 && devid == 0x4726) {
/* sil4726 quirks */ /* sil4726 quirks */
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
/* Class code report is unreliable and SRST /* Class code report is unreliable and SRST
* times out under certain configurations. * times out under certain configurations.
* Config device can be at port 0 or 5 and * Config device can be at port 0 or 5 and
...@@ -450,7 +450,7 @@ int sata_pmp_attach(struct ata_device *dev) ...@@ -450,7 +450,7 @@ int sata_pmp_attach(struct ata_device *dev)
if (ap->ops->pmp_attach) if (ap->ops->pmp_attach)
ap->ops->pmp_attach(ap); ap->ops->pmp_attach(ap);
ata_port_for_each_link(tlink, ap) ata_for_each_link(tlink, ap, EDGE)
sata_link_init_spd(tlink); sata_link_init_spd(tlink);
ata_acpi_associate_sata_port(ap); ata_acpi_associate_sata_port(ap);
...@@ -487,7 +487,7 @@ static void sata_pmp_detach(struct ata_device *dev) ...@@ -487,7 +487,7 @@ static void sata_pmp_detach(struct ata_device *dev)
if (ap->ops->pmp_detach) if (ap->ops->pmp_detach)
ap->ops->pmp_detach(ap); ap->ops->pmp_detach(ap);
ata_port_for_each_link(tlink, ap) ata_for_each_link(tlink, ap, EDGE)
ata_eh_detach_dev(tlink->device); ata_eh_detach_dev(tlink->device);
spin_lock_irqsave(ap->lock, flags); spin_lock_irqsave(ap->lock, flags);
...@@ -700,7 +700,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, ...@@ -700,7 +700,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
} }
/* PMP is reset, SErrors cannot be trusted, scan all */ /* PMP is reset, SErrors cannot be trusted, scan all */
ata_port_for_each_link(tlink, ap) { ata_for_each_link(tlink, ap, EDGE) {
struct ata_eh_context *ehc = &tlink->eh_context; struct ata_eh_context *ehc = &tlink->eh_context;
ehc->i.probe_mask |= ATA_ALL_DEVICES; ehc->i.probe_mask |= ATA_ALL_DEVICES;
...@@ -768,7 +768,7 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap) ...@@ -768,7 +768,7 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap)
spin_lock_irqsave(ap->lock, flags); spin_lock_irqsave(ap->lock, flags);
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
if (!(link->flags & ATA_LFLAG_DISABLED)) if (!(link->flags & ATA_LFLAG_DISABLED))
continue; continue;
...@@ -852,7 +852,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) ...@@ -852,7 +852,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
int cnt, rc; int cnt, rc;
pmp_tries = ATA_EH_PMP_TRIES; pmp_tries = ATA_EH_PMP_TRIES;
ata_port_for_each_link(link, ap) ata_for_each_link(link, ap, EDGE)
link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
retry: retry:
...@@ -861,7 +861,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) ...@@ -861,7 +861,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
rc = ata_eh_recover(ap, ops->prereset, ops->softreset, rc = ata_eh_recover(ap, ops->prereset, ops->softreset,
ops->hardreset, ops->postreset, NULL); ops->hardreset, ops->postreset, NULL);
if (rc) { if (rc) {
ata_link_for_each_dev(dev, &ap->link) ata_for_each_dev(dev, &ap->link, ALL)
ata_dev_disable(dev); ata_dev_disable(dev);
return rc; return rc;
} }
...@@ -870,7 +870,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) ...@@ -870,7 +870,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
return 0; return 0;
/* new PMP online */ /* new PMP online */
ata_port_for_each_link(link, ap) ata_for_each_link(link, ap, EDGE)
link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
/* fall through */ /* fall through */
...@@ -942,7 +942,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) ...@@ -942,7 +942,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
} }
cnt = 0; cnt = 0;
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
if (!(gscr_error & (1 << link->pmp))) if (!(gscr_error & (1 << link->pmp)))
continue; continue;
......
...@@ -3229,12 +3229,12 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) ...@@ -3229,12 +3229,12 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
return; return;
repeat: repeat:
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
struct scsi_device *sdev; struct scsi_device *sdev;
int channel = 0, id = 0; int channel = 0, id = 0;
if (!ata_dev_enabled(dev) || dev->sdev) if (dev->sdev)
continue; continue;
if (ata_is_host_link(link)) if (ata_is_host_link(link))
...@@ -3255,9 +3255,9 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) ...@@ -3255,9 +3255,9 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
* failure occurred, scan would have failed silently. Check * failure occurred, scan would have failed silently. Check
* whether all devices are attached. * whether all devices are attached.
*/ */
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev) && !dev->sdev) if (!dev->sdev)
goto exit_loop; goto exit_loop;
} }
} }
...@@ -3381,7 +3381,7 @@ static void ata_scsi_handle_link_detach(struct ata_link *link) ...@@ -3381,7 +3381,7 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
struct ata_port *ap = link->ap; struct ata_port *ap = link->ap;
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ALL) {
unsigned long flags; unsigned long flags;
if (!(dev->flags & ATA_DFLAG_DETACHED)) if (!(dev->flags & ATA_DFLAG_DETACHED))
...@@ -3496,7 +3496,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, ...@@ -3496,7 +3496,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
if (devno == SCAN_WILD_CARD) { if (devno == SCAN_WILD_CARD) {
struct ata_link *link; struct ata_link *link;
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
struct ata_eh_info *ehi = &link->eh_info; struct ata_eh_info *ehi = &link->eh_info;
ehi->probe_mask |= ATA_ALL_DEVICES; ehi->probe_mask |= ATA_ALL_DEVICES;
ehi->action |= ATA_EH_RESET; ehi->action |= ATA_EH_RESET;
...@@ -3544,11 +3544,11 @@ void ata_scsi_dev_rescan(struct work_struct *work) ...@@ -3544,11 +3544,11 @@ void ata_scsi_dev_rescan(struct work_struct *work)
spin_lock_irqsave(ap->lock, flags); spin_lock_irqsave(ap->lock, flags);
ata_port_for_each_link(link, ap) { ata_for_each_link(link, ap, EDGE) {
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
struct scsi_device *sdev = dev->sdev; struct scsi_device *sdev = dev->sdev;
if (!ata_dev_enabled(dev) || !sdev) if (!sdev)
continue; continue;
if (scsi_device_get(sdev)) if (scsi_device_get(sdev))
continue; continue;
......
...@@ -356,7 +356,6 @@ static void bfin_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -356,7 +356,6 @@ static void bfin_set_piomode(struct ata_port *ap, struct ata_device *adev)
* bfin_set_dmamode - Initialize host controller PATA DMA timings * bfin_set_dmamode - Initialize host controller PATA DMA timings
* @ap: Port whose timings we are configuring * @ap: Port whose timings we are configuring
* @adev: um * @adev: um
* @udma: udma mode, 0 - 6
* *
* Set UDMA mode for device. * Set UDMA mode for device.
* *
......
...@@ -465,8 +465,7 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus ...@@ -465,8 +465,7 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) {
/* We don't really care */ /* We don't really care */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = XFER_MW_DMA_0; dev->dma_mode = XFER_MW_DMA_0;
...@@ -484,7 +483,6 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus ...@@ -484,7 +483,6 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus
dev->flags |= ATA_DFLAG_PIO; dev->flags |= ATA_DFLAG_PIO;
} }
} }
}
return 0; return 0;
} }
......
...@@ -30,15 +30,13 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) ...@@ -30,15 +30,13 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error)
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) {
ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->xfer_mode = XFER_PIO_0; dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO; dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO; dev->flags |= ATA_DFLAG_PIO;
} }
}
return 0; return 0;
} }
......
...@@ -194,16 +194,13 @@ static int legacy_set_mode(struct ata_link *link, struct ata_device **unused) ...@@ -194,16 +194,13 @@ static int legacy_set_mode(struct ata_link *link, struct ata_device **unused)
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) { ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
ata_dev_printk(dev, KERN_INFO,
"configured for PIO\n");
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->xfer_mode = XFER_PIO_0; dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO; dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO; dev->flags |= ATA_DFLAG_PIO;
} }
}
return 0; return 0;
} }
...@@ -641,7 +638,6 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -641,7 +638,6 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
* qdi6580dp_set_piomode - PIO setup for dual channel * qdi6580dp_set_piomode - PIO setup for dual channel
* @ap: Port * @ap: Port
* @adev: Device * @adev: Device
* @irq: interrupt line
* *
* In dual channel mode the 6580 has one clock per channel and we have * In dual channel mode the 6580 has one clock per channel and we have
* to software clockswitch in qc_issue. * to software clockswitch in qc_issue.
...@@ -1028,7 +1024,7 @@ static __init int legacy_init_one(struct legacy_probe *probe) ...@@ -1028,7 +1024,7 @@ static __init int legacy_init_one(struct legacy_probe *probe)
/* Nothing found means we drop the port as its probably not there */ /* Nothing found means we drop the port as its probably not there */
ret = -ENODEV; ret = -ENODEV;
ata_link_for_each_dev(dev, &ap->link) { ata_for_each_dev(dev, &ap->link, ALL) {
if (!ata_dev_absent(dev)) { if (!ata_dev_absent(dev)) {
legacy_host[probe->slot] = host; legacy_host[probe->slot] = host;
ld->platform_dev = pdev; ld->platform_dev = pdev;
......
...@@ -116,7 +116,6 @@ static void oldpiix_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -116,7 +116,6 @@ static void oldpiix_set_piomode (struct ata_port *ap, struct ata_device *adev)
* oldpiix_set_dmamode - Initialize host controller PATA DMA timings * oldpiix_set_dmamode - Initialize host controller PATA DMA timings
* @ap: Port whose timings we are configuring * @ap: Port whose timings we are configuring
* @adev: Device to program * @adev: Device to program
* @isich: True if the device is an ICH and has IOCFG registers
* *
* Set MWDMA mode for device, in host controller PCI config space. * Set MWDMA mode for device, in host controller PCI config space.
* *
......
...@@ -281,7 +281,6 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long ...@@ -281,7 +281,6 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long
* pdc2027x_set_piomode - Initialize host controller PATA PIO timings * pdc2027x_set_piomode - Initialize host controller PATA PIO timings
* @ap: Port to configure * @ap: Port to configure
* @adev: um * @adev: um
* @pio: PIO mode, 0 - 4
* *
* Set PIO mode for device. * Set PIO mode for device.
* *
...@@ -326,7 +325,6 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -326,7 +325,6 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
* pdc2027x_set_dmamode - Initialize host controller PATA UDMA timings * pdc2027x_set_dmamode - Initialize host controller PATA UDMA timings
* @ap: Port to configure * @ap: Port to configure
* @adev: um * @adev: um
* @udma: udma mode, XFER_UDMA_0 to XFER_UDMA_6
* *
* Set UDMA mode for device. * Set UDMA mode for device.
* *
...@@ -406,9 +404,7 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed ...@@ -406,9 +404,7 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed
if (rc < 0) if (rc < 0)
return rc; return rc;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) {
pdc2027x_set_piomode(ap, dev); pdc2027x_set_piomode(ap, dev);
/* /*
...@@ -424,7 +420,6 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed ...@@ -424,7 +420,6 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed
pdc2027x_set_dmamode(ap, dev); pdc2027x_set_dmamode(ap, dev);
} }
} }
}
return 0; return 0;
} }
......
...@@ -34,15 +34,13 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu ...@@ -34,15 +34,13 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) {
/* We don't really care */ /* We don't really care */
dev->pio_mode = dev->xfer_mode = XFER_PIO_0; dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO; dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO; dev->flags |= ATA_DFLAG_PIO;
ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
} }
}
return 0; return 0;
} }
......
...@@ -81,7 +81,6 @@ static void radisys_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -81,7 +81,6 @@ static void radisys_set_piomode (struct ata_port *ap, struct ata_device *adev)
* radisys_set_dmamode - Initialize host controller PATA DMA timings * radisys_set_dmamode - Initialize host controller PATA DMA timings
* @ap: Port whose timings we are configuring * @ap: Port whose timings we are configuring
* @adev: Device to program * @adev: Device to program
* @isich: True if the device is an ICH and has IOCFG registers
* *
* Set MWDMA mode for device, in host controller PCI config space. * Set MWDMA mode for device, in host controller PCI config space.
* *
......
...@@ -38,8 +38,7 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused) ...@@ -38,8 +38,7 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused)
{ {
struct ata_device *dev; struct ata_device *dev;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ENABLED) {
if (ata_dev_enabled(dev)) {
/* We don't really care */ /* We don't really care */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->xfer_mode = XFER_PIO_0; dev->xfer_mode = XFER_PIO_0;
...@@ -47,7 +46,6 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused) ...@@ -47,7 +46,6 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused)
dev->flags |= ATA_DFLAG_PIO; dev->flags |= ATA_DFLAG_PIO;
ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
} }
}
return 0; return 0;
} }
......
...@@ -210,7 +210,6 @@ static void scc_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -210,7 +210,6 @@ static void scc_set_piomode (struct ata_port *ap, struct ata_device *adev)
* scc_set_dmamode - Initialize host controller PATA DMA timings * scc_set_dmamode - Initialize host controller PATA DMA timings
* @ap: Port whose timings we are configuring * @ap: Port whose timings we are configuring
* @adev: um * @adev: um
* @udma: udma mode, 0 - 6
* *
* Set UDMA mode for device. * Set UDMA mode for device.
* *
......
...@@ -138,7 +138,6 @@ static struct sv_cable_table cable_detect[] = { ...@@ -138,7 +138,6 @@ static struct sv_cable_table cable_detect[] = {
/** /**
* serverworks_cable_detect - cable detection * serverworks_cable_detect - cable detection
* @ap: ATA port * @ap: ATA port
* @deadline: deadline jiffies for the operation
* *
* Perform cable detection according to the device and subvendor * Perform cable detection according to the device and subvendor
* identifications * identifications
......
...@@ -112,7 +112,6 @@ static int sis_133_cable_detect(struct ata_port *ap) ...@@ -112,7 +112,6 @@ static int sis_133_cable_detect(struct ata_port *ap)
/** /**
* sis_66_cable_detect - check for 40/80 pin * sis_66_cable_detect - check for 40/80 pin
* @ap: Port * @ap: Port
* @deadline: deadline jiffies for the operation
* *
* Perform cable detection on the UDMA66, UDMA100 and early UDMA133 * Perform cable detection on the UDMA66, UDMA100 and early UDMA133
* SiS IDE controllers. * SiS IDE controllers.
......
...@@ -1836,7 +1836,6 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled) ...@@ -1836,7 +1836,6 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled)
/** /**
* mv_err_intr - Handle error interrupts on the port * mv_err_intr - Handle error interrupts on the port
* @ap: ATA channel to manipulate * @ap: ATA channel to manipulate
* @qc: affected command (non-NCQ), or NULL
* *
* Most cases require a full reset of the chip's state machine, * Most cases require a full reset of the chip's state machine,
* which also performs a COMRESET. * which also performs a COMRESET.
......
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "sata_sil" #define DRV_NAME "sata_sil"
#define DRV_VERSION "2.3" #define DRV_VERSION "2.4"
#define SIL_DMA_BOUNDARY 0x7fffffffUL
enum { enum {
SIL_MMIO_BAR = 5, SIL_MMIO_BAR = 5,
...@@ -118,6 +120,10 @@ static void sil_dev_config(struct ata_device *dev); ...@@ -118,6 +120,10 @@ static void sil_dev_config(struct ata_device *dev);
static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed);
static void sil_qc_prep(struct ata_queued_cmd *qc);
static void sil_bmdma_setup(struct ata_queued_cmd *qc);
static void sil_bmdma_start(struct ata_queued_cmd *qc);
static void sil_bmdma_stop(struct ata_queued_cmd *qc);
static void sil_freeze(struct ata_port *ap); static void sil_freeze(struct ata_port *ap);
static void sil_thaw(struct ata_port *ap); static void sil_thaw(struct ata_port *ap);
...@@ -167,13 +173,22 @@ static struct pci_driver sil_pci_driver = { ...@@ -167,13 +173,22 @@ static struct pci_driver sil_pci_driver = {
}; };
static struct scsi_host_template sil_sht = { static struct scsi_host_template sil_sht = {
ATA_BMDMA_SHT(DRV_NAME), ATA_BASE_SHT(DRV_NAME),
/** These controllers support Large Block Transfer which allows
transfer chunks up to 2GB and which cross 64KB boundaries,
therefore the DMA limits are more relaxed than standard ATA SFF. */
.dma_boundary = SIL_DMA_BOUNDARY,
.sg_tablesize = ATA_MAX_PRD
}; };
static struct ata_port_operations sil_ops = { static struct ata_port_operations sil_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.dev_config = sil_dev_config, .dev_config = sil_dev_config,
.set_mode = sil_set_mode, .set_mode = sil_set_mode,
.bmdma_setup = sil_bmdma_setup,
.bmdma_start = sil_bmdma_start,
.bmdma_stop = sil_bmdma_stop,
.qc_prep = sil_qc_prep,
.freeze = sil_freeze, .freeze = sil_freeze,
.thaw = sil_thaw, .thaw = sil_thaw,
.scr_read = sil_scr_read, .scr_read = sil_scr_read,
...@@ -249,6 +264,83 @@ module_param(slow_down, int, 0444); ...@@ -249,6 +264,83 @@ module_param(slow_down, int, 0444);
MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)");
static void sil_bmdma_stop(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2;
/* clear start/stop bit - can safely always write 0 */
iowrite8(0, bmdma2);
/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
ata_sff_dma_pause(ap);
}
static void sil_bmdma_setup(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void __iomem *bmdma = ap->ioaddr.bmdma_addr;
/* load PRD table addr. */
iowrite32(ap->prd_dma, bmdma + ATA_DMA_TABLE_OFS);
/* issue r/w command */
ap->ops->sff_exec_command(ap, &qc->tf);
}
static void sil_bmdma_start(struct ata_queued_cmd *qc)
{
unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
struct ata_port *ap = qc->ap;
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2;
u8 dmactl = ATA_DMA_START;
/* set transfer direction, start host DMA transaction
Note: For Large Block Transfer to work, the DMA must be started
using the bmdma2 register. */
if (!rw)
dmactl |= ATA_DMA_WR;
iowrite8(dmactl, bmdma2);
}
/* The way God intended PCI IDE scatter/gather lists to look and behave... */
static void sil_fill_sg(struct ata_queued_cmd *qc)
{
struct scatterlist *sg;
struct ata_port *ap = qc->ap;
struct ata_prd *prd, *last_prd = NULL;
unsigned int si;
prd = &ap->prd[0];
for_each_sg(qc->sg, sg, qc->n_elem, si) {
/* Note h/w doesn't support 64-bit, so we unconditionally
* truncate dma_addr_t to u32.
*/
u32 addr = (u32) sg_dma_address(sg);
u32 sg_len = sg_dma_len(sg);
prd->addr = cpu_to_le32(addr);
prd->flags_len = cpu_to_le32(sg_len);
VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len);
last_prd = prd;
prd++;
}
if (likely(last_prd))
last_prd->flags_len |= cpu_to_le32(ATA_PRD_EOT);
}
static void sil_qc_prep(struct ata_queued_cmd *qc)
{
if (!(qc->flags & ATA_QCFLAG_DMAMAP))
return;
sil_fill_sg(qc);
}
static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
{ {
u8 cache_line = 0; u8 cache_line = 0;
...@@ -278,7 +370,7 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed) ...@@ -278,7 +370,7 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed)
if (rc) if (rc)
return rc; return rc;
ata_link_for_each_dev(dev, link) { ata_for_each_dev(dev, link, ALL) {
if (!ata_dev_enabled(dev)) if (!ata_dev_enabled(dev))
dev_mode[dev->devno] = 0; /* PIO0/1/2 */ dev_mode[dev->devno] = 0; /* PIO0/1/2 */
else if (dev->flags & ATA_DFLAG_PIO) else if (dev->flags & ATA_DFLAG_PIO)
......
...@@ -582,3 +582,19 @@ int dmi_walk(void (*decode)(const struct dmi_header *)) ...@@ -582,3 +582,19 @@ int dmi_walk(void (*decode)(const struct dmi_header *))
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(dmi_walk); EXPORT_SYMBOL_GPL(dmi_walk);
/**
* dmi_match - compare a string to the dmi field (if exists)
*
* Returns true if the requested field equals to the str (including NULL).
*/
bool dmi_match(enum dmi_field f, const char *str)
{
const char *info = dmi_get_system_info(f);
if (info == NULL || str == NULL)
return info == str;
return !strcmp(info, str);
}
EXPORT_SYMBOL_GPL(dmi_match);
...@@ -47,6 +47,7 @@ extern int dmi_name_in_vendors(const char *str); ...@@ -47,6 +47,7 @@ extern int dmi_name_in_vendors(const char *str);
extern int dmi_name_in_serial(const char *str); extern int dmi_name_in_serial(const char *str);
extern int dmi_available; extern int dmi_available;
extern int dmi_walk(void (*decode)(const struct dmi_header *)); extern int dmi_walk(void (*decode)(const struct dmi_header *));
extern bool dmi_match(enum dmi_field f, const char *str);
#else #else
...@@ -61,6 +62,8 @@ static inline int dmi_name_in_serial(const char *s) { return 0; } ...@@ -61,6 +62,8 @@ static inline int dmi_name_in_serial(const char *s) { return 0; }
#define dmi_available 0 #define dmi_available 0
static inline int dmi_walk(void (*decode)(const struct dmi_header *)) static inline int dmi_walk(void (*decode)(const struct dmi_header *))
{ return -1; } { return -1; }
static inline bool dmi_match(enum dmi_field f, const char *str)
{ return false; }
#endif #endif
......
...@@ -213,10 +213,11 @@ enum { ...@@ -213,10 +213,11 @@ enum {
ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */
ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */
ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
...@@ -1285,26 +1286,62 @@ static inline int ata_link_active(struct ata_link *link) ...@@ -1285,26 +1286,62 @@ static inline int ata_link_active(struct ata_link *link)
return ata_tag_valid(link->active_tag) || link->sactive; return ata_tag_valid(link->active_tag) || link->sactive;
} }
extern struct ata_link *__ata_port_next_link(struct ata_port *ap, /*
struct ata_link *link, * Iterators
bool dev_only); *
* ATA_LITER_* constants are used to select link iteration mode and
* ATA_DITER_* device iteration mode.
*
* For a custom iteration directly using ata_{link|dev}_next(), if
* @link or @dev, respectively, is NULL, the first element is
* returned. @dev and @link can be any valid device or link and the
* next element according to the iteration mode will be returned.
* After the last element, NULL is returned.
*/
enum ata_link_iter_mode {
ATA_LITER_EDGE, /* if present, PMP links only; otherwise,
* host link. no slave link */
ATA_LITER_HOST_FIRST, /* host link followed by PMP or slave links */
ATA_LITER_PMP_FIRST, /* PMP links followed by host link,
* slave link still comes after host link */
};
#define __ata_port_for_each_link(link, ap) \ enum ata_dev_iter_mode {
for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ ATA_DITER_ENABLED,
(link) = __ata_port_next_link((ap), (link), false)) ATA_DITER_ENABLED_REVERSE,
ATA_DITER_ALL,
ATA_DITER_ALL_REVERSE,
};
#define ata_port_for_each_link(link, ap) \ extern struct ata_link *ata_link_next(struct ata_link *link,
for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ struct ata_port *ap,
(link) = __ata_port_next_link((ap), (link), true)) enum ata_link_iter_mode mode);
#define ata_link_for_each_dev(dev, link) \ extern struct ata_device *ata_dev_next(struct ata_device *dev,
for ((dev) = (link)->device; \ struct ata_link *link,
(dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ enum ata_dev_iter_mode mode);
(dev)++)
/*
* Shortcut notation for iterations
*
* ata_for_each_link() iterates over each link of @ap according to
* @mode. @link points to the current link in the loop. @link is
* NULL after loop termination. ata_for_each_dev() works the same way
* except that it iterates over each device of @link.
*
* Note that the mode prefixes ATA_{L|D}ITER_ shouldn't need to be
* specified when using the following shorthand notations. Only the
* mode itself (EDGE, HOST_FIRST, ENABLED, etc...) should be
* specified. This not only increases brevity but also makes it
* impossible to use ATA_LITER_* for device iteration or vice-versa.
*/
#define ata_for_each_link(link, ap, mode) \
for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
(link) = ata_link_next((link), (ap), ATA_LITER_##mode))
#define ata_link_for_each_dev_reverse(dev, link) \ #define ata_for_each_dev(dev, link, mode) \
for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \
(dev) >= (link)->device || ((dev) = NULL); (dev)--) (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode))
/** /**
* ata_ncq_enabled - Test whether NCQ is enabled * ata_ncq_enabled - Test whether NCQ is enabled
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment