From patchwork Wed Oct 24 13:22:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 12474 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 CDE9C23E29 for ; Wed, 24 Oct 2012 13:26:42 +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 63E86A187B8 for ; Wed, 24 Oct 2012 13:26:42 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so600601iej.11 for ; Wed, 24 Oct 2012 06:26:41 -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=x93njxEkUimnG8lIielehIbOssP4xQrG7X47b0mjCLQ=; b=mJRVvi86X8QCpf2Uv7NPb4UuN8oK3ONRyUJapSNva/4nVJInUOupMhl5s6zffxgkc+ pLUy6Ab0KM7FTZ6LXJJiPObvhwCxLx2mbrTr9AD0Hjf9ttO1r2QFSLemgOaEVX9ydW8X OqCqn0IFjNhz2Z61yHKM7Bd+8q/tZMrls5TFhJr6Ba4BmkYTcwz288CAYuwbtQfTM6CB h4JFvRMl2GNCHuqqZHV3TqFDP84g9I+JgSjERcCz9iYX06BQc4dGwBRNKJk7qdjuP+El DRT+JM14OuJ9n6C3TW4+v5UBPAxf8cnK4//Q+bkLlE1zYJ1reNLIXrGbP9vGd2D28JO2 JzgQ== Received: by 10.50.88.233 with SMTP id bj9mr2293178igb.70.1351085201727; Wed, 24 Oct 2012 06:26:41 -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 n20csp614277igt; Wed, 24 Oct 2012 06:26:40 -0700 (PDT) Received: by 10.180.106.2 with SMTP id gq2mr5943825wib.18.1351085200241; Wed, 24 Oct 2012 06:26:40 -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 by15si4512050wib.34.2012.10.24.06.26.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Oct 2012 06:26:40 -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 1TR0uL-0000yk-AP; Wed, 24 Oct 2012 14:22:05 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Eduardo Habkost Subject: [PATCH v2 5/8] hw/omap_sx1: Don't prematurely explode QEMUMachineInitArgs Date: Wed, 24 Oct 2012 14:22:01 +0100 Message-Id: <1351084924-3729-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1351084924-3729-1-git-send-email-peter.maydell@linaro.org> References: <1351084924-3729-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmxiRVCiiJ922IKkgyvot46ccwL8FFpi48at5xyfSeZl/RmLABxMnd4rxeclGDsOGz3OTiO 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 eb2bf05..21a5bbb 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 = {