From patchwork Fri Oct 27 01:13:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 117279 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp185897qgn; Thu, 26 Oct 2017 18:14:48 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Ro58HaIlT8t8y3uoEHNUtSseKIPIFlsc1iRebxFqiB3wiT3fK16CxWadX/BqRcp0sIyvpF X-Received: by 10.99.160.71 with SMTP id u7mr6529456pgn.22.1509066888213; Thu, 26 Oct 2017 18:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509066888; cv=none; d=google.com; s=arc-20160816; b=VWZRh7iLH0i2sMzOmDgYoPuGG4Z6LzWPyqjNV3RL+2bSHCyRX3yIKceUyLU7Ay/lfi tWrmFBSv+Fmb0EQL53wxrdQVp3bDCvpWCdsOvydlbbp7k7wBxEN5t+KbE3dryMHdHJSo pXSey3ubCMSQ0u3xoJA3pJyfnr7QM8tyKG1YJBFVAsIlHHH1AqkACCDrtgzmePx+gP40 zt13hJ02uiSd5VBomUBC0sL4kt+xnu985o+azfDkUEUm0/2kOORwUIjlXlEWGlTTl745 XUmxGyTWWwrtz58OK04eiq6ePOlVBtfag463U4EY17dMu+yd6eTLbTN3rkDmqmgV6sEP u34Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=EwXZ5SLeRdEFsr6l6rjsPQ3lDgCXm5Wh+olOGMLS8Sw=; b=ZVySC0dKHiACWWTe3skZ7i6rU3O7Vv2xlMtz/hVSma8qrjUZzKT57D5eJkwktAiWX1 MCjnyt09kz8tC4ZzwCCz+JcekQWtSsz4wn3iR4FcTjK4AONt+GWdHbUSPsYF5t+QOku/ IfgxwCPFiQ9f4wlvqLDlcWSm6/9tRdCn0P4WZhcRKeey5uM5aiOFxVUTg+lOKU0oKA6a ESNso7hZ7Qm+bhM3D3NVgj8Mt+MMjnby80WrGI7YkekdGE8unSEfdrOMfWbaS+JP0pHe l9ncxGgplEYXGg/0EhU6L9CDbgfKv4T4l+qzfsGAYhZ9QnTVVbxakcVLnFzRdSGgcihO 6waw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=XMAb7ne2; 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 Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id w7si4118029pgp.252.2017.10.26.18.14.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 18:14:48 -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; dkim=neutral (body hash did not verify) header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=XMAb7ne2; 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 54CEB2034A88A; Thu, 26 Oct 2017 18:10:53 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::241; helo=mail-lf0-x241.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9E4032034A882 for ; Thu, 26 Oct 2017 18:10:50 -0700 (PDT) Received: by mail-lf0-x241.google.com with SMTP id a132so5674999lfa.7 for ; Thu, 26 Oct 2017 18:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MEQtyXsQqjmj8ow5AzkWa+NyZ/kNRHhP3gpq5lhpC+U=; b=XMAb7ne2uZuztFj4GnHDh6AY72l04xssxoAKTXUYZbB+0AYKiEVe4x+PPmh3KS2KZh G6eErcMaoO8YbRHNWrleeHYLyAL62y2LTTjhYsAmMjNTtmFs5Uz6z5KrcvIeCP0T/eZa SoGmf1IYBLR4/W2L+EuJd6lhuZqpXiHoaHIfBpfo+XgKOqjyx+kU83Ibn4i94VM2c8jW fasj0CDBaw9frX2fpaqxa+5ATqdKeLIfJ887BTmTxEKpEoN5OypefWKsqY0uDsQg0Cva /uzaszARmVF+6y4WFtvMcgcVwThL8bDkiz1XEwTbOUQf4LOqT2OH1GhP25kYw4EfRUf0 oMpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MEQtyXsQqjmj8ow5AzkWa+NyZ/kNRHhP3gpq5lhpC+U=; b=sXw1eH+yNCJjCgE/Ua+CepX1437c6kzOf43zUvgD7SzExo7mTi5G+62txhPBfnPOiT AdVuDnAWogbVl4q08nlo3P6aQj0ArxBpF3V9Mi//gPSGHe0uE3zJ8igMjxG6XF3gJWBW vqhgOt+sjetyIjU0iVxExDwjFxNyk95+cLtgliesy0G281qrtCqpszx2iK76d9gBCiQ8 8QSIP0JCQjUTvBOCOVB0I49RKTn9Kvkk120PVakF6z1h9M4Usgar2SW+vezUrQZTMH5L uE8ns+t0Ih9oI48fpBbgkPt7E4IzSlC4y6CbSQpK7uT7YxRLm3MerGg9wyGQ5ZlJ4m6v 0cAQ== X-Gm-Message-State: AMCzsaWzv7KCPQXSeR3E73KKs78acyyBreSucDAssvv2KgUBKtAWRF28 ouldbgKRoE9b6H7+SMCPiDc94SEfdAY= X-Received: by 10.46.46.8 with SMTP id u8mr10353032lju.117.1509066875521; Thu, 26 Oct 2017 18:14:35 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id m9sm1675702ljb.61.2017.10.26.18.14.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Oct 2017 18:14:34 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Fri, 27 Oct 2017 03:13:48 +0200 Message-Id: <1509066832-5285-7-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509066832-5285-1-git-send-email-mw@semihalf.com> References: <1509066832-5285-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH v2 06/10] Marvell/Library: MppLib: Take 0xFF placeholders into account X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jinghua@marvell.com, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Ard Biesheuvel The MppSel definition PCDs contain 0xFF placeholders for values that should be left untouched. MppLib needs to be taught how to take those into account. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Signed-off-by: Marcin Wojtas --- Platform/Marvell/Library/MppLib/MppLib.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/Platform/Marvell/Library/MppLib/MppLib.c b/Platform/Marvell/Library/MppLib/MppLib.c index 383c820..297725f 100644 --- a/Platform/Marvell/Library/MppLib/MppLib.c +++ b/Platform/Marvell/Library/MppLib/MppLib.c @@ -79,18 +79,24 @@ SetRegisterValue ( BOOLEAN ReverseFlag ) { - UINT32 i, j, CtrlVal; + UINT32 i, j, CtrlVal, CtrlMask, PinIndex; INTN Sign; Sign = ReverseFlag ? -1 : 1; for (i = 0; i < RegCount; i++) { CtrlVal = 0; + CtrlMask = 0; for (j = 0; j < MPP_PINS_PER_REG; j++) { - CtrlVal |= MPP_PIN_VAL(7 * (UINTN) ReverseFlag + j * Sign, - MppRegPcd[i][7 * (UINTN) ReverseFlag + j * Sign]); + + PinIndex = 7 * (UINTN)ReverseFlag + j * Sign; + + if (MppRegPcd[i][PinIndex] != 0xff) { + CtrlVal |= MPP_PIN_VAL(PinIndex, MppRegPcd[i][PinIndex]); + CtrlMask |= MPP_PIN_VAL(PinIndex, 0xf); + } } - MmioWrite32 (BaseAddr + 4 * i * Sign, CtrlVal); + MmioAndThenOr32 (BaseAddr + 4 * i * Sign, ~CtrlMask, CtrlVal); } }