qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 2/5] hw/arm/digic: prepare DIGIC-based boards s


From: Antony Pavlov
Subject: Re: [Qemu-devel] [RFC v4 2/5] hw/arm/digic: prepare DIGIC-based boards support
Date: Fri, 6 Sep 2013 11:12:41 +0400

On Thu, 5 Sep 2013 18:54:30 +0100
Peter Maydell <address@hidden> wrote:

> On 5 September 2013 08:52, Antony Pavlov <address@hidden> wrote:
> > Also this patch adds initial support for Canon
> > PowerShot A1100 IS compact camera.
> >
> > Signed-off-by: Antony Pavlov <address@hidden>
> > ---
> >  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 += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
> > +obj-y += boot.o collie.o digic_boards.o exynos4_boards.o gumstix.o 
> > highbank.o
> >  obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
> >  obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
> >  obj-y += 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 @@
> 
> Copyright and license summary comment at the top of the
> file, please.
> 
> > +#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 = NULL;
> > +
> > +    DigicBoardState *s = g_new(DigicBoardState, 1);
> > +
> > +    s->digic = DIGIC(object_new(TYPE_DIGIC));
> > +    object_property_set_bool(OBJECT(s->digic), true, "realized", &err);
> > +    if (err != 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] = board->start_addr;
> 
> 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 = {
> > +    .ram_size = 64 * 1024 * 1024,
> > +    /* CHDK recommends this address for ROM disassembly */
> > +    .start_addr = 0xffc00000,
> > +};
> > +
> > +static void canon_a1100_init(QEMUMachineInitArgs *args)
> > +{
> > +    digic4_board_init(&digic4_board_canon_a1100);
> > +}
> > +
> > +static QEMUMachine canon_a1100 = {
> > +    .name = "canon-a1100",
> > +    .desc = "Canon PowerShot A1100 IS",
> > +    .init = &canon_a1100_init,
> > +};
> > +
> > +static void digic_register_machines(void)
> > +{
> > +    qemu_register_machine(&canon_a1100);
> > +}
> > +
> > +machine_init(digic_register_machines)
> > --
> > 1.8.4.rc3


-- 
-- 
Best regards,
  Antony Pavlov



reply via email to

[Prev in Thread] Current Thread [Next in Thread]