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:c09::229; helo=mail-wm0-x229.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 0324321EA15D8 for ; Fri, 6 Oct 2017 08:59:32 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id q124so8502759wmb.0 for ; Fri, 06 Oct 2017 09:02:56 -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=tRM5KkG1ftElXFq6ChF0NDKcBPG/FHJPI/pmt1bT7Ug=; b=H83APryPNulkbQHVA64YK7JkmdtlXbN6Sv9OOGFZrlRvFWmMl7HlvfdMzgCXFFulzk YQ8f7k0+2Vr5w58vuwwno1mNhbrruidHWaBMLK70OpP9AMtTnl6mSQ70YgCxRGQjlUxd zaQKswZFbNZEHkN6LKAK+G/SNhKTnKiPlHzPg= 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=tRM5KkG1ftElXFq6ChF0NDKcBPG/FHJPI/pmt1bT7Ug=; b=q16i57lvKY+gQaJ3b4FwMcKM7AspccxjPSjqXw18Vo8x8HkqbhOBz5wai1bB/49jID RlAEe5I3/NdpP2ZlB8mEH7/KeqrAhvIiu4amzKElZtsRQ01jXeCyniUjJkW+Gh5QvImu 5FvYDUS4HjjQBg4Umc/SjkEW9vZodle2Xh6SBhyQVyOFv9qF5ksvT6htOmlZY0AvLr3C JAnvfZYPC/AN3EgSNYFGrR9so5XbvWLTqGu0R0dtFkieR7wnCU18/5FOBrNz/G0DUX13 xa86MIyofuV+m7pcnVHGbgX0Or6OKpp25xeJtNaR6VRgHt6BvKSlyO7q8cG9UGpJ3OBq 2XgQ== X-Gm-Message-State: AMCzsaUw/ufy/81d2d1mSa6SfnXI1/Tg5kKQ2HluIiDqleVvMVA6oshX I5paitdmEzPan++c9F1HhFlCbg== X-Google-Smtp-Source: AOwi7QBNsJ4wsPaohbov3lJPueFhothVExH6c//JVPqox8Ml05erIZG0/K8SMIKzaO/lrnUmHybCcg== X-Received: by 10.28.227.68 with SMTP id a65mr2365002wmh.88.1507305775129; Fri, 06 Oct 2017 09:02:55 -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 56sm758694wrx.2.2017.10.06.09.02.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Oct 2017 09:02:52 -0700 (PDT) Date: Fri, 6 Oct 2017 17:02:50 +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: <20171006160250.heidy7kztmp32jgv@bivouac.eciton.net> References: <1507276278-3608-1-git-send-email-mw@semihalf.com> <1507276278-3608-6-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1507276278-3608-6-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH 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: , X-List-Received-Date: Fri, 06 Oct 2017 15:59:33 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 06, 2017 at 09:51:18AM +0200, Marcin Wojtas wrote: > 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 No objections here :) Reviewed-by: Leif Lindholm > --- > 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/Armada/Armada.dsc.inc > index 9549091..679ba59 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/Armada70x0Lib.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 > > DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf > diff --git a/Platform/Marvell/Include/Library/ParsePcdLib.h b/Platform/Marvell/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 and/or > -modify this File under the following licensing terms. > -Redistribution and use in source and binary forms, with or without modification, > -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 IMPLIED > -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > -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. > - > -*******************************************************************************/ > - > -#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 and/or > -modify this File under the following licensing terms. > -Redistribution and use in source and binary forms, with or without modification, > -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 IMPLIED > -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > -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. > - > -*******************************************************************************/ > -#define CHAR_NULL 0x0000 > - > -#include > -#include > -#include > -#include > - > -STATIC > -CHAR16 > -CharToUpper ( > - IN CHAR16 Char > - ) > -{ > - > - if (Char >= L'a' && Char <= L'z') { > - return (CHAR16) (Char - (L'a' - L'A')); > - } > - > - return Char; > -} > - > -STATIC > -BOOLEAN > -IsDecimalDigitChar ( > - IN CHAR16 Char > - ) > -{ > - > - return (BOOLEAN) (Char >= L'0' && Char <= 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 >= L'0' && Char <= L'9') || (Char >= L'A' && > - Char <= L'F') || (Char >= L'a' && Char <= L'f')); > -} > - > -STATIC > -UINTN > -HexStrToUintn ( > - CHAR16 *String > - ) > -{ > - UINTN Result = 0; > - > - if (String == NULL || StrSize(String) == 0) { > - return (UINTN)(-1); > - } > - > - // Ignore spaces and tabs > - while ((*String == L' ') || (*String == L'\t')) { > - String++; > - } > - > - // Ignore leading zeros after spaces > - while (*String == L'0') { > - String++; > - } > - > - if (CharToUpper (*String) != L'X') { > - return (UINTN)(-1); > - } > - > - // Skip 'x' > - String++; > - > - while (IsHexDigitCharacter (*String)) { > - Result <<= 4; > - Result += HexCharToUintn (*String); > - String++; > - } > - > - return (UINTN) Result; > -} > - > -STATIC > -UINTN > -DecimalStrToUintn ( > - CHAR16 *String > - ) > -{ > - UINTN Result = 0; > - > - while (IsDecimalDigitChar (*String)) { > - Result = 10 * Result + (*String - L'0'); > - String++; > - } > - > - return Result; > -} > - > -STATIC > -UINTN > -StrToUintn ( > - CHAR16 *String > - ) > -{ > - CHAR16 *Walker; > - > - // Chop off leading spaces > - for (Walker = String; Walker != NULL && *Walker != CHAR_NULL && *Walker == L' '; Walker++); > - > - if (StrnCmp(Walker, L"0x", 2) == 0 || StrnCmp(Walker, L"0X", 2) == 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 = FALSE; > - CHAR16 *Walker; > - UINTN i, Tmp = 0; > - > - if (ValueTable != NULL) { > - ValueFlag = TRUE; > - } > - > - // Set pointer at the end of PCD string > - Walker = PcdString + StrLen (PcdString); > - for (i = 0; i < Count; i++) { > - while ((--Walker) >= PcdString) { > - if (*Walker == L';') { > - // Cut off parsed chunk from PCD string by replacing ';' with > - // null-terminator > - *Walker = '\0'; > - if (ValueFlag) { > - Tmp = StrToUintn ((Walker + 1)); > - if ((UINTN)(-1) == 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)] = Tmp; > - } else { > - StrTable[Count - (i + 1)] = Walker + 1; > - } > - Walker--; > - break; > - } > - if (Walker == PcdString) { > - if (ValueFlag) { > - Tmp = StrToUintn ((Walker)); > - if (Tmp == (UINTN)(-1)) { > - return EFI_INVALID_PARAMETER; > - } > - } > - // Last device's entry should be added to the table here. > - // If not, return error > - if (i != (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)] = Tmp; > - } else { > - StrTable[Count - (i + 1)] = Walker; > - } > - // End both loops > - return EFI_SUCCESS; > - } > - } > - } > - > - return EFI_SUCCESS; > -} > diff --git a/Platform/Marvell/Library/ParsePcdLib/ParsePcdLib.inf b/Platform/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 modification, > -# 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 IMPLIED > -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR > -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > -# 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 = 0x00010005 > - BASE_NAME = ParsePcdLib > - FILE_GUID = 698d85a0-a952-453e-b8a4-1d6ea338a38e > - MODULE_TYPE = BASE > - VERSION_STRING = 1.0 > - LIBRARY_CLASS = ParsePcdLib > - > -[Packages] > - MdePkg/MdePkg.dec > - MdeModulePkg/MdeModulePkg.dec > - > -[LibraryClasses] > - ArmLib > - DebugLib > - > -[Sources.common] > - ParsePcdLib.c > -- > 1.8.3.1 >