[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v5 41/46] hw/ppc: Use the IEC binary prefix definition
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-ppc] [PATCH v5 41/46] hw/ppc: Use the IEC binary prefix definitions |
Date: |
Mon, 25 Jun 2018 09:42:33 -0300 |
It eases code review, unit is explicit.
Patch generated using:
$ git grep -n '[<>][<>]= ?[1-5]0'
and modified manually.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/ppc/sam460ex.c | 2 +-
target/ppc/mmu_helper.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index ffe561fbc1..c7c799b843 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -126,7 +126,7 @@ static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t
ram_size)
int i;
/* work in terms of MB */
- ram_size >>= 20;
+ ram_size /= MiB;
while ((ram_size >= 4) && (nbanks <= 2)) {
int sz_log2 = MIN(31 - clz32(ram_size), 14);
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 98ce17985b..e6739e6c24 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -17,6 +17,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "sysemu/kvm.h"
@@ -1090,11 +1091,10 @@ static void mmubooke_dump_mmu(FILE *f, fprintf_function
cpu_fprintf,
pa = entry->RPN & mask;
/* Extend the physical address to 36 bits */
pa |= (hwaddr)(entry->RPN & 0xF) << 32;
- size /= 1024;
- if (size >= 1024) {
- snprintf(size_buf, sizeof(size_buf), "%3" PRId64 "M", size / 1024);
+ if (size >= 1 * MiB) {
+ snprintf(size_buf, sizeof(size_buf), "%3" PRId64 "M", size / MiB);
} else {
- snprintf(size_buf, sizeof(size_buf), "%3" PRId64 "k", size);
+ snprintf(size_buf, sizeof(size_buf), "%3" PRId64 "k", size / KiB);
}
cpu_fprintf(f, "0x%016" PRIx64 " 0x%016" PRIx64 " %s %-5u %08x %08x\n",
(uint64_t)ea, (uint64_t)pa, size_buf, (uint32_t)entry->PID,
--
2.18.0
- [Qemu-ppc] [PATCH v5 00/46] Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2018/06/25
- [Qemu-ppc] [PATCH v5 06/46] hw: Directly use "qemu/units.h" instead of "qemu/cutils.h", Philippe Mathieu-Daudé, 2018/06/25
- [Qemu-ppc] [PATCH v5 05/46] hw: Use IEC binary prefix definitions from "qemu/units.h", Philippe Mathieu-Daudé, 2018/06/25
- [Qemu-ppc] [PATCH v5 32/46] hw/ppc: Use the IEC binary prefix definitions, Philippe Mathieu-Daudé, 2018/06/25
- [Qemu-ppc] [PATCH v5 41/46] hw/ppc: Use the IEC binary prefix definitions,
Philippe Mathieu-Daudé <=
- Re: [Qemu-ppc] [PATCH v5 00/46] Use the IEC binary prefix definitions, Michael S. Tsirkin, 2018/06/25
- Re: [Qemu-ppc] [Qemu-block] [PATCH v5 00/46] Use the IEC binary prefix definitions, Paolo Bonzini, 2018/06/29