qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: jordan.l.justen@intel.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] hw/pc: Support system flash memory with -pflash parameter
Date: Mon, 28 Mar 2011 10:24:57 +0200	[thread overview]
Message-ID: <4D9045D9.2090005@redhat.com> (raw)
In-Reply-To: <1300932459-6709-1-git-send-email-jordan.l.justen@intel.com>

On 03/24/11 03:07, jordan.l.justen@intel.com wrote:
> +static void pc_isa_bios_init(ram_addr_t ram_offset, int ram_size)
> +{
> +    int isa_bios_size;
> +
> +    /* map the last 128KB of the BIOS in ISA space */
> +    isa_bios_size = ram_size;
> +    if (isa_bios_size > (128 * 1024))
> +        isa_bios_size = 128 * 1024;

You're missing braces here to comply with coding style. I realize some
of the cosmetics comes from old code you are moving, but please fix it
up in the move.

> +    cpu_register_physical_memory(0x100000 - isa_bios_size,
> +                                 isa_bios_size,
> +                                 (ram_offset + ram_size - isa_bios_size) | IO_MEM_ROM);

A line is 80 characters, please wrap it or calculate the number before
the function call.

> +    bdrv = pflash_drv->bdrv;
> +    size = bdrv_getlength(pflash_drv->bdrv);
> +    sector_bits = 12;
> +    sector_size = 1 << sector_bits;
> +
> +    if ((size % sector_size) != 0) {
> +        fprintf(stderr,
> +                "qemu: -pflash size must be a multiple of 0x%x\n",
> +                sector_size);
> +        exit(1);
> +    }
> +
> +    phys_addr = 0x100000000ULL - rom_size - size;
> +    addr = qemu_ram_alloc(NULL, "system.flash", size);
> +    DPRINTF("flash addr: 0x%lx\n", (int64_t)phys_addr);
> +#if 1
> +    pflash_cfi01_register(phys_addr, addr, bdrv,
> +                          sector_size, size >> sector_bits,
> +                          4, 0x0000, 0x0000, 0x0000, 0x0000, 0);
> +#else
> +    pflash_cfi02_register(phys_addr, addr, bdrv,
> +                          sector_size, size >> sector_bits,
> +                          1, 4, 0x0000, 0x0000, 0x0000, 0x0000, 0x55, 0xaa, 0);
> +#endif

Please get rid of the #ifdef here.

Cheers,
Jes

      reply	other threads:[~2011-03-28  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  2:07 [Qemu-devel] [PATCH v2] hw/pc: Support system flash memory with -pflash parameter jordan.l.justen
2011-03-28  8:24 ` Jes Sorensen [this message]

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=4D9045D9.2090005@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=jordan.l.justen@intel.com \
    --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).