Rafael,

>
>The error happen because the the GetNextDevice does not find anything.
>Any idea about the problem ?
>
>As I said before, the code works correctly on a notebook with a sas hdd, but 
>don't work on a server with 2 sas hdds.
>
>Thanks and Regards
>

Just to make sure you're not mixing SATA and SAS as interchangeable...

SAS hdds implement the SCSI protocol and thus the driver would (normally) 
export the EFI_EXT_SCSI_PASS_THRU_PROTOCOL. It's not uncommon for drivers to 
expose both - for example ATAPI devices in a SATA driver might return the same 
device for both ATA and EXT_SCSI pass thru. (Are you sure the notebook is SAS 
and not SATA?)

If your server has a SAS controller, then try EFI_EXT_SCSI_PASS_THRU_PROTOCOL. 
Same general idea as for ATA except that you're looking for Targets, not ports.

-Joe Thomas

// Joseph Thomas
// Principal Software Engineer
// Dot Hill Systems
// 2905 NorthWest Blvd., Suite 20
// Plymouth, MN 55441
// 763.226.2640

From: Rafael Machado [mailto:rafaelrodrigues.mach...@gmail.com]
Sent: Thursday, October 18, 2012 2:08 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Sata hdds ports not recognized

Thanks for the answer Isakov.
The code is this way now :

EFI_STATUS TestMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
 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;
 Print(L"*****************\n");
 Print(L"*Ata*\n");
 Print(L"*****************\n");
 Status = gBS->LocateHandleBuffer(ByProtocol,
         &gEfiAtaPassThruProtocolGuid,
         NULL,
         &HandleCount,
         &HandleBuffer);
 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);
   Port = 0xFFFF;
   PortMultiplierPort = 0xFFFF;
   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");
      }
      else
      {
       Print(L"Status: %x\n", Status);
      }
     }
     else
     {
      Print(L"Status: %x\n", Status);
     }
   }while(!EFI_ERROR(Status));
  }
 }
 else
 {
  Print(L"Status: %x\n", Status);
 }
  return Status;
}


The prints are displaied on the following way:

*****************
*Ata*
*****************
gEfiAtaPassThruProtocolGuid HandleCount: 1
HandleIndex: 0
Status: E


The error happen because the the GetNextDevice does not find anything.
Any idea about the problem ?

As I said before, the code works correctly on a notebook with a sas hdd, but 
don't work on a server with 2 sas hdds.

Thanks and Regards

PS.: should the command "dh -p AtaPassThru" return something in my case ? This 
command doesn't return nothing. Neither on the server, where the code does not 
work, nor on the notebook, where the code works.

Thanks everyone.
Rafael R. Machado


2012/10/18 Sergey Isakov <isakov...@bk.ru<mailto:isakov...@bk.ru>>
No, Rafael.
You must assign Port = 0xFFFF;  inside for() cycle, not outside.

Type
dh -b
 to see all handles and their protocols
Sergey

On 18.10.2012, at 16:42, Rafael Machado 
<rafaelrodrigues.mach...@gmail.com<mailto:rafaelrodrigues.mach...@gmail.com>> 
wrote:


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<mailto: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<mailto: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<mailto: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<mailto: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<mailto: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<mailto: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