hw/ppc: Use the IEC binary prefix definitions
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> Acked-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20180625124238.25339-33-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									be01029e5d
								
							
						
					
					
						commit
						ab3dd74924
					
				| @ -23,6 +23,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "qemu-common.h" | ||||
| #include "cpu.h" | ||||
| @ -47,9 +48,9 @@ typedef struct sPAPRNVRAM { | ||||
| #define VIO_SPAPR_NVRAM(obj) \ | ||||
|      OBJECT_CHECK(sPAPRNVRAM, (obj), TYPE_VIO_SPAPR_NVRAM) | ||||
| 
 | ||||
| #define MIN_NVRAM_SIZE 8192 | ||||
| #define DEFAULT_NVRAM_SIZE 65536 | ||||
| #define MAX_NVRAM_SIZE 1048576 | ||||
| #define MIN_NVRAM_SIZE      (8 * KiB) | ||||
| #define DEFAULT_NVRAM_SIZE  (64 * KiB) | ||||
| #define MAX_NVRAM_SIZE      (1 * MiB) | ||||
| 
 | ||||
| static void rtas_nvram_fetch(PowerPCCPU *cpu, sPAPRMachineState *spapr, | ||||
|                              uint32_t token, uint32_t nargs, | ||||
| @ -167,7 +168,9 @@ static void spapr_nvram_realize(VIOsPAPRDevice *dev, Error **errp) | ||||
|     nvram->buf = g_malloc0(nvram->size); | ||||
| 
 | ||||
|     if ((nvram->size < MIN_NVRAM_SIZE) || (nvram->size > MAX_NVRAM_SIZE)) { | ||||
|         error_setg(errp, "spapr-nvram must be between %d and %d bytes in size", | ||||
|         error_setg(errp, | ||||
|                    "spapr-nvram must be between %" PRId64 | ||||
|                    " and %" PRId64 " bytes in size", | ||||
|                    MIN_NVRAM_SIZE, MAX_NVRAM_SIZE); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @ -24,6 +24,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "hw/hw.h" | ||||
| #include "hw/pci/pci.h" | ||||
| @ -70,7 +71,7 @@ typedef struct PRePPCIState { | ||||
|     int contiguous_map; | ||||
| } PREPPCIState; | ||||
| 
 | ||||
| #define BIOS_SIZE (1024 * 1024) | ||||
| #define BIOS_SIZE (1 * MiB) | ||||
| 
 | ||||
| static inline uint32_t raven_pci_io_config(hwaddr addr) | ||||
| { | ||||
|  | ||||
| @ -15,6 +15,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "e500.h" | ||||
| #include "e500-ccsr.h" | ||||
| @ -46,11 +47,11 @@ | ||||
| #define BINARY_DEVICE_TREE_FILE    "mpc8544ds.dtb" | ||||
| #define DTC_LOAD_PAD               0x1800000 | ||||
| #define DTC_PAD_MASK               0xFFFFF | ||||
| #define DTB_MAX_SIZE               (8 * 1024 * 1024) | ||||
| #define DTB_MAX_SIZE               (8 * MiB) | ||||
| #define INITRD_LOAD_PAD            0x2000000 | ||||
| #define INITRD_PAD_MASK            0xFFFFFF | ||||
| 
 | ||||
| #define RAM_SIZES_ALIGN            (64UL << 20) | ||||
| #define RAM_SIZES_ALIGN            (64 * MiB) | ||||
| 
 | ||||
| /* TODO: parameterize */ | ||||
| #define MPC8544_CCSRBAR_SIZE       0x00100000ULL | ||||
| @ -603,7 +604,7 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine, | ||||
| /* Create -kernel TLB entries for BookE.  */ | ||||
| hwaddr booke206_page_size_to_tlb(uint64_t size) | ||||
| { | ||||
|     return 63 - clz64(size >> 10); | ||||
|     return 63 - clz64(size / KiB); | ||||
| } | ||||
| 
 | ||||
| static int booke206_initial_map_tsize(CPUPPCState *env) | ||||
| @ -671,7 +672,7 @@ static void ppce500_cpu_reset(void *opaque) | ||||
| 
 | ||||
|     /* Set initial guest state. */ | ||||
|     cs->halted = 0; | ||||
|     env->gpr[1] = (16<<20) - 8; | ||||
|     env->gpr[1] = (16 * MiB) - 8; | ||||
|     env->gpr[3] = bi->dt_base; | ||||
|     env->gpr[4] = 0; | ||||
|     env->gpr[5] = 0; | ||||
| @ -1012,9 +1013,9 @@ void ppce500_init(MachineState *machine) | ||||
|     } | ||||
| 
 | ||||
|     cur_base = loadaddr + payload_size; | ||||
|     if (cur_base < (32 * 1024 * 1024)) { | ||||
|     if (cur_base < 32 * MiB) { | ||||
|         /* u-boot occupies memory up to 32MB, so load blobs above */ | ||||
|         cur_base = (32 * 1024 * 1024); | ||||
|         cur_base = 32 * MiB; | ||||
|     } | ||||
| 
 | ||||
|     /* Load bare kernel only if no bios/u-boot has been provided */ | ||||
|  | ||||
| @ -10,6 +10,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qemu-common.h" | ||||
| #include "e500.h" | ||||
| #include "hw/net/fsl_etsec/etsec.h" | ||||
| @ -85,7 +86,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, void *data) | ||||
|     pmc->has_mpc8xxx_gpio = true; | ||||
|     pmc->has_platform_bus = true; | ||||
|     pmc->platform_bus_base = 0xf00000000ULL; | ||||
|     pmc->platform_bus_size = (128ULL * 1024 * 1024); | ||||
|     pmc->platform_bus_size = 128 * MiB; | ||||
|     pmc->platform_bus_first_irq = 5; | ||||
|     pmc->platform_bus_num_irqs = 10; | ||||
|     pmc->ccsrbar_base = 0xFE0000000ULL; | ||||
|  | ||||
| @ -26,6 +26,7 @@ | ||||
| #ifndef PPC_MAC_H | ||||
| #define PPC_MAC_H | ||||
| 
 | ||||
| #include "qemu/units.h" | ||||
| #include "exec/memory.h" | ||||
| #include "hw/boards.h" | ||||
| #include "hw/sysbus.h" | ||||
| @ -38,7 +39,7 @@ | ||||
| /* SMP is not enabled, for now */ | ||||
| #define MAX_CPUS 1 | ||||
| 
 | ||||
| #define BIOS_SIZE     (1024 * 1024) | ||||
| #define BIOS_SIZE        (1 * MiB) | ||||
| #define NVRAM_SIZE        0x2000 | ||||
| #define PROM_FILENAME    "openbios-ppc" | ||||
| #define PROM_ADDR         0xfff00000 | ||||
|  | ||||
| @ -71,7 +71,6 @@ | ||||
| #include "hw/usb.h" | ||||
| #include "exec/address-spaces.h" | ||||
| #include "hw/sysbus.h" | ||||
| #include "qemu/cutils.h" | ||||
| #include "trace.h" | ||||
| 
 | ||||
| #define MAX_IDE_BUS 2 | ||||
|  | ||||
| @ -24,6 +24,7 @@ | ||||
|  * THE SOFTWARE. | ||||
|  */ | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "hw/hw.h" | ||||
| #include "hw/ppc/ppc.h" | ||||
| @ -46,7 +47,6 @@ | ||||
| #include "sysemu/kvm.h" | ||||
| #include "kvm_ppc.h" | ||||
| #include "exec/address-spaces.h" | ||||
| #include "qemu/cutils.h" | ||||
| 
 | ||||
| #define MAX_IDE_BUS 2 | ||||
| #define CFG_ADDR 0xf0000510 | ||||
| @ -118,10 +118,9 @@ static void ppc_heathrow_init(MachineState *machine) | ||||
|     } | ||||
| 
 | ||||
|     /* allocate RAM */ | ||||
|     if (ram_size > (2047 << 20)) { | ||||
|         fprintf(stderr, | ||||
|                 "qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n", | ||||
|                 ((unsigned int)ram_size / (1 << 20))); | ||||
|     if (ram_size > 2047 * MiB) { | ||||
|         error_report("Too much memory for this machine: %" PRId64 " MB, " | ||||
|                      "maximum 2047 MB", ram_size / MiB); | ||||
|         exit(1); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -22,6 +22,7 @@ | ||||
|  * THE SOFTWARE. | ||||
|  */ | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "qemu-common.h" | ||||
| #include "cpu.h" | ||||
| @ -40,7 +41,7 @@ | ||||
| #include "exec/address-spaces.h" | ||||
| 
 | ||||
| #define BIOS_FILENAME "ppc405_rom.bin" | ||||
| #define BIOS_SIZE (2048 * 1024) | ||||
| #define BIOS_SIZE (2 * MiB) | ||||
| 
 | ||||
| #define KERNEL_LOAD_ADDR 0x00000000 | ||||
| #define INITRD_LOAD_ADDR 0x01800000 | ||||
| @ -216,14 +217,14 @@ static void ref405ep_init(MachineState *machine) | ||||
|     memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); | ||||
|     ram_bases[1] = 0x00000000; | ||||
|     ram_sizes[1] = 0x00000000; | ||||
|     ram_size = 128 * 1024 * 1024; | ||||
|     ram_size = 128 * MiB; | ||||
| #ifdef DEBUG_BOARD_INIT | ||||
|     printf("%s: register cpu\n", __func__); | ||||
| #endif | ||||
|     env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, | ||||
|                         33333333, &pic, kernel_filename == NULL ? 0 : 1); | ||||
|     /* allocate SRAM */ | ||||
|     sram_size = 512 * 1024; | ||||
|     sram_size = 512 * KiB; | ||||
|     memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, | ||||
|                            &error_fatal); | ||||
|     memory_region_add_subregion(sysmem, 0xFFF00000, sram); | ||||
| @ -589,7 +590,7 @@ static void taihu_405ep_init(MachineState *machine) | ||||
| 
 | ||||
|         bios_size = blk_getlength(blk); | ||||
|         /* XXX: should check that size is 32MB */ | ||||
|         bios_size = 32 * 1024 * 1024; | ||||
|         bios_size = 32 * MiB; | ||||
|         fl_sectors = (bios_size + 65535) >> 16; | ||||
| #ifdef DEBUG_BOARD_INIT | ||||
|         printf("Register parallel flash %d size %lx" | ||||
|  | ||||
| @ -22,6 +22,7 @@ | ||||
|  * THE SOFTWARE. | ||||
|  */ | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qapi/error.h" | ||||
| #include "qemu-common.h" | ||||
| #include "cpu.h" | ||||
| @ -983,10 +984,10 @@ static void ppc405_ocm_init(CPUPPCState *env) | ||||
| 
 | ||||
|     ocm = g_malloc0(sizeof(ppc405_ocm_t)); | ||||
|     /* XXX: Size is 4096 or 0x04000000 */ | ||||
|     memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4096, | ||||
|     memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4 * KiB, | ||||
|                            &error_fatal); | ||||
|     memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", &ocm->isarc_ram, | ||||
|                              0, 4096); | ||||
|     memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", | ||||
|                              &ocm->isarc_ram, 0, 4 * KiB); | ||||
|     qemu_register_reset(&ocm_reset, ocm); | ||||
|     ppc_dcr_register(env, OCM0_ISARC, | ||||
|                      ocm, &dcr_read_ocm, &dcr_write_ocm); | ||||
|  | ||||
| @ -12,6 +12,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qemu/error-report.h" | ||||
| #include "qemu-common.h" | ||||
| #include "qemu/error-report.h" | ||||
| @ -49,7 +50,7 @@ | ||||
| #define PPC440EP_SDRAM_NR_BANKS 4 | ||||
| 
 | ||||
