aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/ata/libata-sff.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index e30c537cce32..b1b926c55a72 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -222,7 +222,7 @@ int ata_sff_busy_sleep(struct ata_port *ap,
222 timeout = ata_deadline(timer_start, tmout_pat); 222 timeout = ata_deadline(timer_start, tmout_pat);
223 while (status != 0xff && (status & ATA_BUSY) && 223 while (status != 0xff && (status & ATA_BUSY) &&
224 time_before(jiffies, timeout)) { 224 time_before(jiffies, timeout)) {
225 msleep(50); 225 ata_msleep(ap, 50);
226 status = ata_sff_busy_wait(ap, ATA_BUSY, 3); 226 status = ata_sff_busy_wait(ap, ATA_BUSY, 3);
227 } 227 }
228 228
@@ -234,7 +234,7 @@ int ata_sff_busy_sleep(struct ata_port *ap,
234 timeout = ata_deadline(timer_start, tmout); 234 timeout = ata_deadline(timer_start, tmout);
235 while (status != 0xff && (status & ATA_BUSY) && 235 while (status != 0xff && (status & ATA_BUSY) &&
236 time_before(jiffies, timeout)) { 236 time_before(jiffies, timeout)) {
237 msleep(50); 237 ata_msleep(ap, 50);
238 status = ap->ops->sff_check_status(ap); 238 status = ap->ops->sff_check_status(ap);
239 } 239 }
240 240
@@ -360,7 +360,7 @@ static void ata_dev_select(struct ata_port *ap, unsigned int device,
360 360
361 if (wait) { 361 if (wait) {
362 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) 362 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI)
363 msleep(150); 363 ata_msleep(ap, 150);
364 ata_wait_idle(ap); 364 ata_wait_idle(ap);
365 } 365 }
366} 366}
@@ -1302,6 +1302,18 @@ fsm_start:
1302} 1302}
1303EXPORT_SYMBOL_GPL(ata_sff_hsm_move); 1303EXPORT_SYMBOL_GPL(ata_sff_hsm_move);
1304 1304
1305void ata_sff_queue_work(struct work_struct *work)
1306{
1307 queue_work(ata_sff_wq, work);
1308}
1309EXPORT_SYMBOL_GPL(ata_sff_queue_work);
1310
1311void ata_sff_queue_delayed_work(struct delayed_work *dwork, unsigned long delay)
1312{
1313 queue_delayed_work(ata_sff_wq, dwork, delay);
1314}
1315EXPORT_SYMBOL_GPL(ata_sff_queue_delayed_work);
1316
1305void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) 1317void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay)
1306{ 1318{
1307 struct ata_port *ap = link->ap; 1319 struct ata_port *ap = link->ap;
@@ -1311,8 +1323,7 @@ void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay)
1311 ap->sff_pio_task_link = link; 1323 ap->sff_pio_task_link = link;
1312 1324
1313 /* may fail if ata_sff_flush_pio_task() in progress */ 1325 /* may fail if ata_sff_flush_pio_task() in progress */
1314 queue_delayed_work(ata_sff_wq, &ap->sff_pio_task, 1326 ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay));
1315 msecs_to_jiffies(delay));
1316} 1327}
1317EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task); 1328EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task);
1318 1329
@@ -1320,7 +1331,7 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
1320{ 1331{
1321 DPRINTK("ENTER\n"); 1332 DPRINTK("ENTER\n");
1322 1333
1323 cancel_rearming_delayed_work(&ap->sff_pio_task); 1334 cancel_delayed_work_sync(&ap->sff_pio_task);
1324 ap->hsm_task_state = HSM_ST_IDLE; 1335 ap->hsm_task_state = HSM_ST_IDLE;
1325 1336
1326 if (ata_msg_ctl(ap)) 1337 if (ata_msg_ctl(ap))
@@ -1336,7 +1347,7 @@ static void ata_sff_pio_task(struct work_struct *work)
1336 u8 status; 1347 u8 status;
1337 int poll_next; 1348 int poll_next;
1338 1349
1339 BUG_ON(ap->sff_pio_task_link == NULL); 1350 BUG_ON(ap->sff_pio_task_link == NULL);
1340 /* qc can be NULL if timeout occurred */ 1351 /* qc can be NULL if timeout occurred */
1341 qc = ata_qc_from_tag(ap, link->active_tag); 1352 qc = ata_qc_from_tag(ap, link->active_tag);
1342 if (!qc) { 1353 if (!qc) {
@@ -1356,7 +1367,7 @@ fsm_start:
1356 */ 1367 */
1357 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); 1368 status = ata_sff_busy_wait(ap, ATA_BUSY, 5);
1358 if (status & ATA_BUSY) { 1369 if (status & ATA_BUSY) {
1359 msleep(2); 1370 ata_msleep(ap, 2);
1360 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); 1371 status = ata_sff_busy_wait(ap, ATA_BUSY, 10);
1361 if (status & ATA_BUSY) { 1372 if (status & ATA_BUSY) {
1362 ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); 1373 ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE);
@@ -1532,11 +1543,10 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap,
1532 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) 1543 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
1533 return ata_sff_idle_irq(ap); 1544 return ata_sff_idle_irq(ap);
1534 break; 1545 break;
1535 case HSM_ST: 1546 case HSM_ST_IDLE:
1536 case HSM_ST_LAST:
1537 break;
1538 default:
1539 return ata_sff_idle_irq(ap); 1547 return ata_sff_idle_irq(ap);
1548 default:
1549 break;
1540 } 1550 }
1541 1551
1542 /* check main status, clearing INTRQ if needed */ 1552 /* check main status, clearing INTRQ if needed */
@@ -1937,7 +1947,7 @@ int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
1937 unsigned int dev1 = devmask & (1 << 1); 1947 unsigned int dev1 = devmask & (1 << 1);
1938 int rc, ret = 0; 1948 int rc, ret = 0;
1939 1949
1940 msleep(ATA_WAIT_AFTER_RESET); 1950 ata_msleep(ap, ATA_WAIT_AFTER_RESET);
1941 1951
1942 /* always check readiness of the master device */ 1952 /* always check readiness of the master device */
1943 rc = ata_sff_wait_ready(link, deadline); 1953 rc = ata_sff_wait_ready(link, deadline);
@@ -1966,7 +1976,7 @@ int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
1966 lbal = ioread8(ioaddr->lbal_addr); 1976 lbal = ioread8(ioaddr->lbal_addr);
1967 if ((nsect == 1) && (lbal == 1)) 1977 if ((nsect == 1) && (lbal == 1))
1968 break; 1978 break;
1969 msleep(50); /* give drive a breather */ 1979 ata_msleep(ap, 50); /* give drive a breather */
1970 } 1980 }
1971 1981
1972 rc = ata_sff_wait_ready(link, deadline); 1982 rc = ata_sff_wait_ready(link, deadline);
@@ -2437,13 +2447,18 @@ int ata_pci_sff_activate_host(struct ata_host *host,
2437 return -ENOMEM; 2447 return -ENOMEM;
2438 2448
2439 if (!legacy_mode && pdev->irq) { 2449 if (!legacy_mode && pdev->irq) {
2450 int i;
2451
2440 rc = devm_request_irq(dev, pdev->irq, irq_handler, 2452 rc = devm_request_irq(dev, pdev->irq, irq_handler,
2441 IRQF_SHARED, drv_name, host); 2453 IRQF_SHARED, drv_name, host);
2442 if (rc) 2454 if (rc)
2443 goto out; 2455 goto out;
2444 2456
2445 ata_port_desc(host->ports[0], "irq %d", pdev->irq); 2457 for (i = 0; i < 2; i++) {
2446 ata_port_desc(host->ports[1], "irq %d", pdev->irq); 2458 if (ata_port_is_dummy(host->ports[i]))
2459 continue;
2460 ata_port_desc(host->ports[i], "irq %d", pdev->irq);
2461 }
2447 } else if (legacy_mode) { 2462 } else if (legacy_mode) {
2448 if (!ata_port_is_dummy(host->ports[0])) { 2463 if (!ata_port_is_dummy(host->ports[0])) {
2449 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), 2464 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
@@ -2829,7 +2844,7 @@ unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
2829 bmdma_stopped = true; 2844 bmdma_stopped = true;
2830 2845
2831 if (unlikely(host_stat & ATA_DMA_ERR)) { 2846 if (unlikely(host_stat & ATA_DMA_ERR)) {
2832 /* error when transfering data to/from memory */ 2847 /* error when transferring data to/from memory */
2833 qc->err_mask |= AC_ERR_HOST_BUS; 2848 qc->err_mask |= AC_ERR_HOST_BUS;
2834 ap->hsm_task_state = HSM_ST_ERR; 2849 ap->hsm_task_state = HSM_ST_ERR;
2835 } 2850 }
@@ -3022,7 +3037,7 @@ void ata_bmdma_start(struct ata_queued_cmd *qc)
3022 * Or maybe I'm just being paranoid. 3037 * Or maybe I'm just being paranoid.
3023 * 3038 *
3024 * FIXME: The posting of this write means I/O starts are 3039 * FIXME: The posting of this write means I/O starts are
3025 * unneccessarily delayed for MMIO 3040 * unnecessarily delayed for MMIO
3026 */ 3041 */
3027} 3042}
3028EXPORT_SYMBOL_GPL(ata_bmdma_start); 3043EXPORT_SYMBOL_GPL(ata_bmdma_start);
@@ -3335,14 +3350,14 @@ void ata_sff_port_init(struct ata_port *ap)
3335 3350
3336int __init ata_sff_init(void) 3351int __init ata_sff_init(void)
3337{ 3352{
3338 ata_sff_wq = alloc_workqueue("ata_sff", WQ_RESCUER, WQ_MAX_ACTIVE); 3353 ata_sff_wq = alloc_workqueue("ata_sff", WQ_MEM_RECLAIM, WQ_MAX_ACTIVE);
3339 if (!ata_sff_wq) 3354 if (!ata_sff_wq)
3340 return -ENOMEM; 3355 return -ENOMEM;
3341 3356
3342 return 0; 3357 return 0;
3343} 3358}
3344 3359
3345void __exit ata_sff_exit(void) 3360void ata_sff_exit(void)
3346{ 3361{
3347 destroy_workqueue(ata_sff_wq); 3362 destroy_workqueue(ata_sff_wq);
3348} 3363}