Thanks for the answers Feng and Isakov.

On my first message I din't put my hole function here.
The variables you mentioned were already declared and initialized this way:

 EFI_STATUS        Status = EFI_SUCCESS;
 EFI_ATA_PASS_THRU_PROTOCOL    *ataProtocol;
 UINT16         Port;
 UINT16         PortMultiplierPort;

 EFI_HANDLE *HandleBuffer = (EFI_HANDLE *) NULL;

 UINTN HandleCount = 0;
 UINTN HandleIndex = 0;
 Port = 0xFFFF;
 PortMultiplierPort = 0xFFFF;

I think probably the problem is what Feng told.
I have two questions.

First.
I've searched for a command to  check all available protocols on a computer.
I didn't find anything.
Does any of you know if is there a command that do this kind of magic ?
Some comand like:  shell:> list_all_available_protocols_on_this_computer
(with a better name)

Second.
As Feng told, even if the shell main screen display the HDDs thare is a
possibility of not having access to the ata_pass_thru_protocol. But how the
HDDs are recognized by the system ?

Thanks again everyone.
Rafael R. Machado






2012/10/18 Sergey Isakov <isakov...@bk.ru>

> Hi Rafael,
>
> Set
> Port = 0xFFFF;
> before
> do {
>
> Regards,
> Sergey
>
> On 18.10.2012, at 0:09, Rafael Machado <rafaelrodrigues.mach...@gmail.com>
> wrote:
>
> Hi everyone.
> I'm having a problem with an sample code I've developed.
> This code should display the ports and Multiports of the Sata hdds that
> are connected to the board.
> The strange thing is that the HDD device paths are displayed at uefi main
> screen, but the following code does not return any port.
> Another strange thig is that this code works correctly on a notebook.
> The computer that it doesn't work is a server with 2 sata hdds connected
> to a backplane that is connected to the sata entries of the motherboard
> with AHCI mode enabled.
>
>
>   Print(L"*****************\n");
>  Print(L"*Ata Device Path*\n", HandleCount);
>  Print(L"*****************\n");
>
>  Status = gBS->LocateHandleBuffer(ByProtocol,
>          &gEfiAtaPassThruProtocolGuid,
>          NULL,
>          &HandleCount,
>          &HandleBuffer);
>
>
>  // Checks if happen some error in the handle localization
>  if (Status == EFI_SUCCESS)
>  {
>
>   Print(L"gEfiAtaPassThruProtocolGuid HandleCount: %d\n", HandleCount);
>
>   // Loop to walk in the handles
>   for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex ++)
>   {
>    Print(L"HandleIndex: %d\n", HandleIndex);
>
>    Status = gBS->OpenProtocol(HandleBuffer[HandleIndex],
>           &gEfiAtaPassThruProtocolGuid,
>           (VOID **) &ataProtocol,
>           ImageHandle,
>           NULL,
>           EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
>
>    if(EFI_ERROR(Status))
>    {
>     Print(L"Status: %x\n", Status);
>    }
>
>
>    do {
>      Status = ataProtocol->GetNextPort(ataProtocol,
>              &Port);
>
>      if(!EFI_ERROR(Status))
>      {
>       Status = ataProtocol->GetNextDevice(ataProtocol,
>                Port,
>                &PortMultiplierPort);
>
>       if(!EFI_ERROR(Status))
>       {
>        Print(L"Port: %d\n",Port);
>        Print(L"PortMultiplierPort: %d\n", PortMultiplierPort);
>        Print(L"-----------------------------------\n");
>       }
>      }
>
>    }while(!EFI_ERROR(Status));
>
>   }
>  }
>  else
>  {
>   Print(L"Status: %x\n", Status);
>  }
>
>
> Any idea ?
>
> Thanks everyone.
>
> Rafael R. Machado
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
>
> http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to