| static const unsigned int ppc440ep_sdram_bank_sizes[] = { | ||||
|     256<<20, 128<<20, 64<<20, 32<<20, 16<<20, 8<<20, 0 | ||||
|     256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 16 * MiB, 8 * MiB, 0 | ||||
| }; | ||||
| 
 | ||||
| static hwaddr entry; | ||||
| @ -151,7 +152,7 @@ static void main_cpu_reset(void *opaque) | ||||
|     CPUPPCState *env = &cpu->env; | ||||
| 
 | ||||
|     cpu_reset(CPU(cpu)); | ||||
|     env->gpr[1] = (16<<20) - 8; | ||||
|     env->gpr[1] = (16 * MiB) - 8; | ||||
|     env->gpr[3] = FDT_ADDR; | ||||
|     env->nip = entry; | ||||
| 
 | ||||
|  | ||||
| @ -22,6 +22,7 @@ | ||||
|  * THE SOFTWARE. | ||||
|  */ | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "cpu.h" | ||||
| #include "hw/hw.h" | ||||
| #include "hw/ppc/ppc.h" | ||||
| @ -29,6 +30,7 @@ | ||||
| #include "hw/boards.h" | ||||
| #include "qemu/log.h" | ||||
| #include "exec/address-spaces.h" | ||||
| #include "qemu/error-report.h" | ||||
| 
 | ||||
