Patchwork [v3,25/26] q35: fill in usb pci slots with -usb

login
register
mail settings
Submitter Jason Baron
Date Oct. 19, 2012, 8:43 p.m.
Message ID <d8b0dbdba325773469733222a167b54aca74de55.1350677362.git.jbaron@redhat.com>
Download mbox | patch
Permalink /patch/192868/
State New
Headers show

Comments

Jason Baron - Oct. 19, 2012, 8:43 p.m.
From: Jason Baron <jbaron@redhat.com>

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 <jbaron@redhat.com>
---
 hw/ich9.h   |    5 ++++-
 hw/pc_q35.c |   11 ++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
Gerd Hoffmann - Oct. 22, 2012, 5:54 a.m.
Hi,

> +        pci_create_simple_multifunction(
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
> +            true, "ich9-usb-ehci1");
>          /* XXX: EHCI */

You can remove that comment now ;)

cheers,
  Gerd
Paolo Bonzini - Oct. 24, 2012, 5:10 p.m.
Il 19/10/2012 22:43, Jason Baron ha scritto:
> From: Jason Baron <jbaron@redhat.com>
> 
> 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 <jbaron@redhat.com>
> ---
>  hw/ich9.h   |    5 ++++-
>  hw/pc_q35.c |   11 ++++++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ich9.h b/hw/ich9.h
> index de49135..9e19266 100644
> --- a/hw/ich9.h
> +++ b/hw/ich9.h
> @@ -87,8 +87,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 ca30b65..bde3749 100644
> --- a/hw/pc_q35.c
> +++ b/hw/pc_q35.c
> @@ -185,8 +185,17 @@ static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state,
>      if (usb_enabled) {
>          /* 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),
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC),
>              true, "ich9-usb-uhci1");
> +        pci_create_simple_multifunction(
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI2_FUNC),
> +            true, "ich9-usb-uhci2");
> +        pci_create_simple_multifunction(
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI3_FUNC),
> +            true, "ich9-usb-uhci3");
> +        pci_create_simple_multifunction(
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
> +            true, "ich9-usb-ehci1");
>          /* XXX: EHCI */
>      }

Compared to docs/ich9-ehci-uhci.cfg, this is missing:

[device "uhci-1"]
  masterbus = "ehci.0"
  firstport = "0"

[device "uhci-2"]
  masterbus = "ehci.0"
  firstport = "2"

[device "uhci-3"]
  masterbus = "ehci.0"
  firstport = "4"

Paolo

Patch

diff --git a/hw/ich9.h b/hw/ich9.h
index de49135..9e19266 100644
--- a/hw/ich9.h
+++ b/hw/ich9.h
@@ -87,8 +87,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 ca30b65..bde3749 100644
--- a/hw/pc_q35.c
+++ b/hw/pc_q35.c
@@ -185,8 +185,17 @@  static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state,
     if (usb_enabled) {
         /* 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),
+            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC),
             true, "ich9-usb-uhci1");
+        pci_create_simple_multifunction(
+            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI2_FUNC),
+            true, "ich9-usb-uhci2");
+        pci_create_simple_multifunction(
+            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI3_FUNC),
+            true, "ich9-usb-uhci3");
+        pci_create_simple_multifunction(
+            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
+            true, "ich9-usb-ehci1");
         /* XXX: EHCI */
     }