qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g.	Bochs port 0xe9)
Date: Mon, 23 Nov 2009 11:52:35 +0100	[thread overview]
Message-ID: <4B0A6973.4010303@redhat.com> (raw)
In-Reply-To: <1258752795-15434-1-git-send-email-hpa@linux.intel.com>

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

  parent reply	other threads:[~2009-11-23 10:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 21:33 [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g. Bochs port 0xe9) H. Peter Anvin
2009-11-22 17:16 ` [Qemu-devel] Re: [PATCH] debugcon: support for debugging consoles (e.g.Bochs " Sebastian Herbszt
2009-11-23  3:13   ` H. Peter Anvin
2009-11-23 10:52 ` Gerd Hoffmann [this message]
2009-11-23 20:11   ` [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g. Bochs " H. Peter Anvin
2009-11-24 23:05     ` H. Peter Anvin
2009-11-25  7:33       ` Alexander Graf
2009-11-25 12:46       ` Gerd Hoffmann
2009-11-25 18:01         ` H. Peter Anvin
2009-11-25 22:21           ` Gerd Hoffmann
2009-11-25 22:26             ` H. Peter Anvin
2009-11-25 22:31               ` H. Peter Anvin
2009-11-25 22:54                 ` Gerd Hoffmann
2009-11-26  9:56                   ` Markus Armbruster
2009-11-26 13:18                   ` [Qemu-devel] " Paolo Bonzini
2009-11-25 22:53 ` [Qemu-devel] " H. Peter Anvin
2009-11-26  7:43   ` [Qemu-devel] " Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2009-12-03  3:11 [Qemu-devel] " H. Peter Anvin
2009-12-03  4:02 ` malc
2009-12-03  5:04 H. Peter Anvin
     [not found] <1262123496-12007-1-git-send-email-hpa@linux.intel.com>
     [not found] ` <20091230164946.GA9858@morn.localdomain>
2010-01-02  3:01   ` H. Peter Anvin
2010-01-02  3:02   ` H. Peter Anvin
2010-01-02 17:53     ` Kevin O'Connor
2010-01-02 18:56       ` H. Peter Anvin
2010-01-03  2:13         ` François Revol
2010-01-08 16:36 ` Anthony Liguori

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=4B0A6973.4010303@redhat.com \
    --to=kraxel@redhat.com \
    --cc=hpa@linux.intel.com \
    --cc=qemu-devel@nongnu.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).