]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg AtaBusDxe: Fix ATA commands cannot be sent to some devices
authorHao Wu <hao.a.wu@intel.com>
Mon, 11 Jul 2016 04:56:48 +0000 (12:56 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 12 Jul 2016 12:27:25 +0000 (20:27 +0800)
If there is no port multiplier (PortMultiplierPort = 0xFFFF), current code
in functions TransferAtaDevice() and TrustTransferAtaDevice() will always
set the DEV bit of the ATA device register. It causes that ATA commands
cannot be sent to some ATA hard drives.

Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c

index a3739fc80b5e51d40c435a1a7297bd8b882c3871..35a1b47e8a36b63f9bf6c4017227a3ccf17d8aef 100644 (file)
@@ -10,7 +10,7 @@
   for Security Protocol Specific layout. This implementation uses big endian for\r
   Cylinder register.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -495,7 +495,7 @@ TransferAtaDevice (
   Acb->AtaSectorNumber = (UINT8) StartLba;\r
   Acb->AtaCylinderLow = (UINT8) RShiftU64 (StartLba, 8);\r
   Acb->AtaCylinderHigh = (UINT8) RShiftU64 (StartLba, 16);\r
-  Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4));\r
+  Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));\r
   Acb->AtaSectorCount = (UINT8) TransferLength;\r
   if (AtaDevice->Lba48Bit) {\r
     Acb->AtaSectorNumberExp = (UINT8) RShiftU64 (StartLba, 24);\r
@@ -1027,7 +1027,7 @@ TrustTransferAtaDevice (
   //\r
   Acb->AtaCylinderHigh  = (UINT8) SecurityProtocolSpecificData;\r
   Acb->AtaCylinderLow   = (UINT8) (SecurityProtocolSpecificData >> 8);\r
-  Acb->AtaDeviceHead    = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4));\r
+  Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : (AtaDevice->PortMultiplierPort << 4)));\r
 \r
   //\r
   // Prepare for ATA pass through packet.\r