* DisconnectController API not working.
@ 2017-03-31 12:26 Amit kumar
2017-03-31 17:12 ` Andrew Fish
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-03-31 12:26 UTC (permalink / raw)
To: edk2-devel@lists.01.org
Hi ,
I am trying to disconnect a controller from the usb mass storage driver, for which i am using
Status = gBS->DisconnectController (
ControllerHandle,
NULL,
NULL
);
after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS)
it works as expected and detaches the controller from the driver.
Can some body point me out what could be the reason.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-03-31 12:26 Amit kumar
@ 2017-03-31 17:12 ` Andrew Fish
2017-04-03 9:58 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: Andrew Fish @ 2017-03-31 17:12 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91@hotmail.com> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS)
> it works as expected 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 ControllerHandle.
Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
~/work/src/edk2/ShellPkg(master)>git grep ConnectController
Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectControllers (
Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
Library/UefiShellLevel2CommandsLib/Load.c:52: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Thanks,
Andrew Fish
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-03-31 17:12 ` Andrew Fish
@ 2017-04-03 9:58 ` Amit kumar
2017-04-03 16:07 ` Andrew Fish
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-04-03 9:58 UTC (permalink / raw)
To: Andrew Fish, edk2-devel@lists.01.org
Hi Andrew ,
I did some testing and found out, same code works fine on Server boards but it fails on desktop boards.
I Have double checked the ControllerHandle by printing its handle index using ConvertHandleToHandleIndex(ControllerHandle), the ControllerHandle looks correct.
I have one new query;
i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
Regards
Amit Kumar
________________________________
From: afish@apple.com <afish@apple.com> on behalf of Andrew Fish <afish@apple.com>
Sent: Friday, March 31, 2017 10:42:08 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
Hi ,
I am trying to disconnect a controller from the usb mass storage driver, for which i am using
Status = gBS->DisconnectController (
ControllerHandle,
NULL,
NULL
);
after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS)
it works as expected 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 ControllerHandle.
Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
~/work/src/edk2/ShellPkg(master)>git grep ConnectController
Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectControllers (
Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
Library/UefiShellLevel2CommandsLib/Load.c:52: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Thanks,
Andrew Fish
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-04-03 9:58 ` Amit kumar
@ 2017-04-03 16:07 ` Andrew Fish
2017-04-05 2:51 ` Tian, Feng
0 siblings, 1 reply; 24+ messages in thread
From: Andrew Fish @ 2017-04-03 16:07 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91@hotmail.com> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish@apple.com <afish@apple.com> on behalf of Andrew Fish <afish@apple.com>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163 ...output disconnect(163,0,0):Status = SUCCESS)
> it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>
>
> Thanks,
>
> Andrew Fish
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-04-03 16:07 ` Andrew Fish
@ 2017-04-05 2:51 ` Tian, Feng
2017-04-05 3:38 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: Tian, Feng @ 2017-04-05 2:51 UTC (permalink / raw)
To: Andrew Fish, Amit kumar; +Cc: edk2-devel@lists.01.org, Tian, Feng
Kumar,
Do "map -r" at first please.
PS: for the issue you encounter, are you trying to disconnect the usb 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@lists.01.org] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91@hotmail.com>
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91@hotmail.com> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish@apple.com <afish@apple.com> on behalf of Andrew Fish
> <afish@apple.com>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>
>
> Thanks,
>
> Andrew Fish
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-04-05 2:51 ` Tian, Feng
@ 2017-04-05 3:38 ` Amit kumar
0 siblings, 0 replies; 24+ messages in thread
From: Amit kumar @ 2017-04-05 3:38 UTC (permalink / raw)
To: Tian, Feng, Andrew Fish; +Cc: edk2-devel@lists.01.org
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian@intel.com>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel@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 usb 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@lists.01.org] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91@hotmail.com>
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91@hotmail.com> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish@apple.com <afish@apple.com> on behalf of Andrew Fish
> <afish@apple.com>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>
>
> Thanks,
>
> Andrew Fish
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
@ 2017-06-27 22:54 TVKR
2017-06-28 12:36 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-27 22:54 UTC (permalink / raw)
To: edk2-devel, akamit91
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 seem to
really disconnect the same controller (even though the call returns
SUCCESS) and it still appears to be managed by driver. I even checked the
ControllerHandle passed and it looks correct. Were you able to resolve this
eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org
<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit
kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com
<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org
<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com
<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org
<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb
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
<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of
Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com
<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org
<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
>* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
*>>* Hi Andrew ,
*>>* I did some testing and found out, same code works fine on Server
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 ControllerHandle looks correct.
*>>>* I have one new query;
*>>* i have made a startup.nsh file in which i am issuing load
driver.efi , i am getting file not found.
*>>* i have also tried using load fs0:driver.efi, and again i get
file not found. I have been trying to run this script from internal
shell as well as usb shell.
*>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>>* Regards
*>>* Amit Kumar
*>>* ________________________________
*>* From: afish at apple.com
<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com
<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of
Andrew Fish
*>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
*>* Sent: Friday, March 31, 2017 10:42:08 PM
*>* To: Amit kumar
*>* Cc: edk2-devel at lists.01.org
<https://lists.01.org/mailman/listinfo/edk2-devel>
*>* Subject: Re: [edk2] DisconnectController API not working.
*>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com
<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>>
wrote:
*>>>* Hi ,
*>>* I am trying to disconnect a controller from the usb mass storage
*>* driver, for which i am using
*>>* Status = gBS->DisconnectController (
*>* ControllerHandle,
*>* NULL,
*>* NULL
*>* );
*>>* after the call i get Status = SUCCESS , but when i run drivers
command in shell, i find it still being manged by the same old driver
handle.
*>* Although when i run disconnect command from shell (e.g disconnect 163
*>* ...output disconnect(163,0,0):Status = SUCCESS) it works as
expected 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 ControllerHandle.
*>>* Sequence of events matters. There are boot flows and Shell
commands that do ConnectController.
*>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
*>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
*>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
*>* Library/UefiShellDriver1CommandsLib/Connect.c:95:
gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
NULL, FALSE);
*>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
*>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is
where we call the gBS->ConnectController function.
*>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
gBS->ConnectController(*HandleWalker, DriverHandleList, NULL,
Recursive);
*>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
Recursive);
*>* Library/UefiShellDriver1CommandsLib/Connect.c:298:
Status = gBS->ConnectController (
*>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
*>* trollers (
*>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return
(ConnectControllers(Handle1, Handle2, Recursive, Output,
(BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
*>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status
= ConvertAndConnectControllers(Handle1, Handle2,
ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
*>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
ConnectControllerContextOverride[2];
*>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
ConnectControllerContextOverride[0] = DriverImageHandle;
*>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
ConnectControllerContextOverride[1] = NULL;
*>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
gBS->ConnectController (ControllerHandle,
ConnectControllerContextOverride, NULL, TRUE);
*>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
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><mailto:edk2-devel
at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
*>* https://lists.01.org/mailman/listinfo/edk2-devel
<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>
*>* https://lists.01.org/mailman/listinfo/edk2-devel
<https://lists.01.org/mailman/listinfo/edk2-devel>
*
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-27 22:54 DisconnectController API not working TVKR
@ 2017-06-28 12:36 ` TVKR
2017-06-28 14:07 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 12:36 UTC (permalink / raw)
To: edk2-devel, akamit91
BTW, I ported the disconnect code (under
ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application
and it fails too. Looks like there is something else in the shell app that
is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
>
> Thanks
>
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
> No i am not trying to disconnect USB controller in use.
>
> ________________________________
> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Wednesday, April 5, 2017 8:21:36 AM
> To: Andrew Fish; Amit kumar
> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
> *>>* Hi Andrew ,
> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
> *>>>* I have one new query;
> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
> *>
> Does that command work if you boot the shell?
>
> Thanks,
>
> Andrew Fish
>
> >>* Regards
> *>>* Amit Kumar
> *>>* ________________________________
> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
> *>* Sent: Friday, March 31, 2017 10:42:08 PM
> *>* To: Amit kumar
> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
> *>* Subject: Re: [edk2] DisconnectController API not working.
> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
> *>>>* Hi ,
> *>>* I am trying to disconnect a controller from the usb mass storage
> *>* driver, for which i am using
> *>>* Status = gBS->DisconnectController (
> *>* ControllerHandle,
> *>* NULL,
> *>* NULL
> *>* );
> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> *>* Although when i run disconnect command from shell (e.g disconnect 163
> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> *>* trollers (
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
> *
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 12:36 ` TVKR
@ 2017-06-28 14:07 ` Amit kumar
2017-06-28 14:35 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 14:07 UTC (permalink / raw)
To: TVKR, edk2-devel@lists.01.org
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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com>
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\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 14:07 ` Amit kumar
@ 2017-06-28 14:35 ` TVKR
2017-06-28 15:29 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 14:35 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController
(ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
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...: <null string>
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 <akamit91@hotmail.com> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by >driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
> Yes i was able to resolve it. It might be helpful if you can tell me the
> output of dh -d <handle> command.
>
> Thanks
>
> Amit
>
>
> ------------------------------
> *From:* TVKR <tresko1@gmail.com>
> *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\UefiShellDriver1CommandsLib)
> to a standalone application and it fails too. Looks like there is something
> else in the shell app that is taking care of properly disconnecting the
> controller.
>
> Thanks
>
> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve this
>> eventually?
>>
>>
>> Thanks
>>
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> No i am not trying to disconnect USB controller in use.
>>
>> ________________________________
>> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>> To: Andrew Fish; Amit kumar
>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>>
>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>> *>>* Hi Andrew ,
>> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>> *>>>* I have one new query;
>> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>> *>
>> Does that command work if you boot the shell?
>>
>> Thanks,
>>
>> Andrew Fish
>>
>> >>* Regards
>> *>>* Amit Kumar
>> *>>* ________________________________
>> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
>> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>> *>* Sent: Friday, March 31, 2017 10:42:08 PM
>> *>* To: Amit kumar
>> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>> *>* Subject: Re: [edk2] DisconnectController API not working.
>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>> *>>>* Hi ,
>> *>>* I am trying to disconnect a controller from the usb mass storage
>> *>* driver, for which i am using
>> *>>* Status = gBS->DisconnectController (
>> *>* ControllerHandle,
>> *>* NULL,
>> *>* NULL
>> *>* );
>> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
>> *>* Although when i run disconnect command from shell (e.g disconnect 163
>> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>> *>* trollers (
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
>> *
>>
>>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 14:35 ` TVKR
@ 2017-06-28 15:29 ` Amit kumar
2017-06-28 17:15 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 15:29 UTC (permalink / raw)
To: TVKR; +Cc: edk2-devel@lists.01.org
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’t 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 eariler 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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that 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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akamit91@hotmail.com<mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 15:29 ` Amit kumar
@ 2017-06-28 17:15 ` TVKR
2017-06-28 17:50 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 17:15 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
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 <akamit91@hotmail.com> 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’t 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 eariler
> 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 <ControllerHandeIndex> in uefi shell.
> 7. If still I doesn’t work you can ping me I might suggest the other way
> around.
>
> Amit
>
> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com> wrote:
>
> Hi Amit,
>
> Here is the output. It is the call 'gBS->DisconnectController
> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
> 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...: <null string>
> 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 <akamit91@hotmail.com> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve this
>> eventually?
>>
>> Yes i was able to resolve it. It might be helpful if you can tell me the
>> output of dh -d <handle> command.
>>
>> Thanks
>>
>> Amit
>>
>>
>>
>> ------------------------------
>> *From:* TVKR <tresko1@gmail.com>
>> *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\UefiShellDriver1CommandsLib)
>> to a standalone application and it fails too. Looks like there is something
>> else in the shell app that is taking care of properly disconnecting the
>> controller.
>>
>> Thanks
>>
>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
>>> really disconnect the same controller (even though the call returns
>>> SUCCESS) and it still appears to be managed by driver. I even checked the
>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>> eventually?
>>>
>>>
>>> Thanks
>>>
>>>
>>> -----Original Message-----
>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>> Subject: Re: [edk2] DisconnectController API not working.
>>>
>>> No i am not trying to disconnect USB controller in use.
>>>
>>> ________________________________
>>> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>>> To: Andrew Fish; Amit kumar
>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>> Subject: Re: [edk2] DisconnectController API not working.
>>>
>>>
>>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>> *>>* Hi Andrew ,
>>> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>>> *>>>* I have one new query;
>>> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>>> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>>> *>
>>> Does that command work if you boot the shell?
>>>
>>> Thanks,
>>>
>>> Andrew Fish
>>>
>>> >>* Regards
>>> *>>* Amit Kumar
>>> *>>* ________________________________
>>> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
>>> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> *>* Sent: Friday, March 31, 2017 10:42:08 PM
>>> *>* To: Amit kumar
>>> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>> *>* Subject: Re: [edk2] DisconnectController API not working.
>>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>> *>>>* Hi ,
>>> *>>* I am trying to disconnect a controller from the usb mass storage
>>> *>* driver, for which i am using
>>> *>>* Status = gBS->DisconnectController (
>>> *>* ControllerHandle,
>>> *>* NULL,
>>> *>* NULL
>>> *>* );
>>> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
>>> *>* Although when i run disconnect command from shell (e.g disconnect 163
>>> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>>> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
>>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>>> *>* trollers (
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
>>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
>>> *
>>>
>>>
>>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 17:15 ` TVKR
@ 2017-06-28 17:50 ` Amit kumar
2017-06-28 17:51 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 17:50 UTC (permalink / raw)
To: TVKR; +Cc: edk2-devel@lists.01.org
Did it hang ?
________________________________
From: TVKR <tresko1@gmail.com>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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’t 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 eariler 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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that 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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akamit91@hotmail.com<mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 17:50 ` Amit kumar
@ 2017-06-28 17:51 ` TVKR
2017-06-28 17:56 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 17:51 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
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 <akamit91@hotmail.com> wrote:
> Did it hang ?
> ------------------------------
> *From:* TVKR <tresko1@gmail.com>
> *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 <akamit91@hotmail.com> 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’t 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 eariler
>> 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 <ControllerHandeIndex> in uefi shell.
>> 7. If still I doesn’t work you can ping me I might suggest the other way
>> around.
>>
>> Amit
>>
>> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com> wrote:
>>
>> Hi Amit,
>>
>> Here is the output. It is the call 'gBS->DisconnectController
>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
>> 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...: <null string>
>> 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 <akamit91@hotmail.com> 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 seem to
>>> really disconnect the same controller (even though the call returns
>>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>> eventually?
>>>
>>> Yes i was able to resolve it. It might be helpful if you can tell me the
>>> output of dh -d <handle> command.
>>>
>>> Thanks
>>>
>>> Amit
>>>
>>>
>>>
>>> ------------------------------
>>> *From:* TVKR <tresko1@gmail.com>
>>> *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\UefiShellDriver1CommandsLib)
>>> to a standalone application and it fails too. Looks like there is something
>>> else in the shell app that is taking care of properly disconnecting the
>>> controller.
>>>
>>> Thanks
>>>
>>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
>>>> really disconnect the same controller (even though the call returns
>>>> SUCCESS) and it still appears to be managed by driver. I even checked the
>>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>>> eventually?
>>>>
>>>>
>>>> Thanks
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>
>>>> No i am not trying to disconnect USB controller in use.
>>>>
>>>> ________________________________
>>>> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>>>> To: Andrew Fish; Amit kumar
>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>
>>>>
>>>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>>> *>>* Hi Andrew ,
>>>> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>>>> *>>>* I have one new query;
>>>> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>>>> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>>>> *>
>>>> Does that command work if you boot the shell?
>>>>
>>>> Thanks,
>>>>
>>>> Andrew Fish
>>>>
>>>> >>* Regards
>>>> *>>* Amit Kumar
>>>> *>>* ________________________________
>>>> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
>>>> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>> *>* Sent: Friday, March 31, 2017 10:42:08 PM
>>>> *>* To: Amit kumar
>>>> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>> *>* Subject: Re: [edk2] DisconnectController API not working.
>>>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>>> *>>>* Hi ,
>>>> *>>* I am trying to disconnect a controller from the usb mass storage
>>>> *>* driver, for which i am using
>>>> *>>* Status = gBS->DisconnectController (
>>>> *>* ControllerHandle,
>>>> *>* NULL,
>>>> *>* NULL
>>>> *>* );
>>>> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
>>>> *>* Although when i run disconnect command from shell (e.g disconnect 163
>>>> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>>>> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
>>>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>>>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>>>> *>* trollers (
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
>>>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>> *
>>>>
>>>>
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 17:51 ` TVKR
@ 2017-06-28 17:56 ` Amit kumar
2017-06-28 18:01 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 17:56 UTC (permalink / raw)
To: TVKR; +Cc: edk2-devel@lists.01.org
okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
________________________________
From: TVKR <tresko1@gmail.com>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
Did it hang ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 10:45:13 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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’t 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 eariler 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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that 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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akamit91@hotmail.com<mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 17:56 ` Amit kumar
@ 2017-06-28 18:01 ` TVKR
2017-06-28 18:02 ` TVKR
2017-06-28 18:11 ` Amit kumar
0 siblings, 2 replies; 24+ messages in thread
From: TVKR @ 2017-06-28 18:01 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
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 <akamit91@hotmail.com> wrote:
> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
> ------------------------------
> *From:* TVKR <tresko1@gmail.com>
> *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 <akamit91@hotmail.com> wrote:
>
>> Did it hang ?
>> ------------------------------
>> *From:* TVKR <tresko1@gmail.com>
>> *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 <akamit91@hotmail.com>
>> 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’t 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 eariler
>>> 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 <ControllerHandeIndex> in uefi shell.
>>> 7. If still I doesn’t work you can ping me I might suggest the other way
>>> around.
>>>
>>> Amit
>>>
>>> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com> wrote:
>>>
>>> Hi Amit,
>>>
>>> Here is the output. It is the call 'gBS->DisconnectController
>>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
>>> 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...: <null string>
>>> 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 <akamit91@hotmail.com>
>>> 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 seem to
>>>> really disconnect the same controller (even though the call returns
>>>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>>> eventually?
>>>>
>>>> Yes i was able to resolve it. It might be helpful if you can tell me
>>>> the output of dh -d <handle> command.
>>>>
>>>> Thanks
>>>>
>>>> Amit
>>>>
>>>>
>>>>
>>>> ------------------------------
>>>> *From:* TVKR <tresko1@gmail.com>
>>>> *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\UefiShellDriver1CommandsLib)
>>>> to a standalone application and it fails too. Looks like there is something
>>>> else in the shell app that is taking care of properly disconnecting the
>>>> controller.
>>>>
>>>> Thanks
>>>>
>>>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
>>>>> really disconnect the same controller (even though the call returns
>>>>> SUCCESS) and it still appears to be managed by driver. I even checked the
>>>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>>>> eventually?
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>>> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>>
>>>>> No i am not trying to disconnect USB controller in use.
>>>>>
>>>>> ________________________________
>>>>> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>>>>> To: Andrew Fish; Amit kumar
>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
>>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>>> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>>
>>>>>
>>>>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>>>> *>>* Hi Andrew ,
>>>>> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>>>>> *>>>* I have one new query;
>>>>> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>>>>> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>>>>> *>
>>>>> Does that command work if you boot the shell?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Andrew Fish
>>>>>
>>>>> >>* Regards
>>>>> *>>* Amit Kumar
>>>>> *>>* ________________________________
>>>>> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
>>>>> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>> *>* Sent: Friday, March 31, 2017 10:42:08 PM
>>>>> *>* To: Amit kumar
>>>>> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>> *>* Subject: Re: [edk2] DisconnectController API not working.
>>>>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>>>> *>>>* Hi ,
>>>>> *>>* I am trying to disconnect a controller from the usb mass storage
>>>>> *>* driver, for which i am using
>>>>> *>>* Status = gBS->DisconnectController (
>>>>> *>* ControllerHandle,
>>>>> *>* NULL,
>>>>> *>* NULL
>>>>> *>* );
>>>>> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
>>>>> *>* Although when i run disconnect command from shell (e.g disconnect 163
>>>>> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>>>>> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
>>>>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>>>>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>>>>> *>* trollers (
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
>>>>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>> *
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 18:01 ` TVKR
@ 2017-06-28 18:02 ` TVKR
2017-06-28 18:11 ` Amit kumar
1 sibling, 0 replies; 24+ messages in thread
From: TVKR @ 2017-06-28 18:02 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
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 = ShellCommandLineParse (ParamList, &ArgPackage, &ProblemParam,
TRUE);
if (!EFI_ERROR(Status)) {
Param1 = ShellCommandLineGetRawValue(ArgPackage, 1);
Status = ShellConvertStringToUint64(Param1, &Intermediate, TRUE,
FALSE);
if (EFI_ERROR(Status) || Param1 == NULL ||
ConvertHandleIndexToHandle((UINTN)Intermediate) == NULL){
Print(L"\nInvalid handle %02x\n\r", Param1);
Status = SHELL_INVALID_PARAMETER;
} else {
Handle = (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 <tresko1@gmail.com> 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 <akamit91@hotmail.com> wrote:
>
>> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
>> ------------------------------
>> *From:* TVKR <tresko1@gmail.com>
>> *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 <akamit91@hotmail.com>
>> wrote:
>>
>>> Did it hang ?
>>> ------------------------------
>>> *From:* TVKR <tresko1@gmail.com>
>>> *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 <akamit91@hotmail.com>
>>> 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’t 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 eariler
>>>> 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 <ControllerHandeIndex> in uefi shell.
>>>> 7. If still I doesn’t work you can ping me I might suggest the other
>>>> way around.
>>>>
>>>> Amit
>>>>
>>>> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com> wrote:
>>>>
>>>> Hi Amit,
>>>>
>>>> Here is the output. It is the call 'gBS->DisconnectController
>>>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
>>>> 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...: <null string>
>>>> 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 <akamit91@hotmail.com>
>>>> 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 seem to
>>>>> really disconnect the same controller (even though the call returns
>>>>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>>>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>>>> eventually?
>>>>>
>>>>> Yes i was able to resolve it. It might be helpful if you can tell me
>>>>> the output of dh -d <handle> command.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Amit
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------
>>>>> *From:* TVKR <tresko1@gmail.com>
>>>>> *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\UefiShellDriver1CommandsLib)
>>>>> to a standalone application and it fails too. Looks like there is something
>>>>> else in the shell app that is taking care of properly disconnecting the
>>>>> controller.
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com> 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 seem to
>>>>>> really disconnect the same controller (even though the call returns
>>>>>> SUCCESS) and it still appears to be managed by driver. I even checked the
>>>>>> ControllerHandle passed and it looks correct. Were you able to resolve this
>>>>>> eventually?
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>>>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>>>> To: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>>>
>>>>>> No i am not trying to disconnect USB controller in use.
>>>>>>
>>>>>> ________________________________
>>>>>> From: Tian, Feng <feng.tian at intel.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>>>>>> To: Andrew Fish; Amit kumar
>>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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 <https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
>>>>>> Sent: Tuesday, April 4, 2017 12:07 AM
>>>>>> To: Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>>> Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>>> Subject: Re: [edk2] DisconnectController API not working.
>>>>>>
>>>>>>
>>>>>> >* On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>>>>> *>>* Hi Andrew ,
>>>>>> *>>* I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>>>>>> *>>>* I have one new query;
>>>>>> *>>* i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>>>>>> *>>* i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>>>>>> *>
>>>>>> Does that command work if you boot the shell?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Andrew Fish
>>>>>>
>>>>>> >>* Regards
>>>>>> *>>* Amit Kumar
>>>>>> *>>* ________________________________
>>>>>> *>* From: afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
>>>>>> *>* <afish at apple.com <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>>> *>* Sent: Friday, March 31, 2017 10:42:08 PM
>>>>>> *>* To: Amit kumar
>>>>>> *>* Cc: edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>>> *>* Subject: Re: [edk2] DisconnectController API not working.
>>>>>> *>>>* On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com <https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>>>>> *>>>* Hi ,
>>>>>> *>>* I am trying to disconnect a controller from the usb mass storage
>>>>>> *>* driver, for which i am using
>>>>>> *>>* Status = gBS->DisconnectController (
>>>>>> *>* ControllerHandle,
>>>>>> *>* NULL,
>>>>>> *>* NULL
>>>>>> *>* );
>>>>>> *>>* after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
>>>>>> *>* Although when i run disconnect command from shell (e.g disconnect 163
>>>>>> *>* ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>>>>>> *>>* Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
>>>>>> *>* ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>>>>>> *>* Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>>>>>> *>* trollers (
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
>>>>>> *>* Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
>>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
>>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
>>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
>>>>>> *>* Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
>>>>>> *>* Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org <https://lists.01.org/mailman/listinfo/edk2-devel>>
>>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <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>
>>>>>> *>* https://lists.01.org/mailman/listinfo/edk2-devel <https://lists.01.org/mailman/listinfo/edk2-devel>
>>>>>> *
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 18:01 ` TVKR
2017-06-28 18:02 ` TVKR
@ 2017-06-28 18:11 ` Amit kumar
2017-06-28 18:23 ` Amit kumar
1 sibling, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 18:11 UTC (permalink / raw)
To: TVKR; +Cc: edk2-devel@lists.01.org
Try this; just a quick thing
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS->DisconnectController (
ConvertHandleIndexToHandle (175),
ConvertHandleIndexToHandle (176),
NULL);
return (Status);
}
________________________________
From: TVKR <tresko1@gmail.com>
Sent: Wednesday, June 28, 2017 11:31:46 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 11:21:34 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
Did it hang ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 10:45:13 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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’t 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 eariler 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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that 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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akamit91@hotmail.com<mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 18:11 ` Amit kumar
@ 2017-06-28 18:23 ` Amit kumar
2017-06-28 19:27 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 18:23 UTC (permalink / raw)
To: TVKR; +Cc: edk2-devel@lists.01.org
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS->DisconnectController (
ConvertHandleIndexToHandle (0x175),
ConvertHandleIndexToHandle (0x176),
NULL);
return (Status);
}
________________________________
From: edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Amit kumar <akamit91@hotmail.com>
Sent: Wednesday, June 28, 2017 11:41:53 PM
To: TVKR
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
Try this; just a quick thing
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS->DisconnectController (
ConvertHandleIndexToHandle (175),
ConvertHandleIndexToHandle (176),
NULL);
return (Status);
}
________________________________
From: TVKR <tresko1@gmail.com>
Sent: Wednesday, June 28, 2017 11:31:46 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] DisconnectController API not working.
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 11:21:34 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
Did it hang ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 10:45:13 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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’t 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 eariler 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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that 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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by >driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; akamit91@hotmail.com<mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib) to a standalone application and it fails too. Looks like there is something else in the shell app that is taking care of properly disconnecting the controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> 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 seem to really disconnect the same controller (even though the call returns SUCCESS) and it still appears to be managed by driver. I even checked the ControllerHandle passed and it looks correct. Were you able to resolve this eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>; 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 usb 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<https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle looks correct.
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i am getting file not found.
>
> i have also tried using load fs0:driver.efi, and again i get file not found. I have been trying to run this script from internal shell as well as usb shell.
>
Does that command work if you boot the shell?
Thanks,
Andrew Fish
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>> on behalf of Andrew Fish
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command in shell, i find it still being manged by the same old driver handle.
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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 ControllerHandle.
>
> Sequence of events matters. There are boot flows and Shell commands that do ConnectController.
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402: gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:95: gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we call the gBS->ConnectController function.
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status = gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status = gBS->ConnectController(ControllerHandle, DriverHandleList, NULL, Recursive);
> Library/UefiShellDriver1CommandsLib/Connect.c:298: Status = gBS->ConnectController (
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2 != NULL && Handle1 != NULL)));
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status = ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package, L"-r"), (BOOLEAN)(Count!=0));
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE ConnectControllerContextOverride[2];
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514: ConnectControllerContextOverride[0] = DriverImageHandle;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515: ConnectControllerContextOverride[1] = NULL;
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516: gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride, NULL, TRUE);
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status = 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><mailto:edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-devel>>
> 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>
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 18:23 ` Amit kumar
@ 2017-06-28 19:27 ` TVKR
2017-06-28 19:34 ` Andrew Fish
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 19:27 UTC (permalink / raw)
To: Amit kumar; +Cc: edk2-devel@lists.01.org
Tried it, still no luck :(
There is something in the Shell that makes the in-built disconnect without
any issues but when the same DisconnectController is called from an
application is fails.
Thanks
On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akamit91@hotmail.com> wrote:
>
>
> EFI_STATUS
> EFIAPI
> UefiMain (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> EFI_STATUS Status;
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (0x175),
> ConvertHandleIndexToHandle (0x176),
> NULL);
> return (Status);
>
> }
>
>
> ------------------------------
> *From:* edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Amit
> kumar <akamit91@hotmail.com>
> *Sent:* Wednesday, June 28, 2017 11:41:53 PM
> *To:* TVKR
> *Cc:* edk2-devel@lists.01.org
> *Subject:* Re: [edk2] DisconnectController API not working.
>
> Try this; just a quick thing
>
>
>
>
> EFI_STATUS
> EFIAPI
> UefiMain (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> EFI_STATUS Status;
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (175),
> ConvertHandleIndexToHandle (176),
> NULL);
> return (Status);
>
> }
>
>
> ________________________________
> From: TVKR <tresko1@gmail.com>
> Sent: Wednesday, June 28, 2017 11:31:46 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] DisconnectController API not working.
>
> 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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> wrote:
>
> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
> Sent: Wednesday, June 28, 2017 11:21:34 PM
>
> To: Amit kumar
> Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> wrote:
>
> Did it hang ?
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
> Sent: Wednesday, June 28, 2017 10:45:13 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> 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’t 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 eariler
> 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 <ControllerHandeIndex> in uefi shell.
> 7. If still I doesn’t work you can ping me I might suggest the other way
> around.
>
> Amit
>
> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tres
> ko1@gmail.com>> wrote:
>
> Hi Amit,
>
> Here is the output. It is the call 'gBS->DisconnectController
> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
> 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...: <null string>
> 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 <akamit91@hotmail.com<mailto:a
> kamit91@hotmail.com>> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by >driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
>
> Yes i was able to resolve it. It might be helpful if you can tell me the
> output of dh -d <handle> command.
>
> Thanks
>
> Amit
>
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
> Sent: Wednesday, June 28, 2017 6:06:11 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>;
> akamit91@hotmail.com<mailto:akamit91@hotmail.com>
>
> Subject: Re: [edk2] DisconnectController API not working.
>
> BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib)
> to a standalone application and it fails too. Looks like there is something
> else in the shell app that is taking care of properly disconnecting the
> controller.
>
> Thanks
>
> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tres
> ko1@gmail.com>> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
>
> Thanks
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<
> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Tian, Feng <feng.tian at intel.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
> No i am not trying to disconnect USB controller in use.
>
> ________________________________
> From: Tian, Feng <feng.tian at intel.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Sent: Wednesday, April 5, 2017 8:21:36 AM
> To: Andrew Fish; Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>; 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 usb
> 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<
> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew
> Fish
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Amit kumar <akamit91 at hotmail.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> > On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<
> https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
> >
> > Hi Andrew ,
> >
> > I did some testing and found out, same code works fine on Server 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 ControllerHandle
> looks correct.
> >
> >
> > I have one new query;
> >
> > i have made a startup.nsh file in which i am issuing load driver.efi , i
> am getting file not found.
> >
> > i have also tried using load fs0:driver.efi, and again i get file not
> found. I have been trying to run this script from internal shell as well
> as usb shell.
> >
>
> Does that command work if you boot the shell?
>
> Thanks,
>
> Andrew Fish
>
> >
> > Regards
> >
> > Amit Kumar
> >
> > ________________________________
> > From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
> devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
> devel>> on behalf of Andrew Fish
> > <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> > Sent: Friday, March 31, 2017 10:42:08 PM
> > To: Amit kumar
> > Cc: edk2-devel at lists.01.org<https://lists.01.
> org/mailman/listinfo/edk2-devel>
> > Subject: Re: [edk2] DisconnectController API not working.
> >
> >
> > On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<
> https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
> hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
> >
> >
> > Hi ,
> >
> > I am trying to disconnect a controller from the usb mass storage
> > driver, for which i am using
> >
> > Status = gBS->DisconnectController (
> > ControllerHandle,
> > NULL,
> > NULL
> > );
> >
> > after the call i get Status = SUCCESS , but when i run drivers command
> in shell, i find it still being manged by the same old driver handle.
> > Although when i run disconnect command from shell (e.g disconnect 163
> > ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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
> ControllerHandle.
> >
> > Sequence of events matters. There are boot flows and Shell commands that
> do ConnectController.
> > ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> > Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
> gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> > Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
> gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
> > Library/UefiShellDriver1CommandsLib/Connect.c:95:
> gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
> NULL, FALSE);
> > Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> > Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we
> call the gBS->ConnectController function.
> > Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
> gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
> > Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
> gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
> Recursive);
> > Library/UefiShellDriver1CommandsLib/Connect.c:298:
> Status = gBS->ConnectController (
> > Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> > trollers (
> > Library/UefiShellDriver1CommandsLib/Connect.c:391: return
> (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2
> != NULL && Handle1 != NULL)));
> > Library/UefiShellDriver1CommandsLib/Connect.c:536: Status =
> ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package,
> L"-r"), (BOOLEAN)(Count!=0));
> > Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
> ConnectControllerContextOverride[2];
> > Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
> ConnectControllerContextOverride[0] = DriverImageHandle;
> > Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
> ConnectControllerContextOverride[1] = NULL;
> > Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
> gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride,
> NULL, TRUE);
> > Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
> 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><mailto:edk2-devel at lists.01.org<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> > 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>
> > https://lists.01.org/mailman/listinfo/edk2-devel
>
>
>
>
>
>
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 19:27 ` TVKR
@ 2017-06-28 19:34 ` Andrew Fish
2017-06-28 19:37 ` Amit kumar
0 siblings, 1 reply; 24+ messages in thread
From: Andrew Fish @ 2017-06-28 19:34 UTC (permalink / raw)
To: TVKR; +Cc: Amit kumar, edk2-devel@lists.01.org
> On Jun 28, 2017, at 12:27 PM, TVKR <tresko1@gmail.com> wrote:
>
> Tried it, still no luck :(
>
> There is something in the Shell that makes the in-built disconnect without
> any issues but when the same DisconnectController is called from an
> application is fails.
>
It is more likely you are doing something wrong.
Using HandleIndex is risky as it is more about User Interface than reality. Have you tried printing out the EFI_HANDLE values you are passing into gBS->DisconnectController()? The should match the values you get when you dump a specific handle in the shell. The EFI_HANDLE value is not going to change, it is only going to get removed if all protocols on that handle are uninstalled.
So for example.
176: 7219E798
If you used 178 at the Shell you would expect to see 7219E798 printed out as the handle value.
Thanks,
Andrew Fish
> Thanks
>
> On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akamit91@hotmail.com> wrote:
>
>>
>>
>> EFI_STATUS
>> EFIAPI
>> UefiMain (
>> IN EFI_HANDLE ImageHandle,
>> IN EFI_SYSTEM_TABLE *SystemTable
>> )
>> {
>> EFI_STATUS Status;
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (0x175),
>> ConvertHandleIndexToHandle (0x176),
>> NULL);
>> return (Status);
>>
>> }
>>
>>
>> ------------------------------
>> *From:* edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Amit
>> kumar <akamit91@hotmail.com>
>> *Sent:* Wednesday, June 28, 2017 11:41:53 PM
>> *To:* TVKR
>> *Cc:* edk2-devel@lists.01.org
>> *Subject:* Re: [edk2] DisconnectController API not working.
>>
>> Try this; just a quick thing
>>
>>
>>
>>
>> EFI_STATUS
>> EFIAPI
>> UefiMain (
>> IN EFI_HANDLE ImageHandle,
>> IN EFI_SYSTEM_TABLE *SystemTable
>> )
>> {
>> EFI_STATUS Status;
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (175),
>> ConvertHandleIndexToHandle (176),
>> NULL);
>> return (Status);
>>
>> }
>>
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com>
>> Sent: Wednesday, June 28, 2017 11:31:46 PM
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> 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 <akamit91@hotmail.com<mailto:
>> akamit91@hotmail.com>> wrote:
>>
>> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
>> Sent: Wednesday, June 28, 2017 11:21:34 PM
>>
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:
>> akamit91@hotmail.com>> wrote:
>>
>> Did it hang ?
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
>> Sent: Wednesday, June 28, 2017 10:45:13 PM
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org<mailto: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 <akamit91@hotmail.com<mailto:
>> akamit91@hotmail.com>> 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’t 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 eariler
>> 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 <ControllerHandeIndex> in uefi shell.
>> 7. If still I doesn’t work you can ping me I might suggest the other way
>> around.
>>
>> Amit
>>
>> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tres
>> ko1@gmail.com>> wrote:
>>
>> Hi Amit,
>>
>> Here is the output. It is the call 'gBS->DisconnectController
>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
>> 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...: <null string>
>> 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 <akamit91@hotmail.com<mailto:a
>> kamit91@hotmail.com>> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve this
>> eventually?
>>
>>
>> Yes i was able to resolve it. It might be helpful if you can tell me the
>> output of dh -d <handle> command.
>>
>> Thanks
>>
>> Amit
>>
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
>> Sent: Wednesday, June 28, 2017 6:06:11 PM
>> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>;
>> akamit91@hotmail.com<mailto:akamit91@hotmail.com>
>>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib)
>> to a standalone application and it fails too. Looks like there is something
>> else in the shell app that is taking care of properly disconnecting the
>> controller.
>>
>> Thanks
>>
>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tres
>> ko1@gmail.com>> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve this
>> eventually?
>>
>>
>> Thanks
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<
>> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Tian, Feng <feng.tian at intel.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
>> devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> No i am not trying to disconnect USB controller in use.
>>
>> ________________________________
>> From: Tian, Feng <feng.tian at intel.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>> To: Andrew Fish; Amit kumar
>> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
>> devel>; 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 usb
>> 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<
>> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew
>> Fish
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Amit kumar <akamit91 at hotmail.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
>> devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>>
>>> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<
>> https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>>
>>> Hi Andrew ,
>>>
>>> I did some testing and found out, same code works fine on Server 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 ControllerHandle
>> looks correct.
>>>
>>>
>>> I have one new query;
>>>
>>> i have made a startup.nsh file in which i am issuing load driver.efi , i
>> am getting file not found.
>>>
>>> i have also tried using load fs0:driver.efi, and again i get file not
>> found. I have been trying to run this script from internal shell as well
>> as usb shell.
>>>
>>
>> Does that command work if you boot the shell?
>>
>> Thanks,
>>
>> Andrew Fish
>>
>>>
>>> Regards
>>>
>>> Amit Kumar
>>>
>>> ________________________________
>>> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
>> devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
>> devel>> on behalf of Andrew Fish
>>> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
>>> Sent: Friday, March 31, 2017 10:42:08 PM
>>> To: Amit kumar
>>> Cc: edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-devel>
>>> Subject: Re: [edk2] DisconnectController API not working.
>>>
>>>
>>> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<
>> https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
>> hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>>
>>>
>>> Hi ,
>>>
>>> I am trying to disconnect a controller from the usb mass storage
>>> driver, for which i am using
>>>
>>> Status = gBS->DisconnectController (
>>> ControllerHandle,
>>> NULL,
>>> NULL
>>> );
>>>
>>> after the call i get Status = SUCCESS , but when i run drivers command
>> in shell, i find it still being manged by the same old driver handle.
>>> Although when i run disconnect command from shell (e.g disconnect 163
>>> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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
>> ControllerHandle.
>>>
>>> Sequence of events matters. There are boot flows and Shell commands that
>> do ConnectController.
>>> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>>> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
>> gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
>> gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>> Library/UefiShellDriver1CommandsLib/Connect.c:95:
>> gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
>> NULL, FALSE);
>>> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>>> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we
>> call the gBS->ConnectController function.
>>> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
>> gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
>> gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
>> Recursive);
>>> Library/UefiShellDriver1CommandsLib/Connect.c:298:
>> Status = gBS->ConnectController (
>>> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>>> trollers (
>>> Library/UefiShellDriver1CommandsLib/Connect.c:391: return
>> (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2
>> != NULL && Handle1 != NULL)));
>>> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status =
>> ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package,
>> L"-r"), (BOOLEAN)(Count!=0));
>>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
>> ConnectControllerContextOverride[2];
>>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
>> ConnectControllerContextOverride[0] = DriverImageHandle;
>>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
>> ConnectControllerContextOverride[1] = NULL;
>>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
>> gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride,
>> NULL, TRUE);
>>> Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
>> 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><mailto:edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>>> 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>
>>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 19:34 ` Andrew Fish
@ 2017-06-28 19:37 ` Amit kumar
2017-06-28 19:53 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: Amit kumar @ 2017-06-28 19:37 UTC (permalink / raw)
To: Andrew Fish; +Cc: TVKR, edk2-devel@lists.01.org
Just a final check,
You used this
gBS->DisconnectController (
ConvertHandleIndexToHandle (0x175),
ConvertHandleIndexToHandle (0x176),
NULL);
not this
gBS->DisconnectController (
ConvertHandleIndexToHandle (175),
ConvertHandleIndexToHandle (176),
NULL);
right ?
Amit
On Jun 29, 2017, at 1:04 AM, Andrew Fish <afish@apple.com<mailto:afish@apple.com>> wrote:
On Jun 28, 2017, at 12:27 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>> wrote:
Tried it, still no luck :(
There is something in the Shell that makes the in-built disconnect without
any issues but when the same DisconnectController is called from an
application is fails.
It is more likely you are doing something wrong.
Using HandleIndex is risky as it is more about User Interface than reality. Have you tried printing out the EFI_HANDLE values you are passing into gBS->DisconnectController()? The should match the values you get when you dump a specific handle in the shell. The EFI_HANDLE value is not going to change, it is only going to get removed if all protocols on that handle are uninstalled.
So for example.
176: 7219E798
If you used 178 at the Shell you would expect to see 7219E798 printed out as the handle value.
Thanks,
Andrew Fish
Thanks
On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>> wrote:
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS->DisconnectController (
ConvertHandleIndexToHandle (0x175),
ConvertHandleIndexToHandle (0x176),
NULL);
return (Status);
}
------------------------------
*From:* edk2-devel <edk2-devel-bounces@lists.01.org<mailto:edk2-devel-bounces@lists.01.org>> on behalf of Amit
kumar <akamit91@hotmail.com<mailto:akamit91@hotmail.com>>
*Sent:* Wednesday, June 28, 2017 11:41:53 PM
*To:* TVKR
*Cc:* edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
*Subject:* Re: [edk2] DisconnectController API not working.
Try this; just a quick thing
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS->DisconnectController (
ConvertHandleIndexToHandle (175),
ConvertHandleIndexToHandle (176),
NULL);
return (Status);
}
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 11:31:46 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Subject: Re: [edk2] DisconnectController API not working.
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com><mailto:
akamit91@hotmail.com<mailto:akamit91@hotmail.com>>> wrote:
okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com><mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 11:21:34 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org><mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com><mailto:
akamit91@hotmail.com<mailto:akamit91@hotmail.com>>> wrote:
Did it hang ?
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com><mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 10:45:13 PM
To: Amit kumar
Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org><mailto: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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com><mailto:
akamit91@hotmail.com<mailto:akamit91@hotmail.com>>> 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’t 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 eariler
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 <ControllerHandeIndex> in uefi shell.
7. If still I doesn’t work you can ping me I might suggest the other way
around.
Amit
On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com><mailto:tres
ko1@gmail.com<mailto:ko1@gmail.com>>> wrote:
Hi Amit,
Here is the output. It is the call 'gBS->DisconnectController
(ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
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...: <null string>
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 <akamit91@hotmail.com<mailto:akamit91@hotmail.com><mailto:a
kamit91@hotmail.com<mailto:kamit91@hotmail.com>>> 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 seem to
really disconnect the same controller (even though the call returns
SUCCESS) and it still appears to be managed by >driver. I even checked the
ControllerHandle passed and it looks correct. Were you able to resolve this
eventually?
Yes i was able to resolve it. It might be helpful if you can tell me the
output of dh -d <handle> command.
Thanks
Amit
________________________________
From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com><mailto:tresko1@gmail.com>>
Sent: Wednesday, June 28, 2017 6:06:11 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org><mailto:edk2-devel@lists.01.org>;
akamit91@hotmail.com<mailto:akamit91@hotmail.com><mailto:akamit91@hotmail.com>
Subject: Re: [edk2] DisconnectController API not working.
BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriver1CommandsLib)
to a standalone application and it fails too. Looks like there is something
else in the shell app that is taking care of properly disconnecting the
controller.
Thanks
On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com><mailto:tres
ko1@gmail.com<mailto:ko1@gmail.com>>> 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 seem to
really disconnect the same controller (even though the call returns
SUCCESS) and it still appears to be managed by driver. I even checked the
ControllerHandle passed and it looks correct. Were you able to resolve this
eventually?
Thanks
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<http://lists.01.org><
https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
Sent: Tuesday, April 4, 2017 12:07 AM
To: Tian, Feng <feng.tian at intel.com<http://intel.com><https://lists.01.
org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.org/mailman/listinfo/edk2-
devel>
Subject: Re: [edk2] DisconnectController API not working.
No i am not trying to disconnect USB controller in use.
________________________________
From: Tian, Feng <feng.tian at intel.com<http://intel.com><https://lists.01.
org/mailman/listinfo/edk2-devel>>
Sent: Wednesday, April 5, 2017 8:21:36 AM
To: Andrew Fish; Amit kumar
Cc: edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.org/mailman/listinfo/edk2-
devel>; 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 usb
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<http://lists.01.org><
https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew
Fish
Sent: Tuesday, April 4, 2017 12:07 AM
To: Amit kumar <akamit91 at hotmail.com<http://hotmail.com><https://lists.01.
org/mailman/listinfo/edk2-devel>>
Cc: edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.org/mailman/listinfo/edk2-
devel>
Subject: Re: [edk2] DisconnectController API not working.
On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<http://hotmail.com><
https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
Hi Andrew ,
I did some testing and found out, same code works fine on Server 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 ControllerHandle
looks correct.
I have one new query;
i have made a startup.nsh file in which i am issuing load driver.efi , i
am getting file not found.
i have also tried using load fs0:driver.efi, and again i get file not
found. I have been trying to run this script from internal shell as well
as usb shell.
Does that command work if you boot the shell?
Thanks,
Andrew Fish
Regards
Amit Kumar
________________________________
From: afish at apple.com<http://apple.com><https://lists.01.org/mailman/listinfo/edk2-
devel> <afish at apple.com<http://apple.com><https://lists.01.org/mailman/listinfo/edk2-
devel>> on behalf of Andrew Fish
<afish at apple.com<http://apple.com><https://lists.01.org/mailman/listinfo/edk2-devel>>
Sent: Friday, March 31, 2017 10:42:08 PM
To: Amit kumar
Cc: edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.
org/mailman/listinfo/edk2-devel>
Subject: Re: [edk2] DisconnectController API not working.
On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<http://hotmail.com><
https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
hotmail.com<http://hotmail.com><https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
Hi ,
I am trying to disconnect a controller from the usb mass storage
driver, for which i am using
Status = gBS->DisconnectController (
ControllerHandle,
NULL,
NULL
);
after the call i get Status = SUCCESS , but when i run drivers command
in shell, i find it still being manged by the same old driver handle.
Although when i run disconnect command from shell (e.g disconnect 163
...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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
ControllerHandle.
Sequence of events matters. There are boot flows and Shell commands that
do ConnectController.
~/work/src/edk2/ShellPkg(master)>git grep ConnectController
Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:95:
gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
NULL, FALSE);
Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we
call the gBS->ConnectController function.
Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
Recursive);
Library/UefiShellDriver1CommandsLib/Connect.c:298:
Status = gBS->ConnectController (
Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
trollers (
Library/UefiShellDriver1CommandsLib/Connect.c:391: return
(ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2
!= NULL && Handle1 != NULL)));
Library/UefiShellDriver1CommandsLib/Connect.c:536: Status =
ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(Package,
L"-r"), (BOOLEAN)(Count!=0));
Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
ConnectControllerContextOverride[2];
Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
ConnectControllerContextOverride[0] = DriverImageHandle;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
ConnectControllerContextOverride[1] = NULL;
Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
gBS->ConnectController (ControllerHandle, ConnectControllerContextOverride,
NULL, TRUE);
Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
Thanks,
Andrew Fish
_______________________________________________
edk2-devel mailing list
edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.org/mailman/listinfo/edk2-
devel><mailto:edk2-devel at lists.01.org<http://lists.01.org><https://lists.01.
org/mailman/listinfo/edk2-devel>>
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>
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 19:37 ` Amit kumar
@ 2017-06-28 19:53 ` TVKR
2017-06-29 19:58 ` TVKR
0 siblings, 1 reply; 24+ messages in thread
From: TVKR @ 2017-06-28 19:53 UTC (permalink / raw)
To: Amit kumar; +Cc: Andrew Fish, edk2-devel@lists.01.org
Hi Amit,
Yes, I used the hex prefix :)
Hi Andrew,
Yes, I made sure to print out the EFI_HANDLE (ControllerHandle) that was
passed to the gBS->DisconnectController call. Below is the output:
FS0:\> TestApp.efi 175
Handle passed to gBS->DisconnectController call - 7219EA98 (175)
gBS->DisconnectController return code: 0 (Success)
Thanks
On Wed, Jun 28, 2017 at 2:37 PM, Amit kumar <akamit91@hotmail.com> wrote:
> Just a final check,
> You used this
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (0x175),
> ConvertHandleIndexToHandle (0x176),
> NULL);
>
>
> not this
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (175),
> ConvertHandleIndexToHandle (176),
> NULL);
>
>
> right ?
>
> Amit
>
> On Jun 29, 2017, at 1:04 AM, Andrew Fish <afish@apple.com> wrote:
>
>
> On Jun 28, 2017, at 12:27 PM, TVKR <tresko1@gmail.com> wrote:
>
> Tried it, still no luck :(
>
> There is something in the Shell that makes the in-built disconnect without
> any issues but when the same DisconnectController is called from an
> application is fails.
>
>
> It is more likely you are doing something wrong.
>
> Using HandleIndex is risky as it is more about User Interface than
> reality. Have you tried printing out the EFI_HANDLE values you are passing
> into gBS->DisconnectController()? The should match the values you get when
> you dump a specific handle in the shell. The EFI_HANDLE value is not going
> to change, it is only going to get removed if all protocols on that handle
> are uninstalled.
>
> So for example.
> 176: 7219E798
>
> If you used 178 at the Shell you would expect to see 7219E798 printed out
> as the handle value.
>
> Thanks,
>
> Andrew Fish
>
> Thanks
>
> On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akamit91@hotmail.com> wrote:
>
>
>
> EFI_STATUS
> EFIAPI
> UefiMain (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> EFI_STATUS Status;
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (0x175),
> ConvertHandleIndexToHandle (0x176),
> NULL);
> return (Status);
>
> }
>
>
> ------------------------------
> *From:* edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Amit
> kumar <akamit91@hotmail.com>
> *Sent:* Wednesday, June 28, 2017 11:41:53 PM
> *To:* TVKR
> *Cc:* edk2-devel@lists.01.org
> *Subject:* Re: [edk2] DisconnectController API not working.
>
> Try this; just a quick thing
>
>
>
>
> EFI_STATUS
> EFIAPI
> UefiMain (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> EFI_STATUS Status;
>
>
> gBS->DisconnectController (
> ConvertHandleIndexToHandle (175),
> ConvertHandleIndexToHandle (176),
> NULL);
> return (Status);
>
> }
>
>
> ________________________________
> From: TVKR <tresko1@gmail.com>
> Sent: Wednesday, June 28, 2017 11:31:46 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] DisconnectController API not working.
>
> 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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> wrote:
>
> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com <tresko1@gmail.com>
> >>
> Sent: Wednesday, June 28, 2017 11:21:34 PM
>
> To: Amit kumar
> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
> <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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> wrote:
>
> Did it hang ?
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com <tresko1@gmail.com>
> >>
> Sent: Wednesday, June 28, 2017 10:45:13 PM
> To: Amit kumar
> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
> <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 <akamit91@hotmail.com<mailto:
> akamit91@hotmail.com>> 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’t 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 eariler
> 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 <ControllerHandeIndex> in uefi shell.
> 7. If still I doesn’t work you can ping me I might suggest the other way
> around.
>
> Amit
>
> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tres
> ko1@gmail.com>> wrote:
>
> Hi Amit,
>
> Here is the output. It is the call 'gBS->DisconnectController
> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
> 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...: <null string>
> 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 <akamit91@hotmail.com<mailto:a
> kamit91@hotmail.com>> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by >driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
>
> Yes i was able to resolve it. It might be helpful if you can tell me the
> output of dh -d <handle> command.
>
> Thanks
>
> Amit
>
>
> ________________________________
> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com <tresko1@gmail.com>
> >>
> Sent: Wednesday, June 28, 2017 6:06:11 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
> <edk2-devel@lists.01.org>>;
> akamit91@hotmail.com<mailto:akamit91@hotmail.com <akamit91@hotmail.com>>
>
> Subject: Re: [edk2] DisconnectController API not working.
>
> BTW, I ported the disconnect code (under ShellPkg\Library\
> UefiShellDriver1CommandsLib)
> to a standalone application and it fails too. Looks like there is something
> else in the shell app that is taking care of properly disconnecting the
> controller.
>
> Thanks
>
> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tres
> ko1@gmail.com>> 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 seem to
> really disconnect the same controller (even though the call returns
> SUCCESS) and it still appears to be managed by driver. I even checked the
> ControllerHandle passed and it looks correct. Were you able to resolve this
> eventually?
>
>
> Thanks
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<
> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit kumar
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Tian, Feng <feng.tian at intel.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
> No i am not trying to disconnect USB controller in use.
>
> ________________________________
> From: Tian, Feng <feng.tian at intel.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Sent: Wednesday, April 5, 2017 8:21:36 AM
> To: Andrew Fish; Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>; 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 usb
> 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<
> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew
> Fish
> Sent: Tuesday, April 4, 2017 12:07 AM
> To: Amit kumar <akamit91 at hotmail.com<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
> Cc: edk2-devel at lists.01.org<https://lists.01.org/mailman/listinfo/edk2-
> devel>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<
>
> https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>
>
> Hi Andrew ,
>
> I did some testing and found out, same code works fine on Server 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 ControllerHandle
> looks correct.
>
>
>
> I have one new query;
>
> i have made a startup.nsh file in which i am issuing load driver.efi , i
>
> am getting file not found.
>
>
> i have also tried using load fs0:driver.efi, and again i get file not
>
> found. I have been trying to run this script from internal shell as well
> as usb shell.
>
>
>
> Does that command work if you boot the shell?
>
> Thanks,
>
> Andrew Fish
>
>
> Regards
>
> Amit Kumar
>
> ________________________________
> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
>
> devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
> devel>> on behalf of Andrew Fish
>
> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
> Sent: Friday, March 31, 2017 10:42:08 PM
> To: Amit kumar
> Cc: edk2-devel at lists.01.org<https://lists.01.
>
> org/mailman/listinfo/edk2-devel>
>
> Subject: Re: [edk2] DisconnectController API not working.
>
>
> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<
>
> https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
> hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>
>
>
> Hi ,
>
> I am trying to disconnect a controller from the usb mass storage
> driver, for which i am using
>
> Status = gBS->DisconnectController (
> ControllerHandle,
> NULL,
> NULL
> );
>
> after the call i get Status = SUCCESS , but when i run drivers command
>
> in shell, i find it still being manged by the same old driver handle.
>
> Although when i run disconnect command from shell (e.g disconnect 163
> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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
>
> ControllerHandle.
>
>
> Sequence of events matters. There are boot flows and Shell commands that
>
> do ConnectController.
>
> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
>
> gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>
> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
>
> gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>
> Library/UefiShellDriver1CommandsLib/Connect.c:95:
>
> gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
> NULL, FALSE);
>
> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we
>
> call the gBS->ConnectController function.
>
> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
>
> gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>
> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
>
> gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
> Recursive);
>
> Library/UefiShellDriver1CommandsLib/Connect.c:298:
>
> Status = gBS->ConnectController (
>
> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
> trollers (
> Library/UefiShellDriver1CommandsLib/Connect.c:391: return
>
> (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2
> != NULL && Handle1 != NULL)));
>
> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status =
>
> ConvertAndConnectControllers(Handle1, Handle2, ShellCommandLineGetFlag(
> Package,
> L"-r"), (BOOLEAN)(Count!=0));
>
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
>
> ConnectControllerContextOverride[2];
>
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
>
> ConnectControllerContextOverride[0] = DriverImageHandle;
>
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
>
> ConnectControllerContextOverride[1] = NULL;
>
> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
>
> gBS->ConnectController (ControllerHandle, ConnectControllerContextOverri
> de,
> NULL, TRUE);
>
> Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
>
> 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><mailto:edk2-devel at lists.01.org<https://lists.01.
> org/mailman/listinfo/edk2-devel>>
>
> 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>
>
> https://lists.01.org/mailman/listinfo/edk2-devel
>
>
>
>
>
>
>
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: DisconnectController API not working.
2017-06-28 19:53 ` TVKR
@ 2017-06-29 19:58 ` TVKR
0 siblings, 0 replies; 24+ messages in thread
From: TVKR @ 2017-06-29 19:58 UTC (permalink / raw)
To: Amit kumar; +Cc: Andrew Fish, edk2-devel@lists.01.org
FYI, I tried an alternative method (below) but that didn't work either (the
handle value matches correctly again)
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS
Status ;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*EfiDevicePathFromTextProtocol;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE
Handle;
Status = gBS->LocateProtocol (
&gEfiDevicePathFromTextProtocolGuid,
NULL,
(VOID **)&EfiDevicePathFromTextProtocol
);
Handle = NULL;
if (!(EFI_ERROR (Status))) {
DevicePath =
EfiDevicePathFromTextProtocol->ConvertTextToDevicePath(L"PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0)");
gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath,
&Handle);
Print(L"\nHandle: 0x%x", Handle);
Status = gBS->DisconnectController (Handle, NULL, NULL);
Print(L"\ngBS->DisconnectController return code: %02x (%r)\n\r",
Status, Status);
}
return (Status);
}
On Wed, Jun 28, 2017 at 2:53 PM, TVKR <tresko1@gmail.com> wrote:
> Hi Amit,
> Yes, I used the hex prefix :)
>
>
> Hi Andrew,
> Yes, I made sure to print out the EFI_HANDLE (ControllerHandle) that was
> passed to the gBS->DisconnectController call. Below is the output:
> FS0:\> TestApp.efi 175
> Handle passed to gBS->DisconnectController call - 7219EA98 (175)
> gBS->DisconnectController return code: 0 (Success)
>
>
> Thanks
>
>
>
> On Wed, Jun 28, 2017 at 2:37 PM, Amit kumar <akamit91@hotmail.com> wrote:
>
>> Just a final check,
>> You used this
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (0x175),
>> ConvertHandleIndexToHandle (0x176),
>> NULL);
>>
>>
>> not this
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (175),
>> ConvertHandleIndexToHandle (176),
>> NULL);
>>
>>
>> right ?
>>
>> Amit
>>
>> On Jun 29, 2017, at 1:04 AM, Andrew Fish <afish@apple.com> wrote:
>>
>>
>> On Jun 28, 2017, at 12:27 PM, TVKR <tresko1@gmail.com> wrote:
>>
>> Tried it, still no luck :(
>>
>> There is something in the Shell that makes the in-built disconnect without
>> any issues but when the same DisconnectController is called from an
>> application is fails.
>>
>>
>> It is more likely you are doing something wrong.
>>
>> Using HandleIndex is risky as it is more about User Interface than
>> reality. Have you tried printing out the EFI_HANDLE values you are passing
>> into gBS->DisconnectController()? The should match the values you get when
>> you dump a specific handle in the shell. The EFI_HANDLE value is not going
>> to change, it is only going to get removed if all protocols on that handle
>> are uninstalled.
>>
>> So for example.
>> 176: 7219E798
>>
>> If you used 178 at the Shell you would expect to see 7219E798 printed out
>> as the handle value.
>>
>> Thanks,
>>
>> Andrew Fish
>>
>> Thanks
>>
>> On Wed, Jun 28, 2017 at 1:23 PM, Amit kumar <akamit91@hotmail.com> wrote:
>>
>>
>>
>> EFI_STATUS
>> EFIAPI
>> UefiMain (
>> IN EFI_HANDLE ImageHandle,
>> IN EFI_SYSTEM_TABLE *SystemTable
>> )
>> {
>> EFI_STATUS Status;
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (0x175),
>> ConvertHandleIndexToHandle (0x176),
>> NULL);
>> return (Status);
>>
>> }
>>
>>
>> ------------------------------
>> *From:* edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Amit
>> kumar <akamit91@hotmail.com>
>> *Sent:* Wednesday, June 28, 2017 11:41:53 PM
>> *To:* TVKR
>> *Cc:* edk2-devel@lists.01.org
>> *Subject:* Re: [edk2] DisconnectController API not working.
>>
>> Try this; just a quick thing
>>
>>
>>
>>
>> EFI_STATUS
>> EFIAPI
>> UefiMain (
>> IN EFI_HANDLE ImageHandle,
>> IN EFI_SYSTEM_TABLE *SystemTable
>> )
>> {
>> EFI_STATUS Status;
>>
>>
>> gBS->DisconnectController (
>> ConvertHandleIndexToHandle (175),
>> ConvertHandleIndexToHandle (176),
>> NULL);
>> return (Status);
>>
>> }
>>
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com>
>> Sent: Wednesday, June 28, 2017 11:31:46 PM
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> 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 <akamit91@hotmail.com
>> <mailto:
>> akamit91@hotmail.com>> wrote:
>>
>> okay, os tell me , did you try "disconnect 175 176" in UEFI shell ?
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com
>> <tresko1@gmail.com>>>
>> Sent: Wednesday, June 28, 2017 11:21:34 PM
>>
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
>> <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 <akamit91@hotmail.com
>> <mailto:
>> akamit91@hotmail.com>> wrote:
>>
>> Did it hang ?
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com
>> <tresko1@gmail.com>>>
>> Sent: Wednesday, June 28, 2017 10:45:13 PM
>> To: Amit kumar
>> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
>> <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 <akamit91@hotmail.com
>> <mailto:
>> akamit91@hotmail.com>> 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’t 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 eariler
>> 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 <ControllerHandeIndex> in uefi shell.
>> 7. If still I doesn’t work you can ping me I might suggest the other way
>> around.
>>
>> Amit
>>
>> On Jun 28, 2017, at 8:05 PM, TVKR <tresko1@gmail.com<mailto:tres
>> ko1@gmail.com>> wrote:
>>
>> Hi Amit,
>>
>> Here is the output. It is the call 'gBS->DisconnectController
>> (ControllerHandle, NULL, NULL)' (where ControllerHandle=7219EA98) that
>> 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...: <null string>
>> 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 <akamit91@hotmail.com<mailto:
>> a
>> kamit91@hotmail.com>> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by >driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve
>> this
>> eventually?
>>
>>
>> Yes i was able to resolve it. It might be helpful if you can tell me the
>> output of dh -d <handle> command.
>>
>> Thanks
>>
>> Amit
>>
>>
>> ________________________________
>> From: TVKR <tresko1@gmail.com<mailto:tresko1@gmail.com
>> <tresko1@gmail.com>>>
>> Sent: Wednesday, June 28, 2017 6:06:11 PM
>> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org
>> <edk2-devel@lists.01.org>>;
>> akamit91@hotmail.com<mailto:akamit91@hotmail.com <akamit91@hotmail.com>>
>>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> BTW, I ported the disconnect code (under ShellPkg\Library\UefiShellDriv
>> er1CommandsLib)
>> to a standalone application and it fails too. Looks like there is
>> something
>> else in the shell app that is taking care of properly disconnecting the
>> controller.
>>
>> Thanks
>>
>> On Tue, Jun 27, 2017 at 5:54 PM, TVKR <tresko1@gmail.com<mailto:tres
>> ko1@gmail.com>> 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 seem to
>> really disconnect the same controller (even though the call returns
>> SUCCESS) and it still appears to be managed by driver. I even checked the
>> ControllerHandle passed and it looks correct. Were you able to resolve
>> this
>> eventually?
>>
>>
>> Thanks
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org<
>> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Amit
>> kumar
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Tian, Feng <feng.tian at intel.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-
>> devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>> No i am not trying to disconnect USB controller in use.
>>
>> ________________________________
>> From: Tian, Feng <feng.tian at intel.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Sent: Wednesday, April 5, 2017 8:21:36 AM
>> To: Andrew Fish; Amit kumar
>> Cc: edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-
>> devel>; 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 usb
>> 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<
>> https://lists.01.org/mailman/listinfo/edk2-devel>] On Behalf Of Andrew
>> Fish
>> Sent: Tuesday, April 4, 2017 12:07 AM
>> To: Amit kumar <akamit91 at hotmail.com<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>> Cc: edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-
>> devel>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>>
>> On Apr 3, 2017, at 2:58 AM, Amit kumar <akamit91 at hotmail.com<
>>
>> https://lists.01.org/mailman/listinfo/edk2-devel>> wrote:
>>
>>
>> Hi Andrew ,
>>
>> I did some testing and found out, same code works fine on Server 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 ControllerHandle
>> looks correct.
>>
>>
>>
>> I have one new query;
>>
>> i have made a startup.nsh file in which i am issuing load driver.efi , i
>>
>> am getting file not found.
>>
>>
>> i have also tried using load fs0:driver.efi, and again i get file not
>>
>> found. I have been trying to run this script from internal shell as well
>> as usb shell.
>>
>>
>>
>> Does that command work if you boot the shell?
>>
>> Thanks,
>>
>> Andrew Fish
>>
>>
>> Regards
>>
>> Amit Kumar
>>
>> ________________________________
>> From: afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
>>
>> devel> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-
>> devel>> on behalf of Andrew Fish
>>
>> <afish at apple.com<https://lists.01.org/mailman/listinfo/edk2-devel>>
>> Sent: Friday, March 31, 2017 10:42:08 PM
>> To: Amit kumar
>> Cc: edk2-devel at lists.01.org<https://lists.01.
>>
>> org/mailman/listinfo/edk2-devel>
>>
>> Subject: Re: [edk2] DisconnectController API not working.
>>
>>
>> On Mar 31, 2017, at 5:26 AM, Amit kumar <akamit91 at hotmail.com<
>>
>> https://lists.01.org/mailman/listinfo/edk2-devel><mailto:akamit91 at
>> hotmail.com<https://lists.01.org/mailman/listinfo/edk2-devel>>> wrote:
>>
>>
>>
>> Hi ,
>>
>> I am trying to disconnect a controller from the usb mass storage
>> driver, for which i am using
>>
>> Status = gBS->DisconnectController (
>> ControllerHandle,
>> NULL,
>> NULL
>> );
>>
>> after the call i get Status = SUCCESS , but when i run drivers command
>>
>> in shell, i find it still being manged by the same old driver handle.
>>
>> Although when i run disconnect command from shell (e.g disconnect 163
>> ...output disconnect(163,0,0):Status = SUCCESS) it works as expected 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
>>
>> ControllerHandle.
>>
>>
>> Sequence of events matters. There are boot flows and Shell commands that
>>
>> do ConnectController.
>>
>> ~/work/src/edk2/ShellPkg(master)>git grep ConnectController
>> Library/UefiShellDebug1CommandsLib/LoadPciRom.c:402:
>>
>> gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:54: Status =
>>
>> gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:95:
>>
>> gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL,
>> NULL, FALSE);
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:116:ConnectControllers (
>> Library/UefiShellDriver1CommandsLib/Connect.c:150: // This is where we
>>
>> call the gBS->ConnectController function.
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:158: Status =
>>
>> gBS->ConnectController(*HandleWalker, DriverHandleList, NULL, Recursive);
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:167: Status =
>>
>> gBS->ConnectController(ControllerHandle, DriverHandleList, NULL,
>> Recursive);
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:298:
>>
>> Status = gBS->ConnectController (
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:354:ConvertAndConnectCon
>> trollers (
>> Library/UefiShellDriver1CommandsLib/Connect.c:391: return
>>
>> (ConnectControllers(Handle1, Handle2, Recursive, Output, (BOOLEAN)(Handle2
>> != NULL && Handle1 != NULL)));
>>
>> Library/UefiShellDriver1CommandsLib/Connect.c:536: Status =
>>
>> ConvertAndConnectControllers(Handle1, Handle2,
>> ShellCommandLineGetFlag(Package,
>> L"-r"), (BOOLEAN)(Count!=0));
>>
>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:492: EFI_HANDLE
>>
>> ConnectControllerContextOverride[2];
>>
>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:514:
>>
>> ConnectControllerContextOverride[0] = DriverImageHandle;
>>
>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:515:
>>
>> ConnectControllerContextOverride[1] = NULL;
>>
>> Library/UefiShellDriver1CommandsLib/DrvCfg.c:516:
>>
>> gBS->ConnectController (ControllerHandle, ConnectControllerContextOverri
>> de,
>> NULL, TRUE);
>>
>> Library/UefiShellLevel2CommandsLib/Load.c:52: Status =
>>
>> 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><mailto:edk2-devel at lists.01.org<https://lists.01.
>> org/mailman/listinfo/edk2-devel>>
>>
>> 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>
>>
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
>>
>>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2017-06-29 19:57 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 22:54 DisconnectController API not working TVKR
2017-06-28 12:36 ` TVKR
2017-06-28 14:07 ` Amit kumar
2017-06-28 14:35 ` TVKR
2017-06-28 15:29 ` Amit kumar
2017-06-28 17:15 ` TVKR
2017-06-28 17:50 ` Amit kumar
2017-06-28 17:51 ` TVKR
2017-06-28 17:56 ` Amit kumar
2017-06-28 18:01 ` TVKR
2017-06-28 18:02 ` TVKR
2017-06-28 18:11 ` Amit kumar
2017-06-28 18:23 ` Amit kumar
2017-06-28 19:27 ` TVKR
2017-06-28 19:34 ` Andrew Fish
2017-06-28 19:37 ` Amit kumar
2017-06-28 19:53 ` TVKR
2017-06-29 19:58 ` TVKR
-- strict thread matches above, loose matches on Subject: below --
2017-03-31 12:26 Amit kumar
2017-03-31 17:12 ` Andrew Fish
2017-04-03 9:58 ` Amit kumar
2017-04-03 16:07 ` Andrew Fish
2017-04-05 2:51 ` Tian, Feng
2017-04-05 3:38 ` Amit kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox