From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0606.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::606]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 44AC51A1E8B for ; Fri, 14 Oct 2016 06:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p4eVvyVFGdHLrPZ8RgWP3QIboEm4qhH9xGGMiiSL/wo=; b=jgMHo4VqZg8d0dnhvmnpPWqf03C9I1xwiG0PTnKeAQemJfvri5vK/OIOfsjzMfR4yx02iebgFSjOWVxRNDx0zeO35RX/Zxh2PKUa/62yO7AwtoMAUSlBqjBYL+iEee+H+TJa4snvo3YDqCp/iolCaC18M+V4lB7ce8T7lU96p44= Received: from AM4PR0401MB2289.eurprd04.prod.outlook.com (10.165.45.12) by AM4PR0401MB2291.eurprd04.prod.outlook.com (10.165.45.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.8; Fri, 14 Oct 2016 13:17:15 +0000 Received: from AM4PR0401MB2289.eurprd04.prod.outlook.com ([10.165.45.12]) by AM4PR0401MB2289.eurprd04.prod.outlook.com ([10.165.45.12]) with mapi id 15.01.0659.020; Fri, 14 Oct 2016 13:17:15 +0000 From: Bhupesh Sharma To: Laszlo Ersek CC: "edk2-devel@ml01.01.org" Thread-Topic: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO Thread-Index: AQHSJf8g/iwRRYlwNEmQ6ZjvMhDzNKCn2uOAgAARwcA= Date: Fri, 14 Oct 2016 13:17:15 +0000 Message-ID: References: <1476437615-29534-1-git-send-email-bhupesh.sharma@nxp.com> <38e8d690-b981-4b37-1ad2-6c6975ad2a9a@redhat.com> In-Reply-To: <38e8d690-b981-4b37-1ad2-6c6975ad2a9a@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=bhupesh.sharma@nxp.com; x-originating-ip: [122.177.95.97] x-ms-office365-filtering-correlation-id: 783e94e4-4817-4ab2-19fc-08d3f4346abc x-microsoft-exchange-diagnostics: 1; AM4PR0401MB2291; 7:hrsyIF5XwkqQUAWMiZV9MK2bp4HidzMllCfriVrrRfOoihXS/in9g55AJM19eyYtmp+cqLrkw3534r4AY39b0iUbg3L5Dp6gDsmRZWdRH6Ui4o2ReDokwxqEqfzgAiRs3bwc63s/EwyTYqythmetsImBs+njy8iNP8ReKdC9e651TFOpLui8D8BSM1KzK0MpDoZH9SXozP/X3+alSTDkoSP+/BFx1sLigDgYI4AsQ1JEyA+D00aJxJ8kvgaNAwZbApEszB/t+FfytMBAhS38F15U64kn9pWkb4nU2LCecyNggH0ZgQpHYY+qCEZt6m67p1ROI2hVc/Tvl/0rNX4KzU7zjks+VJPmvHt+Rsa+a9I= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR0401MB2291; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:AM4PR0401MB2291; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB2291; x-forefront-prvs: 0095BCF226 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(6009001)(7916002)(199003)(377454003)(24454002)(189002)(76576001)(7736002)(305945005)(66066001)(2906002)(3846002)(74316002)(9686002)(7846002)(68736007)(19580405001)(6116002)(4326007)(102836003)(3660700001)(81156014)(92566002)(81166006)(11100500001)(3280700002)(87936001)(86362001)(7696004)(2900100001)(2950100002)(50986999)(189998001)(6916009)(8676002)(54356999)(77096005)(33656002)(5002640100001)(106356001)(19580395003)(106116001)(122556002)(15975445007)(8936002)(97736004)(586003)(105586002)(101416001)(10400500002)(76176999)(5660300001)(110136003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB2291; H:AM4PR0401MB2289.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2016 13:17:15.3859 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2291 Subject: Re: [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 13:17:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Laszlo, > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Friday, October 14, 2016 5:37 PM >=20 > On 10/14/16 11:33, Bhupesh Sharma wrote: > > Various IPs on NXP/FSL SoCs having ARM64 cores have big-endian MMIO > > interfaces. > > > > This implies that a byte-swap operation is needed to read/write such > > BE MMIO registers from the LE ARM64 cores. > > > > This patch adds the support for the same. > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Meenakshi Aggarwal > > Signed-off-by: Bhupesh Sharma > > --- > > MdePkg/Include/Library/IoLib.h | 364 > ++++++++++++++++++++ > > MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c | 479 > > +++++++++++++++++++++++++++ > > 2 files changed, 843 insertions(+) >=20 > I think this is both overkill and incomplete, at the same time :) >=20 > - Incomplete because only one IoLib instance gets the implementation. Agree, but do we have an example of similar BE MMIO IPs on other Architectures/soc? I was only aware of NXP/FSL having such MMIO interfaces as the IPs have been reused from PPC SoC, which used to have a BE core and hence did not require a SwapByte. =20 > - Overkill because you can easily use the SwapBytes16, SwapBytes32, > SwapBytes64 functions -- also from BaseLib --, for transforming > MmioWrite arguments and MmioRead results. >=20 Yes, but that means at every IP driver needs to especially carry such arguments and transform the results. That might be an overkill. We already have similar implementations MMIO implementations in Linux for e= .g. http://lxr.free-electrons.com/source/include/asm-generic/io.h#L642 Regards, Bhupesh