Hello Andrew,

As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo (The 
Interface 3rd parameter ) should remain NULL.
But after    OpenProtocol call even though Status = EFI_ALREADY_STARTED PciIo 
(The Interface 3rd parameter ) is getting modified and it not NULL anymore.
Is this not a problem ?

Status = gBS->OpenProtocol (
                  Controller,
                  &gEfiPciIoProtocolGuid,
                  (VOID **) &PciIo,
                  This->DriverBindingHandle,
                  Controller,
                  EFI_OPEN_PROTOCOL_BY_DRIVER
                  );

________________________________
From: [email protected] <[email protected]> on behalf of Andrew Fish 
<[email protected]>
Sent: Thursday, June 1, 2017 10:28:16 PM
To: Amit kumar
Cc: [email protected]
Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol()


> On Jun 1, 2017, at 9:46 AM, Amit kumar <[email protected]> wrote:
>
> Hi,
> I am trying to open PciIoProtocol and facing some issue.
>
> below is the code
>
> EFI_PCI_IO_PROTOCOL *PciIo=NULL;
> EFI_STATUS                      Status;
>
> Status = gBS->OpenProtocol (
>                  Controller,
>                  &gEfiPciIoProtocolGuid,
>                  (VOID **) &PciIo,
>                  This->DriverBindingHandle,
>                  Controller,
>                  EFI_OPEN_PROTOCOL_BY_DRIVER
>                  );
>
> it returns Status = EFI_ALREADY_STARTED, but PciIo is not NULL.
> Is it not supposed to return PciIo as NULL ?
> As per UEFI 2.6 Spec Section 6.3 page 182.
>

Amit,

Look at the Status Codes Returned section at the end of that section.

Attributes is BY_DRIVER and there is an item on the open list with an attribute 
of BY_DRIVER whose agent handle is the same as AgentHandle.

Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list with an 
attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as AgentHandle.

Thanks,

Andrew Fish

> There are a number of reasons that this function call can return an error. If 
> an error is returned, then
> AgentHandle, ControllerHandle, and Attributes are not added to the list of 
> agents
> consuming the protocol interface specified by Handle and Protocol, and 
> Interface is
> returned unmodified.
>
> Thanks And Regards
> Amit
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to