Re: [edk2] [Patch] MdeModulePkg: Update PeiCore dispatcher to handle PEIM and PEI_CORE only

2016-02-25 Thread Gao, Liming
Star:
  To keep code consistent, I will update code to support 
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER also.

Thanks
Liming
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zeng, 
Star
Sent: Friday, February 26, 2016 1:32 PM
To: Gao, Liming <liming@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch] MdeModulePkg: Update PeiCore dispatcher to handle 
PEIM and PEI_CORE only

On 2016/2/6 9:07, Liming Gao wrote:
> When PcdShadowPeimOnBoot is FALSE, they are not copied to memory and
> execute from their original locations. Here, this policy should only
> apply for PEIM and PEI_CORE, not for other file type, such as DXE_CORE.

Do we need to include EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER here?

I see EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER is included in
MdeModulePkg/Core/Pei/FwVol/FwVol.c, EFI_FV_FILETYPE_COMBINED_SMM_DXE
and EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER are included in
MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c, although the combined
types are not supported in BaseTools as I know.


With EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER included,
Reviewed-by: Star Zeng


Thanks,
Star

>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao
> ---
> MdeModulePkg/Core/Pei/Image/Image.c | 13 ++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Pei/Image/Image.c 
> b/MdeModulePkg/Core/Pei/Image/Image.c
> index 9c54192..cc84ac5 100644
> --- a/MdeModulePkg/Core/Pei/Image/Image.c
> +++ b/MdeModulePkg/Core/Pei/Image/Image.c
> @@ -1,7 +1,7 @@
> /** @file
> Pei Core Load Image Support
>
> -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.

> +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.

> 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
> @@ -359,6 +359,7 @@ LoadAndRelocatePeCoffImage (
> EFI_STATUS ReturnStatus;
> BOOLEAN IsS3Boot;
> BOOLEAN IsRegisterForShadow;
> + EFI_FV_FILE_INFO FileInfo;
>
> Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
>
> @@ -396,9 +397,15 @@ LoadAndRelocatePeCoffImage (
> }
>
> //
> + // Get file type first
> + //
> + Status = PeiServicesFfsGetFileInfo (FileHandle, );
> + ASSERT_EFI_ERROR (Status);
> +
> + //
> // When Image has no reloc section, it can't be relocated into memory.
> //
> - if (ImageContext.RelocationsStripped && (Private->PeiMemoryInstalled) && (
> + if (ImageContext.RelocationsStripped && (Private->PeiMemoryInstalled) && 
> ((FileInfo.FileType != EFI_FV_FILETYPE_PEIM && FileInfo.FileType != 
> EFI_FV_FILETYPE_PEI_CORE) ||
> (!IsS3Boot && (PcdGetBool (PcdShadowPeimOnBoot) || IsRegisterForShadow)) || 
> (IsS3Boot && PcdGetBool (PcdShadowPeimOnS3Boot {
> DEBUG ((EFI_D_INFO|EFI_D_LOAD, "The image at 0x%08x without reloc section 
> can't be loaded into memory\n", (UINTN) Pe32Data));
> }
> @@ -413,7 +420,7 @@ LoadAndRelocatePeCoffImage (
> // On normal boot, PcdShadowPeimOnBoot decides whether load PEIM or PeiCore 
> into memory.
> // On S3 boot, PcdShadowPeimOnS3Boot decides whether load PEIM or PeiCore 
> into memory.
> //
> - if ((!ImageContext.RelocationsStripped) && (Private->PeiMemoryInstalled) && 
> (
> + if ((!ImageContext.RelocationsStripped) && (Private->PeiMemoryInstalled) && 
> ((FileInfo.FileType != EFI_FV_FILETYPE_PEIM && FileInfo.FileType != 
> EFI_FV_FILETYPE_PEI_CORE) ||
> (!IsS3Boot && (PcdGetBool (PcdShadowPeimOnBoot) || IsRegisterForShadow)) || 
> (IsS3Boot && PcdGetBool (PcdShadowPeimOnS3Boot {
> //
> // Allocate more buffer to avoid buffer overflow.
>

___
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] MdeModulePkg: Update PeiCore dispatcher to handle PEIM and PEI_CORE only

2016-02-17 Thread Cohen, Eugene
> When PcdShadowPeimOnBoot is FALSE, they are not copied to
> memory and
> execute from their original locations. Here, this policy should only
> apply for PEIM and PEI_CORE, not for other file type, such as
> DXE_CORE.

Tested-by: Eugene Cohen 

Sorry for the delay in testing this - thanks for the reminder Liming!

Eugene

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


[edk2] [Patch] MdeModulePkg: Update PeiCore dispatcher to handle PEIM and PEI_CORE only

2016-02-05 Thread Liming Gao
When PcdShadowPeimOnBoot is FALSE, they are not copied to memory and
execute from their original locations. Here, this policy should only
apply for PEIM and PEI_CORE, not for other file type, such as DXE_CORE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 MdeModulePkg/Core/Pei/Image/Image.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Image/Image.c 
b/MdeModulePkg/Core/Pei/Image/Image.c
index 9c54192..cc84ac5 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -1,7 +1,7 @@
 /** @file
   Pei Core Load Image Support
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
 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
@@ -359,6 +359,7 @@ LoadAndRelocatePeCoffImage (
   EFI_STATUSReturnStatus;
   BOOLEAN   IsS3Boot;
   BOOLEAN   IsRegisterForShadow;
+  EFI_FV_FILE_INFO  FileInfo;
 
   Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
 
@@ -396,9 +397,15 @@ LoadAndRelocatePeCoffImage (
   }
 
   //
+  // Get file type first
+  //
+  Status = PeiServicesFfsGetFileInfo (FileHandle, );
+  ASSERT_EFI_ERROR (Status);
+
+  //
   // When Image has no reloc section, it can't be relocated into memory.
   //
-  if (ImageContext.RelocationsStripped && (Private->PeiMemoryInstalled) && (
+  if (ImageContext.RelocationsStripped && (Private->PeiMemoryInstalled) && 
((FileInfo.FileType != EFI_FV_FILETYPE_PEIM && FileInfo.FileType != 
EFI_FV_FILETYPE_PEI_CORE) ||
   (!IsS3Boot && (PcdGetBool (PcdShadowPeimOnBoot) || IsRegisterForShadow)) 
|| (IsS3Boot && PcdGetBool (PcdShadowPeimOnS3Boot {
 DEBUG ((EFI_D_INFO|EFI_D_LOAD, "The image at 0x%08x without reloc section 
can't be loaded into memory\n", (UINTN) Pe32Data));
   }
@@ -413,7 +420,7 @@ LoadAndRelocatePeCoffImage (
   // On normal boot, PcdShadowPeimOnBoot decides whether load PEIM or PeiCore 
into memory.
   // On S3 boot, PcdShadowPeimOnS3Boot decides whether load PEIM or PeiCore 
into memory.
   //
-  if ((!ImageContext.RelocationsStripped) && (Private->PeiMemoryInstalled) && (
+  if ((!ImageContext.RelocationsStripped) && (Private->PeiMemoryInstalled) && 
((FileInfo.FileType != EFI_FV_FILETYPE_PEIM && FileInfo.FileType != 
EFI_FV_FILETYPE_PEI_CORE) ||
   (!IsS3Boot && (PcdGetBool (PcdShadowPeimOnBoot) || IsRegisterForShadow)) 
|| (IsS3Boot && PcdGetBool (PcdShadowPeimOnS3Boot {
 //
 // Allocate more buffer to avoid buffer overflow.
-- 
1.9.5.msysgit.0

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