Re: [edk2] OpenProtocol "By Driver" Issues. (SafeOpenProtocol)

Subject: Re: [edk2] OpenProtocol "By Driver" Issues. (SafeOpenProtocol)

From: "David F." <df7729@gmail.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2013-09-12 17:46:46

I think I see one thing, it looks like UninstallMultipleProtocolInterfaces isn't uninstalling them because I'm seeing a Print() statement repeating multiple times on the CnnectController() call open 1, close 1, get one message that supported() called, open 2, close 2, get two messages that supported() called, etc.. I'll dig in to that...


On Wed, Sep 11, 2013 at 8:31 AM, David F. <df7729@gmail.com> wrote:
Another issue I see with by_driver is say you have opened a volume, but now you want the block device so you can read a sector somewhere else (say 0) on the drive, if you do, it can be denied or kicks off the volume. You want to try and open each protocol so it doesn't go away from hot removal because it says it's per protocol, it may be better if it was all protocols per device, so you could open just one in a mode that won't allow removal, but still be able to open the other various protocols BY_HANDLE_PROTOCOL and they won't go away. or as mentioned a new BY_APPLICATION where it prevents removal but allows sharing....


On Thu, Sep 5, 2013 at 1:20 PM, David F. <df7729@gmail.com> wrote:
I don't have a debugger setup on the system, nor do I know how to, just using the old printf method. I did check that the handle opened eariler is the same one being reopened down below. I did notice also that on each z-loop the handles that opened remained the same on each loop where as the media path type handles (which don't open in BY_DRIVER mode) changed probably due to the reconnect() call?



On Thu, Sep 5, 2013 at 1:11 PM, Andrew Fish <afish@apple.com> wrote:
Can you get a stack trace of the hang?

It could be you are passing in an invalid handle, but the DXE Core should check for this via the EFI_HANDLE_SIGNATURE that it uses internally to make sure handles are valid.

Thanks,

Andrew Fish

On Sep 5, 2013, at 12:44 PM, "David F." <df7729@gmail.com> wrote:

> Hi,
>
> Using the SafeOpenProtocolLib in an application which basically does a BY_DRIVER open if it can, if not then a BY_DRIVER | EXCLUSIVE to force things off if it can, if that works then when it closes the protocol it also calls reconnect(). A few things based on that...
>
> 1 - Media Paths Can't be opened (BY_HANDLE they can) - no big deal for me.
>
> 2 - Opening Disk IO Protocol fails (Block IO opened prior ok)
>
> 3 - Having a system lock up when reconnect is called if you don't do the LocateHandleBuffer first. See the following proof (z can be set to different values but failure is always there at the reopen). The same type of issue occurs if you disconnect then reconnect a USB drive after the following if it the reopen is commented out. So what's going on here???
>
> // MotherBoard: Intel DH77KC
> // BIOS: KCH7710H,86A,0108.2013.0305.1638
> // ALSO NOTE: No ATA Pass Thru protocol seems to be available for a SATA HD.
>
> #define UEFI_BS gBS
> void ScanDevicesProof()
> {
> EFI_HANDLE savehandle;
> SAFE_OPEN_PROTOCOL_LIB_HANDLE *safeblockhandle;
> EFI_BLOCK_IO_PROTOCOL *blkio;
> UINTN handlecount;
> EFI_HANDLE *handlepointer;
> EFI_STATUS status;
> UINT z;
> UINT i;
>
> for (z=0;z<2;z++) {
> printf("***Next Z****\n");
> status=UEFI_BS->LocateHandleBuffer(ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &handlecount, &handlepointer);
> if (!EFI_ERROR(status)) {
> for (i=0; i<handlecount; i++) {
> printf("open %p...", handlepointer[i]);
> if ((safeblockhandle=SafeOpenProtocol(handlepointer[i], &gEfiBlockIoProtocolGuid, (void**) &blkio, NULL))!=NULL) {
> // save first handle for reopen
> if (i==0) {
> savehandle=handlepointer[i];
> }
> printf("ok closing...");
> SafeCloseProtocol(safeblockhandle);
> printf("ok\n");
> }
> else printf("fail\n");
> }
> UEFI_BS->FreePool(handlepointer);
> }
> }
>
> // open it and close it now
> printf(">>>>>>> reopen (%p)...", savehandle);
> if ((safeblockhandle=SafeOpenProtocol(savehandle, &gEfiBlockIoProtocolGuid, (void**) &blkio, NULL))!=NULL) {
> printf("ok closing...");
> SafeCloseProtocol(safeblockhandle); // <<<<<<<<<<<<<<< HANG ON RECONNECT
> printf("ok\n");
> }
> else printf("fail\n");
> printf("done\n");
> }
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel