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::244; helo=mail-lf0-x244.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) (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 097EE2034CF85 for ; Wed, 25 Oct 2017 18:16:20 -0700 (PDT) Received: by mail-lf0-x244.google.com with SMTP id a16so1955037lfk.0 for ; Wed, 25 Oct 2017 18:20:06 -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=IbWJkKgQEEoKEyONm2oA23Q1NdAKtg79W2BuT3BphZU=; b=LBDo0wthF0ASo1+V10FN2h5VZMZbuA8FIdcIzdsrPZZhBUSpG0upFEbqPfe3X2cuZF tINaOIN37OOI5cmbRtyBMyHCyYQ8a0u/vTG2sy48to8bOPnGuHWdTxAtnQ3PSY3xJ49n 055MrV5D0yfUvAjrmtvAfEEM6efoJOgOg9Z0P2QnBTxLu9+zgRqHuYCqWyjM1G1Js+6K N0KLnSG8tn/BrUprap/ewC2pfIA6p+ZX1yFAf8NU8sR3JKRSs9mdl3oXqBg4BEa+LqrK g0/lvsEDYTLqGEcdWgxWufggofv2PN/gTo4H13rr+/ou1I5C5vhotS87abAiPdMyHG4g mZrg== 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=IbWJkKgQEEoKEyONm2oA23Q1NdAKtg79W2BuT3BphZU=; b=glKn2XnB9npFGHc7d1zZRK6aGlqKd28CzQGDvqmKkzXPHWzZwZFWXese0/9SqHggWH czFGhYhsDRIj+lvXtdkcL3a+jYsRRcyeqx8OAwrja6udRosX8NE6XULZKL0KoDyF5yGY Rfvpdhxso/ZucnbH5qk69jcQ/HtMT8KspwYTFIFzn2QMAY4ZlJx6OowrCU4oqiG/a8nZ voW3msdu9wMlmxrwzcfEGk4iDv9GH6knHI0055d2a/m32SA54XnETpV42eB22QYIb+Uo u3SGfJmTWnYPrfvDx1e5F/YghS71xin1EfqzAA/fNbboOW+lMz1Ezk5C1//GCxPrpfNN Xeag== X-Gm-Message-State: AMCzsaU8FO0kTR8S5fC5eC0wHirkwvRtTC8Df9lAbxUdKUavoHpiqJLS SsXH7ho1g713x1Adpgjtfdn9vMjbstY= X-Google-Smtp-Source: ABhQp+TxZnDGg0Eblm7K+h2zB4K8zmQpbWKqdpMMREzRTWlv6ahUkonnKmoOWSoiQPS4jHlvDMrNcA== X-Received: by 10.25.22.28 with SMTP id m28mr7634963lfi.185.1508980804694; Wed, 25 Oct 2017 18:20:04 -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 h26sm1053428lja.69.2017.10.25.18.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 18:20:04 -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: Thu, 26 Oct 2017 03:19:33 +0200 Message-Id: <1508980777-29006-7-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508980777-29006-1-git-send-email-mw@semihalf.com> References: <1508980777-29006-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH 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: Thu, 26 Oct 2017 01:16:21 -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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Platform/Marvell/Library/MppLib/MppLib.c b/Platform/Marvell/Library/MppLib/MppLib.c index 383c820..9e42f08 100644 --- a/Platform/Marvell/Library/MppLib/MppLib.c +++ b/Platform/Marvell/Library/MppLib/MppLib.c @@ -79,18 +79,22 @@ SetRegisterValue ( BOOLEAN ReverseFlag ) { - UINT32 i, j, CtrlVal; + UINT32 i, j, CtrlVal, CtrlMask; 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]); + if (MppRegPcd[i][7 * (UINTN) ReverseFlag + j * Sign] != 0xff) { + CtrlVal |= MPP_PIN_VAL(7 * (UINTN) ReverseFlag + j * Sign, + MppRegPcd[i][7 * (UINTN) ReverseFlag + j * Sign]); + CtrlMask |= MPP_PIN_VAL(7 * (UINTN) ReverseFlag + j * Sign, 0xf); + } } - MmioWrite32 (BaseAddr + 4 * i * Sign, CtrlVal); + MmioAndThenOr32 (BaseAddr + 4 * i * Sign, ~CtrlMask, CtrlVal); } } -- 2.7.4