From patchwork Thu Oct 25 23:54:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 194325 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 241202C0093 for ; Fri, 26 Oct 2012 10:54:38 +1100 (EST) Received: from localhost ([::1]:50333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRXFy-0001Ov-VD for incoming@patchwork.ozlabs.org; Thu, 25 Oct 2012 19:54:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRXFs-0001Oq-0C for qemu-devel@nongnu.org; Thu, 25 Oct 2012 19:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRXFq-0005TB-VD for qemu-devel@nongnu.org; Thu, 25 Oct 2012 19:54:27 -0400 Received: from mail-vc0-f173.google.com ([209.85.220.173]:63504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRXFq-0005T1-RA for qemu-devel@nongnu.org; Thu, 25 Oct 2012 19:54:26 -0400 Received: by mail-vc0-f173.google.com with SMTP id fl15so415803vcb.4 for ; Thu, 25 Oct 2012 16:54:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=JQRM5GMp0VIIwjcB2RKoYEYLu2ee/aBrEH1yN1u/d7M=; b=L6thqrREAP3H5kIStGLBgaF5Xa8mdcwc91zJUdANt/Fer1ltmnzh5pfY/xaQlcpz7F 3Wt2HhUoKmwQgI+FS589CJWXsW7O2HLemqX+r0kKpVzvOBk4jsimMj+o7aXpBtte9K3I 6z1m3e6cMug61IoVcj8fS4Sceg53jIN2DFWcvRBJ1yGb49NtKxNsJRVmybKd0lKl9f1e 36mkbSU3BgVERZKFi31kAZ6+w5WXyxFosL/Kw9RmkoMf9e5b+UWh+He/3UYHNb4N8eJR KgquFrl4qvmwt7czst1psI6a8bwhuHNQT3kRcMXwkSzQ0KECl5vPwAbusjysgmJhFjGo tXTg== MIME-Version: 1.0 Received: by 10.58.137.229 with SMTP id ql5mr39159012veb.11.1351209266044; Thu, 25 Oct 2012 16:54:26 -0700 (PDT) Received: by 10.58.198.114 with HTTP; Thu, 25 Oct 2012 16:54:26 -0700 (PDT) In-Reply-To: <5089485E.5090004@redhat.com> References: <50892CB0.6020706@redhat.com> <50893B33.5000908@redhat.com> <50894360.906@redhat.com> <5089485E.5090004@redhat.com> Date: Fri, 26 Oct 2012 09:54:26 +1000 X-Google-Sender-Auth: 8-PQmK2dmJxUWt6Dg6ulT-V8AEU Message-ID: From: Peter Crosthwaite To: Gerd Hoffmann X-Gm-Message-State: ALoCoQkfQZ7LEIg6ze8xWCGBIKI8PVvVvk+gkGwqu3V0iu/4YDRtkfLR3WDls444p9l8f8idwpxe X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.173 Cc: vineshp@xilinx.com, Peter Maydell , john.williams@xilinx.com, qemu-devel@nongnu.org, edgar.iglesias@gmail.com Subject: Re: [Qemu-devel] [PATCH v1 5/8] xilinx_zynq: add USB controllers 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 Copying patch inline to make some comments on it On Fri, Oct 26, 2012 at 12:10 AM, Gerd Hoffmann wrote: > Hi, > >> I'll go try that to simplify uhci ... > > Seems to work ... > > cheers, > Gerd > > diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index b6b972f..64442a4 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -88,6 +88,13 @@ enum { typedef struct UHCIState UHCIState; typedef struct UHCIAsync UHCIAsync; typedef struct UHCIQueue UHCIQueue; +typedef struct UHCIInfo UHCIInfo; + +struct UHCIInfo { + uint16_t vendor_id; + uint16_t device_id; + uint8_t revision; +}; /* * Pending async transaction. @@ -1293,17 +1300,18 @@ static Property uhci_properties[] = { DEFINE_PROP_END_OF_LIST(), }; -static void piix3_uhci_class_init(ObjectClass *klass, void *data) +static void uhci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + UHCIInfo *info = data; k->init = usb_uhci_common_initfn; k->exit = usb_uhci_exit; - k->vendor_id = PCI_VENDOR_ID_INTEL; - k->device_id = PCI_DEVICE_ID_INTEL_82371SB_2; - k->revision = 0x01; - k->class_id = PCI_CLASS_SERIAL_USB; + k->vendor_id = info->vendor_id; + k->device_id = info->device_id; + k->revision = info->revision; + k->class_id = PCI_CLASS_SERIAL_USB; dc->vmsd = &vmstate_uhci; dc->props = uhci_properties; } @@ -1312,29 +1320,24 @@ static TypeInfo piix3_uhci_info = { .name = "piix3-usb-uhci", .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(UHCIState), - .class_init = piix3_uhci_class_init, + .class_init = uhci_class_init, + .class_data = (UHCIInfo[]) { { + .vendor_id = PCI_VENDOR_ID_INTEL, + .device_id = PCI_DEVICE_ID_INTEL_82371SB_2, + .revision = 0x01, + } }, }; -static void piix4_uhci_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->init = usb_uhci_common_initfn; - k->exit = usb_uhci_exit; - k->vendor_id = PCI_VENDOR_ID_INTEL; - k->device_id = PCI_DEVICE_ID_INTEL_82371AB_2; - k->revision = 0x01; - k->class_id = PCI_CLASS_SERIAL_USB; - dc->vmsd = &vmstate_uhci; - dc->props = uhci_properties; -} - static TypeInfo piix4_uhci_info = { .name = "piix4-usb-uhci", .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(UHCIState), - .class_init = piix4_uhci_class_init, + .class_init = uhci_class_init, + .class_data = (UHCIInfo[]) { { + .vendor_id = PCI_VENDOR_ID_INTEL, + .device_id = PCI_DEVICE_ID_INTEL_82371AB_2, + .revision = 0x01, + } }, }; static void vt82c686b_uhci_class_init(ObjectClass *klass, void *data)