From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: citrix.com, ip: , mailfrom: anthony.perard@citrix.com) Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com []) by groups.io with SMTP; Mon, 29 Jul 2019 08:57:51 -0700 Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: OC6mMAihpiEm/z+j/9INK1n1VEKj4W74Jcaqh/22VSU8VzgAaAfdeua/gSU/m9dGf+hD9W5bBM bfRudTxQXubG+kvoSr79HxZqLtG0QrdaLhiFWVWe30sg9qTAs3xMl/5SC59lxbZOwHch7w/n96 RexiAZDQ4ygq1okVTHMn8aisiS9UABWicwFCxOldgbfQ40bcFCdmA9BYc18JSTEPoRA5oNBiK5 Ji80P7qaXUk1apXSTxZWRlGVqjcShqV3Jwf+qrMNWb3zyJgI0/7IiBmFqazAfMAax5DOg434iG Bj0= X-SBRS: 2.7 X-MesageID: 3579626 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,323,1559534400"; d="scan'208";a="3579626" From: "Anthony PERARD" To: CC: Julien Grall , , Jordan Justen , Ard Biesheuvel , Laszlo Ersek , Anthony PERARD , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Andrew Cooper Subject: [PATCH v4 23/35] OvmfPkg/XenPlatformPei: Rework memory detection Date: Mon, 29 Jul 2019 16:39:32 +0100 Message-ID: <20190729153944.24239-24-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729153944.24239-1-anthony.perard@citrix.com> References: <20190729153944.24239-1-anthony.perard@citrix.com> MIME-Version: 1.0 Return-Path: anthony.perard@citrix.com Content-Transfer-Encoding: base64 Content-Type: text/plain V2hlbiBydW5uaW5nIGFzIGEgWGVuIFBWSCBndWVzdCwgdGhlcmUgaXMgbm8gQ01PUyB0byByZWFk IHRoZSBtZW1vcnkKc2l6ZSBmcm9tLiAgUmV3b3JrIEdldFN5c3RlbU1lbW9yeVNpemUoQmVsb3d8 QWJvdmUpNGdiKCkgc28gdGhleSBjYW4Kd29yayB3aXRob3V0IENNT1MgYnkgcmVhZGluZyB0aGUg ZTgyMCB0YWJsZS4KClJld29yayBYZW5QdWJsaXNoUmFtUmVnaW9ucyB0byBhbHNvIGNhcmUgZm9y IHRoZSByZXNlcnZlZCBhbmQgQUNQSQplbnRyeSBpbiB0aGUgZTgyMCB0YWJsZS4gVGhlIHJlZ2lv biB0aGF0IHdhcyBhZGRlZCBieSBJbml0a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