From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M2Qy5-0003mv-AB for qemu-devel@nongnu.org; Fri, 08 May 2009 10:22:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M2Qxz-0003lP-Lh for qemu-devel@nongnu.org; Fri, 08 May 2009 10:22:27 -0400 Received: from [199.232.76.173] (port=36792 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2Qxz-0003lM-GT for qemu-devel@nongnu.org; Fri, 08 May 2009 10:22:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:39722) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M2Qxw-0000W7-CS for qemu-devel@nongnu.org; Fri, 08 May 2009 10:22:23 -0400 Date: Fri, 8 May 2009 17:21:00 +0300 From: "Michael S. Tsirkin" Message-ID: <20090508142100.GB3073@redhat.com> References: <20090508034301.GF25512%yamahata@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090508034301.GF25512%yamahata@valinux.co.jp> Subject: [Qemu-devel] Re: pci_default_config_write() clean up List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: blauwirbel@gmail.com, mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On Fri, May 08, 2009 at 12:43:01PM +0900, Isaku Yamahata wrote: > > Here is the ver2 pci_default_config_write() clean up > following to comments. > > I didn't use per-dword callback. Although special cycles > specifies dword address, qemu emulation is not bus level, > but instruction level. > > Maybe callback function signature might be arguable. > But at this moment there is no real user, so I'd like > to postpone its argument until real user appears. > > thanks, > > >From 491830066972faf3f87ba170273c97b7f90a1ea3 Mon Sep 17 00:00:00 2001 > From: Isaku Yamahata > Date: Thu, 7 May 2009 16:14:04 +0900 > Subject: [PATCH] pci: pci_default_config_write() clean up. > > clean up of pci_default_config_write() by table driven code. > > Changes v2 > - converted static table into dynamic initialization. > - changed callback signature. > > Cc: Michael S. Tsirkin > Signed-off-by: Isaku Yamahata > @@ -236,11 +239,122 @@ int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp) > return pci_parse_devaddr(devaddr, domp, busp, slotp); > } > > +static void pci_conf_init(struct PCIConfigReg *config_regs, > + uint32_t addr, pci_config_written_t callback, > + uint32_t wmask, int len) > +{ > + int i; > + > + for (i = 0; i < len; i++) { > + config_regs[addr].wmask = wmask & 0xff; > + config_regs[addr].shift = 8 * i; > + config_regs[addr].callback = callback; > + > + wmask >>= 8; > + } > +} Could you please post an incremental patch, that adds callbacks, on top of mine adding masks? -- MST