From patchwork Thu Dec 11 23:29:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 420291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 20DBB1400DE for ; Fri, 12 Dec 2014 10:30:39 +1100 (AEDT) Received: from localhost ([::1]:54639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDBq-0004wW-84 for incoming@patchwork.ozlabs.org; Thu, 11 Dec 2014 18:30:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDB7-0003tV-P1 for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:29:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzDB1-0000hY-Lv for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:29:49 -0500 Received: from mail-pd0-f173.google.com ([209.85.192.173]:41400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzDB1-0000hP-GR for qemu-devel@nongnu.org; Thu, 11 Dec 2014 18:29:43 -0500 Received: by mail-pd0-f173.google.com with SMTP id ft15so5919381pdb.18 for ; Thu, 11 Dec 2014 15:29:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rbziD8WFeiF/O/S1yvydC3Vm6ujpRtUV2OuRRNBzYCo=; b=iHuVweo2ErBk93y/HzoUfnWrBYYxZ1ULR8ABautGjJ+Fd3HwVGtCrdTdzMr7av49fL sJxzRk1JPgGeVPEoFTJsHYDlPyqWBEdnCwdudNOdQE5W5jmSg/LATRKvq4HVjU0dijGR 6oOn/d/o0SSHtA29IIrn41BfINpBnU/ZLd6dSivniHOqjR2v6BzzpBpl1dgmpLnsI51s kZ/AeYHbDMhKGOLQGMptlHNsK2POsjJCaoDmnJOSVClRxJeNnohyQeoDUHFJ1QsjGTvj BuF8Pq5KWd3Ptm8D4ue2QK/tVSbgXbJsWbXTgJFzG0NdQyHDB0qvylBe/VUIQMJg1j0Z rJ+Q== X-Gm-Message-State: ALoCoQkOxstWjfcsv7Iw1h6UISZ+KVtvw35Uwq0USXNsfpAqxT8/kDvB3zzdrOgmw6zivIZiqowH X-Received: by 10.66.140.76 with SMTP id re12mr20726396pab.147.1418340582706; Thu, 11 Dec 2014 15:29:42 -0800 (PST) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id ip1sm2362908pbc.0.2014.12.11.15.29.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Dec 2014 15:29:41 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch, peter.maydell@linaro.org Date: Thu, 11 Dec 2014 17:29:15 -0600 Message-Id: <1418340569-30519-2-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1418340569-30519-1-git-send-email-greg.bellows@linaro.org> References: <1418340569-30519-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.173 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v2 01/15] target-arm: Add vexpress class and machine types 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 Adds base Vexpress class and machine objects and infrastructure. This is in preparation for switching to the full QEMU object model. The base vexpress infrastructure is intended to handle common vexpress details. Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v1 -> v2 - Made the vexpress class abstract --- hw/arm/vexpress.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 7cbd13f..01046c2 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -157,6 +157,23 @@ static hwaddr motherboard_aseries_map[] = { typedef struct VEDBoardInfo VEDBoardInfo; +typedef struct { + MachineClass parent; + VEDBoardInfo *daughterboard; +} VexpressMachineClass; + +typedef struct { + MachineState parent; +} VexpressMachineState; + +#define TYPE_VEXPRESS_MACHINE "vexpress" +#define VEXPRESS_MACHINE(obj) \ + OBJECT_CHECK(VexpressMachineState, (obj), TYPE_VEXPRESS_MACHINE) +#define VEXPRESS_MACHINE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VexpressMachineClass, obj, TYPE_VEXPRESS_MACHINE) +#define VEXPRESS_MACHINE_CLASS(klass) \ + OBJECT_CLASS_CHECK(VexpressMachineClass, klass, TYPE_VEXPRESS_MACHINE) + typedef void DBoardInitFn(const VEDBoardInfo *daughterboard, ram_addr_t ram_size, const char *cpu_model, @@ -681,6 +698,13 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard, arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo); } +static void vexpress_init(MachineState *machine) +{ + VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(machine); + + vexpress_common_init(vmc->daughterboard, machine); +} + static void vexpress_a9_init(MachineState *machine) { vexpress_common_init(&a9_daughterboard, machine); @@ -691,6 +715,26 @@ static void vexpress_a15_init(MachineState *machine) vexpress_common_init(&a15_daughterboard, machine); } +static void vexpress_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->name = TYPE_VEXPRESS_MACHINE; + mc->desc = "ARM Versatile Express"; + mc->init = vexpress_init; + mc->block_default_type = IF_SCSI; + mc->max_cpus = 4; +} + +static const TypeInfo vexpress_info = { + .name = TYPE_VEXPRESS_MACHINE, + .parent = TYPE_MACHINE, + .abstract = true, + .instance_size = sizeof(VexpressMachineState), + .class_size = sizeof(VexpressMachineClass), + .class_init = vexpress_class_init, +}; + static QEMUMachine vexpress_a9_machine = { .name = "vexpress-a9", .desc = "ARM Versatile Express for Cortex-A9", @@ -709,6 +753,7 @@ static QEMUMachine vexpress_a15_machine = { static void vexpress_machine_init(void) { + type_register_static(&vexpress_info); qemu_register_machine(&vexpress_a9_machine); qemu_register_machine(&vexpress_a15_machine); }