From patchwork Sun Mar 4 11:03:55 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: 144490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 99F98B6F9D for ; Sun, 4 Mar 2012 22:05:26 +1100 (EST) Received: from localhost ([::1]:46536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S49Fj-0006db-Py for incoming@patchwork.ozlabs.org; Sun, 04 Mar 2012 06:05:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S49F4-0004vi-Lu for qemu-devel@nongnu.org; Sun, 04 Mar 2012 06:05:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S49F2-00086v-M4 for qemu-devel@nongnu.org; Sun, 04 Mar 2012 06:04:42 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:63878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S49F2-0007rX-FW for qemu-devel@nongnu.org; Sun, 04 Mar 2012 06:04:40 -0500 Received: by mail-pw0-f45.google.com with SMTP id uo5so3115132pbc.4 for ; Sun, 04 Mar 2012 03:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of peter.crosthwaite@petalogix.com designates 10.68.228.193 as permitted sender) client-ip=10.68.228.193; Authentication-Results: mr.google.com; spf=pass (google.com: domain of peter.crosthwaite@petalogix.com designates 10.68.228.193 as permitted sender) smtp.mail=peter.crosthwaite@petalogix.com Received: from mr.google.com ([10.68.228.193]) by 10.68.228.193 with SMTP id sk1mr36812906pbc.60.1330859079531 (num_hops = 1); Sun, 04 Mar 2012 03:04:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.228.193 with SMTP id sk1mr31340276pbc.60.1330859079478; Sun, 04 Mar 2012 03:04:39 -0800 (PST) Received: from localhost (d58-106-136-119.rdl802.qld.optusnet.com.au. [58.106.136.119]) by mx.google.com with ESMTPS id p9sm10243703pbb.9.2012.03.04.03.04.34 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Mar 2012 03:04:37 -0800 (PST) From: "Peter A. G. Crosthwaite" To: qemu-devel@nongnu.org, edgar.iglesias@gmail.com, john.williams@petalogix.com Date: Sun, 4 Mar 2012 21:03:55 +1000 Message-Id: X-Mailer: git-send-email 1.7.5.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQn9xq9QfE56pzm1G/+wArIoafGlLe5MdccMcZ0BQuqPBPNBa22hxsmhqLj0TrsV+MnJaSOp X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: "Peter A. G. Crosthwaite" , peter.maydell@linaro.org, paul@codesourcery.com Subject: [Qemu-devel] [PATCH v1 5/5] microblaze_boot: enabled -dtb argument 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 From: "Peter A. G. Crosthwaite" Use the -dtb argument for passing is a custom dtb rather than the old hardcoded "mb.dtb" Signed-off-by: Peter A. G. Crosthwaite --- hw/microblaze_boot.c | 34 ++++++++++++++-------------------- 1 files changed, 14 insertions(+), 20 deletions(-) diff --git a/hw/microblaze_boot.c b/hw/microblaze_boot.c index 37fce50..b2f96df 100644 --- a/hw/microblaze_boot.c +++ b/hw/microblaze_boot.c @@ -59,23 +59,16 @@ static int microblaze_load_dtb(target_phys_addr_t addr, const char *kernel_cmdline, const char *dtb_filename) { - char *path; int fdt_size; #ifdef CONFIG_FDT - void *fdt; + void *fdt = NULL; int r; - /* Try the local "mb.dtb" override. */ - fdt = load_device_tree("mb.dtb", &fdt_size); + if (dtb_filename) { + fdt = load_device_tree(dtb_filename, &fdt_size); + } if (!fdt) { - path = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); - if (path) { - fdt = load_device_tree(path, &fdt_size); - g_free(path); - } - if (!fdt) { - return 0; - } + return 0; } if (kernel_cmdline) { @@ -90,15 +83,9 @@ static int microblaze_load_dtb(target_phys_addr_t addr, #else /* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob to the kernel. */ - fdt_size = load_image_targphys("mb.dtb", addr, 0x10000); - if (fdt_size < 0) { - path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE); - if (path) { - fdt_size = load_image_targphys(path, addr, 0x10000); - g_free(path); - } + if (dtb_filename) { + fdt_size = load_image_targphys(dtb_filename, addr, 0x10000); } - if (kernel_cmdline) { fprintf(stderr, "Warning: missing libfdt, cannot pass cmdline to kernel!\n"); @@ -123,8 +110,15 @@ void microblaze_load_kernel(CPUState *env, target_phys_addr_t ddr_base, machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { + const char *dtb_arg; kernel_filename = qemu_opt_get(machine_opts, "kernel"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); + dtb_arg = qemu_opt_get(machine_opts, "dtb"); + if (dtb_arg) { /* Preference a -dtb argument */ + dtb_filename = dtb_arg; + } else { /* default to pcbios dtb as passed by machine_init */ + dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); + } } boot_info.machine_cpu_reset = machine_cpu_reset;