qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: Peter Chubb <peterc@gelato.unsw.edu.au>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Peter Chubb <peter.chubb@nicta.com.au>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] imx.31 and KZM board support
Date: Mon, 21 Nov 2011 23:45:08 +0100	[thread overview]
Message-ID: <4ECAD474.4050209@web.de> (raw)
In-Reply-To: <w4lir9m931.wl%peter@chubb.wattle.id.au>

Hi Peter,

Am 21.11.2011 22:58, schrieb Peter Chubb:
> Hi Peter,
>    Please find appended a patch containing initial support for the
>    FreeScale i.MX31 and the KZM Arm11 evaluation board.

Your patch format is a bit unusual.

Please don't include personal messages in the description, keep it in a
format we can apply unchanged with git-am.

git-am complains:

/home/andreas/QEMU/qemu-arm/.git/rebase-apply/patch:43: new blank line
at EOF.
+
warning: 1 line adds whitespace errors.

>    The implementation was originally written by Hans Jang and Adam
>    Clench of OK-Labs; I've updated it to the current qdev and memory
>    region paradigms and implemented enough extra that Linux will boot
>    on the patched QEMU using a ram disk.
> 
>    The i.MX 31 Serial controller is found in most of the i.MX SoCs;
>    the AVIC and timer implementations can also be shared, albeit with
>    fewer chips.
> 
> Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
> Signed-off-by: Hans Jang <hsjang@ok-labs.com>
> Signed-off-by: Adam Clench <adamc@ok-labs.com>

If as you describe above, you polished up patches originally by OK-Labs
then your SoB should be placed last.

> Index: qemu-working/hw/imx_avic.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ qemu-working/hw/imx_avic.c	2011-11-22 08:51:09.733239638 +1100
> @@ -0,0 +1,294 @@
> +/*
> + * IMX31 Vectored Interrupt Controller
> + *
> + * Note this is NOT the PL192 provided by ARM, but
> + * a custom implementation by FreeScale.
> + *
> + * Copyright (c) 2008 OKL
> + * Written by Hans
> + *
> + * This code is licenced under the GPL.

If you can, it would be nice to clarify the "GPL" license:

    ... the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

> + *
> + * TODO: implement vectors and priorities.
> + */
> +
> +#include "hw.h"
> +#include "sysbus.h"
> +#include <string.h> /* ffsll */
> +
> +#define DEBUG_INT 1
> +#undef DEBUG_INT /* comment out for debugging */

Usually we just do //#define DEBUG_...

