From patchwork Mon Jan 23 07:20:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peter A. G. Crosthwaite" X-Patchwork-Id: 137321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4E48FB6EF7 for ; Mon, 23 Jan 2012 20:28:00 +1100 (EST) Received: from localhost ([::1]:33207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpFKo-0003aW-BQ for incoming@patchwork.ozlabs.org; Mon, 23 Jan 2012 03:33:02 -0500 Received: from eggs.gnu.org ([140.186.70.92]:45105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpECL-00013T-28 for qemu-devel@nongnu.org; Mon, 23 Jan 2012 02:20:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpECK-0004bc-1B for qemu-devel@nongnu.org; Mon, 23 Jan 2012 02:20:13 -0500 Received: from mail-yw0-f45.google.com ([209.85.213.45]:60354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpECJ-0004bP-Td for qemu-devel@nongnu.org; Mon, 23 Jan 2012 02:20:11 -0500 Received: by yhr47 with SMTP id 47so1362056yhr.4 for ; Sun, 22 Jan 2012 23:20:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.77.232 with SMTP id d68mr8873425yhe.98.1327303211347; Sun, 22 Jan 2012 23:20:11 -0800 (PST) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id h43sm19791891yhj.2.2012.01.22.23.20.07 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 23:20:10 -0800 (PST) From: "Peter A. G. Crosthwaite" To: qemu-devel@nongnu.org, monstr@monstr.eu, john.williams@petalogix.com, peter.crosthwaite@petalogix.com, edgar.iglesias@petalogix.com, duyl@xilinx.com, linnj@xilinx.com Date: Mon, 23 Jan 2012 17:20:33 +1000 Message-Id: <165a2470ad991966fd591a7d85dd2dc9b45c1102.1327302677.git.peter.crosthwaite@petalogix.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQniw5HMHKacn+XaVfLr7huejJyMvQq87lhcdEtQdZx1sjS6D4UXVtnrbhTF67LYhC83NK3k X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.45 X-Mailman-Approved-At: Mon, 23 Jan 2012 03:32:26 -0500 Subject: [Qemu-devel] [RFC PATCH 6/7] arm_boot: added initrd address override X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org parameterised the initrd load address for arm boot process. Machine models can populate the initrd field with a non-zero address to specifiy that the default value of 0x00d00000 should be overridden. Signed-off-by: Peter A. G. Crosthwaite --- hw/arm-misc.h | 2 ++ hw/arm_boot.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/arm-misc.h b/hw/arm-misc.h index 6e8ae6b..89e90c9 100644 --- a/hw/arm-misc.h +++ b/hw/arm-misc.h @@ -29,6 +29,8 @@ struct arm_boot_info { const char *kernel_filename; const char *kernel_cmdline; const char *initrd_filename; + /* FIXME: support initrd load address = 0 somehow */ + target_phys_addr_t initrd_load_addr; target_phys_addr_t loader_start; target_phys_addr_t smp_loader_start; target_phys_addr_t smp_bootreg_addr; diff --git a/hw/arm_boot.c b/hw/arm_boot.c index bf509a8..d63ed3f 100644 --- a/hw/arm_boot.c +++ b/hw/arm_boot.c @@ -71,7 +71,8 @@ static void set_kernel_args(const struct arm_boot_info *info, /* ATAG_INITRD2 */ WRITE_WORD(p, 4); WRITE_WORD(p, 0x54420005); - WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); + WRITE_WORD(p, info->loader_start + info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR); WRITE_WORD(p, initrd_size); } if (info->kernel_cmdline && *info->kernel_cmdline) { @@ -148,7 +149,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info, WRITE_WORD(p, 0); /* initrd_start */ if (initrd_size) - WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR); + WRITE_WORD(p, info->loader_start + info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR); else WRITE_WORD(p, 0); /* initrd_size */ @@ -250,11 +252,13 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) } info->entry = entry; if (is_linux) { + target_phys_addr_t initrd_load_addr = info->initrd_load_addr ? + info->initrd_load_addr : INITRD_LOAD_ADDR; if (info->initrd_filename) { initrd_size = load_image_targphys(info->initrd_filename, info->loader_start - + INITRD_LOAD_ADDR, - ram_size - INITRD_LOAD_ADDR); + + initrd_load_addr, + ram_size - initrd_load_addr); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initrd '%s'\n", info->initrd_filename);