Re: [solved] Re: USB device not seen by grub
On Sat, Dec 05, 2009 at 04:16:45AM EST, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > Chris Jones wrote: Hello Vladimir, [..] > > 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? Just curious as to whether anything came of this. One thing further regarding booting a kernel that lives on a USB stick, is that where it works fine when grub lives on the HDD, oddly enough, I have not been able to boot that same kernel from a CD image created via grub-mkrescue. What I was trying to do is have some means of booting the USB stick in the event the target machine has a bootable CD/DVD device and does not let you boot off of a USB device. When I leave the debug=uhci tracing on, I can see that it is generating a few screenful of messages at: uhci.c:403 .. They're all basically the same as previously, giving some details like flags settings, addresses, completion codes, etc. for what appear to be USB 'transactions'. This is followed by exactly three identical sequences of entries at lines: uhci.c:478 .. uhci.c:482 uhci.c:493 uhci.c:539 uhci.c:543 In turn this is followed by a branch back to uhci.c:403 where the same messages as previously are displayed at the terminal. I must have let this run for about a half hour and even without tracing, the boot process never took off. Again this does not occur when I used the copy of grub that lives on the hard drive. The CD images were created with each of the versions of grub that I have on this machine, 1.96 that comes with debian 'lenny', 1.97 beta3, that comes with debian 'squeeze' at least when I installed it about two months ago, and 1.97 beta4 that calme with ubuntu 9.10. Incidentally, I just checked the exact spelling of grub-mkrescue and found that there is also a grub-mkimage, so maybe I'm using the wrong script. In any event, since I have pretty much abandoned this project of booting off of a USB stick for the time being, I am not too concerned about this being fixed or worked around, but I thought I might as well report that I ran into this problem. Thank you again for your help. CJ ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [solved] Re: USB device not seen by grub
On Sat, Dec 05, 2009 at 04:16:45AM EST, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > Chris Jones wrote: [..] > > 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 Excellent. > > 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? That would be great. The worst time to experiment and learn new tricks is when you're in a fix and your system won't boot. Be prepared! Thanks again for your help. CJ ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [solved] Re: USB device not seen by grub
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 === modified file 'bus/usb/uhci.c' --- bus/usb/uhci.c 2009-10-14 08:11:59 + +++ bus/usb/uhci.c 2009-12-05 09:13:21 + @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -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 + +++ bus/usb/usbhub.c 2009-12-04 16:54:09 + @@ -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 + +++ commands/usbtest.c 2009-12-04 01:33:17 + @@ -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; signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [solved] Re: USB device not seen by grub
On Fri, Dec 04, 2009 at 09:58:23PM EST, richardvo...@gmail.com wrote: > On Fri, Dec 4, 2009 at 8:26 PM, Chris Jones wrote: [..] > > Why do I have to enable tracing to make it work? > > Yesterday Vladimir wrote: > > (quote) > There is an issue that somewhere grub misses a delay between uhci > commands. When enabling debug=all this hang goes away. My laptop has > this issue too. I hope to have time soon to fix it > (/quote) > This makes a lot of sense, the UHCI controller may require some time > for processing certain commands before it can accept the next one, and > tracing slows things down enough to let the controller catch up. It's > a very good sign (for having a fix soon) that one of the major > programmers has not only reproduced the problem but is affected by it. Thanks for reminding me. CJ ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel
Re: [solved] Re: USB device not seen by grub
On Fri, Dec 4, 2009 at 8:26 PM, 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? Yesterday Vladimir wrote: (quote) There is an issue that somewhere grub misses a delay between uhci commands. When enabling debug=all this hang goes away. My laptop has this issue too. I hope to have time soon to fix it (/quote) This makes a lot of sense, the UHCI controller may require some time for processing certain commands before it can accept the next one, and tracing slows things down enough to let the controller catch up. It's a very good sign (for having a fix soon) that one of the major programmers has not only reproduced the problem but is affected by it. ___ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel