diff options
author | Borislav Petkov <bbpetkov@yahoo.de> | 2006-06-23 02:29:08 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-23 02:29:08 -0400 |
commit | 0dd4b21f517e138ea113db255645fbae1bf5eef3 (patch) | |
tree | c5f9894fb7f9536e1a2149e64c44ca94d3ec063c | |
parent | 99ba9e093d058f6dff54f475136018e2e281d50f (diff) |
[libata] conversion to new debug scheme, part 1 of $N
The first 25% of libata-core.c converted to the new debugging scheme.
Signed-off-by: <petkov@math.uni-muenster.de>
(with addition of ATA_MSG_WARN to standard msg_enable by me)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/scsi/libata-core.c | 73 |
1 files changed, 47 insertions, 26 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 24d340aeb518..6c66877be2bf 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -418,7 +418,7 @@ static const char *sata_spd_string(unsigned int spd) | |||
418 | 418 | ||
419 | void ata_dev_disable(struct ata_device *dev) | 419 | void ata_dev_disable(struct ata_device *dev) |
420 | { | 420 | { |
421 | if (ata_dev_enabled(dev)) { | 421 | if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) { |
422 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | 422 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); |
423 | dev->class++; | 423 | dev->class++; |
424 | } | 424 | } |
@@ -777,8 +777,11 @@ void ata_std_dev_select (struct ata_port *ap, unsigned int device) | |||
777 | void ata_dev_select(struct ata_port *ap, unsigned int device, | 777 | void ata_dev_select(struct ata_port *ap, unsigned int device, |
778 | unsigned int wait, unsigned int can_sleep) | 778 | unsigned int wait, unsigned int can_sleep) |
779 | { | 779 | { |
780 | VPRINTK("ENTER, ata%u: device %u, wait %u\n", | 780 | if (ata_msg_probe(ap)) { |
781 | ap->id, device, wait); | 781 | ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, ata%u: " |
782 | "device %u, wait %u\n", | ||
783 | ap->id, device, wait); | ||
784 | } | ||
782 | 785 | ||
783 | if (wait) | 786 | if (wait) |
784 | ata_wait_idle(ap); | 787 | ata_wait_idle(ap); |
@@ -946,7 +949,8 @@ void ata_port_flush_task(struct ata_port *ap) | |||
946 | * Cancel and flush. | 949 | * Cancel and flush. |
947 | */ | 950 | */ |
948 | if (!cancel_delayed_work(&ap->port_task)) { | 951 | if (!cancel_delayed_work(&ap->port_task)) { |
949 | DPRINTK("flush #2\n"); | 952 | if (ata_msg_ctl(ap)) |
953 | ata_port_printk(ap, KERN_DEBUG, "%s: flush #2\n", __FUNCTION__); | ||
950 | flush_workqueue(ata_wq); | 954 | flush_workqueue(ata_wq); |
951 | } | 955 | } |
952 | 956 | ||
@@ -954,7 +958,8 @@ void ata_port_flush_task(struct ata_port *ap) | |||
954 | ap->flags &= ~ATA_FLAG_FLUSH_PORT_TASK; | 958 | ap->flags &= ~ATA_FLAG_FLUSH_PORT_TASK; |
955 | spin_unlock_irqrestore(ap->lock, flags); | 959 | spin_unlock_irqrestore(ap->lock, flags); |
956 | 960 | ||
957 | DPRINTK("EXIT\n"); | 961 | if (ata_msg_ctl(ap)) |
962 | ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __FUNCTION__); | ||
958 | } | 963 | } |
959 | 964 | ||
960 | void ata_qc_complete_internal(struct ata_queued_cmd *qc) | 965 | void ata_qc_complete_internal(struct ata_queued_cmd *qc) |
@@ -1074,7 +1079,8 @@ unsigned ata_exec_internal(struct ata_device *dev, | |||
1074 | else | 1079 | else |
1075 | ata_qc_complete(qc); | 1080 | ata_qc_complete(qc); |
1076 | 1081 | ||
1077 | ata_dev_printk(dev, KERN_WARNING, | 1082 | if (ata_msg_warn(ap)) |
1083 | ata_dev_printk(dev, KERN_WARNING, | ||
1078 | "qc timeout (cmd 0x%x)\n", command); | 1084 | "qc timeout (cmd 0x%x)\n", command); |
1079 | } | 1085 | } |
1080 | 1086 | ||
@@ -1086,7 +1092,9 @@ unsigned ata_exec_internal(struct ata_device *dev, | |||
1086 | ap->ops->post_internal_cmd(qc); | 1092 | ap->ops->post_internal_cmd(qc); |
1087 | 1093 | ||
1088 | if (qc->flags & ATA_QCFLAG_FAILED && !qc->err_mask) { | 1094 | if (qc->flags & ATA_QCFLAG_FAILED && !qc->err_mask) { |
1089 | ata_dev_printk(dev, KERN_WARNING, "zero err_mask for failed " | 1095 | if (ata_msg_warn(ap)) |
1096 | ata_dev_printk(dev, KERN_WARNING, | ||
1097 | "zero err_mask for failed " | ||
1090 | "internal command, assuming AC_ERR_OTHER\n"); | 1098 | "internal command, assuming AC_ERR_OTHER\n"); |
1091 | qc->err_mask |= AC_ERR_OTHER; | 1099 | qc->err_mask |= AC_ERR_OTHER; |
1092 | } | 1100 | } |
@@ -1184,7 +1192,9 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1184 | const char *reason; | 1192 | const char *reason; |
1185 | int rc; | 1193 | int rc; |
1186 | 1194 | ||
1187 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, dev->devno); | 1195 | if (ata_msg_ctl(ap)) |
1196 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER, host %u, dev %u\n", | ||
1197 | __FUNCTION__, ap->id, dev->devno); | ||
1188 | 1198 | ||
1189 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 1199 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ |
1190 | 1200 | ||
@@ -1253,7 +1263,8 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1253 | return 0; | 1263 | return 0; |
1254 | 1264 | ||
1255 | err_out: | 1265 | err_out: |
1256 | ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY " | 1266 | if (ata_msg_warn(ap)) |
1267 | ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY " | ||
1257 | "(%s, err_mask=0x%x)\n", reason, err_mask); | 1268 | "(%s, err_mask=0x%x)\n", reason, err_mask); |
1258 | return rc; | 1269 | return rc; |
1259 | } | 1270 | } |
@@ -1306,18 +1317,21 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1306 | unsigned int xfer_mask; | 1317 | unsigned int xfer_mask; |
1307 | int i, rc; | 1318 | int i, rc; |
1308 | 1319 | ||
1309 | if (!ata_dev_enabled(dev)) { | 1320 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { |
1310 | DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", | 1321 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT (host %u, dev %u) -- nodev\n", |
1311 | ap->id, dev->devno); | 1322 | __FUNCTION__, ap->id, dev->devno); |
1312 | return 0; | 1323 | return 0; |
1313 | } | 1324 | } |
1314 | 1325 | ||
1315 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, dev->devno); | 1326 | if (ata_msg_probe(ap)) |
1327 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER, host %u, dev %u\n", | ||
1328 | __FUNCTION__, ap->id, dev->devno); | ||
1316 | 1329 | ||
1317 | /* print device capabilities */ | 1330 | /* print device capabilities */ |
1318 | if (print_info) | 1331 | if (ata_msg_probe(ap)) |
1319 | ata_dev_printk(dev, KERN_DEBUG, "cfg 49:%04x 82:%04x 83:%04x " | 1332 | ata_dev_printk(dev, KERN_DEBUG, "%s: cfg 49:%04x 82:%04x 83:%04x " |
1320 | "84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", | 1333 | "84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", |
1334 | __FUNCTION__, | ||
1321 | id[49], id[82], id[83], id[84], | 1335 | id[49], id[82], id[83], id[84], |
1322 | id[85], id[86], id[87], id[88]); | 1336 | id[85], id[86], id[87], id[88]); |
1323 | 1337 | ||
@@ -1337,7 +1351,8 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1337 | /* find max transfer mode; for printk only */ | 1351 | /* find max transfer mode; for printk only */ |
1338 | xfer_mask = ata_id_xfermask(id); | 1352 | xfer_mask = ata_id_xfermask(id); |
1339 | 1353 | ||
1340 | ata_dump_id(id); | 1354 | if (ata_msg_probe(ap)) |
1355 | ata_dump_id(id); | ||
1341 | 1356 | ||
1342 | /* ATA-specific feature tests */ | 1357 | /* ATA-specific feature tests */ |
1343 | if (dev->class == ATA_DEV_ATA) { | 1358 | if (dev->class == ATA_DEV_ATA) { |
@@ -1358,7 +1373,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1358 | ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc)); | 1373 | ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc)); |
1359 | 1374 | ||
1360 | /* print device info to dmesg */ | 1375 | /* print device info to dmesg */ |
1361 | if (print_info) | 1376 | if (ata_msg_info(ap)) |
1362 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " | 1377 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " |
1363 | "max %s, %Lu sectors: %s %s\n", | 1378 | "max %s, %Lu sectors: %s %s\n", |
1364 | ata_id_major_version(id), | 1379 | ata_id_major_version(id), |
@@ -1381,7 +1396,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1381 | } | 1396 | } |
1382 | 1397 | ||
1383 | /* print device info to dmesg */ | 1398 | /* print device info to dmesg */ |
1384 | if (print_info) | 1399 | if (ata_msg_info(ap)) |
1385 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " | 1400 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " |
1386 | "max %s, %Lu sectors: CHS %u/%u/%u\n", | 1401 | "max %s, %Lu sectors: CHS %u/%u/%u\n", |
1387 | ata_id_major_version(id), | 1402 | ata_id_major_version(id), |
@@ -1392,7 +1407,8 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1392 | 1407 | ||
1393 | if (dev->id[59] & 0x100) { | 1408 | if (dev->id[59] & 0x100) { |
1394 | dev->multi_count = dev->id[59] & 0xff; | 1409 | dev->multi_count = dev->id[59] & 0xff; |
1395 | DPRINTK("ata%u: dev %u multi count %u\n", | 1410 | if (ata_msg_info(ap)) |
1411 | ata_dev_printk(dev, KERN_INFO, "ata%u: dev %u multi count %u\n", | ||
1396 | ap->id, dev->devno, dev->multi_count); | 1412 | ap->id, dev->devno, dev->multi_count); |
1397 | } | 1413 | } |
1398 | 1414 | ||
@@ -1405,8 +1421,9 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1405 | 1421 | ||
1406 | rc = atapi_cdb_len(id); | 1422 | rc = atapi_cdb_len(id); |
1407 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { | 1423 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { |
1408 | ata_dev_printk(dev, KERN_WARNING, | 1424 | if (ata_msg_warn(ap)) |
1409 | "unsupported CDB len\n"); | 1425 | ata_dev_printk(dev, KERN_WARNING, |
1426 | "unsupported CDB len\n"); | ||
1410 | rc = -EINVAL; | 1427 | rc = -EINVAL; |
1411 | goto err_out_nosup; | 1428 | goto err_out_nosup; |
1412 | } | 1429 | } |
@@ -1418,7 +1435,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1418 | } | 1435 | } |
1419 | 1436 | ||
1420 | /* print device info to dmesg */ | 1437 | /* print device info to dmesg */ |
1421 | if (print_info) | 1438 | if (ata_msg_info(ap)) |
1422 | ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n", | 1439 | ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n", |
1423 | ata_mode_string(xfer_mask), | 1440 | ata_mode_string(xfer_mask), |
1424 | cdb_intr_string); | 1441 | cdb_intr_string); |
@@ -1432,7 +1449,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1432 | 1449 | ||
1433 | /* limit bridge transfers to udma5, 200 sectors */ | 1450 | /* limit bridge transfers to udma5, 200 sectors */ |
1434 | if (ata_dev_knobble(dev)) { | 1451 | if (ata_dev_knobble(dev)) { |
1435 | if (print_info) | 1452 | if (ata_msg_info(ap)) |
1436 | ata_dev_printk(dev, KERN_INFO, | 1453 | ata_dev_printk(dev, KERN_INFO, |
1437 | "applying bridge limits\n"); | 1454 | "applying bridge limits\n"); |
1438 | dev->udma_mask &= ATA_UDMA5; | 1455 | dev->udma_mask &= ATA_UDMA5; |
@@ -1442,11 +1459,15 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1442 | if (ap->ops->dev_config) | 1459 | if (ap->ops->dev_config) |
1443 | ap->ops->dev_config(ap, dev); | 1460 | ap->ops->dev_config(ap, dev); |
1444 | 1461 | ||
1445 | DPRINTK("EXIT, drv_stat = 0x%x\n", ata_chk_status(ap)); | 1462 | if (ata_msg_probe(ap)) |
1463 | ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n", | ||
1464 | __FUNCTION__, ata_chk_status(ap)); | ||
1446 | return 0; | 1465 | return 0; |
1447 | 1466 | ||
1448 | err_out_nosup: | 1467 | err_out_nosup: |
1449 | DPRINTK("EXIT, err\n"); | 1468 | if (ata_msg_probe(ap)) |
1469 | ata_dev_printk(dev, KERN_DEBUG, | ||
1470 | "%s: EXIT, err\n", __FUNCTION__); | ||
1450 | return rc; | 1471 | return rc; |
1451 | } | 1472 | } |
1452 | 1473 | ||
@@ -5192,7 +5213,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
5192 | #elif defined(ATA_DEBUG) | 5213 | #elif defined(ATA_DEBUG) |
5193 | ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; | 5214 | ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; |
5194 | #else | 5215 | #else |
5195 | ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR; | 5216 | ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; |
5196 | #endif | 5217 | #endif |
5197 | 5218 | ||
5198 | INIT_WORK(&ap->port_task, NULL, NULL); | 5219 | INIT_WORK(&ap->port_task, NULL, NULL); |