diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 199 |
1 files changed, 92 insertions, 107 deletions
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) | |||
412 | void ata_dev_disable(struct ata_device *dev) | 412 | void 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 | */ |
1897 | int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) | 1897 | int 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 | ||
1931 | static int ata_dev_set_mode(struct ata_device *dev) | 1930 | static 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 | ||
2323 | err_out: | 2318 | err_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, | |||
2724 | static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | 2719 | static 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 | */ |
2784 | int ata_dev_revalidate(struct ata_device *dev, int post_reset) | 2775 | int 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 | ||
3819 | err_out: | 3808 | err_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, |