From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.81]) by mx.groups.io with SMTP id smtpd.web10.9609.1586866532645081215 for ; Tue, 14 Apr 2020 05:15:33 -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=XaTOcMWK; spf=pass (domain: oss.nxp.com, ip: 40.107.14.81, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mAV67R770Nc/190c6+/iJ/IyuE6fzIl58P982u9kGnkWc3HZIM00MEU3fSTYKW/ZwZrRfgEf2tdOVXT2zqhaZDtxNezvJPUDsIz2+w4jOmxbVsgwWj+inhykRZVXYNKYjhg0eeO6lPB3onhEfliP/v7Z9dS8rTk0qY7VZqhTcKUEGNrYh47NGAOs5RiRMW+rhU/DlsWSYNrEqtvJ2skiNa7OebLDK4d6IU/x5YP669vN8ZGkFbBOM6nmCJzNPJ9YGON0ue/4zMLqm6GGOifzmHzZ+IL8Dms9Nq2+S6djLZVDA10NHOQ1ZEB6IT9Bb09DUgMoGs/sLmvGWpkhjhv6FQ== 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=tMZbAuHUWQrLbe2JNx6BlDVdzKzN5Hvb0xptBwz8im0=; b=k7jj9LMUekdfXc/B3jfQ8Kh8Omxj1HRaPFbYqKTEm+aWdvNbUPx8R4nb3dzXd9ZbtJr/DD/9DwqMtTNAgv/RFZJIERnPuvzNwQf2T4NaryPI1rqrxUE84BXsPn9apZXmxBUuI+6stae5kL2t/f3Y6RrdMojiuZkQnFcniH1/MjAyVgeozIVEcJ28UH64D/C7eS+4LUMgDmH2Y9kzjTpZhrhkE3mfuMwpgSBH8pXrGpMpEmdROJsifVTyz97LaX5KVbCvD73aaj3X37Up6vRAuouUh6V2zuYi0PkvyDqbGls/XIHxZf/nHcquDm9ScILftLHsYH77ze/7/gAEZ4MGqw== 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=tMZbAuHUWQrLbe2JNx6BlDVdzKzN5Hvb0xptBwz8im0=; b=XaTOcMWK6pcNNAWfzKR72MsfEHjuKFY4ZCTW4B0ymecSOciwPXwDkymgWMh0rds35dvXZKirsd5iRuC+1+UYNxe5UIxztCApJRcSE9sptKX5iWauqXcE3EZxjIB0fJ1/f3M+L2T+svCsCsxbUWLcqZra9gBQqtMa/tie/I0D1pw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4461.eurprd04.prod.outlook.com (2603:10a6:803:70::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.28; Tue, 14 Apr 2020 12:15:30 +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.2900.028; Tue, 14 Apr 2020 12:15:30 +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 v3 15/24] Silicon: NXP: Remove direct calls to SwapMmio* APIs Date: Wed, 15 Apr 2020 17:43:33 +0530 Message-ID: <20200415121342.9246-16-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) 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 SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Tue, 14 Apr 2020 12:15:27 +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: f7397d54-a8ad-4416-340b-08d7e06d85eb X-MS-TrafficTypeDiagnostic: VI1PR04MB4461:|VI1PR04MB4461: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:576; X-Forefront-PRVS: 0373D94D15 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:(10009020)(4636009)(376002)(366004)(346002)(136003)(39850400004)(396003)(1076003)(186003)(8936002)(16526019)(86362001)(110136005)(26005)(478600001)(81156014)(8676002)(6512007)(66946007)(316002)(44832011)(66476007)(66556008)(52116002)(5660300002)(6666004)(2906002)(6486002)(6506007)(956004)(19627235002)(2616005);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: oss.nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /oHl8HWynu1EIvm7TwhO+C39RPPJ9MR0LOXdT6xTCdI0QZgpsL1k8f2tIv/YDvDGFGUuheq0lytUJ6PlRziPRC3zrABih7Z12hWisFyPObaitLpxwsaVAXXuMqJPuZv0e/cX0tsOsBIFfCswSBAc96R3Oga2+pue+Q8+9D+p/yvy5w49SBLMj64MQ0WTLftuWlXDXppQFFeGFEJ9fdfkiv6E+Hxb8ZFu5cXxYR1kBr3y4ZsD3gSb6pzfKNWoU3pK1PWdoRcWegiKoZiby+tG9q7YyZ5WTCQ2L3wz83rA9tn5pFlrYCrqWLBmwWm6kBouAPJHBbsW9Wi3FfFyMQQtetg1noGQOdvaCg/nnLeRg9TUEgQnzS6XRAXbqoFpTAXO+kkmJOZUluIJps0dmajSRpRkeHp1viGZv7lhc7eWEwT+dhPgOkC4XsEfTxTEJDzW X-MS-Exchange-AntiSpam-MessageData: cUrCPWzPv8fb81hAqIFM23GthcEP53v/EHGdQt7Yx209/123Jd3XeXES7LH7t4ha5si0nxnSV6k5m32poAuvCK7ZEyxfylAqyMFSNlwpgSqWaDDyLgSMNPkKQiQQBvs1HY3bE8HGYJ8S1jf5JU9zyA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7397d54-a8ad-4416-340b-08d7e06d85eb X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 12:15:30.2983 (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: H7bTgAt9gkg5zLtXLtWrJvcdb+lGvUZPYMY4k0y9BybA6U677ZJb9yg9g3edo5V3alBFmwEkTuRZKN0S8utwQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4461 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: - 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 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 ); =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 6ed83d019a6e..bb4a93b6f09a 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..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 =3D GetMmioOperations32 (FixedPcdGetBool (PcdGurBigEndian)); + + return GurOps->Read32 (Address); } =20 /* --=20 2.17.1