From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2o4S-0007Bd-Mo for qemu-devel@nongnu.org; Mon, 13 Jan 2014 15:25:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2o4N-00055c-RH for qemu-devel@nongnu.org; Mon, 13 Jan 2014 15:25:16 -0500 Received: from [2a03:4000:1::4e2f:c7ac:d] (port=39736 helo=v220110690675601.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2o4N-00055U-Gx for qemu-devel@nongnu.org; Mon, 13 Jan 2014 15:25:11 -0500 Message-ID: <52D44B9F.1020307@weilnetz.de> Date: Mon, 13 Jan 2014 21:25:03 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1389644612-4963-1-git-send-email-antonynpavlov@gmail.com> <1389644612-4963-3-git-send-email-antonynpavlov@gmail.com> In-Reply-To: <1389644612-4963-3-git-send-email-antonynpavlov@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RESEND 2/2] hw/mips: use sizes.h macros List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Antony Pavlov , qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Aurelien Jarno , Richard Henderson Am 13.01.2014 21:23, schrieb Antony Pavlov: > Signed-off-by: Antony Pavlov > Reviewed-by: Richard Henderson > Reviewed-by: Andreas F=C3=A4rber > --- > hw/mips/mips_malta.c | 25 +++++++++++++------------ > include/hw/mips/bios.h | 3 ++- > 2 files changed, 15 insertions(+), 13 deletions(-) >=20 > diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c > index 05c8771..604832f 100644 > --- a/hw/mips/mips_malta.c > +++ b/hw/mips/mips_malta.c > @@ -51,6 +51,7 @@ > #include "sysemu/qtest.h" > #include "qemu/error-report.h" > #include "hw/empty_slot.h" > +#include "qemu/sizes.h" > =20 > //#define DEBUG_BOARD_INIT > =20 > @@ -63,7 +64,7 @@ > #define FPGA_ADDRESS 0x1f000000ULL > #define RESET_ADDRESS 0x1fc00000ULL > =20 > -#define FLASH_SIZE 0x400000 > +#define FLASH_SIZE SZ_4M > =20 > #define MAX_IDE_BUS 2 > =20 > @@ -827,8 +828,8 @@ static int64_t load_kernel (void) > } > =20 > prom_set(prom_buf, prom_index++, "memsize"); > - prom_set(prom_buf, prom_index++, "%i", > - MIN(loaderparams.ram_size, 256 << 20)); > + prom_set(prom_buf, prom_index++, "%li", > + MIN(loaderparams.ram_size, SZ_256M)); > prom_set(prom_buf, prom_index++, "modetty0"); > prom_set(prom_buf, prom_index++, "38400n8r"); > prom_set(prom_buf, prom_index++, NULL); > @@ -954,10 +955,10 @@ void mips_malta_init(QEMUMachineInitArgs *args) > env =3D &cpu->env; > =20 > /* allocate RAM */ > - if (ram_size > (2048u << 20)) { > + if (ram_size > SZ_2G) { > fprintf(stderr, > - "qemu: Too much memory for this machine: %d MB, maximu= m 2048 MB\n", > - ((unsigned int)ram_size / (1 << 20))); > + "qemu: Too much memory for this machine: %ld MB, maxim= um 2048 MB\n", > + ((unsigned long)ram_size / SZ_1M)); > exit(1); > } > =20 > @@ -968,17 +969,17 @@ void mips_malta_init(QEMUMachineInitArgs *args) > =20 > /* alias for pre IO hole access */ > memory_region_init_alias(ram_low_preio, NULL, "mips_malta_low_prei= o.ram", > - ram_high, 0, MIN(ram_size, (256 << 20))); > + ram_high, 0, MIN(ram_size, SZ_256M)); > memory_region_add_subregion(system_memory, 0, ram_low_preio); > =20 > /* alias for post IO hole access, if there is enough RAM */ > - if (ram_size > (512 << 20)) { > + if (ram_size > SZ_512M) { > ram_low_postio =3D g_new(MemoryRegion, 1); > memory_region_init_alias(ram_low_postio, NULL, > "mips_malta_low_postio.ram", > - ram_high, 512 << 20, > - ram_size - (512 << 20)); > - memory_region_add_subregion(system_memory, 512 << 20, ram_low_= postio); > + ram_high, SZ_512M, > + ram_size - SZ_512M); > + memory_region_add_subregion(system_memory, SZ_512M, ram_low_po= stio); > } > =20 > /* generate SPD EEPROM data */ > @@ -1012,7 +1013,7 @@ void mips_malta_init(QEMUMachineInitArgs *args) > fl_idx++; > if (kernel_filename) { > /* Write a small bootloader to the flash location. */ > - loaderparams.ram_size =3D MIN(ram_size, 256 << 20); > + loaderparams.ram_size =3D MIN(ram_size, SZ_256M); > loaderparams.kernel_filename =3D kernel_filename; > loaderparams.kernel_cmdline =3D kernel_cmdline; > loaderparams.initrd_filename =3D initrd_filename; > diff --git a/include/hw/mips/bios.h b/include/hw/mips/bios.h > index b4b88ac..3d7da4b 100644 > --- a/include/hw/mips/bios.h > +++ b/include/hw/mips/bios.h > @@ -1,6 +1,7 @@ > #include "cpu.h" > +#include "qemu/sizes.h" > =20 > -#define BIOS_SIZE (4 * 1024 * 1024) > +#define BIOS_SIZE SZ_4M > #ifdef TARGET_WORDS_BIGENDIAN > #define BIOS_FILENAME "mips_bios.bin" > #else >=20 Even if the Linux world and other projects use these macros, I still prefer (4 * MiB), (256 * MiB), (2 * GiB) because they look more natural for me. I won't object to this patch if the majority thinks different. Stefan