From: Reza Jelveh <reza.jel...@tuhh.de> The slave or master device must be selected before sending the diagnostics command, otherwise reading the Ide registers yields invalid results.
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); -- 1.9.2 ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel