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 ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel