From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KXJZ4-0003j6-0H for qemu-devel@nongnu.org; Sun, 24 Aug 2008 13:39:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KXJZ3-0003iu-J0 for qemu-devel@nongnu.org; Sun, 24 Aug 2008 13:39:45 -0400 Received: from [199.232.76.173] (port=33613 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXJZ3-0003ir-Cz for qemu-devel@nongnu.org; Sun, 24 Aug 2008 13:39:45 -0400 Received: from wf-out-1314.google.com ([209.85.200.170]:52411) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KXJZ3-000635-0H for qemu-devel@nongnu.org; Sun, 24 Aug 2008 13:39:45 -0400 Received: by wf-out-1314.google.com with SMTP id 27so1544676wfd.4 for ; Sun, 24 Aug 2008 10:39:44 -0700 (PDT) Message-ID: Date: Sun, 24 Aug 2008 20:39:44 +0300 From: "Blue Swirl" Subject: Re: [Qemu-devel] [PATCH 1/6] Use IO port for qemu<->guest BIOS communication. In-Reply-To: <20080824113304.5652.22656.stgit@gleb-debian.qumranet.com.qumranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080824113258.5652.92531.stgit@gleb-debian.qumranet.com.qumranet.com> <20080824113304.5652.22656.stgit@gleb-debian.qumranet.com.qumranet.com> 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 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. > +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);