From patchwork Sun Apr 28 00:32:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 240211 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 AAD782C0099 for ; Sun, 28 Apr 2013 10:33:20 +1000 (EST) Received: from localhost ([::1]:60449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWFYM-0006z6-NU for incoming@patchwork.ozlabs.org; Sat, 27 Apr 2013 20:33:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWFY8-0006xj-Ip for qemu-devel@nongnu.org; Sat, 27 Apr 2013 20:33:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWFY7-0000dX-EU for qemu-devel@nongnu.org; Sat, 27 Apr 2013 20:33:04 -0400 Received: from mout.web.de ([212.227.15.4]:58913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWFY4-0000cv-9g; Sat, 27 Apr 2013 20:33:00 -0400 Received: from localhost.localdomain ([84.148.23.16]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0M3k4b-1UoC6W0lGb-00qzpb; Sun, 28 Apr 2013 02:32:54 +0200 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 28 Apr 2013 02:32:48 +0200 Message-Id: <1367109168-3673-1-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Provags-ID: V02:K0:6BOSW/Oz/zWTEYZbM4X0QI+Kfvvp5JlqrW2bh2PqQ0r f8/qF6AUY6SBADvCq1JvcnqG78H3wontzb1WT8ejtl8jAApmLD tDl3s3ORGqvrfrBeuAts7USOE/zVOPzlDlgxRM65UgW9rKT+K1 PAzGRrtuU7ZwRHjUX6HnMrgRnxOJdLYGW9zudgtu/dBVAKkMd0 RR3sWsDswZRpfPF1bs0qw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.4 Cc: mark.cave-ayland@ilande.co.uk, Alexander Graf , chouteau@adacore.com, hpoussin@openbios.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , "open list:PReP" Subject: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios 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 This prepares for switching from OpenHack'Ware to OpenBIOS. Signed-off-by: Andreas Färber Acked-by: Hervé Poussineau --- hw/ppc/prep.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index cceab3e..9bb0119 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -41,6 +41,7 @@ #include "sysemu/blockdev.h" #include "sysemu/arch_init.h" #include "exec/address-spaces.h" +#include "elf.h" //#define HARD_DEBUG_PPC_IO //#define DEBUG_PPC_IO @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { - bios_size = get_image_size(filename); + bios_size = load_elf(filename, NULL, NULL, NULL, + NULL, NULL, 1, ELF_MACHINE, 0); + if (bios_size < 0) { + bios_size = get_image_size(filename); + if (bios_size > 0 && bios_size <= BIOS_SIZE) { + hwaddr bios_addr; + bios_size = (bios_size + 0xfff) & ~0xfff; + bios_addr = (uint32_t)(-bios_size); + bios_size = load_image_targphys(filename, bios_addr, bios_size); + } + } } else { bios_size = -1; } - if (bios_size > 0 && bios_size <= BIOS_SIZE) { - hwaddr bios_addr; - bios_size = (bios_size + 0xfff) & ~0xfff; - bios_addr = (uint32_t)(-bios_size); - bios_size = load_image_targphys(filename, bios_addr, bios_size); - } if (bios_size < 0 || bios_size > BIOS_SIZE) { - hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name); + fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", bios_name); } if (filename) { g_free(filename);