From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [solved] Re: USB device not seen by grub
Date: Sat, 05 Dec 2009 10:16:45 +0100 [thread overview]
Message-ID: <4B1A24FD.9080802@gmail.com> (raw)
In-Reply-To: <20091205022656.GC2958@turki.gavron.org>
[-- Attachment #1.1: Type: text/plain, Size: 1373 bytes --]
Chris Jones wrote:
> On Thu, Dec 03, 2009 at 05:52:37PM EST, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>
> [..]
>
>
>> This is just module loading. I guess your terminal is slow which causes
>> an enormous slowback when loading module. You can using
>>
>
>
>> debug=usb,uhci,ohci
>> instead of
>> debug=all
>>
>
> I was able to boot the partition I had copied over to the USB stick after
> this:
>
> grub:> debug=uhci,ohci,usbms
> grub:> insmod uhci
> grub:> insmod usbms
> grub:> debug=
>
> Why do I have to enable tracing to make it work?
>
>
Because a dprintf acted as a forgotten millisleep. This patch should fix
it. On my machine I still have issues because uhci.c has problems with
second port
> Also, is there any way I can run the grub command line on a system
> that's already booted, so I can explore its possibities in a context
> where I have internet access, browse documentation, etc..?
>
>
I'm working on it but the current problem is that I haven't found a
syscall in linux to get physical address of a page. Does anyone has a
suggestion?
> Thanks,
>
> CJ
>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: uhciclean.diff --]
[-- Type: text/x-diff; name="uhciclean.diff", Size: 2948 bytes --]
=== modified file 'bus/usb/uhci.c'
--- bus/usb/uhci.c 2009-10-14 08:11:59 +0000
+++ bus/usb/uhci.c 2009-12-05 09:13:21 +0000
@@ -23,7 +23,6 @@
#include <grub/usb.h>
#include <grub/usbtrans.h>
#include <grub/pci.h>
-#include <grub/cpu/pci.h>
#include <grub/i386/io.h>
#include <grub/time.h>
@@ -435,6 +434,7 @@
grub_uhci_td_t td_prev = NULL;
grub_usb_err_t err = GRUB_USB_ERR_NONE;
int i;
+ grub_uint64_t endtime;
/* Allocate a queue head for the transfer queue. */
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
@@ -483,6 +483,7 @@
/* Wait until either the transaction completed or an error
occurred. */
+ endtime = grub_get_time_ms () + 1000;
for (;;)
{
grub_uhci_td_t errtd;
@@ -534,6 +535,13 @@
updated. */
grub_dprintf ("uhci", "transaction fallthrough\n");
}
+ if (grub_get_time_ms () > endtime)
+ {
+ err = GRUB_USB_ERR_STALL;
+ grub_dprintf ("uhci", "transaction timed out\n");
+ goto fail;
+ }
+ grub_cpu_idle ();
}
grub_dprintf ("uhci", "transaction complete\n");
@@ -573,6 +581,7 @@
struct grub_uhci *u = (struct grub_uhci *) dev->data;
int reg;
unsigned int status;
+ grub_uint64_t endtime;
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
@@ -595,6 +604,7 @@
status = grub_uhci_readreg16 (u, reg);
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
grub_dprintf ("uhci", "reset completed\n");
+ grub_millisleep (10);
/* Enable the port. */
grub_uhci_writereg16 (u, reg, enable << 2);
@@ -602,7 +612,10 @@
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
- while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)));
+ endtime = grub_get_time_ms () + 1000;
+ while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)))
+ if (grub_get_time_ms () > endtime)
+ return grub_error (GRUB_ERR_IO, "UHCI Timed out");
status = grub_uhci_readreg16 (u, reg);
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
=== modified file 'bus/usb/usbhub.c'
--- bus/usb/usbhub.c 2009-07-16 22:14:09 +0000
+++ bus/usb/usbhub.c 2009-12-04 16:54:09 +0000
@@ -48,7 +48,7 @@
if (! grub_usb_devs[i])
break;
}
- if (grub_usb_devs[i])
+ if (i == 128)
{
grub_error (GRUB_ERR_IO, "Can't assign address to USB device");
return NULL;
@@ -60,6 +60,7 @@
| GRUB_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_SET_ADDRESS,
i, 0, 0, NULL);
+
dev->addr = i;
dev->initialized = 1;
grub_usb_devs[i] = dev;
=== modified file 'commands/usbtest.c'
--- commands/usbtest.c 2009-11-09 17:43:53 +0000
+++ commands/usbtest.c 2009-12-04 01:33:17 +0000
@@ -146,6 +146,7 @@
usb_print_str ("Configuration:", dev, config->strconfig);
}
+ if (dev->config[0].descconf)
for (i = 0; i < dev->config[0].descconf->numif; i++)
{
int j;
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]
next prev parent reply other threads:[~2009-12-05 9:17 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 20:26 USB device not seen by grub Chris Jones
2009-12-03 14:45 ` BandiPat
2009-12-03 15:16 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-03 18:01 ` Chris Jones
2009-12-03 20:02 ` Duboucher Thomas
2009-12-03 20:27 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-03 20:43 ` Chris Jones
2009-12-03 20:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-03 21:04 ` Chris Jones
2009-12-03 22:25 ` Chris Jones
2009-12-03 22:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-04 0:24 ` Chris Jones
2009-12-04 1:45 ` Chris Jones
2009-12-05 2:26 ` [solved] " Chris Jones
2009-12-05 2:58 ` richardvoigt
2009-12-05 4:29 ` Chris Jones
2009-12-05 9:16 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2009-12-11 0:45 ` Chris Jones
2009-12-23 7:03 ` Chris Jones
2009-12-04 0:27 ` richardvoigt
2009-12-04 21:36 ` Robert Millan
2009-12-04 22:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-05 3:28 ` richardvoigt
2009-12-05 20:22 ` Robert Millan
2009-12-04 22:45 ` richardvoigt
2009-12-05 20:33 ` Robert Millan
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=4B1A24FD.9080802@gmail.com \
--to=phcoder@gmail.com \
--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.