[edk2] [PATCH] IntelSiliconPkg VTdPmrPei: Add PcdVTdPeiDmaBufferSize(S3)

Star Zeng posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
.../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c        |  7 ++-----
.../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf      |  4 +++-
IntelSiliconPkg/IntelSiliconPkg.dec                    | 18 +++++++++++++++++-
3 files changed, 22 insertions(+), 7 deletions(-)
[edk2] [PATCH] IntelSiliconPkg VTdPmrPei: Add PcdVTdPeiDmaBufferSize(S3)
Posted by Star Zeng 6 years, 9 months ago
Add PcdVTdPeiDmaBufferSize(S3) to replace the hard coded value
TOTAL_DMA_BUFFER_SIZE and TOTAL_DMA_BUFFER_SIZE_S3 in IntelVTdPmrPei.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c        |  7 ++-----
 .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf      |  4 +++-
 IntelSiliconPkg/IntelSiliconPkg.dec                    | 18 +++++++++++++++++-
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
index 6289834fcb38..9a0138b3b086 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
@@ -29,9 +29,6 @@
 
 #include "IntelVTdPmrPei.h"
 
-#define  TOTAL_DMA_BUFFER_SIZE    SIZE_4MB
-#define  TOTAL_DMA_BUFFER_SIZE_S3 SIZE_2MB
-
 EFI_GUID mVTdInfoGuid = {
   0x222f5e30, 0x5cd, 0x49c6, { 0x8a, 0xc, 0x36, 0xd6, 0x58, 0x41, 0xe0, 0x82 }
 };
