aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/ahci.c8
-rw-r--r--drivers/scsi/ata_piix.c4
-rw-r--r--drivers/scsi/libata-core.c199
-rw-r--r--drivers/scsi/libata-eh.c5
-rw-r--r--drivers/scsi/libata-scsi.c9
-rw-r--r--drivers/scsi/sata_mv.c8
-rw-r--r--drivers/scsi/sata_promise.c7
-rw-r--r--drivers/scsi/sata_sil.c8
-rw-r--r--drivers/scsi/sata_sil24.c6
-rw-r--r--drivers/scsi/sata_sx4.c7
10 files changed, 124 insertions, 137 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index f6e4c8ea74e3..a4fb8d0a6c08 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -655,8 +655,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
655 fail_restart: 655 fail_restart:
656 ahci_start_engine(ap); 656 ahci_start_engine(ap);
657 fail: 657 fail:
658 printk(KERN_ERR "ata%u: softreset failed (%s)\n", 658 ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason);
659 ap->id, reason);
660 return rc; 659 return rc;
661} 660}
662 661
@@ -798,9 +797,8 @@ static void ahci_restart_port(struct ata_port *ap, u32 irq_stat)
798 797
799 if ((ap->device[0].class != ATA_DEV_ATAPI) || 798 if ((ap->device[0].class != ATA_DEV_ATAPI) ||
800 ((irq_stat & PORT_IRQ_TF_ERR) == 0)) 799 ((irq_stat & PORT_IRQ_TF_ERR) == 0))
801 printk(KERN_WARNING "ata%u: port reset, " 800 ata_port_printk(ap, KERN_WARNING, "port reset, "
802 "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", 801 "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n",
803 ap->id,
804 irq_stat, 802 irq_stat,
805 readl(mmio + HOST_IRQ_STAT), 803 readl(mmio + HOST_IRQ_STAT),
806 readl(port_mmio + PORT_IRQ_STAT), 804 readl(port_mmio + PORT_IRQ_STAT),
@@ -840,7 +838,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
840 struct ata_queued_cmd *qc; 838 struct ata_queued_cmd *qc;
841 unsigned long flags; 839 unsigned long flags;
842 840
843 printk(KERN_WARNING "ata%u: handling error/timeout\n", ap->id); 841 ata_port_printk(ap, KERN_WARNING, "handling error/timeout\n");
844 842
845 spin_lock_irqsave(&host_set->lock, flags); 843 spin_lock_irqsave(&host_set->lock, flags);
846 844
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 62dabf74188e..af1d46e36107 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -484,7 +484,7 @@ static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes)
484 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 484 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
485 485
486 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { 486 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) {
487 printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); 487 ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n");
488 return 0; 488 return 0;
489 } 489 }
490 490
@@ -565,7 +565,7 @@ static unsigned int piix_sata_probe (struct ata_port *ap)
565static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes) 565static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes)
566{ 566{
567 if (!piix_sata_probe(ap)) { 567 if (!piix_sata_probe(ap)) {
568 printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id); 568 ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n");
569 return 0; 569 return 0;
570 } 570 }
571 571
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 4ced962db812..9a97ebd59209 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -412,8 +412,7 @@ static const char *sata_spd_string(unsigned int spd)
412void ata_dev_disable(struct ata_device *dev) 412void ata_dev_disable(struct ata_device *dev)
413{ 413{
414 if (ata_dev_enabled(dev)) { 414 if (ata_dev_enabled(dev)) {
415 printk(KERN_WARNING "ata%u: dev %u disabled\n", 415 ata_dev_printk(dev, KERN_WARNING, "disabled\n");
416 dev->ap->id, dev->devno);
417 dev->class++; 416 dev->class++;
418 } 417 }
419} 418}
@@ -1021,8 +1020,9 @@ unsigned ata_exec_internal(struct ata_device *dev,
1021 if (qc->flags & ATA_QCFLAG_ACTIVE) { 1020 if (qc->flags & ATA_QCFLAG_ACTIVE) {
1022 qc->err_mask = AC_ERR_TIMEOUT; 1021 qc->err_mask = AC_ERR_TIMEOUT;
1023 ata_qc_complete(qc); 1022 ata_qc_complete(qc);
1024 printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n", 1023
1025 ap->id, command); 1024 ata_dev_printk(dev, KERN_WARNING,
1025 "qc timeout (cmd 0x%x)\n", command);
1026 } 1026 }
1027 1027
1028 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1028 spin_unlock_irqrestore(&ap->host_set->lock, flags);
@@ -1187,8 +1187,8 @@ static int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1187 return 0; 1187 return 0;
1188 1188
1189 err_out: 1189 err_out:
1190 printk(KERN_WARNING "ata%u: dev %u failed to IDENTIFY (%s)\n", 1190 ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY "
1191 ap->id, dev->devno, reason); 1191 "(%s, err_mask=0x%x)\n", reason, err_mask);
1192 return rc; 1192 return rc;
1193} 1193}
1194 1194
@@ -1228,10 +1228,10 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1228 1228
1229 /* print device capabilities */ 1229 /* print device capabilities */
1230 if (print_info) 1230 if (print_info)
1231 printk(KERN_DEBUG "ata%u: dev %u cfg 49:%04x 82:%04x 83:%04x " 1231 ata_dev_printk(dev, KERN_DEBUG, "cfg 49:%04x 82:%04x 83:%04x "
1232 "84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", 1232 "84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n",
1233 ap->id, dev->devno, id[49], id[82], id[83], 1233 id[49], id[82], id[83], id[84],
1234 id[84], id[85], id[86], id[87], id[88]); 1234 id[85], id[86], id[87], id[88]);
1235 1235
1236 /* initialize to-be-configured parameters */ 1236 /* initialize to-be-configured parameters */
1237 dev->flags &= ~ATA_DFLAG_CFG_MASK; 1237 dev->flags &= ~ATA_DFLAG_CFG_MASK;
@@ -1267,13 +1267,12 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1267 1267
1268 /* print device info to dmesg */ 1268 /* print device info to dmesg */
1269 if (print_info) 1269 if (print_info)
1270 printk(KERN_INFO "ata%u: dev %u ATA-%d, " 1270 ata_dev_printk(dev, KERN_INFO, "ATA-%d, "
1271 "max %s, %Lu sectors: %s\n", 1271 "max %s, %Lu sectors: %s\n",
1272 ap->id, dev->devno, 1272 ata_id_major_version(id),
1273 ata_id_major_version(id), 1273 ata_mode_string(xfer_mask),
1274 ata_mode_string(xfer_mask), 1274 (unsigned long long)dev->n_sectors,
1275 (unsigned long long)dev->n_sectors, 1275 lba_desc);
1276 lba_desc);
1277 } else { 1276 } else {
1278 /* CHS */ 1277 /* CHS */
1279 1278
@@ -1291,13 +1290,12 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1291 1290
1292 /* print device info to dmesg */ 1291 /* print device info to dmesg */
1293 if (print_info) 1292 if (print_info)
1294 printk(KERN_INFO "ata%u: dev %u ATA-%d, " 1293 ata_dev_printk(dev, KERN_INFO, "ATA-%d, "
1295 "max %s, %Lu sectors: CHS %u/%u/%u\n", 1294 "max %s, %Lu sectors: CHS %u/%u/%u\n",
1296 ap->id, dev->devno, 1295 ata_id_major_version(id),
1297 ata_id_major_version(id), 1296 ata_mode_string(xfer_mask),
1298 ata_mode_string(xfer_mask), 1297 (unsigned long long)dev->n_sectors,
1299 (unsigned long long)dev->n_sectors, 1298 dev->cylinders, dev->heads, dev->sectors);
1300 dev->cylinders, dev->heads, dev->sectors);
1301 } 1299 }
1302 1300
1303 dev->cdb_len = 16; 1301 dev->cdb_len = 16;
@@ -1307,7 +1305,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1307 else if (dev->class == ATA_DEV_ATAPI) { 1305 else if (dev->class == ATA_DEV_ATAPI) {
1308 rc = atapi_cdb_len(id); 1306 rc = atapi_cdb_len(id);
1309 if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { 1307 if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
1310 printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); 1308 ata_dev_printk(dev, KERN_WARNING,
1309 "unsupported CDB len\n");
1311 rc = -EINVAL; 1310 rc = -EINVAL;
1312 goto err_out_nosup; 1311 goto err_out_nosup;
1313 } 1312 }
@@ -1315,8 +1314,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1315 1314
1316 /* print device info to dmesg */ 1315 /* print device info to dmesg */
1317 if (print_info) 1316 if (print_info)
1318 printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", 1317 ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s\n",
1319 ap->id, dev->devno, ata_mode_string(xfer_mask)); 1318 ata_mode_string(xfer_mask));
1320 } 1319 }
1321 1320
1322 ap->host->max_cmd_len = 0; 1321 ap->host->max_cmd_len = 0;
@@ -1328,8 +1327,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
1328 /* limit bridge transfers to udma5, 200 sectors */ 1327 /* limit bridge transfers to udma5, 200 sectors */
1329 if (ata_dev_knobble(dev)) { 1328 if (ata_dev_knobble(dev)) {
1330 if (print_info) 1329 if (print_info)
1331 printk(KERN_INFO "ata%u(%u): applying bridge limits\n", 1330 ata_dev_printk(dev, KERN_INFO,
1332 ap->id, dev->devno); 1331 "applying bridge limits\n");
1333 dev->udma_mask &= ATA_UDMA5; 1332 dev->udma_mask &= ATA_UDMA5;
1334 dev->max_sectors = ATA_MAX_SECTORS; 1333 dev->max_sectors = ATA_MAX_SECTORS;
1335 } 1334 }
@@ -1382,7 +1381,8 @@ static int ata_bus_probe(struct ata_port *ap)
1382 if (ap->ops->probe_reset) { 1381 if (ap->ops->probe_reset) {
1383 rc = ap->ops->probe_reset(ap, classes); 1382 rc = ap->ops->probe_reset(ap, classes);
1384 if (rc) { 1383 if (rc) {
1385 printk("ata%u: reset failed (errno=%d)\n", ap->id, rc); 1384 ata_port_printk(ap, KERN_ERR,
1385 "reset failed (errno=%d)\n", rc);
1386 return rc; 1386 return rc;
1387 } 1387 }
1388 } else { 1388 } else {
@@ -1495,13 +1495,13 @@ static void sata_print_link_status(struct ata_port *ap)
1495 1495
1496 if (ata_port_online(ap)) { 1496 if (ata_port_online(ap)) {
1497 tmp = (sstatus >> 4) & 0xf; 1497 tmp = (sstatus >> 4) & 0xf;
1498 printk(KERN_INFO 1498 ata_port_printk(ap, KERN_INFO,
1499 "ata%u: SATA link up %s (SStatus %X SControl %X)\n", 1499 "SATA link up %s (SStatus %X SControl %X)\n",
1500 ap->id, sata_spd_string(tmp), sstatus, scontrol); 1500 sata_spd_string(tmp), sstatus, scontrol);
1501 } else { 1501 } else {
1502 printk(KERN_INFO 1502 ata_port_printk(ap, KERN_INFO,
1503 "ata%u: SATA link down (SStatus %X SControl %X)\n", 1503 "SATA link down (SStatus %X SControl %X)\n",
1504 ap->id, sstatus, scontrol); 1504 sstatus, scontrol);
1505 } 1505 }
1506} 1506}
1507 1507
@@ -1655,8 +1655,8 @@ int sata_down_spd_limit(struct ata_port *ap)
1655 1655
1656 ap->sata_spd_limit = mask; 1656 ap->sata_spd_limit = mask;
1657 1657
1658 printk(KERN_WARNING "ata%u: limiting SATA link speed to %s\n", 1658 ata_port_printk(ap, KERN_WARNING, "limiting SATA link speed to %s\n",
1659 ap->id, sata_spd_string(fls(mask))); 1659 sata_spd_string(fls(mask)));
1660 1660
1661 return 0; 1661 return 0;
1662} 1662}
@@ -1896,7 +1896,6 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1896 */ 1896 */
1897int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) 1897int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
1898{ 1898{
1899 struct ata_port *ap = dev->ap;
1900 unsigned long xfer_mask; 1899 unsigned long xfer_mask;
1901 int highbit; 1900 int highbit;
1902 1901
@@ -1919,8 +1918,8 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
1919 ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, 1918 ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask,
1920 &dev->udma_mask); 1919 &dev->udma_mask);
1921 1920
1922 printk(KERN_WARNING "ata%u: dev %u limiting speed to %s\n", 1921 ata_dev_printk(dev, KERN_WARNING, "limiting speed to %s\n",
1923 ap->id, dev->devno, ata_mode_string(xfer_mask)); 1922 ata_mode_string(xfer_mask));
1924 1923
1925 return 0; 1924 return 0;
1926 1925
@@ -1930,7 +1929,6 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
1930 1929
1931static int ata_dev_set_mode(struct ata_device *dev) 1930static int ata_dev_set_mode(struct ata_device *dev)
1932{ 1931{
1933 struct ata_port *ap = dev->ap;
1934 unsigned int err_mask; 1932 unsigned int err_mask;
1935 int rc; 1933 int rc;
1936 1934
@@ -1940,9 +1938,8 @@ static int ata_dev_set_mode(struct ata_device *dev)
1940 1938
1941 err_mask = ata_dev_set_xfermode(dev); 1939 err_mask = ata_dev_set_xfermode(dev);
1942 if (err_mask) { 1940 if (err_mask) {
1943 printk(KERN_ERR 1941 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
1944 "ata%u: failed to set xfermode (err_mask=0x%x)\n", 1942 "(err_mask=0x%x)\n", err_mask);
1945 ap->id, err_mask);
1946 return -EIO; 1943 return -EIO;
1947 } 1944 }
1948 1945
@@ -1953,9 +1950,8 @@ static int ata_dev_set_mode(struct ata_device *dev)
1953 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", 1950 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
1954 dev->xfer_shift, (int)dev->xfer_mode); 1951 dev->xfer_shift, (int)dev->xfer_mode);
1955 1952
1956 printk(KERN_INFO "ata%u: dev %u configured for %s\n", 1953 ata_dev_printk(dev, KERN_INFO, "configured for %s\n",
1957 ap->id, dev->devno, 1954 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)));
1958 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)));
1959 return 0; 1955 return 0;
1960} 1956}
1961 1957
@@ -2023,8 +2019,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2023 continue; 2019 continue;
2024 2020
2025 if (!dev->pio_mode) { 2021 if (!dev->pio_mode) {
2026 printk(KERN_WARNING "ata%u: dev %u no PIO support\n", 2022 ata_dev_printk(dev, KERN_WARNING, "no PIO support\n");
2027 ap->id, dev->devno);
2028 rc = -EINVAL; 2023 rc = -EINVAL;
2029 goto out; 2024 goto out;
2030 } 2025 }
@@ -2123,8 +2118,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap,
2123 } 2118 }
2124 2119
2125 if (status & ATA_BUSY) 2120 if (status & ATA_BUSY)
2126 printk(KERN_WARNING "ata%u is slow to respond, " 2121 ata_port_printk(ap, KERN_WARNING,
2127 "please be patient\n", ap->id); 2122 "port is slow to respond, please be patient\n");
2128 2123
2129 timeout = timer_start + tmout; 2124 timeout = timer_start + tmout;
2130 while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) { 2125 while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
@@ -2133,8 +2128,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap,
2133 } 2128 }
2134 2129
2135 if (status & ATA_BUSY) { 2130 if (status & ATA_BUSY) {
2136 printk(KERN_ERR "ata%u failed to respond (%lu secs)\n", 2131 ata_port_printk(ap, KERN_ERR, "port failed to respond "
2137 ap->id, tmout / HZ); 2132 "(%lu secs)\n", tmout / HZ);
2138 return 1; 2133 return 1;
2139 } 2134 }
2140 2135
@@ -2227,7 +2222,7 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
2227 * pulldown resistor. 2222 * pulldown resistor.
2228 */ 2223 */
2229 if (ata_check_status(ap) == 0xFF) { 2224 if (ata_check_status(ap) == 0xFF) {
2230 printk(KERN_ERR "ata%u: SRST failed (status 0xFF)\n", ap->id); 2225 ata_port_printk(ap, KERN_ERR, "SRST failed (status 0xFF)\n");
2231 return AC_ERR_OTHER; 2226 return AC_ERR_OTHER;
2232 } 2227 }
2233 2228
@@ -2321,7 +2316,7 @@ void ata_bus_reset(struct ata_port *ap)
2321 return; 2316 return;
2322 2317
2323err_out: 2318err_out:
2324 printk(KERN_ERR "ata%u: disabling port\n", ap->id); 2319 ata_port_printk(ap, KERN_ERR, "disabling port\n");
2325 ap->ops->port_disable(ap); 2320 ap->ops->port_disable(ap);
2326 2321
2327 DPRINTK("EXIT\n"); 2322 DPRINTK("EXIT\n");
@@ -2424,8 +2419,8 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes)
2424 DPRINTK("about to softreset, devmask=%x\n", devmask); 2419 DPRINTK("about to softreset, devmask=%x\n", devmask);
2425 err_mask = ata_bus_softreset(ap, devmask); 2420 err_mask = ata_bus_softreset(ap, devmask);
2426 if (err_mask) { 2421 if (err_mask) {
2427 printk(KERN_ERR "ata%u: SRST failed (err_mask=0x%x)\n", 2422 ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
2428 ap->id, err_mask); 2423 err_mask);
2429 return -EIO; 2424 return -EIO;
2430 } 2425 }
2431 2426
@@ -2503,8 +2498,8 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class)
2503 } 2498 }
2504 2499
2505 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { 2500 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
2506 printk(KERN_ERR 2501 ata_port_printk(ap, KERN_ERR,
2507 "ata%u: COMRESET failed (device not ready)\n", ap->id); 2502 "COMRESET failed (device not ready)\n");
2508 return -EIO; 2503 return -EIO;
2509 } 2504 }
2510 2505
@@ -2662,8 +2657,8 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2662 rc = ata_do_reset(ap, softreset, classes); 2657 rc = ata_do_reset(ap, softreset, classes);
2663 if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN) 2658 if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN)
2664 goto done; 2659 goto done;
2665 printk(KERN_INFO "ata%u: softreset failed, will try " 2660 ata_port_printk(ap, KERN_INFO, "softreset failed, "
2666 "hardreset in 5 secs\n", ap->id); 2661 "will try hardreset in 5 secs\n");
2667 ssleep(5); 2662 ssleep(5);
2668 } 2663 }
2669 2664
@@ -2681,15 +2676,15 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2681 if (sata_down_spd_limit(ap)) 2676 if (sata_down_spd_limit(ap))
2682 goto done; 2677 goto done;
2683 2678
2684 printk(KERN_INFO "ata%u: hardreset failed, will retry " 2679 ata_port_printk(ap, KERN_INFO, "hardreset failed, "
2685 "in 5 secs\n", ap->id); 2680 "will retry in 5 secs\n");
2686 ssleep(5); 2681 ssleep(5);
2687 } 2682 }
2688 2683
2689 if (softreset) { 2684 if (softreset) {
2690 printk(KERN_INFO "ata%u: hardreset succeeded without " 2685 ata_port_printk(ap, KERN_INFO,
2691 "classification, will retry softreset in 5 secs\n", 2686 "hardreset succeeded without classification, "
2692 ap->id); 2687 "will retry softreset in 5 secs\n");
2693 ssleep(5); 2688 ssleep(5);
2694 2689
2695 rc = ata_do_reset(ap, softreset, classes); 2690 rc = ata_do_reset(ap, softreset, classes);
@@ -2724,15 +2719,13 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2724static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, 2719static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
2725 const u16 *new_id) 2720 const u16 *new_id)
2726{ 2721{
2727 struct ata_port *ap = dev->ap;
2728 const u16 *old_id = dev->id; 2722 const u16 *old_id = dev->id;
2729 unsigned char model[2][41], serial[2][21]; 2723 unsigned char model[2][41], serial[2][21];
2730 u64 new_n_sectors; 2724 u64 new_n_sectors;
2731 2725
2732 if (dev->class != new_class) { 2726 if (dev->class != new_class) {
2733 printk(KERN_INFO 2727 ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n",
2734 "ata%u: dev %u class mismatch %d != %d\n", 2728 dev->class, new_class);
2735 ap->id, dev->devno, dev->class, new_class);
2736 return 0; 2729 return 0;
2737 } 2730 }
2738 2731
@@ -2743,24 +2736,22 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
2743 new_n_sectors = ata_id_n_sectors(new_id); 2736 new_n_sectors = ata_id_n_sectors(new_id);
2744 2737
2745 if (strcmp(model[0], model[1])) { 2738 if (strcmp(model[0], model[1])) {
2746 printk(KERN_INFO 2739 ata_dev_printk(dev, KERN_INFO, "model number mismatch "
2747 "ata%u: dev %u model number mismatch '%s' != '%s'\n", 2740 "'%s' != '%s'\n", model[0], model[1]);
2748 ap->id, dev->devno, model[0], model[1]);
2749 return 0; 2741 return 0;
2750 } 2742 }
2751 2743
2752 if (strcmp(serial[0], serial[1])) { 2744 if (strcmp(serial[0], serial[1])) {
2753 printk(KERN_INFO 2745 ata_dev_printk(dev, KERN_INFO, "serial number mismatch "
2754 "ata%u: dev %u serial number mismatch '%s' != '%s'\n", 2746 "'%s' != '%s'\n", serial[0], serial[1]);
2755 ap->id, dev->devno, serial[0], serial[1]);
2756 return 0; 2747 return 0;
2757 } 2748 }
2758 2749
2759 if (dev->class == ATA_DEV_ATA && dev->n_sectors != new_n_sectors) { 2750 if (dev->class == ATA_DEV_ATA && dev->n_sectors != new_n_sectors) {
2760 printk(KERN_INFO 2751 ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
2761 "ata%u: dev %u n_sectors mismatch %llu != %llu\n", 2752 "%llu != %llu\n",
2762 ap->id, dev->devno, (unsigned long long)dev->n_sectors, 2753 (unsigned long long)dev->n_sectors,
2763 (unsigned long long)new_n_sectors); 2754 (unsigned long long)new_n_sectors);
2764 return 0; 2755 return 0;
2765 } 2756 }
2766 2757
@@ -2783,9 +2774,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
2783 */ 2774 */
2784int ata_dev_revalidate(struct ata_device *dev, int post_reset) 2775int ata_dev_revalidate(struct ata_device *dev, int post_reset)
2785{ 2776{
2786 struct ata_port *ap = dev->ap;
2787 unsigned int class = dev->class; 2777 unsigned int class = dev->class;
2788 u16 *id = (void *)ap->sector_buf; 2778 u16 *id = (void *)dev->ap->sector_buf;
2789 int rc; 2779 int rc;
2790 2780
2791 if (!ata_dev_enabled(dev)) { 2781 if (!ata_dev_enabled(dev)) {
@@ -2812,8 +2802,7 @@ int ata_dev_revalidate(struct ata_device *dev, int post_reset)
2812 return 0; 2802 return 0;
2813 2803
2814 fail: 2804 fail:
2815 printk(KERN_ERR "ata%u: dev %u revalidation failed (errno=%d)\n", 2805 ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc);
2816 ap->id, dev->devno, rc);
2817 return rc; 2806 return rc;
2818} 2807}
2819 2808
@@ -2941,8 +2930,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
2941 } 2930 }
2942 2931
2943 if (ata_dma_blacklisted(dev)) 2932 if (ata_dma_blacklisted(dev))
2944 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, " 2933 ata_dev_printk(dev, KERN_WARNING,
2945 "disabling DMA\n", ap->id, dev->devno); 2934 "device is on DMA blacklist, disabling DMA\n");
2946 2935
2947 if (hs->flags & ATA_HOST_SIMPLEX) { 2936 if (hs->flags & ATA_HOST_SIMPLEX) {
2948 if (hs->simplex_claimed) 2937 if (hs->simplex_claimed)
@@ -3733,8 +3722,8 @@ next_sg:
3733 unsigned int i; 3722 unsigned int i;
3734 3723
3735 if (words) /* warning if bytes > 1 */ 3724 if (words) /* warning if bytes > 1 */
3736 printk(KERN_WARNING "ata%u: %u bytes trailing data\n", 3725 ata_dev_printk(qc->dev, KERN_WARNING,
3737 ap->id, bytes); 3726 "%u bytes trailing data\n", bytes);
3738 3727
3739 for (i = 0; i < words; i++) 3728 for (i = 0; i < words; i++)
3740 ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); 3729 ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
@@ -3817,8 +3806,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
3817 return; 3806 return;
3818 3807
3819err_out: 3808err_out:
3820 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", 3809 ata_dev_printk(dev, KERN_INFO, "ATAPI check failed\n");
3821 ap->id, dev->devno);
3822 qc->err_mask |= AC_ERR_HSM; 3810 qc->err_mask |= AC_ERR_HSM;
3823 ap->hsm_task_state = HSM_ST_ERR; 3811 ap->hsm_task_state = HSM_ST_ERR;
3824} 3812}
@@ -3887,8 +3875,7 @@ static void ata_pio_error(struct ata_queued_cmd *qc)
3887 struct ata_port *ap = qc->ap; 3875 struct ata_port *ap = qc->ap;
3888 3876
3889 if (qc->tf.command != ATA_CMD_PACKET) 3877 if (qc->tf.command != ATA_CMD_PACKET)
3890 printk(KERN_WARNING "ata%u: dev %u PIO error\n", 3878 ata_dev_printk(qc->dev, KERN_WARNING, "PIO error\n");
3891 ap->id, qc->dev->devno);
3892 3879
3893 /* make sure qc->err_mask is available to 3880 /* make sure qc->err_mask is available to
3894 * know what's wrong and recover 3881 * know what's wrong and recover
@@ -4314,7 +4301,7 @@ idle_irq:
4314#ifdef ATA_IRQ_TRAP 4301#ifdef ATA_IRQ_TRAP
4315 if ((ap->stats.idle_irq % 1000) == 0) { 4302 if ((ap->stats.idle_irq % 1000) == 0) {
4316 ata_irq_ack(ap, 0); /* debug trap */ 4303 ata_irq_ack(ap, 0); /* debug trap */
4317 printk(KERN_WARNING "ata%d: irq trap\n", ap->id); 4304 ata_port_printk(ap, KERN_WARNING, "irq trap\n");
4318 return 1; 4305 return 1;
4319 } 4306 }
4320#endif 4307#endif
@@ -4522,8 +4509,8 @@ static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd)
4522 4509
4523 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); 4510 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
4524 if (err) 4511 if (err)
4525 printk(KERN_ERR "%s: ata command failed: %d\n", 4512 ata_dev_printk(dev, KERN_ERR, "%s: ata command failed: %d\n",
4526 __FUNCTION__, err); 4513 __FUNCTION__, err);
4527 4514
4528 return err; 4515 return err;
4529} 4516}
@@ -4863,15 +4850,14 @@ int ata_device_add(const struct ata_probe_ent *ent)
4863 (ap->pio_mask << ATA_SHIFT_PIO); 4850 (ap->pio_mask << ATA_SHIFT_PIO);
4864 4851
4865 /* print per-port info to dmesg */ 4852 /* print per-port info to dmesg */
4866 printk(KERN_INFO "ata%u: %cATA max %s cmd 0x%lX ctl 0x%lX " 4853 ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX "
4867 "bmdma 0x%lX irq %lu\n", 4854 "ctl 0x%lX bmdma 0x%lX irq %lu\n",
4868 ap->id, 4855 ap->flags & ATA_FLAG_SATA ? 'S' : 'P',
4869 ap->flags & ATA_FLAG_SATA ? 'S' : 'P', 4856 ata_mode_string(xfer_mode_mask),
4870 ata_mode_string(xfer_mode_mask), 4857 ap->ioaddr.cmd_addr,
4871 ap->ioaddr.cmd_addr, 4858 ap->ioaddr.ctl_addr,
4872 ap->ioaddr.ctl_addr, 4859 ap->ioaddr.bmdma_addr,
4873 ap->ioaddr.bmdma_addr, 4860 ent->irq);
4874 ent->irq);
4875 4861
4876 ata_chk_status(ap); 4862 ata_chk_status(ap);
4877 host_set->ops->irq_clear(ap); 4863 host_set->ops->irq_clear(ap);
@@ -4909,8 +4895,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
4909 4895
4910 rc = scsi_add_host(ap->host, dev); 4896 rc = scsi_add_host(ap->host, dev);
4911 if (rc) { 4897 if (rc) {
4912 printk(KERN_ERR "ata%u: scsi_add_host failed\n", 4898 ata_port_printk(ap, KERN_ERR, "scsi_add_host failed\n");
4913 ap->id);
4914 /* FIXME: do something useful here */ 4899 /* FIXME: do something useful here */
4915 /* FIXME: handle unconditional calls to 4900 /* FIXME: handle unconditional calls to
4916 * scsi_scan_host and ata_host_remove, below, 4901 * scsi_scan_host and ata_host_remove, below,
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c
index c31b13fd5307..959a1cdffac2 100644
--- a/drivers/scsi/libata-eh.c
+++ b/drivers/scsi/libata-eh.c
@@ -167,8 +167,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
167 /* ack bmdma irq events */ 167 /* ack bmdma irq events */
168 ap->ops->irq_clear(ap); 168 ap->ops->irq_clear(ap);
169 169
170 printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", 170 ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, "
171 ap->id, qc->tf.command, drv_stat, host_stat); 171 "stat 0x%x host_stat 0x%x\n",
172 qc->tf.command, drv_stat, host_stat);
172 173
173 /* complete taskfile transaction */ 174 /* complete taskfile transaction */
174 qc->err_mask |= ac_err_mask(drv_stat); 175 qc->err_mask |= ac_err_mask(drv_stat);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index fcbf64e741bb..a9b4083a4f67 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1261,8 +1261,8 @@ static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
1261 if (cmd->sc_data_direction == DMA_FROM_DEVICE || 1261 if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1262 cmd->sc_data_direction == DMA_TO_DEVICE) { 1262 cmd->sc_data_direction == DMA_TO_DEVICE) {
1263 if (unlikely(cmd->request_bufflen < 1)) { 1263 if (unlikely(cmd->request_bufflen < 1)) {
1264 printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", 1264 ata_dev_printk(dev, KERN_WARNING,
1265 dev->ap->id, dev->devno); 1265 "WARNING: zero len r/w req\n");
1266 goto err_did; 1266 goto err_did;
1267 } 1267 }
1268 1268
@@ -2200,8 +2200,9 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2200 2200
2201 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { 2201 if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
2202 if (unlikely(dev->class == ATA_DEV_ATAPI)) { 2202 if (unlikely(dev->class == ATA_DEV_ATAPI)) {
2203 printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n", 2203 ata_dev_printk(dev, KERN_WARNING,
2204 ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled"); 2204 "WARNING: ATAPI is %s, device ignored.\n",
2205 atapi_enabled ? "not supported with this driver" : "disabled");
2205 return NULL; 2206 return NULL;
2206 } 2207 }
2207 } 2208 }
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 748569b615fc..e8d00f0efdf2 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -680,7 +680,7 @@ static void mv_stop_dma(struct ata_port *ap)
680 } 680 }
681 681
682 if (EDMA_EN & reg) { 682 if (EDMA_EN & reg) {
683 printk(KERN_ERR "ata%u: Unable to stop eDMA\n", ap->id); 683 ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n");
684 /* FIXME: Consider doing a reset here to recover */ 684 /* FIXME: Consider doing a reset here to recover */
685 } 685 }
686} 686}
@@ -1964,8 +1964,8 @@ comreset_retry:
1964 ata_port_probe(ap); 1964 ata_port_probe(ap);
1965 } else { 1965 } else {
1966 sata_scr_read(ap, SCR_STATUS, &sstatus); 1966 sata_scr_read(ap, SCR_STATUS, &sstatus);
1967 printk(KERN_INFO "ata%u: no device found (phy stat %08x)\n", 1967 ata_port_printk(ap, KERN_INFO,
1968 ap->id, sstatus); 1968 "no device found (phy stat %08x)\n", sstatus);
1969 ata_port_disable(ap); 1969 ata_port_disable(ap);
1970 return; 1970 return;
1971 } 1971 }
@@ -2023,7 +2023,7 @@ static void mv_eng_timeout(struct ata_port *ap)
2023{ 2023{
2024 struct ata_queued_cmd *qc; 2024 struct ata_queued_cmd *qc;
2025 2025
2026 printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); 2026 ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n");
2027 DPRINTK("All regs @ start of eng_timeout\n"); 2027 DPRINTK("All regs @ start of eng_timeout\n");
2028 mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, 2028 mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no,
2029 to_pci_dev(ap->host_set->dev)); 2029 to_pci_dev(ap->host_set->dev));
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index ddbc0c6dd9fe..e9d61bc2b247 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -435,7 +435,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
435 switch (qc->tf.protocol) { 435 switch (qc->tf.protocol) {
436 case ATA_PROT_DMA: 436 case ATA_PROT_DMA:
437 case ATA_PROT_NODATA: 437 case ATA_PROT_NODATA:
438 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 438 ata_port_printk(ap, KERN_ERR, "command timeout\n");
439 drv_stat = ata_wait_idle(ap); 439 drv_stat = ata_wait_idle(ap);
440 qc->err_mask |= __ac_err_mask(drv_stat); 440 qc->err_mask |= __ac_err_mask(drv_stat);
441 break; 441 break;
@@ -443,8 +443,9 @@ static void pdc_eng_timeout(struct ata_port *ap)
443 default: 443 default:
444 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 444 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
445 445
446 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", 446 ata_port_printk(ap, KERN_ERR,
447 ap->id, qc->tf.command, drv_stat); 447 "unknown timeout, cmd 0x%x stat 0x%x\n",
448 qc->tf.command, drv_stat);
448 449
449 qc->err_mask |= ac_err_mask(drv_stat); 450 qc->err_mask |= ac_err_mask(drv_stat);
450 break; 451 break;
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index c9333577330e..bfcece18a7cb 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -360,16 +360,16 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
360 if (slow_down || 360 if (slow_down ||
361 ((ap->flags & SIL_FLAG_MOD15WRITE) && 361 ((ap->flags & SIL_FLAG_MOD15WRITE) &&
362 (quirks & SIL_QUIRK_MOD15WRITE))) { 362 (quirks & SIL_QUIRK_MOD15WRITE))) {
363 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n", 363 ata_dev_printk(dev, KERN_INFO, "applying Seagate errata fix "
364 ap->id, dev->devno); 364 "(mod15write workaround)\n");
365 dev->max_sectors = 15; 365 dev->max_sectors = 15;
366 return; 366 return;
367 } 367 }
368 368
369 /* limit to udma5 */ 369 /* limit to udma5 */
370 if (quirks & SIL_QUIRK_UDMA5MAX) { 370 if (quirks & SIL_QUIRK_UDMA5MAX) {
371 printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", 371 ata_dev_printk(dev, KERN_INFO,
372 ap->id, dev->devno, model_num); 372 "applying Maxtor errata fix %s\n", model_num);
373 dev->udma_mask &= ATA_UDMA5; 373 dev->udma_mask &= ATA_UDMA5;
374 return; 374 return;
375 } 375 }
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index bedc787dafd1..ff96724b1e38 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -516,7 +516,7 @@ static int sil24_softreset(struct ata_port *ap, unsigned int *class)
516 return 0; 516 return 0;
517 517
518 err: 518 err:
519 printk(KERN_ERR "ata%u: softreset failed (%s)\n", ap->id, reason); 519 ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason);
520 return -EIO; 520 return -EIO;
521} 521}
522 522
@@ -561,7 +561,7 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class)
561 return 0; 561 return 0;
562 562
563 err: 563 err:
564 printk(KERN_ERR "ata%u: hardreset failed (%s)\n", ap->id, reason); 564 ata_port_printk(ap, KERN_ERR, "hardreset failed (%s)\n", reason);
565 return -EIO; 565 return -EIO;
566} 566}
567 567
@@ -721,7 +721,7 @@ static void sil24_eng_timeout(struct ata_port *ap)
721 721
722 qc = ata_qc_from_tag(ap, ap->active_tag); 722 qc = ata_qc_from_tag(ap, ap->active_tag);
723 723
724 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 724 ata_port_printk(ap, KERN_ERR, "command timeout\n");
725 qc->err_mask |= AC_ERR_TIMEOUT; 725 qc->err_mask |= AC_ERR_TIMEOUT;
726 ata_eh_qc_complete(qc); 726 ata_eh_qc_complete(qc);
727 727
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index a669d0589889..96d7b73f5fdc 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -868,15 +868,16 @@ static void pdc_eng_timeout(struct ata_port *ap)
868 switch (qc->tf.protocol) { 868 switch (qc->tf.protocol) {
869 case ATA_PROT_DMA: 869 case ATA_PROT_DMA:
870 case ATA_PROT_NODATA: 870 case ATA_PROT_NODATA:
871 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 871 ata_port_printk(ap, KERN_ERR, "command timeout\n");
872 qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); 872 qc->err_mask |= __ac_err_mask(ata_wait_idle(ap));
873 break; 873 break;
874 874
875 default: 875 default:
876 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 876 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
877 877
878 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", 878 ata_port_printk(ap, KERN_ERR,
879 ap->id, qc->tf.command, drv_stat); 879 "unknown timeout, cmd 0x%x stat 0x%x\n",
880 qc->tf.command, drv_stat);
880 881
881 qc->err_mask |= ac_err_mask(drv_stat); 882 qc->err_mask |= ac_err_mask(drv_stat);
882 break; 883 break;