From patchwork Mon Jan 9 11:53:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640615 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2099279pvb; Mon, 9 Jan 2023 04:16:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0IchbWfVvKHxmYbcxnR8DHTTTH/zMsRdI1arF3BSFnY0PvXk5+2yBNmOf+KMrEktKhfHC X-Received: by 2002:a05:622a:1b12:b0:3a8:a6f:fb7 with SMTP id bb18-20020a05622a1b1200b003a80a6f0fb7mr88196805qtb.11.1673266580890; Mon, 09 Jan 2023 04:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266580; cv=none; d=google.com; s=arc-20160816; b=zbWSqkvKN/Al8Us5NUvFr2RbRjitHpYGMg2R2goXLyeAUshmzw5p0IHh1YUk8dhqel 6I4xTDyCVGFxLcQwABHs4Af93Lim/Ww2N0klkjPdtxW+6xoVZ7v8vcsk6sgrbODtSnWp 0DzDHRU5WTQa0hi33L3XzILK31ZFkeAzpqJk3gBJgjkNHIDpNegwhuNfY/MquG7VlB1a Dj5LdQ15mbWblU8FpRm/IQsV75h9QI7ePLdSo2TTpFUNeNMrv8J11EUMWj5jHdTxrNC7 p2nlVy5sHyrn8PMJhwBtaL4xFwH8NyjWQMBaGJ0Bk73+on69ZpQxksMJDtzMAsK8rnZt utqQ== 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:cc:to :from:dkim-signature; bh=7S4AtrItDHw6gjUi/DcC6OrJFm3Uy3mqWC4OtemhbH0=; b=rJSTuFHxYz5FVmHZeC76VIsGlog/1xXrbAG2UmRim/xSMrNSRsXJuixLDvvJNe72qI s2Qw74CxQVd/+VWzgiS9Yujcv7FUOdOvNnBJt2teahyA/QCcBFgvFlxb5ElRnN7z1Sd7 5SlsLqTxh9/3WV1EtcjuIdEDu12bAqESqSX2dk9FPVSgbxZ4Cl9by0fjKzeK3xByWk8S E2VNHrQzOT8gumP/v75zXxyNR/ntsaPriRvQkN1iFpXW2GcmsH0Pht8IugoI96c1xCXV ipdxXRly5cW0Ed1kAe1CIAVF3gN4zOpObYeA72dlY928fKQhkAq9Hz0EfEUd0tEh1/BA SnSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pePx4DCv; 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 ESMTPS id e25-20020ac845d9000000b003a4f2a458d0si4250475qto.400.2023.01.09.04.16.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:16:20 -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=pePx4DCv; 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 1pEqj3-00037a-Bw; Mon, 09 Jan 2023 06:54:01 -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 1pEqj1-000372-V9 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:59 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqj0-00088K-FR for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:59 -0500 Received: by mail-wr1-x435.google.com with SMTP id w1so7885021wrt.8 for ; Mon, 09 Jan 2023 03:53:58 -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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7S4AtrItDHw6gjUi/DcC6OrJFm3Uy3mqWC4OtemhbH0=; b=pePx4DCvFpr8t3cPEDuEXDalYvRffpzgmGQGamHsL1EOAkOREfaNq+rqiSnjahYXQC J0gDBwsga221inhUAmFBKWkx+eS7def5xLicwtg4YNpaVKAEJ5tHVCdwwD2DM0IDKYCz DjDkUeUyO93xME5SE/OIqbMGE66wkbpxLU5zGygju04/PsTEv3pTlASizbOqwB5/hSsb 34+BaYmezJZip6AupL3JhpHzm98AQ5dgBWFfEJ7p3N7k7S9IV28aegNyBS2tRvgr4C7R 4DPlqFR7RhDLHn6iWYONVI8VwiiKWUUMhG5o4oZsn7iMSPM2v81rWuqWHIoJhAaga3KL 58Kg== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7S4AtrItDHw6gjUi/DcC6OrJFm3Uy3mqWC4OtemhbH0=; b=ngEBw8LHJbSfEFr3Sp3c9rVdquTZdBo4gyVjdnvFnkol2wsWPHjmPUnrCaa7rF89D8 zK3G1CVjVKoP8cHMiIni7BgSnKH5cGXtnObp2oVrPixrvv/WIUJPbLMvzIveTVkEnbVx uBDSIRCZ3QK2V6U2e+ARj/IlJoK5Q3kLe3PJra2J8alocaKdne/9TY2en6d2GQgaFdZX Y7/7lSPk324GtnZaj8Lgv+nhQ37vTXvFoGieyJTwtvXdnpWfwg2uWg2NRlEGP8b29+zF XbPQV8+XZmQsdsGR621/yylvoQ+ImZZsRsbJDkTqAUkW4mzTtdrDr/pRVsascJuJDrjD ZODA== X-Gm-Message-State: AFqh2kosRhg4HRf8qTCeRbZKfYVrOCVhKay0NkwH2Eyz1biLMqxsoNdP r2CNPO8mRdn3xLrxFjEnOhtq9fFyUuvwetqG X-Received: by 2002:adf:eb09:0:b0:2aa:1121:1b79 with SMTP id s9-20020adfeb09000000b002aa11211b79mr11348107wrn.25.1673265236995; Mon, 09 Jan 2023 03:53:56 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id m5-20020adfdc45000000b002428c4fb16asm8528588wrj.10.2023.01.09.03.53.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 03:53:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Jan Kiszka , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 08/13] hw/arm/musicpal: Use the IEC binary prefix definitions Date: Mon, 9 Jan 2023 12:53:11 +0100 Message-Id: <20230109115316.2235-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109115316.2235-1-philmd@linaro.org> References: <20230109115316.2235-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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=unavailable 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 IEC binary prefixes ease code review: the unit is explicit. Add the FLASH_SECTOR_SIZE definition. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/musicpal.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index b65c020115..73e2b7e4ce 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "cpu.h" #include "hw/sysbus.h" @@ -1196,6 +1197,8 @@ static const TypeInfo musicpal_key_info = { .class_init = musicpal_key_class_init, }; +#define FLASH_SECTOR_SIZE (64 * KiB) + static struct arm_boot_info musicpal_binfo = { .loader_start = 0x0, .board_id = 0x20e, @@ -1264,8 +1267,8 @@ static void musicpal_init(MachineState *machine) BlockBackend *blk = blk_by_legacy_dinfo(dinfo); flash_size = blk_getlength(blk); - if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && - flash_size != 32*1024*1024) { + if (flash_size != 8 * MiB && flash_size != 16 * MiB && + flash_size != 32 * MiB) { error_report("Invalid flash image size"); exit(1); } @@ -1277,7 +1280,7 @@ static void musicpal_init(MachineState *machine) */ pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, "musicpal.flash", flash_size, - blk, 0x10000, + blk, FLASH_SECTOR_SIZE, MP_FLASH_SIZE_MAX / flash_size, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA, 0);