From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DC4E721A143E3 for ; Sat, 1 Jul 2017 13:40:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A21CCC0587CD; Sat, 1 Jul 2017 20:42:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A21CCC0587CD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A21CCC0587CD Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-56.phx2.redhat.com [10.3.116.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 673695C697; Sat, 1 Jul 2017 20:42:07 +0000 (UTC) To: Jordan Justen Cc: Michael Kinney , edk2-devel-01 , Jiewen Yao , Jeff Fan References: <20170608171333.17937-1-lersek@redhat.com> <20170608171333.17937-2-lersek@redhat.com> <149789342556.32751.17592475673245441129@jljusten-skl> <384c7b21-dc46-25ba-c90e-75ae07ab5921@redhat.com> <149849999779.24605.15084992650352143991@jljusten-skl> <04147371-25a3-12d2-0cbd-6e07c816a880@redhat.com> <149851656823.26353.11207512663550762369@jljusten-skl> <149876364614.17954.18085820933912290198@jljusten-skl.jf.intel.com> From: Laszlo Ersek Message-ID: <670b335c-665b-1672-6f34-d0a9d1de5e3c@redhat.com> Date: Sat, 1 Jul 2017 22:42:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <149876364614.17954.18085820933912290198@jljusten-skl.jf.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 01 Jul 2017 20:42:08 +0000 (UTC) Subject: Re: [PATCH 1/5] OvmfPkg: introduce Q35TsegSizeLib (class header and sole lib instance) X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jul 2017 20:40:34 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 06/29/17 21:14, Jordan Justen wrote: > On 2017-06-26 16:04:41, Laszlo Ersek wrote: >> On 06/27/17 00:36, Jordan Justen wrote: >>> >>> Why can't SmramInternal.c read the size from the PCD directly? >> >> If I remember correctly, I wanted to base SmramAccessGetCapabilities() >> directly on hardware configuration. At that point (regardless of whether >> the function would be called via PEI_SMM_ACCESS_PPI or >> EFI_SMM_ACCESS2_PROTOCOL), the ESMRAMC.TSEG_SZ bits used as source for >> the calculation would already be locked, by the SmmAccessPei entry point >> function. > > I guess it does look slightly more appropriate to read to reg, even if > the end result will always match the PCD. The 'internal' file is used > by PEI as well, so if you want to add a function or variable in the > 'internal' give the mask, it sounds good. I would like to introduce a global variable in SmramInternal.c, to be set by both the PEIM's and the DXE driver's entry point functions to the dynamic PCD value (i.e., at module startup). - This global variable would be consulted in SmramAccessGetCapabilities() (in SmramInternal.c, called from both the corresponding PPI and protocol member functions) if, and only if, the value read from ESMRAMC.TSEG_SZ were 11 binary. - If the bit pattern read from this bit-field register were different, then constant values would be used (exactly like now). - And the dynamic PCD would never be consulted in SmramAccessGetCapabilities(). OK? Thanks, Laszlo