From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-trivial@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-devel@nongnu.org, "Fabien Chouteau" <chouteau@adacore.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Artyom Tarasenko" <atar4qemu@gmail.com>
Subject: [Qemu-devel] [PATCH v2 09/30] hw/sparc: use the BYTE-based definitions
Date: Mon, 5 Mar 2018 08:27:11 -0300 [thread overview]
Message-ID: <20180305112732.26471-10-f4bug@amsat.org> (raw)
In-Reply-To: <20180305112732.26471-1-f4bug@amsat.org>
It eases code review, unit is explicit.
Patch generated using:
$ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/
and modified manually.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sparc/leon3.c | 8 ++++----
hw/sparc/sun4m.c | 7 +++----
hw/sparc64/niagara.c | 2 +-
hw/sparc64/sun4u.c | 2 +-
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index bba3aa3dee..31be3f32b0 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -139,9 +139,9 @@ static void leon3_generic_hw_init(MachineState *machine)
env->qemu_irq_ack = leon3_irq_manager;
/* Allocate RAM */
- if ((uint64_t)ram_size > (1UL << 30)) {
- error_report("Too much memory for this machine: %d, maximum 1G",
- (unsigned int)(ram_size / (1024 * 1024)));
+ if (ram_size > 1 * G_BYTE) {
+ error_report("Too much memory for this machine: %lluMB, maximum 1G",
+ ram_size / M_BYTE);
exit(1);
}
@@ -149,7 +149,7 @@ static void leon3_generic_hw_init(MachineState *machine)
memory_region_add_subregion(address_space_mem, 0x40000000, ram);
/* Allocate BIOS */
- prom_size = 8 * 1024 * 1024; /* 8Mb */
+ prom_size = 8 * M_BYTE;
memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_fatal);
memory_region_set_readonly(prom, true);
memory_region_add_subregion(address_space_mem, 0x00000000, prom);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 9d82490794..01b4d0c36e 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -66,7 +66,7 @@
#define KERNEL_LOAD_ADDR 0x00004000
#define CMDLINE_ADDR 0x007ff000
#define INITRD_LOAD_ADDR 0x00800000
-#define PROM_SIZE_MAX (1024 * 1024)
+#define PROM_SIZE_MAX (1 * M_BYTE)
#define PROM_VADDR 0xffd00000
#define PROM_FILENAME "openbios-sparc32"
#define CFG_ADDR 0xd00000510ULL
@@ -744,9 +744,8 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size,
/* allocate RAM */
if ((uint64_t)RAM_size > max_mem) {
- error_report("Too much memory for this machine: %d, maximum %d",
- (unsigned int)(RAM_size / (1024 * 1024)),
- (unsigned int)(max_mem / (1024 * 1024)));
+ error_report("Too much memory for this machine: %llu, maximum %llu",
+ RAM_size / M_BYTE, max_mem / M_BYTE);
exit(1);
}
dev = qdev_create(NULL, "memory");
diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index 1874477ef6..97a78ca9a2 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -84,7 +84,7 @@ typedef struct NiagaraBoardState {
#define NIAGARA_PROM_BASE 0xfff0000000ULL
#define NIAGARA_Q_OFFSET 0x10000ULL
#define NIAGARA_OBP_OFFSET 0x80000ULL
-#define PROM_SIZE_MAX (4 * 1024 * 1024)
+#define PROM_SIZE_MAX (4 * M_BYTE)
static void add_rom_or_fail(const char *file, const hwaddr addr)
{
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index b84589e0b6..7a39ec7859 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -53,7 +53,7 @@
#define KERNEL_LOAD_ADDR 0x00404000
#define CMDLINE_ADDR 0x003ff000
-#define PROM_SIZE_MAX (4 * 1024 * 1024)
+#define PROM_SIZE_MAX (4 * M_BYTE)
#define PROM_VADDR 0x000ffd00000ULL
#define PBM_SPECIAL_BASE 0x1fe00000000ULL
#define PBM_MEM_BASE 0x1ff00000000ULL
--
2.16.2
next prev parent reply other threads:[~2018-03-05 11:27 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 11:27 [Qemu-devel] [PATCH v2 00/30] hw: use the BYTE-based definitions when useful Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 01/30] util/cutils: extract byte-based definitions into a new header: "qemu/cunits.h" Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [RFC PATCH v2 02/30] hw: include "qemu/cunits.h" and clean unused "qemu/cutils.h" Philippe Mathieu-Daudé
2018-03-05 18:57 ` Daniel P. Berrangé
2018-03-05 19:01 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 03/30] hw/block/nvme: include the "qemu/cutils.h" in the source file Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 04/30] hw/lm32/milkymist: remove unused include Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 05/30] hw/mips/r4k: constify params_size Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 06/30] hw/mips: use the BYTE-based definitions Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 07/30] hw/arm: " Philippe Mathieu-Daudé
2018-03-06 15:46 ` Alex Bennée
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 08/30] hw/i386: " Philippe Mathieu-Daudé
2018-03-05 18:51 ` Anthony PERARD
2018-03-06 12:43 ` Igor Mammedov
2018-03-05 11:27 ` Philippe Mathieu-Daudé [this message]
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 10/30] hw/ppc: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 11/30] hw/s390x: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 12/30] hw/hppa: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 13/30] hw/xtensa: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 14/30] hw/alpha: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 15/30] hw/lm32: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 16/30] hw/sh4: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 17/30] hw/tricore: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 18/30] hw/microblaze: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 19/30] hw/nios2: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 20/30] hw/cris: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 21/30] hw/misc: " Philippe Mathieu-Daudé
2018-03-05 19:02 ` Jiri Slaby
2018-03-05 19:05 ` Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 23/30] hw/net: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 24/30] hw/ipack: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 25/30] hw/scsi: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 26/30] hw/smbios: " Philippe Mathieu-Daudé
2018-03-06 9:02 ` Igor Mammedov
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 27/30] vfio/pci: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 28/30] ivshmem: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 29/30] tpm: " Philippe Mathieu-Daudé
2018-03-05 11:27 ` [Qemu-devel] [PATCH v2 30/30] xen: " Philippe Mathieu-Daudé
2018-03-05 18:53 ` Anthony PERARD
[not found] ` <20180305112732.26471-23-f4bug@amsat.org>
2018-03-05 18:52 ` [Qemu-devel] [PATCH v2 22/30] hw/display: " Anthony PERARD
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=20180305112732.26471-10-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=atar4qemu@gmail.com \
--cc=chouteau@adacore.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).