From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.18809.1589564466278158632 for ; Fri, 15 May 2020 10:41:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cqq2NOFc; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589564465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m52FEYKLb4N9gxbXBgeSOzCuGoZ6FiNUYx6tDVkRRUI=; b=Cqq2NOFcP88r80IFCcEVzCD2RraD6LtPiTgexN/Tev4xolps+X4JJrHFfRPxWbYClLeppS zCGXrvbhSSKTCBED4JoU4/RsCxjII1oZ5NeUQqbIIC2JS6TF60krHYGWy1eZ9JIfE069Qu NzCQhb08mnWndIiogUYOwNVtwwz1e8o= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-xlUISJEYMSKOKrnJaxFa9Q-1; Fri, 15 May 2020 13:40:59 -0400 X-MC-Unique: xlUISJEYMSKOKrnJaxFa9Q-1 Received: by mail-wr1-f72.google.com with SMTP id z16so1502366wrq.21 for ; Fri, 15 May 2020 10:40:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=m52FEYKLb4N9gxbXBgeSOzCuGoZ6FiNUYx6tDVkRRUI=; b=PvNXLCWe+/I3ylya532wXH1ZXuRR6kWJpNc75BlgWaftVm8B2x4QOGBYXT/MQGLolV gzlzg0mprE29rsdtBdeI0Sddz/VJYgkuGdy06I8FwoJw6+iwa18IzNx3S3pMUVq6Lbbt hlHbYJ6yKjd1upl7Fmc7OvRcS6mqyg+IrWk5hh47Iitfl0eefUnx6r8Sq5vfJF5uf8MA SicL8swyQ5CM2AwjbSIzF/wNDectIGwsWc04WBLxN5UcCPzzFfQfrahQXG0K0BKT0Hmb /APYWKooTTeFq4tv7dMU+ZB+pWcosuuvG/BYTz57MDmYPYm2n+cw+LUlAMuHfNOW1UhU eLtQ== X-Gm-Message-State: AOAM533awHdcQt/bvYUADPQGOrQmGeoO2m4/Qhdg/ewD1pqDsvm3cNMn APCWWoTmY8ezcJV2LJPwyUUqwEi5S0I2EVnvkrH84ANixsUNOJJc92F0erY8tA9WReqy2Y2Txcy U3P3b38TYFgJMxA== X-Received: by 2002:adf:93e3:: with SMTP id 90mr5718659wrp.180.1589564458511; Fri, 15 May 2020 10:40:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKNKJB+ucsBDxxIhozzpLFqP6ikGMiOLmiELcVnWLPZCuREOcDAmkaV8XEehNiehKN5fctXQ== X-Received: by 2002:adf:93e3:: with SMTP id 90mr5718631wrp.180.1589564458232; Fri, 15 May 2020 10:40:58 -0700 (PDT) Return-Path: Received: from [192.168.1.39] (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id w10sm4934327wrg.52.2020.05.15.10.40.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 May 2020 10:40:57 -0700 (PDT) Subject: Re: [PATCH 3/4] OvmfPkg/PlatformPei: extract memory type info defaults to PCDs To: Laszlo Ersek , edk2-devel-groups-io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen References: <20200508121651.16045-1-lersek@redhat.com> <20200508121651.16045-4-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Fri, 15 May 2020 19:40:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200508121651.16045-4-lersek@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 5/8/20 2:16 PM, Laszlo Ersek wrote: > Some OvmfPkg modules already depend on "EmbeddedPkg.dec"; thus, replace > the open-coded memory type info defaults in the source code with the > EmbeddedPkg PCDs that stand for the same purpose. Consequently, platform > builders can override these values with the "--pcd" option of "build", > without source code updates. > > While at it, sort the memory type names alphabetically. > > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Philippe Mathieu-Daudé > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2706 > Signed-off-by: Laszlo Ersek > --- > OvmfPkg/OvmfPkgIa32.dsc | 12 +++++++++++ > OvmfPkg/OvmfPkgIa32X64.dsc | 13 ++++++++++++ > OvmfPkg/OvmfPkgX64.dsc | 12 +++++++++++ > OvmfPkg/PlatformPei/PlatformPei.inf | 6 ++++++ > OvmfPkg/PlatformPei/MemTypeInfo.c | 21 +++++++++----------- > 5 files changed, 52 insertions(+), 12 deletions(-) > > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc > index 7c8b51f43b66..a1981f8085a6 100644 > --- a/OvmfPkg/OvmfPkgIa32.dsc > +++ b/OvmfPkg/OvmfPkgIa32.dsc > @@ -532,6 +532,18 @@ [PcdsFixedAtBuild] > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 > !endif > > + # > + # The NumberOfPages values below are ad-hoc. They are updated sporadically at > + # best (please refer to git-blame for past updates). The values capture a set > + # of BIN hints that made sense at a particular time, for some (now likely > + # unknown) workloads / boot paths. > + # > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24 > + > # > # Network Pcds > # > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc > index a0596c44168c..c1950e6aa915 100644 > --- a/OvmfPkg/OvmfPkgIa32X64.dsc > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc > @@ -536,6 +536,19 @@ [PcdsFixedAtBuild] > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 > !endif > > +[PcdsFixedAtBuild.IA32] > + # > + # The NumberOfPages values below are ad-hoc. They are updated sporadically at > + # best (please refer to git-blame for past updates). The values capture a set > + # of BIN hints that made sense at a particular time, for some (now likely > + # unknown) workloads / boot paths. > + # > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24 > + > [PcdsFixedAtBuild.X64] > # > # Network Pcds > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc > index 2e764b6b7233..bc7e15f749ca 100644 > --- a/OvmfPkg/OvmfPkgX64.dsc > +++ b/OvmfPkg/OvmfPkgX64.dsc > @@ -536,6 +536,18 @@ [PcdsFixedAtBuild] > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 > !endif > > + # > + # The NumberOfPages values below are ad-hoc. They are updated sporadically at > + # best (please refer to git-blame for past updates). The values capture a set > + # of BIN hints that made sense at a particular time, for some (now likely > + # unknown) workloads / boot paths. > + # > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30 > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24 > + > # > # Network Pcds > # > diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf > index e72ef7963d97..ff397b3ee9d7 100644 > --- a/OvmfPkg/PlatformPei/PlatformPei.inf > +++ b/OvmfPkg/PlatformPei/PlatformPei.inf > @@ -37,6 +37,7 @@ [Sources] > Xen.h > > [Packages] > + EmbeddedPkg/EmbeddedPkg.dec > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > SecurityPkg/SecurityPkg.dec > @@ -105,6 +106,11 @@ [Pcd] > > [FixedPcd] > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode > + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData > > [FeaturePcd] > gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable > diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/MemTypeInfo.c > index d287fb9d7df0..f3ce2b6865e1 100644 > --- a/OvmfPkg/PlatformPei/MemTypeInfo.c > +++ b/OvmfPkg/PlatformPei/MemTypeInfo.c > @@ -17,19 +17,16 @@ > > #include "Platform.h" > > -// > -// The NumberOfPages values below are ad-hoc. They are updated sporadically at > -// best (please refer to git-blame for past updates). The values capture a set > -// of BIN hints that made sense at a particular time, for some (now likely > -// unknown) workloads / boot paths. > -// > +#define MEMORY_TYPE_INFO_DEFAULT(Type) \ > + { Type, FixedPcdGet32 (PcdMemoryType ## Type) } > + > STATIC EFI_MEMORY_TYPE_INFORMATION mMemoryTypeInformation[] = { > - { EfiACPIMemoryNVS, 0x004 }, > - { EfiACPIReclaimMemory, 0x008 }, > - { EfiReservedMemoryType, 0x004 }, > - { EfiRuntimeServicesData, 0x024 }, > - { EfiRuntimeServicesCode, 0x030 }, > - { EfiMaxMemoryType, 0x000 } > + MEMORY_TYPE_INFO_DEFAULT (EfiACPIMemoryNVS), > + MEMORY_TYPE_INFO_DEFAULT (EfiACPIReclaimMemory), > + MEMORY_TYPE_INFO_DEFAULT (EfiReservedMemoryType), > + MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesCode), > + MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesData), > + { EfiMaxMemoryType, 0 } > }; > > STATIC > Reviewed-by: Philippe Mathieu-Daude