229
230
if (status != 0xff && (status & ATA_BUSY))
230
ata_port_printk(ap, KERN_WARNING,
231
"port is slow to respond, please be patient "
232
"(Status 0x%x)\n", status);
232
"port is slow to respond, please be patient (Status 0x%x)\n",
234
235
timeout = ata_deadline(timer_start, tmout);
235
236
while (status != 0xff && (status & ATA_BUSY) &&
244
245
if (status & ATA_BUSY) {
245
ata_port_printk(ap, KERN_ERR, "port failed to respond "
246
"(%lu secs, Status 0x%x)\n",
247
DIV_ROUND_UP(tmout, 1000), status);
247
"port failed to respond (%lu secs, Status 0x%x)\n",
248
DIV_ROUND_UP(tmout, 1000), status);
350
351
unsigned int wait, unsigned int can_sleep)
352
353
if (ata_msg_probe(ap))
353
ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, "
354
"device %u, wait %u\n", device, wait);
354
ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
357
358
ata_wait_idle(ap);
570
571
/* Transfer trailing byte, if any. */
571
572
if (unlikely(buflen & 0x01)) {
572
unsigned char pad[2];
573
unsigned char pad[2] = { };
574
575
/* Point buf to the tail of buffer */
575
576
buf += buflen - 1;
678
679
unsigned int consumed;
680
681
local_irq_save(flags);
681
consumed = ata_sff_data_xfer(dev, buf, buflen, rw);
682
consumed = ata_sff_data_xfer32(dev, buf, buflen, rw);
682
683
local_irq_restore(flags);
1334
1335
cancel_delayed_work_sync(&ap->sff_pio_task);
1335
1336
ap->hsm_task_state = HSM_ST_IDLE;
1337
ap->sff_pio_task_link = NULL;
1337
1339
if (ata_msg_ctl(ap))
1338
ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
1340
ata_port_dbg(ap, "%s: EXIT\n", __func__);
1341
1343
static void ata_sff_pio_task(struct work_struct *work)
1513
1515
ap->ops->sff_check_status(ap);
1514
1516
if (ap->ops->sff_irq_clear)
1515
1517
ap->ops->sff_irq_clear(ap);
1516
ata_port_printk(ap, KERN_WARNING, "irq trap\n");
1518
ata_port_warn(ap, "irq trap\n");
1712
1714
/* There was a command running, we are no longer busy and we have
1713
1715
no interrupt. */
1714
ata_port_printk(ap, KERN_WARNING, "lost interrupt (Status 0x%x)\n",
1716
ata_port_warn(ap, "lost interrupt (Status 0x%x)\n",
1716
1718
/* Run the host interrupt logic as if the interrupt had not been
1798
1800
if (!ata_link_offline(link)) {
1799
1801
rc = ata_sff_wait_ready(link, deadline);
1800
1802
if (rc && rc != -ENODEV) {
1801
ata_link_printk(link, KERN_WARNING, "device not ready "
1802
"(errno=%d), forcing hardreset\n", rc);
1804
"device not ready (errno=%d), forcing hardreset\n",
1803
1806
ehc->i.action |= ATA_EH_HARDRESET;
2056
2059
rc = ata_bus_softreset(ap, devmask, deadline);
2057
2060
/* if link is occupied, -ENODEV too is an error */
2058
2061
if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
2059
ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
2062
ata_link_err(link, "SRST failed (errno=%d)\n", rc);
2171
2174
/* Can become DEBUG later */
2173
ata_port_printk(ap, KERN_DEBUG,
2174
"drained %d bytes to clear DRQ.\n", count);
2176
ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count);
2177
2179
EXPORT_SYMBOL_GPL(ata_sff_drain_fifo);
2316
2318
rc = pcim_iomap_regions(pdev, 0x3 << base,
2317
2319
dev_driver_string(gdev));
2319
dev_printk(KERN_WARNING, gdev,
2320
"failed to request/iomap BARs for port %d "
2321
"(errno=%d)\n", i, rc);
2322
"failed to request/iomap BARs for port %d (errno=%d)\n",
2322
2324
if (rc == -EBUSY)
2323
2325
pcim_pin_device(pdev);
2324
2326
ap->ops = &ata_dummy_port_ops;
2376
2378
host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
2378
dev_printk(KERN_ERR, &pdev->dev,
2379
"failed to allocate ATA host\n");
2380
dev_err(&pdev->dev, "failed to allocate ATA host\n");
2511
static int ata_pci_init_one(struct pci_dev *pdev,
2512
const struct ata_port_info * const *ppi,
2513
struct scsi_host_template *sht, void *host_priv,
2514
int hflags, bool bmdma)
2516
struct device *dev = &pdev->dev;
2517
const struct ata_port_info *pi;
2518
struct ata_host *host = NULL;
2523
pi = ata_sff_find_valid_pi(ppi);
2525
dev_err(&pdev->dev, "no valid port_info specified\n");
2529
if (!devres_open_group(dev, NULL, GFP_KERNEL))
2532
rc = pcim_enable_device(pdev);
2536
#ifdef CONFIG_ATA_BMDMA
2538
/* prepare and activate BMDMA host */
2539
rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host);
2542
/* prepare and activate SFF host */
2543
rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
2546
host->private_data = host_priv;
2547
host->flags |= hflags;
2549
#ifdef CONFIG_ATA_BMDMA
2551
pci_set_master(pdev);
2552
rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
2555
rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
2558
devres_remove_group(&pdev->dev, NULL);
2560
devres_release_group(&pdev->dev, NULL);
2511
2566
* ata_pci_sff_init_one - Initialize/register PIO-only PCI IDE controller
2512
2567
* @pdev: Controller to be initialized
2533
2588
const struct ata_port_info * const *ppi,
2534
2589
struct scsi_host_template *sht, void *host_priv, int hflag)
2536
struct device *dev = &pdev->dev;
2537
const struct ata_port_info *pi;
2538
struct ata_host *host = NULL;
2543
pi = ata_sff_find_valid_pi(ppi);
2545
dev_printk(KERN_ERR, &pdev->dev,
2546
"no valid port_info specified\n");
2550
if (!devres_open_group(dev, NULL, GFP_KERNEL))
2553
rc = pcim_enable_device(pdev);
2557
/* prepare and activate SFF host */
2558
rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
2561
host->private_data = host_priv;
2562
host->flags |= hflag;
2564
rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
2567
devres_remove_group(&pdev->dev, NULL);
2569
devres_release_group(&pdev->dev, NULL);
2591
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflag, 0);
2573
2593
EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);
3167
dev_printk(KERN_ERR, host->dev, "BMDMA: %s, falling back to PIO\n",
3187
dev_err(host->dev, "BMDMA: %s, falling back to PIO\n", reason);
3170
3189
for (i = 0; i < 2; i++) {
3171
3190
host->ports[i]->mwdma_mask = 0;
3288
3307
struct scsi_host_template *sht, void *host_priv,
3291
struct device *dev = &pdev->dev;
3292
const struct ata_port_info *pi;
3293
struct ata_host *host = NULL;
3298
pi = ata_sff_find_valid_pi(ppi);
3300
dev_printk(KERN_ERR, &pdev->dev,
3301
"no valid port_info specified\n");
3305
if (!devres_open_group(dev, NULL, GFP_KERNEL))
3308
rc = pcim_enable_device(pdev);
3312
/* prepare and activate BMDMA host */
3313
rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host);
3316
host->private_data = host_priv;
3317
host->flags |= hflags;
3319
pci_set_master(pdev);
3320
rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
3323
devres_remove_group(&pdev->dev, NULL);
3325
devres_release_group(&pdev->dev, NULL);
3310
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflags, 1);
3329
3312
EXPORT_SYMBOL_GPL(ata_pci_bmdma_init_one);