From patchwork Tue Feb 9 04:58:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 8258291 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51B3CBEEE5 for ; Tue, 9 Feb 2016 04:58:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9158120270 for ; Tue, 9 Feb 2016 04:58:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 973092026D for ; Tue, 9 Feb 2016 04:58:51 +0000 (UTC) Received: from localhost ([::1]:51848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT0O2-0004ge-NN for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 Feb 2016 23:58:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT0Nv-0004fZ-VM for qemu-devel@nongnu.org; Mon, 08 Feb 2016 23:58:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aT0Nu-0002u8-SC for qemu-devel@nongnu.org; Mon, 08 Feb 2016 23:58:43 -0500 Received: from avon.wwwdotorg.org ([70.85.31.133]:55113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT0Nq-0002tC-G1; Mon, 08 Feb 2016 23:58:38 -0500 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 4573664A5; Mon, 8 Feb 2016 21:58:37 -0700 (MST) Received: from dart.wwwdotorg.org (localhost [127.0.0.1]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id DF25DE40CA; Mon, 8 Feb 2016 21:58:36 -0700 (MST) From: Stephen Warren To: Peter Maydell Date: Mon, 8 Feb 2016 21:58:30 -0700 Message-Id: <1454993910-24077-1-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.9.1 X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.98.6 at avon.wwwdotorg.org X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 70.85.31.133 Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Andrew Baumann , Stephen Warren Subject: [Qemu-devel] [PATCH V2] bcm2835_property: implement "get board revision" query 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return a valid value from the BCM2835 property mailbox query "get board revision". This query is used by U-Boot. Implementing it fixes the first obvious difference between qemu and real HW. The value returned is currently hard-coded to match the RPi2 I own. Other values are legal, e.g. different board manufacturer field values are likely to exist in the wild. Cc: Andrew Baumann Signed-off-by: Stephen Warren Reviewed-by: Andrew Baumann --- V2: Set the property in raspi.c, and pass it through to the property mbox code via property aliases. hw/arm/bcm2835_peripherals.c | 2 ++ hw/arm/bcm2836.c | 2 ++ hw/arm/raspi.c | 2 ++ hw/misc/bcm2835_property.c | 4 ++-- include/hw/misc/bcm2835_property.h | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 18b72ecb696c..e4fb48b8035c 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -58,6 +58,8 @@ static void bcm2835_peripherals_init(Object *obj) /* Property channel */ object_initialize(&s->property, sizeof(s->property), TYPE_BCM2835_PROPERTY); object_property_add_child(obj, "property", OBJECT(&s->property), NULL); + object_property_add_alias(obj, "board-rev", OBJECT(&s->property), + "board-rev", &error_abort); qdev_set_parent_bus(DEVICE(&s->property), sysbus_get_default()); object_property_add_const_link(OBJECT(&s->property), "dma-mr", diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 69c7438317c4..8a4d13c7d973 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -39,6 +39,8 @@ static void bcm2836_init(Object *obj) TYPE_BCM2835_PERIPHERALS); object_property_add_child(obj, "peripherals", OBJECT(&s->peripherals), &error_abort); + object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals), + "board-rev", &error_abort); qdev_set_parent_bus(DEVICE(&s->peripherals), sysbus_get_default()); } diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 0c9427c40ec4..7d3d21ab3244 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -128,6 +128,8 @@ static void raspi2_init(MachineState *machine) &error_abort); object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus", &error_abort); + object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev", + &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort); setup_boot(machine, 2, machine->ram_size); diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index e42b43e72d56..45bd6c18ce90 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -43,8 +43,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen = 4; break; case 0x00010002: /* Get board revision */ - qemu_log_mask(LOG_UNIMP, - "bcm2835_property: %x get board revision NYI\n", tag); + stl_phys(&s->dma_as, value + 12, s->board_rev); resplen = 4; break; case 0x00010003: /* Get board MAC address */ @@ -258,6 +257,7 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp) } static Property bcm2835_property_props[] = { + DEFINE_PROP_UINT32("board-rev", BCM2835PropertyState, board_rev, 0), DEFINE_PROP_UINT32("ram-size", BCM2835PropertyState, ram_size, 0), DEFINE_PROP_END_OF_LIST() }; diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h index fcf5f3decafc..df889eaa08b5 100644 --- a/include/hw/misc/bcm2835_property.h +++ b/include/hw/misc/bcm2835_property.h @@ -23,6 +23,7 @@ typedef struct { MemoryRegion iomem; qemu_irq mbox_irq; MACAddr macaddr; + uint32_t board_rev; uint32_t ram_size; uint32_t addr; bool pending;