Hi, Reza

IMHO, it should jump out the loop at the below point if we put break statement 
inside the new if.

        PrdCount = *(volatile UINT32 *) 
(&(AhciRegisters->AhciCmdList[0].AhciCmdPrdbc));
        if (PrdCount == DataCount) {
          break;
        }

As I have no the test env, could you help me verify if it's true?

Thanks
Feng

-----Original Message-----
From: Reza Jelveh [mailto:[email protected]] 
Sent: Friday, August 08, 2014 17:54
To: Tian, Feng
Cc: [email protected]; [email protected]
Subject: Re: [edk2] [PATCH 2/2] MdeModulePkg: Check D2H register status in 
AhciPioTransfer

On 08/08/14 01:12, Tian, Feng wrote:
> Hi, Reza
> 
> That's the problem.
> 
> For PIO DATA-OUT command protocol, D2H either indicates that the transfer was 
> completed or that's an error occurred.
> But for PIO DATA-IN command protocol, I don't see such sentence from SATA 2.6 
> spec.
> 
> If the transfer has been completed, why the loop doesn't jump out when SETUP 
> FIS received and expected data size was transferred?
> So there is only one possibility: more data transfer required but D2H 
> received here. How could we return now? Doesn't it cause data lost?

If we don't break out of the loop the opposite will happen. It will continue 
pausing and reading indefinitely until the retry limit is reached.

I'm not sure if I'm right but if you were to follow the spec literally 
responses to commands like identify are synchronous and don't have a D2H at the 
end. OS drivers seem to have no problems with these quirks, but AhciMode.c will 
simply fail with those sata controllers.

I'm guessing that some Arm controller have the same problem after seeing this 
patch on the linaro mailing list:

http://lists.linaro.org/pipermail/linaro-uefi/2014-June/000275.html

According to the spec D2H here should indeed only occur on error, but this is 
not always the case.

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to