From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AF0692244E411 for ; Mon, 16 Apr 2018 13:42:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93EF1722E1; Mon, 16 Apr 2018 20:42:28 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-213.rdu2.redhat.com [10.10.120.213]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93D032166BAD; Mon, 16 Apr 2018 20:42:27 +0000 (UTC) To: Michael Brown , "Kinney, Michael D" , Leif Lindholm Cc: "edk2-devel@lists.01.org" , "Gao, Liming" References: <20180413174211.858-1-leif.lindholm@linaro.org> <20180413193143.t45tua3yi7sopk4d@bivouac.eciton.net> <20180416100712.6v642ycksvmoffvt@bivouac.eciton.net> <52ea5684-380d-0519-2545-6ef7f62198ae@ipxe.org> From: Laszlo Ersek Message-ID: <09cc135a-c3b7-bcbd-1a71-6454e3ba7623@redhat.com> Date: Mon, 16 Apr 2018 22:42:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <52ea5684-380d-0519-2545-6ef7f62198ae@ipxe.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 16 Apr 2018 20:42:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 16 Apr 2018 20:42:28 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH] MdePkg: add big-endian MMIO BaseBeIoLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 20:42:29 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 04/16/18 16:34, Michael Brown wrote: > On 16/04/18 15:10, Kinney, Michael D wrote: >> I agree that the opposite use case is a BE CPU >> needing a LE operation. >> >> I think we only need a single lib class and lib >> Instance that does the byte swap and we should >> not use Le or Be in any of the names of the class, >> instance, or APIs.  Just "Swap". > > I may have misunderstood, but wouldn't using "Swap" within the API names > effectively encode knowledge of the endianness of the _build_ platform > into the source code?  This would prevent the same source code being > built for both little-endian and big-endian CPUs. Under this scenario, all drivers meant to be portable to both byte orders would have to: - link against both IoLib and IoSwapLib, - determine at device binding time, from CPU endianness and device endianness combined, whether swapping was needed for that device, - call the IoLib or IoSwapLib APIs through wrapper functions, or function pointers. Thanks, Laszlo