qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: BALATON Zoltan via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: Huacai Chen <chenhuacai@kernel.org>, f4bug@amsat.org
Subject: [PATCH 09/12] vt82c686: Convert debug printf to trace points
Date: Sun, 27 Dec 2020 02:10:06 +0100	[thread overview]
Message-ID: <d404014f90d8ba9d09d4c000ca599dea86992864.1609031406.git.balaton@eik.bme.hu> (raw)
In-Reply-To: <cover.1609031406.git.balaton@eik.bme.hu>

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/isa/trace-events |  6 ++++++
 hw/isa/vt82c686.c   | 51 +++++++++++++--------------------------------
 2 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/hw/isa/trace-events b/hw/isa/trace-events
index 3544c6213c..d267d3e652 100644
--- a/hw/isa/trace-events
+++ b/hw/isa/trace-events
@@ -13,3 +13,9 @@ pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x"
 # apm.c
 apm_io_read(uint8_t addr, uint8_t val) "read addr=0x%x val=0x%02x"
 apm_io_write(uint8_t addr, uint8_t val) "write addr=0x%x val=0x%02x"
+
+# vt82c686.c
+via_isa_write(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x%x"
+via_pm_write(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x%x"
+via_superio_read(uint8_t addr, uint8_t val) "addr 0x%x val 0x%x"
+via_superio_write(uint8_t addr, uint32_t val) "addr 0x%x val 0x%x"
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index b138838400..789459bcae 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -28,14 +28,7 @@
 #include "qemu/timer.h"
 #include "exec/address-spaces.h"
 #include "qom/object.h"
-
-/* #define DEBUG_VT82C686B */
-
-#ifdef DEBUG_VT82C686B
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __func__, ##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#include "trace.h"
 
 typedef struct SuperIOConfig {
     uint8_t config[0x100];
@@ -56,16 +49,17 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
 {
     SuperIOConfig *superio_conf = opaque;
 
-    DPRINTF("superio_ioport_writeb  address 0x%x  val 0x%x\n", addr, data);
-    if (addr == 0x3f0) {
+    if (addr == 0x3f0) { /* config index register */
         superio_conf->index = data & 0xff;
     } else {
         bool can_write = true;
-        /* 0x3f1 */
+        /* 0x3f1, config data register */
+        trace_via_superio_write(superio_conf->index, data & 0xff);
         switch (superio_conf->index) {
         case 0x00 ... 0xdf:
         case 0xe4:
         case 0xe5:
+        case 0xe6 ... 0xe8: /* Should set base port of parallel and serial */
         case 0xe9 ... 0xed:
         case 0xf3:
         case 0xf5:
@@ -74,18 +68,6 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
         case 0xfd ... 0xff:
             can_write = false;
             break;
-        case 0xe7:
-            if ((data & 0xff) != 0xfe) {
-                DPRINTF("change uart 1 base. unsupported yet\n");
-                can_write = false;
-            }
-            break;
-        case 0xe8:
-            if ((data & 0xff) != 0xbe) {
-                DPRINTF("change uart 2 base. unsupported yet\n");
-                can_write = false;
-            }
-            break;
         default:
             break;
 
@@ -99,9 +81,10 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data,
 static uint64_t superio_ioport_readb(void *opaque, hwaddr addr, unsigned size)
 {
     SuperIOConfig *superio_conf = opaque;
+    uint8_t val = superio_conf->config[superio_conf->index];
 
-    DPRINTF("superio_ioport_readb  address 0x%x\n", addr);
-    return superio_conf->config[superio_conf->index];
+    trace_via_superio_read(superio_conf->index, val);
+    return val;
 }
 
 static const MemoryRegionOps superio_ops = {
@@ -142,16 +125,14 @@ static void vt82c686b_isa_reset(DeviceState *dev)
 }
 
 /* write config pci function0 registers. PCI-ISA bridge */
-static void vt82c686b_write_config(PCIDevice *d, uint32_t address,
+static void vt82c686b_write_config(PCIDevice *d, uint32_t addr,
                                    uint32_t val, int len)
 {
     VT82C686BState *vt686 = VT82C686B(d);
 
-    DPRINTF("vt82c686b_write_config  address 0x%x  val 0x%x len 0x%x\n",
-           address, val, len);
-
-    pci_default_write_config(d, address, val, len);
-    if (address == 0x85) {  /* enable or disable super IO configure */
+    trace_via_isa_write(addr, val, len);
+    pci_default_write_config(d, addr, val, len);
+    if (addr == 0x85) {  /* enable or disable super IO configure */
         memory_region_set_enabled(&vt686->superio, val & 0x2);
     }
 }
@@ -204,12 +185,10 @@ static void pm_io_space_update(VT686PMState *s)
     memory_region_transaction_commit();
 }
 
-static void pm_write_config(PCIDevice *d,
-                            uint32_t address, uint32_t val, int len)
+static void pm_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len)
 {
-    DPRINTF("pm_write_config  address 0x%x  val 0x%x len 0x%x\n",
-           address, val, len);
-    pci_default_write_config(d, address, val, len);
+    trace_via_pm_write(addr, val, len);
+    pci_default_write_config(d, addr, val, len);
 }
 
 static int vmstate_acpi_post_load(void *opaque, int version_id)
-- 
2.21.3



  parent reply	other threads:[~2020-12-27  1:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27  1:10 [PATCH 00/12] Misc vt82c686b clean ups BALATON Zoltan via
2020-12-27  1:10 ` [PATCH 12/12] vt82c686: Do not add floppy BALATON Zoltan via
2020-12-27  1:10 ` [PATCH 07/12] vt82c686: Remove vt82c686b_isa_init() function BALATON Zoltan via
2020-12-27 14:36   ` Philippe Mathieu-Daudé
2020-12-27 16:52     ` BALATON Zoltan via
2020-12-27  1:10 ` [PATCH 02/12] vt82c686: Rename AC97/MC97 parts from VT82C686B to VIA BALATON Zoltan via
2020-12-27 15:04   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` [PATCH 08/12] vt82c686: Remove vt82c686b_pm_init() function BALATON Zoltan via
2020-12-27 14:39   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` [PATCH 01/12] vt82c686: Add APM and ACPI dependencies for VT82C686 BALATON Zoltan via
2020-12-28  0:35   ` Huacai Chen
2020-12-28  1:41     ` BALATON Zoltan via
2020-12-28  2:03       ` chen huacai
2020-12-27  1:10 ` [PATCH 06/12] audio/via-ac97: Simplify code and set user_creatable to false BALATON Zoltan via
2020-12-27 14:56   ` Philippe Mathieu-Daudé
2020-12-27 16:47     ` BALATON Zoltan via
2020-12-27  1:10 ` [PATCH 04/12] vt82c686: Remove vt82c686b_[am]c97_init() functions BALATON Zoltan via
2021-01-01 21:07   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` [PATCH 03/12] vt82c686: Remove unnecessary _DEVICE suffix from type macros BALATON Zoltan via
2020-12-27 14:29   ` Philippe Mathieu-Daudé
2020-12-27 14:33   ` Philippe Mathieu-Daudé
2020-12-27 16:49     ` BALATON Zoltan via
2020-12-27  1:10 ` [PATCH 11/12] vt82c686: Rename some functions to better show where they belong BALATON Zoltan via
2020-12-27 14:25   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` [PATCH 10/12] vt82c686: Remove unneeded includes and defines BALATON Zoltan via
2020-12-27 14:51   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` [PATCH 05/12] vt82c686: Split off via-[am]c97 into separate file in hw/audio BALATON Zoltan via
2020-12-27 15:03   ` Philippe Mathieu-Daudé
2020-12-27  1:10 ` BALATON Zoltan via [this message]
2020-12-27 15:08   ` [PATCH 09/12] vt82c686: Convert debug printf to trace points Philippe Mathieu-Daudé
2020-12-27 16:42     ` BALATON Zoltan via

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=d404014f90d8ba9d09d4c000ca599dea86992864.1609031406.git.balaton@eik.bme.hu \
    --to=qemu-devel@nongnu.org \
    --cc=balaton@eik.bme.hu \
    --cc=chenhuacai@kernel.org \
    --cc=f4bug@amsat.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).