From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1R9D1w-0008HV-Jf for mharc-grub-devel@gnu.org; Thu, 29 Sep 2011 05:35:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9D1r-0008HM-58 for grub-devel@gnu.org; Thu, 29 Sep 2011 05:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9D1m-0006U6-Li for grub-devel@gnu.org; Thu, 29 Sep 2011 05:35:43 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:48655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9D1m-0006Tv-Cj for grub-devel@gnu.org; Thu, 29 Sep 2011 05:35:38 -0400 Received: by wwp14 with SMTP id 14so516701wwp.30 for ; Thu, 29 Sep 2011 02:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; bh=fFcchsZRGF3yAgSwHXw/jhFwJahGo24Zv41ZnLt7jNA=; b=Gf8c/j+D8Ga9rXwqBc1W0BAjXy8LqdvcvNvcJKQ/0k35OiO5Szv1m5BHy6IWgvkKsd UWj4OuPtGnLoi3dJ2Z6wcDZmRaI+lYgQ87JxqZPJVqq4WU0nh2cNBFdbE91ridZ8fPEk NLJjjFigxzFR8QXBiIqr1YvYPBFodb+fZR1a8= Received: by 10.227.143.72 with SMTP id t8mr10061526wbu.95.1317288937272; Thu, 29 Sep 2011 02:35:37 -0700 (PDT) Received: from debian.x201.phnet (public-docking-hg-6-254.ethz.ch. [129.132.216.254]) by mx.google.com with ESMTPS id i29sm1565951wbp.22.2011.09.29.02.35.34 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Sep 2011 02:35:34 -0700 (PDT) Message-ID: <4E843BE4.5000407@gmail.com> Date: Thu, 29 Sep 2011 11:35:32 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Iceowl/1.0b2 Icedove/3.1.13 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] Re: [Fwd: [Resolved] Grub2 can not detect usb disk] References: <1313876741.5634.49.camel@pracovna> <4E512DF6.1030807@gmail.com> <1314352626.2642.10.camel@pracovna> In-Reply-To: <1314352626.2642.10.camel@pracovna> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig0AF5942F8A648843C022EE29" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.49 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 09:35:47 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0AF5942F8A648843C022EE29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 26.08.2011 11:57, Ale=C5=A1 Nesrsta wrote: > Hi Vladimir, > > there is the patch with @Rock changes. Go ahead. Don't forget to put an acknowledgement to Rock Cui (put him as an author, and yourself as a co-author) > I hope I didn't make some mistake during cleanup/macroify... > > You may note some additional cosmetic changes: > > 1. > ... > + /* Finish HC reset, HC remains disabled */ > + grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0); > + /* Read back to be sure PCI write is done */ > + grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD); > ... > I think it is more safe to ensure the command is written into PCI > register before executing next code. > > 2. > - /* Make sure UHCI is disabled! */ > - grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0); > - > It is not necessary yet because UHCI is disabled sooner in code which i= s > listed above in point 1. > > 3. > - grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7)); > + grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, > + GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP); > Some very small cleanup of previous code... > > > I very shortly tested this patch, it seems to be working OK. > > Best regards, > Ales > > Vladimir '=CF=86-coder/phcoder' Serbinenko p=C3=AD=C5=A1e v Ne 21. 08. = 2011 v 18:10 > +0200: >> On 20.08.2011 23:45, Ale=C5=A1 Nesrsta wrote: >>> Hi everybody, >>> >>> could anybody test changes from Cui Lei (see below) in uhci.c - if th= ey >>> are generally working and does not have some negative effect on machi= nes >>> with "normal" BIOS etc. ? >>> >>> Maybe such changes are related only to coreboot and some special use >>> case/platform, but probably they are related to needed change of UHCI= >>> controller ownership and should be included into uhci.c code. >>> >> I don't think it is. The difference is that coreboot doesn't use USB >> itself so it's initialised but disabled initially which I expect also = to >> happen with some older BIOSes so this code is perfectly ok to be added= >> generically. >> @Rock or Ale=C5=A1: Could someone of you clean this up (macroify and c= omment >> style mainly) and supply as a .diff ? >>> Regards, >>> Ales >>> >>> -------- P=C5=99eposlan=C3=A1 zpr=C3=A1va -------- >>> Od: Cui Lei >>> Komu: Ale=C5=A1 Nesrsta >>> Kopie: The development of GNU GRUB >>> P=C5=99edm=C4=9Bt: [Resolved] Grub2 can not detect usb disk >>> Datum: Fri, 19 Aug 2011 10:58:00 +0800 >>> >>> Thank you for your help, very much! ^_^ >>> This problem have been resolved and I can usb the usb_keyborard under= =20 >>> grub-shell and I can boot ubuntu11.04 from usb disk. >>> My mainboard is via 8595a, the usb controller is uhci. >>> I resolved it by add these code in the grub-core/bus/usb/uhci.c: >>> >>> (1) >>> 182 /*Set bus master*/ >>> 183 addr =3D grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); >>> 184 grub_uint16_t val =3D grub_pci_read_word(addr); >>> 185 val =3D (val & ~0) | GRUB_PCI_COMMAND_BUS_MASTER; >>> 186 grub_pci_write_word(addr, val); >>> >>> (2) >>> 203 // Reset PIRQ and SMI >>> 204 addr =3D grub_pci_make_address (dev, 0xC0); =20 >>> //USBLEGSUP 0xc0 >>> 205 grub_pci_write_word(addr, 0x8f00); //USBLEGSUP_RWC =20 >>> 0x8f00 /* the R/WC bits */ >>> 206 // Reset the HC >>> 207 grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0x0002);=20 >>> //USBCMD_HCRESET 0x0002 >>> 208 grub_millisleep(5); >>> 209 // Disable interrupts and commands (just to be safe). >>> 210 grub_outw (0, u->iobase + 4); //USBINTR 4 /*Interrupt=20 >>> enable register*/ >>> 211 grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0); >>> >>> I don't know whether it is useful to the other one, but may be a refe= rence. >>> >>> BRs, >>> >>> Rock. >>> >>>> Hi, >>>> >>>> I am afraid, I maybe will not help You too much but I try it: >>>> >>>> I shortly looked into ML to Your posts. As I saw short part of debug= >>>> output in one of Your e-mail, GRUB freezes when it wants to get devi= ce >>>> descriptor - more precisely, when it requests first 8 bytes of devic= e >>>> descriptor. It is the first thing which is done after address is >>>> assigned to the device. >>>> >>>> So, it looks like device does not set address properly (even if cont= rol >>>> message Set Address returns success) or happened something else what= >>>> prevent device to respond (but I don't know what...). >>>> >>>> For the first try You can increase related delays in usbhub.c: >>>> >>>> ... >>>> /* Wait "recovery interval", spec. says 2ms */ >>>> grub_millisleep (2);<<<<---- HERE (try 4ms or more) >>>> >>>> grub_usb_device_attach (dev); >>>> ... >>>> >>>> ... >>>> /* Enable the port. */ >>>> err =3D hub->controller->dev->portstatus (hub->controller, portno= , 1); >>>> if (err) >>>> return; >>>> hub->controller->dev->pending_reset =3D grub_get_time_ms () + 500= 0; >>>> >>>> grub_millisleep (10);<<<<---- maybe here also >>>> >>>> /* Enable the port and create a device. */ >>>> dev =3D grub_usb_hub_add_dev (hub->controller, speed, portno, 0);= >>>> hub->controller->dev->pending_reset =3D 0; >>>> if (! dev) >>>> return; >>>> ... >>>> >>>> If this will not help You, I currently have no other idea what could= be >>>> the reason of timeout. >>>> I think You don't need EHCI because it looks like Set Address contro= l >>>> message works (at least it does not return error), i.e. You probably= >>>> have OHCI or UHCI USB (companion) controller on computer and Your de= vice >>>> is working at full or low speed with Your USB controller. >>>> >>>> By the way, for the first look into ML I did not find which USB >>>> controller You have - OHCI/UHCI ? (which driver/module are You using= - >>>> ohci/uhci?) - and which machine/architecture is the computer You are= >>>> trying to boot with GRUB2 - ? >>>> I sometimes had some unidentified problems on my UHCI/EHCI controlle= r, >>>> mostly with port powering - UHCI does not have power management but = EHCI >>>> does and if EHCI is not properly initialized by BIOS (it could be Yo= ur >>>> case with coreboot, maybe ?) then USB ports are not properly powered= =2E >>>> Another BIOS (coreboot?) issue could be improper handling of USB >>>> controller ownership. >>>> >>>> Do You have USB device connected directly into root port or via some= USB >>>> hub ? Try to do it in opposite way (i.e. if You are not using the US= B >>>> hub, try use it and connect USB device via hub - maybe it helps...) >>>> >>>> Hmmm, I remember now one issue which could be related to Your proble= m. >>>> On my very old machine with OHCI USB controller some devices are not= >>>> working "for the first time". I am still not able to debug why it >>>> happened (it does not happened when full debug is active - so it loo= ks >>>> like it is related to some timing). But I am afraid it will be not Y= our >>>> case because device stops working after it is recognized, configured= , >>>> usbms module loaded and GRUB USB device usb0 created. >>>> But - try load ohci/uhci module when USB disk is connected and then >>>> disconnect and connect it again after few seconds. In my case device= >>>> becomes working as new usb device (i.e. usb1). >>>> >>>> Additionally, lot of manufacturers does not follow USB or USBMS >>>> specifications, as You can read in Linux source code of USB controll= ers >>>> and USB mass storage devices and related documentation. >>>> Did You tried more different USB mass storage devices ? >>>> What is manufacturer& type of Your USB mass storage device ? >>>> >>>> Of course, You can also try EHCI driver, it maybe can solve Your pro= blem >>>> because of little bit different ports/devices handling. But EHCI dri= ver >>>> is currently highly experimental, it still exists only as uncorrecte= d >>>> and not accepted "patch". I have to do some improvement but I don't = have >>>> sufficient time still, unfortunately... >>>> If You want try to use it, You can get my patch from ML (sent at >>>> 25.6.2011) and use it with related source code trunk branch revision= >>>> (maybe also any later or current revision, because USB parts of GRUB= are >>>> not frequently changed). Please also read about know issue and anoth= er >>>> limitations of the "zero version" of EHCI driver - e.g. it may not w= ork >>>> if Your PC is not x86 machine or USB registers are mapped above 4GB = etc. >>>> >>>> Sorry if You will wait longer time for my response in future - I don= 't >>>> check the post so often and additionally currently I am (and probabl= y >>>> will be) longer time too busy - I am not regular GRUB2 contributor, = I do >>>> something for GRUB2 USB part only time to time... >>>> >>>> BRs, >>>> Ales >>>> >>>> >>>> Cui Lei p=C3=AD=C5=A1e v =C3=9At 09. 08. 2011 v 11:05 +0800: >>>>> Hi Ale=C5=A1, >>>>> I am trying to boot OS from USB disk, I use coreboot-v4 with grub2= as >>>>> payload, but my usb disk can not been >>>>> detect. I try to use usb-keyboard, it is not working. I know you a= re >>>>> working on the EHCI driver from Vladimir , >>>>> could you give me some advices? Vladimir said it may need EHCI driv= er, >>>>> but I think the usb device should run >>>>> with low-speed or full-speed if no EHCI driver.C >>>>> >>>>> Looking forward to your reply. >>>>> BRs, >>>>> Rock Cui. >>>>> >>>>> >>> >>> >>> >>> >>> _______________________________________________ >>> Grub-devel mailing list >>> Grub-devel@gnu.org >>> https://lists.gnu.org/mailman/listinfo/grub-devel >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig0AF5942F8A648843C022EE29 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAk6EO+QACgkQNak7dOguQgnpJgD9Hgc0DldveGDKclAjgaBjnif/ OqhXo0ClcOfe1uZuMekBAITkFbGEg8SzEE4xr3GQzmVxBO8F39fcdIi11koqWVR/ =8WU8 -----END PGP SIGNATURE----- --------------enig0AF5942F8A648843C022EE29--