From patchwork Tue Oct 23 17:04:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 12446 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8749623E29 for ; Tue, 23 Oct 2012 17:04:39 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 337ADA188BF for ; Tue, 23 Oct 2012 17:04:39 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5437920iej.11 for ; Tue, 23 Oct 2012 10:04:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=MlAUxjpIopDvnrLJyjeUm8k5X/kC09mBUnQv6l7ilMA=; b=eseCqBp8bONW/VViWRzGoZcFz46ig11KQeRrCEE5BixAv132Kk8142HWWlbxRNuVm0 r87WHAUcMai6QQB7dQYVGmvT1/pzPl0jK7160eavvU9I4jj3UYKaBhMLWOpauou5YKmz krRiie57vY1PKPgOT/YM3xnpOy2Pp5fsWpcWcyT3DG4h5TO7bBTSBuf0U/yCRF9e/g8/ YTjkbDyYwEHx3hBtfH5tc85hCAD21kJNJkE8hV6Z311Aj1LVwgRBB5x4HSg7oXB8kl/Y uOX4QVuKMZfT5uyFsKwo7zNXWzz9LfezAicbJkBNjMKoZVJN2N/ySMX9zM607LZrZDTw c7jA== Received: by 10.50.95.161 with SMTP id dl1mr13667867igb.0.1351011878968; Tue, 23 Oct 2012 10:04:38 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp466109igt; Tue, 23 Oct 2012 10:04:37 -0700 (PDT) Received: by 10.68.248.1 with SMTP id yi1mr42395396pbc.93.1351011876719; Tue, 23 Oct 2012 10:04:36 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id m8si18009054pav.17.2012.10.23.10.04.35 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Oct 2012 10:04:36 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1TQhu2-0000Rh-Rr; Tue, 23 Oct 2012 18:04:30 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Eduardo Habkost Subject: [PATCH 5/7] hw/omap_sx1: Don't prematurely explode QEMUMachineInitArgs Date: Tue, 23 Oct 2012 18:04:28 +0100 Message-Id: <1351011870-1680-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1351011870-1680-1-git-send-email-peter.maydell@linaro.org> References: <1351011870-1680-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkAPnJHt59qCePvW179iW1CFHmvlhG37JsCLhbRAITLe4osEgXNBFNjqxra1eKeP1yKRxuY Don't explode QEMUMachineInitArgs before passing it to the omap_sx1 common init function. Signed-off-by: Peter Maydell --- hw/omap_sx1.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c index ad17487..7474f2d 100644 --- a/hw/omap_sx1.c +++ b/hw/omap_sx1.c @@ -97,11 +97,7 @@ static struct arm_boot_info sx1_binfo = { .board_id = 0x265, }; -static void sx1_init(ram_addr_t ram_size, - const char *boot_device, - const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename, const char *cpu_model, - const int version) +static void sx1_init(QEMUMachineInitArgs *args, const int version) { struct omap_mpu_state_s *mpu; MemoryRegion *address_space = get_system_memory(); @@ -121,7 +117,7 @@ static void sx1_init(ram_addr_t ram_size, flash_size = flash2_size; } - mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, cpu_model); + mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, args->cpu_model); /* External Flash (EMIFS) */ memory_region_init_ram(flash, "omap_sx1.flash0-0", flash_size); @@ -192,16 +188,16 @@ static void sx1_init(ram_addr_t ram_size, OMAP_CS1_BASE, &cs[1]); } - if (!kernel_filename && !fl_idx) { + if (!args->kernel_filename && !fl_idx) { fprintf(stderr, "Kernel or Flash image must be specified\n"); exit(1); } /* Load the kernel. */ - if (kernel_filename) { - sx1_binfo.kernel_filename = kernel_filename; - sx1_binfo.kernel_cmdline = kernel_cmdline; - sx1_binfo.initrd_filename = initrd_filename; + if (args->kernel_filename) { + sx1_binfo.kernel_filename = args->kernel_filename; + sx1_binfo.kernel_cmdline = args->kernel_cmdline; + sx1_binfo.initrd_filename = args->initrd_filename; arm_load_kernel(mpu->cpu, &sx1_binfo); } @@ -211,26 +207,12 @@ static void sx1_init(ram_addr_t ram_size, static void sx1_init_v1(QEMUMachineInitArgs *args) { - ram_addr_t ram_size = args->ram_size; - const char *cpu_model = args->cpu_model; - const char *kernel_filename = args->kernel_filename; - const char *kernel_cmdline = args->kernel_cmdline; - const char *initrd_filename = args->initrd_filename; - const char *boot_device = args->boot_device; - sx1_init(ram_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model, 1); + sx1_init(args, 1); } static void sx1_init_v2(QEMUMachineInitArgs *args) { - ram_addr_t ram_size = args->ram_size; - const char *cpu_model = args->cpu_model; - const char *kernel_filename = args->kernel_filename; - const char *kernel_cmdline = args->kernel_cmdline; - const char *initrd_filename = args->initrd_filename; - const char *boot_device = args->boot_device; - sx1_init(ram_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model, 2); + sx1_init(args, 2); } static QEMUMachine sx1_machine_v2 = {