> +
> +#ifdef DEBUG_INT
> +#define DPRINTF(fmt, args...) \
> +do { printf("imx_int: " fmt , ##args); } while (0)
> +#else
> +#define DPRINTF(fmt, args...) do {} while (0)
> +#endif

> Index: qemu-working/hw/imx_serial.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ qemu-working/hw/imx_serial.c	2011-11-22 08:49:36.084276219 +1100
> @@ -0,0 +1,260 @@
> +/*
> + * IMX31 UARTS
> + *
> + * Copyright (c) 2008 OKL
> + * Written by Hans
> + *
> + * This code is licenced under the GPL.

Dito.

> + * This is a `bare-bones' implementation of the IMX series serial ports.
> + * TODO:
> + *  -- implement FIFOs.  The real hardware has 32 word transmit
> + *                       and receive FIFOs
> + *  -- implement DMA
> + *  -- implement BAUD-rate and modem lines, for when the backend
> + *     is a real serial device.
> + */
> +
> +#include "hw.h"
> +#include "sysbus.h"
> +#include "qemu-char.h"
> +
> +#define DEBUG_SERIAL 1
> +#undef DEBUG_SERIAL /* comment out for debugging */

Dito.

> +
> +#ifdef DEBUG_SERIAL
> +#define DPRINTF(fmt, args...) \
> +do { printf("imx_serial: " fmt , ##args); } while (0)
> +#else
> +#define DPRINTF(fmt, args...) do {} while (0)
> +#endif

> +static int imx_serial_init(SysBusDevice *dev)
> +{
> +    imx_state *s = FROM_SYSBUS(imx_state, dev);
> +
> +    memory_region_init_io(&s->iomem, &imx_serial_ops, s, "imx-serial", 0x1000);
> +    sysbus_init_mmio_region(dev, &s->iomem);
> +    sysbus_init_irq(dev, &s->irq);
> +    s->chr = qdev_init_chardev(&dev->qdev);
> +
> +    s->usr1 = USR1_TRDY;
> +    s->usr2 = USR2_TXFE | USR2_TXDC;
> +    s->ucr1 = UCR1_TRDYEN | UCR1_RRDYEN | UCR1_UARTEN;
> +    s->uts1 = UTS1_RXEMPTY;
> +    s->readbuff = 0;
> +    if (s->chr) {
> +        qemu_chr_add_handlers(s->chr, imx_can_receive, imx_receive,
> +                              imx_event, s);
> +    }
> +    return 0;
> +    /* ??? Save/restore.  */

What does this comment tell us? :)

> +}

> Index: qemu-working/hw/imx_timer.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ qemu-working/hw/imx_timer.c	2011-11-22 08:51:12.589269454 +1100
> @@ -0,0 +1,430 @@
> +/*
> + * IMX31 Timer
> + *
> + * Copyright (c) 2008 OKL
> + * Written by Hans
> + * Updated by Peter Chubb
> + *
> + * This code is licenced under the GPL.

Dito.

> + */
> +
> +#include "hw.h"
> +#include "qemu-timer.h"
> +#include "sysbus.h"
> +
> +#define DEBUG_TIMER 1
> +#undef DEBUG_TIMER  /* comment out for debugging */

Dito.

> +
> +#ifdef DEBUG_TIMER
> +#   define DPRINTF(fmt, args...) \
> +        do { printf("imx_timer: " fmt , ##args); } while (0)
> +#else
> +#   define DPRINTF(fmt, args...) do {} while (0)
> +#endif

> Index: qemu-working/hw/kzm.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ qemu-working/hw/kzm.c	2011-11-22 08:42:26.292661540 +1100
> @@ -0,0 +1,159 @@
> +/*
> + * KZM Board System emulation.
> + *
> + * Copyright (c) 2008 OKL and 2011 NICTA
> + * Written by Hans
> + * Updated by Peter Chubb.
> + *
> + * This code is licenced under the GPL.

Dito.

> + * It (partially) emulates a Kyoto Microcomputer
> + * KZM-ARM11-01 evaluation board, with a FreeScale
> + * I.MX31 SoC
> + */
> +
> +#include "sysbus.h"
> +#include "exec-memory.h"
> +#include "hw.h"
> +#include "arm-misc.h"
> +#include "primecell.h"
> +#include "devices.h"
> +#include "pci.h"
> +#include "net.h"
> +#include "sysemu.h"
> +#include "boards.h"
> +#include "pc.h" /* for the FPGA UART that emulates a 16550 */
> +
> +    /* Memory map for Kzm Emulation Baseboard:
> +     * 0x00000000-0x00003fff 16k secure ROM       IGNORED
> +     * 0x00004000-0x00407fff Reserved             IGNORED
> +     * 0x00404000-0x00407fff ROM                  IGNORED
> +     * 0x00408000-0x0fffffff Reserved             IGNORED
> +     * 0x10000000-0x1fffBfff RAM aliasing         IGNORED
> +     * 0x1fffc000-0x1fffffff RAM                  EMULATED
> +     * 0x20000000-0x2fffffff Reserved             IGNORED
> +     * 0x30000000-0x7fffffff I.MX31 Internal Register Space
> +     *   0x43f00000 IO_AREA0
> +     *   0x43f90000 UART1                         EMULATED
> +     *   0x43f94000 UART2                         EMULATED
> +     *   0x68000000 PIC                           EMULATED
> +     *   0x53f94000 PIT 1                         EMULATED
> +     *   0x53f98000 PIT 2                         EMULATED
> +     *   0x53f90000 GPT                           EMULATED
> +     * 0x80000000-0x87ffffff RAM                  EMULATED
> +     * 0x88000000-0x8fffffff RAM Aliasing         EMULATED
> +     * 0xa0000000-0xafffffff NAND Flash           IGNORED
> +     * 0xb0000000-0xb3ffffff Unavailable          IGNORED
> +     * 0xb4000000-0xb4000fff 8-bit free space     IGNORED
> +     * 0xb4001000-0xb400100f Board control        IGNORED
> +     *  0xb4001003           DIP switch
> +     * 0xb4001010-0xb400101f 7-segment LED        IGNORED
> +     * 0xb4001020-0xb400102f LED                  IGNORED
> +     * 0xb4001030-0xb400103f LED                  IGNORED
> +     * 0xb4001040-0xb400104f FPGA, UART           EMULATED
> +     * 0xb4001050-0xb400105f FPGA, UART           EMULATED
> +     * 0xb4001060-0xb40fffff FPGA                 IGNORED
> +     * 0xb6000000-0xb61fffff LAN controller       EMULATED
> +     * 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED
> +     * 0xb6300000-0xb7ffffff Free                 IGNORED
> +     * 0xb8000000-0xb8004fff Memory control registers IGNORED
> +     * 0xc0000000-0xc3ffffff PCMCIA/CF            IGNORED
> +     * 0xc4000000-0xffffffff Reserved             IGNORED
> +     */

Nice overview!

> +static void kzm_init(ram_addr_t ram_size,
> +                     const char *boot_device,
> +                     const char *kernel_filename, const char *kernel_cmdline,
> +                     const char *initrd_filename, const char *cpu_model)
> +{
> +    CPUState *env;
> +    MemoryRegion *address_space_mem = get_system_memory();
> +    MemoryRegion *ram = g_new(MemoryRegion, 1);
> +    MemoryRegion *sram = g_new(MemoryRegion, 1);
> +    MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
> +    qemu_irq *cpu_pic;
> +    DeviceState *dev;
> +
> +    if (!cpu_model) {
> +        cpu_model = "arm1136";

[ My "favorite" CPU... ;) ]

> +    }
> +
> +    env = cpu_init(cpu_model);
> +    if (!env) {
> +        fprintf(stderr, "Unable to find CPU definition\n");
> +        exit(1);
> +    }

My sharp eye also spotted an | without spaces somewhere. If you haven't
already, try running scripts/checkpatch.pl.

Regards,
Andreas

  reply	other threads:[~2011-11-21 22:46 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29  2:34 [Qemu-devel] [PATCH] [ARM] Fix sp804 dual-timer Peter Chubb
2011-09-29  9:58 ` Peter Maydell
2011-09-30  0:20   ` Peter Chubb
2011-09-30  9:04     ` Peter Maydell
2011-09-30  9:23       ` Peter Chubb
2011-09-30 10:07         ` Peter Maydell
     [not found]   ` <w4y5x6g8gk.wl%peter@chubb.wattle.id.au>
     [not found]     ` <CAFEAcA8-iByH0xgjkMUo3hvkrLc8NV-Lq4GbHU-d7UoF8GSX-Q@mail.gmail.com>
2011-11-21 21:58       ` [Qemu-devel] [PATCH] imx.31 and KZM board support Peter Chubb
2011-11-21 22:45         ` Andreas Färber [this message]
2011-11-21 23:04           ` Peter Chubb
2011-11-21 23:10             ` Peter Maydell
2011-11-21 23:41         ` Peter Maydell
2011-11-21 23:54           ` Peter Chubb
2011-11-22  0:12             ` Peter Maydell
2011-11-22  0:27               ` Peter Chubb
2011-11-22  0:32                 ` Peter Maydell
2011-11-22  4:31           ` [Qemu-devel] [PATCH V2 0/4] " Peter Chubb
2011-11-22  4:32             ` [Qemu-devel] [PATCH V2 1/4] imx.31 and KZM board support: UART support Peter Chubb
2011-11-24 18:53               ` Peter Maydell
2011-11-24 22:18                 ` Peter Chubb
2011-11-22  4:33             ` [Qemu-devel] [PATCH V2 2/4] imx.31 and KZM board support: Timer support Peter Chubb
2011-11-24 17:01               ` Peter Maydell
2011-11-24 19:06               ` Peter Maydell
2011-11-22  4:34             ` [Qemu-devel] [PATCH V2 3/4] imx.31 and KZM board support: interrupt controller Peter Chubb
2011-11-24 19:37               ` Peter Maydell
2011-11-22  4:34             ` [Qemu-devel] [PATCH V2 4/4] imx.31 and KZM board support: Makefile and board Peter Chubb
2011-11-24 19:41               ` Peter Maydell
2011-11-24 20:19                 ` Andreas Färber
2011-11-24 21:31                   ` Peter Maydell
2011-11-24 21:46                     ` Andreas Färber
2011-11-24 21:52                       ` Peter Maydell
2011-11-23  0:51             ` [Qemu-devel] [PATCH V2 0/4] imx.31 and KZM board support Peter Chubb
2011-11-24 19:07               ` Andreas Färber
2011-11-26  5:21                 ` Peter Chubb
2011-11-26 19:35                   ` Peter Maydell
2011-11-22 11:06         ` [Qemu-devel] [PATCH] " Juan Quintela
2011-11-22 11:14           ` Peter Maydell
2011-11-23 14:24             ` Juan Quintela
2011-11-23  0:48           ` Peter Chubb
2011-11-21 22:05   ` [Qemu-devel] [PATCH] [ARM] Fix sp804 dual-timer Peter Chubb
2011-11-21 23:01     ` Andreas Färber
2011-11-22  0:20       ` [Qemu-devel] [PATCH] [ARM] fix function names in error messages in arm_timer.c Peter Chubb
2011-11-22  3:20       ` [Qemu-devel] [PATCH] [ARM] Fix hw_error messages from arm_timer.c Peter Chubb
2011-12-05 19:53         ` andrzej zaborowski
2011-11-22  3:25       ` [Qemu-devel] [PATCH] [ARM] Fix sp804 dual-timer Peter Chubb
2011-11-24 17:46         ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ECAD474.4050209@web.de \
    --to=andreas.faerber@web.de \
    --cc=peter.chubb@nicta.com.au \
    --cc=peter.maydell@linaro.org \
    --cc=peterc@gelato.unsw.edu.au \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).