All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] patch for USB issues
@ 2006-02-16 20:06 Krister Walfridsson
  2006-02-17  4:41 ` Lonnie Mendez
  0 siblings, 1 reply; 3+ messages in thread
From: Krister Walfridsson @ 2006-02-16 20:06 UTC (permalink / raw)
  To: qemu-devel

I'm playing with the USB code, but I cannot get the USB mouse emulation
to work with the guests I have tried (NetBSD and Win2k).  Attached are 
two patches that improves the situation somewhat.

* hw/usb-uhci.c
      The PCI configuration registers are set up with an incorrect
      offset for USBBASE and uninitialized SBRN.  This makes NetBSD
      complain that this is not a valid UHCI controller.
* hw/usb.c
      The length field of the returned descriptor strings are
      incorrect, which trunkates the returned strings.

There are some additional problems with the hub emulation that I hope
to get the time to fix during the weekend.

    /Krister



Index: usb-uhci.c
===================================================================
RCS file: /sources/qemu/qemu/hw/usb-uhci.c,v
retrieving revision 1.4
diff -b -u -p -r1.4 usb-uhci.c
--- usb-uhci.c	19 Nov 2005 17:43:37 -0000	1.4
+++ usb-uhci.c	16 Feb 2006 20:02:52 -0000
@@ -654,6 +654,7 @@ void usb_uhci_init(PCIBus *bus, USBPort
      pci_conf[0x0b] = 0x0c;
      pci_conf[0x0e] = 0x00; // header_type
      pci_conf[0x3d] = 4; // interrupt pin 3
+    pci_conf[0x60] = 0x11; // USB 1.1

      for(i = 0; i < NB_PORTS; i++) {
          port = &s->ports[i];
@@ -666,6 +667,6 @@ void usb_uhci_init(PCIBus *bus, USBPort

      uhci_reset(s);

-    pci_register_io_region(&s->dev, 0, 0x20, 
+    pci_register_io_region(&s->dev, 4, 0x20,
                             PCI_ADDRESS_SPACE_IO, uhci_map);
  }
Index: usb.c
===================================================================
RCS file: /sources/qemu/qemu/hw/usb.c,v
retrieving revision 1.3
diff -b -u -p -r1.3 usb.c
--- usb.c	6 Nov 2005 16:13:29 -0000	1.3
+++ usb.c	16 Feb 2006 20:02:55 -0000
@@ -183,7 +183,7 @@ int set_usb_string(uint8_t *buf, const c

      q = buf;
      len = strlen(str);
-    *q++ = 2 * len + 1;
+    *q++ = 2 * len + 2;
      *q++ = 3;
      for(i = 0; i < len; i++) {
          *q++ = str[i];

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] patch for USB issues
  2006-02-16 20:06 [Qemu-devel] patch for USB issues Krister Walfridsson
@ 2006-02-17  4:41 ` Lonnie Mendez
  2006-02-17 15:37   ` Krister Walfridsson
  0 siblings, 1 reply; 3+ messages in thread
From: Lonnie Mendez @ 2006-02-17  4:41 UTC (permalink / raw)
  To: qemu-devel

Krister Walfridsson wrote:

> I'm playing with the USB code, but I cannot get the USB mouse emulation
> to work with the guests I have tried (NetBSD and Win2k).  Attached are 
> two patches that improves the situation somewhat.
>
> * hw/usb-uhci.c
>      The PCI configuration registers are set up with an incorrect
>      offset for USBBASE and uninitialized SBRN.  This makes NetBSD
>      complain that this is not a valid UHCI controller.
> * hw/usb.c
>      The length field of the returned descriptor strings are
>      incorrect, which trunkates the returned strings.
>
> There are some additional problems with the hub emulation that I hope
> to get the time to fix during the weekend.
>
>    /Krister
>
>
>
> Index: usb-uhci.c
> ===================================================================
> RCS file: /sources/qemu/qemu/hw/usb-uhci.c,v
> retrieving revision 1.4
> diff -b -u -p -r1.4 usb-uhci.c
> --- usb-uhci.c    19 Nov 2005 17:43:37 -0000    1.4
> +++ usb-uhci.c    16 Feb 2006 20:02:52 -0000
> @@ -654,6 +654,7 @@ void usb_uhci_init(PCIBus *bus, USBPort
>      pci_conf[0x0b] = 0x0c;
>      pci_conf[0x0e] = 0x00; // header_type
>      pci_conf[0x3d] = 4; // interrupt pin 3
> +    pci_conf[0x60] = 0x11; // USB 1.1
>
>      for(i = 0; i < NB_PORTS; i++) {
>          port = &s->ports[i];
> @@ -666,6 +667,6 @@ void usb_uhci_init(PCIBus *bus, USBPort
>
>      uhci_reset(s);
>
> -    pci_register_io_region(&s->dev, 0, 0x20, +    
> pci_register_io_region(&s->dev, 4, 0x20,
>                             PCI_ADDRESS_SPACE_IO, uhci_map);
>  }
> Index: usb.c
> ===================================================================
> RCS file: /sources/qemu/qemu/hw/usb.c,v
> retrieving revision 1.3
> diff -b -u -p -r1.3 usb.c
> --- usb.c    6 Nov 2005 16:13:29 -0000    1.3
> +++ usb.c    16 Feb 2006 20:02:55 -0000
> @@ -183,7 +183,7 @@ int set_usb_string(uint8_t *buf, const c
>
>      q = buf;
>      len = strlen(str);
> -    *q++ = 2 * len + 1;
> +    *q++ = 2 * len + 2;
>      *q++ = 3;
>      for(i = 0; i < len; i++) {
>          *q++ = str[i];
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
    Hello.  That change to pci_register_io_region works over here with 
FreeBSD 6.0.  However the revision for register 0x60 is incorrect.  It 
should read:

pci_conf[0x60] = 0x10; // USB Release 1.0

    At least according to the uhci document I found that is the 
appropriate value.  Changing it to 0x11 causes FreeBSD's uhci layer to 
complain of an invalid version number and kill the controller and it is 
indeed not listed in the document.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] patch for USB issues
  2006-02-17  4:41 ` Lonnie Mendez
@ 2006-02-17 15:37   ` Krister Walfridsson
  0 siblings, 0 replies; 3+ messages in thread
From: Krister Walfridsson @ 2006-02-17 15:37 UTC (permalink / raw)
  To: qemu-devel



On Thu, 16 Feb 2006, Lonnie Mendez wrote:

>   Hello.  That change to pci_register_io_region works over here with FreeBSD 
> 6.0.  However the revision for register 0x60 is incorrect.  It should read:
>
> pci_conf[0x60] = 0x10; // USB Release 1.0
>
>   At least according to the uhci document I found that is the appropriate 
> value.  Changing it to 0x11 causes FreeBSD's uhci layer to complain of an 
> invalid version number and kill the controller and it is indeed not listed in 
> the document.

Oops.  Yes, you are correct.  I got confused by the NetBSD USB code that
recognizes the two values:

   #define  PCI_USBREV_1_0         0x10
   #define  PCI_USBREV_1_1         0x11

so I thought that there existed some update to the UHCI specification that
I didn't have...

    /Krister

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-02-17 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-16 20:06 [Qemu-devel] patch for USB issues Krister Walfridsson
2006-02-17  4:41 ` Lonnie Mendez
2006-02-17 15:37   ` Krister Walfridsson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.