From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHqG9-0002a3-9i for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:15:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHqG3-0004Cv-Lh for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:15:13 -0400 Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:48378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHqG3-0004C6-8W for qemu-devel@nongnu.org; Fri, 06 Sep 2013 03:15:07 -0400 Received: by mail-lb0-f169.google.com with SMTP id z5so2580405lbh.28 for ; Fri, 06 Sep 2013 00:15:06 -0700 (PDT) Date: Fri, 6 Sep 2013 11:12:41 +0400 From: Antony Pavlov Message-Id: <20130906111241.aaf80bc73ac794ffb1c52b83@gmail.com> In-Reply-To: References: <1378367579-1099-1-git-send-email-antonynpavlov@gmail.com> <1378367579-1099-3-git-send-email-antonynpavlov@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v4 2/5] hw/arm/digic: prepare DIGIC-based boards support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers On Thu, 5 Sep 2013 18:54:30 +0100 Peter Maydell wrote: > On 5 September 2013 08:52, Antony Pavlov wrote: > > Also this patch adds initial support for Canon > > PowerShot A1100 IS compact camera. > > > > Signed-off-by: Antony Pavlov > > --- > > hw/arm/Makefile.objs | 2 +- > > hw/arm/digic_boards.c | 63 +++++++++++++++++++++++++++++++++++++++++++= ++++++++ > > 2 files changed, 64 insertions(+), 1 deletion(-) > > create mode 100644 hw/arm/digic_boards.c > > > > diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs > > index e140485..f6e9533 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_boards.o exynos4_boards.o gumstix.o h= ighbank.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_boards.c b/hw/arm/digic_boards.c > > new file mode 100644 > > index 0000000..0b99227 > > --- /dev/null > > +++ b/hw/arm/digic_boards.c > > @@ -0,0 +1,63 @@ >=20 > Copyright and license summary comment at the top of the > file, please. >=20 > > +#include "hw/boards.h" > > +#include "exec/address-spaces.h" > > +#include "hw/arm/digic.h" > > + > > +typedef struct DigicBoardState { > > + DigicState *digic; > > + MemoryRegion ram; > > +} DigicBoardState; > > + > > +typedef struct DigicBoard { > > + hwaddr ram_size; > > + hwaddr start_addr; > > +} DigicBoard; > > + > > +static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size) > > +{ > > + memory_region_init_ram(&s->ram, NULL, "ram", ram_size); > > + memory_region_add_subregion(get_system_memory(), 0, &s->ram); > > + vmstate_register_ram_global(&s->ram); > > +} > > + > > +static void digic4_board_init(DigicBoard *board) > > +{ > > + Error *err =3D NULL; > > + > > + DigicBoardState *s =3D g_new(DigicBoardState, 1); > > + > > + s->digic =3D DIGIC(object_new(TYPE_DIGIC)); > > + object_property_set_bool(OBJECT(s->digic), true, "realized", &err); > > + if (err !=3D NULL) { > > + fprintf(stderr, "Couldn't realize DIGIC SoC: %s\n", > > + error_get_pretty(err)); > > + exit(1); > > + } > > + > > + digic4_board_setup_ram(s, board->ram_size); > > + > > + s->digic->cpu.env.regs[15] =3D board->start_addr; >=20 > This is odd. What happens on real hardware? Is > the firmware actually at zero? There is no public documentation on Digic chips. Only Canon's engineers know something about real Digic's bootprocess. Nowadays Canon produce two families of photocameras: * relatevely cheap Point-and-Shot cameras (PowerShot series); * more expensive cameras with exchangeable lens (EOS series). The DIGIC chips has two regions for NOR ROM mapping. The PowerShot cameras (as rule) have simple firmware and use only one ROM = region. The EOS cameras have more complex firmware and use both ROM regions. So the board->start_addr parameter is used just for selection of ROM region. > > +} > > + > > +static DigicBoard digic4_board_canon_a1100 =3D { > > + .ram_size =3D 64 * 1024 * 1024, > > + /* CHDK recommends this address for ROM disassembly */ > > + .start_addr =3D 0xffc00000, > > +}; > > + > > +static void canon_a1100_init(QEMUMachineInitArgs *args) > > +{ > > + digic4_board_init(&digic4_board_canon_a1100); > > +} > > + > > +static QEMUMachine canon_a1100 =3D { > > + .name =3D "canon-a1100", > > + .desc =3D "Canon PowerShot A1100 IS", > > + .init =3D &canon_a1100_init, > > +}; > > + > > +static void digic_register_machines(void) > > +{ > > + qemu_register_machine(&canon_a1100); > > +} > > + > > +machine_init(digic_register_machines) > > -- > > 1.8.4.rc3 --=20 --=A0 Best regards, =A0 Antony Pavlov