From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFRXw-0001an-Lj for qemu-devel@nongnu.org; Fri, 30 Aug 2013 12:27:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFRXo-0004ST-KW for qemu-devel@nongnu.org; Fri, 30 Aug 2013 12:27:40 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50011 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFRXo-0004SL-Ay for qemu-devel@nongnu.org; Fri, 30 Aug 2013 12:27:32 -0400 Message-ID: <5220C7EF.7080509@suse.de> Date: Fri, 30 Aug 2013 18:27:27 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1377768833-11400-1-git-send-email-antonynpavlov@gmail.com> <1377768833-11400-3-git-send-email-antonynpavlov@gmail.com> <521F3B6C.6040207@suse.de> <20130829233623.b05e3fe616e160dff7fa5a50@gmail.com> In-Reply-To: <20130829233623.b05e3fe616e160dff7fa5a50@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 2/5] hw/arm: add very initial support for Canon DIGIC SoC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Antony Pavlov Cc: Alex Dumitrache , Peter Crosthwaite , Giovanni Condello , g3gg0 , Peter Maydell , qemu-devel@nongnu.org, Paul Brook , Paolo Bonzini Am 29.08.2013 21:36, schrieb Antony Pavlov: > On Thu, 29 Aug 2013 14:15:40 +0200 > Andreas F=E4rber wrote: >=20 >> Am 29.08.2013 11:33, schrieb Antony Pavlov: >>> DIGIC is Canon Inc.'s name for a family of SoC >>> for digital cameras and camcorders. >>> >>> There is no publicly available specification for >>> DIGIC chips. All information about DIGIC chip >>> internals is based on reverse engineering efforts >>> made by CHDK (http://chdk.wikia.com) and >>> Magic Lantern (http://www.magiclantern.fm) projects >>> contributors. >>> >>> Also this patch adds initial support for Canon >>> PowerShot A1100 IS compact camera. >>> >>> Signed-off-by: Antony Pavlov >>> --- >>> default-configs/arm-softmmu.mak | 1 + >>> hw/arm/Makefile.objs | 2 +- >>> hw/arm/digic.c | 85 +++++++++++++++++++++++++++++++= ++++++++++ >>> 3 files changed, 87 insertions(+), 1 deletion(-) >>> create mode 100644 hw/arm/digic.c >>> >>> diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-so= ftmmu.mak >>> index ac0815d..0d1d783 100644 >>> --- a/default-configs/arm-softmmu.mak >>> +++ b/default-configs/arm-softmmu.mak >>> @@ -63,6 +63,7 @@ CONFIG_FRAMEBUFFER=3Dy >>> CONFIG_XILINX_SPIPS=3Dy >>> =20 >>> CONFIG_A9SCU=3Dy >>> +CONFIG_DIGIC=3Dy >>> CONFIG_MARVELL_88W8618=3Dy >>> CONFIG_OMAP=3Dy >>> CONFIG_TSC210X=3Dy >>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs >>> index 3671b42..53d5ffd 100644 >>> --- a/hw/arm/Makefile.objs >>> +++ b/hw/arm/Makefile.objs >>> @@ -1,4 +1,4 @@ >>> -obj-y +=3D boot.o collie.o exynos4_boards.o gumstix.o highbank.o >>> +obj-y +=3D boot.o collie.o digic.o exynos4_boards.o gumstix.o highba= nk.o >>> obj-y +=3D integratorcp.o kzm.o mainstone.o musicpal.o nseries.o >>> obj-y +=3D omap_sx1.o palm.o realview.o spitz.o stellaris.o >>> obj-y +=3D tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o >>> diff --git a/hw/arm/digic.c b/hw/arm/digic.c >>> new file mode 100644 >>> index 0000000..3259b38 >>> --- /dev/null >>> +++ b/hw/arm/digic.c >>> @@ -0,0 +1,85 @@ >>> +/* >>> + * QEMU model of the Canon SoC. >>> + * >>> + * Copyright (C) 2013 Antony Pavlov >>> + * >>> + * This model is based on reverse engineering efforts >>> + * made by CHDK (http://chdk.wikia.com) and >>> + * Magic Lantern (http://www.magiclantern.fm) projects >>> + * contributors. >>> + * >>> + * This library is free software; you can redistribute it and/or >>> + * modify it under the terms of the GNU Lesser General Public >>> + * License as published by the Free Software Foundation; either >>> + * version 2 of the License, or (at your option) any later version. >>> + * >>> + * This library is distributed in the hope that it will be useful, >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >>> + * Lesser General Public License for more details. >>> + * >>> + * You should have received a copy of the GNU Lesser General Public >>> + * License along with this library; if not, see . >>> + * >>> + */ >>> + >>> +#include "exec/address-spaces.h" >>> +#include "hw/sysbus.h" >>> +#include "hw/boards.h" >>> + >>> +typedef struct { >> >> structs should not be anonymous, just reuse the typedef name. >> >>> + ARMCPU *cpu; >>> + MemoryRegion ram; >>> +} DigicState; >>> + >>> +typedef struct { >>> + hwaddr ram_size; >>> +} DigicBoard; >>> + >>> +static DigicState *digic4_create(void) >>> +{ >>> + DigicState *s =3D g_new(DigicState, 1); >>> + >>> + s->cpu =3D cpu_arm_init("arm946e-s"); >>> + if (!s->cpu) { >>> + fprintf(stderr, "Unable to find CPU definition\n"); >>> + exit(1); >>> + } >>> + >>> + return s; >>> +} >> >> Please separate the SoC from the boards by placing them in different >> files (and commits). >=20 > I'm agree. >=20 >> DigicState should be a QOM type derived from TYPE_DEVICE. Since you're >> hardcoding the CPU type, please use object_initialize() to create it >> in-place - note we're about to extend that function but rebase will be >> trivial. >=20 > I have just examinied platforms with hardcoded cpu: pxa2xx, exynos4210. > They don't use object_initialize(). > Is there any significant difference between hardcoded cpu type > and variable cpu type with selected default cpu type? >=20 > I try to find a example of object_initialize() usage for cpu initialisa= tion > in repo but I have no success. Can you point me one or explain your des= ign > pattern? My Tegra2 SoC emulation uses the new pattern: http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/tegra But you can just look at existing non-CPU users of object_initialize(). For a non-x86 CPU you don't need qdev_set_parent_bus(), but you do need object_property_set_bool(obj, true, "realized", &err) in your realize function and error_propagate(errp, err) to your caller. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg