From patchwork Tue Oct 30 02:11:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 195264 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 7B2DA2C008C for ; Tue, 30 Oct 2012 13:47:45 +1100 (EST) Received: from localhost ([::1]:34237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT1KN-0000yi-M5 for incoming@patchwork.ozlabs.org; Mon, 29 Oct 2012 22:13:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT1Ik-0005b8-Tg for qemu-devel@nongnu.org; Mon, 29 Oct 2012 22:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TT1Ij-0001TA-R7 for qemu-devel@nongnu.org; Mon, 29 Oct 2012 22:11:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT1Ij-0001Sy-Io for qemu-devel@nongnu.org; Mon, 29 Oct 2012 22:11:33 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9U2BVDP015526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Oct 2012 22:11:31 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9U2BU4l010016; Mon, 29 Oct 2012 22:11:30 -0400 Date: Mon, 29 Oct 2012 22:11:30 -0400 From: Jason Baron To: qemu-devel@nongnu.org Message-Id: <66b81e2e5ffe78ac446fe4ba0a28e748595b7bf6.1351561225.git.jbaron@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, juzhang@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, armbru@redhat.com, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, kevin@koconnor.net, avi@redhat.com, gsomlo@gmail.com, mkletzan@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de, kraxel@redhat.com Subject: [Qemu-devel] [PATCH v1 12/13] q35: fill in usb pci slots with -usb 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 From: Jason Baron This fills out the usb slots on q35, when -usb is passed. We now have (lspci output): 00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03) 00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03) 00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03) 00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03) Signed-off-by: Jason Baron --- hw/ich9.h | 5 ++++- hw/pc_q35.c | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/ich9.h b/hw/ich9.h index 10c6d47..c4d04a7 100644 --- a/hw/ich9.h +++ b/hw/ich9.h @@ -86,8 +86,11 @@ typedef struct ICH9LPCState { /* D29:F0 USB UHCI Controller #1 */ -#define ICH9_USB_UHCI1_DEV 29 +#define ICH9_USB_DEV 29 #define ICH9_USB_UHCI1_FUNC 0 +#define ICH9_USB_UHCI2_FUNC 1 +#define ICH9_USB_UHCI3_FUNC 2 +#define ICH9_USB_EHCI1_FUNC 7 /* D30:F0 DMI-to-PCI brdige */ #define ICH9_D2P_BRIDGE "ICH9 D2P BRIDGE" diff --git a/hw/pc_q35.c b/hw/pc_q35.c index a9a7f6c..714aeaf 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -191,11 +191,29 @@ static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state, idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); if (usb_enabled(false)) { + int i; + PCIDevice *usb; + DeviceState *usb_qdev; + char uhci_devname[] = "ich9-usb-uhciX"; + /* Should we create 6 UHCI according to ich9 spec? */ - pci_create_simple_multifunction( - host_bus, PCI_DEVFN(ICH9_USB_UHCI1_DEV, ICH9_USB_UHCI1_FUNC), - true, "ich9-usb-uhci1"); - /* XXX: EHCI */ + usb = pci_create_multifunction( + host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC), + true, "ich9-usb-ehci1"); + usb_qdev = &usb->qdev; + usb_qdev->id = g_strdup("ich9-usb-bus"); + qdev_init_nofail(usb_qdev); + + for (i = 0; i < 3; i++) { + uhci_devname[sizeof(uhci_devname) - 2] = ((char)'1') + i; + usb = pci_create_multifunction( + host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC + i), + true, uhci_devname); + usb_qdev = &usb->qdev; + qdev_prop_set_string(usb_qdev, "masterbus", "ich9-usb-bus.0"); + qdev_prop_set_uint32(usb_qdev, "firstport", i * 2); + qdev_init_nofail(usb_qdev); + } } /* TODO: Populate SPD eeprom data. */