From nobody Thu Dec 26 02:02:17 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 1507459807831289.41363586815316; Sun, 8 Oct 2017 03:50:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 89A5E21CF58D0; Sun, 8 Oct 2017 03:46:34 -0700 (PDT) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (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 B3E4620945B76 for ; Sun, 8 Oct 2017 03:46:32 -0700 (PDT) Received: by mail-lf0-x22f.google.com with SMTP id d10so22155777lfg.11 for ; Sun, 08 Oct 2017 03:49:58 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id y17sm930370lfj.0.2017.10.08.03.49.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Oct 2017 03:49:55 -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::22f; helo=mail-lf0-x22f.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=d3eIJ3/AExfz3/i1tf/JVwQmBSfLt+F3fFRJamPKkho=; b=BKcUUanjDNCAlmP1WbfGGfFC9MUAQoByVT1Lz/zV4EhS+8obZeZuqD6qJ3ad+NfrAo 84APk1wHGvVQEwsnO8lS5aZB1ITZmogIcdK/kAjP2HHpdOV3OgOGVleNKG9U73N/ASu4 D3fdUMKuJVn0iOa5vU7TN4/aKQTjGhXbDwu+pzg6+/3FzYzi6IAU3e/8HLt4ugB1cX1h 7JGbe+zik2Ni1hB4fY51d8n9kVbqxEWb8IfGNXiO+eiStzwuo1UJRInCzCp2AMJuDTl/ TTxjBis40ZFKA7wwv7trRRZ6X5C6UZ3uYi4xgC+Z4wiC7BjwezHN3NUVGf6/SiGXOoYM xQOA== 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=d3eIJ3/AExfz3/i1tf/JVwQmBSfLt+F3fFRJamPKkho=; b=E/AhI59PUiPK5eYGLji20uVBXOUm5BDbK8pohLDzk8OdvK36AsZgNN6XgwriZ2D+la 9ijOz91uUDrzW4lYbRcLRom0EL67qnk7nbyckaabJ26fTUZ7AZtt+cFbuGK2CubjzMNK qpjaalPsujUga+D45Zch1cOMU0PuqlT9YgRizOQaMSu/Vvel05idR+agUiVII62fo4zR B0X8rvtV+fmH9HXqcJYHN2gkmrJcWWWml1SoP5qCB6tqChqyRAOwNGJ0Ow1qfI1cO9a7 UOJ5Fj+CS2ht5cRUk+GbQGGrdcYOCC+YoimgtSGXssJqWvf1xCzb2w4zmV+SpoO3QLGf 6l4A== X-Gm-Message-State: AMCzsaWGfoHTFtTf6sLCi3XXDe5vD6OHVhP9FRgEBWDIV4ZFLACFr6r+ wCG5Giw1WEncUqy/uKCVpILugG7zfxA= X-Google-Smtp-Source: AOwi7QBCGjVHuil5te6XkZWJsOggeGuctqLW8i9OWFx9ZmBsce9mDRh4ya8kKEM9I2mr1cCYX/UqUQ== X-Received: by 10.25.56.26 with SMTP id f26mr856563lfa.17.1507459796477; Sun, 08 Oct 2017 03:49:56 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Sun, 8 Oct 2017 12:56:52 +0200 Message-Id: <1507460212-10323-6-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1507460212-10323-1-git-send-email-mw@semihalf.com> References: <1507460212-10323-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH v2 5/5] Platform/Marvell/Armada: Remove ParsePcdLib 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 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" Current PCD handling in libraries and drivers allow to get rid of this code. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm Reviewed-by: Ard Biesheuvel --- Platform/Marvell/Armada/Armada.dsc.inc | 1 - Platform/Marvell/Include/Library/ParsePcdLib.h | 46 ---- Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.c | 228 ---------------= ----- Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.inf | 50 ----- 4 files changed, 325 deletions(-) diff --git a/Platform/Marvell/Armada/Armada.dsc.inc b/Platform/Marvell/Arma= da/Armada.dsc.inc index 7258017..89fb7e7 100644 --- a/Platform/Marvell/Armada/Armada.dsc.inc +++ b/Platform/Marvell/Armada/Armada.dsc.inc @@ -33,7 +33,6 @@ ArmPlatformLib|Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0L= ib.inf ComPhyLib|Platform/Marvell/Library/ComPhyLib/ComPhyLib.inf MppLib|Platform/Marvell/Library/MppLib/MppLib.inf - ParsePcdLib|Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.inf UtmiPhyLib|Platform/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf =20 DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf diff --git a/Platform/Marvell/Include/Library/ParsePcdLib.h b/Platform/Marv= ell/Include/Library/ParsePcdLib.h deleted file mode 100644 index a255685..0000000 --- a/Platform/Marvell/Include/Library/ParsePcdLib.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************= ******* -Copyright (C) 2016 Marvell International Ltd. - -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute a= nd/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modific= ation, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS= " AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPL= IED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABL= E FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAM= AGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICE= S; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AN= D ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF T= HIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**************************************************************************= *****/ - -#ifndef __PARSEPCDLIB_H__ -#define __PARSEPCDLIB_H__ - -EFI_STATUS -ParsePcdString ( - IN CHAR16 *PcdString, - IN UINT8 Count, - OUT UINTN *ValueTable, - OUT CHAR16 **StrTable - ); - -#endif diff --git a/Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.c b/Platform/= Marvell/Library/ParsePcdLib/ParsePcdLib.c deleted file mode 100644 index 9a4be8e..0000000 --- a/Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.c +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************= ******* -Copyright (C) 2016 Marvell International Ltd. - -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute a= nd/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modific= ation, -are permitted provided that the following conditions are met: - -* Redistributions of source code must Retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS= " AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPL= IED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABL= E FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAM= AGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICE= S; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AN= D ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF T= HIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -**************************************************************************= *****/ -#define CHAR_NULL 0x0000 - -#include -#include -#include -#include - -STATIC -CHAR16 -CharToUpper ( - IN CHAR16 Char - ) -{ - - if (Char >=3D L'a' && Char <=3D L'z') { - return (CHAR16) (Char - (L'a' - L'A')); - } - - return Char; -} - -STATIC -BOOLEAN -IsDecimalDigitChar ( - IN CHAR16 Char - ) -{ - - return (BOOLEAN) (Char >=3D L'0' && Char <=3D L'9'); -} - - -STATIC -UINTN -HexCharToUintn ( - IN CHAR16 Char - ) -{ - if (IsDecimalDigitChar (Char)) { - return Char - L'0'; - } - - return (UINTN) (10 + CharToUpper (Char) - L'A'); -} - -STATIC -BOOLEAN -IsHexDigitCharacter ( - CHAR16 Char - ) -{ - - return (BOOLEAN) ((Char >=3D L'0' && Char <=3D L'9') || (Char >=3D L'A' = && - Char <=3D L'F') || (Char >=3D L'a' && Char <=3D L'f')); -} - -STATIC -UINTN -HexStrToUintn ( - CHAR16 *String - ) -{ - UINTN Result =3D 0; - - if (String =3D=3D NULL || StrSize(String) =3D=3D 0) { - return (UINTN)(-1); - } - - // Ignore spaces and tabs - while ((*String =3D=3D L' ') || (*String =3D=3D L'\t')) { - String++; - } - - // Ignore leading zeros after spaces - while (*String =3D=3D L'0') { - String++; - } - - if (CharToUpper (*String) !=3D L'X') { - return (UINTN)(-1); - } - - // Skip 'x' - String++; - - while (IsHexDigitCharacter (*String)) { - Result <<=3D 4; - Result +=3D HexCharToUintn (*String); - String++; - } - - return (UINTN) Result; -} - -STATIC -UINTN -DecimalStrToUintn ( - CHAR16 *String - ) -{ - UINTN Result =3D 0; - - while (IsDecimalDigitChar (*String)) { - Result =3D 10 * Result + (*String - L'0'); - String++; - } - - return Result; -} - -STATIC -UINTN -StrToUintn ( - CHAR16 *String - ) -{ - CHAR16 *Walker; - - // Chop off leading spaces - for (Walker =3D String; Walker !=3D NULL && *Walker !=3D CHAR_NULL && *W= alker =3D=3D L' '; Walker++); - - if (StrnCmp(Walker, L"0x", 2) =3D=3D 0 || StrnCmp(Walker, L"0X", 2) =3D= =3D 0) { - return HexStrToUintn (Walker); - } else { - return DecimalStrToUintn (Walker); - } -} - -EFI_STATUS -ParsePcdString ( - IN CHAR16 *PcdString, - IN UINT8 Count, - OUT UINTN *ValueTable, - OUT CHAR16 **StrTable - ) -{ - BOOLEAN ValueFlag =3D FALSE; - CHAR16 *Walker; - UINTN i, Tmp =3D 0; - - if (ValueTable !=3D NULL) { - ValueFlag =3D TRUE; - } - - // Set pointer at the end of PCD string - Walker =3D PcdString + StrLen (PcdString); - for (i =3D 0; i < Count; i++) { - while ((--Walker) >=3D PcdString) { - if (*Walker =3D=3D L';') { - // Cut off parsed chunk from PCD string by replacing ';' with - // null-terminator - *Walker =3D '\0'; - if (ValueFlag) { - Tmp =3D StrToUintn ((Walker + 1)); - if ((UINTN)(-1) =3D=3D Tmp) { - return EFI_INVALID_PARAMETER; - } - // Entry is parsed from the end to the beginning - // so fill table in the same manner - ValueTable[Count - (i + 1)] =3D Tmp; - } else { - StrTable[Count - (i + 1)] =3D Walker + 1; - } - Walker--; - break; - } - if (Walker =3D=3D PcdString) { - if (ValueFlag) { - Tmp =3D StrToUintn ((Walker)); - if (Tmp =3D=3D (UINTN)(-1)) { - return EFI_INVALID_PARAMETER; - } - } - // Last device's entry should be added to the table here. - // If not, return error - if (i !=3D (Count - 1)) { - DEBUG((DEBUG_ERROR, "ParsePcdLib: Please set PCD value for every= " - "device\n")); - return EFI_INVALID_PARAMETER; - } - // We parse from the end to the beginning - // so fill table in the same manner - if (ValueFlag) { - ValueTable[Count - (i + 1)] =3D Tmp; - } else { - StrTable[Count - (i + 1)] =3D Walker; - } - // End both loops - return EFI_SUCCESS; - } - } - } - - return EFI_SUCCESS; -} diff --git a/Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.inf b/Platfor= m/Marvell/Library/ParsePcdLib/ParsePcdLib.inf deleted file mode 100644 index b4db621..0000000 --- a/Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.inf +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2016 Marvell International Ltd. -# -# Marvell BSD License Option -# -# If you received this File from Marvell, you may opt to use, redistribute= and/or -# modify this File under the following licensing terms. -# Redistribution and use in source and binary forms, with or without modif= ication, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of Marvell nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS = IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IM= PLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIA= BLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL D= AMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVI= CES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED = AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF= THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D ParsePcdLib - FILE_GUID =3D 698d85a0-a952-453e-b8a4-1d6ea338a38e - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ParsePcdLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - -[LibraryClasses] - ArmLib - DebugLib - -[Sources.common] - ParsePcdLib.c --=20 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel