From patchwork Thu Nov 2 17:38:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 740455 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp962028wrv; Thu, 2 Nov 2023 10:41:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXBDznI4noqX2+l63+JqRhXM0A4wHGP2Q0Bg/iuFpawH4sL1+3inAX+L5Mr6cp5L3lqadm X-Received: by 2002:a05:690c:5:b0:59c:aea:d877 with SMTP id bc5-20020a05690c000500b0059c0aead877mr523235ywb.40.1698946869081; Thu, 02 Nov 2023 10:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698946869; cv=none; d=google.com; s=arc-20160816; b=mUjcCQPOmqwd01RJFEguSKJD5APOIe2MYDYMFv3hbv3Fb77qLm+gLwINBEr671fi9V ewwdvzHcEhgnYQiLsTmpl9qALkWGzl47p3e7qkGczedpwQl7+fvFVQKT1n1Swk2W+DRa KyBpuJDrP9kPqXOO/WLIp3kdeu9tCszVR+UITshlOlZn7bq+waeMYJdRqhZainbOSAqb UZFwMzYHK+CFJ4QaunWJGNbYsf+92jhzXU/B4P7gEbhUCyqPKXgS1DNNqiXKFuKk938A AxBt28mP02lFxoTV2E+91cnodg/uryZ4l+A3EIQwUdEAaANl4JtdO6SMupZRHJrMn+vB 8QPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZHDPNX802foR/50mB3oyBv/8R5SQ4cLQ2e+YpuDWZPZ6LsWzQXMuAsC/u5Th4Q0ejV HfqNhGRv2mkjujCk8hkD9G7adt01GKBPg1rzgy5gSH2OXzJZTVEGBJmGen8M6+gutSkc fA7nzalTzgg4ogVNO+oGTiihzTn7Y1OVrRmIw00u3FyH6/ZwO7Vviwqj6xpvsoqyK4jV IhQlPN6Lve7u4wWpXeg5R4F7emIXVBAJTFoHbBMz2dVlgCPWS8YL6/weP5F96Z2c8tSv eQhe5obcKBNsMqA72uF1dq/gdRv6hI0NMcSH1JPJlpHW+mg2OagskZE84kTHhTOnUtDG tivw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPM6Wyqx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dj20-20020a056214091400b0065b1c33dfcfsi270992qvb.352.2023.11.02.10.41.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 10:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPM6Wyqx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qybfo-000474-4N; Thu, 02 Nov 2023 13:40:07 -0400 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 1qybeh-0003H6-LE for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:59 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qybec-0002mB-LB for qemu-devel@nongnu.org; Thu, 02 Nov 2023 13:38:55 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32f737deedfso699164f8f.3 for ; Thu, 02 Nov 2023 10:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698946729; x=1699551529; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; b=aPM6WyqxyAB3A2/cX1OZIXu8YhIrzjUqluc/331q+8mp+3aQBUFRi0PqeYrXySMEMJ 6/uCrp3WFy/4aueQq1PLSFOfk3GtBC1Go1pQHffjeDz5o8oCIbYjhvaG7eRbja3QB108 26ZlTSkf6a/OaxhgWjVsypsWhTHP+ag7MVG4FPxvtfCBOccFaJWTLfgGhqfcivaaI3P8 c4GoF2GPNzmr+uckS9Rpyy2cbnDUb2rt9umWucNtuNqFcuNyXbA9FVShWfcjN/M6XJ+H +1Cij6bTcuETK05yCQcDm1gVHKNemgvzXxcqA4looWdNhYjF6TIsWxIgs4My9MhPchwj I2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698946729; x=1699551529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+OgurXglUm5DGvPAaUaiEGoa0h4kT2MTfg7/wu2rdFc=; b=A3epxJ8gMSc0qeslYGj0FveFUWVGDOgM/JyquDZVbnqDj9v13PQ1AnPhKbsrHvCwPQ 3slYMB3uf7Z9fOHV14I/KOCMx8ylscD3Wav/0h+/age0AakBXZsL0+KetT3YOCT1E8lw BEt1ym9Z/YgM4QHxdaOROKbmm44F2APkYhMhit1ADLKWB0IbvfNMSQaGQHuDMks99GVr y18u18IoidQUhyzkFiAMGh/BxGESfLJmaEtFydTExgNe0VQi1WPfSKqFWEmIi7g7dA0J 7/zivF8NsyxuWQpSjBqS9UpDWrlSXwspKneRWCo0vM4sIBoUNYWhz0ExiSgd7YgFSDnq eYaQ== X-Gm-Message-State: AOJu0Yw5WzAbCHGBGca/0davQsTk/+UsBBCYE4nskZ9iU7qSEVesm0G2 ajsQ+yh7WtqLV9ofv118LOTi0AcS/DR5Ig51S2Y= X-Received: by 2002:a05:6000:154a:b0:32f:7bd7:9f1d with SMTP id 10-20020a056000154a00b0032f7bd79f1dmr13127798wry.48.1698946728947; Thu, 02 Nov 2023 10:38:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020adff350000000b003258934a4bcsm3046805wrp.42.2023.11.02.10.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 10:38:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/33] hw/i2c/pm_smbus: Convert DPRINTF to trace events Date: Thu, 2 Nov 2023 17:38:24 +0000 Message-Id: <20231102173835.609985-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102173835.609985-1-peter.maydell@linaro.org> References: <20231102173835.609985-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bernhard Beschow Let the trace messages slightly deviate from the function names ("smb" -> "smbus") being traced in order to avoid conflights with the SMB protocol. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Acked-by: Corey Minyard Message-id: 20231028122415.14869-6-shentey@gmail.com Signed-off-by: Peter Maydell --- hw/i2c/pm_smbus.c | 18 ++++-------------- hw/i2c/trace-events | 6 ++++++ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index 4e1b8a5182d..78e7c229a85 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -23,6 +23,7 @@ #include "hw/i2c/pm_smbus.h" #include "hw/i2c/smbus_master.h" #include "migration/vmstate.h" +#include "trace.h" #define SMBHSTSTS 0x00 #define SMBHSTCNT 0x02 @@ -64,15 +65,6 @@ #define AUX_BLK (1 << 1) #define AUX_MASK 0x3 -/*#define DEBUG*/ - -#ifdef DEBUG -# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__) -#else -# define SMBUS_DPRINTF(format, ...) do { } while (0) -#endif - - static void smb_transaction(PMSMBus *s) { uint8_t prot = (s->smb_ctl >> 2) & 0x07; @@ -82,7 +74,7 @@ static void smb_transaction(PMSMBus *s) I2CBus *bus = s->smbus; int ret; - SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot); + trace_smbus_transaction(addr, prot); /* Transaction isn't exec if STS_DEV_ERR bit set */ if ((s->smb_stat & STS_DEV_ERR) != 0) { goto error; @@ -258,8 +250,7 @@ static void smb_ioport_writeb(void *opaque, hwaddr addr, uint64_t val, PMSMBus *s = opaque; uint8_t clear_byte_done; - SMBUS_DPRINTF("SMB writeb port=0x%04" HWADDR_PRIx - " val=0x%02" PRIx64 "\n", addr, val); + trace_smbus_ioport_writeb(addr, val); switch(addr) { case SMBHSTSTS: clear_byte_done = s->smb_stat & val & STS_BYTE_DONE; @@ -429,8 +420,7 @@ static uint64_t smb_ioport_readb(void *opaque, hwaddr addr, unsigned width) val = 0; break; } - SMBUS_DPRINTF("SMB readb port=0x%04" HWADDR_PRIx " val=0x%02x\n", - addr, val); + trace_smbus_ioport_readb(addr, val); if (s->set_irq) { s->set_irq(s, smb_irq_value(s)); diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events index d7b1e25858b..6900e06edad 100644 --- a/hw/i2c/trace-events +++ b/hw/i2c/trace-events @@ -15,6 +15,12 @@ i2c_send_async(uint8_t address, uint8_t data) "send_async(addr:0x%02x) data:0x%0 i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x" i2c_ack(void) "" +# pm_smbus.c + +smbus_ioport_readb(uint16_t addr, uint8_t data) "[0x%04" PRIx16 "] -> val=0x%02x" +smbus_ioport_writeb(uint16_t addr, uint8_t data) "[0x%04" PRIx16 "] <- val=0x%02x" +smbus_transaction(uint8_t addr, uint8_t prot) "addr=0x%02x prot=0x%02x" + # allwinner_i2c.c allwinner_i2c_read(const char* reg_name, uint64_t offset, uint64_t value) "read %s [0x%" PRIx64 "]: -> 0x%" PRIx64