From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (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 A3F1421198CA8 for ; Tue, 4 Dec 2018 08:38:49 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id u3so16652020wrs.3 for ; Tue, 04 Dec 2018 08:38:49 -0800 (PST) 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=qWOxHFPUinCT+oojw0lp5IJmg1G2XFUej0K9p9DXEZM=; b=WTB/p4eU6KtJ3kLgR3YPYY74dEj8kKtnKSPQQtdlztVEZNnYOLJ7gzgCF4OviAKr7x 4upGElp8V3fq0zeewAkxaOWDSrbSIS899Pp7VWV9Qs+isLXV9qbjrr2K09TstKPEa6vX 7X2x+DxMaZ9dznlYdbRjL7M365/XXBuEqd8iU= 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=qWOxHFPUinCT+oojw0lp5IJmg1G2XFUej0K9p9DXEZM=; b=pbAKM4Ip9nSILwwNBuPhrykldLHrmmWD2xHgji7fD3Tt1nDZvRW9DQfvrKE4BBZagn U62BYJuG3VwaYcL53fhSr6g67GlSdRELvsvEpjExG9hCko+UH+yv6K8SqdKnXWeAuOpY H/TBX7shT5PMnni31um9LfxsQm+tOKR94kIVPAR7jOigEah1wb2YNByL4buW1e6M/IZq eJ+mZj8dAVkwsxVRpeu29cj8m0UosD5rSLoyiq1Mzoy4quGPtRYfm/9HKG5MRvhyrDl6 64VMIPRzGFq1B1Ke4YU8VFMiZGutyvXp1Ft75Q4FEl6uWamGY5VGqSNDgciZwdgBGz9Y j9QQ== X-Gm-Message-State: AA+aEWYrHbc13VzyyVyxUz6c2JVpLZNVf4tMSOpzteDwoCAKUh8k1VeW 8ymQm0jK8UkOPGf4DiqbUdlYEg== X-Google-Smtp-Source: AFSGD/WhllB6CzZgMbzJH3dB0meWzb5Noevaby/E/6s1sIjovEdZRDrN31NTh7wYUkWa/hYB1vy+EQ== X-Received: by 2002:a5d:61c4:: with SMTP id q4mr17919079wrv.308.1543941528090; Tue, 04 Dec 2018 08:38:48 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id m6sm29347262wrv.24.2018.12.04.08.38.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Dec 2018 08:38:47 -0800 (PST) Date: Tue, 4 Dec 2018 16:38:45 +0000 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com Message-ID: <20181204163845.mjerkult3k3qo7xe@bivouac.eciton.net> References: <1540000661-1956-1-git-send-email-mw@semihalf.com> <1540000661-1956-10-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1540000661-1956-10-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH 09/12] Marvell/Drivers: I2c: Use common header for macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 16:38:50 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Oct 20, 2018 at 03:57:38AM +0200, Marcin Wojtas wrote: > Hitherto I2c solution used same macros, defined in multiple > places. Move them to a new common header. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm > --- > Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h | 10 ------- > Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h | 17 ++--------- > Silicon/Marvell/Include/Protocol/MvI2c.h | 31 ++++++++++++++++++++ > Silicon/Marvell/Applications/EepromCmd/EepromCmd.c | 5 +--- > Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c | 3 +- > Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 4 +-- > 6 files changed, 37 insertions(+), 33 deletions(-) > create mode 100644 Silicon/Marvell/Include/Protocol/MvI2c.h > > diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h > index b1af645..c32ee48 100644 > --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h > +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h > @@ -41,16 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > #define MAX_BUFFER_LENGTH 64 > > -/* > - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue > - * transmission without repeated start operation. > - * FIXME: This flag is also defined in Drivers/I2c/MvI2cDxe/MvI2cDxe.h > - * and it's important to have both version synced. This solution is > - * temporary and shared flag should be used by both files. > - * Situation is analogous with I2C_GUID, which also should be common, but is > - * for now defined same way in two header files. > - */ > -#define I2C_FLAG_NORESTART 0x00000002 > #define I2C_GUID \ > { \ > 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ > diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > index 3c9beaf..6850c34 100644 > --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > *******************************************************************************/ > > -#ifndef __MV_I2C_H__ > -#define __MV_I2C_H__ > +#ifndef __MV_I2C_DXE_H__ > +#define __MV_I2C_DXE_H__ > > #include > > @@ -75,17 +75,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > #define I2C_FAST 0x2 > #define I2C_FASTEST 0x3 > > -/* > - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue > - * transmission without repeated start operation. > - * FIXME: This flag is also defined in > - * Platforms/Marvell/Include/Protocol/Eeprom.h and it's important to have both > - * version synced. This solution is temporary and shared flag should be used by > - * both files. > - * Situation is analogous with I2C_GUID, which also should be common, but is > - * for now defined same way in two header files. > - */ > -#define I2C_FLAG_NORESTART 0x00000002 > #define I2C_GUID \ > { \ > 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ > @@ -266,4 +255,4 @@ MvI2cEnableConf ( > IN EFI_STATUS *I2cStatus OPTIONAL > ); > > -#endif // __MV_I2C_H__ > +#endif // __MV_I2C_DXE_H__ > diff --git a/Silicon/Marvell/Include/Protocol/MvI2c.h b/Silicon/Marvell/Include/Protocol/MvI2c.h > new file mode 100644 > index 0000000..d8e644e > --- /dev/null > +++ b/Silicon/Marvell/Include/Protocol/MvI2c.h > @@ -0,0 +1,31 @@ > +/** > +* > +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. > +* > +* This program and the accompanying materials are licensed and made available > +* under the terms and conditions of the BSD License which accompanies this > +* distribution. The full text of the license may be found at > +* http://opensource.org/licenses/bsd-license.php > +* > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > +* > +**/ > +#ifndef __MV_I2C_H__ > +#define __MV_I2C_H__ > + > +/* > + * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue > + * transmission without repeated start operation. > + */ > +#define I2C_FLAG_NORESTART 0x00000002 > + > +/* > + * Helper macros for maintaining multiple I2C buses > + * and devices defined via EFI_I2C_DEVICE. > + */ > +#define I2C_DEVICE_ADDRESS(Index) ((Index) & MAX_UINT16) > +#define I2C_DEVICE_BUS(Index) ((Index) >> 16) > +#define I2C_DEVICE_INDEX(Bus, Address) (((Address) & MAX_UINT16) | (Bus) << 16) > + > +#endif > diff --git a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c > index f43e411..a390f23 100644 > --- a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c > +++ b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c > @@ -52,10 +52,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > #include > > #include > - > -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16) > -#define I2C_DEVICE_ADDRESS(index) ((index) & 0xffff) > -#define I2C_DEVICE_BUS(index) ((index) >> 16) > +#include > > CONST CHAR16 ShellEepromFileName[] = L"ShellCommand"; > EFI_HANDLE ShellEepromHiiHandle = NULL; > diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c > index 9d2f650..90d0d1e 100644 > --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c > +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c > @@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > #include > #include > #include > +#include > > #include > #include > @@ -49,8 +50,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > #include "MvEepromDxe.h" > > -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16) > - > STATIC CONST EFI_GUID I2cGuid = I2C_GUID; > > EFI_DRIVER_BINDING_PROTOCOL gDriverBindingProtocol = { > diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > index 9ec4929..582e2b9 100755 > --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > @@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > #include > #include > #include > +#include > > #include > #include > @@ -628,9 +629,6 @@ MvI2cStartRequest ( > > STATIC CONST EFI_GUID DevGuid = I2C_GUID; > > -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16) > -#define I2C_DEVICE_ADDRESS(index) ((index) & 0xffff) > - > STATIC > EFI_STATUS > MvI2cAllocDevice ( > -- > 2.7.4 >