From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web11.3031.1587634082915625367 for ; Thu, 23 Apr 2020 02:28:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=HPZLoosm; spf=pass (domain: nuviainc.com, ip: 209.85.221.65, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f65.google.com with SMTP id f13so5940482wrm.13 for ; Thu, 23 Apr 2020 02:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dqJUOvgscsE49S+Qm4a0vMCyv1LVgDeTbOnEfhHTkpQ=; b=HPZLoosmenUeY7otLtIcTfDEHWhStknFb7CMzGI2uIMFhzLXuI2DyBsO0TwGyxebQo ceZpZayQL0frpRtaKCkqemrbepzufmUZ0cXYX4FNlCKGUeRtXWuTAInVKPxsJgPtiUHn acPndrXgkO+dWslPJgX2aWI02RO8UExT4Ao2FfwONNV7n0Dju8O5ZLi0Ys8UZSOAD7Tj Tn6NdSy3dLFLodAe1OAqe1pbzB7gCq8SuQ/+0QMUIm7eL5g22gDzM8ELOrwDpqb2fI5H dkzbfk7l7/37ziMYx9ITCHgEPNsWtgaTNZWY4d3v94Xkxa3Oj8N7rpEEJ26jquVotdWG aOYQ== 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=dqJUOvgscsE49S+Qm4a0vMCyv1LVgDeTbOnEfhHTkpQ=; b=DqkL7EUStlFMC1qVRf3958bPlo66YvbD7dfkj8yjqsIibodosQMwwPsj8db4PdJnod uRLfdcgsuNte57xmQcKu4Qzr8viIWJrf3sGtrE+H512l8kYvVZjO5N7mcVLiKuaNWTgg 3tvfYcfPUbfmhZ5gmwhP5cYXI4E2vIxfy6LxRKam7HLwIHRYN5JRCFGRET6QivJlk+xC d0A21lfgEAtlV15l9D3X/Bkdo+Hq6PhS0D+dLwocN1QahYQgrts015sJu89xRl1Eq8DE GcMtfG3ivVZGWwpWeSxVDeYqQ4Ur2IAYIjjwAj+4hwBLwwvLtmWxx6KCeIbPnTUrGk58 O9rg== X-Gm-Message-State: AGi0PuZ4PLhsJ9iuX+3EV4bkeCRbM54Ls2M+vV/4hERRbz58lQGCgxib F8dPM6BXq7iX61S0P3BD9Zpf3A== X-Google-Smtp-Source: APiQypI+LIWg93BIv+xBdGjxYxFHt3UMLSrpo90AYR3iSnHfPBgwELV3ODdCBXs18whj3wNGpGuu6g== X-Received: by 2002:a5d:4283:: with SMTP id k3mr3693262wrq.238.1587634081439; Thu, 23 Apr 2020 02:28:01 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id o3sm2792739wru.68.2020.04.23.02.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 02:28:01 -0700 (PDT) Date: Thu, 23 Apr 2020 10:27:59 +0100 From: "Leif Lindholm" To: Pankaj Bansal Cc: Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: Re: [PATCH edk2-platforms v3 15/24] Silicon: NXP: Remove direct calls to SwapMmio* APIs Message-ID: <20200423092759.GU14075@vanye> References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> <20200415121342.9246-16-pankaj.bansal@oss.nxp.com> MIME-Version: 1.0 In-Reply-To: <20200415121342.9246-16-pankaj.bansal@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 15, 2020 at 17:43:33 +0530, Pankaj Bansal wrote: > From: Pankaj Bansal > > The SwapMmio** APIs are supposed to be called indirectly via > GetMmioOperations** APIs. > Therefore, remove the SwapMmio** APIs from IoAccessLib.h and make > these APIs STATIC to IoAccessLib.c, so that no accidental call can > be made to these. > > Signed-off-by: Pankaj Bansal > --- > > Notes: > - New commit Thanks! Reviewed-by: Leif Lindholm > > Silicon/NXP/Include/Library/IoAccessLib.h | 236 +------------------- > Silicon/NXP/Library/IoAccessLib/IoAccessLib.c | 17 +- > Silicon/NXP/Library/SocLib/Chassis.c | 10 +- > 3 files changed, 22 insertions(+), 241 deletions(-) > > diff --git a/Silicon/NXP/Include/Library/IoAccessLib.h b/Silicon/NXP/Include/Library/IoAccessLib.h > index 0b708d544fa7..7b490744382c 100644 > --- a/Silicon/NXP/Include/Library/IoAccessLib.h > +++ b/Silicon/NXP/Include/Library/IoAccessLib.h > @@ -1,6 +1,6 @@ > /** @file > * > - * Copyright 2017-2019 NXP > + * Copyright 2017-2020 NXP > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -89,238 +89,4 @@ GetMmioOperations64 ( > IN BOOLEAN Swap > ); > > -/** > - MmioRead16 for Big-Endian modules. > - > - @param Address The MMIO register to read. > - > - @return The value read. > - > -**/ > -UINT16 > -EFIAPI > -SwapMmioRead16 ( > - IN UINTN Address > - ); > - > -/** > - MmioRead32 for Big-Endian modules. > - > - @param Address The MMIO register to read. > - > - @return The value read. > - > -**/ > -UINT32 > -EFIAPI > -SwapMmioRead32 ( > - IN UINTN Address > - ); > - > -/** > - MmioRead64 for Big-Endian modules. > - > - @param Address The MMIO register to read. > - > - @return The value read. > - > -**/ > -UINT64 > -EFIAPI > -SwapMmioRead64 ( > - IN UINTN Address > - ); > - > -/** > - MmioWrite16 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param Value The value to write to the MMIO register. > - > -**/ > -UINT16 > -EFIAPI > -SwapMmioWrite16 ( > - IN UINTN Address, > - IN UINT16 Value > - ); > - > -/** > - MmioWrite32 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param Value The value to write to the MMIO register. > - > -**/ > -UINT32 > -EFIAPI > -SwapMmioWrite32 ( > - IN UINTN Address, > - IN UINT32 Value > - ); > - > -/** > - MmioWrite64 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param Value The value to write to the MMIO register. > - > -**/ > -UINT64 > -EFIAPI > -SwapMmioWrite64 ( > - IN UINTN Address, > - IN UINT64 Value > - ); > - > -/** > - MmioAndThenOr16 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - @param OrData The value to OR with the result of the AND operation. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT16 > -EFIAPI > -SwapMmioAndThenOr16 ( > - IN UINTN Address, > - IN UINT16 AndData, > - IN UINT16 OrData > - ); > - > -/** > - MmioAndThenOr32 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - @param OrData The value to OR with the result of the AND operation. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT32 > -EFIAPI > -SwapMmioAndThenOr32 ( > - IN UINTN Address, > - IN UINT32 AndData, > - IN UINT32 OrData > - ); > - > -/** > - MmioAndThenOr64 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - @param OrData The value to OR with the result of the AND operation. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT64 > -EFIAPI > -SwapMmioAndThenOr64 ( > - IN UINTN Address, > - IN UINT64 AndData, > - IN UINT64 OrData > - ); > - > -/** > - MmioOr16 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param OrData The value to OR with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT16 > -EFIAPI > -SwapMmioOr16 ( > - IN UINTN Address, > - IN UINT16 OrData > - ); > - > -/** > - MmioOr32 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param OrData The value to OR with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT32 > -EFIAPI > -SwapMmioOr32 ( > - IN UINTN Address, > - IN UINT32 OrData > - ); > - > -/** > - MmioOr64 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param OrData The value to OR with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT64 > -EFIAPI > -SwapMmioOr64 ( > - IN UINTN Address, > - IN UINT64 OrData > - ); > - > -/** > - MmioAnd16 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT16 > -EFIAPI > -SwapMmioAnd16 ( > - IN UINTN Address, > - IN UINT16 AndData > - ); > - > -/** > - MmioAnd32 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT32 > -EFIAPI > -SwapMmioAnd32 ( > - IN UINTN Address, > - IN UINT32 AndData > - ); > - > -/** > - MmioAnd64 for Big-Endian modules. > - > - @param Address The MMIO register to write. > - @param AndData The value to AND with the read value from the MMIO register. > - > - @return The value written back to the MMIO register. > - > -**/ > -UINT64 > -EFIAPI > -SwapMmioAnd64 ( > - IN UINTN Address, > - IN UINT64 AndData > - ); > - > #endif /* IO_ACCESS_LIB_H_ */ > diff --git a/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c b/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c > index 6ed83d019a6e..bb4a93b6f09a 100644 > --- a/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c > +++ b/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c > @@ -2,7 +2,7 @@ > > Provide MMIO APIs for BE modules. > > - Copyright 2017-2019 NXP > + Copyright 2017-2020 NXP > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -21,6 +21,7 @@ > @return The value read. > > **/ > +STATIC > UINT16 > EFIAPI > SwapMmioRead16 ( > @@ -38,6 +39,7 @@ SwapMmioRead16 ( > @return The value read. > > **/ > +STATIC > UINT32 > EFIAPI > SwapMmioRead32 ( > @@ -55,6 +57,7 @@ SwapMmioRead32 ( > @return The value read. > > **/ > +STATIC > UINT64 > EFIAPI > SwapMmioRead64 ( > @@ -71,6 +74,7 @@ SwapMmioRead64 ( > @param Value The value to write to the MMIO register. > > **/ > +STATIC > UINT16 > EFIAPI > SwapMmioWrite16 ( > @@ -88,6 +92,7 @@ SwapMmioWrite16 ( > @param Value The value to write to the MMIO register. > > **/ > +STATIC > UINT32 > EFIAPI > SwapMmioWrite32 ( > @@ -105,6 +110,7 @@ SwapMmioWrite32 ( > @param Value The value to write to the MMIO register. > > **/ > +STATIC > UINT64 > EFIAPI > SwapMmioWrite64 ( > @@ -125,6 +131,7 @@ SwapMmioWrite64 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT16 > EFIAPI > SwapMmioAndThenOr16 ( > @@ -149,6 +156,7 @@ SwapMmioAndThenOr16 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT32 > EFIAPI > SwapMmioAndThenOr32 ( > @@ -173,6 +181,7 @@ SwapMmioAndThenOr32 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT64 > EFIAPI > SwapMmioAndThenOr64 ( > @@ -196,6 +205,7 @@ SwapMmioAndThenOr64 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT16 > EFIAPI > SwapMmioOr16 ( > @@ -215,6 +225,7 @@ SwapMmioOr16 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT32 > EFIAPI > SwapMmioOr32 ( > @@ -234,6 +245,7 @@ SwapMmioOr32 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT64 > EFIAPI > SwapMmioOr64 ( > @@ -253,6 +265,7 @@ SwapMmioOr64 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT16 > EFIAPI > SwapMmioAnd16 ( > @@ -272,6 +285,7 @@ SwapMmioAnd16 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT32 > EFIAPI > SwapMmioAnd32 ( > @@ -291,6 +305,7 @@ SwapMmioAnd32 ( > @return The value written back to the MMIO register. > > **/ > +STATIC > UINT64 > EFIAPI > SwapMmioAnd64 ( > diff --git a/Silicon/NXP/Library/SocLib/Chassis.c b/Silicon/NXP/Library/SocLib/Chassis.c > index 90677f0f36ca..d7bc55c9d275 100644 > --- a/Silicon/NXP/Library/SocLib/Chassis.c > +++ b/Silicon/NXP/Library/SocLib/Chassis.c > @@ -30,11 +30,11 @@ GurRead ( > IN UINTN Address > ) > { > - if (FixedPcdGetBool (PcdGurBigEndian)) { > - return SwapMmioRead32 (Address); > - } else { > - return MmioRead32 (Address); > - } > + MMIO_OPERATIONS_32 *GurOps; > + > + GurOps = GetMmioOperations32 (FixedPcdGetBool (PcdGurBigEndian)); > + > + return GurOps->Read32 (Address); > } > > /* > -- > 2.17.1 >