@@ -798,9 +795,9 @@ IntelVTdPmrInitialize (
   PeiServicesGetBootMode (&BootMode);
 
   if (BootMode == BOOT_ON_S3_RESUME) {
-    DmaBufferInfo->DmaBufferSize = TOTAL_DMA_BUFFER_SIZE_S3;
+    DmaBufferInfo->DmaBufferSize = PcdGet32 (PcdVTdPeiDmaBufferSizeS3);
   } else {
-    DmaBufferInfo->DmaBufferSize = TOTAL_DMA_BUFFER_SIZE;
+    DmaBufferInfo->DmaBufferSize = PcdGet32 (PcdVTdPeiDmaBufferSize);
   }
 
   Status = PeiServicesNotifyPpi (&mVTdInfoNotifyDesc);
diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
index e6d0323acc50..5b688d5cbf9f 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
@@ -4,7 +4,7 @@
 # This driver initializes VTd engine based upon EDKII_VTD_INFO_PPI
 # and provide DMA protection in PEI.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -54,6 +54,8 @@ [Ppis]
 
 [Pcd]
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask   ## CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize     ## CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3   ## CONSUMES
 
 [Depex]
   gEfiPeiMasterBootModePpiGuid AND
diff --git a/IntelSiliconPkg/IntelSiliconPkg.dec b/IntelSiliconPkg/IntelSiliconPkg.dec
index a15d3dee392c..c0cf58fa6cb5 100644
--- a/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -3,7 +3,7 @@
 #
 # This package provides common open source Intel silicon modules.
 #
-# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials are licensed and made available under
 # the terms and conditions of the BSD License that accompanies this distribution.
 # The full text of the license may be found at
@@ -61,3 +61,19 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   # @Prompt The policy for VTd driver behavior.
   gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1|UINT8|0x00000002
 
+  ## Declares VTd PEI DMA buffer size.<BR><BR>
+  #  When this PCD value is referred by platform to calculate the required
+  #  memory size for PEI (InstallPeiMemory), the PMR alignment requirement
+  #  needs be considered to be added with this PCD value for alignment
+  #  adjustment need by AllocateAlignedPages.
+  # @Prompt The VTd PEI DMA buffer size.
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize|0x00400000|UINT32|0x00000003
+
+  ## Declares VTd PEI DMA buffer size for S3.<BR><BR>
+  #  When this PCD value is referred by platform to calculate the required
+  #  memory size for PEI S3 (InstallPeiMemory), the PMR alignment requirement
+  #  needs be considered to be added with this PCD value for alignment
+  #  adjustment need by AllocateAlignedPages.
+  # @Prompt The VTd PEI DMA buffer size for S3.
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000|UINT32|0x00000004
+
-- 
2.13.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] IntelSiliconPkg VTdPmrPei: Add PcdVTdPeiDmaBufferSize(S3)
Posted by Yao, Jiewen 6 years, 9 months ago
Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, March 5, 2018 10:17 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] IntelSiliconPkg VTdPmrPei: Add PcdVTdPeiDmaBufferSize(S3)
> 
> Add PcdVTdPeiDmaBufferSize(S3) to replace the hard coded value
> TOTAL_DMA_BUFFER_SIZE and TOTAL_DMA_BUFFER_SIZE_S3 in
> IntelVTdPmrPei.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c        |  7 ++-----
>  .../Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf      |  4 +++-
>  IntelSiliconPkg/IntelSiliconPkg.dec                    | 18
> +++++++++++++++++-
>  3 files changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
> b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
> index 6289834fcb38..9a0138b3b086 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
> @@ -29,9 +29,6 @@
> 
>  #include "IntelVTdPmrPei.h"
> 
> -#define  TOTAL_DMA_BUFFER_SIZE    SIZE_4MB
> -#define  TOTAL_DMA_BUFFER_SIZE_S3 SIZE_2MB
> -
>  EFI_GUID mVTdInfoGuid = {
>    0x222f5e30, 0x5cd, 0x49c6, { 0x8a, 0xc, 0x36, 0xd6, 0x58, 0x41, 0xe0,
> 0x82 }
>  };
> @@ -798,9 +795,9 @@ IntelVTdPmrInitialize (
>    PeiServicesGetBootMode (&BootMode);
> 
>    if (BootMode == BOOT_ON_S3_RESUME) {
> -    DmaBufferInfo->DmaBufferSize = TOTAL_DMA_BUFFER_SIZE_S3;
> +    DmaBufferInfo->DmaBufferSize = PcdGet32
> (PcdVTdPeiDmaBufferSizeS3);
>    } else {
> -    DmaBufferInfo->DmaBufferSize = TOTAL_DMA_BUFFER_SIZE;
> +    DmaBufferInfo->DmaBufferSize = PcdGet32 (PcdVTdPeiDmaBufferSize);
>    }
> 
>    Status = PeiServicesNotifyPpi (&mVTdInfoNotifyDesc);
> diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
> b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
> index e6d0323acc50..5b688d5cbf9f 100644
> --- a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
> +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
> @@ -4,7 +4,7 @@
>  # This driver initializes VTd engine based upon EDKII_VTD_INFO_PPI
>  # and provide DMA protection in PEI.
>  #
> -# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and conditions of the BSD
> License
>  # which accompanies this distribution.  The full text of the license may be
> found at
> @@ -54,6 +54,8 @@ [Ppis]
> 
>  [Pcd]
>    gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask   ##
> CONSUMES
> +  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize     ##
> CONSUMES
> +  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3   ##
> CONSUMES
> 
>  [Depex]
>    gEfiPeiMasterBootModePpiGuid AND
> diff --git a/IntelSiliconPkg/IntelSiliconPkg.dec
> b/IntelSiliconPkg/IntelSiliconPkg.dec
> index a15d3dee392c..c0cf58fa6cb5 100644
> --- a/IntelSiliconPkg/IntelSiliconPkg.dec
> +++ b/IntelSiliconPkg/IntelSiliconPkg.dec
> @@ -3,7 +3,7 @@
>  #
>  # This package provides common open source Intel silicon modules.
>  #
> -# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
>  # This program and the accompanying materials are licensed and made
> available under
>  # the terms and conditions of the BSD License that accompanies this
> distribution.
>  # The full text of the license may be found at
> @@ -61,3 +61,19 @@ [PcdsFixedAtBuild, PcdsPatchableInModule,
> PcdsDynamic, PcdsDynamicEx]
>    # @Prompt The policy for VTd driver behavior.
> 
> gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask|1|UINT8|0x00000
> 002
> 
> +  ## Declares VTd PEI DMA buffer size.<BR><BR>
> +  #  When this PCD value is referred by platform to calculate the required
> +  #  memory size for PEI (InstallPeiMemory), the PMR alignment requirement
> +  #  needs be considered to be added with this PCD value for alignment
> +  #  adjustment need by AllocateAlignedPages.
> +  # @Prompt The VTd PEI DMA buffer size.
> +
> gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize|0x00400000|UINT3
> 2|0x00000003
> +
> +  ## Declares VTd PEI DMA buffer size for S3.<BR><BR>
> +  #  When this PCD value is referred by platform to calculate the required
> +  #  memory size for PEI S3 (InstallPeiMemory), the PMR alignment
> requirement
> +  #  needs be considered to be added with this PCD value for alignment
> +  #  adjustment need by AllocateAlignedPages.
> +  # @Prompt The VTd PEI DMA buffer size for S3.
> +
> gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000|UINT
> 32|0x00000004
> +
> --
> 2.13.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel