From nobody Wed Dec 25 13:51:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1509121970506789.1712565099496; Fri, 27 Oct 2017 09:32:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 31EDD21EA15A2; Fri, 27 Oct 2017 09:28:57 -0700 (PDT) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (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 5F02721CEB12D for ; Fri, 27 Oct 2017 09:28:54 -0700 (PDT) Received: by mail-lf0-x243.google.com with SMTP id r129so8014766lff.8 for ; Fri, 27 Oct 2017 09:32:41 -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 h3sm1569222lfj.26.2017.10.27.09.32.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 09:32:39 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::243; helo=mail-lf0-x243.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org 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=TUMONFAKMpiQWShizYJCsesNltdW4p7QVVldO0pf3Wo=; b=VS0KtZ2v8P8npaVl75k5DUb4sc/roXH9RPWtEFn4itkqq4VkA6hraP/CATz0T1urYT 6f9Uud+jmd37ICF4AVP7IvxTW1wG/p2LWJrmrSj32+SRVbl3kKDvdzoKSy0IaJel7tgl EvX4V78rjkq7uEFc+ALzRzHtyQOE43r0i9uxgvI/UX0iAqqrchbhv13pYiVLeeDMr4ZG S15baoeZFWvlXXVHGpxYITaSkwmV8Ty9Q1O6txeKObCWlCTLqp6S7WyJdiljQUAiKaO3 LsN9WqvHpOU/Ow3PuqkYJ+wIUpZQF1KYI2WtMnWUn4DgkJdZZmc6ae5tv5wUpChkeyLu v2jQ== 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=TUMONFAKMpiQWShizYJCsesNltdW4p7QVVldO0pf3Wo=; b=F7zFxbCEqs06Y7S1orwbOWnaLgwX7x/wAy647WWc75bNmxXugTFulEERfZDjWyb2pQ nH/jaDKc0N4WaXas2Rtpm9/JeayXcPiQgcT+KfAU0OOCqA03z1gO+Xxmx31MyjlNcLvB 6ITlCfdDzsy9zixMTD6eRXCUTtFVZ+XKUOjQfwwYk8Ujao2LyzPFsXhpYoRXEO3jsIXe zek0wakE44M+BwR77qqMxJEKQ6wS9VRWHH/duHDloRpI0bq0pTSaHZPFtMllHY4VOLsY vTR+ALYQzd4K33LDuZ2g+Q1fv9fPiYT3vyfblz1fXcjg/fI8PLFD3bl6WlpkhiTdeaW+ lTag== X-Gm-Message-State: AMCzsaUyk4hksfVKSFLdjavOGP43XlboU47TAOAo2x8OONu/ZoYWPMGc ef6y1AlAaYA7IVVDy1gxlnU5TDi1xQ0= X-Google-Smtp-Source: ABhQp+QRhnY7v144awrHoWmX4Y7gQkcVq6fmQXWI5/uuvSPM/D6bjnTKmFgaguTHTOpHvSjWBRilVg== X-Received: by 10.25.22.28 with SMTP id m28mr357085lfi.185.1509121959927; Fri, 27 Oct 2017 09:32:39 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Fri, 27 Oct 2017 18:31:47 +0200 Message-Id: <1509121913-12937-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509121913-12937-1-git-send-email-mw@semihalf.com> References: <1509121913-12937-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH v3 04/10] Marvell/Library: MppLib: Prevent overwriting PCD values 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, Joe Zhou , ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Joe Zhou After enabling dynamic PCDs, it is possible to reconfigure MPP during platform initialization. It occurred that due to a faulty way of passing temporary values, information obtained from PCDs was overwritten. This patch fixes the issue, which on the occasion simplifies PcdToMppRegs function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Joe Zhou Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/Marvell/Library/MppLib/MppLib.c | 21 ++++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Platform/Marvell/Library/MppLib/MppLib.c b/Platform/Marvell/Li= brary/MppLib/MppLib.c index c09acf9..383c820 100644 --- a/Platform/Marvell/Library/MppLib/MppLib.c +++ b/Platform/Marvell/Library/MppLib/MppLib.c @@ -74,7 +74,7 @@ STATIC VOID SetRegisterValue ( UINT8 RegCount, - UINT8 **MppRegPcd, + UINT8 MppRegPcd[][MPP_PINS_PER_REG], UINTN BaseAddr, BOOLEAN ReverseFlag ) @@ -99,10 +99,10 @@ STATIC UINT8 PcdToMppRegs ( UINTN PinCount, - UINT8 **MppRegPcd + UINT8 **MppRegPcd, + UINT8 MppRegPcdTmp[][MPP_PINS_PER_REG] ) { - UINT8 MppRegPcdTmp[MPP_MAX_REGS][MPP_PINS_PER_REG]; UINT8 PcdGroupCount, MppRegCount; UINTN i, j, k, l; =20 @@ -125,14 +125,7 @@ PcdToMppRegs ( for (j =3D 0; j < PCD_PINS_PER_GROUP; j++) { k =3D (PCD_PINS_PER_GROUP * i + j) / MPP_PINS_PER_REG; l =3D (PCD_PINS_PER_GROUP * i + j) % MPP_PINS_PER_REG; - MppRegPcdTmp[k][l] =3D MppRegPcd[i][j]; - } - } - - /* Update input table */ - for (i =3D 0; i < MppRegCount; i++) { - for (j =3D 0; j < MPP_PINS_PER_REG; j++) { - MppRegPcd[i][j] =3D MppRegPcdTmp[i][j]; + MppRegPcdTmp[k][l] =3D (UINT8)MppRegPcd[i][j]; } } =20 @@ -191,6 +184,7 @@ MppInitialize ( BOOLEAN ReverseFlag[MAX_CHIPS]; UINT8 *MppRegPcd[MAX_CHIPS][MPP_MAX_REGS]; UINT32 i, ChipCount; + UINT8 TmpMppValue[MPP_MAX_REGS][MPP_PINS_PER_REG]; =20 ChipCount =3D PcdGet32 (PcdMppChipCount); =20 @@ -203,8 +197,9 @@ MppInitialize ( for (i =3D 0; i < MAX_CHIPS; i++) { if (i =3D=3D ChipCount) break; - RegCount =3D PcdToMppRegs (PinCount[i], MppRegPcd[i]); - SetRegisterValue (RegCount, MppRegPcd[i], BaseAddr[i], ReverseFlag[i]); + + RegCount =3D PcdToMppRegs (PinCount[i], MppRegPcd[i], TmpMppValue); + SetRegisterValue (RegCount, TmpMppValue, BaseAddr[i], ReverseFlag[i]); =20 /* * eMMC PHY IP has its own MPP configuration. --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel