From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KXYgy-0002bC-45 for qemu-devel@nongnu.org; Mon, 25 Aug 2008 05:48:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KXYgx-0002at-NJ for qemu-devel@nongnu.org; Mon, 25 Aug 2008 05:48:55 -0400 Received: from [199.232.76.173] (port=37506 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXYgx-0002ao-8l for qemu-devel@nongnu.org; Mon, 25 Aug 2008 05:48:55 -0400 Received: from il.qumranet.com ([212.179.150.194]:15325) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KXYgw-0002pV-Tg for qemu-devel@nongnu.org; Mon, 25 Aug 2008 05:48:55 -0400 Received: from gleb-debian.qumranet.com (gleb-debian.qumranet.com.qumranet.com [172.16.15.143]) by il.qumranet.com (Postfix) with ESMTP id 22ACC250310 for ; Mon, 25 Aug 2008 12:48:54 +0300 (IDT) Date: Mon, 25 Aug 2008 12:48:54 +0300 From: Gleb Natapov Subject: Re: [Qemu-devel] [PATCH 1/6] Use IO port for qemu<->guest BIOS communication. Message-ID: <20080825094854.GK6192@minantech.com> References: <20080824113258.5652.92531.stgit@gleb-debian.qumranet.com.qumranet.com> <20080824113304.5652.22656.stgit@gleb-debian.qumranet.com.qumranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Sun, Aug 24, 2008 at 08:39:44PM +0300, Blue Swirl wrote: > On 8/24/08, Gleb Natapov wrote: > > Use PIO to get configuration info between qemu process and guest BIOS. > > Could you make this a separate device, so that it could be used in > other machines? There is nothing PC-specific. The code is less then 50 lines. Is it worth to move it to a separate file (two of them .c and .h) before there is a real need? > > > +static uint32_t bios_cfg_read(void *opaque, uint32_t addr) > > +{ > > + BIOSCfgEntry *e = &bios_params.entries[bios_params.entry]; > > You should use the opaque parameter and cast that to BIOSCfgState. > > > + if (!e->data) > > + return 0; > > + > > + return e->data[bios_params.cur_offset++ % e->len]; > > Instead of using modular arithmetic, zero should be returned for invalid values. > > > +static void bios_cfg_write(void *opaque, uint32_t addr, uint32_t value) > > +{ > > + bios_params.entry = value % BIOS_CFG_MAX_ENTRY; > > Same here, its important for downward compatibility. > > > + bios_cfg_add_data(BIOS_CFG_SIGNATURE, "QEMU", 4); > > I'd add: > + bios_cfg_add_data(BIOS_CFG_ID, 1, 4); > Done. -- Gleb.