From patchwork Fri Jan 13 14:11:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 641974 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp248485pvb; Fri, 13 Jan 2023 06:59:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXuteAFDllJzcpoD7l/lvCLAg8lHWN9gAeQ5CLPC4ykvjosznRsesagjCk+sCIJZo4Y+DpUD X-Received: by 2002:ad4:5407:0:b0:532:233a:c0c8 with SMTP id f7-20020ad45407000000b00532233ac0c8mr34641033qvt.9.1673621942359; Fri, 13 Jan 2023 06:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673621942; cv=none; d=google.com; s=arc-20160816; b=rQ/jhK7gWxgnEVdHJeIjGyNJpdQC5QbDd/atpULZDeLMm0MNl/3u+/ZROyJD9uJQ5D IRi4Ns5Zv/1yhASoml71z+8Z3nnIc05zwz1Gbb5HVs5/cNe6noVMuKKiPI3oYV45vxNw Hnmiu7RfCBUyEwQRjJYrafdJvcC28ltv4JvyheDFLyAKaqQCdxrK9pG1lmNk7Cqo0XM7 Mvd5B/xwK3RTIG7IymgNNV0yU5QlW6xzd7mrsTVYvHQNmOLZ9vMkMp7rGW1aO7E4KuJS Urk/j0SocmyBjM/Ho42zQhTHgLNDXd2f4YJZXYDm6g0tcfHHyIn3vhXU7mjMXYRAl5S8 yzvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4zdHeiITJEFYFvL/oVldM7ClF1Ud0kfLQubpqfkMy+k=; b=f2TepNesQs5rBOl9nqAc0q80pTjx7XAEILPyz/gvrbVId+jyFNEHPaRSIZ2tYMiEnJ K+LROX94gMvmelPuBwqZcsSybzFzEkYk+/9gZGZcbynojK2iUjeG5mhmFOXmix3PBJfj VE+PdZm4dGM3bWYPmyprWlDpyvCMrhFAa/GC3VEZvBgZOdtAauueyYTzjSsUYaBPZhWk O9tNKWE/oXl80IzGopi3c2DNJjDVL7wMsizYqyyQUbfhISwXHj9qWydVK9GFi320FGLO Ts9SGKW5wqK7y3bfSbMGx4TGquKg8xKm92jYxnI80qxUCT4bHM6AeoZBuNilRsoWqkPs FNCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXsVH5Nu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTP id gc15-20020a056214230f00b005342fb911ccsi3683622qvb.194.2023.01.13.06.59.02 for ; Fri, 13 Jan 2023 06:59:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXsVH5Nu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGKnJ-0001Wq-Qi; Fri, 13 Jan 2023 09:12:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGKml-00012q-L4 for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:59 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGKmh-0003hx-8s for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:59 -0500 Received: by mail-wm1-x32a.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so1129085wmc.1 for ; Fri, 13 Jan 2023 06:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4zdHeiITJEFYFvL/oVldM7ClF1Ud0kfLQubpqfkMy+k=; b=WXsVH5NuKAPkxdD0Lf8OUmIiiIW0tjTki/wm2mSN76e3ksW1zHuzCJEiANoIvnMRhO yqewPgqZQHwC60utBEObCgQJZ69IFWky5pSailAjTo7xJUUcde11rS8YUJO1Dit2Hmog HU+jrg5dVHcPz5Jo5RmLZ8VBbwumvMAfDbpuZOW1hb549hAwP3j3TBsM8K4h59AVohvF 5eKCyF56pr705MW8t23RZd1DFivsZqQda28ILoS78cm6ar/Jm1dRPk2g8Of/rPRGJime I8gGRwvoPpJt8e7ha00an67OOgAH+Y0P92DrkJARYtGQMPMTI+WlbXaPluhtSGnB45UJ An4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4zdHeiITJEFYFvL/oVldM7ClF1Ud0kfLQubpqfkMy+k=; b=CBy3RUAEsLYkh+BFg5zVX4FqbGRCnP84RQuq6rCfMmHCZ4nXW8+PGni+rfeDeHZBSn HB+cl1y3GBX5e4Z+hjbynAahNbgPybpmM3f3pVX+gnrx9XeDpLDjDPjhTh/yzQ02kwM8 wtr6s5aluNm2aw4gXx1NtZFUxEZRjK46zDXlze3tGTLmLJs+saTBU9xonysBBopYVpVr ywsfPrvFaW6y+sg8LvU34/WBdKL7wigszErJifcWmDOPT1ZI71YpI4uUvzBmv7s9fS3G cJEtWIlcyEzCkcV+n/gPcmFwc8uRrI3MkZLv9WGZ6kDAc6+7GxcO2oKX8rINxOPlPWgn dtew== X-Gm-Message-State: AFqh2kqCium1duXfXCRI+g51CWKuwLyEnaZ4lfdCcU5JnozVaQl6S2PW oXemN50M30G53nThHjuS4Kg0l4PrLOwGu08G X-Received: by 2002:a05:600c:c0d:b0:3d9:7667:c0e4 with SMTP id fm13-20020a05600c0c0d00b003d97667c0e4mr50204939wmb.31.1673619102720; Fri, 13 Jan 2023 06:11:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id n36-20020a05600c502400b003da0b75de94sm5334464wmr.8.2023.01.13.06.11.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 06:11:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/38] hw/arm/mainstone: Use the IEC binary prefix definitions Date: Fri, 13 Jan 2023 14:11:05 +0000 Message-Id: <20230113141126.535646-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113141126.535646-1-peter.maydell@linaro.org> References: <20230113141126.535646-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé IEC binary prefixes ease code review: the unit is explicit. Add the FLASH_SECTOR_SIZE definition. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20230109115316.2235-8-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/mainstone.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index f6293c6c13a..eebaed6e3ea 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -12,6 +12,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "hw/arm/pxa.h" @@ -99,19 +100,20 @@ static const struct keymap map[0xE0] = { enum mainstone_model_e { mainstone }; -#define MAINSTONE_RAM 0x04000000 -#define MAINSTONE_ROM 0x00800000 -#define MAINSTONE_FLASH 0x02000000 +#define MAINSTONE_RAM_SIZE (64 * MiB) +#define MAINSTONE_ROM_SIZE (8 * MiB) +#define MAINSTONE_FLASH_SIZE (32 * MiB) static struct arm_boot_info mainstone_binfo = { .loader_start = PXA2XX_SDRAM_BASE, - .ram_size = 0x04000000, + .ram_size = MAINSTONE_RAM_SIZE, }; +#define FLASH_SECTOR_SIZE (256 * KiB) + static void mainstone_common_init(MachineState *machine, enum mainstone_model_e model, int arm_id) { - uint32_t sector_len = 256 * 1024; hwaddr mainstone_flash_base[] = { MST_FLASH_0, MST_FLASH_1 }; PXA2xxState *mpu; DeviceState *mst_irq; @@ -121,7 +123,7 @@ static void mainstone_common_init(MachineState *machine, /* Setup CPU & memory */ mpu = pxa270_init(mainstone_binfo.ram_size, machine->cpu_type); - memory_region_init_rom(rom, NULL, "mainstone.rom", MAINSTONE_ROM, + memory_region_init_rom(rom, NULL, "mainstone.rom", MAINSTONE_ROM_SIZE, &error_fatal); memory_region_add_subregion(get_system_memory(), 0x00000000, rom); @@ -130,9 +132,9 @@ static void mainstone_common_init(MachineState *machine, dinfo = drive_get(IF_PFLASH, 0, i); if (!pflash_cfi01_register(mainstone_flash_base[i], i ? "mainstone.flash1" : "mainstone.flash0", - MAINSTONE_FLASH, + MAINSTONE_FLASH_SIZE, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - sector_len, 4, 0, 0, 0, 0, 0)) { + FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0)) { error_report("Error registering flash memory"); exit(1); }