From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 B65202205B90A for ; Thu, 11 Jan 2018 01:53:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB12C80F79; Thu, 11 Jan 2018 09:58:13 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-14.rdu2.redhat.com [10.10.120.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CC2387DA; Thu, 11 Jan 2018 09:58:12 +0000 (UTC) To: Pankaj Bansal , "edk2-devel@lists.01.org" Cc: Leif Lindholm , Ard Biesheuvel , Michael Kinney References: <1515576669-14171-1-git-send-email-pankaj.bansal@nxp.com> <1515576669-14171-2-git-send-email-pankaj.bansal@nxp.com> <3abe87d7-e50f-a454-6855-5eeb13428fce@redhat.com> From: Laszlo Ersek Message-ID: <28f0a274-0f59-9b2b-e8ac-e85faffea228@redhat.com> Date: Thu, 11 Jan 2018 10:58:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Jan 2018 09:58:13 +0000 (UTC) Subject: Re: [PATCH 2/2] ArmPkg/ArmArchTimerLib: Implement GetElapsedTime function of TimerLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 09:53:01 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 01/11/18 07:28, Pankaj Bansal wrote: > Hi Laszlo, > >> -----Original Message----- >> From: Laszlo Ersek [mailto:lersek@redhat.com] >> Sent: Wednesday, January 10, 2018 10:34 PM >> To: Pankaj Bansal ; edk2-devel@lists.01.org >> Cc: Leif Lindholm ; Ard Biesheuvel >> ; Michael Kinney >> Subject: Re: [edk2] [PATCH 2/2] ArmPkg/ArmArchTimerLib: Implement >> GetElapsedTime function of TimerLib >> (1) Please feel free to pick up my code and work on upstreaming it -- just >> please preserve my S-o-b on the patch(es) (in addition to yours), and the Red >> Hat copyright notice (in addition to your company's) in the new files. >> >> (2) Last time I counted (reading up on the original thread), there were >> 21 TimerLib instances in edk2. Adding the same function to every one of >> them looks terrible. In edk2, I know of only two ways to avoid this: >> >> - introduce a new library class (with class header file), and a simple library >> instance (implementation) >> >> - collect (=move) as many as possible of the existing library instances under >> common subdirectories, so that their INF files are basically in the same >> subdirectory. Then the new code can be implemented in a new C file, under >> the same subdirectory, and then all INF files can refer to the new C file >> directly. This kind of code sharing works very well if the library instances are >> otherwise closely related. It does not work at all if the library instances live in >> separate top-level packages (which is BTW the case here). >> >> >> It seems that Mike wasn't opposed to introducing a TimerTickDiffLib class (or >> something similar) to MdePkg. However, more work looked necessary than I >> had expected, esp. with regard to the caching of timer hardware >> characteristics (please see the last few messages in the thread >> -- either the code has to add its own caching, or all existing, suitable TimerLib >> instances have to be verified about caching). Again, please feel free to pick >> up the code and rework it as Mike suggests -- it's basically the >> GetTickDifference() function only that adds value. Feel free to hammer it into >> any shape or form necessary. > > Thank you. I will try to work on this problem of integrating these changes in multiple > TimerLib instances, when I have some room on my plate. > For now, I guess I will just add wrapper functions on top of TimerLib APIs for my Platform only. Sure, that works as well -- feel free to scavenge the code as you see fit. Thanks, Laszlo