Hi, Reza I did a bigger scope test on your proposed patch. it will bring issue when a HDD is in primary master and a cdrom is in primary slave at Intel DQ57 platform.. The cdrom may be identified as HDD and will get a ABORT error for IDENTIFY cmd.
To solve this issue, I modified your code like attachment (set device select before and after DIAG cmd rather than only before this cmd). This way works at my test platform. Please review and help test it at Qemu. Thanks Feng -----Original Message----- From: reza.jel...@tuhh.de [mailto:reza.jel...@tuhh.de] Sent: Thursday, October 23, 2014 07:02 To: edk2-devel@lists.sourceforge.net Cc: Zeng, Star; Tian, Feng; ler...@redhat.com; asava....@gmail.com; Reza Jelveh Subject: [PATCH v3 5/5] MdeModulePkg; IdeMode select master/slave before diagnostics command From: Reza Jelveh <reza.jel...@tuhh.de> Some Ide controllers only update ID fields such as sector information on specific commands such as the DIAG command. The master/slave device is therefore selected before sending the DIAG command otherwise reading the IDE registers yields the masters ID fields. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Reza Jelveh <reza.jel...@tuhh.de> --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c index e5beea6..35330e2 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c @@ -2593,6 +2593,11 @@ DetectAndConfigIdeDevice ( for (IdeDevice = 0; IdeDevice < EfiIdeMaxDevice; IdeDevice++) { // + // Select Master or Slave device to get the return signature for ATA DEVICE DIAGNOSTIC cmd. + // + IdeWritePortB (PciIo, IdeRegisters->Head, (UINT8)((IdeDevice << 4) + | 0xe0)); + + // // Send ATA Device Execut Diagnostic command. // This command should work no matter DRDY is ready or not // @@ -2605,10 +2610,6 @@ DetectAndConfigIdeDevice ( } // - // Select Master or Slave device to get the return signature for ATA DEVICE DIAGNOSTIC cmd. - // - IdeWritePortB (PciIo, IdeRegisters->Head, (UINT8)((IdeDevice << 4) | 0xe0)); - // // Stall for 1 milliseconds. // MicroSecondDelay (1000); -- 2.1.1
IdeMode.c.patch
Description: IdeMode.c.patch
------------------------------------------------------------------------------
_______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel