Reviewed-by: Feng Tian <[email protected]> Thanks Feng
-----Original Message----- From: edk2-devel [mailto:[email protected]] On Behalf Of Hao Wu Sent: Monday, July 11, 2016 1:21 PM To: [email protected] Cc: Wu, Hao A <[email protected]>; Tian, Feng <[email protected]> Subject: [edk2] [PATCH] MdeModulePkg AtaBusDxe: Fix ATA commands cannot be sent to some devices 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 <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <[email protected]> --- MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c index a3739fc..35a1b47 100644 --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c @@ -10,7 +10,7 @@ for Security Protocol Specific layout. This implementation uses big endian for Cylinder register. - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2009 - 2016, Intel Corporation. All rights + reserved.<BR> (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -495,7 +495,7 @@ TransferAtaDevice ( Acb->AtaSectorNumber = (UINT8) StartLba; Acb->AtaCylinderLow = (UINT8) RShiftU64 (StartLba, 8); Acb->AtaCylinderHigh = (UINT8) RShiftU64 (StartLba, 16); - Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4)); + Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | + (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : + (AtaDevice->PortMultiplierPort << 4))); Acb->AtaSectorCount = (UINT8) TransferLength; if (AtaDevice->Lba48Bit) { Acb->AtaSectorNumberExp = (UINT8) RShiftU64 (StartLba, 24); @@ -1027,7 +1027,7 @@ TrustTransferAtaDevice ( // Acb->AtaCylinderHigh = (UINT8) SecurityProtocolSpecificData; Acb->AtaCylinderLow = (UINT8) (SecurityProtocolSpecificData >> 8); - Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | (AtaDevice->PortMultiplierPort << 4)); + Acb->AtaDeviceHead = (UINT8) (BIT7 | BIT6 | BIT5 | + (AtaDevice->PortMultiplierPort == 0xFFFF ? 0 : + (AtaDevice->PortMultiplierPort << 4))); // // Prepare for ATA pass through packet. -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

