From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.75]) by mx.groups.io with SMTP id smtpd.web10.2056.1588225907247952650 for ; Wed, 29 Apr 2020 22:51:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=PUxtcnZ8; spf=pass (domain: oss.nxp.com, ip: 40.107.21.75, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EQ6+0GY+kFKHY90zQp/08BtdigrIOpHHorkeTYfZ048cLuF2wAZDDI4GotQV2KXH2B0sfz+ZE8HepG2seVcU4na0UbD+zaOsozkYwBjI+SZb2SxhdBdQ5LWNsM1Fp3aVNyVXPbFWvV6uuSF3HAxQOKzoOwHU2AgTPspFwwNgPAD6JXhi5+IMPURebyZnzwsx7IsXX4P7qzYLYjB9vaIJSFT1710fiDHqAy/Ug1mwvzzUEenDYurYXRucIr3PB/SxY403XWERNQMoMejKqO//JWhtNEW1zkiljeG4kdQo8yXEN+fm/yGktzCKKuDevAQgZUHWpiyR8Pn17OPqPSUPFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gZRfXPlilVBgbnBzjCd0zS3iLlJ5Gk6OJrwCzHYh+QY=; b=AskI/KpBKo31fiAnft8Wvbie9mdv0upVFCei3yIW2Q8gEexs0iNHAqytV0UoVZBNMnuBP67FucYnXiMtz7CSkOpDnYwS0rlsQ4BMJ+QE+rxpqjtYiAzSXPTQckGwzGWu2HeFOhQysWy046wlGIgOmX2K/S12CxJds7pfnhRNubPNHuPj6r7AaU95NduPbaDFCQ6o8huXSKLhe7VvdGkqRGAB2PJbAUFZBxDIeP6IiIhNz9lh1YOSsBulPZBK1Wnj2aoTOvySKLE8xXUrCSUijURhoNfPMBT2Sd8Au8gu1GHa8kFk8t5OK/HT7+os3KwVSQ8O71OoIdbirbKeQVU/DQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gZRfXPlilVBgbnBzjCd0zS3iLlJ5Gk6OJrwCzHYh+QY=; b=PUxtcnZ84KXCie85uovdqSND1/0wcV84sG7ZkHdFq8pnfiap5CY3ont1WeqQMQ1FuQ/YKFn7GSLKlPoebx6E7jGylOLDNA+EjLYFA79ErmiSdhY67V+3LvhSZeqDjvHoCeoJi8NP6VSwtG9VHrY7wOlTx505Gos9ZglfN+a/zWE= Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4429.eurprd04.prod.outlook.com (2603:10a6:803:6e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 05:51:44 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513%7]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 05:51:44 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: [PATCH edk2-platforms v4 15/24] Silicon: NXP: Remove direct calls to SwapMmio* APIs Date: Fri, 1 May 2020 11:19:46 +0530 Message-ID: <20200501054955.13025-16-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> References: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) To VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) Return-Path: pankaj.bansal@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from uefi-workstation.ap.freescale.net (92.120.0.69) by SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.14 via Frontend Transport; Thu, 30 Apr 2020 05:51:42 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [92.120.0.69] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0b28fcbe-8e33-4f5a-541c-08d7ecca904e X-MS-TrafficTypeDiagnostic: VI1PR04MB4429:|VI1PR04MB4429: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1122; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5933.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(376002)(39860400002)(346002)(366004)(396003)(6512007)(26005)(16526019)(5660300002)(478600001)(186003)(2906002)(110136005)(52116002)(6486002)(316002)(8676002)(6506007)(66476007)(19627235002)(86362001)(2616005)(66946007)(44832011)(956004)(66556008)(1076003)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHuU1Vj67bZrYJ+WRnW8nLX9D063CSEDqVS0NLnPVK4Q+wLLTi882FQ/0YgvnTYhEv9EszleR9CxK/znx/TjvddTDjyrz8yV/V86Ii7DaUm7ziOeqz2aNNuWS5SbZUON+7iKjB82DXb7sVxoqtZSpu0v9ISKq8MNmXnKYsPXHAOZDUjL4QzpJxJC1lAOOlVjNqy+hbaQLyJvKEt2+OMLapCer0393C0PgZNMSDRo7pJ1tzzOfMemejZmDVpii3vqEt7dGttqRxI0F7EzZKqjwTxfQ7TSSt2oiX8mX8c9SVs+SYiX2BP2/6TlK20WaV7al0K030XUU4FYW0zbkEPXjH+i6/bG44ijS7euV8+/nHMGf1AH2d6PBx1tOBy/BEG8KlpZbrlLHGEKgEnmlJL+crX50iW2V+AsGrxp1N0dD86Rc6wadcSfoCwSIjnAS1IR X-MS-Exchange-AntiSpam-MessageData: D3/XUclh7/Xb2S4ixWDr8fvlcRrYryKf+mMGBuxCT9k4gGITM168l2PZHepwluFUF9Xk/O/Imj5c+ANdkytUU7pRqdOKZysPV4xlEnN/vJ1p690XZinG6w+xBtxgADWPeWyI1mSIzNSyDOchCTjz3RcGM2KoZqleEsciV1SRT+6FDjOy1qBsCE/8nH/eYK7+EN8kYj4dtz72SASVavOvA8k96tWEIPCez4YbznnXl5bNCwvkw4KvrJ/F/4vgbYSkiV55QTGOQYCGxdpHSrwP4k9Qd0YLmHDzf8zzMD9Q+Siocz+HnQli1IgSyvz294sU4AXodH9XiI6iKM+Wym80DC+ZAVCgGCaUzIEQvF1tfYnZ0deM1Mx2Sya0/zoZ2yB+uIrm9T2p12wP1XMGlC9jdP2H5bl7IITaaIQKGGTh8inHGyt7JYdHXbTkPCJ2rLMjvLg9z+0Dz/YlUPfoqp3BXcUfqIvH/92EhuN2naxe+wlPty9pHRvyWdK54dYIpJAX5tJptayIVpByD2ERlIS4rCMjJhlaJaRQU+QYLLPsqtykhOFy+Adpdpnbp1PtBfktdFYwCssl2imMR/s2ue+uSTFKsgwb6FKJV72OBHYnZeystXgRlCVcdw0QZwoAdZ1tvN/I5niQPw3gDKFm/kbK0a4fenFHvQlislU9v36Sk9hGgGLMxJoNuas/vjertPVEseqDVIxi36UtMwxXoOF+mu2B2fdpaZMDOwfa4fMY0POFIIPgfAy9sGohc3RI3MvLtysCLpBwj1paiXKNge1YLcpYjmFlsXV+qWnmSj54vnU= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b28fcbe-8e33-4f5a-541c-08d7ecca904e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 05:51:44.7814 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PKSzOGLqrC21Sdc/BBoo0Hdy2T168lBYZLCT1r+BF1I/zYY9jMxbjll4DacHAdz3t+04wdO+Wvly3dCgAuE6VQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4429 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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: V4: - Use GetMmioOperations in place of GetMmioOperations32 - Use MMIO_OPERATIONS in place of MMIO_OPERATIONS_32 =20 V3: - New commit 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/Includ= e/Library/IoAccessLib.h index 0f5b19dcf149..3dbb35d2ce5a 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 * @@ -47,238 +47,4 @@ GetMmioOperations ( IN BOOLEAN Swap ); =20 -/** - 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 regis= ter. - @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 regis= ter. - @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 regis= ter. - @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 regist= er. - - @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 regist= er. - - @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 regist= er. - - @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 regis= ter. - - @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 regis= ter. - - @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 regis= ter. - - @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/Li= brary/IoAccessLib/IoAccessLib.c index 33039afda40f..2c6160e8acef 100644 --- a/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c +++ b/Silicon/NXP/Library/IoAccessLib/IoAccessLib.c @@ -2,7 +2,7 @@ =20 Provide MMIO APIs for BE modules. =20 - Copyright 2017-2019 NXP + Copyright 2017-2020 NXP =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -21,6 +21,7 @@ @return The value read. =20 **/ +STATIC UINT16 EFIAPI SwapMmioRead16 ( @@ -38,6 +39,7 @@ SwapMmioRead16 ( @return The value read. =20 **/ +STATIC UINT32 EFIAPI SwapMmioRead32 ( @@ -55,6 +57,7 @@ SwapMmioRead32 ( @return The value read. =20 **/ +STATIC UINT64 EFIAPI SwapMmioRead64 ( @@ -71,6 +74,7 @@ SwapMmioRead64 ( @param Value The value to write to the MMIO register. =20 **/ +STATIC UINT16 EFIAPI SwapMmioWrite16 ( @@ -88,6 +92,7 @@ SwapMmioWrite16 ( @param Value The value to write to the MMIO register. =20 **/ +STATIC UINT32 EFIAPI SwapMmioWrite32 ( @@ -105,6 +110,7 @@ SwapMmioWrite32 ( @param Value The value to write to the MMIO register. =20 **/ +STATIC UINT64 EFIAPI SwapMmioWrite64 ( @@ -125,6 +131,7 @@ SwapMmioWrite64 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT16 EFIAPI SwapMmioAndThenOr16 ( @@ -149,6 +156,7 @@ SwapMmioAndThenOr16 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT32 EFIAPI SwapMmioAndThenOr32 ( @@ -173,6 +181,7 @@ SwapMmioAndThenOr32 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT64 EFIAPI SwapMmioAndThenOr64 ( @@ -196,6 +205,7 @@ SwapMmioAndThenOr64 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT16 EFIAPI SwapMmioOr16 ( @@ -215,6 +225,7 @@ SwapMmioOr16 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT32 EFIAPI SwapMmioOr32 ( @@ -234,6 +245,7 @@ SwapMmioOr32 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT64 EFIAPI SwapMmioOr64 ( @@ -253,6 +265,7 @@ SwapMmioOr64 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT16 EFIAPI SwapMmioAnd16 ( @@ -272,6 +285,7 @@ SwapMmioAnd16 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT32 EFIAPI SwapMmioAnd32 ( @@ -291,6 +305,7 @@ SwapMmioAnd32 ( @return The value written back to the MMIO register. =20 **/ +STATIC UINT64 EFIAPI SwapMmioAnd64 ( diff --git a/Silicon/NXP/Library/SocLib/Chassis.c b/Silicon/NXP/Library/Soc= Lib/Chassis.c index 90677f0f36ca..05c5462446a4 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 *GurOps; + + GurOps =3D GetMmioOperations (FixedPcdGetBool (PcdGurBigEndian)); + + return GurOps->Read32 (Address); } =20 /* --=20 2.17.1