qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Blue Swirl" <blauwirbel@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Kevin Wolf" <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH v3 08/10] esp: use trace framework instead of stderr output
Date: Mon,  9 Jul 2012 12:02:29 +0200	[thread overview]
Message-ID: <1341828152-15199-9-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1341828152-15199-1-git-send-email-hpoussin@reactos.org>


Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/esp.c     |   13 ++++++-------
 trace-events |    3 +++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/esp.c b/hw/esp.c
index 796cdc1..ec40d93 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -26,6 +26,7 @@
 #include "scsi.h"
 #include "esp.h"
 #include "trace.h"
+#include "qemu-log.h"
 
 /*
  * On Sparc32, this is the ESP (NCR53C90) part of chip STP2000 (Master I/O),
@@ -35,9 +36,6 @@
  * http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR53C9X.txt
  */
 
-#define ESP_ERROR(fmt, ...)                                             \
-    do { printf("ESP ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0)
-
 #define ESP_REGS 16
 #define TI_BUFSZ 16
 
@@ -503,7 +501,8 @@ static uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
             s->ti_size--;
             if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {
                 /* Data out.  */
-                ESP_ERROR("PIO data read not implemented\n");
+                qemu_log_mask(LOG_UNIMP,
+                              "esp: PIO data read not implemented\n");
                 s->rregs[ESP_FIFO] = 0;
             } else {
                 s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++];
@@ -543,7 +542,7 @@ static void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
         if (s->do_cmd) {
             s->cmdbuf[s->cmdlen++] = val & 0xff;
         } else if (s->ti_size == TI_BUFSZ - 1) {
-            ESP_ERROR("fifo overrun\n");
+            trace_esp_error_fifo_overrun();
         } else {
             s->ti_size++;
             s->ti_buf[s->ti_wptr++] = val & 0xff;
@@ -631,7 +630,7 @@ static void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
             esp_raise_irq(s);
             break;
         default:
-            ESP_ERROR("Unhandled ESP command (%2.2x)\n", (unsigned)val);
+            trace_esp_error_unhandled_command(val);
             break;
         }
         break;
@@ -646,7 +645,7 @@ static void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
         s->rregs[saddr] = val;
         break;
     default:
-        ESP_ERROR("invalid write of 0x%02x at [0x%x]\n", (unsigned)val, saddr);
+        trace_esp_error_invalid_write(val, saddr);
         return;
     }
     s->wregs[saddr] = val;
diff --git a/trace-events b/trace-events
index 0488e34..a16179d 100644
--- a/trace-events
+++ b/trace-events
@@ -645,6 +645,9 @@ iscsi_aio_read16_cb(void *iscsi, int status, void *acb, int canceled) "iscsi %p
 iscsi_aio_readv(void *iscsi, int64_t sector_num, int nb_sectors, void *opaque, void *acb) "iscsi %p sector_num %"PRId64" nb_sectors %d opaque %p acb %p"
 
 # hw/esp.c
+esp_error_fifo_overrun(void) "FIFO overrun"
+esp_error_unhandled_command(uint32_t val) "unhandled command (%2.2x)"
+esp_error_invalid_write(uint32_t val, uint32_t addr) "invalid write of 0x%02x at [0x%x]"
 esp_raise_irq(void) "Raise IRQ"
 esp_lower_irq(void) "Lower IRQ"
 esp_dma_enable(void) "Raise enable"
-- 
1.7.10.4

  parent reply	other threads:[~2012-07-09 10:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 10:02 [Qemu-devel] [PATCH v3 00/10] esp: add AMD PCscsi emulation Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 01/10] esp: execute select commands immediately when it is a non-dma command Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 02/10] esp: delay Transfer Information command if dma is not enabled Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 03/10] esp: implement Disable selection command Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 04/10] esp: implement Reset ATN command Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 05/10] esp: support future change of chip_id Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 06/10] esp: use hba_private field instead of a complex cast Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 07/10] esp: split esp code into generic chip emulation and sysbus layer Hervé Poussineau
2012-07-09 10:02 ` Hervé Poussineau [this message]
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 09/10] pci: add some stubs Hervé Poussineau
2012-07-09 10:02 ` [Qemu-devel] [PATCH v3 10/10] esp: add AMD PCscsi emulation (PCI SCSI adapter) Hervé Poussineau
2012-07-14 12:18 ` [Qemu-devel] [PATCH v3 00/10] esp: add AMD PCscsi emulation Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341828152-15199-9-git-send-email-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=blauwirbel@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).