| #define DEBUG_UIC | ||||
| 
 | ||||
| @ -353,25 +355,25 @@ static uint32_t sdram_bcr (hwaddr ram_base, | ||||
|     uint32_t bcr; | ||||
| 
 | ||||
|     switch (ram_size) { | ||||
|     case (4 * 1024 * 1024): | ||||
|     case 4 * MiB: | ||||
|         bcr = 0x00000000; | ||||
|         break; | ||||
|     case (8 * 1024 * 1024): | ||||
|     case 8 * MiB: | ||||
|         bcr = 0x00020000; | ||||
|         break; | ||||
|     case (16 * 1024 * 1024): | ||||
|     case 16 * MiB: | ||||
|         bcr = 0x00040000; | ||||
|         break; | ||||
|     case (32 * 1024 * 1024): | ||||
|     case 32 * MiB: | ||||
|         bcr = 0x00060000; | ||||
|         break; | ||||
|     case (64 * 1024 * 1024): | ||||
|     case 64 * MiB: | ||||
|         bcr = 0x00080000; | ||||
|         break; | ||||
|     case (128 * 1024 * 1024): | ||||
|     case 128 * MiB: | ||||
|         bcr = 0x000A0000; | ||||
|         break; | ||||
|     case (256 * 1024 * 1024): | ||||
|     case 256 * MiB: | ||||
|         bcr = 0x000C0000; | ||||
|         break; | ||||
|     default: | ||||
| @ -399,7 +401,7 @@ static target_ulong sdram_size (uint32_t bcr) | ||||
|     if (sh == 7) | ||||
|         size = -1; | ||||
|     else | ||||
|         size = (4 * 1024 * 1024) << sh; | ||||
|         size = (4 * MiB) << sh; | ||||
| 
 | ||||
|     return size; | ||||
| } | ||||
| @ -702,8 +704,8 @@ ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks, | ||||
| 
 | ||||
|     ram_size -= size_left; | ||||
|     if (size_left) { | ||||
|         printf("Truncating memory to %d MiB to fit SDRAM controller limits.\n", | ||||
|                (int)(ram_size >> 20)); | ||||
|         error_report("Truncating memory to %" PRId64 " MiB to fit SDRAM" | ||||
|                      " controller limits", ram_size / MiB); | ||||
|     } | ||||
| 
 | ||||
|     memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_size); | ||||
|  | ||||
| @ -28,6 +28,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "hw/hw.h" | ||||
| #include "hw/sysbus.h" | ||||
| #include "sysemu/hw_accel.h" | ||||
| @ -89,7 +90,7 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) | ||||
|     PowerPCCPU *cpu = POWERPC_CPU(cs); | ||||
|     CPUPPCState *env = &cpu->env; | ||||
|     SpinInfo *curspin = data.host_ptr; | ||||
|     hwaddr map_size = 64 * 1024 * 1024; | ||||
|     hwaddr map_size = 64 * MiB; | ||||
|     hwaddr map_start; | ||||
| 
 | ||||
