From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::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 672CA2034A884 for ; Fri, 27 Oct 2017 07:27:05 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id u40so6335730wrf.10 for ; Fri, 27 Oct 2017 07:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xcK15zFGlzpRLSyGgtm3+UtWDDM32OXbl+EyDRtpyiE=; b=b7MNypzuFspRu2p70VsMdBlr9UpZvdAky90P2iS18HL6LLNpAUtfkduhu0/tcWf+F0 VgKTdtFvNHQici/gybdhyqxFsThUB7VBUYkIjwiggGHWTF4AF/DJoVBoQEtAjgEKMmRn 5qUn3xlkzmJLQ6TcdxdYPjZhfHJ+IxkUbImzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xcK15zFGlzpRLSyGgtm3+UtWDDM32OXbl+EyDRtpyiE=; b=FtypewjCNcSsgYkJBrJuH8hCe3gpT/Y3J3PYOJRTjFlbNemdE7cUgyH6vwkSeGunTi S6HOne192mDBh+mnDWfKV4C/c3vd0T0U74U4pUzGH2iRV8wCUZiif3WeZ0duSqWoHp6K 2XA/q+qrAxHekbiuh5qJwHCwyl7cWoFOIt09DmA/iljt0HeuBRrQXlwlOTtZhFGmcEXZ ozYKv6Ro5P1vgNDGlJJq1BEPocbAtVf8bmww8ZwSn5UyCKONTK5VRavQ5HhhcxGOsFCM 6+ibF8j7px5wD4kjQLvYc01yFBfOOkWuNlbMutj9vQ35bxm5trC4k4P0BOtv1NZxr0mX P3EA== X-Gm-Message-State: AMCzsaX+Lt8KUGINtPLxTiKeiky/BdfwwCvs1GeY8YSh9sq3lrRPeLdo sp7tQbi68NR+3Oszm2O/tSe2Qg== X-Google-Smtp-Source: ABhQp+Tizd0syE/IMyzUFqXiuex8jN3Zt4NKwKe1WnQxG5OGbGj0dtnx/qmiHBLHk5GDrV/7mI5p1w== X-Received: by 10.223.185.33 with SMTP id k30mr668399wrf.40.1509114651408; Fri, 27 Oct 2017 07:30:51 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id o7sm9364779wrf.31.2017.10.27.07.30.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Oct 2017 07:30:50 -0700 (PDT) Date: Fri, 27 Oct 2017 15:30:48 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, jsd@semihalf.com Message-ID: <20171027143048.f7m6bvguyevficne@bivouac.eciton.net> References: <1509066832-5285-1-git-send-email-mw@semihalf.com> <1509066832-5285-7-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1509066832-5285-7-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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 14:27:05 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 27, 2017 at 03:13:48AM +0200, Marcin Wojtas wrote: > 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 That is so much nicer than the v1, thanks. Reviewed-by: Leif Lindholm > --- > 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 >