From patchwork Mon Jan 9 11:53:06 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: 640616 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2100103pvb; Mon, 9 Jan 2023 04:18:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXtcL6I6dW562cN1nUKiA/Sa8HplD2iA8ODwScbblEN1jCzhgp2Cd4VeJ/4Q/D5qcXlaRalg X-Received: by 2002:ac8:47c4:0:b0:3a7:e1d5:3429 with SMTP id d4-20020ac847c4000000b003a7e1d53429mr84015541qtr.22.1673266698810; Mon, 09 Jan 2023 04:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266698; cv=none; d=google.com; s=arc-20160816; b=CA6txpKlRC0q+fQ9WHruHWSLWGO8pMxombu3WVMHBv7sCKRhlniVCsN3hn0010XC9Z cqTjHHmeB5LP7LR5NZfXJyGVdddcGI7sW2WoOip7ZXnrAyHmLc9B9xkWEWwZ8JTZwdwO r4+ll3hJ3g/jogcaI2CoXQ7C+paA1QHBbBMh/XHgLlscfQYdP5eisD32W2TYc3zsfn7l AHfMJgKXzShQzsbdXWsqTt8Movm4cm6dIsrHN9x4PCecJVoa5d2HiUcJfYwx2xQQBj95 EYCqcU3nBu2LCS9GnV81j6cGULiZxA2nLV9pc88a2HqiqeTx23dF2GPIjzEEbSkOrbLL T53Q== 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=kABC6Dg8afXn22QWktdCfTPtG/Bv98gX9IL+lt9WyQQ=; b=lDP4E0/cPNlv/oblvSmBBpdQB2h6NV4PB4UetlOrKe/b/ynoZF+rAkaBaTpy+v0Hu9 aAzcOCxAANTN2utCqmwcJ2yW6+RT5oyHpFqRozAZAvNRlxzZIU8fIefO9vGMBIPu0tdM 6BLaxZYVbDk6a8miNsuJhTP5biY0a4NnxoJUkMNCjy0uqZ8En3Uh7uiqU39MWKgY+CGa sX9OOKQNsp71Z5D/8RFQxP0nrGQQtt1dYb9ogpAonC425Dy0zxw5esWMNKShrPNosyFh a6woBqhidNOOku0pdDY4kQ2pX4qdZ3j+qqNEZEA+cLj5U2Ch5bMOV+ZiO1JjyoJrCd9/ On1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MpY4iZiX; 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 b15-20020ac8678f000000b003a55c9ed459si4196883qtp.561.2023.01.09.04.18.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:18:18 -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=MpY4iZiX; 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 1pEqil-0002t8-Kk; Mon, 09 Jan 2023 06:53:43 -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 1pEqid-0002re-Iq for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:35 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqib-00082Z-Ss for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:35 -0500 Received: by mail-wm1-x331.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso6480301wmq.1 for ; Mon, 09 Jan 2023 03:53:33 -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=kABC6Dg8afXn22QWktdCfTPtG/Bv98gX9IL+lt9WyQQ=; b=MpY4iZiX5WIaoEoozJxdF8cC26tBpsQTe6o+9CeNBtAyqsEBH1emKIrLxEM+A8qBBw QyHaQUQBSRie0wFHpyW+VKScOudKrvYGYqLsAuRksLZOJW0P51NGY8IbaTeZ62npMLXS LNOo6JNc4fxZr7Mc23wmUr7x0O16A/ldOp5f3VwLM/MfTy0TWi6A1m20kN1O2kddPNEB FetHlSO5ayv7NSwc5OqG6yThPjgMWdmMe3/FvIlDX4OUWWR0+Q3lzTik74w5xtLeDBjK i6O/NixQs7CvhX24quiwoAnDde6cMqCW4DstQk8V9ZQHjPsus115ytlwQ8mJHIgTAtgq 3hIg== 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=kABC6Dg8afXn22QWktdCfTPtG/Bv98gX9IL+lt9WyQQ=; b=6sY0LS0HhJ03Mtv/1QVt63uJSsn6ALLlyKhTL12PYlxYtp97QBk9L43WDqxc5scUNF jO0LjQtmFCrdIobkuMIxbyhZfAyj2iH0e+IPbPX+y+CogyUbkInBt30LIJw3cNyVHpMo CBmo9iLxkfovgPkNSBpJe71youJ+r6CoYtNLkvV++Lkm98TZuwtnUHfYyuhwx4NAXHui 15csl5qwQ6hIzf2fieqHR4+DsevJGvT4cCdethPtkNmqCPLLKCf1thXOkeRfhYcNiyKq 4hUgT/YGfRxf8nH8lI1fl5pYpIIaNekHFa0jAPushH94Uqd+wZllyS1iUwf9wLt38Nah LeEw== X-Gm-Message-State: AFqh2kpjEZuhj/pP8pJ0CZquaKIqWuewV3M0pRzzbAg8hDH6z8nBKHAL AUhtP5rQgbeMAKeU1nWKwaoMwweILPZ2yHEw X-Received: by 2002:a05:600c:4fcf:b0:3d1:d396:1ade with SMTP id o15-20020a05600c4fcf00b003d1d3961ademr45806891wmq.9.1673265212398; Mon, 09 Jan 2023 03:53:32 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f28-20020a05600c491c00b003d9bd56e9c1sm10568247wmp.11.2023.01.09.03.53.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 03:53:32 -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 03/13] hw/arm/collie: Use the IEC binary prefix definitions Date: Mon, 9 Jan 2023 12:53:06 +0100 Message-Id: <20230109115316.2235-4-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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 definitions for RAM / Flash / Flash blocksize. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/collie.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 8df31e2793..d59c376e60 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -20,6 +20,10 @@ #include "cpu.h" #include "qom/object.h" +#define RAM_SIZE (512 * MiB) +#define FLASH_SIZE (32 * MiB) +#define FLASH_SECTOR_SIZE (64 * KiB) + struct CollieMachineState { MachineState parent; @@ -31,7 +35,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(CollieMachineState, COLLIE_MACHINE) static struct arm_boot_info collie_binfo = { .loader_start = SA_SDCS0, - .ram_size = 0x20000000, + .ram_size = RAM_SIZE, }; static void collie_init(MachineState *machine) @@ -52,14 +56,14 @@ static void collie_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram); dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000, + pflash_cfi01_register(SA_CS0, "collie.fl1", FLASH_SIZE, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0); + FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); dinfo = drive_get(IF_PFLASH, 0, 1); - pflash_cfi01_register(SA_CS1, "collie.fl2", 0x02000000, + pflash_cfi01_register(SA_CS1, "collie.fl2", FLASH_SIZE, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0); + FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); sysbus_create_simple("scoop", 0x40800000, NULL); @@ -75,7 +79,7 @@ static void collie_machine_class_init(ObjectClass *oc, void *data) mc->init = collie_init; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("sa1110"); - mc->default_ram_size = 0x20000000; + mc->default_ram_size = RAM_SIZE; mc->default_ram_id = "strongarm.sdram"; }