From patchwork Sun Dec 2 02:57:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 203183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C49722C007B for ; Sun, 2 Dec 2012 14:21:24 +1100 (EST) Received: from localhost ([::1]:59573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TezlA-00066d-BJ for incoming@patchwork.ozlabs.org; Sat, 01 Dec 2012 21:58:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TezkO-0003wU-FS for qemu-devel@nongnu.org; Sat, 01 Dec 2012 21:57:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TezkN-00068Z-BQ for qemu-devel@nongnu.org; Sat, 01 Dec 2012 21:57:36 -0500 Received: from mout.web.de ([212.227.15.3]:62256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TezkN-00068L-2i for qemu-devel@nongnu.org; Sat, 01 Dec 2012 21:57:35 -0500 Received: from localhost.localdomain ([62.157.70.37]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MRUC0-1TlZLP1eJs-00SvbL; Sun, 02 Dec 2012 03:57:31 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 2 Dec 2012 03:57:19 +0100 Message-Id: <1354417042-8818-3-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1354417042-8818-1-git-send-email-andreas.faerber@web.de> References: <1354417042-8818-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Provags-ID: V02:K0:doOKMVJkjC/NHlx5pxZbk+KcEeDCT++NqRbd2sLqTmg Tr+mGBvMiza//jgwD+SgB7LImhuUWojygXGVjcZ4Xvpg+DqngZ uNCtOreoQtiphEa3+MTlBI5tE0sOwCzCpJ8LKq7NuvUiowQsva kaafuOCwgJTNDCjryYcL6Qih+gxKxRrCc0oPBoLqHSV5Mkpkt6 TTjHdeNinX92IL3fHcM5Q== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.3 Cc: peter.crosthwaite@xilinx.com, walimisdev@gmail.com, kraxel@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH RFT 2/5] usb/ehci: Move capsbase and opregbase into SysBus EHCI class 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 This allows specific derived models to use different values. Signed-off-by: Andreas Färber Reviewed-by: Igor Mitsyanko --- hw/usb/hcd-ehci-sysbus.c | 26 ++++++++++++++++++++++++-- 1 Datei geändert, 24 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index c7b68b2..38e82bb 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -21,6 +21,17 @@ #define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" #define SYS_BUS_EHCI(obj) \ OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI) +#define SYS_BUS_EHCI_CLASS(class) \ + OBJECT_CLASS_CHECK(SysBusEHCIClass, (class), TYPE_SYS_BUS_EHCI) +#define SYS_BUS_EHCI_GET_CLASS(obj) \ + OBJECT_GET_CLASS(SysBusEHCIClass, (obj), TYPE_SYS_BUS_EHCI) + +typedef struct SysBusEHCIClass { + SysBusDeviceClass parent_class; + + uint16_t capsbase; + uint16_t opregbase; +} SysBusEHCIClass; typedef struct EHCISysBusState { SysBusDevice parent_obj; @@ -46,10 +57,11 @@ static Property ehci_sysbus_properties[] = { static int usb_ehci_sysbus_initfn(SysBusDevice *dev) { EHCISysBusState *i = SYS_BUS_EHCI(dev); + SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev); EHCIState *s = &i->ehci; - s->capsbase = 0x100; - s->opregbase = 0x140; + s->capsbase = sec->capsbase; + s->opregbase = sec->opregbase; s->dma = &dma_context_memory; usb_ehci_initfn(s, DEVICE(dev)); @@ -74,11 +86,21 @@ static const TypeInfo ehci_type_info = { .instance_size = sizeof(EHCISysBusState), .abstract = true, .class_init = ehci_sysbus_class_init, + .class_size = sizeof(SysBusEHCIClass), }; +static void ehci_xlnx_class_init(ObjectClass *oc, void *data) +{ + SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); + + sec->capsbase = 0x100; + sec->opregbase = 0x140; +} + static const TypeInfo ehci_xlnx_type_info = { .name = "xlnx,ps7-usb", .parent = TYPE_SYS_BUS_EHCI, + .class_init = ehci_xlnx_class_init, }; static void ehci_sysbus_register_types(void)