I fork a new code base and push IntelFsp2Pkg and IntelFsp2WrapperPkg to 
[email protected]:jyao1/edk2.git for review.

The old IntelFspPkg and IntelFspWrapperPkg are kept.

Thank you
Yao Jiewen

> -----Original Message-----
> From: Yao, Jiewen
> Sent: Wednesday, May 11, 2016 11:14 AM
> To: 'Tim Lewis' <[email protected]>; Kinney, Michael D
> <[email protected]>; Mudusuru, Giri P
> <[email protected]>; [email protected]
> Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> <[email protected]>; Rangarajan, Ravi P
> <[email protected]>
> Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> FspInitPei to FspmWrapperPeim and FspsWrapperPeim.
> 
> Good. I will send out IntelFsp2Pkg update soon.
> 
> > -----Original Message-----
> > From: Tim Lewis [mailto:[email protected]]
> > Sent: Wednesday, May 11, 2016 8:07 AM
> > To: Yao, Jiewen <[email protected]>; Kinney, Michael D
> > <[email protected]>; Mudusuru, Giri P
> > <[email protected]>; [email protected]
> > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > <[email protected]>; Rangarajan, Ravi P
> > <[email protected]>
> > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > FspInitPei to FspmWrapperPeim and FspsWrapperPeim.
> >
> > Yes.
> >
> > Tim
> >
> > -----Original Message-----
> > From: Yao, Jiewen [mailto:[email protected]]
> > Sent: Monday, May 09, 2016 6:42 PM
> > To: Kinney, Michael D <[email protected]>; Tim Lewis
> > <[email protected]>; Mudusuru, Giri P <[email protected]>;
> > [email protected]
> > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > <[email protected]>; Rangarajan, Ravi P
> > <[email protected]>
> > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > FspInitPei to FspmWrapperPeim and FspsWrapperPeim.
> >
> > Good discussion on PACKAGES_PATH usage.
> >
> > For this specific case (FSP2 without FSP1.1 support), do we need change to
> > IntelFsp2Pkg?
> >
> > Thank you
> > Yao Jiewen
> >
> > > -----Original Message-----
> > > From: Kinney, Michael D
> > > Sent: Friday, May 6, 2016 10:07 AM
> > > To: Tim Lewis <[email protected]>; Mudusuru, Giri P
> > > <[email protected]>; Yao, Jiewen <[email protected]>;
> > > [email protected]; Kinney, Michael D
> <[email protected]>
> > > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > > <[email protected]>; Rangarajan, Ravi P
> > > <[email protected]>
> > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to FspmWrapperPeim and FspsWrapperPeim.
> > >
> > > Tim,
> > >
> > > I agree multiple repos in a WORKSPACE can potentially be confusing.
> > > Especially if the
> > > same package dir exists in more than of the repos.  To alleviate this
> issue,
> > a
> > > repo can
> > > be pruned and the .gitignore feature can be used for git to ignore the
> > > packages that
> > > have been pruned.
> > >
> > > The reason I am asking these questions is not related to FSP.
> > >
> > > There have been prior discussions on edk2-devel to organize the
> packages
> > in
> > > edk2
> > > into subdirectories, and I am working on a proposal for that.  However,
> > > moving
> > > packages into subdirectories would require the use of the
> PACKAGES_PATH
> > > feature.
> > >
> > > Is PACKAGES_PATH something you could add support for in your tools?
> > >
> > > Thanks,
> > >
> > > Mike
> > >
> > > > -----Original Message-----
> > > > From: Tim Lewis [mailto:[email protected]]
> > > > Sent: Thursday, May 5, 2016 6:53 PM
> > > > To: Kinney, Michael D <[email protected]>; Mudusuru, Giri P
> > > > <[email protected]>; Yao, Jiewen <[email protected]>;
> > edk2-
> > > > [email protected]
> > > > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > > > <[email protected]>; Rangarajan, Ravi P
> > > <[email protected]>
> > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > FspmWrapperPeim and FspsWrapperPeim.
> > > >
> > > > Mike --
> > > >
> > > > At this time, no. Our internal tools do not recognize it, and would fail
> > > during tree
> > > > analysis.
> > > >
> > > > Likewise, our policy does not allow it because we find our customers
> are
> > > confused by
> > > > multiple roots. It makes it hard for the engineers looking at a
> > downstream
> > > file to
> > > > predict where the final file resides. That leads to bad bug reports, 
> > > > etc.
> > > >
> > > > Tim
> > > >
> > > > -----Original Message-----
> > > > From: Kinney, Michael D [mailto:[email protected]]
> > > > Sent: Thursday, May 05, 2016 6:14 PM
> > > > To: Tim Lewis <[email protected]>; Mudusuru, Giri P
> > > <[email protected]>;
> > > > Yao, Jiewen <[email protected]>; [email protected]; Kinney,
> > > Michael D
> > > > <[email protected]>
> > > > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > > > <[email protected]>; Rangarajan, Ravi P
> > > <[email protected]>
> > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > FspmWrapperPeim and FspsWrapperPeim.
> > > >
> > > > Hi Tim,
> > > >
> > > > I wanted to follow up on the general concern on the use of the
> > > PACKAGES_PATH feature.
> > > >
> > > > The EDK II BaseTools still use a single WORKSPACE and can use
> > > PACKAGES_PATH for
> > > > additional search paths for packages.  PACKAGES_PATH can point to
> > > directories
> > > > Below WORKSPACE or outside WORKSPACE, so it is very flexible.
> > > >
> > > >
> > >
> >
> https://github.com/tianocore/tianocore.github.io/wiki/Multiple_Workspace
> > > >
> > > > For your specific use case, could you use PACKAGES_PATH if all the
> paths
> > > listed
> > > > in PACKAGES_PATH are below WORKSPACE?
> > > >
> > > > For example, if you have the following dir structure:
> > > >
> > > >         tianocore/
> > > >                 edk2/
> > > >                 Udk2015/
> > > >
> > > > You can set WORKSPACE to tianocore/ and PACKAGES_PATH to
> > > > tianocore/edk2;tianocore/Udk2015.
> > > >
> > > > This means an additional directory level is added, so all the packages
> are
> > > not in the
> > > > root of WORKSPACE.  This is how we can support pulling content from
> > > multiple git
> > > > repos/tags/branches for a single WSORKSPACE build environment
> > without
> > > having to update
> > > > the [Packages] section in every INF.
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: edk2-devel [mailto:[email protected]] On
> Behalf
> > > Of Tim Lewis
> > > > > Sent: Thursday, May 5, 2016 12:09 PM
> > > > > To: Mudusuru, Giri P <[email protected]>; Yao, Jiewen
> > > <[email protected]>;
> > > > > [email protected]
> > > > > Cc: Mudusuru, Giri P <[email protected]>; Zimmer, Vincent
> > > > > <[email protected]>; Rangarajan, Ravi P
> > > <[email protected]>
> > > > > Subject: Re: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > That works well, thank you
> > > > >
> > > > > Tim
> > > > >
> > > > > Sent from my Windows 10 phone
> > > > >
> > > > > From: Mudusuru, Giri P<mailto:[email protected]>
> > > > > Sent: Thursday, May 5, 2016 12:07 PM
> > > > > To: Tim Lewis<mailto:[email protected]>; Yao,
> > > Jiewen<mailto:[email protected]>;
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P<mailto:[email protected]>;
> > Yarlagadda,
> > > Satya
> > > > > P<mailto:[email protected]>; Zimmer,
> > > > > Vincent<mailto:[email protected]>; Mudusuru, Giri
> > > > > P<mailto:[email protected]>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Hi Tim,
> > > > > Here is summary of the plan and next steps after discussing internally
> > > with Vincent
> > > > and
> > > > > others...
> > > > >
> > > > >
> > > > > 1)      IntelFspPkg & IntelFspWrapperPkg will continue to support
> > FSP
> > > v1.x support.
> > > > > These packages are in maintenance mode i.e., only critical bug fix or
> > > changes
> > > > >
> > > > > 2)      Create new packages IntelFsp2Pkg and
> IntelFsp2WrapperPkg
> > to
> > > support FSP v2.0
> > > > > support
> > > > >
> > > > > Please let me know if this meets your need.
> > > > >
> > > > > Thanks,
> > > > > -Giri
> > > > >
> > > > > From: Tim Lewis [mailto:[email protected]]
> > > > > Sent: Wednesday, May 4, 2016 6:40 AM
> > > > > To: Mudusuru, Giri P <[email protected]>; Yao, Jiewen
> > > <[email protected]>;
> > > > > [email protected]
> > > > > Cc: Rangarajan, Ravi P <[email protected]>; Yarlagadda,
> > Satya
> > > P
> > > > > <[email protected]>; Zimmer, Vincent
> > > <[email protected]>; Mudusuru,
> > > > > Giri P <[email protected]>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Thank you.
> > > > >
> > > > > Tim
> > > > >
> > > > > Sent from my Windows 10 phone
> > > > >
> > > > > From: Mudusuru, Giri P<mailto:[email protected]>
> > > > > Sent: Tuesday, May 3, 2016 11:06 PM
> > > > > To: Tim Lewis<mailto:[email protected]>; Yao,
> > > Jiewen<mailto:[email protected]>;
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P<mailto:[email protected]>;
> > Yarlagadda,
> > > Satya
> > > > > P<mailto:[email protected]>; Zimmer,
> > > > > Vincent<mailto:[email protected]>; Mudusuru, Giri
> > > > > P<mailto:[email protected]>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Thanks for info on the policy and usage. Let me follow up internally
> and
> > > get back to
> > > > > you.
> > > > >
> > > > > Thanks,
> > > > > -Giri
> > > > > From: Tim Lewis [mailto:[email protected]]
> > > > > Sent: Tuesday, May 3, 2016 4:24 PM
> > > > > To: Mudusuru, Giri P
> > > <[email protected]<mailto:[email protected]>>;
> > > > > Yao, Jiewen
> <[email protected]<mailto:[email protected]>>;
> > > edk2-
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P
> > > > >
> <[email protected]<mailto:[email protected]>>;
> > > Yarlagadda, Satya
> > > > P
> > > > >
> > <[email protected]<mailto:[email protected]>>;
> > > Zimmer, Vincent
> > > > > <[email protected]<mailto:[email protected]>>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > >
> > > > > 1.      Because we, per our custom tools and per our company
> > policy,
> > > require that all
> > > > > source code exist underneath $(WORKSPACE).  As previously
> discussed
> > > on this list, we
> > > > > think multiple workspaces makes our projects harder to maintain and
> > > harder to scan.
> > > > > Multiple workspaces was meant to be an OPTIONAL feature and,
> while
> > > some may use it,
> > > > > making it a requirement that all codebases follow this path to support
> > > what is today
> > > > > already supported seems a bit steep.
> > > > >
> > > > > 2.      There is NO PRODUCTION silicon that uses FSP 2.0 at this
> time
> > > that I am aware
> > > > > of. That means Intel is upgrading the Wrapper package to support
> > silicon
> > > that is not
> > > > > yet shipping and removing support for the (by my count) 5 publicly
> > > announced
> > > > chipsets,
> > > > > and probably a few others that are in alpha or beta.
> > > > >
> > > > > 3.      Many of these chipsets have a long life, which means new
> > > projects start on
> > > > them
> > > > > well after initial product launch. Because of features and security
> > > concerns, we
> > > > > continually upgrade our chipsets to use newer kernel code. This puts
> an
> > > extra
> > > > variable.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Tim Lewis
> > > > > CTO, Insyde Software
> > > > > www.insyde.com<http://www.insyde.com>
> > > > >
> > > > > From: Mudusuru, Giri P [mailto:[email protected]]
> > > > > Sent: Tuesday, May 03, 2016 4:07 PM
> > > > > To: Tim Lewis
> > <[email protected]<mailto:[email protected]>>;
> > > Yao, Jiewen
> > > > > <[email protected]<mailto:[email protected]>>; edk2-
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P
> > > > >
> <[email protected]<mailto:[email protected]>>;
> > > Yarlagadda, Satya
> > > > P
> > > > >
> > <[email protected]<mailto:[email protected]>>;
> > > Zimmer, Vincent
> > > > > <[email protected]<mailto:[email protected]>>;
> > > Mudusuru, Giri P
> > > > > <[email protected]<mailto:[email protected]>>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Hi Tim,
> > > > > Yes we considered creating a separate package name along with
> > moving
> > > the package
> > > > under
> > > > > Deprecated folder and just leave it in the UDK2015 branch.
> > > > >
> > > > > There are pro's and con's for all options.
> > > > >
> > > > > Can you please help me understand on why multi-workspace is not an
> > > option?
> > > > >
> > > > > Thanks,
> > > > > -Giri
> > > > >
> > > > > From: Tim Lewis [mailto:[email protected]]
> > > > > Sent: Tuesday, May 03, 2016 8:47 AM
> > > > > To: Mudusuru, Giri P
> > > <[email protected]<mailto:[email protected]>>;
> > > > > Yao, Jiewen
> <[email protected]<mailto:[email protected]>>;
> > > edk2-
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P
> > > > >
> <[email protected]<mailto:[email protected]>>;
> > > Yarlagadda, Satya
> > > > P
> > > > >
> > <[email protected]<mailto:[email protected]>>;
> > > Zimmer, Vincent
> > > > > <[email protected]<mailto:[email protected]>>;
> > > Mudusuru, Giri P
> > > > > <[email protected]<mailto:[email protected]>>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > >
> > > > > Giri ,
> > > > >
> > > > > I suggest you create a new package name, rather than use the same
> > one
> > > with different
> > > > > semantics.
> > > > >
> > > > >
> > > > >
> > > > > Multiple workspaces is not ah option for us.
> > > > >
> > > > >
> > > > >
> > > > > Tim
> > > > >
> > > > >
> > > > >
> > > > > Sent from my Windows 10 phone
> > > > >
> > > > >
> > > > >
> > > > > From: Mudusuru, Giri P<mailto:[email protected]>
> > > > > Sent: Tuesday, May 3, 2016 8:07 AM
> > > > > To: Tim Lewis<mailto:[email protected]>; Yao,
> > > Jiewen<mailto:[email protected]>;
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Rangarajan, Ravi P<mailto:[email protected]>;
> > Yarlagadda,
> > > Satya
> > > > > P<mailto:[email protected]>; Zimmer,
> > > > > Vincent<mailto:[email protected]>; Mudusuru, Giri
> > > > > P<mailto:[email protected]>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > >
> > > > > Hi Tim,
> > > > > The main reason to deprecate the v1.x support was to reduce the
> > > complexity and focus
> > > > on
> > > > > v2.0 going forward. At the same time as Jiewen mentioned below our
> > > plan is to
> > > > continue
> > > > > maintaining v1.1 in the UDK2015 branch for the existing chipsets.
> > > > >
> > > > > Understand your usage with single tree. For this usage, suggest to use
> > > the multi-
> > > > > workspace capability so you can have both in a single tree.
> > > > >
> > > > > Thanks,
> > > > > -Giri
> > > > >
> > > > > -----Original Message-----
> > > > > From: Tim Lewis [mailto:[email protected]]
> > > > > Sent: Tuesday, May 3, 2016 4:48 AM
> > > > > To: Yao, Jiewen
> > <[email protected]<mailto:[email protected]>>;
> > > edk2-
> > > > > [email protected]<mailto:[email protected]>
> > > > > Cc: Mudusuru, Giri P
> > > <[email protected]<mailto:[email protected]>>;
> > > > > Rangarajan, Ravi P
> > > <[email protected]<mailto:[email protected]>>
> > > > > Subject: RE: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Is this really a good idea, dropping 1.1 support? We don't maintain
> two
> > > separate
> > > > trees
> > > > > for our products, just 1. There are several chipsets which have long
> life
> > > that will
> > > > > need additional features, but are only 1.1
> > > > >
> > > > > Tim
> > > > >
> > > > > -----Original Message-----
> > > > > From: edk2-devel [mailto:[email protected]] On
> Behalf
> > > Of Jiewen Yao
> > > > > Sent: Monday, May 02, 2016 9:51 PM
> > > > > To: [email protected]<mailto:[email protected]>
> > > > > Cc: Giri P Mudusuru
> > > <[email protected]<mailto:[email protected]>>;
> > > > Ravi
> > > > > P Rangarajan
> > > <[email protected]<mailto:[email protected]>>
> > > > > Subject: [edk2] [PATCH 17/19] IntelFspWrapperPkg/FspInit: Split
> > > FspInitPei to
> > > > > FspmWrapperPeim and FspsWrapperPeim.
> > > > >
> > > > > Update FSP to follow:
> > > > >
> > >
> >
> https://firmware.intel.com/sites/default/files/FSP_EAS_v2.0_Draft%20Exter
> > > nal.pdf
> > > > >
> > > > > Align to FSP2.0.
> > > > > Remove 1.1 support from FspInit.
> > > > > Split it into FspmWrapperPeim and FspsWrapperPeim, so they can
> build
> > in
> > > > > different FV.
> > > > >
> > > > > The FSP1.1 compatibility is NOT maintained.
> > > > >
> > > > > The new Intel platform will follow FSP2.0.
> > > > > The old platform can either use an old EDK branch,
> > > > > or move FSP1.1 support to platform directory.
> > > > >
> > > > > Cc: Giri P Mudusuru
> > > <[email protected]<mailto:[email protected]>>
> > > > > Cc: Maurice Ma
> > > <[email protected]<mailto:[email protected]>>
> > > > > Cc: Ravi P Rangarajan
> > > > <[email protected]<mailto:[email protected]>>
> > > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > > Signed-off-by: Jiewen Yao
> > > <[email protected]<mailto:[email protected]>>
> > > > > Reviewed-by: Giri P Mudusuru
> > > > > <[email protected]<mailto:[email protected]>>
> > > > > Reviewed-by: Maurice Ma
> > > <[email protected]<mailto:[email protected]>>
> > > > > Reviewed-by: Ravi P Rangarajan
> > > > > <[email protected]<mailto:[email protected]>>
> > > > > ---
> > > > >  IntelFspWrapperPkg/FspInitPei/FindPeiCore.c            | 199
> > > ------------
> > > > >  IntelFspWrapperPkg/FspInitPei/FspInitPei.c             |  66
> ----
> > > > >  IntelFspWrapperPkg/FspInitPei/FspInitPei.h             |  64
> ----
> > > > >  IntelFspWrapperPkg/FspInitPei/FspInitPei.inf           |  90
> ------
> > > > >  IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c           | 182
> > > -----------
> > > > >  IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c           | 338
> > > --------------------
> > > > >  IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c            |  80
> > -----
> > > > >  IntelFspWrapperPkg/FspInitPei/SecMain.c                | 310
> > > ------------------
> > > > >  IntelFspWrapperPkg/FspInitPei/SecMain.h                | 116
> > > -------
> > > > >  IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c   |
> > 161
> > > ++++++++++
> > > > >  IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf |
> 77
> > > +++++
> > > > >  IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c   |
> 313
> > > ++++++++++++++++++
> > > > >  IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf |  79
> > > +++++
> > > > >  13 files changed, 630 insertions(+), 1445 deletions(-)
> > > > >
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FindPeiCore.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/FindPeiCore.c
> > > > > deleted file mode 100644
> > > > > index ce003d0..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FindPeiCore.c
> > > > > +++ /dev/null
> > > > > @@ -1,199 +0,0 @@
> > > > > -/** @file
> > > > > -  Locate the entry point for the PEI Core
> > > > > -
> > > > > -  Copyright (c) 2014, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -#include <PiPei.h>
> > > > > -#include <Library/BaseLib.h>
> > > > > -#include <Library/PeCoffGetEntryPointLib.h>
> > > > > -
> > > > > -#include "SecMain.h"
> > > > > -
> > > > > -/**
> > > > > -  Find core image base.
> > > > > -
> > > > > -  @param[in]  BootFirmwareVolumePtr    Point to the boot
> > > firmware volume.
> > > > > -  @param[out] SecCoreImageBase         The base address of
> > the
> > > SEC core image.
> > > > > -  @param[out] PeiCoreImageBase         The base address of
> the
> > > PEI core image.
> > > > > -
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FindImageBase (
> > > > > -  IN  EFI_FIRMWARE_VOLUME_HEADER
> > > *BootFirmwareVolumePtr,
> > > > > -  OUT EFI_PHYSICAL_ADDRESS
> *SecCoreImageBase,
> > > > > -  OUT EFI_PHYSICAL_ADDRESS             *PeiCoreImageBase
> > > > > -  )
> > > > > -{
> > > > > -  EFI_PHYSICAL_ADDRESS        CurrentAddress;
> > > > > -  EFI_PHYSICAL_ADDRESS        EndOfFirmwareVolume;
> > > > > -  EFI_FFS_FILE_HEADER         *File;
> > > > > -  UINT32                      Size;
> > > > > -  EFI_PHYSICAL_ADDRESS        EndOfFile;
> > > > > -  EFI_COMMON_SECTION_HEADER   *Section;
> > > > > -  EFI_PHYSICAL_ADDRESS        EndOfSection;
> > > > > -
> > > > > -  *SecCoreImageBase = 0;
> > > > > -  *PeiCoreImageBase = 0;
> > > > > -
> > > > > -  CurrentAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)
> > > BootFirmwareVolumePtr;
> > > > > -  EndOfFirmwareVolume = CurrentAddress +
> > > BootFirmwareVolumePtr->FvLength;
> > > > > -
> > > > > -  //
> > > > > -  // Loop through the FFS files in the Boot Firmware Volume
> > > > > -  //
> > > > > -  for (EndOfFile = CurrentAddress +
> > > BootFirmwareVolumePtr->HeaderLength; ; ) {
> > > > > -
> > > > > -    CurrentAddress = (EndOfFile + 7) & 0xfffffffffffffff8ULL;
> > > > > -    if (CurrentAddress > EndOfFirmwareVolume) {
> > > > > -      return EFI_NOT_FOUND;
> > > > > -    }
> > > > > -
> > > > > -    File = (EFI_FFS_FILE_HEADER*)(UINTN) CurrentAddress;
> > > > > -    if (IS_FFS_FILE2 (File)) {
> > > > > -      Size = FFS_FILE2_SIZE (File);
> > > > > -      if (Size <= 0x00FFFFFF) {
> > > > > -        return EFI_NOT_FOUND;
> > > > > -      }
> > > > > -    } else {
> > > > > -      Size = FFS_FILE_SIZE (File);
> > > > > -      if (Size < sizeof (EFI_FFS_FILE_HEADER)) {
> > > > > -        return EFI_NOT_FOUND;
> > > > > -      }
> > > > > -    }
> > > > > -
> > > > > -    EndOfFile = CurrentAddress + Size;
> > > > > -    if (EndOfFile > EndOfFirmwareVolume) {
> > > > > -      return EFI_NOT_FOUND;
> > > > > -    }
> > > > > -
> > > > > -    //
> > > > > -    // Look for SEC Core / PEI Core files
> > > > > -    //
> > > > > -    if (File->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
> > > > > -        File->Type != EFI_FV_FILETYPE_PEI_CORE) {
> > > > > -      continue;
> > > > > -    }
> > > > > -
> > > > > -    //
> > > > > -    // Loop through the FFS file sections within the FFS file
> > > > > -    //
> > > > > -    if (IS_FFS_FILE2 (File)) {
> > > > > -      EndOfSection = (EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *)
> > File
> > > + sizeof
> > > > > (EFI_FFS_FILE_HEADER2));
> > > > > -    } else {
> > > > > -      EndOfSection = (EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *)
> > File
> > > + sizeof
> > > > > (EFI_FFS_FILE_HEADER));
> > > > > -    }
> > > > > -    for (;;) {
> > > > > -      CurrentAddress = (EndOfSection + 3) & 0xfffffffffffffffcULL;
> > > > > -      Section = (EFI_COMMON_SECTION_HEADER*)(UINTN)
> > > CurrentAddress;
> > > > > -
> > > > > -      if (IS_SECTION2 (Section)) {
> > > > > -        Size = SECTION2_SIZE (Section);
> > > > > -        if (Size <= 0x00FFFFFF) {
> > > > > -          return EFI_NOT_FOUND;
> > > > > -        }
> > > > > -      } else {
> > > > > -        Size = SECTION_SIZE (Section);
> > > > > -        if (Size < sizeof (EFI_COMMON_SECTION_HEADER)) {
> > > > > -          return EFI_NOT_FOUND;
> > > > > -        }
> > > > > -      }
> > > > > -
> > > > > -      EndOfSection = CurrentAddress + Size;
> > > > > -      if (EndOfSection > EndOfFile) {
> > > > > -        return EFI_NOT_FOUND;
> > > > > -      }
> > > > > -
> > > > > -      //
> > > > > -      // Look for executable sections
> > > > > -      //
> > > > > -      if (Section->Type == EFI_SECTION_PE32 || Section->Type ==
> > > EFI_SECTION_TE) {
> > > > > -        if (File->Type == EFI_FV_FILETYPE_SECURITY_CORE) {
> > > > > -          if (IS_SECTION2 (Section)) {
> > > > > -            *SecCoreImageBase = (PHYSICAL_ADDRESS) (UINTN)
> > > ((UINT8 *) Section +
> > > > sizeof
> > > > > (EFI_COMMON_SECTION_HEADER2));
> > > > > -          } else {
> > > > > -            *SecCoreImageBase = (PHYSICAL_ADDRESS) (UINTN)
> > > ((UINT8 *) Section +
> > > > sizeof
> > > > > (EFI_COMMON_SECTION_HEADER));
> > > > > -          }
> > > > > -        } else {
> > > > > -          if (IS_SECTION2 (Section)) {
> > > > > -            *PeiCoreImageBase = (PHYSICAL_ADDRESS) (UINTN)
> > > ((UINT8 *) Section +
> > > > sizeof
> > > > > (EFI_COMMON_SECTION_HEADER2));
> > > > > -          } else {
> > > > > -            *PeiCoreImageBase = (PHYSICAL_ADDRESS) (UINTN)
> > > ((UINT8 *) Section +
> > > > sizeof
> > > > > (EFI_COMMON_SECTION_HEADER));
> > > > > -          }
> > > > > -        }
> > > > > -        break;
> > > > > -      }
> > > > > -    }
> > > > > -
> > > > > -    //
> > > > > -    // Both SEC Core and PEI Core images found
> > > > > -    //
> > > > > -    if (*SecCoreImageBase != 0 && *PeiCoreImageBase != 0) {
> > > > > -      return EFI_SUCCESS;
> > > > > -    }
> > > > > -  }
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Find and return Pei Core entry point.
> > > > > -
> > > > > -  It also find SEC and PEI Core file debug inforamtion. It will 
> > > > > report
> > > them if
> > > > > -  remote debug is enabled.
> > > > > -
> > > > > -  @param[in]  BootFirmwareVolumePtr    Point to the boot
> > > firmware volume.
> > > > > -  @param[out] PeiCoreEntryPoint        The entry point of the
> PEI
> > > core.
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -FindAndReportEntryPoints (
> > > > > -  IN  EFI_FIRMWARE_VOLUME_HEADER
> > > *BootFirmwareVolumePtr,
> > > > > -  OUT EFI_PEI_CORE_ENTRY_POINT         *PeiCoreEntryPoint
> > > > > -  )
> > > > > -{
> > > > > -  EFI_STATUS                       Status;
> > > > > -  EFI_PHYSICAL_ADDRESS             SecCoreImageBase;
> > > > > -  EFI_PHYSICAL_ADDRESS             PeiCoreImageBase;
> > > > > -  PE_COFF_LOADER_IMAGE_CONTEXT     ImageContext;
> > > > > -
> > > > > -  //
> > > > > -  // Find SEC Core and PEI Core image base
> > > > > -  //
> > > > > -  Status = FindImageBase (BootFirmwareVolumePtr,
> > > &SecCoreImageBase,
> > > > > &PeiCoreImageBase);
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  ZeroMem ((VOID *) &ImageContext, sizeof
> > > (PE_COFF_LOADER_IMAGE_CONTEXT));
> > > > > -  //
> > > > > -  // Report SEC Core debug information when remote debug is
> > enabled
> > > > > -  //
> > > > > -  ImageContext.ImageAddress = SecCoreImageBase;
> > > > > -  ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*)
> > > (UINTN)
> > > > > ImageContext.ImageAddress);
> > > > > -  PeCoffLoaderRelocateImageExtraAction (&ImageContext);
> > > > > -
> > > > > -  //
> > > > > -  // Report PEI Core debug information when remote debug is
> > enabled
> > > > > -  //
> > > > > -  ImageContext.ImageAddress = PeiCoreImageBase;
> > > > > -  ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*)
> > > (UINTN)
> > > > > ImageContext.ImageAddress);
> > > > > -  PeCoffLoaderRelocateImageExtraAction (&ImageContext);
> > > > > -
> > > > > -  //
> > > > > -  // Find PEI Core entry point
> > > > > -  //
> > > > > -  Status = PeCoffLoaderGetEntryPoint ((VOID *) (UINTN)
> > > PeiCoreImageBase, (VOID**)
> > > > > PeiCoreEntryPoint);
> > > > > -  if (EFI_ERROR (Status)) {
> > > > > -    *PeiCoreEntryPoint = 0;
> > > > > -  }
> > > > > -
> > > > > -  return;
> > > > > -}
> > > > > -
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
> > > > > deleted file mode 100644
> > > > > index 48a0307..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
> > > > > +++ /dev/null
> > > > > @@ -1,66 +0,0 @@
> > > > > -/** @file
> > > > > -  This PEIM initialize FSP.
> > > > > -
> > > > > -  Copyright (c) 2014 - 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -
> > > > > -#include "FspInitPei.h"
> > > > > -
> > > > > -/**
> > > > > -  This is the entrypoint of PEIM
> > > > > -
> > > > > -  @param[in] FileHandle  Handle of the file being invoked.
> > > > > -  @param[in] PeiServices Describes the list of possible PEI Services.
> > > > > -
> > > > > -  @retval EFI_SUCCESS if it completed successfully.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FspPeiEntryPoint (
> > > > > -  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> > > > > -  IN CONST EFI_PEI_SERVICES     **PeiServices
> > > > > -  )
> > > > > -{
> > > > > -  FSP_INFO_HEADER      *FspHeader;
> > > > > -  UINT8                PcdFspApiVersion;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "FspPeiEntryPoint\n"));
> > > > > -  PcdFspApiVersion = 1;
> > > > > -
> > > > > -  FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
> > > > > -  DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));
> > > > > -  if (FspHeader == NULL) {
> > > > > -    return EFI_DEVICE_ERROR;
> > > > > -  }
> > > > > -
> > > > > -  ASSERT (FspHeader->TempRamInitEntryOffset != 0);
> > > > > -  ASSERT (FspHeader->FspInitEntryOffset != 0);
> > > > > -  ASSERT (FspHeader->NotifyPhaseEntryOffset != 0);
> > > > > -
> > > > > -  if ((PcdGet8 (PcdFspApiVersion) >= 2) &&
> > > > > -      (FspHeader->HeaderRevision >= FSP_HEADER_REVISION_2)
> &&
> > > > > -      (FspHeader->ApiEntryNum >= 6) ) {
> > > > > -    ASSERT (FspHeader->FspMemoryInitEntryOffset != 0);
> > > > > -    ASSERT (FspHeader->TempRamExitEntryOffset != 0);
> > > > > -    ASSERT (FspHeader->FspSiliconInitEntryOffset != 0);
> > > > > -    PcdFspApiVersion = PcdGet8 (PcdFspApiVersion);
> > > > > -  }
> > > > > -  DEBUG ((DEBUG_INFO, "PcdFspApiVersion - 0x%x\n",
> > > PcdFspApiVersion));
> > > > > -
> > > > > -  if (PcdFspApiVersion == 1) {
> > > > > -    PeiFspInitV1 (FspHeader);
> > > > > -  } else {
> > > > > -    PeiFspInitV2 (FspHeader);
> > > > > -  }
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
> > > > > deleted file mode 100644
> > > > > index 6d70f0c..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
> > > > > +++ /dev/null
> > > > > @@ -1,64 +0,0 @@
> > > > > -/** @file
> > > > > -  This is PEIM header file.
> > > > > -
> > > > > -  Copyright (c) 2014 - 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -#ifndef _FSP_INIT_PEI_H_
> > > > > -#define _FSP_INIT_PEI_H_
> > > > > -
> > > > > -#include <PiPei.h>
> > > > > -
> > > > > -#include <Library/PeimEntryPoint.h>
> > > > > -#include <Library/PeiServicesLib.h>
> > > > > -#include <Library/PeiServicesTablePointerLib.h>
> > > > > -#include <Library/BaseLib.h>
> > > > > -#include <Library/DebugLib.h>
> > > > > -#include <Library/BaseMemoryLib.h>
> > > > > -#include <Library/HobLib.h>
> > > > > -#include <Library/PcdLib.h>
> > > > > -#include <Library/FspPlatformInfoLib.h>
> > > > > -#include <Library/FspPlatformSecLib.h>
> > > > > -#include <Library/FspHobProcessLib.h>
> > > > > -#include <Library/FspApiLib.h>
> > > > > -
> > > > > -#include <Ppi/FspInitDone.h>
> > > > > -#include <Ppi/EndOfPeiPhase.h>
> > > > > -#include <Ppi/MemoryDiscovered.h>
> > > > > -#include <Ppi/TemporaryRamDone.h>
> > > > > -
> > > > > -extern EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc;
> > > > > -
> > > > > -/**
> > > > > -  Do FSP initialization based on FspApi version 1.
> > > > > -
> > > > > -  @param[in] FspHeader FSP header pointer.
> > > > > -
> > > > > -  @return FSP initialization status.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -PeiFspInitV1 (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  );
> > > > > -
> > > > > -/**
> > > > > -  Do FSP initialization based on FspApi version 2.
> > > > > -
> > > > > -  @param[in] FspHeader FSP header pointer.
> > > > > -
> > > > > -  @return FSP initialization status.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -PeiFspInitV2 (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  );
> > > > > -
> > > > > -#endif
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
> > > > > deleted file mode 100644
> > > > > index cde101b..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
> > > > > +++ /dev/null
> > > > > @@ -1,90 +0,0 @@
> > > > > -## @file
> > > > > -# FSP PEI Module
> > > > > -#
> > > > > -# This PEIM initialize FSP.
> > > > > -# In FSP API V1 mode, it will be invoked twice by pei core. In 1st
> entry,
> > it
> > > will
> > > > > -# call FspInit API. In 2nd entry, it will parse the hoblist from fsp 
> > > > > and
> > > report
> > > > > -# them into pei core.
> > > > > -# In FSP API V2 mode, it will be invoked only once. It will call
> > > FspMemoryInit API,
> > > > > -# register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > -# notify to call FspSiliconInit API.
> > > > > -#
> > > > > -#  Copyright (c) 2014 - 2015, 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
> > > > > -#  http://opensource.org/licenses/bsd-license.php.
> > > > > -#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > > EITHER EXPRESS OR IMPLIED.
> > > > > -#
> > > > > -##
> > > > > -
> > > > > -[Defines]
> > > > > -  INF_VERSION                    = 0x00010005
> > > > > -  BASE_NAME                      = FspInitPeim
> > > > > -  FILE_GUID                      =
> > > BC59E2E1-7492-4031-806E-C48DCCC3A026
> > > > > -  MODULE_TYPE                    = PEIM
> > > > > -  VERSION_STRING                 = 1.0
> > > > > -  ENTRY_POINT                    = FspPeiEntryPoint
> > > > > -
> > > > > -#
> > > > > -# The following information is for reference only and not required by
> > the
> > > build
> > > > tools.
> > > > > -#
> > > > > -#  VALID_ARCHITECTURES           = IA32
> > > > > -#
> > > > > -
> > > > > -[Sources]
> > > > > -  FspInitPei.c
> > > > > -  FspInitPei.h
> > > > > -  FspInitPeiV1.c
> > > > > -  FspInitPeiV2.c
> > > > > -  FspNotifyS3.c
> > > > > -  SecMain.c
> > > > > -  SecMain.h
> > > > > -  FindPeiCore.c
> > > > > -
> > > > > -[Packages]
> > > > > -  MdePkg/MdePkg.dec
> > > > > -  MdeModulePkg/MdeModulePkg.dec
> > > > > -  UefiCpuPkg/UefiCpuPkg.dec
> > > > > -  IntelFspPkg/IntelFspPkg.dec
> > > > > -  IntelFspWrapperPkg/IntelFspWrapperPkg.dec
> > > > > -
> > > > > -[LibraryClasses]
> > > > > -  PeimEntryPoint
> > > > > -  PeiServicesLib
> > > > > -  PeiServicesTablePointerLib
> > > > > -  BaseLib
> > > > > -  BaseMemoryLib
> > > > > -  DebugLib
> > > > > -  HobLib
> > > > > -  FspPlatformInfoLib
> > > > > -  FspHobProcessLib
> > > > > -  FspPlatformSecLib
> > > > > -  DebugAgentLib
> > > > > -  UefiCpuLib
> > > > > -  PeCoffGetEntryPointLib
> > > > > -  PeCoffExtraActionLib
> > > > > -  FspApiLib
> > > > > -
> > > > > -[Ppis]
> > > > > -  gTopOfTemporaryRamPpiGuid             ## PRODUCES
> > > > > -  gFspInitDonePpiGuid                   ## PRODUCES
> > > > > -  gEfiEndOfPeiSignalPpiGuid             ## PRODUCES
> > > > > -  gEfiTemporaryRamDonePpiGuid           ## PRODUCES
> > > > > -  gEfiPeiMemoryDiscoveredPpiGuid        ## PRODUCES
> > > > > -
> > > > > -[FixedPcd]
> > > > > -  gFspWrapperTokenSpaceGuid.PcdSecCoreMaxPpiSupported
> > > ## CONSUMES
> > > > > -
> > > > > -[Pcd]
> > > > > -  gFspWrapperTokenSpaceGuid.PcdPeiTemporaryRamStackSize
> > > ## CONSUMES
> > > > > -  gFspWrapperTokenSpaceGuid.PcdFlashFvFspBase
> > > ## CONSUMES
> > > > > -  gFspWrapperTokenSpaceGuid.PcdFlashFvSecondFspBase
> > > ## CONSUMES
> > > > > -  gFspWrapperTokenSpaceGuid.PcdFlashFvFspSize
> > > ## CONSUMES
> > > > > -  gFspWrapperTokenSpaceGuid.PcdMaxUpdRegionSize
> > > ## CONSUMES
> > > > > -  gFspWrapperTokenSpaceGuid.PcdFspApiVersion
> > > ## CONSUMES
> > > > > -
> > > > > -[Depex]
> > > > > -  gEfiPeiMasterBootModePpiGuid
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c
> > > > > deleted file mode 100644
> > > > > index b145b50..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c
> > > > > +++ /dev/null
> > > > > @@ -1,182 +0,0 @@
> > > > > -/** @file
> > > > > -  In FSP API V1 mode, it will be invoked twice by pei core. In 1st
> entry,
> > it
> > > will
> > > > > -  call FspInit API. In 2nd entry, it will parse the hoblist from fsp 
> > > > > and
> > > report
> > > > > -  them into pei core.
> > > > > -
> > > > > -  Copyright (c) 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -
> > > > > -#include "FspInitPei.h"
> > > > > -
> > > > > -/**
> > > > > -  FSP Init continuation function.
> > > > > -  Control will be returned to this callback function after FspInit 
> > > > > API
> > call.
> > > > > -
> > > > > -  @param[in] Status      Status of the FSP INIT API
> > > > > -  @param[in] HobListPtr  Pointer to the HOB data structure
> defined
> > in
> > > the PI
> > > > > specification.
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -ContinuationFunc (
> > > > > -  IN EFI_STATUS Status,
> > > > > -  IN VOID       *HobListPtr
> > > > > -  )
> > > > > -{
> > > > > -  EFI_BOOT_MODE             BootMode;
> > > > > -  UINT64                    StackSize;
> > > > > -  EFI_PHYSICAL_ADDRESS      StackBase;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "ContinuationFunc - %r\n", Status));
> > > > > -  DEBUG ((DEBUG_INFO, "HobListPtr - 0x%x\n", HobListPtr));
> > > > > -
> > > > > -  if (Status != EFI_SUCCESS) {
> > > > > -    CpuDeadLoop ();
> > > > > -  }
> > > > > -
> > > > > -  //
> > > > > -  // Can not call any PeiServices
> > > > > -  //
> > > > > -  BootMode = GetBootMode ();
> > > > > -
> > > > > -  GetStackInfo (BootMode, TRUE, &StackSize, &StackBase);
> > > > > -  DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
> > > > > -  DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
> > > > > -  CallPeiCoreEntryPoint (
> > > > > -    HobListPtr,
> > > > > -    (VOID *)(UINTN)StackBase,
> > > > > -    (VOID *)(UINTN)(StackBase + StackSize)
> > > > > -    );
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Call FspInit API.
> > > > > -
> > > > > -  @param[in] FspHeader FSP header pointer.
> > > > > -**/
> > > > > -VOID
> > > > > -PeiFspInit (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  )
> > > > > -{
> > > > > -  FSP_INIT_PARAMS           FspInitParams;
> > > > > -  FSP_INIT_RT_COMMON_BUFFER FspRtBuffer;
> > > > > -  UINT8                     FspUpdRgn[FixedPcdGet32
> > > (PcdMaxUpdRegionSize)];
> > > > > -  UINT32                    UpdRegionSize;
> > > > > -  EFI_BOOT_MODE             BootMode;
> > > > > -  UINT64                    StackSize;
> > > > > -  EFI_PHYSICAL_ADDRESS      StackBase;
> > > > > -  EFI_STATUS                Status;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "PeiFspInit enter\n"));
> > > > > -
> > > > > -  PeiServicesGetBootMode (&BootMode);
> > > > > -  DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode));
> > > > > -
> > > > > -  GetStackInfo (BootMode, FALSE, &StackSize, &StackBase);
> > > > > -  DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
> > > > > -  DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
> > > > > -
> > > > > -  ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer));
> > > > > -  FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize);
> > > > > -
> > > > > -  FspRtBuffer.BootMode = BootMode;
> > > > > -
> > > > > -  /* Platform override any UPD configs */
> > > > > -  UpdRegionSize = GetUpdRegionSize();
> > > > > -  DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n",
> > UpdRegionSize));
> > > > > -  DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n",
> > > sizeof(FspUpdRgn)));
> > > > > -  ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize);
> > > > > -  ZeroMem (FspUpdRgn, UpdRegionSize);
> > > > > -  FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn);
> > > > > -  FspRtBuffer.BootLoaderTolumSize = 0;
> > > > > -
> > > > > -  ZeroMem (&FspInitParams, sizeof(FspInitParams));
> > > > > -  FspInitParams.NvsBufferPtr = GetNvsBuffer ();
> > > > > -  DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n",
> > > FspInitParams.NvsBufferPtr));
> > > > > -  FspInitParams.RtBufferPtr  = (VOID *)&FspRtBuffer;
> > > > > -  FspInitParams.ContinuationFunc =
> > > (CONTINUATION_PROC)ContinuationFunc;
> > > > > -
> > > > > -  SaveSecContext (GetPeiServicesTablePointer ());
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "FspInitParams      - 0x%x\n",
> > > &FspInitParams));
> > > > > -  DEBUG ((DEBUG_INFO, "  NvsBufferPtr     - 0x%x\n",
> > > FspInitParams.NvsBufferPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "  RtBufferPtr      - 0x%x\n",
> > > FspInitParams.RtBufferPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "    StackTop       - 0x%x\n",
> > > FspRtBuffer.StackTop));
> > > > > -  DEBUG ((DEBUG_INFO, "    BootMode       - 0x%x\n",
> > > FspRtBuffer.BootMode));
> > > > > -  DEBUG ((DEBUG_INFO, "    UpdDataRgnPtr  - 0x%x\n",
> > > FspRtBuffer.UpdDataRgnPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "  ContinuationFunc - 0x%x\n",
> > > > FspInitParams.ContinuationFunc));
> > > > > -
> > > > > -  Status = CallFspInit (FspHeader, &FspInitParams);
> > > > > -  //
> > > > > -  // Should never return
> > > > > -  //
> > > > > -  DEBUG((DEBUG_ERROR, "FSP Init failed, status: 0x%x\n", Status));
> > > > > -  CpuDeadLoop ();
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Do FSP initialization based on FspApi version 1.
> > > > > -
> > > > > -  @param[in] FspHeader FSP header pointer.
> > > > > -
> > > > > -  @return FSP initialization status.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -PeiFspInitV1 (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  )
> > > > > -{
> > > > > -  EFI_STATUS           Status;
> > > > > -  FSP_INIT_DONE_PPI    *FspInitDone;
> > > > > -  VOID                 *FspHobList;
> > > > > -  EFI_BOOT_MODE        BootMode;
> > > > > -
> > > > > -  Status = PeiServicesLocatePpi (
> > > > > -             &gFspInitDonePpiGuid,
> > > > > -             0,
> > > > > -             NULL,
> > > > > -             (VOID **) &FspInitDone
> > > > > -             );
> > > > > -  if (EFI_ERROR (Status)) {
> > > > > -    //
> > > > > -    // 1st entry
> > > > > -    //
> > > > > -    DEBUG ((DEBUG_INFO, "1st entry\n"));
> > > > > -
> > > > > -    PeiFspInit (FspHeader);
> > > > > -    //
> > > > > -    // Never return here, for FspApi version 1.
> > > > > -    //
> > > > > -    CpuDeadLoop ();
> > > > > -  } else {
> > > > > -    //
> > > > > -    // 2nd entry for FspApi version 1 only.
> > > > > -    //
> > > > > -    DEBUG ((DEBUG_INFO, "2nd entry\n"));
> > > > > -
> > > > > -    Status = FspInitDone->GetFspHobList
> (GetPeiServicesTablePointer
> > (),
> > > FspInitDone,
> > > > > &FspHobList);
> > > > > -    ASSERT_EFI_ERROR (Status);
> > > > > -    DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
> > > > > -    FspHobProcess (FspHobList);
> > > > > -
> > > > > -    //
> > > > > -    // Register EndOfPei Notify for S3 to run FspNotifyPhase
> > > > > -    //
> > > > > -    PeiServicesGetBootMode (&BootMode);
> > > > > -    if (BootMode == BOOT_ON_S3_RESUME) {
> > > > > -      Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
> > > > > -      ASSERT_EFI_ERROR (Status);
> > > > > -    }
> > > > > -  }
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > \ No newline at end of file
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c
> > > > > deleted file mode 100644
> > > > > index 50b150a..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c
> > > > > +++ /dev/null
> > > > > @@ -1,338 +0,0 @@
> > > > > -/** @file
> > > > > -  In FSP API V2 mode, it will be invoked only once. It will call
> > > FspMemoryInit API,
> > > > > -  register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > -  notify to call FspSiliconInit API.
> > > > > -
> > > > > -  Copyright (c) 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -
> > > > > -#include "FspInitPei.h"
> > > > > -
> > > > > -/**
> > > > > -  Return Hob list produced by FSP.
> > > > > -
> > > > > -  @param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > -  @param[in]  This         The pointer to this instance of this
> PPI.
> > > > > -  @param[out] FspHobList   The pointer to Hob list produced by
> > FSP.
> > > > > -
> > > > > -  @return EFI_SUCCESS FReturn Hob list produced by FSP
> successfully.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FspInitDoneGetFspHobListV2 (
> > > > > -  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > -  IN  FSP_INIT_DONE_PPI              *This,
> > > > > -  OUT VOID                           **FspHobList
> > > > > -  );
> > > > > -
> > > > > -FSP_INIT_DONE_PPI mFspInitDonePpiV2 = {
> > > > > -  FspInitDoneGetFspHobListV2
> > > > > -};
> > > > > -
> > > > > -EFI_PEI_PPI_DESCRIPTOR            mPeiFspInitDonePpiV2 = {
> > > > > -  EFI_PEI_PPI_DESCRIPTOR_PPI |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> > > > > -  &gFspInitDonePpiGuid,
> > > > > -  &mFspInitDonePpiV2
> > > > > -};
> > > > > -
> > > > > -/**
> > > > > -  This function is called after PEI core discover memory and finish
> > > migration.
> > > > > -
> > > > > -  @param[in] PeiServices    Pointer to PEI Services Table.
> > > > > -  @param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event
> > > > that
> > > > > -                            caused this function to execute.
> > > > > -  @param[in] Ppi            Pointer to the PPI data associated
> > with
> > > this function.
> > > > > -
> > > > > -  @retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -PeiMemoryDiscoveredNotify (
> > > > > -  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > -  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > -  IN VOID                      *Ppi
> > > > > -  );
> > > > > -
> > > > > -EFI_PEI_NOTIFY_DESCRIPTOR mPeiMemoryDiscoveredNotifyDesc =
> {
> > > > > -  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> > > > > -  &gEfiPeiMemoryDiscoveredPpiGuid,
> > > > > -  PeiMemoryDiscoveredNotify
> > > > > -};
> > > > > -
> > > > > -/**
> > > > > -  TemporaryRamDone() disables the use of Temporary RAM. If
> > present,
> > > this service is
> > > > > invoked
> > > > > -  by the PEI Foundation after the
> > > EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is
> > > > installed.
> > > > > -
> > > > > -  @retval EFI_SUCCESS           Use of Temporary RAM was
> > > disabled.
> > > > > -  @retval EFI_INVALID_PARAMETER Temporary RAM could not be
> > > disabled.
> > > > > -
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -PeiTemporaryRamDone (
> > > > > -  VOID
> > > > > -  );
> > > > > -
> > > > > -EFI_PEI_TEMPORARY_RAM_DONE_PPI mPeiTemporaryRamDonePpi
> =
> > {
> > > > > -  PeiTemporaryRamDone
> > > > > -};
> > > > > -
> > > > > -EFI_PEI_PPI_DESCRIPTOR         mPeiTemporaryRamDoneDesc =
> {
> > > > > -  (EFI_PEI_PPI_DESCRIPTOR_PPI |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> > > > > -  &gEfiTemporaryRamDonePpiGuid,
> > > > > -  &mPeiTemporaryRamDonePpi
> > > > > -};
> > > > > -
> > > > > -/**
> > > > > -  Return Hob list produced by FSP.
> > > > > -
> > > > > -  @param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > -  @param[in]  This         The pointer to this instance of this
> PPI.
> > > > > -  @param[out] FspHobList   The pointer to Hob list produced by
> > FSP.
> > > > > -
> > > > > -  @return EFI_SUCCESS FReturn Hob list produced by FSP
> successfully.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FspInitDoneGetFspHobListV2 (
> > > > > -  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > -  IN  FSP_INIT_DONE_PPI              *This,
> > > > > -  OUT VOID                           **FspHobList
> > > > > -  )
> > > > > -{
> > > > > -  EFI_HOB_GUID_TYPE                  *GuidHob;
> > > > > -
> > > > > -  GuidHob = GetFirstGuidHob (&gFspInitDonePpiGuid);
> > > > > -  if (GuidHob != NULL) {
> > > > > -    *FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
> > > > > -    return EFI_SUCCESS;
> > > > > -  } else {
> > > > > -    return EFI_NOT_FOUND;
> > > > > -  }
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Call FspMemoryInit API.
> > > > > -
> > > > > -  @param[in]  FspHeader   FSP header pointer.
> > > > > -
> > > > > -  @return Status returned by FspMemoryInit API.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -PeiFspMemoryInit (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  )
> > > > > -{
> > > > > -  FSP_MEMORY_INIT_PARAMS    FspMemoryInitParams;
> > > > > -  FSP_INIT_RT_COMMON_BUFFER FspRtBuffer;
> > > > > -  UINT8                     FspUpdRgn[FixedPcdGet32
> > > (PcdMaxUpdRegionSize)];
> > > > > -  UINT32                    UpdRegionSize;
> > > > > -  EFI_BOOT_MODE             BootMode;
> > > > > -  UINT64                    StackSize;
> > > > > -  EFI_PHYSICAL_ADDRESS      StackBase;
> > > > > -  EFI_STATUS                Status;
> > > > > -  VOID                      *FspHobList;
> > > > > -  VOID                      *HobData;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "PeiFspMemoryInit enter\n"));
> > > > > -
> > > > > -  PeiServicesGetBootMode (&BootMode);
> > > > > -  DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode));
> > > > > -
> > > > > -  GetStackInfo (BootMode, FALSE, &StackSize, &StackBase);
> > > > > -  DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
> > > > > -  DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
> > > > > -
> > > > > -  ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer));
> > > > > -  FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize);
> > > > > -
> > > > > -  FspRtBuffer.BootMode = BootMode;
> > > > > -
> > > > > -  /* Platform override any UPD configs */
> > > > > -  UpdRegionSize = GetUpdRegionSize();
> > > > > -  DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n",
> > UpdRegionSize));
> > > > > -  DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n",
> > > sizeof(FspUpdRgn)));
> > > > > -  ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize);
> > > > > -  ZeroMem (FspUpdRgn, UpdRegionSize);
> > > > > -  FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn);
> > > > > -  FspRtBuffer.BootLoaderTolumSize = GetBootLoaderTolumSize ();
> > > > > -
> > > > > -  ZeroMem (&FspMemoryInitParams,
> sizeof(FspMemoryInitParams));
> > > > > -  FspMemoryInitParams.NvsBufferPtr = GetNvsBuffer ();
> > > > > -  DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n",
> > > FspMemoryInitParams.NvsBufferPtr));
> > > > > -  FspMemoryInitParams.RtBufferPtr  = (VOID *)&FspRtBuffer;
> > > > > -  FspHobList = NULL;
> > > > > -  FspMemoryInitParams.HobListPtr   = &FspHobList;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "FspMemoryInitParams - 0x%x\n",
> > > &FspMemoryInitParams));
> > > > > -  DEBUG ((DEBUG_INFO, "  NvsBufferPtr      - 0x%x\n",
> > > > > FspMemoryInitParams.NvsBufferPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "  RtBufferPtr       - 0x%x\n",
> > > > > FspMemoryInitParams.RtBufferPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "    StackTop        - 0x%x\n",
> > > FspRtBuffer.StackTop));
> > > > > -  DEBUG ((DEBUG_INFO, "    BootMode        - 0x%x\n",
> > > FspRtBuffer.BootMode));
> > > > > -  DEBUG ((DEBUG_INFO, "    UpdDataRgnPtr   - 0x%x\n",
> > > FspRtBuffer.UpdDataRgnPtr));
> > > > > -  DEBUG ((DEBUG_INFO, "  HobListPtr        - 0x%x\n",
> > > > > FspMemoryInitParams.HobListPtr));
> > > > > -
> > > > > -  Status = CallFspMemoryInit (FspHeader, &FspMemoryInitParams);
> > > > > -  DEBUG((DEBUG_INFO, "FspMemoryInit status: 0x%x\n", Status));
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "  HobListPtr (returned) - 0x%x\n",
> > > FspHobList));
> > > > > -  ASSERT (FspHobList != NULL);
> > > > > -
> > > > > -  FspHobProcessForMemoryResource (FspHobList);
> > > > > -
> > > > > -  //
> > > > > -  // FspHobList is not complete at this moment.
> > > > > -  // Save FspHobList pointer to hob, so that it can be got later
> > > > > -  //
> > > > > -  HobData = BuildGuidHob (
> > > > > -             &gFspInitDonePpiGuid,
> > > > > -             sizeof (VOID *)
> > > > > -             );
> > > > > -  ASSERT (HobData != NULL);
> > > > > -  CopyMem (HobData, &FspHobList, sizeof (FspHobList));
> > > > > -
> > > > > -  return Status;
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  TemporaryRamDone() disables the use of Temporary RAM. If
> > present,
> > > this service is
> > > > > invoked
> > > > > -  by the PEI Foundation after the
> > > EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is
> > > > installed.
> > > > > -
> > > > > -  @retval EFI_SUCCESS           Use of Temporary RAM was
> > > disabled.
> > > > > -  @retval EFI_INVALID_PARAMETER Temporary RAM could not be
> > > disabled.
> > > > > -
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -PeiTemporaryRamDone (
> > > > > -  VOID
> > > > > -  )
> > > > > -{
> > > > > -  EFI_STATUS                Status;
> > > > > -  VOID                      *TempRamExitParam;
> > > > > -  FSP_INFO_HEADER           *FspHeader;
> > > > > -
> > > > > -  FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
> > > > > -  if (FspHeader == NULL) {
> > > > > -    return EFI_DEVICE_ERROR;
> > > > > -  }
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "PeiTemporaryRamDone enter\n"));
> > > > > -
> > > > > -  TempRamExitParam = GetTempRamExitParam ();
> > > > > -  Status = CallTempRamExit (FspHeader, TempRamExitParam);
> > > > > -  DEBUG((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  This function is called after PEI core discover memory and finish
> > > migration.
> > > > > -
> > > > > -  @param[in] PeiServices    Pointer to PEI Services Table.
> > > > > -  @param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event
> > > > that
> > > > > -                            caused this function to execute.
> > > > > -  @param[in] Ppi            Pointer to the PPI data associated
> > with
> > > this function.
> > > > > -
> > > > > -  @retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -PeiMemoryDiscoveredNotify (
> > > > > -  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > -  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > -  IN VOID                      *Ppi
> > > > > -  )
> > > > > -{
> > > > > -  EFI_STATUS                Status;
> > > > > -  VOID                      *FspSiliconInitParam;
> > > > > -  FSP_INFO_HEADER           *FspHeader;
> > > > > -  VOID                      *FspHobList;
> > > > > -  EFI_HOB_GUID_TYPE         *GuidHob;
> > > > > -
> > > > > -  if (PcdGet32 (PcdFlashFvSecondFspBase) == 0) {
> > > > > -    FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
> > > > > -  } else {
> > > > > -    FspHeader = FspFindFspHeader (PcdGet32
> > > (PcdFlashFvSecondFspBase));
> > > > > -  }
> > > > > -  if (FspHeader == NULL) {
> > > > > -    return EFI_DEVICE_ERROR;
> > > > > -  }
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "PeiMemoryDiscoveredNotify enter\n"));
> > > > > -
> > > > > -  FspSiliconInitParam = GetFspSiliconInitParam ();
> > > > > -  Status = CallFspSiliconInit (FspHeader, FspSiliconInitParam);
> > > > > -  DEBUG((DEBUG_ERROR, "FspSiliconInit status: 0x%x\n", Status));
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  //
> > > > > -  // Now FspHobList complete, process it
> > > > > -  //
> > > > > -  GuidHob = GetFirstGuidHob (&gFspInitDonePpiGuid);
> > > > > -  ASSERT (GuidHob != NULL);
> > > > > -  FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
> > > > > -  DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
> > > > > -  FspHobProcessForOtherData (FspHobList);
> > > > > -
> > > > > -  //
> > > > > -  // Install FspInitDonePpi so that any other driver can consume this
> > > info.
> > > > > -  //
> > > > > -  Status = PeiServicesInstallPpi (&mPeiFspInitDonePpiV2);
> > > > > -  ASSERT_EFI_ERROR(Status);
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Do FSP initialization based on FspApi version 2.
> > > > > -
> > > > > -  @param[in] FspHeader FSP header pointer.
> > > > > -
> > > > > -  @return FSP initialization status.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -PeiFspInitV2 (
> > > > > -  IN FSP_INFO_HEADER *FspHeader
> > > > > -  )
> > > > > -{
> > > > > -  EFI_STATUS           Status;
> > > > > -  EFI_BOOT_MODE        BootMode;
> > > > > -
> > > > > -  Status = PeiFspMemoryInit (FspHeader);
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  //
> > > > > -  // Install TempramDonePpi to run TempRamExit
> > > > > -  //
> > > > > -  Status = PeiServicesInstallPpi (&mPeiTemporaryRamDoneDesc);
> > > > > -  ASSERT_EFI_ERROR(Status);
> > > > > -
> > > > > -  //
> > > > > -  // Register MemoryDiscovered Nofity to run FspSiliconInit
> > > > > -  //
> > > > > -  Status = PeiServicesNotifyPpi
> > (&mPeiMemoryDiscoveredNotifyDesc);
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > > -
> > > > > -  //
> > > > > -  // Register EndOfPei Notify for S3 to run FspNotifyPhase
> > > > > -  //
> > > > > -  PeiServicesGetBootMode (&BootMode);
> > > > > -  if (BootMode == BOOT_ON_S3_RESUME) {
> > > > > -    Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
> > > > > -    ASSERT_EFI_ERROR (Status);
> > > > > -  }
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > \ No newline at end of file
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
> > > > > deleted file mode 100644
> > > > > index f784b01..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
> > > > > +++ /dev/null
> > > > > @@ -1,80 +0,0 @@
> > > > > -/** @file
> > > > > -  In EndOfPei notify, it will call FspNotifyPhase API.
> > > > > -
> > > > > -  Copyright (c) 2014 - 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -
> > > > > -#include "FspInitPei.h"
> > > > > -
> > > > > -/**
> > > > > -  This function handles S3 resume task at the end of PEI
> > > > > -
> > > > > -  @param[in] PeiServices    Pointer to PEI Services Table.
> > > > > -  @param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event
> > > > that
> > > > > -                            caused this function to execute.
> > > > > -  @param[in] Ppi            Pointer to the PPI data associated
> > with
> > > this function.
> > > > > -
> > > > > -  @retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -S3EndOfPeiNotify (
> > > > > -  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > -  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > -  IN VOID                      *Ppi
> > > > > -  );
> > > > > -
> > > > > -EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {
> > > > > -  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> > > > > -  &gEfiEndOfPeiSignalPpiGuid,
> > > > > -  S3EndOfPeiNotify
> > > > > -};
> > > > > -
> > > > > -/**
> > > > > -  This function handles S3 resume task at the end of PEI
> > > > > -
> > > > > -  @param[in] PeiServices    Pointer to PEI Services Table.
> > > > > -  @param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event
> > > > that
> > > > > -                            caused this function to execute.
> > > > > -  @param[in] Ppi            Pointer to the PPI data associated
> > with
> > > this function.
> > > > > -
> > > > > -  @retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -S3EndOfPeiNotify (
> > > > > -  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > -  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > -  IN VOID                      *Ppi
> > > > > -  )
> > > > > -{
> > > > > -  NOTIFY_PHASE_PARAMS NotifyPhaseParams;
> > > > > -  EFI_STATUS          Status;
> > > > > -  FSP_INFO_HEADER     *FspHeader;
> > > > > -
> > > > > -  FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
> > > > > -  if (FspHeader == NULL) {
> > > > > -    return EFI_DEVICE_ERROR;
> > > > > -  }
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
> > > > > -
> > > > > -  NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
> > > > > -  Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
> > > > > -  DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration
> > > status: 0x%x\n",
> > > > Status));
> > > > > -
> > > > > -  NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
> > > > > -  Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
> > > > > -  DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status:
> > > 0x%x\n", Status));
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/SecMain.c
> > > > > b/IntelFspWrapperPkg/FspInitPei/SecMain.c
> > > > > deleted file mode 100644
> > > > > index 4d0878a..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/SecMain.c
> > > > > +++ /dev/null
> > > > > @@ -1,310 +0,0 @@
> > > > > -/** @file
> > > > > -  C functions in SEC
> > > > > -
> > > > > -  Copyright (c) 2014 - 2015, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -
> > > > > -#include "SecMain.h"
> > > > > -
> > > > > -EFI_PEI_PPI_DESCRIPTOR            mPeiSecMainPpi[] = {
> > > > > -  {
> > > > > -    EFI_PEI_PPI_DESCRIPTOR_PPI,
> > > > > -    &gTopOfTemporaryRamPpiGuid,
> > > > > -    NULL // To be patched later.
> > > > > -  },
> > > > > -  {
> > > > > -    EFI_PEI_PPI_DESCRIPTOR_PPI |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> > > > > -    &gFspInitDonePpiGuid,
> > > > > -    &gFspInitDonePpi
> > > > > -  },
> > > > > -};
> > > > > -
> > > > > -FSP_INIT_DONE_PPI gFspInitDonePpi = {
> > > > > -  FspInitDoneGetFspHobList
> > > > > -};
> > > > > -
> > > > > -//
> > > > > -// These are IDT entries pointing to 10:FFFFFFE4h.
> > > > > -//
> > > > > -UINT64  mIdtEntryTemplate = 0xffff8e000010ffe4ULL;
> > > > > -
> > > > > -/**
> > > > > -  Caller provided function to be invoked at the end of
> > > InitializeDebugAgent().
> > > > > -
> > > > > -  Entry point to the C language phase of SEC. After the SEC
> assembly
> > > > > -  code has initialized some temporary memory and set up the stack,
> > > > > -  the control is transferred to this function.
> > > > > -
> > > > > -  @param[in] Context    The first input parameter of
> > > InitializeDebugAgent().
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -SecStartupPhase2(
> > > > > -  IN VOID                     *Context
> > > > > -  );
> > > > > -
> > > > > -
> > > > > -/**
> > > > > -
> > > > > -  Entry point to the C language phase of SEC. After the SEC
> assembly
> > > > > -  code has initialized some temporary memory and set up the stack,
> > > > > -  the control is transferred to this function.
> > > > > -
> > > > > -  @param[in] SizeOfRam           Size of the temporary
> memory
> > > available for use.
> > > > > -  @param[in] TempRamBase         Base address of tempory
> ram
> > > > > -  @param[in] BootFirmwareVolume  Base address of the Boot
> > > Firmware Volume.
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -SecStartup (
> > > > > -  IN UINT32                   SizeOfRam,
> > > > > -  IN UINT32                   TempRamBase,
> > > > > -  IN VOID                     *BootFirmwareVolume
> > > > > -  )
> > > > > -{
> > > > > -  EFI_SEC_PEI_HAND_OFF        SecCoreData;
> > > > > -  IA32_DESCRIPTOR             IdtDescriptor;
> > > > > -  SEC_IDT_TABLE               IdtTableInStack;
> > > > > -  UINT32                      Index;
> > > > > -  UINT32                      PeiStackSize;
> > > > > -
> > > > > -  PeiStackSize = PcdGet32 (PcdPeiTemporaryRamStackSize);
> > > > > -  if (PeiStackSize == 0) {
> > > > > -    PeiStackSize = (SizeOfRam >> 1);
> > > > > -  }
> > > > > -
> > > > > -  ASSERT (PeiStackSize < SizeOfRam);
> > > > > -
> > > > > -  //
> > > > > -  // Process all libraries constructor function linked to SecCore.
> > > > > -  //
> > > > > -  ProcessLibraryConstructorList ();
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "FspPei - SecStartup\n"));
> > > > > -
> > > > > -  //
> > > > > -  // Initialize floating point operating environment
> > > > > -  // to be compliant with UEFI spec.
> > > > > -  //
> > > > > -  InitializeFloatingPointUnits ();
> > > > > -
> > > > > -
> > > > > -  // |-------------------|---->
> > > > > -  // |Idt Table          |
> > > > > -  // |-------------------|
> > > > > -  // |PeiService Pointer |    PeiStackSize
> > > > > -  // |-------------------|
> > > > > -  // |                   |
> > > > > -  // |      Stack        |
> > > > > -  // |-------------------|---->
> > > > > -  // |                   |
> > > > > -  // |                   |
> > > > > -  // |      Heap         |    PeiTemporayRamSize
> > > > > -  // |                   |
> > > > > -  // |                   |
> > > > > -  // |-------------------|---->  TempRamBase
> > > > > -
> > > > > -  IdtTableInStack.PeiService = 0;
> > > > > -  for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index ++) {
> > > > > -    CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index],
> > > (VOID*)&mIdtEntryTemplate,
> > > > > sizeof (UINT64));
> > > > > -  }
> > > > > -
> > > > > -  IdtDescriptor.Base  = (UINTN) &IdtTableInStack.IdtTable;
> > > > > -  IdtDescriptor.Limit = (UINT16)(sizeof (IdtTableInStack.IdtTable) -
> 1);
> > > > > -
> > > > > -  AsmWriteIdtr (&IdtDescriptor);
> > > > > -
> > > > > -  //
> > > > > -  // Update the base address and length of Pei temporary memory
> > > > > -  //
> > > > > -  SecCoreData.DataSize               = (UINT16) sizeof
> > > (EFI_SEC_PEI_HAND_OFF);
> > > > > -  SecCoreData.BootFirmwareVolumeBase = BootFirmwareVolume;
> > > > > -  SecCoreData.BootFirmwareVolumeSize = (UINTN)(SIZE_4GB -
> > > (UINTN)
> > > > BootFirmwareVolume);
> > > > > -  SecCoreData.TemporaryRamBase       = (VOID*)(UINTN)
> > > TempRamBase;
> > > > > -  SecCoreData.TemporaryRamSize       = SizeOfRam;
> > > > > -  SecCoreData.PeiTemporaryRamBase    =
> > > SecCoreData.TemporaryRamBase;
> > > > > -  SecCoreData.PeiTemporaryRamSize    = SizeOfRam -
> PeiStackSize;
> > > > > -  SecCoreData.StackBase              =
> > > (VOID*)(UINTN)(TempRamBase +
> > > > > SecCoreData.PeiTemporaryRamSize);
> > > > > -  SecCoreData.StackSize              = PeiStackSize;
> > > > > -
> > > > > -  DEBUG ((DEBUG_INFO, "BootFirmwareVolumeBase - 0x%x\n",
> > > > > SecCoreData.BootFirmwareVolumeBase));
> > > > > -  DEBUG ((DEBUG_INFO, "BootFirmwareVolumeSize - 0x%x\n",
> > > > > SecCoreData.BootFirmwareVolumeSize));
> > > > > -  DEBUG ((DEBUG_INFO, "TemporaryRamBase       - 0x%x\n",
> > > > > SecCoreData.TemporaryRamBase));
> > > > > -  DEBUG ((DEBUG_INFO, "TemporaryRamSize       - 0x%x\n",
> > > > > SecCoreData.TemporaryRamSize));
> > > > > -  DEBUG ((DEBUG_INFO, "PeiTemporaryRamBase    - 0x%x\n",
> > > > > SecCoreData.PeiTemporaryRamBase));
> > > > > -  DEBUG ((DEBUG_INFO, "PeiTemporaryRamSize    - 0x%x\n",
> > > > > SecCoreData.PeiTemporaryRamSize));
> > > > > -  DEBUG ((DEBUG_INFO, "StackBase              - 0x%x\n",
> > > SecCoreData.StackBase));
> > > > > -  DEBUG ((DEBUG_INFO, "StackSize              - 0x%x\n",
> > > SecCoreData.StackSize));
> > > > > -
> > > > > -  //
> > > > > -  // Initialize Debug Agent to support source level debug in SEC/PEI
> > > phases before
> > > > > memory ready.
> > > > > -  //
> > > > > -  InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC,
> > > &SecCoreData,
> > > > SecStartupPhase2);
> > > > > -
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  This API patch the TopOfTemporaryRam value in SecPpiList.
> > > > > -
> > > > > -  @param[in,out] SecPpiList           PPI list to be patched.
> > > > > -  @param[in]     TopOfTemporaryRam    The top of Temporary
> > > Ram.
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -PatchTopOfTemporaryRamPpi (
> > > > > -  IN OUT EFI_PEI_PPI_DESCRIPTOR *SecPpiList,
> > > > > -  IN VOID                       *TopOfTemporaryRam
> > > > > -  )
> > > > > -{
> > > > > -  SecPpiList[0].Ppi = TopOfTemporaryRam;
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Caller provided function to be invoked at the end of
> > > InitializeDebugAgent().
> > > > > -
> > > > > -  Entry point to the C language phase of SEC. After the SEC
> assembly
> > > > > -  code has initialized some temporary memory and set up the stack,
> > > > > -  the control is transferred to this function.
> > > > > -
> > > > > -  @param[in] Context    The first input parameter of
> > > InitializeDebugAgent().
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -SecStartupPhase2(
> > > > > -  IN VOID                     *Context
> > > > > -  )
> > > > > -{
> > > > > -  EFI_SEC_PEI_HAND_OFF        *SecCoreData;
> > > > > -  EFI_PEI_PPI_DESCRIPTOR      *PpiList;
> > > > > -  UINT32                      Index;
> > > > > -  EFI_PEI_PPI_DESCRIPTOR
> > > > > LocalSecPpiList[sizeof(mPeiSecMainPpi)/sizeof(mPeiSecMainPpi[0])];
> > > > > -  EFI_PEI_PPI_DESCRIPTOR
> > > > AllSecPpiList[FixedPcdGet32(PcdSecCoreMaxPpiSupported)];
> > > > > -  EFI_PEI_CORE_ENTRY_POINT    PeiCoreEntryPoint;
> > > > > -
> > > > > -  SecCoreData = (EFI_SEC_PEI_HAND_OFF *) Context;
> > > > > -  //
> > > > > -  // Find Pei Core entry point. It will report SEC and Pei Core debug
> > > information if
> > > > > remote debug
> > > > > -  // is enabled.
> > > > > -  //
> > > > > -  FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *)
> > > SecCoreData-
> > > > > >BootFirmwareVolumeBase, &PeiCoreEntryPoint);
> > > > > -  if (PeiCoreEntryPoint == NULL)
> > > > > -  {
> > > > > -    CpuDeadLoop ();
> > > > > -  }
> > > > > -
> > > > > -  CopyMem (LocalSecPpiList, mPeiSecMainPpi,
> > > sizeof(mPeiSecMainPpi));
> > > > > -  PatchTopOfTemporaryRamPpi (LocalSecPpiList, (VOID
> > > *)((UINTN)SecCoreData-
> > > > > >TemporaryRamBase + SecCoreData->TemporaryRamSize));
> > > > > -
> > > > > -  //
> > > > > -  // Perform platform specific initialization before entering 
> > > > > PeiCore.
> > > > > -  //
> > > > > -  PpiList = SecPlatformMain (SecCoreData);
> > > > > -  if (PpiList != NULL) {
> > > > > -    //
> > > > > -    // Remove the terminal flag from the terminal Ppi
> > > > > -    //
> > > > > -    CopyMem (AllSecPpiList, LocalSecPpiList, sizeof
> > (LocalSecPpiList));
> > > > > -    for (Index = 0; Index < PcdGet32 (PcdSecCoreMaxPpiSupported);
> > > Index ++) {
> > > > > -      if ((AllSecPpiList[Index].Flags &
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
> > > > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
> > > > > -        break;
> > > > > -      }
> > > > > -    }
> > > > > -    AllSecPpiList[Index].Flags = AllSecPpiList[Index].Flags &
> > > > > (~EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
> > > > > -
> > > > > -    //
> > > > > -    // Append the platform additional Ppi list
> > > > > -    //
> > > > > -    Index += 1;
> > > > > -    while (Index < PcdGet32 (PcdSecCoreMaxPpiSupported) &&
> > > > > -           ((PpiList->Flags &
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) !=
> > > > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST)) {
> > > > > -      CopyMem (&AllSecPpiList[Index], PpiList, sizeof
> > > (EFI_PEI_PPI_DESCRIPTOR));
> > > > > -      Index++;
> > > > > -      PpiList++;
> > > > > -    }
> > > > > -
> > > > > -    //
> > > > > -    // Check whether the total Ppis exceeds the max supported Ppi.
> > > > > -    //
> > > > > -    if (Index >= PcdGet32 (PcdSecCoreMaxPpiSupported)) {
> > > > > -      //
> > > > > -      // the total Ppi is larger than the supported Max
> > > > > -      // PcdSecCoreMaxPpiSupported can be enlarged to solve it.
> > > > > -      //
> > > > > -      CpuDeadLoop ();
> > > > > -    } else {
> > > > > -      //
> > > > > -      // Add the terminal Ppi
> > > > > -      //
> > > > > -      CopyMem (&AllSecPpiList[Index], PpiList, sizeof
> > > (EFI_PEI_PPI_DESCRIPTOR));
> > > > > -    }
> > > > > -
> > > > > -    //
> > > > > -    // Set PpiList to the total Ppi
> > > > > -    //
> > > > > -    PpiList = &AllSecPpiList[0];
> > > > > -  } else {
> > > > > -    //
> > > > > -    // No addition Ppi, PpiList directly point to the common Ppi 
> > > > > list.
> > > > > -    //
> > > > > -    PpiList = &LocalSecPpiList[0];
> > > > > -  }
> > > > > -
> > > > > -  //
> > > > > -  // Transfer the control to the PEI core
> > > > > -  //
> > > > > -  ASSERT (PeiCoreEntryPoint != NULL);
> > > > > -  (*PeiCoreEntryPoint) (SecCoreData, PpiList);
> > > > > -
> > > > > -  //
> > > > > -  // Should not come here.
> > > > > -  //
> > > > > -  return ;
> > > > > -}
> > > > > -
> > > > > -/**
> > > > > -  Return Hob list produced by FSP.
> > > > > -
> > > > > -  @param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > -  @param[in]  This         The pointer to this instance of this
> PPI.
> > > > > -  @param[out] FspHobList   The pointer to Hob list produced by
> > FSP.
> > > > > -
> > > > > -  @return EFI_SUCCESS FReturn Hob list produced by FSP
> successfully.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FspInitDoneGetFspHobList (
> > > > > -  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > -  IN  FSP_INIT_DONE_PPI              *This,
> > > > > -  OUT VOID                           **FspHobList
> > > > > -  )
> > > > > -{
> > > > > -  VOID        *TopOfTemporaryRamPpi;
> > > > > -  EFI_STATUS  Status;
> > > > > -
> > > > > -  Status = (*PeiServices)->LocatePpi (
> > > > > -                             PeiServices,
> > > > > -                             &gTopOfTemporaryRamPpiGuid,
> > > > > -                             0,
> > > > > -                             NULL,
> > > > > -                             (VOID **)
> > &TopOfTemporaryRamPpi
> > > > > -                             );
> > > > > -  if (EFI_ERROR (Status)) {
> > > > > -    return EFI_NOT_FOUND;
> > > > > -  }
> > > > > -
> > > > > -  *FspHobList = (VOID *)(UINTN)(*(UINT32
> > > *)((UINTN)TopOfTemporaryRamPpi -
> > > > > sizeof(UINT32)));
> > > > > -
> > > > > -  return EFI_SUCCESS;
> > > > > -}
> > > > > -
> > > > > diff --git a/IntelFspWrapperPkg/FspInitPei/SecMain.h
> > > > > b/IntelFspWrapperPkg/FspInitPei/SecMain.h
> > > > > deleted file mode 100644
> > > > > index fc20397..0000000
> > > > > --- a/IntelFspWrapperPkg/FspInitPei/SecMain.h
> > > > > +++ /dev/null
> > > > > @@ -1,116 +0,0 @@
> > > > > -/** @file
> > > > > -  Master header file for SecCore.
> > > > > -
> > > > > -  Copyright (c) 2014, 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
> > > > > -  http://opensource.org/licenses/bsd-license.php.
> > > > > -
> > > > > -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > -
> > > > > -**/
> > > > > -
> > > > > -#ifndef _SEC_CORE_H_
> > > > > -#define _SEC_CORE_H_
> > > > > -
> > > > > -
> > > > > -#include <PiPei.h>
> > > > > -
> > > > > -#include <Ppi/TopOfTemporaryRam.h>
> > > > > -#include <Ppi/FspInitDone.h>
> > > > > -
> > > > > -#include <Library/BaseLib.h>
> > > > > -#include <Library/DebugLib.h>
> > > > > -#include <Library/PcdLib.h>
> > > > > -#include <Library/BaseMemoryLib.h>
> > > > > -#include <Library/FspPlatformSecLib.h>
> > > > > -#include <Library/FspPlatformInfoLib.h>
> > > > > -#include <Library/UefiCpuLib.h>
> > > > > -#include <Library/PeCoffGetEntryPointLib.h>
> > > > > -#include <Library/PeCoffExtraActionLib.h>
> > > > > -#include <Library/DebugAgentLib.h>
> > > > > -
> > > > > -#include <FspApi.h>
> > > > > -#include <FspInfoHeader.h>
> > > > > -
> > > > > -#define SEC_IDT_ENTRY_COUNT  34
> > > > > -
> > > > > -typedef struct _SEC_IDT_TABLE {
> > > > > -  //
> > > > > -  // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**,
> > since
> > > IDT base
> > > > > -  // address should be 8-byte alignment.
> > > > > -  // Note: For IA32, only the 4 bytes immediately preceding IDT is
> > used
> > > to store
> > > > > -  // EFI_PEI_SERVICES**
> > > > > -  //
> > > > > -  UINT64            PeiService;
> > > > > -  UINT64            IdtTable[SEC_IDT_ENTRY_COUNT];
> > > > > -} SEC_IDT_TABLE;
> > > > > -
> > > > > -/**
> > > > > -  Entry point to the C language phase of SEC. After the SEC
> assembly
> > > > > -  code has initialized some temporary memory and set up the stack,
> > > > > -  the control is transferred to this function.
> > > > > -
> > > > > -  @param[in] SizeOfRam           Size of the temporary
> memory
> > > available for use.
> > > > > -  @param[in] TempRamBase         Base address of tempory
> ram
> > > > > -  @param[in] BootFirmwareVolume  Base address of the Boot
> > > Firmware Volume.
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -SecStartup (
> > > > > -  IN UINT32                   SizeOfRam,
> > > > > -  IN UINT32                   TempRamBase,
> > > > > -  IN VOID                     *BootFirmwareVolume
> > > > > -  );
> > > > > -
> > > > > -/**
> > > > > -  Find and return Pei Core entry point.
> > > > > -
> > > > > -  It also find SEC and PEI Core file debug inforamtion. It will 
> > > > > report
> > > them if
> > > > > -  remote debug is enabled.
> > > > > -
> > > > > -  @param[in]  BootFirmwareVolumePtr  Point to the boot
> > firmware
> > > volume.
> > > > > -  @param[out] PeiCoreEntryPoint      Point to the PEI core entry
> > > point.
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -FindAndReportEntryPoints (
> > > > > -  IN  EFI_FIRMWARE_VOLUME_HEADER
> > > *BootFirmwareVolumePtr,
> > > > > -  OUT EFI_PEI_CORE_ENTRY_POINT         *PeiCoreEntryPoint
> > > > > -  );
> > > > > -
> > > > > -/**
> > > > > -  Autogenerated function that calls the library constructors for all
> of
> > > the module's
> > > > > -  dependent libraries.  This function must be called by the SEC Core
> > > once a stack
> > > > has
> > > > > -  been established.
> > > > > -
> > > > > -**/
> > > > > -VOID
> > > > > -EFIAPI
> > > > > -ProcessLibraryConstructorList (
> > > > > -  VOID
> > > > > -  );
> > > > > -
> > > > > -/**
> > > > > -  Return Hob list produced by FSP.
> > > > > -
> > > > > -  @param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > -  @param[in]  This         The pointer to this instance of this
> PPI.
> > > > > -  @param[out] FspHobList   The pointer to Hob list produced by
> > FSP.
> > > > > -
> > > > > -  @return EFI_SUCCESS FReturn Hob list produced by FSP
> successfully.
> > > > > -**/
> > > > > -EFI_STATUS
> > > > > -EFIAPI
> > > > > -FspInitDoneGetFspHobList (
> > > > > -  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > -  IN  FSP_INIT_DONE_PPI              *This,
> > > > > -  OUT VOID                           **FspHobList
> > > > > -  );
> > > > > -
> > > > > -extern FSP_INIT_DONE_PPI gFspInitDonePpi;
> > > > > -
> > > > > -#endif
> > > > > diff --git
> > a/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> > > > > b/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> > > > > new file mode 100644
> > > > > index 0000000..4370fde
> > > > > --- /dev/null
> > > > > +++ b/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> > > > > @@ -0,0 +1,161 @@
> > > > > +/** @file
> > > > > +  This will be invoked only once. It will call FspMemoryInit API,
> > > > > +  register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > +  notify to call FspSiliconInit API.
> > > > > +
> > > > > +  Copyright (c) 2014 - 2016, 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
> > > > > +  http://opensource.org/licenses/bsd-license.php.
> > > > > +
> > > > > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > +
> > > > > +**/
> > > > > +
> > > > > +
> > > > > +#include <PiPei.h>
> > > > > +
> > > > > +#include <Library/PeimEntryPoint.h>
> > > > > +#include <Library/PeiServicesLib.h>
> > > > > +#include <Library/PeiServicesTablePointerLib.h>
> > > > > +#include <Library/BaseLib.h>
> > > > > +#include <Library/DebugLib.h>
> > > > > +#include <Library/BaseMemoryLib.h>
> > > > > +#include <Library/MemoryAllocationLib.h>
> > > > > +#include <Library/HobLib.h>
> > > > > +#include <Library/PcdLib.h>
> > > > > +#include <Library/TimerLib.h>
> > > > > +#include <Library/PerformanceLib.h>
> > > > > +#include <Library/FspWrapperPlatformLib.h>
> > > > > +#include <Library/FspWrapperHobProcessLib.h>
> > > > > +#include <Library/FspWrapperApiLib.h>
> > > > > +
> > > > > +#include <Ppi/FspSiliconInitDone.h>
> > > > > +#include <Ppi/EndOfPeiPhase.h>
> > > > > +#include <Ppi/MemoryDiscovered.h>
> > > > > +#include <Ppi/SecPlatformInformation.h>
> > > > > +#include <Library/PlatformSecLib.h>
> > > > > +#include <Library/FspWrapperApiTestLib.h>
> > > > > +#include <FspApi.h>
> > > > > +
> > > > > +extern EFI_GUID gFspHobGuid;
> > > > > +
> > > > > +/**
> > > > > +  Call FspMemoryInit API.
> > > > > +
> > > > > +  @return Status returned by FspMemoryInit API.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +PeiFspMemoryInit (
> > > > > +  VOID
> > > > > +  )
> > > > > +{
> > > > > +  FSP_INFO_HEADER           *FspmHeaderPtr;
> > > > > +  EFI_STATUS                Status;
> > > > > +  UINT64                    TimeStampCounterStart;
> > > > > +  VOID                      *FspHobListPtr;
> > > > > +  VOID                      *HobData;
> > > > > +  FSPM_UPD_COMMON           *FspmUpdDataPtr;
> > > > > +  UINTN                     *SourceData;
> > > > > +
> > > > > +  DEBUG ((DEBUG_INFO, "PeiFspMemoryInit enter\n"));
> > > > > +
> > > > > +  FspHobListPtr = NULL;
> > > > > +
> > > > > +  //
> > > > > +  // Copy default FSP-M UPD data from Flash
> > > > > +  //
> > > > > +  FspmHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader
> > (PcdGet32
> > > > (PcdFspmBaseAddress));
> > > > > +  FspmUpdDataPtr = (FSPM_UPD_COMMON *)AllocateZeroPool
> > > ((UINTN)FspmHeaderPtr-
> > > > > >CfgRegionSize);
> > > > > +  ASSERT (FspmUpdDataPtr != NULL);
> > > > > +  SourceData = (UINTN *)((UINTN)FspmHeaderPtr->ImageBase +
> > > (UINTN)FspmHeaderPtr-
> > > > > >CfgRegionOffset);
> > > > > +  CopyMem (FspmUpdDataPtr, SourceData,
> > > (UINTN)FspmHeaderPtr->CfgRegionSize);
> > > > > +
> > > > > +  DEBUG ((DEBUG_INFO, "FspWrapperPlatformInitPreMem
> > enter\n"));
> > > > > +  UpdateFspmUpdData ((VOID *)FspmUpdDataPtr);
> > > > > +  DEBUG ((DEBUG_INFO, "  NvsBufferPtr        - 0x%x\n",
> > > FspmUpdDataPtr-
> > > > > >FspmArchUpd.NvsBufferPtr));
> > > > > +  DEBUG ((DEBUG_INFO, "  StackBase           - 0x%x\n",
> > > FspmUpdDataPtr-
> > > > > >FspmArchUpd.StackBase));
> > > > > +  DEBUG ((DEBUG_INFO, "  StackSize           - 0x%x\n",
> > > FspmUpdDataPtr-
> > > > > >FspmArchUpd.StackSize));
> > > > > +  DEBUG ((DEBUG_INFO, "  BootLoaderTolumSize - 0x%x\n",
> > > FspmUpdDataPtr-
> > > > > >FspmArchUpd.BootLoaderTolumSize));
> > > > > +  DEBUG ((DEBUG_INFO, "  BootMode            - 0x%x\n",
> > > FspmUpdDataPtr-
> > > > > >FspmArchUpd.BootMode));
> > > > > +  DEBUG ((DEBUG_INFO, "  HobListPtr          - 0x%x\n",
> > > &FspHobListPtr));
> > > > > +
> > > > > +  TimeStampCounterStart = AsmReadTsc ();
> > > > > +  Status = CallFspMemoryInit (FspmUpdDataPtr, &FspHobListPtr);
> > > > > +  // @note: Create hobs after memory initialization and not in temp
> > > RAM. Hence
> > > > passing
> > > > > the recorded timestamp here
> > > > > +  PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL,
> > > TimeStampCounterStart,
> > > > > 0xD000);
> > > > > +  PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0,
> > > 0xD07F);
> > > > > +  DEBUG ((DEBUG_INFO, "Total time spent executing
> > > FspMemoryInitApi: %d
> > > > millisecond\n",
> > > > > DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () -
> > > TimeStampCounterStart), 1000000)));
> > > > > +  if (EFI_ERROR(Status)) {
> > > > > +    DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute
> > > FspMemoryInitApi(), Status =
> > > > > %r\n", Status));
> > > > > +  }
> > > > > +  DEBUG((DEBUG_INFO, "FspMemoryInit status: 0x%x\n", Status));
> > > > > +  ASSERT_EFI_ERROR (Status);
> > > > > +
> > > > > +
> > > > > +  Status = TestFspMemoryInitApiOutput (FspmUpdDataPtr,
> > > &FspHobListPtr);
> > > > > +  if (EFI_ERROR (Status)) {
> > > > > +    DEBUG ((DEBUG_ERROR, "ERROR -
> TestFspMemoryInitApiOutput
> > ()
> > > fail, Status =
> > > > %r\n",
> > > > > Status));
> > > > > +  }
> > > > > +
> > > > > +  DEBUG ((DEBUG_INFO, "  FspHobListPtr (returned) - 0x%x\n",
> > > FspHobListPtr));
> > > > > +  ASSERT (FspHobListPtr != NULL);
> > > > > +
> > > > > +  PostFspmHobProcess (FspHobListPtr);
> > > > > +
> > > > > +  //
> > > > > +  // FspHobList is not complete at this moment.
> > > > > +  // Save FspHobList pointer to hob, so that it can be got later
> > > > > +  //
> > > > > +  HobData = BuildGuidHob (
> > > > > +             &gFspHobGuid,
> > > > > +             sizeof (VOID *)
> > > > > +             );
> > > > > +  ASSERT (HobData != NULL);
> > > > > +  CopyMem (HobData, &FspHobListPtr, sizeof (FspHobListPtr));
> > > > > +
> > > > > +  return Status;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +  Do FSP initialization.
> > > > > +
> > > > > +  @return FSP initialization status.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +FspmWrapperInit (
> > > > > +  VOID
> > > > > +  )
> > > > > +{
> > > > > +  EFI_STATUS           Status;
> > > > > +
> > > > > +  Status = PeiFspMemoryInit ();
> > > > > +  ASSERT_EFI_ERROR (Status);
> > > > > +
> > > > > +  return Status;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +  This is the entrypoint of PEIM
> > > > > +
> > > > > +  @param[in] FileHandle  Handle of the file being invoked.
> > > > > +  @param[in] PeiServices Describes the list of possible PEI Services.
> > > > > +
> > > > > +  @retval EFI_SUCCESS if it completed successfully.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +FspmWrapperPeimEntryPoint (
> > > > > +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> > > > > +  IN CONST EFI_PEI_SERVICES     **PeiServices
> > > > > +  )
> > > > > +{
> > > > > +  DEBUG((DEBUG_INFO, "FspmWrapperPeimEntryPoint\n"));
> > > > > +
> > > > > +  FspmWrapperInit ();
> > > > > +
> > > > > +  return EFI_SUCCESS;
> > > > > +}
> > > > > diff --git
> > > a/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> > > > > b/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> > > > > new file mode 100644
> > > > > index 0000000..55b9679
> > > > > --- /dev/null
> > > > > +++ b/IntelFspWrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> > > > > @@ -0,0 +1,77 @@
> > > > > +## @file
> > > > > +# FSP-M wrapper PEI Module
> > > > > +#
> > > > > +# This PEIM initialize FSP.
> > > > > +# This will be invoked only once. It will call FspMemoryInit API,
> > > > > +# register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > +# notify to call FspSiliconInit API.
> > > > > +#
> > > > > +#  Copyright (c) 2014 - 2016, 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
> > > > > +#  http://opensource.org/licenses/bsd-license.php.
> > > > > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > > "AS IS" BASIS,
> > > > > +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > > EITHER EXPRESS OR IMPLIED.
> > > > > +#
> > > > > +##
> > > > > +
> > > > > +[Defines]
> > > > > +  INF_VERSION                    = 0x00010017
> > > > > +  BASE_NAME                      = FspmWrapperPeim
> > > > > +  FILE_GUID                      =
> > > CCD05B01-8C4E-409D-B6D3-BFB82F175C3A
> > > > > +  VERSION_STRING                 = 1.0
> > > > > +  MODULE_TYPE                    = PEIM
> > > > > +  ENTRY_POINT                    =
> > > FspmWrapperPeimEntryPoint
> > > > > +
> > > > > +#
> > > > > +# The following information is for reference only and not required
> by
> > > the build
> > > > tools.
> > > > > +#
> > > > > +#  VALID_ARCHITECTURES           = IA32
> > > > > +#
> > > > > +
> > > > > +[LibraryClasses]
> > > > > +  PeimEntryPoint
> > > > > +  PeiServicesLib
> > > > > +  PeiServicesTablePointerLib
> > > > > +  BaseLib
> > > > > +  BaseMemoryLib
> > > > > +  MemoryAllocationLib
> > > > > +  DebugLib
> > > > > +  HobLib
> > > > > +  FspWrapperPlatformLib
> > > > > +  FspWrapperHobProcessLib
> > > > > +  DebugAgentLib
> > > > > +  UefiCpuLib
> > > > > +  PeCoffGetEntryPointLib
> > > > > +  PeCoffExtraActionLib
> > > > > +  PerformanceLib
> > > > > +  TimerLib
> > > > > +  FspWrapperApiLib
> > > > > +  FspWrapperApiTestLib
> > > > > +
> > > > > +[Packages]
> > > > > +  MdePkg/MdePkg.dec
> > > > > +  MdeModulePkg/MdeModulePkg.dec
> > > > > +  UefiCpuPkg/UefiCpuPkg.dec
> > > > > +  IntelFspPkg/IntelFspPkg.dec
> > > > > +  IntelFspWrapperPkg/IntelFspWrapperPkg.dec
> > > > > +
> > > > > +[Pcd]
> > > > > +  gFspWrapperTokenSpaceGuid.PcdFspmBaseAddress
> > > ## CONSUMES
> > > > > +
> > > > > +[Sources]
> > > > > +  FspmWrapperPeim.c
> > > > > +
> > > > > +[Ppis]
> > > > > +  gTopOfTemporaryRamPpiGuid             ## PRODUCES
> > > > > +  gEfiEndOfPeiSignalPpiGuid             ## PRODUCES
> > > > > +  gEfiPeiMemoryDiscoveredPpiGuid        ## PRODUCES
> > > > > +
> > > > > +[Guids]
> > > > > +  gFspHobGuid                           ## PRODUCES ##
> > HOB
> > > > > +  gFspApiPerformanceGuid                ## CONSUMES ##
> > GUID
> > > > > +
> > > > > +[Depex]
> > > > > +  gEfiPeiMasterBootModePpiGuid
> > > > > diff --git
> a/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> > > > > b/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> > > > > new file mode 100644
> > > > > index 0000000..8dfb311
> > > > > --- /dev/null
> > > > > +++ b/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> > > > > @@ -0,0 +1,313 @@
> > > > > +/** @file
> > > > > +  This will be invoked only once. It will call FspMemoryInit API,
> > > > > +  register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > +  notify to call FspSiliconInit API.
> > > > > +
> > > > > +  Copyright (c) 2014 - 2016, 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
> > > > > +  http://opensource.org/licenses/bsd-license.php.
> > > > > +
> > > > > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > "AS
> > > IS" BASIS,
> > > > > +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > EITHER
> > > EXPRESS OR IMPLIED.
> > > > > +
> > > > > +**/
> > > > > +
> > > > > +#include <PiPei.h>
> > > > > +
> > > > > +#include <Library/PeimEntryPoint.h>
> > > > > +#include <Library/PeiServicesLib.h>
> > > > > +#include <Library/PeiServicesTablePointerLib.h>
> > > > > +#include <Library/BaseLib.h>
> > > > > +#include <Library/DebugLib.h>
> > > > > +#include <Library/BaseMemoryLib.h>
> > > > > +#include <Library/HobLib.h>
> > > > > +#include <Library/PcdLib.h>
> > > > > +#include <Library/MemoryAllocationLib.h>
> > > > > +#include <Library/FspWrapperPlatformLib.h>
> > > > > +#include <Library/FspWrapperHobProcessLib.h>
> > > > > +#include <Library/TimerLib.h>
> > > > > +#include <Library/PerformanceLib.h>
> > > > > +#include <Library/FspWrapperApiLib.h>
> > > > > +
> > > > > +#include <Ppi/FspSiliconInitDone.h>
> > > > > +#include <Ppi/EndOfPeiPhase.h>
> > > > > +#include <Ppi/MemoryDiscovered.h>
> > > > > +#include <Ppi/TemporaryRamDone.h>
> > > > > +#include <Ppi/SecPlatformInformation.h>
> > > > > +#include <Library/PlatformSecLib.h>
> > > > > +#include <Library/FspWrapperApiTestLib.h>
> > > > > +#include <FspApi.h>
> > > > > +
> > > > > +extern EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc;
> > > > > +extern EFI_GUID                  gFspHobGuid;
> > > > > +
> > > > > +/**
> > > > > +This function handles S3 resume task at the end of PEI
> > > > > +
> > > > > +@param[in] PeiServices    Pointer to PEI Services Table.
> > > > > +@param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event that
> > > > > +caused this function to execute.
> > > > > +@param[in] Ppi            Pointer to the PPI data associated
> with
> > > this function.
> > > > > +
> > > > > +@retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +S3EndOfPeiNotify(
> > > > > +  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > +  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > +  IN VOID                      *Ppi
> > > > > +  );
> > > > > +
> > > > > +EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {
> > > > > +  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> > > > > +  &gEfiEndOfPeiSignalPpiGuid,
> > > > > +  S3EndOfPeiNotify
> > > > > +};
> > > > > +
> > > > > +/**
> > > > > +This function handles S3 resume task at the end of PEI
> > > > > +
> > > > > +@param[in] PeiServices    Pointer to PEI Services Table.
> > > > > +@param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event that
> > > > > +caused this function to execute.
> > > > > +@param[in] Ppi            Pointer to the PPI data associated
> with
> > > this function.
> > > > > +
> > > > > +@retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +S3EndOfPeiNotify(
> > > > > +  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > +  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > +  IN VOID                      *Ppi
> > > > > +  )
> > > > > +{
> > > > > +  NOTIFY_PHASE_PARAMS NotifyPhaseParams;
> > > > > +  EFI_STATUS          Status;
> > > > > +
> > > > > +  DEBUG((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
> > > > > +
> > > > > +  NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
> > > > > +  Status = CallFspNotifyPhase (&NotifyPhaseParams);
> > > > > +  DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration
> > > status: 0x%x\n",
> > > > Status));
> > > > > +
> > > > > +  NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
> > > > > +  Status = CallFspNotifyPhase (&NotifyPhaseParams);
> > > > > +  DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status:
> > > 0x%x\n", Status));
> > > > > +
> > > > > +  NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;
> > > > > +  Status = CallFspNotifyPhase (&NotifyPhaseParams);
> > > > > +  DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware
> status:
> > > 0x%x\n", Status));
> > > > > +
> > > > > +  return EFI_SUCCESS;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +Return Hob list produced by FSP.
> > > > > +
> > > > > +@param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > +@param[in]  This         The pointer to this instance of this PPI.
> > > > > +@param[out] FspHobList   The pointer to Hob list produced by FSP.
> > > > > +
> > > > > +@return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +FspSiliconInitDoneGetFspHobList (
> > > > > +  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > +  IN  FSP_SILICON_INIT_DONE_PPI      *This,
> > > > > +  OUT VOID                           **FspHobList
> > > > > +  );
> > > > > +
> > > > > +FSP_SILICON_INIT_DONE_PPI mFspSiliconInitDonePpi = {
> > > > > +  FspSiliconInitDoneGetFspHobList
> > > > > +};
> > > > > +
> > > > > +EFI_PEI_PPI_DESCRIPTOR            mPeiFspSiliconInitDonePpi =
> {
> > > > > +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> > > > > +  &gFspSiliconInitDonePpiGuid,
> > > > > +  &mFspSiliconInitDonePpi
> > > > > +};
> > > > > +
> > > > > +/**
> > > > > +Return Hob list produced by FSP.
> > > > > +
> > > > > +@param[in]  PeiServices  The pointer to the PEI Services Table.
> > > > > +@param[in]  This         The pointer to this instance of this PPI.
> > > > > +@param[out] FspHobList   The pointer to Hob list produced by FSP.
> > > > > +
> > > > > +@return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +FspSiliconInitDoneGetFspHobList (
> > > > > +  IN  CONST EFI_PEI_SERVICES         **PeiServices,
> > > > > +  IN  FSP_SILICON_INIT_DONE_PPI      *This,
> > > > > +  OUT VOID                           **FspHobList
> > > > > +  )
> > > > > +{
> > > > > +  EFI_HOB_GUID_TYPE                  *GuidHob;
> > > > > +
> > > > > +  GuidHob = GetFirstGuidHob (&gFspHobGuid);
> > > > > +  if (GuidHob != NULL) {
> > > > > +    *FspHobList = *(VOID **)GET_GUID_HOB_DATA(GuidHob);
> > > > > +    return EFI_SUCCESS;
> > > > > +  } else {
> > > > > +    return EFI_NOT_FOUND;
> > > > > +  }
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +  This function is called after PEI core discover memory and finish
> > > migration.
> > > > > +
> > > > > +  @param[in] PeiServices    Pointer to PEI Services Table.
> > > > > +  @param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event
> > > > that
> > > > > +                            caused this function to execute.
> > > > > +  @param[in] Ppi            Pointer to the PPI data associated
> > with
> > > this function.
> > > > > +
> > > > > +  @retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +PeiMemoryDiscoveredNotify (
> > > > > +  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > +  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > +  IN VOID                      *Ppi
> > > > > +  );
> > > > > +
> > > > > +EFI_PEI_NOTIFY_DESCRIPTOR mPeiMemoryDiscoveredNotifyDesc =
> {
> > > > > +  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
> > > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> > > > > +  &gEfiPeiMemoryDiscoveredPpiGuid,
> > > > > +  PeiMemoryDiscoveredNotify
> > > > > +};
> > > > > +
> > > > > +/**
> > > > > +This function is called after PEI core discover memory and finish
> > > migration.
> > > > > +
> > > > > +@param[in] PeiServices    Pointer to PEI Services Table.
> > > > > +@param[in] NotifyDesc     Pointer to the descriptor for the
> > > Notification event that
> > > > > +caused this function to execute.
> > > > > +@param[in] Ppi            Pointer to the PPI data associated
> with
> > > this function.
> > > > > +
> > > > > +@retval EFI_STATUS        Always return EFI_SUCCESS
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +PeiMemoryDiscoveredNotify (
> > > > > +  IN EFI_PEI_SERVICES          **PeiServices,
> > > > > +  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
> > > > > +  IN VOID                      *Ppi
> > > > > +  )
> > > > > +{
> > > > > +  FSP_INFO_HEADER           *FspsHeaderPtr;
> > > > > +  UINT64                    TimeStampCounterStart;
> > > > > +  EFI_STATUS                Status;
> > > > > +  VOID                      *FspHobListPtr;
> > > > > +  EFI_HOB_GUID_TYPE         *GuidHob;
> > > > > +  FSPS_UPD_COMMON           *FspsUpdDataPtr;
> > > > > +  UINTN                     *SourceData;
> > > > > +
> > > > > +
> > > > > +  DEBUG ((DEBUG_INFO, "PeiMemoryDiscoveredNotify enter\n"));
> > > > > +
> > > > > +  //
> > > > > +  // Copy default FSP-S UPD data from Flash
> > > > > +  //
> > > > > +  FspsHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader
> (PcdGet32
> > > > (PcdFspsBaseAddress));
> > > > > +  FspsUpdDataPtr = (FSPS_UPD_COMMON *)AllocateZeroPool
> > > ((UINTN)FspsHeaderPtr-
> > > > > >CfgRegionSize);
> > > > > +  ASSERT (FspsUpdDataPtr != NULL);
> > > > > +  SourceData = (UINTN *)((UINTN)FspsHeaderPtr->ImageBase +
> > > (UINTN)FspsHeaderPtr-
> > > > > >CfgRegionOffset);
> > > > > +  CopyMem (FspsUpdDataPtr, SourceData,
> > > (UINTN)FspsHeaderPtr->CfgRegionSize);
> > > > > +
> > > > > +  UpdateFspsUpdData ((VOID *)FspsUpdDataPtr);
> > > > > +
> > > > > +  TimeStampCounterStart = AsmReadTsc ();
> > > > > +  PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0,
> > > 0x9000);
> > > > > +  Status = CallFspSiliconInit ((VOID *)FspsUpdDataPtr);
> > > > > +  PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0,
> > > 0x907F);
> > > > > +  DEBUG ((DEBUG_INFO, "Total time spent executing
> > > FspSiliconInitApi: %d
> > > > > millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () -
> > > > TimeStampCounterStart),
> > > > > 1000000)));
> > > > > +  if (EFI_ERROR(Status)) {
> > > > > +    DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute
> > > FspSiliconInitApi(), Status =
> > > > > %r\n", Status));
> > > > > +  }
> > > > > +  DEBUG((DEBUG_INFO, "FspSiliconInit status: 0x%x\n", Status));
> > > > > +  ASSERT_EFI_ERROR (Status);
> > > > > +
> > > > > +  Status = TestFspSiliconInitApiOutput ((VOID *)NULL);
> > > > > +  if (RETURN_ERROR (Status)) {
> > > > > +    DEBUG ((DEBUG_ERROR, "ERROR - TestFspSiliconInitApiOutput
> ()
> > > fail, Status =
> > > > %r\n",
> > > > > Status));
> > > > > +  }
> > > > > +
> > > > > +  //
> > > > > +  // Now FspHobList complete, process it
> > > > > +  //
> > > > > +  GuidHob = GetFirstGuidHob (&gFspHobGuid);
> > > > > +  ASSERT (GuidHob != NULL);
> > > > > +  FspHobListPtr = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
> > > > > +  DEBUG ((DEBUG_INFO, "FspHobListPtr - 0x%x\n", FspHobListPtr));
> > > > > +  PostFspsHobProcess (FspHobListPtr);
> > > > > +
> > > > > +  //
> > > > > +  // Install FspSiliconInitDonePpi so that any other driver can
> > consume
> > > this info.
> > > > > +  //
> > > > > +  Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
> > > > > +  ASSERT_EFI_ERROR(Status);
> > > > > +
> > > > > +  return Status;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +  Do FSP initialization.
> > > > > +
> > > > > +  @return FSP initialization status.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +FspsWrapperInit (
> > > > > +  VOID
> > > > > +  )
> > > > > +{
> > > > > +  EFI_STATUS           Status;
> > > > > +  EFI_BOOT_MODE        BootMode;
> > > > > +
> > > > > +  //
> > > > > +  // Register MemoryDiscovered Nofity to run FspSiliconInit
> > > > > +  //
> > > > > +  Status = PeiServicesNotifyPpi
> > (&mPeiMemoryDiscoveredNotifyDesc);
> > > > > +  ASSERT_EFI_ERROR (Status);
> > > > > +
> > > > > +  //
> > > > > +  // Register EndOfPei Notify for S3 to run FSP NotifyPhase
> > > > > +  //
> > > > > +  PeiServicesGetBootMode (&BootMode);
> > > > > +  if (BootMode == BOOT_ON_S3_RESUME) {
> > > > > +    Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
> > > > > +    ASSERT_EFI_ERROR (Status);
> > > > > +  }
> > > > > +
> > > > > +  return EFI_SUCCESS;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > +  This is the entrypoint of PEIM
> > > > > +
> > > > > +  @param[in] FileHandle  Handle of the file being invoked.
> > > > > +  @param[in] PeiServices Describes the list of possible PEI Services.
> > > > > +
> > > > > +  @retval EFI_SUCCESS if it completed successfully.
> > > > > +**/
> > > > > +EFI_STATUS
> > > > > +EFIAPI
> > > > > +FspsWrapperPeimEntryPoint (
> > > > > +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> > > > > +  IN CONST EFI_PEI_SERVICES     **PeiServices
> > > > > +  )
> > > > > +{
> > > > > +
> > > > > +  DEBUG ((DEBUG_INFO, "FspsWrapperPeimEntryPoint\n"));
> > > > > +
> > > > > +  FspsWrapperInit ();
> > > > > +
> > > > > +  return EFI_SUCCESS;
> > > > > +}
> > > > > diff --git
> > a/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> > > > > b/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> > > > > new file mode 100644
> > > > > index 0000000..6304dbf
> > > > > --- /dev/null
> > > > > +++ b/IntelFspWrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> > > > > @@ -0,0 +1,79 @@
> > > > > +## @file
> > > > > +# FSP-S wrapper PEI Module
> > > > > +#
> > > > > +# This PEIM initialize FSP.
> > > > > +# This will be invoked only once. It will call FspMemoryInit API,
> > > > > +# register TemporaryRamDonePpi to call TempRamExit API, and
> > register
> > > > > MemoryDiscoveredPpi
> > > > > +# notify to call FspSiliconInit API.
> > > > > +#
> > > > > +#  Copyright (c) 2014 - 2016, 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
> > > > > +#  http://opensource.org/licenses/bsd-license.php.
> > > > > +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
> > > "AS IS" BASIS,
> > > > > +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> > > EITHER EXPRESS OR IMPLIED.
> > > > > +#
> > > > > +##
> > > > > +
> > > > > +[Defines]
> > > > > +  INF_VERSION                    = 0x00010017
> > > > > +  BASE_NAME                      = FspsWrapperPeim
> > > > > +  FILE_GUID                      =
> > > DA516A06-05B6-4C52-9580-A45403EA9E8A
> > > > > +  VERSION_STRING                 = 1.0
> > > > > +  MODULE_TYPE                    = PEIM
> > > > > +  ENTRY_POINT                    =
> > FspsWrapperPeimEntryPoint
> > > > > +
> > > > > +#
> > > > > +# The following information is for reference only and not required
> by
> > > the build
> > > > tools.
> > > > > +#
> > > > > +#  VALID_ARCHITECTURES           = IA32
> > > > > +#
> > > > > +
> > > > > +[LibraryClasses]
> > > > > +  PeimEntryPoint
> > > > > +  PeiServicesLib
> > > > > +  PeiServicesTablePointerLib
> > > > > +  BaseLib
> > > > > +  BaseMemoryLib
> > > > > +  TimerLib
> > > > > +  DebugLib
> > > > > +  HobLib
> > > > > +  MemoryAllocationLib
> > > > > +  FspWrapperPlatformLib
> > > > > +  FspWrapperHobProcessLib
> > > > > +  DebugAgentLib
> > > > > +  UefiCpuLib
> > > > > +  PeCoffGetEntryPointLib
> > > > > +  PeCoffExtraActionLib
> > > > > +  PerformanceLib
> > > > > +  FspWrapperApiLib
> > > > > +  FspWrapperApiTestLib
> > > > > +
> > > > > +[Packages]
> > > > > +  MdePkg/MdePkg.dec
> > > > > +  MdeModulePkg/MdeModulePkg.dec
> > > > > +  UefiCpuPkg/UefiCpuPkg.dec
> > > > > +  IntelFspPkg/IntelFspPkg.dec
> > > > > +  IntelFspWrapperPkg/IntelFspWrapperPkg.dec
> > > > > +
> > > > > +[Ppis]
> > > > > +  gTopOfTemporaryRamPpiGuid             ## PRODUCES
> > > > > +  gFspSiliconInitDonePpiGuid            ## PRODUCES
> > > > > +  gEfiEndOfPeiSignalPpiGuid             ## PRODUCES
> > > > > +  gEfiTemporaryRamDonePpiGuid           ## PRODUCES
> > > > > +  gEfiPeiMemoryDiscoveredPpiGuid        ## PRODUCES
> > > > > +
> > > > > +[Pcd]
> > > > > +  gFspWrapperTokenSpaceGuid.PcdFspsBaseAddress
> > > ## CONSUMES
> > > > > +
> > > > > +[Guids]
> > > > > +  gFspHobGuid                           ## CONSUMES ##
> > HOB
> > > > > +  gFspApiPerformanceGuid                ## CONSUMES ##
> > GUID
> > > > > +
> > > > > +[Sources]
> > > > > +  FspsWrapperPeim.c
> > > > > +
> > > > > +[Depex]
> > > > > +  gEfiPeiMemoryDiscoveredPpiGuid
> > > > > --
> > > > > 2.7.4.windows.1
> > > > >
> > > > > _______________________________________________
> > > > > edk2-devel mailing list
> > > > > [email protected]
> > > > > https://lists.01.org/mailman/listinfo/edk2-devel
> > > > > _______________________________________________
> > > > > edk2-devel mailing list
> > > > > [email protected]
> > > > > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to