Index: uspace/drv/block/ata_bd/ata_bd.c
===================================================================
--- uspace/drv/block/ata_bd/ata_bd.c	(revision 257feec9d30b7aa8ced34c0ef045309a9cc98d3c)
+++ uspace/drv/block/ata_bd/ata_bd.c	(revision 9f391e917010f96de63dc01c3a587d808ded8a0d)
@@ -48,6 +48,6 @@
  */
 
-#include <stdio.h>
 #include <ddi.h>
+#include <ddf/log.h>
 #include <async.h>
 #include <as.h>
@@ -61,4 +61,5 @@
 #include <errno.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <byteorder.h>
 #include <task.h>
@@ -150,5 +151,5 @@
 	unsigned ctl_num;
 
-	printf(NAME ": ata_ctrl_init()\n");
+	ddf_msg(LVL_DEBUG, "ata_ctrl_init()");
 
 	ctl_num = 1;
@@ -158,5 +159,5 @@
 	ctrl->ctl_physical = legacy_base[ctl_num - 1].ctl;
 
-	printf("I/O address %p/%p\n", (void *) ctrl->cmd_physical,
+	ddf_msg(LVL_NOTE, "I/O address %p/%p", (void *) ctrl->cmd_physical,
 	    (void *) ctrl->ctl_physical);
 
@@ -166,6 +167,5 @@
 
 	for (i = 0; i < MAX_DISKS; i++) {
-		printf("Identify drive %d... ", i);
-		fflush(stdout);
+		ddf_msg(LVL_NOTE, "Identify drive %d...", i);
 
 		rc = disk_init(ctrl, &ctrl->disk[i], i);
@@ -174,5 +174,5 @@
 			disk_print_summary(&ctrl->disk[i]);
 		} else {
-			printf("Not found.\n");
+			ddf_msg(LVL_NOTE, "Not found.");
 		}
 	}
@@ -187,6 +187,6 @@
 		rc = ata_fun_create(&ctrl->disk[i]);
 		if (rc != EOK) {
-			printf(NAME ": Unable to create function for disk %d.\n",
-			    i);
+			ddf_msg(LVL_ERROR, "Unable to create function for "
+			    "disk %d.", i);
 			goto error;
 		}
@@ -195,5 +195,5 @@
 
 	if (n_disks == 0) {
-		printf("No disks detected.\n");
+		ddf_msg(LVL_WARN, "No disks detected.");
 		rc = EIO;
 		goto error;
@@ -204,6 +204,6 @@
 	for (i = 0; i < MAX_DISKS; i++) {
 		if (ata_fun_remove(&ctrl->disk[i]) != EOK) {
-			printf(NAME ": Unable to clean up function for disk %d.\n",
-			    i);
+			ddf_msg(LVL_ERROR, "Unable to clean up function for "
+			    "disk %d.", i);
 		}
 	}
@@ -217,5 +217,5 @@
 	int i, rc;
 
-	printf(NAME ": ata_ctrl_remove()\n");
+	ddf_msg(LVL_DEBUG, ": ata_ctrl_remove()");
 
 	fibril_mutex_lock(&ctrl->lock);
@@ -224,6 +224,6 @@
 		rc = ata_fun_remove(&ctrl->disk[i]);
 		if (rc != EOK) {
-			printf(NAME ": Unable to clean up function for disk %d.\n",
-			    i);
+			ddf_msg(LVL_ERROR, "Unable to clean up function for "
+			    "disk %d.", i);
 			return rc;
 		}
@@ -241,5 +241,5 @@
 	int i, rc;
 
-	printf(NAME ": ata_ctrl_gone()\n");
+	ddf_msg(LVL_DEBUG, "ata_ctrl_gone()");
 
 	fibril_mutex_lock(&ctrl->lock);
@@ -248,6 +248,6 @@
 		rc = ata_fun_unbind(&ctrl->disk[i]);
 		if (rc != EOK) {
-			printf(NAME ": Unable to clean up function for disk %d.\n",
-			    i);
+			ddf_msg(LVL_ERROR, "Unable to clean up function for "
+			    "disk %d.", i);
 			return rc;
 		}
@@ -264,32 +264,47 @@
 {
 	uint64_t mbytes;
-
-	printf("%s: ", d->model);
+	char *atype = NULL;
+	char *cap = NULL;
+	int rc;
 
 	if (d->dev_type == ata_reg_dev) {
 		switch (d->amode) {
 		case am_chs:
-			printf("CHS %u cylinders, %u heads, %u sectors",
-			    d->geom.cylinders, d->geom.heads,
+			rc = asprintf(&atype, "CHS %u cylinders, %u heads, "
+			    "%u sectors", d->geom.cylinders, d->geom.heads,
 			    d->geom.sectors);
+			if (rc < 0) {
+				/* Out of memory */
+				atype = NULL;
+			}
 			break;
 		case am_lba28:
-			printf("LBA-28");
+			atype = str_dup("LBA-28");
 			break;
 		case am_lba48:
-			printf("LBA-48");
+			atype = str_dup("LBA-48");
 			break;
 		}
 	} else {
-		printf("PACKET");
-	}
-
-	printf(" %" PRIu64 " blocks", d->blocks);
+		atype = str_dup("PACKET");
+	}
+
+	if (atype == NULL)
+		return;
 
 	mbytes = d->blocks / (2 * 1024);
-	if (mbytes > 0)
-		printf(" %" PRIu64 " MB.", mbytes);
-
-	printf("\n");
+	if (mbytes > 0) {
+		rc = asprintf(&cap, " %" PRIu64 " MB.", mbytes);
+		if (rc < 0) {
+			cap = NULL;
+			goto cleanup;
+		}
+	}
+
+	ddf_msg(LVL_NOTE, "%s: %s %" PRIu64 " blocks%s", d->model, atype,
+	    d->blocks, cap);
+cleanup:
+	free(atype);
+	free(cap);
 }
 
@@ -302,5 +317,5 @@
 	rc = pio_enable((void *) ctrl->cmd_physical, sizeof(ata_cmd_t), &vaddr);
 	if (rc != EOK) {
-		printf("%s: Could not initialize device I/O space.\n", NAME);
+		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
 		return rc;
 	}
@@ -310,5 +325,5 @@
 	rc = pio_enable((void *) ctrl->ctl_physical, sizeof(ata_ctl_t), &vaddr);
 	if (rc != EOK) {
-		printf("%s: Could not initialize device I/O space.\n", NAME);
+		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
 		return rc;
 	}
@@ -352,5 +367,5 @@
 	if (rc == EOK) {
 		/* Success. It's a register (non-packet) device. */
-		printf("ATA register-only device found.\n");
+		ddf_msg(LVL_NOTE, "ATA register-only device found.");
 		d->dev_type = ata_reg_dev;
 	} else if (rc == EIO) {
@@ -455,5 +470,5 @@
 		rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data));
 		if (rc != EOK) {
-			printf("Device inquiry failed.\n");
+			ddf_msg(LVL_ERROR, "Device inquiry failed.");
 			d->present = false;
 			return EIO;
@@ -462,5 +477,5 @@
 		/* Check device type. */
 		if (INQUIRY_PDEV_TYPE(inq_data.pdev_type) != PDEV_TYPE_CDROM)
-			printf("Warning: Peripheral device type is not CD-ROM.\n");
+			ddf_msg(LVL_WARN, "Peripheral device type is not CD-ROM.");
 
 		/* Assume 2k block size for now. */
