From patchwork Wed Sep 21 20:33:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Lloyd X-Patchwork-Id: 76713 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2244051qgf; Wed, 21 Sep 2016 13:33:25 -0700 (PDT) X-Received: by 10.98.145.25 with SMTP id l25mr7969862pfe.63.1474490005378; Wed, 21 Sep 2016 13:33:25 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id e1si77314244pfd.27.2016.09.21.13.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 13:33:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B12951A1F08; Wed, 21 Sep 2016 13:33:24 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E14021A1EC7 for ; Wed, 21 Sep 2016 13:33:23 -0700 (PDT) Received: from E107800.Emea.Arm.com (e107800.emea.arm.com [10.1.33.85]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id u8LKXKhb008453; Wed, 21 Sep 2016 21:33:21 +0100 From: evan.lloyd@arm.com To: edk2-devel@ml01.01.org Date: Wed, 21 Sep 2016 21:33:13 +0100 Message-Id: <20160921203315.11204-2-evan.lloyd@arm.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160921203315.11204-1-evan.lloyd@arm.com> References: <20160921203315.11204-1-evan.lloyd@arm.com> Subject: [edk2] [PATCH 1/3] ArmPlatformPkg: Fix PL011 FIFO size test X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Harkin , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Evan Lloyd This change updates PL011UartInitializePort to compare ReceiveFifoDepth with the correct hardware FIFO size instead of the constant 32 used previously. This corrects a minor bug where a request for a fifo size > 15 and < 32 would not have been honoured on a system with a 16 byte FIFO. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sami Mujawar Signed-off-by: Evan Lloyd --- ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c index 3748972acbfc80f1077b9b928756a72cc77b5c75..b3ea138bf60b93a1000dd29aedaad206f2d15f2b 100644 --- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c +++ b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c @@ -79,17 +79,18 @@ PL011UartInitializePort ( UINT32 Divisor; UINT32 Integer; UINT32 Fractional; + UINT32 HardwareFifoDepth; + HardwareFifoDepth = (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) \ + > PL011_VER_R1P4) \ + ? 32 : 16 ; // The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept // 1 char buffer as the minimum FIFO size. Because everything can be rounded // down, there is no maximum FIFO size. - if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= 32)) { + if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= HardwareFifoDepth)) { // Enable FIFO LineControl = PL011_UARTLCR_H_FEN; - if (PL011_UARTPID2_VER (MmioRead32 (UartBase + UARTPID2)) > PL011_VER_R1P4) - *ReceiveFifoDepth = 32; - else - *ReceiveFifoDepth = 16; + *ReceiveFifoDepth = HardwareFifoDepth; } else { // Disable FIFO LineControl = 0;