From patchwork Wed Jan 11 08:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1724534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=nn7K67Cq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NsM3b569nz23fY for ; Wed, 11 Jan 2023 19:56:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFWot-0003SC-QM; Wed, 11 Jan 2023 03:50:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFWop-0003Lw-7z for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:49 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFWom-0007jT-LH for qemu-devel@nongnu.org; Wed, 11 Jan 2023 03:50:46 -0500 Received: by mail-wr1-x433.google.com with SMTP id h16so14288141wrz.12 for ; Wed, 11 Jan 2023 00:50:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uj4vMJ6IjNLjq+M6XLE4uewGsLuqMTdFQ7srLl6Qez8=; b=nn7K67CqhIZdqQiZ0FRG+l8zJK2tXJlgfvl+gnULYM5YIJhcEFfmSXLfvO+O2kZPHg 5M8QgibkrAU8jtvEWWWn9cdrAQX+n41+4To2eGIdEtzAgSabo+Hm05POkgMtE/BVlLFu c4PUTL53OvDx1MrZfnQHuOli/kl0pVa/4/yvkOKy+myzVeeOJf08vzkuGy0K/7FwDxm2 5yoUuWxBRSROlBK7mx+MxYLreTOaXf2jQTPMNRED15hJwfsbKZaMuVLKH+hJ/beQZQba ihZT0E7Oj03U4VUxwrUSFoo5wiNwkn93PzsQy4RnT5NlrWM6GLYO65nrb9I6a7JObfYs 4TFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uj4vMJ6IjNLjq+M6XLE4uewGsLuqMTdFQ7srLl6Qez8=; b=RrAHc316aNaDWDEmgiDw9rYqtXgtw6Y5EWJgL0R0GwNV3gtO/QelB3DHr3NlIH8S3z JPgAIqvKzKR9o8U86bI2FrkrVaiDiDahc3IT+3oJsA1u/UEUAbJSWZb/0CMDtdLhdYnd PydT2tl3XO8OaaH8RayrduSRJsclzCncLGTDiCZYQVP6txa/INUyLFf0xYiy2Hon7Y7M FIOHX2v7Y19x2+ij7hSYwPlwL8FTzs3evAuMKs7JrLbdshmhMmE4FQVybDbBZApaYc3j 0GENa0Fqk49UhJwlhxTeiwpUdKmXDr4ehAkV+gC9gWYzEJbdrdhMDdt5j8LSbDZG+mcS HRmA== X-Gm-Message-State: AFqh2kqGrC3BWEy+BOkFzRzG9VQqkaolf5jQvzQ9hgDoLs3ecGA4rzkv avs6o3PzwpWs4s0z9unimwTxOHA9L0QFPIii X-Google-Smtp-Source: AMrXdXsG6xIibaOF4aE0Q7XWZ2QaJtef4d3EXkZ6HAhT9Pxbi0UXa1vO2TJt89ud0Zr/OOsqpaH1ZA== X-Received: by 2002:a5d:630d:0:b0:2ac:5b46:9c85 with SMTP id i13-20020a5d630d000000b002ac5b469c85mr15283173wru.68.1673427042808; Wed, 11 Jan 2023 00:50:42 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l13-20020adfe58d000000b00296730b5c3esm13272686wrm.102.2023.01.11.00.50.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 00:50:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Thomas Huth , Jan Kiszka , qemu-trivial@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 5/5] hw/i2c/bitbang_i2c: Convert DPRINTF() to trace events Date: Wed, 11 Jan 2023 09:50:16 +0100 Message-Id: <20230111085016.44551-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111085016.44551-1-philmd@linaro.org> References: <20230111085016.44551-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 Convert the remaining DPRINTF debug macro uses to tracepoints. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/i2c/bitbang_i2c.c | 18 ++++++------------ hw/i2c/trace-events | 4 ++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index efc49b7502..bb18954765 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -18,14 +18,6 @@ #include "qom/object.h" #include "trace.h" -//#define DEBUG_BITBANG_I2C - -#ifdef DEBUG_BITBANG_I2C -#define DPRINTF(fmt, ...) \ -do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) do {} while(0) -#endif /* bitbang_i2c_state enum to name */ static const char * const sname[] = { @@ -71,8 +63,10 @@ static void bitbang_i2c_enter_stop(bitbang_i2c_interface *i2c) /* Set device data pin. */ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level) { + trace_bitbang_i2c_data(i2c->last_clock, i2c->last_data, + i2c->device_out, level); i2c->device_out = level; - //DPRINTF("%d %d %d\n", i2c->last_clock, i2c->last_data, i2c->device_out); + return level & i2c->last_data; } @@ -137,11 +131,11 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) if (i2c->current_addr < 0) { i2c->current_addr = i2c->buffer; - DPRINTF("Address 0x%02x\n", i2c->current_addr); + trace_bitbang_i2c_addr(i2c->current_addr); ret = i2c_start_transfer(i2c->bus, i2c->current_addr >> 1, i2c->current_addr & 1); } else { - DPRINTF("Sent 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_send(i2c->buffer); ret = i2c_send(i2c->bus, i2c->buffer); } if (ret) { @@ -161,7 +155,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level) } case RECEIVING_BIT7: i2c->buffer = i2c_recv(i2c->bus); - DPRINTF("RX byte 0x%02x\n", i2c->buffer); + trace_bitbang_i2c_recv(i2c->buffer); /* Fall through... */ case RECEIVING_BIT6 ... RECEIVING_BIT0: data = i2c->buffer >> 7; diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index 2a479c1c12..b0ab237b0f 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -2,6 +2,10 @@ # bitbang_i2c.c bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s" +bitbang_i2c_addr(uint8_t addr) "Address 0x%02x" +bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x" +bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x" +bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u" # core.c