Reviewed-by: Feng Tian <[email protected]>

-----Original Message-----
From: Laszlo Ersek [mailto:[email protected]] 
Sent: Wednesday, September 16, 2015 10:57
To: [email protected]
Cc: Alexander Graf; Reza Jelveh; Justen, Jordan L; Hannes Reinecke; Gabriel L. 
Somlo; Tian, Feng
Subject: [PATCH v4 07/10] MdeModulePkg: AtaAtapiPassThru: select master/slave 
around DIAG command

From: Reza Jelveh <[email protected]>

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 both before and after sending the 
DIAG command; otherwise reading the IDE registers yields the master's ID fields.

(Reza's patch originally *moved* the master/slave selection from after the DIAG 
command before it, however Feng asked for the original master/slave select to 
be preserved; effectively making the master/slave select
*bracket* the DIAG command. See this subthread:
<http://thread.gmane.org/gmane.comp.bios.tianocore.devel/10545/focus=10550>.)

Cc: Alexander Graf <[email protected]>
Cc: Reza Jelveh <[email protected]>
Cc: Jordan Justen <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Gabriel L. Somlo <[email protected]>
Cc: Feng Tian <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Reza Jelveh <[email protected]>
[[email protected]: see above]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <[email protected]>
[[email protected]: updated commit message]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
index 420ad27..4928ed5 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
@@ -2614,6 +2614,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
     //
--
1.8.3.1


_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to