From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCWXI-0003tJ-7E for qemu-devel@nongnu.org; Mon, 23 Nov 2009 05:52:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCWXD-0003qN-Gw for qemu-devel@nongnu.org; Mon, 23 Nov 2009 05:52:47 -0500 Received: from [199.232.76.173] (port=53207 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCWXD-0003qG-BO for qemu-devel@nongnu.org; Mon, 23 Nov 2009 05:52:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53503) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCWXC-000676-PI for qemu-devel@nongnu.org; Mon, 23 Nov 2009 05:52:43 -0500 Message-ID: <4B0A6973.4010303@redhat.com> Date: Mon, 23 Nov 2009 11:52:35 +0100 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] debugcon: support for debugging consoles (e.g. Bochs port 0xe9) References: <1258752795-15434-1-git-send-email-hpa@linux.intel.com> In-Reply-To: <1258752795-15434-1-git-send-email-hpa@linux.intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "H. Peter Anvin" Cc: qemu-devel@nongnu.org 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