[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] hw/pc: Support system flash memory with -pfl
From: |
Jes Sorensen |
Subject: |
Re: [Qemu-devel] [PATCH v2] hw/pc: Support system flash memory with -pflash parameter |
Date: |
Mon, 28 Mar 2011 10:24:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 |
On 03/24/11 03:07, address@hidden 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