From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEkH0-00060R-5v for qemu-devel@nongnu.org; Thu, 11 Jun 2009 09:24:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEkGu-0005uB-Q3 for qemu-devel@nongnu.org; Thu, 11 Jun 2009 09:24:53 -0400 Received: from [199.232.76.173] (port=59574 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEkGu-0005u7-NE for qemu-devel@nongnu.org; Thu, 11 Jun 2009 09:24:48 -0400 Received: from mx2.redhat.com ([66.187.237.31]:49530) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEkGu-00057O-9K for qemu-devel@nongnu.org; Thu, 11 Jun 2009 09:24:48 -0400 Message-ID: <4A310523.1090203@redhat.com> Date: Thu, 11 Jun 2009 15:22:43 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/4] Add device tree machine References: <20090610173803.4674.82538.stgit@wren.home> <20090610173821.4674.58171.stgit@wren.home> In-Reply-To: <20090610173821.4674.58171.stgit@wren.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org > +++ b/hw/arm-cpu.c > +/* FIXME: Remove this and make the CPU emulation use the right names. */ > +static const struct { > + const char *devname; > + const char *cpuname; > +} cpu_device_name_map[] = { > + {"ARM,ARM926EJ-S", "arm926"}, > + {"ARM,Cortex-A8", "cortex-a8"} > +}; > +static void arm_cpu_register_devices(void) > +{ > + int i; > + CPUInfo *info; > + > + for (i = 0; i< ARRAY_SIZE(cpu_device_name_map); i++) { > + info = qemu_mallocz(sizeof(*info)); > + info->sysbus.qdev.props = cpu_qdev_props; > + info->sysbus.init = arm_cpu_dev_init; > + info->cpuname = cpu_device_name_map[i].cpuname; > + sysbus_register_withprop(cpu_device_name_map[i].devname, > + sizeof(CPUDevice), > +&info->sysbus); > + } I would drop cpu_device_name_map[] and have static CPUInfo structs instead. > +++ b/hw/dt-machine.c > +void dt_fixup_sysbus_device(DeviceState *dev) > +{ That doesn't belong here, it should go to sysbus.c. With the businfo patch (http://git.et.redhat.com/?p=qemu-kraxel.git;a=commitdiff;h=c02134e1d986892df7e8cc1cd27cf340fcafec63) posted yesterday it is easy, just add a fixup_device() callback to the BusInfo struct. I'd name it configure() instead of fixup() though. > + qdev_fixup_devices(); qdev_configure_devices() ? > +DeviceState *qdev_from_phandle(uint32_t phandle) > +{ > + if (!main_system_bus) { > + return NULL; > + } > + return qdev_from_phandle1(main_system_bus, phandle); > +} What this is good for? Seems to be unused in the existing board descriptions ... cheers, Gerd