qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g.


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g. Bochs port 0xe9)
Date: Mon, 23 Nov 2009 11:52:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4

On 11/20/09 22:33, H. Peter Anvin wrote:

+static const uint16_t isa_debugcon_iobase[MAX_DEBUGCON_PORTS] = { 0xe9 };

Not needed here.

+    if (isa->index == -1)
+        isa->index = index;
+    if (isa->index>= MAX_DEBUGCON_PORTS)
+        return -1;
+    if (isa->iobase == -1)
+       isa->iobase = isa_debugcon_iobase[isa->index];
+    index++;

Also not needed.

+    debugcon_init_core(s);
+    register_ioport_write(isa->iobase, 1, 1, debugcon_ioport_write, s);
+    return 0;
+}
+
+DebugconState *debugcon_isa_init(int index, CharDriverState *chr)
+{
+    ISADevice *dev;
+
+    dev = isa_create("isa-debugcon");
+    qdev_prop_set_chr(&dev->qdev, "chardev", chr);
+    if (qdev_init(&dev->qdev)<  0)
+        return NULL;
+    return&DO_UPCAST(ISADebugconState, dev, dev)->state;
+}

Can be dropped too.

+static ISADeviceInfo debugcon_isa_info = {
+    .qdev.name  = "isa-debugcon",
+    .qdev.size  = sizeof(ISADebugconState),
+    .init       = debugcon_isa_initfn,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_HEX32("index",  ISADebugconState, index,   -1),

Drop index property.

+        DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase,  -1),

Last arg is the default value, simply place 0xe9 there.

+        DEFINE_PROP_CHR("chardev",  ISADebugconState, state.chr),
+        DEFINE_PROP_END_OF_LIST(),
+    },
+};
+
+static void debugcon_register_devices(void)
+{
+    isa_qdev_register(&debugcon_isa_info);
+}

diff --git a/hw/pc.c b/hw/pc.c
diff --git a/hw/pc.h b/hw/pc.h
diff --git a/qemu-common.h b/qemu-common.h
diff --git a/qemu-options.hx b/qemu-options.hx
diff --git a/sysemu.h b/sysemu.h
diff --git a/vl.c b/vl.c

All not needed. Simply registering as qdev device is enougth. You can then add a debug port like this, without adding new cmd line options:

  -chardev vc,id=debug -device isa-debugcon,chardev=debug

Adding a second one on a non-default port works this way:

  -chardev vc,id=d2 -device isa-debugcon,iobase=0xea,chardev=d2

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]