libata-sff.c (c43d559f0423816bb2918d892131d21c51816c3d) | libata-sff.c (97750cebb3000a9cc08f8ce8dc8c7143be7d7201) |
---|---|
1/* 2 * libata-sff.c - helper library for PCI IDE BMDMA 3 * 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2003-2006 Red Hat, Inc. All rights reserved. --- 208 unchanged lines hidden (view full) --- 217 unsigned long timer_start, timeout; 218 u8 status; 219 220 status = ata_sff_busy_wait(ap, ATA_BUSY, 300); 221 timer_start = jiffies; 222 timeout = ata_deadline(timer_start, tmout_pat); 223 while (status != 0xff && (status & ATA_BUSY) && 224 time_before(jiffies, timeout)) { | 1/* 2 * libata-sff.c - helper library for PCI IDE BMDMA 3 * 4 * Maintained by: Jeff Garzik <jgarzik@pobox.com> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2003-2006 Red Hat, Inc. All rights reserved. --- 208 unchanged lines hidden (view full) --- 217 unsigned long timer_start, timeout; 218 u8 status; 219 220 status = ata_sff_busy_wait(ap, ATA_BUSY, 300); 221 timer_start = jiffies; 222 timeout = ata_deadline(timer_start, tmout_pat); 223 while (status != 0xff && (status & ATA_BUSY) && 224 time_before(jiffies, timeout)) { |
225 msleep(50); | 225 ata_msleep(ap, 50); |
226 status = ata_sff_busy_wait(ap, ATA_BUSY, 3); 227 } 228 229 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); 233 234 timeout = ata_deadline(timer_start, tmout); 235 while (status != 0xff && (status & ATA_BUSY) && 236 time_before(jiffies, timeout)) { | 226 status = ata_sff_busy_wait(ap, ATA_BUSY, 3); 227 } 228 229 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); 233 234 timeout = ata_deadline(timer_start, tmout); 235 while (status != 0xff && (status & ATA_BUSY) && 236 time_before(jiffies, timeout)) { |
237 msleep(50); | 237 ata_msleep(ap, 50); |
238 status = ap->ops->sff_check_status(ap); 239 } 240 241 if (status == 0xff) 242 return -ENODEV; 243 244 if (status & ATA_BUSY) { 245 ata_port_printk(ap, KERN_ERR, "port failed to respond " --- 109 unchanged lines hidden (view full) --- 355 356 if (wait) 357 ata_wait_idle(ap); 358 359 ap->ops->sff_dev_select(ap, device); 360 361 if (wait) { 362 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) | 238 status = ap->ops->sff_check_status(ap); 239 } 240 241 if (status == 0xff) 242 return -ENODEV; 243 244 if (status & ATA_BUSY) { 245 ata_port_printk(ap, KERN_ERR, "port failed to respond " --- 109 unchanged lines hidden (view full) --- 355 356 if (wait) 357 ata_wait_idle(ap); 358 359 ap->ops->sff_dev_select(ap, device); 360 361 if (wait) { 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); 365 } 366} 367 368/** 369 * ata_sff_irq_on - Enable interrupts on a port. 370 * @ap: Port on which interrupts are enabled. 371 * --- 979 unchanged lines hidden (view full) --- 1351 * This is purely heuristic. This is a fast path. 1352 * Sometimes when we enter, BSY will be cleared in 1353 * a chk-status or two. If not, the drive is probably seeking 1354 * or something. Snooze for a couple msecs, then 1355 * chk-status again. If still busy, queue delayed work. 1356 */ 1357 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); 1358 if (status & ATA_BUSY) { | 364 ata_wait_idle(ap); 365 } 366} 367 368/** 369 * ata_sff_irq_on - Enable interrupts on a port. 370 * @ap: Port on which interrupts are enabled. 371 * --- 979 unchanged lines hidden (view full) --- 1351 * This is purely heuristic. This is a fast path. 1352 * Sometimes when we enter, BSY will be cleared in 1353 * a chk-status or two. If not, the drive is probably seeking 1354 * or something. Snooze for a couple msecs, then 1355 * chk-status again. If still busy, queue delayed work. 1356 */ 1357 status = ata_sff_busy_wait(ap, ATA_BUSY, 5); 1358 if (status & ATA_BUSY) { |
1359 msleep(2); | 1359 ata_msleep(ap, 2); |
1360 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); 1361 if (status & ATA_BUSY) { 1362 ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); 1363 return; 1364 } 1365 } 1366 1367 /* --- 564 unchanged lines hidden (view full) --- 1932 unsigned long deadline) 1933{ 1934 struct ata_port *ap = link->ap; 1935 struct ata_ioports *ioaddr = &ap->ioaddr; 1936 unsigned int dev0 = devmask & (1 << 0); 1937 unsigned int dev1 = devmask & (1 << 1); 1938 int rc, ret = 0; 1939 | 1360 status = ata_sff_busy_wait(ap, ATA_BUSY, 10); 1361 if (status & ATA_BUSY) { 1362 ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); 1363 return; 1364 } 1365 } 1366 1367 /* --- 564 unchanged lines hidden (view full) --- 1932 unsigned long deadline) 1933{ 1934 struct ata_port *ap = link->ap; 1935 struct ata_ioports *ioaddr = &ap->ioaddr; 1936 unsigned int dev0 = devmask & (1 << 0); 1937 unsigned int dev1 = devmask & (1 << 1); 1938 int rc, ret = 0; 1939 |
1940 msleep(ATA_WAIT_AFTER_RESET); | 1940 ata_msleep(ap, ATA_WAIT_AFTER_RESET); |
1941 1942 /* always check readiness of the master device */ 1943 rc = ata_sff_wait_ready(link, deadline); 1944 /* -ENODEV means the odd clown forgot the D7 pulldown resistor 1945 * and TF status is 0xff, bail out on it too. 1946 */ 1947 if (rc) 1948 return rc; --- 12 unchanged lines hidden (view full) --- 1961 */ 1962 for (i = 0; i < 2; i++) { 1963 u8 nsect, lbal; 1964 1965 nsect = ioread8(ioaddr->nsect_addr); 1966 lbal = ioread8(ioaddr->lbal_addr); 1967 if ((nsect == 1) && (lbal == 1)) 1968 break; | 1941 1942 /* always check readiness of the master device */ 1943 rc = ata_sff_wait_ready(link, deadline); 1944 /* -ENODEV means the odd clown forgot the D7 pulldown resistor 1945 * and TF status is 0xff, bail out on it too. 1946 */ 1947 if (rc) 1948 return rc; --- 12 unchanged lines hidden (view full) --- 1961 */ 1962 for (i = 0; i < 2; i++) { 1963 u8 nsect, lbal; 1964 1965 nsect = ioread8(ioaddr->nsect_addr); 1966 lbal = ioread8(ioaddr->lbal_addr); 1967 if ((nsect == 1) && (lbal == 1)) 1968 break; |
1969 msleep(50); /* give drive a breather */ | 1969 ata_msleep(ap, 50); /* give drive a breather */ |
1970 } 1971 1972 rc = ata_sff_wait_ready(link, deadline); 1973 if (rc) { 1974 if (rc != -ENODEV) 1975 return rc; 1976 ret = rc; 1977 } --- 1371 unchanged lines hidden --- | 1970 } 1971 1972 rc = ata_sff_wait_ready(link, deadline); 1973 if (rc) { 1974 if (rc != -ENODEV) 1975 return rc; 1976 ret = rc; 1977 } --- 1371 unchanged lines hidden --- |