|     cpu_synchronize_state(cs); | ||||
|  | ||||
| @ -50,7 +50,7 @@ | ||||
| #include "exec/address-spaces.h" | ||||
| #include "trace.h" | ||||
| #include "elf.h" | ||||
| #include "qemu/cutils.h" | ||||
| #include "qemu/units.h" | ||||
| #include "kvm_ppc.h" | ||||
| 
 | ||||
| /* SMP is not enabled, for now */ | ||||
| @ -60,7 +60,7 @@ | ||||
| 
 | ||||
| #define CFG_ADDR 0xf0000510 | ||||
| 
 | ||||
| #define BIOS_SIZE (1024 * 1024) | ||||
| #define BIOS_SIZE (1 * MiB) | ||||
| #define BIOS_FILENAME "ppc_rom.bin" | ||||
| #define KERNEL_LOAD_ADDR 0x01000000 | ||||
| #define INITRD_LOAD_ADDR 0x01800000 | ||||
|  | ||||
| @ -18,6 +18,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "hw/isa/isa.h" | ||||
| #include "exec/address-spaces.h" | ||||
| #include "hw/boards.h" | ||||
| @ -109,7 +110,7 @@ static void rs6000mc_port0820_write(void *opaque, uint32_t addr, uint32_t val) | ||||
|             size = end_address - start_address; | ||||
|             memory_region_set_enabled(&s->simm[socket - 1], size != 0); | ||||
|             memory_region_set_address(&s->simm[socket - 1], | ||||
|                                       start_address * 8 * 1024 * 1024); | ||||
|                                       start_address * 8 * MiB); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -140,7 +141,7 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) | ||||
| { | ||||
|     RS6000MCState *s = RS6000MC_DEVICE(dev); | ||||
|     int socket = 0; | ||||
|     unsigned int ram_size = s->ram_size / (1024 * 1024); | ||||
|     unsigned int ram_size = s->ram_size / MiB; | ||||
| 
 | ||||
|     while (socket < 6) { | ||||
|         if (ram_size >= 64) { | ||||
| @ -163,8 +164,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) | ||||
|             char name[] = "simm.?"; | ||||
|             name[5] = socket + '0'; | ||||
|             memory_region_allocate_system_memory(&s->simm[socket], OBJECT(dev), | ||||
|                                                  name, s->simm_size[socket] | ||||
|                                                  * 1024 * 1024); | ||||
|                                                  name, | ||||
|                                                  s->simm_size[socket] * MiB); | ||||
|             memory_region_add_subregion_overlap(get_system_memory(), 0, | ||||
|                                                 &s->simm[socket], socket); | ||||
|         } | ||||
| @ -172,8 +173,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) | ||||
|     if (ram_size) { | ||||
|         /* unable to push all requested RAM in SIMMs */ | ||||
|         error_setg(errp, "RAM size incompatible with this board. " | ||||
|                    "Try again with something else, like %d MB", | ||||
|                    s->ram_size / 1024 / 1024 - ram_size); | ||||
|                    "Try again with something else, like %" PRId64 " MB", | ||||
|                    s->ram_size / MiB - ram_size); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -12,8 +12,8 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "qemu-common.h" | ||||
| #include "qemu/cutils.h" | ||||
| #include "qemu/error-report.h" | ||||
| #include "qapi/error.h" | ||||
| #include "hw/hw.h" | ||||
| @ -46,7 +46,7 @@ | ||||
| /* from Sam460 U-Boot include/configs/Sam460ex.h */ | ||||
| #define FLASH_BASE             0xfff00000 | ||||
| #define FLASH_BASE_H           0x4 | ||||
| #define FLASH_SIZE             (1 << 20) | ||||
| #define FLASH_SIZE             (1 * MiB) | ||||
| #define UBOOT_LOAD_BASE        0xfff80000 | ||||
| #define UBOOT_SIZE             0x00080000 | ||||
| #define UBOOT_ENTRY            0xfffffffc | ||||
| @ -71,7 +71,7 @@ | ||||
| 
 | ||||
