From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: ABhQp+RAEzpXYHQuUMDxRDgH37NOsoAWwmQPMOuFGPCojZsvkSPJBhzONLDASCWdc1eTL5tTxkwiKA== 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 Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com 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: [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: , X-List-Received-Date: Fri, 27 Oct 2017 01:10:51 -0000 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(-) 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); } } -- 2.7.4