diff options
author | Joe Perches <joe@perches.com> | 2011-04-15 18:51:59 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2011-07-23 17:57:36 -0400 |
commit | a9a79dfec239568bdbf778242f8fcd10bcc5b9e2 (patch) | |
tree | 620648585f89cdb589d1625431f8c21ef70a9258 /drivers/ata/libata-core.c | |
parent | a44fec1fce5d5d14cc3ac4545b8da346394de666 (diff) |
ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
Saves text by removing nearly duplicated text format strings by
creating ata_<foo>_printk functions and printf extension %pV.
ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
Format string duplication comes from:
#define ata_link_printk(link, lv, fmt, args...) do { \
if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
(link)->pmp , ##args); \
else \
printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
} while(0)
Coalesce long formats.
$ size drivers/ata/built-in.*
text data bss dec hex filename
544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o
558429 73893 117864 750186 b726a drivers/ata/built-in.allyesconfig.dev_level.o
141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o
149567 14689 4220 168476 2921c drivers/ata/built-in.defconfig.dev_level.o
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 381 |
1 files changed, 215 insertions, 166 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 481089c85a94..ef5612e42881 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -335,8 +335,7 @@ void ata_force_cbl(struct ata_port *ap) | |||
335 | continue; | 335 | continue; |
336 | 336 | ||
337 | ap->cbl = fe->param.cbl; | 337 | ap->cbl = fe->param.cbl; |
338 | ata_port_printk(ap, KERN_NOTICE, | 338 | ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name); |
339 | "FORCE: cable set to %s\n", fe->param.name); | ||
340 | return; | 339 | return; |
341 | } | 340 | } |
342 | } | 341 | } |
@@ -378,8 +377,7 @@ static void ata_force_link_limits(struct ata_link *link) | |||
378 | /* only honor the first spd limit */ | 377 | /* only honor the first spd limit */ |
379 | if (!did_spd && fe->param.spd_limit) { | 378 | if (!did_spd && fe->param.spd_limit) { |
380 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | 379 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; |
381 | ata_link_printk(link, KERN_NOTICE, | 380 | ata_link_notice(link, "FORCE: PHY spd limit set to %s\n", |
382 | "FORCE: PHY spd limit set to %s\n", | ||
383 | fe->param.name); | 381 | fe->param.name); |
384 | did_spd = true; | 382 | did_spd = true; |
385 | } | 383 | } |
@@ -387,7 +385,7 @@ static void ata_force_link_limits(struct ata_link *link) | |||
387 | /* let lflags stack */ | 385 | /* let lflags stack */ |
388 | if (fe->param.lflags) { | 386 | if (fe->param.lflags) { |
389 | link->flags |= fe->param.lflags; | 387 | link->flags |= fe->param.lflags; |
390 | ata_link_printk(link, KERN_NOTICE, | 388 | ata_link_notice(link, |
391 | "FORCE: link flag 0x%x forced -> 0x%x\n", | 389 | "FORCE: link flag 0x%x forced -> 0x%x\n", |
392 | fe->param.lflags, link->flags); | 390 | fe->param.lflags, link->flags); |
393 | } | 391 | } |
@@ -442,8 +440,8 @@ static void ata_force_xfermask(struct ata_device *dev) | |||
442 | dev->pio_mask = pio_mask; | 440 | dev->pio_mask = pio_mask; |
443 | } | 441 | } |
444 | 442 | ||
445 | ata_dev_printk(dev, KERN_NOTICE, | 443 | ata_dev_notice(dev, "FORCE: xfer_mask set to %s\n", |
446 | "FORCE: xfer_mask set to %s\n", fe->param.name); | 444 | fe->param.name); |
447 | return; | 445 | return; |
448 | } | 446 | } |
449 | } | 447 | } |
@@ -486,8 +484,8 @@ static void ata_force_horkage(struct ata_device *dev) | |||
486 | dev->horkage |= fe->param.horkage_on; | 484 | dev->horkage |= fe->param.horkage_on; |
487 | dev->horkage &= ~fe->param.horkage_off; | 485 | dev->horkage &= ~fe->param.horkage_off; |
488 | 486 | ||
489 | ata_dev_printk(dev, KERN_NOTICE, | 487 | ata_dev_notice(dev, "FORCE: horkage modified (%s)\n", |
490 | "FORCE: horkage modified (%s)\n", fe->param.name); | 488 | fe->param.name); |
491 | } | 489 | } |
492 | } | 490 | } |
493 | 491 | ||
@@ -711,8 +709,8 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) | |||
711 | sect = tf->lbal; | 709 | sect = tf->lbal; |
712 | 710 | ||
713 | if (!sect) { | 711 | if (!sect) { |
714 | ata_dev_printk(dev, KERN_WARNING, "device reported " | 712 | ata_dev_warn(dev, |
715 | "invalid CHS sector 0\n"); | 713 | "device reported invalid CHS sector 0\n"); |
716 | sect = 1; /* oh well */ | 714 | sect = 1; /* oh well */ |
717 | } | 715 | } |
718 | 716 | ||
@@ -1230,8 +1228,9 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors) | |||
1230 | 1228 | ||
1231 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); | 1229 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); |
1232 | if (err_mask) { | 1230 | if (err_mask) { |
1233 | ata_dev_printk(dev, KERN_WARNING, "failed to read native " | 1231 | ata_dev_warn(dev, |
1234 | "max address (err_mask=0x%x)\n", err_mask); | 1232 | "failed to read native max address (err_mask=0x%x)\n", |
1233 | err_mask); | ||
1235 | if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED)) | 1234 | if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED)) |
1236 | return -EACCES; | 1235 | return -EACCES; |
1237 | return -EIO; | 1236 | return -EIO; |
@@ -1292,8 +1291,9 @@ static int ata_set_max_sectors(struct ata_device *dev, u64 new_sectors) | |||
1292 | 1291 | ||
1293 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); | 1292 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); |
1294 | if (err_mask) { | 1293 | if (err_mask) { |
1295 | ata_dev_printk(dev, KERN_WARNING, "failed to set " | 1294 | ata_dev_warn(dev, |
1296 | "max address (err_mask=0x%x)\n", err_mask); | 1295 | "failed to set max address (err_mask=0x%x)\n", |
1296 | err_mask); | ||
1297 | if (err_mask == AC_ERR_DEV && | 1297 | if (err_mask == AC_ERR_DEV && |
1298 | (tf.feature & (ATA_ABORTED | ATA_IDNF))) | 1298 | (tf.feature & (ATA_ABORTED | ATA_IDNF))) |
1299 | return -EACCES; | 1299 | return -EACCES; |
@@ -1336,8 +1336,8 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1336 | * be unlocked, skip HPA resizing. | 1336 | * be unlocked, skip HPA resizing. |
1337 | */ | 1337 | */ |
1338 | if (rc == -EACCES || !unlock_hpa) { | 1338 | if (rc == -EACCES || !unlock_hpa) { |
1339 | ata_dev_printk(dev, KERN_WARNING, "HPA support seems " | 1339 | ata_dev_warn(dev, |
1340 | "broken, skipping HPA handling\n"); | 1340 | "HPA support seems broken, skipping HPA handling\n"); |
1341 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; | 1341 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; |
1342 | 1342 | ||
1343 | /* we can continue if device aborted the command */ | 1343 | /* we can continue if device aborted the command */ |
@@ -1355,14 +1355,13 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1355 | return 0; | 1355 | return 0; |
1356 | 1356 | ||
1357 | if (native_sectors > sectors) | 1357 | if (native_sectors > sectors) |
1358 | ata_dev_printk(dev, KERN_INFO, | 1358 | ata_dev_info(dev, |
1359 | "HPA detected: current %llu, native %llu\n", | 1359 | "HPA detected: current %llu, native %llu\n", |
1360 | (unsigned long long)sectors, | 1360 | (unsigned long long)sectors, |
1361 | (unsigned long long)native_sectors); | 1361 | (unsigned long long)native_sectors); |
1362 | else if (native_sectors < sectors) | 1362 | else if (native_sectors < sectors) |
1363 | ata_dev_printk(dev, KERN_WARNING, | 1363 | ata_dev_warn(dev, |
1364 | "native sectors (%llu) is smaller than " | 1364 | "native sectors (%llu) is smaller than sectors (%llu)\n", |
1365 | "sectors (%llu)\n", | ||
1366 | (unsigned long long)native_sectors, | 1365 | (unsigned long long)native_sectors, |
1367 | (unsigned long long)sectors); | 1366 | (unsigned long long)sectors); |
1368 | return 0; | 1367 | return 0; |
@@ -1372,10 +1371,10 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1372 | rc = ata_set_max_sectors(dev, native_sectors); | 1371 | rc = ata_set_max_sectors(dev, native_sectors); |
1373 | if (rc == -EACCES) { | 1372 | if (rc == -EACCES) { |
1374 | /* if device aborted the command, skip HPA resizing */ | 1373 | /* if device aborted the command, skip HPA resizing */ |
1375 | ata_dev_printk(dev, KERN_WARNING, "device aborted resize " | 1374 | ata_dev_warn(dev, |
1376 | "(%llu -> %llu), skipping HPA handling\n", | 1375 | "device aborted resize (%llu -> %llu), skipping HPA handling\n", |
1377 | (unsigned long long)sectors, | 1376 | (unsigned long long)sectors, |
1378 | (unsigned long long)native_sectors); | 1377 | (unsigned long long)native_sectors); |
1379 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; | 1378 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; |
1380 | return 0; | 1379 | return 0; |
1381 | } else if (rc) | 1380 | } else if (rc) |
@@ -1384,14 +1383,14 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1384 | /* re-read IDENTIFY data */ | 1383 | /* re-read IDENTIFY data */ |
1385 | rc = ata_dev_reread_id(dev, 0); | 1384 | rc = ata_dev_reread_id(dev, 0); |
1386 | if (rc) { | 1385 | if (rc) { |
1387 | ata_dev_printk(dev, KERN_ERR, "failed to re-read IDENTIFY " | 1386 | ata_dev_err(dev, |
1388 | "data after HPA resizing\n"); | 1387 | "failed to re-read IDENTIFY data after HPA resizing\n"); |
1389 | return rc; | 1388 | return rc; |
1390 | } | 1389 | } |
1391 | 1390 | ||
1392 | if (print_info) { | 1391 | if (print_info) { |
1393 | u64 new_sectors = ata_id_n_sectors(dev->id); | 1392 | u64 new_sectors = ata_id_n_sectors(dev->id); |
1394 | ata_dev_printk(dev, KERN_INFO, | 1393 | ata_dev_info(dev, |
1395 | "HPA unlocked: %llu -> %llu, native %llu\n", | 1394 | "HPA unlocked: %llu -> %llu, native %llu\n", |
1396 | (unsigned long long)sectors, | 1395 | (unsigned long long)sectors, |
1397 | (unsigned long long)new_sectors, | 1396 | (unsigned long long)new_sectors, |
@@ -1655,8 +1654,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1655 | ata_qc_complete(qc); | 1654 | ata_qc_complete(qc); |
1656 | 1655 | ||
1657 | if (ata_msg_warn(ap)) | 1656 | if (ata_msg_warn(ap)) |
1658 | ata_dev_printk(dev, KERN_WARNING, | 1657 | ata_dev_warn(dev, "qc timeout (cmd 0x%x)\n", |
1659 | "qc timeout (cmd 0x%x)\n", command); | 1658 | command); |
1660 | } | 1659 | } |
1661 | 1660 | ||
1662 | spin_unlock_irqrestore(ap->lock, flags); | 1661 | spin_unlock_irqrestore(ap->lock, flags); |
@@ -1870,7 +1869,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1870 | int rc; | 1869 | int rc; |
1871 | 1870 | ||
1872 | if (ata_msg_ctl(ap)) | 1871 | if (ata_msg_ctl(ap)) |
1873 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); | 1872 | ata_dev_dbg(dev, "%s: ENTER\n", __func__); |
1874 | 1873 | ||
1875 | retry: | 1874 | retry: |
1876 | ata_tf_init(dev, &tf); | 1875 | ata_tf_init(dev, &tf); |
@@ -1909,14 +1908,13 @@ retry: | |||
1909 | 1908 | ||
1910 | if (err_mask) { | 1909 | if (err_mask) { |
1911 | if (err_mask & AC_ERR_NODEV_HINT) { | 1910 | if (err_mask & AC_ERR_NODEV_HINT) { |
1912 | ata_dev_printk(dev, KERN_DEBUG, | 1911 | ata_dev_dbg(dev, "NODEV after polling detection\n"); |
1913 | "NODEV after polling detection\n"); | ||
1914 | return -ENOENT; | 1912 | return -ENOENT; |
1915 | } | 1913 | } |
1916 | 1914 | ||
1917 | if (is_semb) { | 1915 | if (is_semb) { |
1918 | ata_dev_printk(dev, KERN_INFO, "IDENTIFY failed on " | 1916 | ata_dev_info(dev, |
1919 | "device w/ SEMB sig, disabled\n"); | 1917 | "IDENTIFY failed on device w/ SEMB sig, disabled\n"); |
1920 | /* SEMB is not supported yet */ | 1918 | /* SEMB is not supported yet */ |
1921 | *p_class = ATA_DEV_SEMB_UNSUP; | 1919 | *p_class = ATA_DEV_SEMB_UNSUP; |
1922 | return 0; | 1920 | return 0; |
@@ -1942,8 +1940,8 @@ retry: | |||
1942 | * both flavors of IDENTIFYs which happens | 1940 | * both flavors of IDENTIFYs which happens |
1943 | * sometimes with phantom devices. | 1941 | * sometimes with phantom devices. |
1944 | */ | 1942 | */ |
1945 | ata_dev_printk(dev, KERN_DEBUG, | 1943 | ata_dev_dbg(dev, |
1946 | "both IDENTIFYs aborted, assuming NODEV\n"); | 1944 | "both IDENTIFYs aborted, assuming NODEV\n"); |
1947 | return -ENOENT; | 1945 | return -ENOENT; |
1948 | } | 1946 | } |
1949 | 1947 | ||
@@ -1953,9 +1951,9 @@ retry: | |||
1953 | } | 1951 | } |
1954 | 1952 | ||
1955 | if (dev->horkage & ATA_HORKAGE_DUMP_ID) { | 1953 | if (dev->horkage & ATA_HORKAGE_DUMP_ID) { |
1956 | ata_dev_printk(dev, KERN_DEBUG, "dumping IDENTIFY data, " | 1954 | ata_dev_dbg(dev, "dumping IDENTIFY data, " |
1957 | "class=%d may_fallback=%d tried_spinup=%d\n", | 1955 | "class=%d may_fallback=%d tried_spinup=%d\n", |
1958 | class, may_fallback, tried_spinup); | 1956 | class, may_fallback, tried_spinup); |
1959 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, | 1957 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, |
1960 | 16, 2, id, ATA_ID_WORDS * sizeof(*id), true); | 1958 | 16, 2, id, ATA_ID_WORDS * sizeof(*id), true); |
1961 | } | 1959 | } |
@@ -2034,8 +2032,8 @@ retry: | |||
2034 | 2032 | ||
2035 | err_out: | 2033 | err_out: |
2036 | if (ata_msg_warn(ap)) | 2034 | if (ata_msg_warn(ap)) |
2037 | ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY " | 2035 | ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n", |
2038 | "(%s, err_mask=0x%x)\n", reason, err_mask); | 2036 | reason, err_mask); |
2039 | return rc; | 2037 | return rc; |
2040 | } | 2038 | } |
2041 | 2039 | ||
@@ -2065,9 +2063,8 @@ static int ata_do_link_spd_horkage(struct ata_device *dev) | |||
2065 | * guaranteed by setting sata_spd_limit to target_limit above. | 2063 | * guaranteed by setting sata_spd_limit to target_limit above. |
2066 | */ | 2064 | */ |
2067 | if (plink->sata_spd > target) { | 2065 | if (plink->sata_spd > target) { |
2068 | ata_dev_printk(dev, KERN_INFO, | 2066 | ata_dev_info(dev, "applying link speed limit horkage to %s\n", |
2069 | "applying link speed limit horkage to %s\n", | 2067 | sata_spd_string(target)); |
2070 | sata_spd_string(target)); | ||
2071 | return -EAGAIN; | 2068 | return -EAGAIN; |
2072 | } | 2069 | } |
2073 | return 0; | 2070 | return 0; |
@@ -2110,8 +2107,9 @@ static int ata_dev_config_ncq(struct ata_device *dev, | |||
2110 | err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE, | 2107 | err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE, |
2111 | SATA_FPDMA_AA); | 2108 | SATA_FPDMA_AA); |
2112 | if (err_mask) { | 2109 | if (err_mask) { |
2113 | ata_dev_printk(dev, KERN_ERR, "failed to enable AA" | 2110 | ata_dev_err(dev, |
2114 | "(error_mask=0x%x)\n", err_mask); | 2111 | "failed to enable AA (error_mask=0x%x)\n", |
2112 | err_mask); | ||
2115 | if (err_mask != AC_ERR_DEV) { | 2113 | if (err_mask != AC_ERR_DEV) { |
2116 | dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA; | 2114 | dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA; |
2117 | return -EIO; | 2115 | return -EIO; |
@@ -2154,31 +2152,28 @@ int ata_dev_configure(struct ata_device *dev) | |||
2154 | int rc; | 2152 | int rc; |
2155 | 2153 | ||
2156 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { | 2154 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { |
2157 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", | 2155 | ata_dev_info(dev, "%s: ENTER/EXIT -- nodev\n", __func__); |
2158 | __func__); | ||
2159 | return 0; | 2156 | return 0; |
2160 | } | 2157 | } |
2161 | 2158 | ||
2162 | if (ata_msg_probe(ap)) | 2159 | if (ata_msg_probe(ap)) |
2163 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); | 2160 | ata_dev_dbg(dev, "%s: ENTER\n", __func__); |
2164 | 2161 | ||
2165 | /* set horkage */ | 2162 | /* set horkage */ |
2166 | dev->horkage |= ata_dev_blacklisted(dev); | 2163 | dev->horkage |= ata_dev_blacklisted(dev); |
2167 | ata_force_horkage(dev); | 2164 | ata_force_horkage(dev); |
2168 | 2165 | ||
2169 | if (dev->horkage & ATA_HORKAGE_DISABLE) { | 2166 | if (dev->horkage & ATA_HORKAGE_DISABLE) { |
2170 | ata_dev_printk(dev, KERN_INFO, | 2167 | ata_dev_info(dev, "unsupported device, disabling\n"); |
2171 | "unsupported device, disabling\n"); | ||
2172 | ata_dev_disable(dev); | 2168 | ata_dev_disable(dev); |
2173 | return 0; | 2169 | return 0; |
2174 | } | 2170 | } |
2175 | 2171 | ||
2176 | if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && | 2172 | if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && |
2177 | dev->class == ATA_DEV_ATAPI) { | 2173 | dev->class == ATA_DEV_ATAPI) { |
2178 | ata_dev_printk(dev, KERN_WARNING, | 2174 | ata_dev_warn(dev, "WARNING: ATAPI is %s, device ignored\n", |
2179 | "WARNING: ATAPI is %s, device ignored.\n", | 2175 | atapi_enabled ? "not supported with this driver" |
2180 | atapi_enabled ? "not supported with this driver" | 2176 | : "disabled"); |
2181 | : "disabled"); | ||
2182 | ata_dev_disable(dev); | 2177 | ata_dev_disable(dev); |
2183 | return 0; | 2178 | return 0; |
2184 | } | 2179 | } |
@@ -2199,12 +2194,12 @@ int ata_dev_configure(struct ata_device *dev) | |||
2199 | 2194 | ||
2200 | /* print device capabilities */ | 2195 | /* print device capabilities */ |
2201 | if (ata_msg_probe(ap)) | 2196 | if (ata_msg_probe(ap)) |
2202 | ata_dev_printk(dev, KERN_DEBUG, | 2197 | ata_dev_dbg(dev, |
2203 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " | 2198 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " |
2204 | "85:%04x 86:%04x 87:%04x 88:%04x\n", | 2199 | "85:%04x 86:%04x 87:%04x 88:%04x\n", |
2205 | __func__, | 2200 | __func__, |
2206 | id[49], id[82], id[83], id[84], | 2201 | id[49], id[82], id[83], id[84], |
2207 | id[85], id[86], id[87], id[88]); | 2202 | id[85], id[86], id[87], id[88]); |
2208 | 2203 | ||
2209 | /* initialize to-be-configured parameters */ | 2204 | /* initialize to-be-configured parameters */ |
2210 | dev->flags &= ~ATA_DFLAG_CFG_MASK; | 2205 | dev->flags &= ~ATA_DFLAG_CFG_MASK; |
@@ -2238,17 +2233,15 @@ int ata_dev_configure(struct ata_device *dev) | |||
2238 | if (ata_id_is_cfa(id)) { | 2233 | if (ata_id_is_cfa(id)) { |
2239 | /* CPRM may make this media unusable */ | 2234 | /* CPRM may make this media unusable */ |
2240 | if (id[ATA_ID_CFA_KEY_MGMT] & 1) | 2235 | if (id[ATA_ID_CFA_KEY_MGMT] & 1) |
2241 | ata_dev_printk(dev, KERN_WARNING, | 2236 | ata_dev_warn(dev, |
2242 | "supports DRM functions and may " | 2237 | "supports DRM functions and may not be fully accessible\n"); |
2243 | "not be fully accessible.\n"); | ||
2244 | snprintf(revbuf, 7, "CFA"); | 2238 | snprintf(revbuf, 7, "CFA"); |
2245 | } else { | 2239 | } else { |
2246 | snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id)); | 2240 | snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id)); |
2247 | /* Warn the user if the device has TPM extensions */ | 2241 | /* Warn the user if the device has TPM extensions */ |
2248 | if (ata_id_has_tpm(id)) | 2242 | if (ata_id_has_tpm(id)) |
2249 | ata_dev_printk(dev, KERN_WARNING, | 2243 | ata_dev_warn(dev, |
2250 | "supports DRM functions and may " | 2244 | "supports DRM functions and may not be fully accessible\n"); |
2251 | "not be fully accessible.\n"); | ||
2252 | } | 2245 | } |
2253 | 2246 | ||
2254 | dev->n_sectors = ata_id_n_sectors(id); | 2247 | dev->n_sectors = ata_id_n_sectors(id); |
@@ -2285,12 +2278,11 @@ int ata_dev_configure(struct ata_device *dev) | |||
2285 | 2278 | ||
2286 | /* print device info to dmesg */ | 2279 | /* print device info to dmesg */ |
2287 | if (ata_msg_drv(ap) && print_info) { | 2280 | if (ata_msg_drv(ap) && print_info) { |
2288 | ata_dev_printk(dev, KERN_INFO, | 2281 | ata_dev_info(dev, "%s: %s, %s, max %s\n", |
2289 | "%s: %s, %s, max %s\n", | 2282 | revbuf, modelbuf, fwrevbuf, |
2290 | revbuf, modelbuf, fwrevbuf, | 2283 | ata_mode_string(xfer_mask)); |
2291 | ata_mode_string(xfer_mask)); | 2284 | ata_dev_info(dev, |
2292 | ata_dev_printk(dev, KERN_INFO, | 2285 | "%llu sectors, multi %u: %s %s\n", |
2293 | "%Lu sectors, multi %u: %s %s\n", | ||
2294 | (unsigned long long)dev->n_sectors, | 2286 | (unsigned long long)dev->n_sectors, |
2295 | dev->multi_count, lba_desc, ncq_desc); | 2287 | dev->multi_count, lba_desc, ncq_desc); |
2296 | } | 2288 | } |
@@ -2311,15 +2303,14 @@ int ata_dev_configure(struct ata_device *dev) | |||
2311 | 2303 | ||
2312 | /* print device info to dmesg */ | 2304 | /* print device info to dmesg */ |
2313 | if (ata_msg_drv(ap) && print_info) { | 2305 | if (ata_msg_drv(ap) && print_info) { |
2314 | ata_dev_printk(dev, KERN_INFO, | 2306 | ata_dev_info(dev, "%s: %s, %s, max %s\n", |
2315 | "%s: %s, %s, max %s\n", | 2307 | revbuf, modelbuf, fwrevbuf, |
2316 | revbuf, modelbuf, fwrevbuf, | 2308 | ata_mode_string(xfer_mask)); |
2317 | ata_mode_string(xfer_mask)); | 2309 | ata_dev_info(dev, |
2318 | ata_dev_printk(dev, KERN_INFO, | 2310 | "%llu sectors, multi %u, CHS %u/%u/%u\n", |
2319 | "%Lu sectors, multi %u, CHS %u/%u/%u\n", | 2311 | (unsigned long long)dev->n_sectors, |
2320 | (unsigned long long)dev->n_sectors, | 2312 | dev->multi_count, dev->cylinders, |
2321 | dev->multi_count, dev->cylinders, | 2313 | dev->heads, dev->sectors); |
2322 | dev->heads, dev->sectors); | ||
2323 | } | 2314 | } |
2324 | } | 2315 | } |
2325 | 2316 | ||
@@ -2336,8 +2327,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2336 | rc = atapi_cdb_len(id); | 2327 | rc = atapi_cdb_len(id); |
2337 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { | 2328 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { |
2338 | if (ata_msg_warn(ap)) | 2329 | if (ata_msg_warn(ap)) |
2339 | ata_dev_printk(dev, KERN_WARNING, | 2330 | ata_dev_warn(dev, "unsupported CDB len\n"); |
2340 | "unsupported CDB len\n"); | ||
2341 | rc = -EINVAL; | 2331 | rc = -EINVAL; |
2342 | goto err_out_nosup; | 2332 | goto err_out_nosup; |
2343 | } | 2333 | } |
@@ -2358,9 +2348,9 @@ int ata_dev_configure(struct ata_device *dev) | |||
2358 | err_mask = ata_dev_set_feature(dev, | 2348 | err_mask = ata_dev_set_feature(dev, |
2359 | SETFEATURES_SATA_ENABLE, SATA_AN); | 2349 | SETFEATURES_SATA_ENABLE, SATA_AN); |
2360 | if (err_mask) | 2350 | if (err_mask) |
2361 | ata_dev_printk(dev, KERN_ERR, | 2351 | ata_dev_err(dev, |
2362 | "failed to enable ATAPI AN " | 2352 | "failed to enable ATAPI AN (err_mask=0x%x)\n", |
2363 | "(err_mask=0x%x)\n", err_mask); | 2353 | err_mask); |
2364 | else { | 2354 | else { |
2365 | dev->flags |= ATA_DFLAG_AN; | 2355 | dev->flags |= ATA_DFLAG_AN; |
2366 | atapi_an_string = ", ATAPI AN"; | 2356 | atapi_an_string = ", ATAPI AN"; |
@@ -2379,12 +2369,12 @@ int ata_dev_configure(struct ata_device *dev) | |||
2379 | 2369 | ||
2380 | /* print device info to dmesg */ | 2370 | /* print device info to dmesg */ |
2381 | if (ata_msg_drv(ap) && print_info) | 2371 | if (ata_msg_drv(ap) && print_info) |
2382 | ata_dev_printk(dev, KERN_INFO, | 2372 | ata_dev_info(dev, |
2383 | "ATAPI: %s, %s, max %s%s%s%s\n", | 2373 | "ATAPI: %s, %s, max %s%s%s%s\n", |
2384 | modelbuf, fwrevbuf, | 2374 | modelbuf, fwrevbuf, |
2385 | ata_mode_string(xfer_mask), | 2375 | ata_mode_string(xfer_mask), |
2386 | cdb_intr_string, atapi_an_string, | 2376 | cdb_intr_string, atapi_an_string, |
2387 | dma_dir_string); | 2377 | dma_dir_string); |
2388 | } | 2378 | } |
2389 | 2379 | ||
2390 | /* determine max_sectors */ | 2380 | /* determine max_sectors */ |
@@ -2396,8 +2386,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2396 | 200 sectors */ | 2386 | 200 sectors */ |
2397 | if (ata_dev_knobble(dev)) { | 2387 | if (ata_dev_knobble(dev)) { |
2398 | if (ata_msg_drv(ap) && print_info) | 2388 | if (ata_msg_drv(ap) && print_info) |
2399 | ata_dev_printk(dev, KERN_INFO, | 2389 | ata_dev_info(dev, "applying bridge limits\n"); |
2400 | "applying bridge limits\n"); | ||
2401 | dev->udma_mask &= ATA_UDMA5; | 2390 | dev->udma_mask &= ATA_UDMA5; |
2402 | dev->max_sectors = ATA_MAX_SECTORS; | 2391 | dev->max_sectors = ATA_MAX_SECTORS; |
2403 | } | 2392 | } |
@@ -2423,26 +2412,23 @@ int ata_dev_configure(struct ata_device *dev) | |||
2423 | bugs */ | 2412 | bugs */ |
2424 | 2413 | ||
2425 | if (print_info) { | 2414 | if (print_info) { |
2426 | ata_dev_printk(dev, KERN_WARNING, | 2415 | ata_dev_warn(dev, |
2427 | "Drive reports diagnostics failure. This may indicate a drive\n"); | 2416 | "Drive reports diagnostics failure. This may indicate a drive\n"); |
2428 | ata_dev_printk(dev, KERN_WARNING, | 2417 | ata_dev_warn(dev, |
2429 | "fault or invalid emulation. Contact drive vendor for information.\n"); | 2418 | "fault or invalid emulation. Contact drive vendor for information.\n"); |
2430 | } | 2419 | } |
2431 | } | 2420 | } |
2432 | 2421 | ||
2433 | if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) { | 2422 | if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) { |
2434 | ata_dev_printk(dev, KERN_WARNING, "WARNING: device requires " | 2423 | ata_dev_warn(dev, "WARNING: device requires firmware update to be fully functional\n"); |
2435 | "firmware update to be fully functional.\n"); | 2424 | ata_dev_warn(dev, " contact the vendor or visit http://ata.wiki.kernel.org\n"); |
2436 | ata_dev_printk(dev, KERN_WARNING, " contact the vendor " | ||
2437 | "or visit http://ata.wiki.kernel.org.\n"); | ||
2438 | } | 2425 | } |
2439 | 2426 | ||
2440 | return 0; | 2427 | return 0; |
2441 | 2428 | ||
2442 | err_out_nosup: | 2429 | err_out_nosup: |
2443 | if (ata_msg_probe(ap)) | 2430 | if (ata_msg_probe(ap)) |
2444 | ata_dev_printk(dev, KERN_DEBUG, | 2431 | ata_dev_dbg(dev, "%s: EXIT, err\n", __func__); |
2445 | "%s: EXIT, err\n", __func__); | ||
2446 | return rc; | 2432 | return rc; |
2447 | } | 2433 | } |
2448 | 2434 | ||
@@ -2663,13 +2649,11 @@ static void sata_print_link_status(struct ata_link *link) | |||
2663 | 2649 | ||
2664 | if (ata_phys_link_online(link)) { | 2650 | if (ata_phys_link_online(link)) { |
2665 | tmp = (sstatus >> 4) & 0xf; | 2651 | tmp = (sstatus >> 4) & 0xf; |
2666 | ata_link_printk(link, KERN_INFO, | 2652 | ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n", |
2667 | "SATA link up %s (SStatus %X SControl %X)\n", | 2653 | sata_spd_string(tmp), sstatus, scontrol); |
2668 | sata_spd_string(tmp), sstatus, scontrol); | ||
2669 | } else { | 2654 | } else { |
2670 | ata_link_printk(link, KERN_INFO, | 2655 | ata_link_info(link, "SATA link down (SStatus %X SControl %X)\n", |
2671 | "SATA link down (SStatus %X SControl %X)\n", | 2656 | sstatus, scontrol); |
2672 | sstatus, scontrol); | ||
2673 | } | 2657 | } |
2674 | } | 2658 | } |
2675 | 2659 | ||
@@ -2758,8 +2742,8 @@ int sata_down_spd_limit(struct ata_link *link, u32 spd_limit) | |||
2758 | 2742 | ||
2759 | link->sata_spd_limit = mask; | 2743 | link->sata_spd_limit = mask; |
2760 | 2744 | ||
2761 | ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", | 2745 | ata_link_warn(link, "limiting SATA link speed to %s\n", |
2762 | sata_spd_string(fls(mask))); | 2746 | sata_spd_string(fls(mask))); |
2763 | 2747 | ||
2764 | return 0; | 2748 | return 0; |
2765 | } | 2749 | } |
@@ -3136,8 +3120,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel) | |||
3136 | snprintf(buf, sizeof(buf), "%s", | 3120 | snprintf(buf, sizeof(buf), "%s", |
3137 | ata_mode_string(xfer_mask)); | 3121 | ata_mode_string(xfer_mask)); |
3138 | 3122 | ||
3139 | ata_dev_printk(dev, KERN_WARNING, | 3123 | ata_dev_warn(dev, "limiting speed to %s\n", buf); |
3140 | "limiting speed to %s\n", buf); | ||
3141 | } | 3124 | } |
3142 | 3125 | ||
3143 | ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, | 3126 | ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, |
@@ -3164,9 +3147,9 @@ static int ata_dev_set_mode(struct ata_device *dev) | |||
3164 | dev_err_whine = " (SET_XFERMODE skipped)"; | 3147 | dev_err_whine = " (SET_XFERMODE skipped)"; |
3165 | else { | 3148 | else { |
3166 | if (nosetxfer) | 3149 | if (nosetxfer) |
3167 | ata_dev_printk(dev, KERN_WARNING, | 3150 | ata_dev_warn(dev, |
3168 | "NOSETXFER but PATA detected - can't " | 3151 | "NOSETXFER but PATA detected - can't " |
3169 | "skip SETXFER, might malfunction\n"); | 3152 | "skip SETXFER, might malfunction\n"); |
3170 | err_mask = ata_dev_set_xfermode(dev); | 3153 | err_mask = ata_dev_set_xfermode(dev); |
3171 | } | 3154 | } |
3172 | 3155 | ||
@@ -3216,15 +3199,14 @@ static int ata_dev_set_mode(struct ata_device *dev) | |||
3216 | DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", | 3199 | DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", |
3217 | dev->xfer_shift, (int)dev->xfer_mode); | 3200 | dev->xfer_shift, (int)dev->xfer_mode); |
3218 | 3201 | ||
3219 | ata_dev_printk(dev, KERN_INFO, "configured for %s%s\n", | 3202 | ata_dev_info(dev, "configured for %s%s\n", |
3220 | ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)), | 3203 | ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)), |
3221 | dev_err_whine); | 3204 | dev_err_whine); |
3222 | 3205 | ||
3223 | return 0; | 3206 | return 0; |
3224 | 3207 | ||
3225 | fail: | 3208 | fail: |
3226 | ata_dev_printk(dev, KERN_ERR, "failed to set xfermode " | 3209 | ata_dev_err(dev, "failed to set xfermode (err_mask=0x%x)\n", err_mask); |
3227 | "(err_mask=0x%x)\n", err_mask); | ||
3228 | return -EIO; | 3210 | return -EIO; |
3229 | } | 3211 | } |
3230 | 3212 | ||
@@ -3286,7 +3268,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3286 | /* step 2: always set host PIO timings */ | 3268 | /* step 2: always set host PIO timings */ |
3287 | ata_for_each_dev(dev, link, ENABLED) { | 3269 | ata_for_each_dev(dev, link, ENABLED) { |
3288 | if (dev->pio_mode == 0xff) { | 3270 | if (dev->pio_mode == 0xff) { |
3289 | ata_dev_printk(dev, KERN_WARNING, "no PIO support\n"); | 3271 | ata_dev_warn(dev, "no PIO support\n"); |
3290 | rc = -EINVAL; | 3272 | rc = -EINVAL; |
3291 | goto out; | 3273 | goto out; |
3292 | } | 3274 | } |
@@ -3404,7 +3386,7 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline, | |||
3404 | 3386 | ||
3405 | if (!warned && time_after(now, start + 5 * HZ) && | 3387 | if (!warned && time_after(now, start + 5 * HZ) && |
3406 | (deadline - now > 3 * HZ)) { | 3388 | (deadline - now > 3 * HZ)) { |
3407 | ata_link_printk(link, KERN_WARNING, | 3389 | ata_link_warn(link, |
3408 | "link is slow to respond, please be patient " | 3390 | "link is slow to respond, please be patient " |
3409 | "(ready=%d)\n", tmp); | 3391 | "(ready=%d)\n", tmp); |
3410 | warned = 1; | 3392 | warned = 1; |
@@ -3552,16 +3534,14 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, | |||
3552 | } while ((scontrol & 0xf0f) != 0x300 && --tries); | 3534 | } while ((scontrol & 0xf0f) != 0x300 && --tries); |
3553 | 3535 | ||
3554 | if ((scontrol & 0xf0f) != 0x300) { | 3536 | if ((scontrol & 0xf0f) != 0x300) { |
3555 | ata_link_printk(link, KERN_ERR, | 3537 | ata_link_err(link, "failed to resume link (SControl %X)\n", |
3556 | "failed to resume link (SControl %X)\n", | 3538 | scontrol); |
3557 | scontrol); | ||
3558 | return 0; | 3539 | return 0; |
3559 | } | 3540 | } |
3560 | 3541 | ||
3561 | if (tries < ATA_LINK_RESUME_TRIES) | 3542 | if (tries < ATA_LINK_RESUME_TRIES) |
3562 | ata_link_printk(link, KERN_WARNING, | 3543 | ata_link_warn(link, "link resume succeeded after %d retries\n", |
3563 | "link resume succeeded after %d retries\n", | 3544 | ATA_LINK_RESUME_TRIES - tries); |
3564 | ATA_LINK_RESUME_TRIES - tries); | ||
3565 | 3545 | ||
3566 | if ((rc = sata_link_debounce(link, params, deadline))) | 3546 | if ((rc = sata_link_debounce(link, params, deadline))) |
3567 | return rc; | 3547 | return rc; |
@@ -3678,8 +3658,9 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline) | |||
3678 | rc = sata_link_resume(link, timing, deadline); | 3658 | rc = sata_link_resume(link, timing, deadline); |
3679 | /* whine about phy resume failure but proceed */ | 3659 | /* whine about phy resume failure but proceed */ |
3680 | if (rc && rc != -EOPNOTSUPP) | 3660 | if (rc && rc != -EOPNOTSUPP) |
3681 | ata_link_printk(link, KERN_WARNING, "failed to resume " | 3661 | ata_link_warn(link, |
3682 | "link for reset (errno=%d)\n", rc); | 3662 | "failed to resume link for reset (errno=%d)\n", |
3663 | rc); | ||
3683 | } | 3664 | } |
3684 | 3665 | ||
3685 | /* no point in trying softreset on offline link */ | 3666 | /* no point in trying softreset on offline link */ |
@@ -3795,8 +3776,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3795 | /* online is set iff link is online && reset succeeded */ | 3776 | /* online is set iff link is online && reset succeeded */ |
3796 | if (online) | 3777 | if (online) |
3797 | *online = false; | 3778 | *online = false; |
3798 | ata_link_printk(link, KERN_ERR, | 3779 | ata_link_err(link, "COMRESET failed (errno=%d)\n", rc); |
3799 | "COMRESET failed (errno=%d)\n", rc); | ||
3800 | } | 3780 | } |
3801 | DPRINTK("EXIT, rc=%d\n", rc); | 3781 | DPRINTK("EXIT, rc=%d\n", rc); |
3802 | return rc; | 3782 | return rc; |
@@ -3880,8 +3860,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3880 | unsigned char serial[2][ATA_ID_SERNO_LEN + 1]; | 3860 | unsigned char serial[2][ATA_ID_SERNO_LEN + 1]; |
3881 | 3861 | ||
3882 | if (dev->class != new_class) { | 3862 | if (dev->class != new_class) { |
3883 | ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n", | 3863 | ata_dev_info(dev, "class mismatch %d != %d\n", |
3884 | dev->class, new_class); | 3864 | dev->class, new_class); |
3885 | return 0; | 3865 | return 0; |
3886 | } | 3866 | } |
3887 | 3867 | ||
@@ -3891,14 +3871,14 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3891 | ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1])); | 3871 | ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1])); |
3892 | 3872 | ||
3893 | if (strcmp(model[0], model[1])) { | 3873 | if (strcmp(model[0], model[1])) { |
3894 | ata_dev_printk(dev, KERN_INFO, "model number mismatch " | 3874 | ata_dev_info(dev, "model number mismatch '%s' != '%s'\n", |
3895 | "'%s' != '%s'\n", model[0], model[1]); | 3875 | model[0], model[1]); |
3896 | return 0; | 3876 | return 0; |
3897 | } | 3877 | } |
3898 | 3878 | ||
3899 | if (strcmp(serial[0], serial[1])) { | 3879 | if (strcmp(serial[0], serial[1])) { |
3900 | ata_dev_printk(dev, KERN_INFO, "serial number mismatch " | 3880 | ata_dev_info(dev, "serial number mismatch '%s' != '%s'\n", |
3901 | "'%s' != '%s'\n", serial[0], serial[1]); | 3881 | serial[0], serial[1]); |
3902 | return 0; | 3882 | return 0; |
3903 | } | 3883 | } |
3904 | 3884 | ||
@@ -3968,8 +3948,8 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
3968 | new_class != ATA_DEV_ATA && | 3948 | new_class != ATA_DEV_ATA && |
3969 | new_class != ATA_DEV_ATAPI && | 3949 | new_class != ATA_DEV_ATAPI && |
3970 | new_class != ATA_DEV_SEMB) { | 3950 | new_class != ATA_DEV_SEMB) { |
3971 | ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n", | 3951 | ata_dev_info(dev, "class mismatch %u != %u\n", |
3972 | dev->class, new_class); | 3952 | dev->class, new_class); |
3973 | rc = -ENODEV; | 3953 | rc = -ENODEV; |
3974 | goto fail; | 3954 | goto fail; |
3975 | } | 3955 | } |
@@ -3990,9 +3970,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
3990 | return 0; | 3970 | return 0; |
3991 | 3971 | ||
3992 | /* n_sectors has changed */ | 3972 | /* n_sectors has changed */ |
3993 | ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch %llu != %llu\n", | 3973 | ata_dev_warn(dev, "n_sectors mismatch %llu != %llu\n", |
3994 | (unsigned long long)n_sectors, | 3974 | (unsigned long long)n_sectors, |
3995 | (unsigned long long)dev->n_sectors); | 3975 | (unsigned long long)dev->n_sectors); |
3996 | 3976 | ||
3997 | /* | 3977 | /* |
3998 | * Something could have caused HPA to be unlocked | 3978 | * Something could have caused HPA to be unlocked |
@@ -4001,9 +3981,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
4001 | */ | 3981 | */ |
4002 | if (dev->n_native_sectors == n_native_sectors && | 3982 | if (dev->n_native_sectors == n_native_sectors && |
4003 | dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) { | 3983 | dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) { |
4004 | ata_dev_printk(dev, KERN_WARNING, | 3984 | ata_dev_warn(dev, |
4005 | "new n_sectors matches native, probably " | 3985 | "new n_sectors matches native, probably " |
4006 | "late HPA unlock, n_sectors updated\n"); | 3986 | "late HPA unlock, n_sectors updated\n"); |
4007 | /* use the larger n_sectors */ | 3987 | /* use the larger n_sectors */ |
4008 | return 0; | 3988 | return 0; |
4009 | } | 3989 | } |
@@ -4017,9 +3997,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
4017 | if (dev->n_native_sectors == n_native_sectors && | 3997 | if (dev->n_native_sectors == n_native_sectors && |
4018 | dev->n_sectors < n_sectors && n_sectors == n_native_sectors && | 3998 | dev->n_sectors < n_sectors && n_sectors == n_native_sectors && |
4019 | !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) { | 3999 | !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) { |
4020 | ata_dev_printk(dev, KERN_WARNING, | 4000 | ata_dev_warn(dev, |
4021 | "old n_sectors matches native, probably " | 4001 | "old n_sectors matches native, probably " |
4022 | "late HPA lock, will try to unlock HPA\n"); | 4002 | "late HPA lock, will try to unlock HPA\n"); |
4023 | /* try unlocking HPA */ | 4003 | /* try unlocking HPA */ |
4024 | dev->flags |= ATA_DFLAG_UNLOCK_HPA; | 4004 | dev->flags |= ATA_DFLAG_UNLOCK_HPA; |
4025 | rc = -EIO; | 4005 | rc = -EIO; |
@@ -4030,7 +4010,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | |||
4030 | dev->n_native_sectors = n_native_sectors; | 4010 | dev->n_native_sectors = n_native_sectors; |
4031 | dev->n_sectors = n_sectors; | 4011 | dev->n_sectors = n_sectors; |
4032 | fail: | 4012 | fail: |
4033 | ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc); | 4013 | ata_dev_err(dev, "revalidation failed (errno=%d)\n", rc); |
4034 | return rc; | 4014 | return rc; |
4035 | } | 4015 | } |
4036 | 4016 | ||
@@ -4358,15 +4338,15 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
4358 | 4338 | ||
4359 | if (ata_dma_blacklisted(dev)) { | 4339 | if (ata_dma_blacklisted(dev)) { |
4360 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 4340 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
4361 | ata_dev_printk(dev, KERN_WARNING, | 4341 | ata_dev_warn(dev, |
4362 | "device is on DMA blacklist, disabling DMA\n"); | 4342 | "device is on DMA blacklist, disabling DMA\n"); |
4363 | } | 4343 | } |
4364 | 4344 | ||
4365 | if ((host->flags & ATA_HOST_SIMPLEX) && | 4345 | if ((host->flags & ATA_HOST_SIMPLEX) && |
4366 | host->simplex_claimed && host->simplex_claimed != ap) { | 4346 | host->simplex_claimed && host->simplex_claimed != ap) { |
4367 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 4347 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
4368 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " | 4348 | ata_dev_warn(dev, |
4369 | "other device, disabling DMA\n"); | 4349 | "simplex DMA is claimed by other device, disabling DMA\n"); |
4370 | } | 4350 | } |
4371 | 4351 | ||
4372 | if (ap->flags & ATA_FLAG_NO_IORDY) | 4352 | if (ap->flags & ATA_FLAG_NO_IORDY) |
@@ -4386,8 +4366,8 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
4386 | if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) | 4366 | if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) |
4387 | /* UDMA/44 or higher would be available */ | 4367 | /* UDMA/44 or higher would be available */ |
4388 | if (cable_is_40wire(ap)) { | 4368 | if (cable_is_40wire(ap)) { |
4389 | ata_dev_printk(dev, KERN_WARNING, | 4369 | ata_dev_warn(dev, |
4390 | "limited to UDMA/33 due to 40-wire cable\n"); | 4370 | "limited to UDMA/33 due to 40-wire cable\n"); |
4391 | xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); | 4371 | xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); |
4392 | } | 4372 | } |
4393 | 4373 | ||
@@ -4954,8 +4934,8 @@ int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active) | |||
4954 | done_mask = ap->qc_active ^ qc_active; | 4934 | done_mask = ap->qc_active ^ qc_active; |
4955 | 4935 | ||
4956 | if (unlikely(done_mask & qc_active)) { | 4936 | if (unlikely(done_mask & qc_active)) { |
4957 | ata_port_printk(ap, KERN_ERR, "illegal qc_active transition " | 4937 | ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n", |
4958 | "(%08x->%08x)\n", ap->qc_active, qc_active); | 4938 | ap->qc_active, qc_active); |
4959 | return -EINVAL; | 4939 | return -EINVAL; |
4960 | } | 4940 | } |
4961 | 4941 | ||
@@ -6022,14 +6002,13 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6022 | ap->udma_mask); | 6002 | ap->udma_mask); |
6023 | 6003 | ||
6024 | if (!ata_port_is_dummy(ap)) { | 6004 | if (!ata_port_is_dummy(ap)) { |
6025 | ata_port_printk(ap, KERN_INFO, | 6005 | ata_port_info(ap, "%cATA max %s %s\n", |
6026 | "%cATA max %s %s\n", | 6006 | (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', |
6027 | (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', | 6007 | ata_mode_string(xfer_mask), |
6028 | ata_mode_string(xfer_mask), | 6008 | ap->link.eh_info.desc); |
6029 | ap->link.eh_info.desc); | ||
6030 | ata_ehi_clear_desc(&ap->link.eh_info); | 6009 | ata_ehi_clear_desc(&ap->link.eh_info); |
6031 | } else | 6010 | } else |
6032 | ata_port_printk(ap, KERN_INFO, "DUMMY\n"); | 6011 | ata_port_info(ap, "DUMMY\n"); |
6033 | } | 6012 | } |
6034 | 6013 | ||
6035 | /* perform each probe asynchronously */ | 6014 | /* perform each probe asynchronously */ |
@@ -6599,6 +6578,76 @@ const struct ata_port_info ata_dummy_port_info = { | |||
6599 | }; | 6578 | }; |
6600 | 6579 | ||
6601 | /* | 6580 | /* |
6581 | * Utility print functions | ||
6582 | */ | ||
6583 | int ata_port_printk(const struct ata_port *ap, const char *level, | ||
6584 | const char *fmt, ...) | ||
6585 | { | ||
6586 | struct va_format vaf; | ||
6587 | va_list args; | ||
6588 | int r; | ||
6589 | |||
6590 | va_start(args, fmt); | ||
6591 | |||
6592 | vaf.fmt = fmt; | ||
6593 | vaf.va = &args; | ||
6594 | |||
6595 | r = printk("%sata%u: %pV", level, ap->print_id, &vaf); | ||
6596 | |||
6597 | va_end(args); | ||
6598 | |||
6599 | return r; | ||
6600 | } | ||
6601 | EXPORT_SYMBOL(ata_port_printk); | ||
6602 | |||
6603 | int ata_link_printk(const struct ata_link *link, const char *level, | ||
6604 | const char *fmt, ...) | ||
6605 | { | ||
6606 | struct va_format vaf; | ||
6607 | va_list args; | ||
6608 | int r; | ||
6609 | |||
6610 | va_start(args, fmt); | ||
6611 | |||
6612 | vaf.fmt = fmt; | ||
6613 | vaf.va = &args; | ||
6614 | |||
6615 | if (sata_pmp_attached(link->ap) || link->ap->slave_link) | ||
6616 | r = printk("%sata%u.%02u: %pV", | ||
6617 | level, link->ap->print_id, link->pmp, &vaf); | ||
6618 | else | ||
6619 | r = printk("%sata%u: %pV", | ||
6620 | level, link->ap->print_id, &vaf); | ||
6621 | |||
6622 | va_end(args); | ||
6623 | |||
6624 | return r; | ||
6625 | } | ||
6626 | EXPORT_SYMBOL(ata_link_printk); | ||
6627 | |||
6628 | int ata_dev_printk(const struct ata_device *dev, const char *level, | ||
6629 | const char *fmt, ...) | ||
6630 | { | ||
6631 | struct va_format vaf; | ||
6632 | va_list args; | ||
6633 | int r; | ||
6634 | |||
6635 | va_start(args, fmt); | ||
6636 | |||
6637 | vaf.fmt = fmt; | ||
6638 | vaf.va = &args; | ||
6639 | |||
6640 | r = printk("%sata%u.%02u: %pV", | ||
6641 | level, dev->link->ap->print_id, dev->link->pmp + dev->devno, | ||
6642 | &vaf); | ||
6643 | |||
6644 | va_end(args); | ||
6645 | |||
6646 | return r; | ||
6647 | } | ||
6648 | EXPORT_SYMBOL(ata_dev_printk); | ||
6649 | |||
6650 | /* | ||
6602 | * libata is essentially a library of internal helper functions for | 6651 | * libata is essentially a library of internal helper functions for |
6603 | * low-level ATA host controller drivers. As such, the API/ABI is | 6652 | * low-level ATA host controller drivers. As such, the API/ABI is |
6604 | * likely to change as new drivers are added and updated. | 6653 | * likely to change as new drivers are added and updated. |