1.       Even if you saw the HDD device path at UEFI shell/main screen, it 
doesn't mean your bios produce ATA_PASS_THRU protocol.


2.    If ATA_PASS_THRU protocol is produced, you should pass 0xFFFF into 
GetNextPort() and 0xFFFF into GetNextDevice() to traverse all ATA devices.
Details please refer to UEFI spec 12.11 and AtaBus driver code in 
MdeModulePkg/Bus/Ata.

From: Rafael Machado [mailto:rafaelrodrigues.mach...@gmail.com]
Sent: Thursday, October 18, 2012 04:09
To: edk2-devel
Subject: [edk2] Sata hdds ports not recognized

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

Reply via email to