All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aleš Nesrsta" <starous@volny.cz>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] Re: Missing USB devices.
Date: Sat, 31 Aug 2013 20:14:19 +0200	[thread overview]
Message-ID: <5222327B.7090103@volny.cz> (raw)
In-Reply-To: <522231B0.8080106@volny.cz>

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

Sorry, I missed the patch... :-)
There it is.

> 28.8.2013 08:59, Melki Christian (consultant) wrote:
>> I'm thinking of the EHCI hand-over. In the case of EHCI handover
>> beeing successful within the timeout, you never clear the USBLEGCTLSTS
>> register (SMI's). You do that in the other cases however. Why? I can
>> not think of any case of a successful handover with SMI's still
>> enabled. To what purpose? A buggy BIOS would maybe act upon such
>> stuff? Maybe thats a case for lost devices etc?
> Ok, I made a short look into Linux USB source code and I saw there is
> USBLEGCTLSTS register reset in any case.
> (What is maybe more interesting, Linux driver DOES NOT handover on some
> (broken) devices, only reset SMI...)
>
> So I prepared simple "SMI" patch (attached).
>
> BR,
> Ales

[-- Attachment #2: usb_patch_130831.diff --]
[-- Type: text/x-patch, Size: 2060 bytes --]

diff -purB ./grub/grub-core/bus/usb/ehci.c ./grub_patched/grub-core/bus/usb/ehci.c
--- ./grub/grub-core/bus/usb/ehci.c	2013-05-12 23:15:17.857567000 +0200
+++ ./grub_patched/grub-core/bus/usb/ehci.c	2013-08-31 20:00:54.846788313 +0200
@@ -716,7 +716,7 @@ grub_ehci_pci_iter (grub_pci_device_t de
       usblegsup = grub_pci_read (pciaddr_eecp);
       if (usblegsup & GRUB_EHCI_BIOS_OWNED)
 	{
-	  grub_boot_time ("Taking ownership of EHCI port");
+	  grub_boot_time ("Taking ownership of EHCI controller");
 	  grub_dprintf ("ehci",
 			"EHCI grub_ehci_pci_iter: EHCI owned by: BIOS\n");
 	  /* Ownership change - set OS_OWNED bit */
@@ -737,13 +737,8 @@ grub_ehci_pci_iter (grub_pci_device_t de
 	      grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED);
 	      /* Ensure PCI register is written */
 	      grub_pci_read (pciaddr_eecp);
-	      /* Disable SMI.  */
-	      pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4);
-	      grub_pci_write (pciaddr_eecp, 0);
-	      /* Ensure PCI register is written */
-	      grub_pci_read (pciaddr_eecp);
 	    }
-	  grub_boot_time ("Ownership of EHCI port taken");
+	  grub_boot_time ("Ownership of EHCI controller taken");
 	}
       else if (usblegsup & GRUB_EHCI_OS_OWNED)
 	/* XXX: What to do in this case - nothing ? Can it happen ? */
@@ -758,14 +753,15 @@ grub_ehci_pci_iter (grub_pci_device_t de
 	  grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED);
 	  /* Ensure PCI register is written */
 	  grub_pci_read (pciaddr_eecp);
-	  /* Disable SMI, just to be sure.  */
-	  pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4);
-	  grub_pci_write (pciaddr_eecp, 0);
-	  /* Ensure PCI register is written */
-	  grub_pci_read (pciaddr_eecp);
 	}
     }
 
+  /* Disable SMI, just to be sure.  */
+  pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4);
+  grub_pci_write (pciaddr_eecp, 0);
+  /* Ensure PCI register is written */
+  grub_pci_read (pciaddr_eecp);
+
   grub_dprintf ("ehci", "inithw: EHCI grub_ehci_pci_iter: ownership OK\n");
 
   /* Now we can setup EHCI (maybe...) */

  reply	other threads:[~2013-08-31 18:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  8:16 Missing USB devices Melki Christian (consultant)
2013-08-07 16:11 ` Andrey Borzenkov
2013-08-08  7:22   ` Melki Christian (consultant)
2013-08-09 18:27     ` Aleš Nesrsta
2013-08-09 22:24       ` Aleš Nesrsta
2013-08-27 11:37         ` Melki Christian (consultant)
2013-08-27 20:21           ` Aleš Nesrsta
2013-08-27 21:38             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-08-30 22:07               ` Aleš Nesrsta
2013-09-02  7:01                 ` Melki Christian (consultant)
2013-09-02 21:33                   ` USB controller hand-back (original thread: Missing USB devices.) Aleš Nesrsta
2013-09-02 22:52                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-03  6:52                     ` Melki Christian (consultant)
2013-08-28  6:59             ` Missing USB devices Melki Christian (consultant)
2013-08-31 18:10               ` Aleš Nesrsta
2013-08-31 18:14                 ` Aleš Nesrsta [this message]
2013-08-31 21:12                   ` [PATCH] " Aleš Nesrsta
2013-09-02  7:17                     ` Melki Christian (consultant)
2013-09-23 12:47                     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-23 18:38                       ` Aleš Nesrsta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5222327B.7090103@volny.cz \
    --to=starous@volny.cz \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.