From patchwork Sun Aug 7 11:14:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 108815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CD384B6F64 for ; Sun, 7 Aug 2011 21:14:36 +1000 (EST) Received: from localhost ([::1]:46847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq1JQ-0005ta-OZ for incoming@patchwork.ozlabs.org; Sun, 07 Aug 2011 07:14:32 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq1JJ-0005tV-VZ for qemu-devel@nongnu.org; Sun, 07 Aug 2011 07:14:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qq1JI-0006ki-35 for qemu-devel@nongnu.org; Sun, 07 Aug 2011 07:14:25 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:51727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qq1JH-0006kX-Ov for qemu-devel@nongnu.org; Sun, 07 Aug 2011 07:14:24 -0400 Received: by qyk31 with SMTP id 31so1235049qyk.4 for ; Sun, 07 Aug 2011 04:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=Dos/eIZVECBCKeudRocFPzC0LU0QjZ/6xW+WvjRv754=; b=tgoSXz52S60BigmDhJTJpjJAb0qQKzHTf+F37m0ne6QrCEGZc6NqfaaajD7La/3ZYh nKT4bLAW2BdI+QT+EJLKtLIholAyNGYdI0yVp1gncGS6ONy2Ng1Sdohcwt/vgRqWAilX OxkBz+vpEA0ntnI+Wk3VnV9petAYtMksWedcU= Received: by 10.224.31.11 with SMTP id w11mr2899993qac.132.1312715663139; Sun, 07 Aug 2011 04:14:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.37.82 with HTTP; Sun, 7 Aug 2011 04:14:03 -0700 (PDT) From: Blue Swirl Date: Sun, 7 Aug 2011 11:14:03 +0000 Message-ID: To: qemu-devel , Robert Reif X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.173 Subject: [Qemu-devel] [PATCH] escc: replace DPRINTFs with tracepoints X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Blue Swirl --- hw/escc.c | 60 +++++++++++++-------------------------------------------- trace-events | 15 ++++++++++++++ 2 files changed, 29 insertions(+), 46 deletions(-) +disable escc_mem_readb_data(char channel, uint32_t ret) "Read channel %c, ch %d" +disable escc_serial_receive_byte(char channel, int ch) "channel %c put ch %d" +disable escc_sunkbd_event_in(int ch) "Untranslated keycode %2.2x" +disable escc_sunkbd_event_out(int ch) "Translated keycode %2.2x" +disable escc_kbd_command(int val) "Command %d" +disable escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x" From ca9536983dce986139ff898c6c308c0d730b3d88 Mon Sep 17 00:00:00 2001 Message-Id: From: Blue Swirl Date: Sun, 7 Aug 2011 11:01:05 +0000 Subject: [PATCH] escc: replace DPRINTFs with tracepoints Signed-off-by: Blue Swirl --- hw/escc.c | 60 +++++++++++++-------------------------------------------- trace-events | 15 ++++++++++++++ 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/hw/escc.c b/hw/escc.c index f6fd919..9e72d5e 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -27,15 +27,7 @@ #include "escc.h" #include "qemu-char.h" #include "console.h" - -/* debug serial */ -//#define DEBUG_SERIAL - -/* debug keyboard */ -//#define DEBUG_KBD - -/* debug mouse */ -//#define DEBUG_MOUSE +#include "trace.h" /* * Chipset docs: @@ -69,25 +61,6 @@ * 2010-May-23 Artyom Tarasenko: Reworked IUS logic */ -#ifdef DEBUG_SERIAL -#define SER_DPRINTF(fmt, ...) \ - do { printf("SER: " fmt , ## __VA_ARGS__); } while (0) -#else -#define SER_DPRINTF(fmt, ...) -#endif -#ifdef DEBUG_KBD -#define KBD_DPRINTF(fmt, ...) \ - do { printf("KBD: " fmt , ## __VA_ARGS__); } while (0) -#else -#define KBD_DPRINTF(fmt, ...) -#endif -#ifdef DEBUG_MOUSE -#define MS_DPRINTF(fmt, ...) \ - do { printf("MSC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define MS_DPRINTF(fmt, ...) -#endif - typedef enum { chn_a, chn_b, } ChnID; @@ -249,7 +222,7 @@ static void put_queue(void *opaque, int b) ChannelState *s = opaque; SERIOQueue *q = &s->queue; - SER_DPRINTF("channel %c put: 0x%02x\n", CHN_C(s), b); + trace_escc_put_queue(CHN_C(s), b); if (q->count >= SERIO_QUEUE_SIZE) return; q->data[q->wptr] = b; @@ -273,7 +246,7 @@ static uint32_t get_queue(void *opaque) q->rptr = 0; q->count--; } - SER_DPRINTF("channel %c get 0x%02x\n", CHN_C(s), val); + trace_escc_get_queue(CHN_C(s), val); if (q->count > 0) serial_receive_byte(s, 0); return val; @@ -300,7 +273,7 @@ static void escc_update_irq(ChannelState *s) irq = escc_update_irq_chn(s); irq |= escc_update_irq_chn(s->otherchn); - SER_DPRINTF("IRQ = %d\n", irq); + trace_escc_update_irq(irq); qemu_set_irq(s->irq, irq); } @@ -485,8 +458,7 @@ static void escc_update_parameters(ChannelState *s) ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; - SER_DPRINTF("channel %c: speed=%d parity=%c data=%d stop=%d\n", CHN_C(s), - speed, parity, data_bits, stop_bits); + trace_escc_update_parameters(CHN_C(s), speed, parity, data_bits, stop_bits); qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); } @@ -503,8 +475,7 @@ static void escc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) s = &serial->chn[channel]; switch (saddr) { case SERIAL_CTRL: - SER_DPRINTF("Write channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, - val & 0xff); + trace_escc_mem_writeb_ctrl(CHN_C(s), s->reg, val & 0xff); newreg = 0; switch (s->reg) { case W_CMD: @@ -574,7 +545,7 @@ static void escc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) s->reg = 0; break; case SERIAL_DATA: - SER_DPRINTF("Write channel %c, ch %d\n", CHN_C(s), val); + trace_escc_mem_writeb_data(CHN_C(s), val); s->tx = val; if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled if (s->chr) @@ -605,8 +576,7 @@ static uint32_t escc_mem_readb(void *opaque, target_phys_addr_t addr) s = &serial->chn[channel]; switch (saddr) { case SERIAL_CTRL: - SER_DPRINTF("Read channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, - s->rregs[s->reg]); + trace_escc_mem_readb_ctrl(CHN_C(s), s->reg, s->rregs[s->reg]); ret = s->rregs[s->reg]; s->reg = 0; return ret; @@ -617,7 +587,7 @@ static uint32_t escc_mem_readb(void *opaque, target_phys_addr_t addr) ret = get_queue(s); else ret = s->rx; - SER_DPRINTF("Read channel %c, ch %d\n", CHN_C(s), ret); + trace_escc_mem_readb_data(CHN_C(s), ret); if (s->chr) qemu_chr_accept_input(s->chr); return ret; @@ -643,7 +613,7 @@ static int serial_can_receive(void *opaque) static void serial_receive_byte(ChannelState *s, int ch) { - SER_DPRINTF("channel %c put ch %d\n", CHN_C(s), ch); + trace_escc_serial_receive_byte(CHN_C(s), ch); s->rregs[R_STATUS] |= STATUS_RXAV; s->rx = ch; set_rxint(s); @@ -767,8 +737,7 @@ static void sunkbd_event(void *opaque, int ch) ChannelState *s = opaque; int release = ch & 0x80; - KBD_DPRINTF("Untranslated keycode %2.2x (%s)\n", ch, release? "release" : - "press"); + trace_escc_sunkbd_event_in(ch); switch (ch) { case 58: // Caps lock press s->caps_lock_mode ^= 1; @@ -802,13 +771,13 @@ static void sunkbd_event(void *opaque, int ch) } else { ch = keycodes[ch & 0x7f]; } - KBD_DPRINTF("Translated keycode %2.2x\n", ch); + trace_escc_sunkbd_event_out(ch); put_queue(s, ch | release); } static void handle_kbd_command(ChannelState *s, int val) { - KBD_DPRINTF("Command %d\n", val); + trace_escc_kbd_command(val); if (s->led_mode) { // Ignore led byte s->led_mode = 0; return; @@ -840,8 +809,7 @@ static void sunmouse_event(void *opaque, ChannelState *s = opaque; int ch; - MS_DPRINTF("dx=%d dy=%d buttons=%01x\n", dx, dy, buttons_state); - + trace_escc_sunmouse_event(dx, dy, buttons_state); ch = 0x80 | 0x7; /* protocol start byte, no buttons pressed */ if (buttons_state & MOUSE_EVENT_LBUTTON) diff --git a/trace-events b/trace-events index 19d31e3..0bb2cf8 100644 --- a/trace-events +++ b/trace-events @@ -441,3 +441,18 @@ disable qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p" disable qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p" disable qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p" disable qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p" + +# hw/escc.c +disable escc_put_queue(char channel, int b) "channel %c put: 0x%02x" +disable escc_get_queue(char channel, int val) "channel %c get 0x%02x" +disable escc_update_irq(int irq) "IRQ = %d" +disable escc_update_parameters(char channel, int speed, int parity, int data_bits, int stop_bits) "channel %c: speed=%d parity=%c data=%d stop=%d" +disable escc_mem_writeb_ctrl(char channel, uint32_t reg, uint32_t val) "Write channel %c, reg[%d] = %2.2x" +disable escc_mem_writeb_data(char channel, uint32_t val) "Write channel %c, ch %d" +disable escc_mem_readb_ctrl(char channel, uint32_t reg, uint8_t val) "Read channel %c, reg[%d] = %2.2x" +disable escc_mem_readb_data(char channel, uint32_t ret) "Read channel %c, ch %d" +disable escc_serial_receive_byte(char channel, int ch) "channel %c put ch %d" +disable escc_sunkbd_event_in(int ch) "Untranslated keycode %2.2x" +disable escc_sunkbd_event_out(int ch) "Translated keycode %2.2x" +disable escc_kbd_command(int val) "Command %d" +disable escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x" -- 1.7.2.5