| /* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */ | ||||
| static const unsigned int ppc460ex_sdram_bank_sizes[] = { | ||||
|     1024 << 20, 512 << 20, 256 << 20, 128 << 20, 64 << 20, 32 << 20, 0 | ||||
|     1 * GiB, 512 * MiB, 256 * MiB, 128 * MiB, 64 * MiB, 32 * MiB, 0 | ||||
| }; | ||||
| 
 | ||||
| struct boot_info { | ||||
| @ -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); | ||||
| @ -225,7 +225,7 @@ static int sam460ex_load_uboot(void) | ||||
|     fl_sectors = (bios_size + 65535) >> 16; | ||||
| 
 | ||||
|     if (!pflash_cfi01_register(base, NULL, "sam460ex.flash", bios_size, | ||||
|                                blk, (64 * 1024), fl_sectors, | ||||
|                                blk, 64 * KiB, fl_sectors, | ||||
|                                1, 0x89, 0x18, 0x0000, 0x0, 1)) { | ||||
|         error_report("qemu: Error registering flash memory."); | ||||
|         /* XXX: return an error instead? */ | ||||
| @ -359,14 +359,14 @@ static void main_cpu_reset(void *opaque) | ||||
| 
 | ||||
|     /* either we have a kernel to boot or we jump to U-Boot */ | ||||
|     if (bi->entry != UBOOT_ENTRY) { | ||||
|         env->gpr[1] = (16 << 20) - 8; | ||||
|         env->gpr[1] = (16 * MiB) - 8; | ||||
|         env->gpr[3] = FDT_ADDR; | ||||
|         env->nip = bi->entry; | ||||
| 
 | ||||
|         /* Create a mapping for the kernel.  */ | ||||
|         mmubooke_create_initial_mapping(env, 0, 0); | ||||
|         env->gpr[6] = tswap32(EPAPR_MAGIC); | ||||
|         env->gpr[7] = (16 << 20) - 8; /*bi->ima_size;*/ | ||||
|         env->gpr[7] = (16 * MiB) - 8; /* bi->ima_size; */ | ||||
| 
 | ||||
|     } else { | ||||
|         env->nip = UBOOT_ENTRY; | ||||
| @ -479,7 +479,7 @@ static void sam460ex_init(MachineState *machine) | ||||
|     /* 256K of L2 cache as memory */ | ||||
|     ppc4xx_l2sram_init(env); | ||||
|     /* FIXME: remove this after fixing l2sram mapping in ppc440_uc.c? */ | ||||
|     memory_region_init_ram(l2cache_ram, NULL, "ppc440.l2cache_ram", 256 << 10, | ||||
|     memory_region_init_ram(l2cache_ram, NULL, "ppc440.l2cache_ram", 256 * KiB, | ||||
|                            &error_abort); | ||||
|     memory_region_add_subregion(address_space_mem, 0x400000000LL, l2cache_ram); | ||||
| 
 | ||||
|  | ||||
| @ -2322,7 +2322,7 @@ static void spapr_validate_node_memory(MachineState *machine, Error **errp) | ||||
| 
 | ||||
|     if (machine->ram_size % SPAPR_MEMORY_BLOCK_SIZE) { | ||||
|         error_setg(errp, "Memory size 0x" RAM_ADDR_FMT | ||||
|                    " is not aligned to %llu MiB", | ||||
|                    " is not aligned to %" PRIu64 " MiB", | ||||
|                    machine->ram_size, | ||||
|                    SPAPR_MEMORY_BLOCK_SIZE / MiB); | ||||
|         return; | ||||
| @ -2330,7 +2330,7 @@ static void spapr_validate_node_memory(MachineState *machine, Error **errp) | ||||
| 
 | ||||
|     if (machine->maxram_size % SPAPR_MEMORY_BLOCK_SIZE) { | ||||
|         error_setg(errp, "Maximum memory size 0x" RAM_ADDR_FMT | ||||
|                    " is not aligned to %llu MiB", | ||||
|                    " is not aligned to %" PRIu64 " MiB", | ||||
|                    machine->ram_size, | ||||
|                    SPAPR_MEMORY_BLOCK_SIZE / MiB); | ||||
|         return; | ||||
| @ -2340,7 +2340,7 @@ static void spapr_validate_node_memory(MachineState *machine, Error **errp) | ||||
|         if (numa_info[i].node_mem % SPAPR_MEMORY_BLOCK_SIZE) { | ||||
|             error_setg(errp, | ||||
|                        "Node %d memory size 0x%" PRIx64 | ||||
|                        " is not aligned to %llu MiB", | ||||
|                        " is not aligned to %" PRIu64 " MiB", | ||||
|                        i, numa_info[i].node_mem, | ||||
|                        SPAPR_MEMORY_BLOCK_SIZE / MiB); | ||||
|             return; | ||||
| @ -2763,7 +2763,7 @@ static void spapr_machine_init(MachineState *machine) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { | ||||
|     if (spapr->rma_size < (MIN_RMA_SLOF * MiB)) { | ||||
|         error_report( | ||||
|             "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", | ||||
|             MIN_RMA_SLOF); | ||||
| @ -3209,7 +3209,7 @@ static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, | ||||
| 
 | ||||
|     if (size % SPAPR_MEMORY_BLOCK_SIZE) { | ||||
|         error_setg(errp, "Hotplugged memory size must be a multiple of " | ||||
|                       "%lld MB", SPAPR_MEMORY_BLOCK_SIZE / MiB); | ||||
|                       "%" PRIu64 " MB", SPAPR_MEMORY_BLOCK_SIZE / MiB); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -237,7 +237,7 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, | ||||
|     switch (parameter) { | ||||
|     case RTAS_SYSPARM_SPLPAR_CHARACTERISTICS: { | ||||
|         char *param_val = g_strdup_printf("MaxEntCap=%d," | ||||
|                                           "DesMem=%llu," | ||||
|                                           "DesMem=%" PRIu64 "," | ||||
|                                           "DesProcs=%d," | ||||
|                                           "MaxPlatProcs=%d", | ||||
|                                           max_cpus, | ||||
|  | ||||
| @ -23,6 +23,7 @@ | ||||
|  */ | ||||
| 
 | ||||
| #include "qemu/osdep.h" | ||||
| #include "qemu/units.h" | ||||
| #include "cpu.h" | ||||
| #include "hw/sysbus.h" | ||||
| #include "hw/hw.h" | ||||
| @ -45,7 +46,7 @@ | ||||
| #include "ppc405.h" | ||||
| 
 | ||||
| #define EPAPR_MAGIC    (0x45504150) | ||||
| #define FLASH_SIZE     (16 * 1024 * 1024) | ||||
| #define FLASH_SIZE     (16 * MiB) | ||||
| 
 | ||||
| #define INTC_BASEADDR       0x81800000 | ||||
| #define UART16550_BASEADDR  0x83e01003 | ||||
| @ -127,7 +128,7 @@ static void main_cpu_reset(void *opaque) | ||||
|        *   r8: 0 | ||||
|        *   r9: 0 | ||||
|     */ | ||||
|     env->gpr[1] = (16<<20) - 8; | ||||
|     env->gpr[1] = (16 * MiB) - 8; | ||||
|     /* Provide a device-tree.  */ | ||||
|     env->gpr[3] = bi->fdt; | ||||
|     env->nip = bi->bootstrap_pc; | ||||
| @ -235,7 +236,7 @@ static void virtex_init(MachineState *machine) | ||||
|     dinfo = drive_get(IF_PFLASH, 0, 0); | ||||
|     pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE, | ||||
|                           dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, | ||||
|                           (64 * 1024), FLASH_SIZE >> 16, | ||||
|                           64 * KiB, FLASH_SIZE >> 16, | ||||
|                           1, 0x89, 0x18, 0x0000, 0x0, 1); | ||||
| 
 | ||||
|     cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT]; | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| #ifndef HW_SPAPR_H | ||||
| #define HW_SPAPR_H | ||||
| 
 | ||||
| #include "qemu/units.h" | ||||
| #include "sysemu/dma.h" | ||||
| #include "hw/boards.h" | ||||
| #include "hw/ppc/xics.h" | ||||
| @ -749,8 +750,8 @@ int spapr_rng_populate_dt(void *fdt); | ||||
|  */ | ||||
| #define SPAPR_MAX_RAM_SLOTS     32 | ||||
| 
 | ||||
| /* 1GB alignment for device memory region */ | ||||
| #define SPAPR_DEVICE_MEM_ALIGN (1ULL << 30) | ||||
| /* 1GB alignment for hotplug memory region */ | ||||
| #define SPAPR_DEVICE_MEM_ALIGN (1 * GiB) | ||||
| 
 | ||||
| /*
 | ||||
|  * Number of 32 bit words in each LMB list entry in ibm,dynamic-memory | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Philippe Mathieu-Daudé
						Philippe Mathieu-Daudé