grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH]: xHCI/EHCI - Windows - BIOS bug interaction.


From: Melki Christian (consultant)
Subject: [PATCH]: xHCI/EHCI - Windows - BIOS bug interaction.
Date: Thu, 19 Dec 2013 10:01:11 +0000

Hi.

Request for comments (patch is a local repository patch) so far:

I noticed on some Dell 7010 machines the following behaviour with GRUB.

Machine is cold-booted. - > USB keyboard works in GRUB -> Windows boots -> 
Windows does warm reboot -> USB keyboard does not work in GRUB.
This only happens in the ports marked superspeed on the machine.
A quick dig into the subject revealed something of interest that Sarah Sharp 
added to Linux a while ago.
The problem is that Windows seems to leave the the SS ports in SS mode when 
rebooting and a BIOS bug(?) on warm boot leads to not setting the SS ports in 
2.0 mode.
So in the ehci driver I identified the xHCI controller, disabled it and set all 
ports in 2.0 mode in the port routing register, much like Linux does.
This is a little odd, but I think GRUB needs this because it does not properly 
handle xHCI yet. GRUB needs to make sure that all ports are available as 2.0 
mode ports.
It seems to fix my problems atleast.

Index: grub-core/bus/usb/ehci.c
===================================================================
--- grub-core/bus/usb/ehci.c    (revision 6009)
+++ grub-core/bus/usb/ehci.c    (working copy)
@@ -41,6 +41,8 @@
  */

 #define GRUB_EHCI_PCI_SBRN_REG  0x60
+#define GRUB_XHCI_PCI_XUSB2PR   0xD0
+#define GRUB_XHCI_PCI_USB3_PSSEN 0xD8

 /* Capability registers offsets */
 enum
@@ -507,6 +509,21 @@
       subclass = (class_code >> 8) & 0xFF;
       class = class_code >> 16;

+      /* This is an xHCI controller.
+       * Since GRUB does not currently handle xHCI we need
+       * to make sure it is disabled and the ports put in 2.0 mode.
+       * To be removed when xHCI is properly introduced.
+       */
+      if (class == 0x0c && subclass == 0x03 && interf == 0x30)
+        {
+          addr = grub_pci_make_address (dev, GRUB_XHCI_PCI_USB3_PSSEN);
+          grub_pci_write_word (addr, 0x0);
+          grub_pci_read_word(addr);
+          addr = grub_pci_make_address (dev, GRUB_XHCI_PCI_XUSB2PR);
+          grub_pci_write_word (addr, 0x0);
+          grub_pci_read_word(addr);
+        }
+
       /* If this is not an EHCI controller, just return.  */
       if (class != 0x0c || subclass != 0x03 || interf != 0x20)
        return 0;

Regards,
Christian


Attachment: xhcifix.patch
Description: xhcifix.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]