From patchwork Mon Feb 4 13:44:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 14528 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 B4AF823FEE for ; Mon, 4 Feb 2013 13:44:42 +0000 (UTC) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by fiordland.canonical.com (Postfix) with ESMTP id 50F3AA1918D for ; Mon, 4 Feb 2013 13:44:42 +0000 (UTC) Received: by mail-ve0-f181.google.com with SMTP id d10so4677184vea.40 for ; Mon, 04 Feb 2013 05:44:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=1nyt+Vf3L+yP5GIpcuAcA5oXV5kmNzoH5n0/AqpdCpY=; b=XS+EzejDUwCgZBnCc5UFAJPliQphu7/frqQ9GO4SmKjWSUhmycZt0cHXwmd9lFgsOp pQqVOQvG6+avMhrs49swuqYSOJLroUErLIWFle392MJptvPKKc518XTO2cL2V5f3n0Y2 CVbs9aVILtnlmxxhVeoNVpz/tMnDuJyqM1Vu/MUP2Dvb+xpxoz2YKsNlfUjYtB+Ru0hp pctfKiAUGZd4ZVLHRcO7db+gy3Z/6/5WEWrHq6PHrG12WZIEnTmaUP6gsHaKiGqoKQmW v8ElNYXtN1LlUJ31u1LUMuUYLC7ksaC46FZB5hIi6hY2huMZhQ4XjWsUtplCfzuqwAAQ lncA== X-Received: by 10.220.151.141 with SMTP id c13mr22258842vcw.64.1359985481829; Mon, 04 Feb 2013 05:44:41 -0800 (PST) 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.58.252.8 with SMTP id zo8csp87646vec; Mon, 4 Feb 2013 05:44:40 -0800 (PST) X-Received: by 10.194.123.105 with SMTP id lz9mr35457164wjb.43.1359985480358; Mon, 04 Feb 2013 05:44:40 -0800 (PST) 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 s2si3590487wif.66.2013.02.04.05.44.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 05:44:40 -0800 (PST) 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 1U2MLd-0007eL-1t; Mon, 04 Feb 2013 13:44:37 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Anthony Liguori Subject: [PATCH 01/10] hw/vexpress: Pass proc_id via VEDBoardInfo Date: Mon, 4 Feb 2013 13:44:27 +0000 Message-Id: <1359985476-29380-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1359985476-29380-1-git-send-email-peter.maydell@linaro.org> References: <1359985476-29380-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmBbBtz0XWY6fcsEiIiKNjcKU5YyIRH2/pt+pisBJZQqCC8Fq+n74BBEYPXbqDjeVGnVDcA Pass the daughterboard-specific proc_id property to the code that creates the sysctl device via the VEDBoardInfo struct, rather than by having the daughterboard init function write to a uint32_t* argument. This is a cleaner way to pass the info around, and is in line with the way we are going to handle voltage and oscillator initialization. Signed-off-by: Peter Maydell --- hw/vexpress.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/vexpress.c b/hw/vexpress.c index 741b044..d028382 100644 --- a/hw/vexpress.c +++ b/hw/vexpress.c @@ -147,19 +147,20 @@ typedef struct VEDBoardInfo VEDBoardInfo; typedef void DBoardInitFn(const VEDBoardInfo *daughterboard, ram_addr_t ram_size, const char *cpu_model, - qemu_irq *pic, uint32_t *proc_id); + qemu_irq *pic); struct VEDBoardInfo { const hwaddr *motherboard_map; hwaddr loader_start; const hwaddr gic_cpu_if_addr; + uint32_t proc_id; DBoardInitFn *init; }; static void a9_daughterboard_init(const VEDBoardInfo *daughterboard, ram_addr_t ram_size, const char *cpu_model, - qemu_irq *pic, uint32_t *proc_id) + qemu_irq *pic) { MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); @@ -175,8 +176,6 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard, cpu_model = "cortex-a9"; } - *proc_id = 0x0c000191; - for (n = 0; n < smp_cpus; n++) { ARMCPU *cpu = cpu_arm_init(cpu_model); if (!cpu) { @@ -251,13 +250,14 @@ static const VEDBoardInfo a9_daughterboard = { .motherboard_map = motherboard_legacy_map, .loader_start = 0x60000000, .gic_cpu_if_addr = 0x1e000100, + .proc_id = 0x0c000191, .init = a9_daughterboard_init, }; static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, ram_addr_t ram_size, const char *cpu_model, - qemu_irq *pic, uint32_t *proc_id) + qemu_irq *pic) { int n; MemoryRegion *sysmem = get_system_memory(); @@ -271,8 +271,6 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, cpu_model = "cortex-a15"; } - *proc_id = 0x14000237; - for (n = 0; n < smp_cpus; n++) { ARMCPU *cpu; qemu_irq *irqp; @@ -344,6 +342,7 @@ static const VEDBoardInfo a15_daughterboard = { .motherboard_map = motherboard_aseries_map, .loader_start = 0x80000000, .gic_cpu_if_addr = 0x2c002000, + .proc_id = 0x14000237, .init = a15_daughterboard_init, }; @@ -352,7 +351,6 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, { DeviceState *dev, *sysctl, *pl041; qemu_irq pic[64]; - uint32_t proc_id; uint32_t sys_id; DriveInfo *dinfo; ram_addr_t vram_size, sram_size; @@ -361,8 +359,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, MemoryRegion *sram = g_new(MemoryRegion, 1); const hwaddr *map = daughterboard->motherboard_map; - daughterboard->init(daughterboard, args->ram_size, args->cpu_model, - pic, &proc_id); + daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic); /* Motherboard peripherals: the wiring is the same but the * addresses vary between the legacy and A-Series memory maps. @@ -372,7 +369,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", sys_id); - qdev_prop_set_uint32(sysctl, "proc_id", proc_id); + qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id); qdev_init_nofail(sysctl); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]);