From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-x22c.google.com (mail-yb0-x22c.google.com [IPv6:2607:f8b0:4002:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 879E52095A6BC for ; Wed, 28 Jun 2017 11:01:44 -0700 (PDT) Received: by mail-yb0-x22c.google.com with SMTP id b81so21614878yba.2 for ; Wed, 28 Jun 2017 11:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mYdsI4dcUERAOkuJVJ1WecHF0C+PdmKxl7ndCZ+SFXE=; b=mSx7ZnKwS1JikZoGWZoq8A6t8UadEY257O4VQo10Z+G+EdwWB351dXdaZQttb/Q0sJ ++84SD/wE9BeyOPzzBOZq9/HrqwOpbWehF+YzMOkmdZKM2ostUClf7C7dyOWicA91h+A 6VCk1TJhb99zPmo9LooUxm6BRa9F50Co5wpmFurBWPI9+ig7AsCs0SqUBUdtKMbjXzL7 miOONJV2NHuMaMbHRnJDIocoJJAfc5DzFCGVvm+moegJvses3YvLDYMYBlIau+OToU+A vejgjRVjqmZanVCoXKeBGQYDzYEhpexoMpftpqrSV27A7czMTcxwg1qTxpPN/jCPO35A 5bmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mYdsI4dcUERAOkuJVJ1WecHF0C+PdmKxl7ndCZ+SFXE=; b=X9tZTmUV7Zd2SX9//BOiEw/BS+emv1hPy9GBS/TGeIE6SQGKyQrHvpAnRNZUEfzNMO T3FdVaLxpSzF23ncLIe8ROUwBm1S0PBcPQh9ihae4x+jcD1YbWAcpvKm32uEZacTWOBB GR0ClXvEIw/102yWOjqRSIItC10kavF7aSTzociJ1Oc8AfihosJcOYLN08WPTSdzvl5v oJ66XgukDBnJ1XnfJsiZhC5xdLKxfXRxCtPQN4Pgx1Y4fF+9cl2kTJI/HjmQq3w3xeIX 3cKd54Z1i6aqZEqg/MmXkrjJgukl3UGlC8/SQDLDZkqXE2HXwPv0csjBWow8CBq7UFKx 0yWw== X-Gm-Message-State: AKS2vOzg3NN4N61c1zvKcjOM+XQ78xyIZPZa42o61idm3zjJcXhGy8P4 qt4fyRdu3+0S/+IIuE7c+LkSTjrUkLVI X-Received: by 10.37.214.213 with SMTP id n204mr9274298ybg.201.1498672995425; Wed, 28 Jun 2017 11:03:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.209.86 with HTTP; Wed, 28 Jun 2017 11:02:54 -0700 (PDT) In-Reply-To: References: From: TVKR Date: Wed, 28 Jun 2017 13:02:54 -0500 Message-ID: To: Amit kumar Cc: "edk2-devel@lists.01.org" X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: DisconnectController API not working. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2017 18:01:45 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable BTW, when I run the 'reconnect -r' the ControllerHandle changes to a new value and I noticed that handle parsing functions like ConvertHandleIndexToHandle/PARSE_HANDLE_DATABASE_DEVICES called from the application aren't returning correct data (all though the same functions seem to work correctly when called by the shell's in-built commands like dh etc). Below is the code for reference EFI_STATUS EFIAPI UefiMain ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; LIST_ENTRY *ArgPackage; CHAR16 *ProblemParam; CONST CHAR16 *Param1; UINT64 Intermediate; EFI_HANDLE Handle; // // parse the command line // Status =3D ShellCommandLineParse (ParamList, &ArgPackage, &ProblemParam= , TRUE); if (!EFI_ERROR(Status)) { Param1 =3D ShellCommandLineGetRawValue(ArgPackage, 1); Status =3D ShellConvertStringToUint64(Param1, &Intermediate, TRUE, FALSE); if (EFI_ERROR(Status) || Param1 =3D=3D NULL || ConvertHandleIndexToHandle((UINTN)Intermediate) =3D=3D NULL){ Print(L"\nInvalid handle %02x\n\r", Param1); Status =3D SHELL_INVALID_PARAMETER; } else { Handle =3D (EFI_HANDLE) ConvertHandleIndexToHandle((UINTN)Intermediate); Print(L"\nHandle %02x (%x)\n\r", Intermediate, Handle); gBS->DisconnectController (Handle, NULL, NULL); } } return (Status); } On Wed, Jun 28, 2017 at 1:01 PM, TVKR wrote: > Yes, the shell's in-built command disconnect (disconnect 175 176) worked > but DisconnectController call from the application still did not work. > > On Wed, Jun 28, 2017 at 12:56 PM, Amit kumar wrote= : > >> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ? >> ------------------------------ >> *From:* TVKR >> *Sent:* Wednesday, June 28, 2017 11:21:34 PM >> >> *To:* Amit kumar >> *Cc:* edk2-devel@lists.01.org >> *Subject:* Re: [edk2] DisconnectController API not working. >> >> Sorry, I wasn't clear in my last email. No it did not hang. The >> 'reconnect -r' command completed successfully (no errors reported on >> screen). >> >> On Wed, Jun 28, 2017 at 12:50 PM, Amit kumar >> wrote: >> >>> Did it hang ? >>> ------------------------------ >>> *From:* TVKR >>> *Sent:* Wednesday, June 28, 2017 10:45:13 PM >>> *To:* Amit kumar >>> *Cc:* edk2-devel@lists.01.org >>> >>> *Subject:* Re: [edk2] DisconnectController API not working. >>> >>> Thanks for the suggestion Amit. I tried the reconnect -r but it doesn't >>> seem to help. >>> >>> On Wed, Jun 28, 2017 at 10:29 AM, Amit kumar >>> wrote: >>> >>>> Hi Tresko, >>>> I looks like there is no problem with your implementation, as was the >>>> case with me. >>>> I can suggest you a quick trick here, if it won=E2=80=99t work I will = help you >>>> further which might take a while. >>>> Follow the steps below. >>>> 1. Go to refi shell >>>> 2. Reconnect -r >>>> 3. If the sysytem hangs. >>>> 4. Try to update your BIOS/UEFI to latest (as I had noticed the earile= r >>>> BIOS/UEFI had some some problem which normally gets fixed with updates= ). >>>> 5. After update once again try Reconnect -r. >>>> 6. If theres a no hang restart the system and now you can try your app >>>> or just give disconnect in uefi shell. >>>> 7. If still I doesn=E2=80=99t work you can ping me I might suggest the= other >>>> way around. >>>> >>>> Amit >>>> >>>> On Jun 28, 2017, at 8:05 PM, TVKR wrote: >>>> >>>> Hi Amit, >>>> >>>> Here is the output. It is the call 'gBS->DisconnectController >>>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=3D7219EA98) th= at >>>> doesn't seem to correctly work. >>>> >>>> FS0:\> drivers >>>> Output Truncated.. >>>> 176 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E >>>> PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)/Offset(0x1D200,0x3E9FF) >>>> 178 07042200 B Y Y 1 1 Intel(R) PRO/1000 7.3.18 PCI-E >>>> PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x1)/Offset(0x1D200,0x3E9FF) >>>> >>>> FS0:\> dh 176 -d -v >>>> 176: 7219E798 >>>> DriverVersion >>>> 0x00020028 >>>> EfiDriverHealthProtocolGuid >>>> DriverConfiguration >>>> DriverDiagnostics2 >>>> ComponentName2 >>>> DriverDiagnostics >>>> ComponentName >>>> DriverBinding >>>> ImageDevicePath >>>> LoadedImage >>>> Revision......: 0x00001000 >>>> ParentHandle..: 72B70A18 >>>> SystemTable...: 788FEF18 >>>> DeviceHandle..: 7219EA98 >>>> FilePath......: 7219E998 >>>> OptionsSize...: 0 >>>> LoadOptions...: >>>> ImageBase.....: 776A0000 >>>> ImageSize.....: 555E0 >>>> CodeType......: EfiBootServicesCode >>>> DataType......: EfiBootServicesData >>>> Unload........: 776A0708 >>>> >>>> Child[176] : Intel(R) PRO/1000 7.3.18 PCI-E >>>> Driver Image Name : Offset(0x1D200,0x3E9FF) >>>> Driver Version : 07031800 >>>> Driver Type : Bus >>>> Configuration : YES >>>> Diagnostics : YES >>>> Child Controllers : >>>> Ctrl[175] : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) >>>> Child[219] : Intel Ethernet Server Adapter I350-T2 >>>> >>>> >>>> FS0:\> dh 175 -d -v >>>> 175: 7219EA98 >>>> UnknownDevice >>>> UnknownDevice >>>> BusSpecificDriverOverride >>>> LoadFile2 >>>> PCIIO >>>> DevicePath >>>> PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) >>>> Controller Name : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) >>>> Device Path : PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0) >>>> Controller Type : BUS >>>> Configuration : NO >>>> Diagnostics : NO >>>> Managed by : >>>> Drv[176] : Intel(R) PRO/1000 7.3.18 PCI-E >>>> Parent Controllers : >>>> Parent[75] : PciRoot(0x0) >>>> Child Controllers : >>>> Child[219] : Intel Ethernet Server Adapter I350-T2 >>>> >>>> >>>> Thanks >>>> >>>> On Wed, Jun 28, 2017 at 9:07 AM, Amit kumar >>>> wrote: >>>> >>>>> Hi Tresko, >>>>> >>>>> >Hi Amit, >>>>> >>>>> >I am seeing the exact same issue on my system with >>>>> DisconnectController. The shell command 'disconnect' works but when I= use >>>>> the gBS->DisconnectController >call from my application it doesn't se= em to >>>>> really disconnect the same controller (even though the call returns >>>>> SUCCESS) and it still appears to be managed by >driver. I even checke= d the >>>>> ControllerHandle passed and it looks correct. Were you able to resolv= e this >>>>> eventually? >>>>> >>>>> Yes i was able to resolve it. It might be helpful if you can tell me >>>>> the output of dh -d command. >>>>> >>>>> Thanks >>>>> >>>>> Amit >>>>> >>>>> >>>>> >>>>> ------------------------------ >>>>> *From:* TVKR >>>>> *Sent:* Wednesday, June 28, 2017 6:06:11 PM >>>>> *To:* edk2-devel@lists.01.org; akamit91@hotmail.com >>>>> >>>>> *Subject:* Re: [edk2] DisconnectController API not working. >>>>> >>>>> BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDr= iver1CommandsLib) >>>>> to a standalone application and it fails too. Looks like there is som= ething >>>>> else in the shell app that is taking care of properly disconnecting t= he >>>>> controller. >>>>> >>>>> Thanks >>>>> >>>>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR wrote: >>>>> >>>>>> Hi Amit, >>>>>> >>>>>> I am seeing the exact same issue on my system with >>>>>> DisconnectController. The shell command 'disconnect' works but when = I use >>>>>> the gBS->DisconnectController call from my application it doesn't se= em to >>>>>> really disconnect the same controller (even though the call returns >>>>>> SUCCESS) and it still appears to be managed by driver. I even checke= d the >>>>>> ControllerHandle passed and it looks correct. Were you able to resol= ve this >>>>>> eventually? >>>>>> >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> -----Original Message----- >>>>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org ] On Behalf Of Amit kumar >>>>>> Sent: Tuesday, April 4, 2017 12:07 AM >>>>>> To: Tian, Feng > >>>>>> Cc: edk2-devel at lists.01.org >>>>>> Subject: Re: [edk2] DisconnectController API not working. >>>>>> >>>>>> No i am not trying to disconnect USB controller in use. >>>>>> >>>>>> ________________________________ >>>>>> From: Tian, Feng > >>>>>> Sent: Wednesday, April 5, 2017 8:21:36 AM >>>>>> To: Andrew Fish; Amit kumar >>>>>> Cc: edk2-devel at lists.01.org ; Tian, Feng >>>>>> Subject: RE: [edk2] DisconnectController API not working. >>>>>> >>>>>> Kumar, >>>>>> >>>>>> Do "map -r" at first please. >>>>>> >>>>>> >>>>>> PS: for the issue you encounter, are you trying to disconnect the us= b controller in use? Please note at this time you are reading the file from= usb key. It means the disconnect will never succeed. >>>>>> >>>>>> Thanks >>>>>> Feng >>>>>> >>>>>> -----Original Message----- >>>>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org ] On Behalf Of Andrew Fish >>>>>> Sent: Tuesday, April 4, 2017 12:07 AM >>>>>> To: Amit kumar > >>>>>> Cc: edk2-devel at lists.01.org >>>>>> Subject: Re: [edk2] DisconnectController API not working. >>>>>> >>>>>> >>>>>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar > wrote: >>>>>> *>>* Hi Andrew , >>>>>> *>>* I did some testing and found out, same code works fine on Serve= r boards but it fails on desktop boards. >>>>>> *> >>>>>> Servers tend to connect less things as it can take a long time. >>>>>> >>>>>> >* I Have double checked the ControllerHandle by printing its handle= index using ConvertHandleToHandleIndex(ControllerHandle), the ControllerH= andle looks correct. >>>>>> *>>>* I have one new query; >>>>>> *>>* i have made a startup.nsh file in which i am issuing load drive= r.efi , i am getting file not found. >>>>>> *>>* i have also tried using load fs0:driver.efi, and again i get f= ile not found. I have been trying to run this script from internal shell a= s well as usb shell. >>>>>> *> >>>>>> Does that command work if you boot the shell? >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Andrew Fish >>>>>> >>>>>> >>* Regards >>>>>> *>>* Amit Kumar >>>>>> *>>* ________________________________ >>>>>> *>* From: afish at apple.com > on behalf of Andrew Fish >>>>>> *>* > >>>>>> *>* Sent: Friday, March 31, 2017 10:42:08 PM >>>>>> *>* To: Amit kumar >>>>>> *>* Cc: edk2-devel at lists.01.org >>>>>> *>* Subject: Re: [edk2] DisconnectController API not working. >>>>>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar >> wrote: >>>>>> *>>>* Hi , >>>>>> *>>* I am trying to disconnect a controller from the usb mass storag= e >>>>>> *>* driver, for which i am using >>>>>> *>>* Status =3D gBS->DisconnectController ( >>>>>> *>* ControllerHandle, >>>>>> *>* NULL, >>>>>> *>* NULL >>>>>> *>* ); >>>>>> *>>* after the call i get Status =3D SUCCESS , but when i run driver= s command in shell, i find it still being manged by the same old driver han= dle. >>>>>> *>* Although when i run disconnect command from shell (e.g disconnec= t 163 >>>>>> *>* ...output disconnect(163,0,0):Status =3D SUCCESS) it works as ex= pected and detaches the controller from the driver. >>>>>> *>* Can some body point me out what could be the reason. >>>>>> *>>* Amit, >>>>>> *>>* It is always good to double check you are using the right Contr= ollerHandle. >>>>>> *>>* Sequence of events matters. There are boot flows and Shell comm= ands that do ConnectController. >>>>>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController >>>>>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->Con= nectController (HandleBuffer[Index], NULL, NULL, TRUE); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = =3D gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->Connec= tController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControl= lers ( >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is w= here we call the gBS->ConnectController function. >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = =3D gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive= ); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =3D= gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive= ); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: = Status =3D gBS->ConnectController ( >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConn= ectCon >>>>>> *>* trollers ( >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (Conn= ectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 !=3D = NULL && Handle1 !=3D NULL))); >>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Stat= us =3D ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFl= ag(Package, L"-r"), (BOOLEAN)(Count!=3D0)); >>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE C= onnectControllerContextOverride[2]; >>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectCont= rollerContextOverride[0] =3D DriverImageHandle; >>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectCont= rollerContextOverride[1] =3D NULL; >>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->Connec= tController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE= ); >>>>>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status =3D gBS-= >ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); >>>>>> *>>>* Thanks, >>>>>> *>>* Andrew Fish >>>>>> *>>* _______________________________________________ >>>>>> *>* edk2-devel mailing list >>>>>> *>* edk2-devel at lists.01.org > >>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel >>>>>> *>>* _______________________________________________ >>>>>> *>* edk2-devel mailing list >>>>>> *>* edk2-devel at lists.01.org >>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel >>>>>> * >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >