From patchwork Fri Jan 13 14:11:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 641951 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp230143pvb; Fri, 13 Jan 2023 06:21:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoCg4wHbOhLTyhxiCvzLDRHXb6f7qAtRhrdpfuxcYGqOCfGZBBksH1XnFptm7Kw0YlrFpy X-Received: by 2002:ac8:754d:0:b0:3a9:8b1a:fe22 with SMTP id b13-20020ac8754d000000b003a98b1afe22mr103956329qtr.4.1673619706655; Fri, 13 Jan 2023 06:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673619706; cv=none; d=google.com; s=arc-20160816; b=V1wcMmkFvW09VLxKnWYBz9P7jwoQc5nBrvjEqr9GXsvtEpeYN2f/p+4/UbAyrgFBaC nxv6GCyCdOxn4WBqcwV2d/O/jRHQHgc4szildUWA5Jf6+cSur1wHfxNGEG4JxmH//smF ECpTiC4i8R1reTnR+A9Yn5IiqQbpjLwtx0Ftp1RfpYzgjghpnuLTiS+qeNUi2YdJJ6Md WnC7UI4CKLY6pYzilBLTET8+2BUv5kU+Nad8D+3yqFg/ByeDhoM9JKcsTT/ns9qxYy0U iwd1omy7W39O/k+l963TPTjP16J6qlzQJcYlFpBoVYbUEYsF85A8hEKMvBRntdhCFErS C2BA== 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=8kvFw5OaxUrQIg+Lm57FxJPCYrHar5GDxptYQDtd90o=; b=waEziz7YHOALIVnqXEGtC2tKwsSVNIMDrXPMJEyCesTPvH0yzVVjYvoipwKeG7DHw/ Yoi/TenjijvqyaP9c+4uYprw7KmrPUKzjyboH/noqwFdbkSvy2PFwmsApC9l1x6sFTLd TJtuAVZBc3fUWx0GoquEP0abvPXIpp4lk3Jb4n3HntT0QLEUcH/hrdj17hMe1pL4bg1X hoJVKThHtPEjmP5W4rY0e30JtFpSYw+hs4U3PiCNEMRyJpD+rHx6m3xiXoi4E5ytabkX /SE6+q3wVbu55HzHn1TYthcqg9qC9MiM9RsmOv5vvrPqZ9zR0O54+Kk8I79BtLelZ2/8 wQJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fLRZ51g+; 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 fe8-20020a05622a4d4800b003a811f36272si13277877qtb.306.2023.01.13.06.21.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jan 2023 06:21:46 -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=fLRZ51g+; 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 1pGKnF-0001TW-GO; Fri, 13 Jan 2023 09:12:29 -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 1pGKmk-00012R-BS for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:59 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGKmh-0003iJ-8x for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:57 -0500 Received: by mail-wm1-x32e.google.com with SMTP id ja17so15355266wmb.3 for ; Fri, 13 Jan 2023 06:11:44 -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=8kvFw5OaxUrQIg+Lm57FxJPCYrHar5GDxptYQDtd90o=; b=fLRZ51g+/LZcdByPJa1+EMN7RrBni5M3j3VCSCvBKpyClpmSFkacPNMhWYe/5yT833 jJzsKk0lnx0t3Gf673814ZZN4KuYnY8HeL6rsv96N7Ovf6G6lPm2UX9j5N7UYLeGcbUH C5+nJOERhrASxgc9Mr5oSv88G9m5CqUKHq8QqugJ3vrvneDc0yJewMMp2yjKEqgzXS46 Xn3A+501OsTWLA8QfapWZNxZk0Ne0uMaBSMP6Xj+aS+5ZSnTmqb3uiPNkKzhCQtkJPJG L2MCeuDUMSXrgjPiJNtBYUdn22zZLH8mloUhinxumlvkgLOLSZTSHU7QGUI96PzvBbiB ZmgA== 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=8kvFw5OaxUrQIg+Lm57FxJPCYrHar5GDxptYQDtd90o=; b=MLz7Ac7d4tL4ELC/7vyPCLxmljfWSiQWdm57qJTiXomPlkZzm2yD0oZn7w3agY0vKq QlL3fgkG6mki6i9QNb+/f/Iojk3liNOQu+/RaW1w+MUZcqSBVucc9sEA4yoG/2kTMdyu C8CNLI1/8uIQv/JCYKuQtS3PyjZoAXkhyaesFMlPpq0RCd4DpFU7D/Nldlmiz1d9GND4 /97fEcTfi6iZaXKTPO7m5wzgLICy69d3ZNZvt2ueVpFXDS2Ng6P0HJwX9m+VzFDl/ADO 7F9YsWdq9AKbAlP0GgVjSguata7JQSGUNsYQuGzPvpa+ROs6tTgsZaoxDGyvIkmOTtWH TFSQ== X-Gm-Message-State: AFqh2kqBP7jYVQY1dckApQbPmGREkieEpCnocn2Oj5rU5Sx9ZeGghah/ g2d7pfaP1+suLZSnieQcsSdxL2zSw8DjiKul X-Received: by 2002:a05:600c:2046:b0:3da:1357:4ca2 with SMTP id p6-20020a05600c204600b003da13574ca2mr5372565wmg.11.1673619103541; Fri, 13 Jan 2023 06:11:43 -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.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 06:11:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/38] hw/arm/musicpal: Use the IEC binary prefix definitions Date: Fri, 13 Jan 2023 14:11:06 +0000 Message-Id: <20230113141126.535646-19-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::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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-9-philmd@linaro.org Signed-off-by: Peter Maydell --- 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 b65c020115a..73e2b7e4cef 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);