From patchwork Wed Mar 21 20:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10300359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 112AF602B3 for ; Wed, 21 Mar 2018 20:49:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4D27290A6 for ; Wed, 21 Mar 2018 20:49:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7FC4290B0; Wed, 21 Mar 2018 20:49:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 223D6290A6 for ; Wed, 21 Mar 2018 20:49:38 +0000 (UTC) Received: from localhost ([::1]:57352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykfx-0003cm-Dk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Mar 2018 16:49:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykeJ-000208-Eb for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eykeH-00023S-Pc for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:54 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:36668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eykeH-00022w-JK for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:47:53 -0400 Received: by mail-pf0-x241.google.com with SMTP id 68so2465089pfx.3 for ; Wed, 21 Mar 2018 13:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=etZGfs2I6eIUVzklmG0XvLcDBBdWMcIvQq939Ceof5k=; b=hezzqX7EnVJZ0bUMXiJt/r7pXbQVQSAVfDS3AwZ9Pla/K6wJU8fxyFlydGRoJjOSZN +Qhl34V14UK9fPug9UFpIu8RWyx/y7h0acP+IMyuB5aCq9oDMCjDUNaGYOXFiZ7beT0n B1XB8BeYFy0Gnmxj2qMColWSH28+LTv161A6AY6lXqM0tfQOFbByBlVSvscAzp+XsLBp CyUHwQTfzJPF7Co1XZyr+fnD20CqAVX0Nxezx8rvt1lkQF11k66bJIVTNbFdOWRlauMX XbsIAZw+024jvYNXJJywmIG/R3RL3YhjlX6MRP+7A1tzOqrk+hN8Zr0axwKdH39OyTOf mvVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=etZGfs2I6eIUVzklmG0XvLcDBBdWMcIvQq939Ceof5k=; b=n1dhamaCfMtkhr9YUIpGZau4qu9GvCxjOYptQgz9LFiyliU7iI8Bk5qMe6WAkEkUko 0QDcaU8B2llU92spZccCMILbgSY0PFYa+HHVvzfQ+V/9zV7wg3svl+JBJmA1SxYl9LdJ Al02yCDkkmLfV3l5kEsJOGI2GqS2n1BRhhF3vAgJKocWrOdkIlRgtHxc4p4mTPW62rE8 6KmBGs9oFMJbFpeA+Lb30EvB/R3FThLDdcx6QtbG8xs24mn+Zjq2sVwbVLWVhPDsXrXT oH7bBEsPe8LA3xST7/KcXPdCiYKoiWPkwWSak3Yq4gNAm2ve8XCIMcvL7mNeYu9ySRHG QBMg== X-Gm-Message-State: AElRT7GCs14yDmRogTJSXbBEn6xykO1ONicjEwvbxW4QbjFw34B1u7BK Y9OC1OMtk+16pXwo7D48JL6HwyulIJQ= X-Google-Smtp-Source: AG47ELtB512T54ejlOr4vdqXcG3Rg/IXqT9UOve9FhdRG0R7f7mOOmjza3RbYrDPxOckziBLwwXp8w== X-Received: by 10.99.131.73 with SMTP id h70mr15769453pge.195.1521665272517; Wed, 21 Mar 2018 13:47:52 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w10sm8244499pgr.57.2018.03.21.13.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Mar 2018 13:47:52 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 21 Mar 2018 13:46:40 -0700 Message-Id: <1521665220-3869-5-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521665220-3869-1-git-send-email-mjc@sifive.com> References: <1521665220-3869-1-git-send-email-mjc@sifive.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 04/24] RISC-V: Use ROM base address and size from memmap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@groups.riscv.org, Michael Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Another case of replacing hard coded constants, this time referring to the definition in the virt machine's memmap. Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Michael Clark Signed-off-by: Palmer Dabbelt Reviewed-by: Philippe Mathieu-Daudé --- hw/riscv/virt.c | 4 ++-- include/hw/riscv/virt.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 0055439..0d101fc 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -338,11 +338,11 @@ static void riscv_virt_board_init(MachineState *machine) }; /* copy in the reset vector */ - copy_le32_to_phys(ROM_BASE, reset_vec, sizeof(reset_vec)); + copy_le32_to_phys(memmap[VIRT_MROM].base, reset_vec, sizeof(reset_vec)); /* copy in the device tree */ qemu_fdt_dumpdtb(s->fdt, s->fdt_size); - cpu_physical_memory_write(ROM_BASE + sizeof(reset_vec), + cpu_physical_memory_write(memmap[VIRT_MROM].base + sizeof(reset_vec), s->fdt, s->fdt_size); /* create PLIC hart topology configuration string */ diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 2fbe808..655e85d 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -23,8 +23,6 @@ #define VIRT(obj) \ OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_BOARD) -enum { ROM_BASE = 0x1000 }; - typedef struct { /*< private >*/ SysBusDevice parent_obj;