public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues
@ 2018-03-28  5:33 Kinney, Michael D
  2018-03-28  5:33 ` [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts Kinney, Michael D
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo, Jiewen Yao, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix a the following issues

* Update build scripts to work when Vlv2Binaries are placed in PACKAGES_PATH
* Fix some compiler build breaks when using VS2015
* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase
* Update PlatformBdsLib to show boot logo when the boot
  mode is BOOT_ON_FLASH_UPDATE.
* Update FLASH libraries to match libraries in the UDK2017
  development branch in edk2-platforms.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (4):
  Vlv2TbltDevicePkg: Fix VS2015 build breaks
  Vlv2TbltDevicePkg: Fix build issues in DSC/FDF
  Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
  Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

Michael D Kinney (1):
  Vlv2TbltDevicePkg: Fix build scripts

 Vlv2TbltDevicePkg/.gitignore                       |   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat                   |   8 +-
 .../PlatformFlashAccessLib.c                       | 491 ++++++++++++++++++++-
 .../PlatformFlashAccessLib.inf                     |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c        | 158 ++++++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf      |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h    |   1 +
 .../Library/PlatformBdsLib/BdsPlatform.c           |  14 +-
 Vlv2TbltDevicePkg/PlatformPkg.fdf                  |  15 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf               |  17 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |  12 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |  12 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |  14 +-
 .../PlatformSetupDxe/SetupInfoRecords.c            |   1 -
 .../SmBiosMiscDxe/MiscProcessorCacheFunction.c     |   6 -
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat            |   2 +-
 .../VlvPlatformInitDxe/VlvPlatformInit.c           |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat                      | 117 ++---
 18 files changed, 775 insertions(+), 123 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/.gitignore

-- 
2.14.2.windows.3



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
@ 2018-03-28  5:33 ` Kinney, Michael D
  2018-03-28  6:48   ` Guo, Mang
  2018-03-28  5:33 ` [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks Kinney, Michael D
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, David Wei, Mang Guo, Jiewen Yao

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update build scripts to work with edk2 and Vlv2Binaries
in PACKAGES_PATH.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/.gitignore            |   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat        |   8 +--
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat           | 117 +++++++++++++++++---------------
 4 files changed, 72 insertions(+), 58 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/.gitignore

diff --git a/Vlv2TbltDevicePkg/.gitignore b/Vlv2TbltDevicePkg/.gitignore
new file mode 100644
index 0000000000..b4699122b8
--- /dev/null
+++ b/Vlv2TbltDevicePkg/.gitignore
@@ -0,0 +1,3 @@
+AutoPlatformCFG.txt
+Stitch/Stitching.log
+Stitch/MNW*.bin
diff --git a/Vlv2TbltDevicePkg/Build_IFWI.bat b/Vlv2TbltDevicePkg/Build_IFWI.bat
index ac22a76b73..c8e3ec3d76 100644
--- a/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ b/Vlv2TbltDevicePkg/Build_IFWI.bat
@@ -1,7 +1,7 @@
 @REM @file
 @REM   Windows batch file to build BIOS ROM
 @REM
-@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+@REM Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 @REM This program and the accompanying materials
 @REM are licensed and made available under the terms and conditions of the BSD License
 @REM which accompanies this distribution.  The full text of the license may be found at
@@ -131,11 +131,11 @@ if %ERRORLEVEL% NEQ 0 (
 echo.
 echo Finished Building BIOS.
 @REM Set BIOS_ID environment variable here.
-call Conf\BiosId.bat
+call %WORKSPACE%\Conf\BiosId.bat
 echo BIOS_ID=%BIOS_ID%
 
 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
-find /v "#" Conf\BiosId.env > ver_strings
+find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
 del /f/q ver_strings >nul
 set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
@@ -149,7 +149,7 @@ if "%Platform_Type%" == "BYTC" (
     pushd %PLATFORM_PACKAGE%\Stitch
 )
    :: IFWIStitch.bat [/nG] [/nM] [/nB] [/B BIOS.rom] [/C StitchConfig] [/S IFWISuffix]
-   call IFWIStitch.bat %Stitch_Flags% /B ..\..\%BIOS_Name% %IFWI_Suffix%
+   call IFWIStitch.bat %Stitch_Flags% /B %WORKSPACE%\%BIOS_Name% %IFWI_Suffix%
    
    @echo off
 popd
diff --git a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
index f3a9cf3d74..5f19983c91 100644
--- a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
+++ b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
@@ -191,7 +191,7 @@ for %%i in (%BIOS_Names%) do (
     echo Generating IFWI... %BIOS_ID%.bin
     echo.
     
-    copy /b/y !IFWI_HEADER_FILE! + ..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + ..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! %BIOS_ID%.bin
+    copy /b/y !IFWI_HEADER_FILE! + %WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + %WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! %BIOS_ID%.bin
     echo.
     echo ===========================================================================
 )
diff --git a/Vlv2TbltDevicePkg/bld_vlv.bat b/Vlv2TbltDevicePkg/bld_vlv.bat
index a1d8c5b525..27bc4e7c41 100644
--- a/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -20,8 +20,8 @@ echo.
 ::**********************************************************************
 :: Initial Setup
 ::**********************************************************************
-set WORKSPACE=%CD%
-if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
+REM set WORKSPACE=%CD%
+REM if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
 set /a build_threads=1
 set "Build_Flags= "
 set exitCode=0
@@ -36,7 +36,7 @@ if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
 if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
 if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
 if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
-if exist conf\.cache rmdir /q/s conf\.cache
+if exist %WORKSPACE%\Conf\.cache rmdir /q/s %WORKSPACE%\Conf\.cache
 
 :: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
 :: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
@@ -48,7 +48,7 @@ set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
 set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
 
-set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
+REM set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
 
 ::create new AutoPlatformCFG.txt file
 copy /y nul %auto_config_inc% >nul
@@ -109,17 +109,17 @@ if "%~1"=="" goto Usage
 
 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
 if "%Arch%"=="IA32" (
-    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
+    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > %WORKSPACE%\Conf\BiosId.env
     echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
 ) else if "%Arch%"=="X64" (
-    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
+    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > %WORKSPACE%\Conf\BiosId.env
     echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
 )
 
 :: -- Build flags settings for each Platform --
 echo Setting  %1  platform configuration and BIOS ID...
 if /i "%~1" == "MNW2" (
-    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
+    echo BOARD_ID = MNW2MAX >> %WORKSPACE%\Conf\BiosId.env
     echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%
     
 ) else (
@@ -130,37 +130,23 @@ set Platform_Type=%~1
 
 if /i "%~2" == "RELEASE" (
     set target=RELEASE
-    echo BUILD_TYPE = R >> Conf\BiosId.env
+    echo BUILD_TYPE = R >> %WORKSPACE%\Conf\BiosId.env
 ) else (
     set target=DEBUG
-    echo BUILD_TYPE = D >> Conf\BiosId.env
+    echo BUILD_TYPE = D >> %WORKSPACE%\Conf\BiosId.env
 )
 
 ::**********************************************************************
-:: Additional EDK Build Setup/Configuration
-::**********************************************************************
-echo.
+:: Additional EDK Build Setup/Configuration
+::**********************************************************************
+echo.
 echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
-if defined VS90COMNTOOLS (
-   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
-   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
-      set TOOL_CHAIN_TAG=VS2008
-   ) else (
-      set TOOL_CHAIN_TAG=VS2008x86
-   )
- ) else if defined VS100COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
-  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
-    set TOOL_CHAIN_TAG=VS2010
+if defined VS140COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
+  if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2015
   ) else (
-    set TOOL_CHAIN_TAG=VS2010x86
-  )
-) else if defined VS110COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
-  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
-    set TOOL_CHAIN_TAG=VS2012
-  ) else (
-    set TOOL_CHAIN_TAG=VS2012x86
+    set TOOL_CHAIN_TAG=VS2015x86
   )
 ) else if defined VS120COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
@@ -169,35 +155,56 @@ if defined VS90COMNTOOLS (
   ) else (
     set TOOL_CHAIN_TAG=VS2013x86
   )
-) else (
-  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
+) else if defined VS110COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
+  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2012
+  ) else (
+    set TOOL_CHAIN_TAG=VS2012x86
+  )
+) else if defined VS100COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
+  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2010
+  ) else (
+    set TOOL_CHAIN_TAG=VS2010x86
+  )
+) else if defined VS90COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
+  if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
+     set TOOL_CHAIN_TAG=VS2008
+  ) else (
+     set TOOL_CHAIN_TAG=VS2008x86
+  )
+) else (
+  echo  --ERROR: VS2008/VS2010/VS2012/VS2013/VS2015 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS/VS140COMMONTOOLS not defined ^^!
   echo.
   goto :BldFail
-)
+)
 
 echo Ensuring correct build directory is present for GenBiosId...
-set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
+set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
 
 echo Modifing Conf files for this build...
 :: Remove lines with these tags from target.txt
-findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
+findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" %WORKSPACE%\Conf\target.txt > %WORKSPACE%\Conf\target.txt.tmp
 
-echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
+echo TARGET          = %TARGET%                                  >> %WORKSPACE%\Conf\target.txt.tmp
 if "%Arch%"=="IA32" (
-    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
+    echo TARGET_ARCH = IA32                                      >> %WORKSPACE%\Conf\target.txt.tmp
 ) else if "%Arch%"=="X64" (
-    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
+    echo TARGET_ARCH = IA32 X64                                  >> %WORKSPACE%\Conf\target.txt.tmp
 )
-echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
-echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
+echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> %WORKSPACE%\Conf\target.txt.tmp
+echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> %WORKSPACE%\Conf\target.txt.tmp
 if %Source% == 0 (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
+  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> %WORKSPACE%\Conf\target.txt.tmp
 ) else (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
+  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> %WORKSPACE%\Conf\target.txt.tmp
 )
-echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp
+echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> %WORKSPACE%\Conf\target.txt.tmp
 
-move /Y Conf\target.txt.tmp Conf\target.txt >nul
+move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >nul
 
 ::**********************************************************************
 :: Build BIOS
@@ -205,11 +212,11 @@ move /Y Conf\target.txt.tmp Conf\target.txt >nul
 
 echo Creating BiosId...
 pushd %PLATFORM_PACKAGE%
-if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
-  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
+if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
+  GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
 if "%Arch%"=="X64" (
-   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
-   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
+   if not exist %BUILD_PATH%\X64  mkdir %BUILD_PATH%\X64
+   GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o %BUILD_PATH%\X64\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
 )
 popd
 
@@ -230,10 +237,10 @@ echo Running fce...
 
 pushd %PLATFORM_PACKAGE%
 :: Extract Hii data from build and store in HiiDefaultData.txt
-fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt
+fce read -i %BUILD_PATH%\FV\Vlv.fd > %BUILD_PATH%\FV\HiiDefaultData.txt
 
 :: save changes to VlvXXX.fd
-fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd
+fce update -i %BUILD_PATH%\FV\Vlv.fd -s %BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Vlv%Arch%.fd
 
 popd
 
@@ -241,7 +248,7 @@ if %ERRORLEVEL% NEQ 0 goto BldFail
 ::echo FD successfully updated with default Hii values.
 
 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
-find /v "#" Conf\BiosId.env > ver_strings
+find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
 del /f/q ver_strings >nul
 
@@ -257,7 +264,11 @@ echo -------------------- The EDKII BIOS build has successfully completed. -----
 echo.
 
 @REM build capsule here
-if "%openssl_path%" == "" goto Exit
+if "%openssl_path%" == "" (
+    echo -- Error:  OPENSSL_PATH not set.  Capule and Recovery images not generated.
+    set exitCode=1
+    goto Exit
+)
 echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
 build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc
 
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
  2018-03-28  5:33 ` [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts Kinney, Michael D
@ 2018-03-28  5:33 ` Kinney, Michael D
  2018-03-28  6:11   ` Wei, David
  2018-03-28  5:33 ` [Patch 3/5] Vlv2TbltDevicePkg: Fix build issues in DSC/FDF Kinney, Michael D
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo, Jiewen Yao, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix minor code issues that break VS2015 builds.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c        | 1 -
 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c | 6 ------
 Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c       | 2 +-
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
index b0e29f02d0..f608651cd4 100644
--- a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
+++ b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
@@ -1185,7 +1185,6 @@ UpdatePlatformInformation (
   EFI_STATUS               Status;
   UINT8                    CpuFlavor=0;
   EFI_PEI_HOB_POINTERS     GuidHob;
-  EFI_PLATFORM_INFO_HOB    *mPlatformInfo=NULL;
   UINTN                    NumHandles;
   EFI_HANDLE                        *HandleBuffer;
   UINTN                             Index;
diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
index b18a6aaa3b..4a83aedc97 100644
--- a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
+++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
@@ -28,12 +28,6 @@ Abstract:
 #include <Protocol/DataHub.h>
 #include <Guid/DataHubRecords.h>
 
-
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL1;
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL2;
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL3;
-
-
 UINT32
 ConvertBase2ToRaw (
   IN  EFI_EXP_BASE2_DATA             *Data)
diff --git a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
index 5e8d95ae9f..f8274e9df0 100644
--- a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
+++ b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
@@ -147,7 +147,7 @@ PostPmInitCallBack (
 EFI_STATUS
 IgdPmHook (
   IN EFI_HANDLE                      ImageHandle,
-  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicy
+  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicyParam
   )
 {
 
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Patch 3/5] Vlv2TbltDevicePkg: Fix build issues in DSC/FDF
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
  2018-03-28  5:33 ` [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts Kinney, Michael D
  2018-03-28  5:33 ` [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks Kinney, Michael D
@ 2018-03-28  5:33 ` Kinney, Michael D
  2018-03-28  5:33 ` [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE Kinney, Michael D
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo, Jiewen Yao, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix a the following issues in DSC/FDF files

* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf       | 15 ++++++++++++---
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf    | 17 +++++++++++++----
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 12 ++++++++----
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 12 ++++++++----
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc    | 14 +++++++++-----
 5 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 846db044b4..85309650db 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -319,7 +319,7 @@ [FV.FVRECOVERY2]
 INF EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
 !endif
 
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+# INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 !if $(TPM_ENABLED) == TRUE
 INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
 INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
@@ -473,6 +473,7 @@ [FV.FVMAIN]
 INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MpCpu.inf
 INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
 INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+INF USE=X64 MdeModulePkg/Logo/Logo.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -612,6 +613,8 @@ [FV.FVMAIN]
 
 INF $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -635,8 +638,8 @@ [FV.FVMAIN]
 #
 # SDIO
 #
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 #
 # IDE/SCSI/AHCI
 #
@@ -1091,6 +1094,12 @@ [Rule.Common.USER_DEFINED]
     RAW BIN                |.bin
   }
 
+[Rule.Common.USER_DEFINED.BINARY]
+  FILE FREEFORM = $(NAMED_GUID) {
+    UI  STRING="$(MODULE_NAME)" Optional
+    RAW BIN                |.bin
+  }
+
 [Rule.Common.USER_DEFINED.ACPITABLE]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW ACPI  Optional            |.acpi
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index 479c4c7264..51a620ea15 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -276,7 +276,7 @@ [FV.FVRECOVERY2]
 INF EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
 !endif
 
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+# INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 !if $(TPM_ENABLED) == TRUE
 INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
 INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
@@ -430,6 +430,7 @@ [FV.FVMAIN]
 INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MpCpu.inf
 INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
 INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+INF USE=X64 MdeModulePkg/Logo/Logo.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -569,6 +570,8 @@ [FV.FVMAIN]
 
 INF $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -592,8 +595,8 @@ [FV.FVMAIN]
 #
 # SDIO
 #
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#INF RuleOverride = BINARY $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 #
 # IDE/SCSI/AHCI
 #
@@ -670,7 +673,7 @@ [FV.FVMAIN]
 #
 FILE APPLICATION = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile) {
 #    SECTION PE32 = EdkShellBinPkg/FullShell/$(EDK_DXE_ARCHITECTURE)/Shell_Full.efi
-   SECTION PE32 = EdkShellBinPkg/MinimumShell/$(EDK_DXE_ARCHITECTURE)/Shell.efi
+    SECTION PE32 = ShellBinPkg/UefiShell/$(EDK_DXE_ARCHITECTURE)/Shell.efi
   }
 
 #
@@ -1052,6 +1055,12 @@ [Rule.Common.USER_DEFINED]
     RAW BIN                |.bin
   }
 
+[Rule.Common.USER_DEFINED.BINARY]
+  FILE FREEFORM = $(NAMED_GUID) {
+    UI  STRING="$(MODULE_NAME)" Optional
+    RAW BIN                |.bin
+  }
+
 [Rule.Common.USER_DEFINED.ACPITABLE]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW ACPI  Optional            |.acpi
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index dc2c5b63e9..f918e44851 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -303,6 +303,8 @@ [LibraryClasses.common]
   FspHobProcessLib|Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.inf
 !endif
 
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
 [LibraryClasses.IA32.SEC]
 !if $(PERFORMANCE_ENABLE) == TRUE
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
@@ -375,7 +377,7 @@ [LibraryClasses.X64]
   HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
 
 [LibraryClasses.X64.DXE_DRIVER]
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -1035,7 +1037,7 @@ [Components.IA32]
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
   $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/MpS3.inf
   EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 
 !if $(RECOVERY_ENABLE)
   #
@@ -1409,6 +1411,8 @@ [Components.X64]
 
   $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -1430,8 +1434,8 @@ [Components.X64]
 #
 # SDIO
 #
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 !if $(ACPI50_ENABLE) == TRUE
   MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf {
     <LibraryClasses>
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 35a51944f3..0a95d95557 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -303,6 +303,8 @@ [LibraryClasses.common]
   FspHobProcessLib|Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.inf
 !endif
 
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
 [LibraryClasses.IA32.SEC]
 !if $(PERFORMANCE_ENABLE) == TRUE
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
@@ -375,7 +377,7 @@ [LibraryClasses.IA32]
   HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
 
 [LibraryClasses.IA32.DXE_DRIVER]
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -1035,7 +1037,7 @@ [Components.IA32]
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
   $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/MpS3.inf
   EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 
 !if $(RECOVERY_ENABLE)
   #
@@ -1397,6 +1399,8 @@ [Components.IA32]
 
   $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -1418,8 +1422,8 @@ [Components.IA32]
 #
 # SDIO
 #
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 !if $(ACPI50_ENABLE) == TRUE
   MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf {
     <LibraryClasses>
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 5fab75c31e..fb2743c727 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -303,6 +303,8 @@ [LibraryClasses.common]
   FspHobProcessLib|Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.inf
 !endif
 
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
 [LibraryClasses.IA32.SEC]
 !if $(PERFORMANCE_ENABLE) == TRUE
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
@@ -375,7 +377,7 @@ [LibraryClasses.X64]
   HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
 
 [LibraryClasses.X64.DXE_DRIVER]
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -698,7 +700,7 @@ [PcdsFixedAtBuild.common]
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|2
 !endif
 
-[PcdsFixedAtBuild.IA32.PEIM, PcdsFixedAtBuild.IA32.PEI_CORE, PcdsFixedAtBuild.IA32.SEC]
+[PcdsFixedAtBuild.IA32]
 !if $(TARGET) == RELEASE
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x3
@@ -1035,7 +1037,7 @@ [Components.IA32]
   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
   $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/MpS3.inf
   EdkCompatibilityPkg/Compatibility/AcpiVariableHobOnSmramReserveHobThunk/AcpiVariableHobOnSmramReserveHobThunk.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PiSmmCommunicationPei.inf
 
 !if $(RECOVERY_ENABLE)
   #
@@ -1409,6 +1411,8 @@ [Components.X64]
 
   $(PLATFORM_PACKAGE)/AcpiPlatform/AcpiPlatform.inf
 
+  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+
   #
   # PCI
   #
@@ -1430,8 +1434,8 @@ [Components.X64]
 #
 # SDIO
 #
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
-  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcHost.inf
+#  $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MmcMediaDevice.inf
 !if $(ACPI50_ENABLE) == TRUE
   MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf {
     <LibraryClasses>
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
                   ` (2 preceding siblings ...)
  2018-03-28  5:33 ` [Patch 3/5] Vlv2TbltDevicePkg: Fix build issues in DSC/FDF Kinney, Michael D
@ 2018-03-28  5:33 ` Kinney, Michael D
  2018-03-28  6:20   ` Wei, David
  2018-03-28  5:33 ` [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch Kinney, Michael D
  2018-03-28  6:10 ` [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Wei, David
  5 siblings, 1 reply; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo, Jiewen Yao, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update PlatformBdsLib to show boot logo when the boot
mode is BOOT_ON_FLASH_UPDATE.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index e42e82b678..c25e1d301a 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2018, Intel Corporation. All rights reserved.<BR>
                                                                                    
   This program and the accompanying materials are licensed and made available under
   the terms and conditions of the BSD License that accompanies this distribution.  
@@ -1871,6 +1871,7 @@ PlatformBdsPolicyBehavior (
     //
     PlatformBdsConnectConsole (gPlatformConsole);
     PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
+    EnableQuietBoot (PcdGetPtr(PcdLogoFile));
 
     DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe......\n"));
     ProcessCapsules ();
@@ -2642,6 +2643,8 @@ PlatformBdsEnterFrontPageWithHotKey (
 {
   EFI_STATUS                    Status;
 
+  EFI_STATUS                         LogoStatus;
+  EFI_BOOT_LOGO_PROTOCOL             *BootLogo;
   EFI_GRAPHICS_OUTPUT_PROTOCOL       *GraphicsOutput;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *SimpleTextOut;
   UINTN                              BootTextColumn;
@@ -2721,6 +2724,14 @@ PlatformBdsEnterFrontPageWithHotKey (
     gST->ConOut->EnableCursor (gST->ConOut, TRUE);
     gST->ConOut->ClearScreen (gST->ConOut);
 
+    //
+    // Boot Logo is corrupted, report it using Boot Logo protocol.
+    //
+    LogoStatus = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
+    if (!EFI_ERROR (LogoStatus) && (BootLogo != NULL)) {
+      BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
+    }
+
     if (EFI_ERROR (Status)) {
       //
       // Timeout or user press enter to continue
@@ -2728,6 +2739,7 @@ PlatformBdsEnterFrontPageWithHotKey (
       goto Exit;
     }
   }
+
   //
   // Install BM HiiPackages. 
   // Keep BootMaint HiiPackage, so that it can be covered by global setting. 
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
                   ` (3 preceding siblings ...)
  2018-03-28  5:33 ` [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE Kinney, Michael D
@ 2018-03-28  5:33 ` Kinney, Michael D
  2018-03-28  7:11   ` Guo, Mang
  2018-03-28  6:10 ` [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Wei, David
  5 siblings, 1 reply; 11+ messages in thread
From: Kinney, Michael D @ 2018-03-28  5:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: David Wei, Mang Guo, Jiewen Yao, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update Minnow Max FLASH libraries to match libraries in
the UDK2017 development branch in edk2-platforms.

https://github.com/tianocore/edk2-platforms/tree/devel-MinnowBoardMax-UDK2017

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../PlatformFlashAccessLib.c                       | 491 ++++++++++++++++++++-
 .../PlatformFlashAccessLib.inf                     |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c        | 158 ++++++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf      |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h    |   1 +
 5 files changed, 639 insertions(+), 36 deletions(-)

diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index f3cb31daaa..9162e025ed 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017, 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
@@ -11,6 +11,7 @@
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
+#include <Uefi.h>
 
 #include <PiDxe.h>
 
@@ -19,14 +20,366 @@
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
 #include <Library/PlatformFlashAccessLib.h>
-#include <Library/FlashDeviceLib.h>
+//#include <Library/FlashDeviceLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Protocol/Spi.h>
+#include <Library/CacheMaintenanceLib.h>
+#include "PchAccess.h"
+#include <Library/IoLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PrintLib.h>
 
-#define SECTOR_SIZE_64KB  0x10000      // Common 64kBytes sector size
-#define ALINGED_SIZE  SECTOR_SIZE_64KB
+//#define SECTOR_SIZE_64KB  0x10000      // Common 64kBytes sector size
+//#define ALINGED_SIZE  SECTOR_SIZE_64KB
+
+#define BLOCK_SIZE 0x1000
+#define ALINGED_SIZE BLOCK_SIZE
+
+#define R_PCH_LPC_BIOS_CNTL                       0xDC
+#define B_PCH_LPC_BIOS_CNTL_SMM_BWP               0x20            ///< SMM BIOS write protect disable
+
+//
+// Prefix Opcode Index on the host SPI controller
+//
+typedef enum {
+  SPI_WREN,             // Prefix Opcode 0: Write Enable
+  SPI_EWSR,             // Prefix Opcode 1: Enable Write Status Register
+} PREFIX_OPCODE_INDEX;
+//
+// Opcode Menu Index on the host SPI controller
+//
+typedef enum {
+  SPI_READ_ID,        // Opcode 0: READ ID, Read cycle with address
+  SPI_READ,           // Opcode 1: READ, Read cycle with address
+  SPI_RDSR,           // Opcode 2: Read Status Register, No address
+  SPI_WRDI_SFDP,      // Opcode 3: Write Disable or Discovery Parameters, No address
+  SPI_SERASE,         // Opcode 4: Sector Erase (4KB), Write cycle with address
+  SPI_BERASE,         // Opcode 5: Block Erase (32KB), Write cycle with address
+  SPI_PROG,           // Opcode 6: Byte Program, Write cycle with address
+  SPI_WRSR,           // Opcode 7: Write Status Register, No address
+} SPI_OPCODE_INDEX;
 
 STATIC EFI_PHYSICAL_ADDRESS     mInternalFdAddress;
 
+EFI_SPI_PROTOCOL  *mSpiProtocol;
+
+/**
+  Read NumBytes bytes of data from the address specified by
+  PAddress into Buffer.
+
+  @param[in]      Address       The starting physical address of the read.
+  @param[in,out]  NumBytes      On input, the number of bytes to read. On output, the number
+                                of bytes actually read.
+  @param[out]     Buffer        The destination data buffer for the read.
+
+  @retval         EFI_SUCCESS       Opertion is successful.
+  @retval         EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashRead (
+  IN     UINTN     Address,
+  IN OUT UINT32    *NumBytes,
+     OUT UINT8     *Buffer
+  )
+{
+  EFI_STATUS    Status = EFI_SUCCESS;
+  UINTN         Offset = 0;
+
+  ASSERT ((NumBytes != NULL) && (Buffer != NULL));
+
+
+  //if (Address >= (UINTN)PcdGet32 (PcdGbeRomBase) && Address < (UINTN)PcdGet32 (PcdPDRRomBase)) {
+    Offset = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+    Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               1, //SPI_READ,
+                               0, //SPI_WREN,
+                               TRUE,
+                               TRUE,
+                               FALSE,
+                               Offset,
+                               BLOCK_SIZE,
+                               Buffer,
+                               EnumSpiRegionAll
+                               );
+    return Status;
+}
+
+/**
+  Write NumBytes bytes of data from Buffer to the address specified by
+  PAddresss.
+
+  @param[in]      Address         The starting physical address of the write.
+  @param[in,out]  NumBytes        On input, the number of bytes to write. On output,
+                                  the actual number of bytes written.
+  @param[in]      Buffer          The source data buffer for the write.
+
+  @retval         EFI_SUCCESS       Opertion is successful.
+  @retval         EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashWrite (
+  IN     UINTN     Address,
+  IN OUT UINT32    *NumBytes,
+  IN     UINT8     *Buffer
+  )
+{
+  EFI_STATUS                Status;
+  UINTN                     Offset;
+  UINT32                    Length;
+  UINT32                    RemainingBytes;
+
+  ASSERT ((NumBytes != NULL) && (Buffer != NULL));
+  ASSERT (Address >= (UINTN)PcdGet32 (PcdFlashChipBase));
+
+  Offset    = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+  ASSERT ((*NumBytes + Offset) <= (UINTN)PcdGet32 (PcdFlashChipSize));
+
+  Status = EFI_SUCCESS;
+  RemainingBytes = *NumBytes;
+
+  while (RemainingBytes > 0) {
+    if (RemainingBytes > SIZE_4KB) {
+      Length = SIZE_4KB;
+    } else {
+      Length = RemainingBytes;
+    }
+    Status = mSpiProtocol->Execute (
+                             mSpiProtocol,
+                             SPI_PROG,
+                             SPI_WREN,
+                             TRUE,
+                             TRUE,
+                             TRUE,
+                             (UINT32) Offset,
+                             Length,
+                             Buffer,
+                             EnumSpiRegionAll
+                             );
+    if (EFI_ERROR (Status)) {
+      break;
+    }
+    RemainingBytes -= Length;
+    Offset += Length;
+    Buffer += Length;
+  }
+
+  //
+  // Actual number of bytes written
+  //
+  *NumBytes -= RemainingBytes;
+
+  return Status;
+}
+
+
+EFI_STATUS
+InternalReadBlock (
+  IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+  OUT VOID                  *ReadBuffer
+  )
+{
+  EFI_STATUS    Status;
+  UINT32        BlockSize;
+
+  BlockSize = BLOCK_SIZE;
+
+  Status = SpiFlashRead ((UINTN) BaseAddress, &BlockSize, ReadBuffer);
+
+  return Status;
+}
+
+/**
+  Erase the block starting at Address.
+
+  @param[in]  Address         The starting physical address of the block to be erased.
+                              This library assume that caller garantee that the PAddress
+                              is at the starting address of this block.
+  @param[in]  NumBytes        On input, the number of bytes of the logical block to be erased.
+                              On output, the actual number of bytes erased.
+
+  @retval     EFI_SUCCESS.      Opertion is successful.
+  @retval     EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashBlockErase (
+  IN UINTN    Address,
+  IN UINTN    *NumBytes
+  )
+{
+  EFI_STATUS          Status;
+  UINTN               Offset;
+  UINTN               RemainingBytes;
+
+  ASSERT (NumBytes != NULL);
+  ASSERT (Address >= (UINTN)PcdGet32 (PcdFlashChipBase));
+
+  Offset    = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+  ASSERT ((*NumBytes % SIZE_4KB) == 0);
+  ASSERT ((*NumBytes + Offset) <= (UINTN)PcdGet32 (PcdFlashChipSize));
+
+  Status = EFI_SUCCESS;
+  RemainingBytes = *NumBytes;
+
+  //
+  // To adjust the Offset with Bios/Gbe
+  //
+//  if (Address >= (UINTN)PcdGet32 (PcdFlashChipBase)) {
+//    Offset = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+    while (RemainingBytes > 0) {
+      Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               SPI_SERASE,
+                               SPI_WREN,
+                               FALSE,
+                               TRUE,
+                               FALSE,
+                               (UINT32) Offset,
+                               0,
+                               NULL,
+                               EnumSpiRegionAll
+                               );
+      if (EFI_ERROR (Status)) {
+        break;
+      }
+      RemainingBytes -= SIZE_4KB;
+      Offset         += SIZE_4KB;
+    }
+//  }
+
+  //
+  // Actual number of bytes erased
+  //
+  *NumBytes -= RemainingBytes;
+
+  return Status;
+}
+
+/**
+
+Routine Description:
+
+  Erase the whole block.
+
+Arguments:
+
+  BaseAddress  - Base address of the block to be erased.
+
+Returns:
+
+  EFI_SUCCESS - The command completed successfully.
+  Other       - Device error or wirte-locked, operation failed.
+
+**/
+EFI_STATUS
+InternalEraseBlock (
+  IN  EFI_PHYSICAL_ADDRESS BaseAddress
+  )
+{
+  EFI_STATUS                              Status;
+  UINTN                                   NumBytes;
+
+  NumBytes = BLOCK_SIZE;
+
+  Status = SpiFlashBlockErase ((UINTN) BaseAddress, &NumBytes);
+
+  return Status;
+}
+
+EFI_STATUS
+InternalCompareBlock (
+  IN  EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN  UINT8                       *Buffer
+  )
+{
+  EFI_STATUS                              Status;
+  VOID                                    *CompareBuffer;
+  UINT32                                  NumBytes;
+  INTN                                    CompareResult;
+
+  NumBytes = BLOCK_SIZE;
+  CompareBuffer = AllocatePool (NumBytes);
+  if (CompareBuffer == NULL) {
+    Status = EFI_OUT_OF_RESOURCES;
+    goto Done;
+  }
+
+  Status = SpiFlashRead ((UINTN) BaseAddress, &NumBytes, CompareBuffer);
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+  CompareResult = CompareMem (CompareBuffer, Buffer, BLOCK_SIZE);
+  if (CompareResult != 0) {
+    Status = EFI_VOLUME_CORRUPTED;
+  }
+
+Done:
+  if (CompareBuffer != NULL) {
+    FreePool (CompareBuffer);
+  }
+
+  return Status;
+}
+
+/**
+
+Routine Description:
+
+  Write a block of data.
+
+Arguments:
+
+  BaseAddress  - Base address of the block.
+  Buffer       - Data buffer.
+  BufferSize   - Size of the buffer.
+
+Returns:
+
+  EFI_SUCCESS           - The command completed successfully.
+  EFI_INVALID_PARAMETER - Invalid parameter, can not proceed.
+  Other                 - Device error or wirte-locked, operation failed.
+
+**/
+EFI_STATUS
+InternalWriteBlock (
+  IN  EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN  UINT8                       *Buffer,
+  IN  UINT32                      BufferSize
+  )
+{
+  EFI_STATUS                              Status;
+
+  Status = SpiFlashWrite ((UINTN) BaseAddress, &BufferSize, Buffer);
+
+  if (EFI_ERROR (Status)) {
+    DEBUG((DEBUG_ERROR, "\nFlash write error."));
+    return Status;
+  }
+
+  WriteBackInvalidateDataCacheRange ((VOID *) (UINTN) BaseAddress, BLOCK_SIZE);
+
+  Status = InternalCompareBlock (BaseAddress, Buffer);
+  if (EFI_ERROR (Status)) {
+    DEBUG((DEBUG_ERROR, "\nError when writing to BaseAddress %x with different at offset %x.", BaseAddress, Status));
+  } else {
+    DEBUG((DEBUG_INFO, "\nVerified data written to Block at %x is correct.", BaseAddress));
+  }
+
+  return Status;
+
+}
+
 /**
   Perform flash write opreation.
 
@@ -51,36 +404,122 @@ PerformFlashWrite (
   IN UINTN                        Length
   )
 {
-  EFI_STATUS          Status;
+  EFI_STATUS            Status = EFI_SUCCESS;
+  UINTN               Index;
+  EFI_PHYSICAL_ADDRESS  Address;
+  UINTN                 CountOfBlocks;
+  EFI_TPL               OldTpl;
+  BOOLEAN               FlashError;
+  UINT8                 *Buf;
+  UINTN                 LpcBaseAddress;
+  UINT8                 Data8Or;
+  UINT8                 Data8And;
+  UINT8                 BiosCntl;
 
-  DEBUG((DEBUG_INFO, "PerformFlashWrite - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
+  Index             = 0;
+  Address           = 0;
+  CountOfBlocks     = 0;
+  FlashError        = FALSE;
+  Buf               = Buffer;
+
+  DEBUG((DEBUG_INFO | DEBUG_ERROR, "PerformFlashWrite - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
   if (FlashAddressType == FlashAddressTypeRelativeAddress) {
     FlashAddress = FlashAddress + mInternalFdAddress;
   }
 
-  DEBUG((DEBUG_INFO, "                  - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
-  LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, FALSE);
+  CountOfBlocks = (UINTN) (Length / BLOCK_SIZE);
+  Address = FlashAddress;
 
+  LpcBaseAddress = MmPciAddress (0,
+                    DEFAULT_PCI_BUS_NUMBER_PCH,
+                    PCI_DEVICE_NUMBER_PCH_LPC,
+                    PCI_FUNCTION_NUMBER_PCH_LPC,
+                    0
+                    );
+  BiosCntl = MmioRead8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL);
+  if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+    ///
+    /// Clear SMM_BWP bit (D31:F0:RegDCh[5])
+    ///
+    Data8And  = (UINT8) ~B_PCH_LPC_BIOS_CNTL_SMM_BWP;
+    Data8Or   = 0x00;
+
+    MmioAndThenOr8 (
+      LpcBaseAddress + R_PCH_LPC_BIOS_CNTL,
+      Data8And,
+      Data8Or
+      );
+    DEBUG((DEBUG_INFO, "PerformFlashWrite Clear SMM_BWP bit\n"));
+  }
+
+    //
+    // Raise TPL to TPL_NOTIFY to block any event handler,
+    // while still allowing RaiseTPL(TPL_NOTIFY) within
+    // output driver during Print()
   //
-  // Erase & Write
-  //
-  Status = LibFvbFlashDeviceBlockErase((UINTN)FlashAddress, Length);
-  ASSERT_EFI_ERROR(Status);
+    OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+    for (Index = 0; Index < CountOfBlocks; Index++) {
+      //
+      // Handle block based on address and contents.
+      //
+      if (!EFI_ERROR (InternalCompareBlock (Address, Buf))) {
+        DEBUG((DEBUG_INFO, "Skipping block at 0x%lx (already programmed)\n", Address));
+      } else {
+        //
+        // Display a dot for each block being updated.
+        //
+        Print (L".");
+
+        //
+        // Make updating process uninterruptable,
+        // so that the flash memory area is not accessed by other entities
+        // which may interfere with the updating process
+        //
+        Status  = InternalEraseBlock (Address);
   if (EFI_ERROR(Status)) {
-    LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
-    DEBUG((DEBUG_ERROR, "Flash Erase error\n"));
-    return Status;
+          gBS->RestoreTPL (OldTpl);
+          FlashError = TRUE;
+          goto Done;
   }
-
-  Status = LibFvbFlashDeviceWrite((UINTN)FlashAddress, &Length, Buffer);
-  ASSERT_EFI_ERROR(Status);
+        Status = InternalWriteBlock (
+                  Address,
+                  Buf,
+                  (UINT32)(Length > BLOCK_SIZE ? BLOCK_SIZE : Length)
+                  );
   if (EFI_ERROR(Status)) {
-    LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
-    DEBUG((DEBUG_ERROR, "Flash write error\n"));
-    return Status;
+          gBS->RestoreTPL (OldTpl);
+          FlashError = TRUE;
+          goto Done;
+        }
   }
 
-  LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
+      //
+      // Move to next block to update.
+      //
+      Address += BLOCK_SIZE;
+      Buf += BLOCK_SIZE;
+      if (Length > BLOCK_SIZE) {
+        Length -= BLOCK_SIZE;
+      } else {
+        Length = 0;
+      }
+    }
+    gBS->RestoreTPL (OldTpl);
+
+  Done:
+  if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+    //
+    // Restore original control setting
+    //
+    MmioWrite8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL, BiosCntl);
+    }
+
+  //
+  // Print flash update failure message if error detected.
+  //
+  if (FlashError) {
+    Print (L"No %r\n", Status);
+  }
 
   return EFI_SUCCESS;
 }
@@ -183,8 +622,16 @@ PerformFlashAccessLibConstructor (
   VOID
   )
 {
+  EFI_STATUS Status;
   mInternalFdAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32(PcdFlashAreaBaseAddress);
   DEBUG((DEBUG_INFO, "PcdFlashAreaBaseAddress - 0x%x\n", mInternalFdAddress));
 
+  Status = gBS->LocateProtocol (
+                  &gEfiSpiProtocolGuid,
+                  NULL,
+                  (VOID **) &mSpiProtocol
+                  );
+  ASSERT_EFI_ERROR(Status);
+
   return EFI_SUCCESS;
 }
diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
index 17ab38e27f..fbbdb91b64 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Platform Flash Access library.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2017, 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
@@ -36,13 +36,26 @@ [Packages]
   MdeModulePkg/MdeModulePkg.dec
   SignedCapsulePkg/SignedCapsulePkg.dec
   Vlv2TbltDevicePkg/PlatformPkg.dec
+  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
+  IoLib
   PcdLib
   DebugLib
-  FlashDeviceLib
+#  FlashDeviceLib
   MemoryAllocationLib
+  CacheMaintenanceLib
+
+[Guids]
+  gEdkiiSystemFmpCapsuleConfigFileGuid          ## SOMETIMES_CONSUMES ## GUID
+
+[Protocols]
+  gEfiSpiProtocolGuid                          ## CONSUMES
 
 [Pcd]
-  gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress
+  gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress  ## SOMETIMES_CONSUMES
+  gPlatformModuleTokenSpaceGuid.PcdFlashChipBase         ## SOMETIMES_CONSUMES
+  gPlatformModuleTokenSpaceGuid.PcdFlashChipSize         ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress      ## SOMETIMES_CONSUMES
+
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
index 8e6e5b4728..392ad1c14b 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
@@ -19,13 +19,14 @@
 #include <Library/FlashDeviceLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeLib.h>
+#include <Protocol/SmmBase2.h>
 #include <Guid/EventGroup.h>
-#include <Library/SpiFlash.H>
+#include "SpiChipDefinitions.h"
 
-#define FLASH_SIZE  0x400000
-
-#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)
 UINTN FlashDeviceBase = FLASH_DEVICE_BASE_ADDRESS;
 
 EFI_SPI_PROTOCOL *mSpiProtocol = NULL;
@@ -77,11 +78,11 @@ SpiFlashBlockErase (
   UINT32              SpiAddress;
 
   SpiAddress = (UINT32)(UINTN)(BaseAddress) - (UINT32)FlashDeviceBase;
-  SectorSize = SECTOR_SIZE_64KB;
+  SectorSize = SECTOR_SIZE_4KB;
   while ( (NumBytes > 0) && (NumBytes <= MAX_FWH_SIZE) ) {
     Status = mSpiProtocol->Execute (
                              mSpiProtocol,
-                             SPI_BERASE,
+                             SPI_SERASE,
                              SPI_WREN,
                              FALSE,
                              TRUE,
@@ -319,3 +320,148 @@ LibFvbFlashDeviceBlockLock (
   return Status;
 }
 
+VOID
+EFIAPI
+LibFvbFlashDeviceVirtualAddressChangeNotifyEvent (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  gRT->ConvertPointer (0, (VOID **) &mSpiProtocol);
+  gRT->ConvertPointer (0, (VOID **) &FlashDeviceBase);
+}
+
+
+/**
+  The library constructuor.
+
+  The function does the necessary initialization work for this library
+  instance. Please put all initialization works in it.
+
+  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.
+  @param[in]  SystemTable       A pointer to the EFI system table.
+
+  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.
+                                It will ASSERT on error for debug version.
+  @retval     EFI_ERROR         Please reference LocateProtocol for error code details.
+
+**/
+EFI_STATUS
+EFIAPI
+LibFvbFlashDeviceSupportInit (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  EFI_STATUS Status;
+  EFI_EVENT  Event;
+  UINT8                         SfId[3];
+  UINT8                         FlashIndex;
+  UINT8                         SpiReadError;
+  UINT8                         SpiNotMatchError;
+  EFI_SMM_BASE2_PROTOCOL       *SmmBase;
+  BOOLEAN                       InSmm;
+
+  SpiReadError     = 0x00;
+  SpiNotMatchError = 0x00;
+
+  InSmm = FALSE;
+  Status = gBS->LocateProtocol (
+                  &gEfiSmmBase2ProtocolGuid,
+                  NULL,
+                  (void **)&SmmBase
+                  );
+  if (!EFI_ERROR(Status)) {
+    Status = SmmBase->InSmm(SmmBase, &InSmm);
+    if (EFI_ERROR(Status)) {
+      InSmm = FALSE;
+    }
+  }
+
+  if (!InSmm) {
+    Status = gBS->LocateProtocol (
+                  &gEfiSpiProtocolGuid,
+                  NULL,
+                  (VOID **)&mSpiProtocol
+                  );
+    ASSERT_EFI_ERROR (Status);
+
+    Status = gBS->CreateEventEx (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_NOTIFY,
+                  LibFvbFlashDeviceVirtualAddressChangeNotifyEvent,
+                  NULL,
+                  &gEfiEventVirtualAddressChangeGuid,
+                  &Event
+                  );
+    ASSERT_EFI_ERROR (Status);
+  } else {
+    Status = gBS->LocateProtocol (
+                    &gEfiSmmSpiProtocolGuid,
+                    NULL,
+                    (VOID **)&mSpiProtocol
+                    );
+    ASSERT_EFI_ERROR (Status);
+  }
+
+
+  for (FlashIndex = EnumSpiFlashW25Q64; FlashIndex < EnumSpiFlashMax; FlashIndex++) {
+    Status = mSpiProtocol->Init (mSpiProtocol, &(mInitTable[FlashIndex]));
+    if (!EFI_ERROR (Status)) {
+      //
+      // Read Vendor/Device IDs to check if the driver supports the Serial Flash device.
+      //
+      Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               SPI_READ_ID,
+                               SPI_WREN,
+                               TRUE,
+                               FALSE,
+                               FALSE,
+                               0,
+                               3,
+                               SfId,
+                               EnumSpiRegionAll
+                               );
+      if (!EFI_ERROR (Status)) {
+        if ((SfId[0] == mInitTable[FlashIndex].VendorId)  &&
+            (SfId[1] == mInitTable[FlashIndex].DeviceId0) &&
+            (SfId[2] == mInitTable[FlashIndex].DeviceId1)) {
+            //
+            // Found a matching SPI device, FlashIndex now contains flash device.
+            //
+            DEBUG ((DEBUG_ERROR, "OK - Found SPI Flash Type in SPI Flash Driver, Device Type ID 0 = 0x%02x!\n", mInitTable[FlashIndex].DeviceId0));
+            DEBUG ((DEBUG_ERROR, "Device Type ID 1 = 0x%02x!\n", mInitTable[FlashIndex].DeviceId1));
+
+            if (mInitTable[FlashIndex].BiosStartOffset == (UINTN) (-1)) {
+              DEBUG ((DEBUG_ERROR, "ERROR - The size of BIOS image is bigger than SPI Flash device!\n"));
+              CpuDeadLoop ();
+            }
+            break;
+        } else {
+          SpiNotMatchError++;
+        }
+      } else {
+        SpiReadError++;
+      }
+    }
+  }
+
+  DEBUG ((DEBUG_ERROR, "SPI flash chip VID = 0x%X, DID0 = 0x%X, DID1 = 0x%X\n", SfId[0], SfId[1], SfId[2]));
+
+  if (FlashIndex < EnumSpiFlashMax)  {
+    return EFI_SUCCESS;
+  } else {
+  if (SpiReadError != 0) {
+      DEBUG ((DEBUG_ERROR, "ERROR - SPI Read ID execution failed! Error Count = %d\n", SpiReadError));
+   }
+    else {
+      if (SpiNotMatchError != 0) {
+        DEBUG ((DEBUG_ERROR, "ERROR - No supported SPI flash chip found! Error Count = %d\n", SpiNotMatchError));
+        DEBUG ((DEBUG_ERROR, "SPI flash chip VID = 0x%X, DID0 = 0x%X, DID1 = 0x%X\n", SfId[0], SfId[1], SfId[2]));
+      }
+    }
+    return EFI_UNSUPPORTED;
+  }
+}
+
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
index 955b2479f6..3331432b68 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
@@ -16,7 +16,7 @@
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = FlashDeviceLibRuntimeSmm
+  BASE_NAME                      = FlashDeviceLib
   FILE_GUID                      = E38A1C3C-928C-4bf7-B6C1-7F0EF163FAA5
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
@@ -32,7 +32,6 @@ [Defines]
 
 [Sources]
   FlashDeviceLib.c
-  FlashDeviceLibDxeRuntimeSmm.c
 
 
 [Packages]
@@ -44,9 +43,6 @@ [Packages]
 [LibraryClasses]
   DebugLib
 
-[Guids]
-  gEfiEventVirtualAddressChangeGuid
-
 [Protocols]
   gEfiSpiProtocolGuid
   gEfiSmmSpiProtocolGuid
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
index fdf742c1ba..954aadc174 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
@@ -17,6 +17,7 @@
 #include <Library/SpiFlash.H>
 
 #define FLASH_SIZE  0x400000
+#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)
 
 //
 // Serial Flash device initialization data table provided to the
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues
  2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
                   ` (4 preceding siblings ...)
  2018-03-28  5:33 ` [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch Kinney, Michael D
@ 2018-03-28  6:10 ` Wei, David
  5 siblings, 0 replies; 11+ messages in thread
From: Wei, David @ 2018-03-28  6:10 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Guo, Mang, Yao, Jiewen

Reviewed-by: David Wei <david.wei@intel.com>

Thanks,
David  Wei

Intel SSG/STO/UEFI BIOS                                 

-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, March 28, 2018 1:33 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>; Guo, Mang <mang.guo@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix a the following issues

* Update build scripts to work when Vlv2Binaries are placed in PACKAGES_PATH
* Fix some compiler build breaks when using VS2015
* Remove references to  drivers that are not present
* Enable the Tianocore boot logo and BGRT table
* Enable full UEFI shell
* Enable more debug messages in DXE phase
* Update PlatformBdsLib to show boot logo when the boot
  mode is BOOT_ON_FLASH_UPDATE.
* Update FLASH libraries to match libraries in the UDK2017
  development branch in edk2-platforms.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (4):
  Vlv2TbltDevicePkg: Fix VS2015 build breaks
  Vlv2TbltDevicePkg: Fix build issues in DSC/FDF
  Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
  Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

Michael D Kinney (1):
  Vlv2TbltDevicePkg: Fix build scripts

 Vlv2TbltDevicePkg/.gitignore                       |   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat                   |   8 +-
 .../PlatformFlashAccessLib.c                       | 491 ++++++++++++++++++++-
 .../PlatformFlashAccessLib.inf                     |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c        | 158 ++++++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf      |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h    |   1 +
 .../Library/PlatformBdsLib/BdsPlatform.c           |  14 +-
 Vlv2TbltDevicePkg/PlatformPkg.fdf                  |  15 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf               |  17 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |  12 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |  12 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |  14 +-
 .../PlatformSetupDxe/SetupInfoRecords.c            |   1 -
 .../SmBiosMiscDxe/MiscProcessorCacheFunction.c     |   6 -
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat            |   2 +-
 .../VlvPlatformInitDxe/VlvPlatformInit.c           |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat                      | 117 ++---
 18 files changed, 775 insertions(+), 123 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/.gitignore

-- 
2.14.2.windows.3



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks
  2018-03-28  5:33 ` [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks Kinney, Michael D
@ 2018-03-28  6:11   ` Wei, David
  0 siblings, 0 replies; 11+ messages in thread
From: Wei, David @ 2018-03-28  6:11 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Guo, Mang, Yao, Jiewen

Reviewed-by: David Wei <david.wei@intel.com>

Thanks,
David  Wei

Intel SSG/STO/UEFI BIOS                                 


-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, March 28, 2018 1:33 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>; Guo, Mang <mang.guo@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Fix minor code issues that break VS2015 builds.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c        | 1 -
 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c | 6 ------
 Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c       | 2 +-
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
index b0e29f02d0..f608651cd4 100644
--- a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
+++ b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
@@ -1185,7 +1185,6 @@ UpdatePlatformInformation (
   EFI_STATUS               Status;
   UINT8                    CpuFlavor=0;
   EFI_PEI_HOB_POINTERS     GuidHob;
-  EFI_PLATFORM_INFO_HOB    *mPlatformInfo=NULL;
   UINTN                    NumHandles;
   EFI_HANDLE                        *HandleBuffer;
   UINTN                             Index;
diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
index b18a6aaa3b..4a83aedc97 100644
--- a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
+++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c
@@ -28,12 +28,6 @@ Abstract:
 #include <Protocol/DataHub.h>
 #include <Guid/DataHubRecords.h>
 
-
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL1;
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL2;
-extern  SMBIOS_TABLE_TYPE7            *SmbiosRecordL3;
-
-
 UINT32
 ConvertBase2ToRaw (
   IN  EFI_EXP_BASE2_DATA             *Data)
diff --git a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
index 5e8d95ae9f..f8274e9df0 100644
--- a/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
+++ b/Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInit.c
@@ -147,7 +147,7 @@ PostPmInitCallBack (
 EFI_STATUS
 IgdPmHook (
   IN EFI_HANDLE                      ImageHandle,
-  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicy
+  IN DXE_VLV_PLATFORM_POLICY_PROTOCOL *DxePlatformSaPolicyParam
   )
 {
 
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
  2018-03-28  5:33 ` [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE Kinney, Michael D
@ 2018-03-28  6:20   ` Wei, David
  0 siblings, 0 replies; 11+ messages in thread
From: Wei, David @ 2018-03-28  6:20 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Guo, Mang, Yao, Jiewen

Reviewed-by: David Wei <david.wei@intel.com>

Thanks,
David  Wei

Intel SSG/STO/UEFI BIOS                                 


-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, March 28, 2018 1:33 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>; Guo, Mang <mang.guo@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update PlatformBdsLib to show boot logo when the boot
mode is BOOT_ON_FLASH_UPDATE.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index e42e82b678..c25e1d301a 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2018, Intel Corporation. All rights reserved.<BR>
                                                                                    
   This program and the accompanying materials are licensed and made available under
   the terms and conditions of the BSD License that accompanies this distribution.  
@@ -1871,6 +1871,7 @@ PlatformBdsPolicyBehavior (
     //
     PlatformBdsConnectConsole (gPlatformConsole);
     PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
+    EnableQuietBoot (PcdGetPtr(PcdLogoFile));
 
     DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe......\n"));
     ProcessCapsules ();
@@ -2642,6 +2643,8 @@ PlatformBdsEnterFrontPageWithHotKey (
 {
   EFI_STATUS                    Status;
 
+  EFI_STATUS                         LogoStatus;
+  EFI_BOOT_LOGO_PROTOCOL             *BootLogo;
   EFI_GRAPHICS_OUTPUT_PROTOCOL       *GraphicsOutput;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *SimpleTextOut;
   UINTN                              BootTextColumn;
@@ -2721,6 +2724,14 @@ PlatformBdsEnterFrontPageWithHotKey (
     gST->ConOut->EnableCursor (gST->ConOut, TRUE);
     gST->ConOut->ClearScreen (gST->ConOut);
 
+    //
+    // Boot Logo is corrupted, report it using Boot Logo protocol.
+    //
+    LogoStatus = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
+    if (!EFI_ERROR (LogoStatus) && (BootLogo != NULL)) {
+      BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
+    }
+
     if (EFI_ERROR (Status)) {
       //
       // Timeout or user press enter to continue
@@ -2728,6 +2739,7 @@ PlatformBdsEnterFrontPageWithHotKey (
       goto Exit;
     }
   }
+
   //
   // Install BM HiiPackages. 
   // Keep BootMaint HiiPackage, so that it can be covered by global setting. 
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts
  2018-03-28  5:33 ` [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts Kinney, Michael D
@ 2018-03-28  6:48   ` Guo, Mang
  0 siblings, 0 replies; 11+ messages in thread
From: Guo, Mang @ 2018-03-28  6:48 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Wei, David, Yao, Jiewen

Reviewed-by:  Guo  Mang <mang.guo@intel.com>


-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, March 28, 2018 1:33 PM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D; Wei, David; Guo, Mang; Yao, Jiewen
Subject: [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update build scripts to work with edk2 and Vlv2Binaries in PACKAGES_PATH.

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Vlv2TbltDevicePkg/.gitignore            |   3 +
 Vlv2TbltDevicePkg/Build_IFWI.bat        |   8 +--
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat |   2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat           | 117 +++++++++++++++++---------------
 4 files changed, 72 insertions(+), 58 deletions(-)  create mode 100644 Vlv2TbltDevicePkg/.gitignore

diff --git a/Vlv2TbltDevicePkg/.gitignore b/Vlv2TbltDevicePkg/.gitignore new file mode 100644 index 0000000000..b4699122b8
--- /dev/null
+++ b/Vlv2TbltDevicePkg/.gitignore
@@ -0,0 +1,3 @@
+AutoPlatformCFG.txt
+Stitch/Stitching.log
+Stitch/MNW*.bin
diff --git a/Vlv2TbltDevicePkg/Build_IFWI.bat b/Vlv2TbltDevicePkg/Build_IFWI.bat
index ac22a76b73..c8e3ec3d76 100644
--- a/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ b/Vlv2TbltDevicePkg/Build_IFWI.bat
@@ -1,7 +1,7 @@
 @REM @file
 @REM   Windows batch file to build BIOS ROM
 @REM
-@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+@REM Copyright (c) 2006 - 2018, Intel Corporation. All rights 
+reserved.<BR>
 @REM This program and the accompanying materials  @REM are licensed and made available under the terms and conditions of the BSD License  @REM which accompanies this distribution.  The full text of the license may be found at @@ -131,11 +131,11 @@ if %ERRORLEVEL% NEQ 0 (  echo.
 echo Finished Building BIOS.
 @REM Set BIOS_ID environment variable here.
-call Conf\BiosId.bat
+call %WORKSPACE%\Conf\BiosId.bat
 echo BIOS_ID=%BIOS_ID%
 
 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables -find /v "#" Conf\BiosId.env > ver_strings
+find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j  del /f/q ver_strings >nul  set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
@@ -149,7 +149,7 @@ if "%Platform_Type%" == "BYTC" (
     pushd %PLATFORM_PACKAGE%\Stitch
 )
    :: IFWIStitch.bat [/nG] [/nM] [/nB] [/B BIOS.rom] [/C StitchConfig] [/S IFWISuffix]
-   call IFWIStitch.bat %Stitch_Flags% /B ..\..\%BIOS_Name% %IFWI_Suffix%
+   call IFWIStitch.bat %Stitch_Flags% /B %WORKSPACE%\%BIOS_Name% 
+ %IFWI_Suffix%
    
    @echo off
 popd
diff --git a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
index f3a9cf3d74..5f19983c91 100644
--- a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
+++ b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
@@ -191,7 +191,7 @@ for %%i in (%BIOS_Names%) do (
     echo Generating IFWI... %BIOS_ID%.bin
     echo.
     
-    copy /b/y !IFWI_HEADER_FILE! + ..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + ..\..\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! %BIOS_ID%.bin
+    copy /b/y !IFWI_HEADER_FILE! + 
+ %WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\VLV_SEC
+ _REGION.bin + 
+ %WORKSPACE%\Vlv2Binaries\Vlv2MiscBinariesPkg\SEC\!SEC_VERSION!\Vacant.
+ bin + !BIOS_Rom! %BIOS_ID%.bin
     echo.
     echo ===========================================================================
 )
diff --git a/Vlv2TbltDevicePkg/bld_vlv.bat b/Vlv2TbltDevicePkg/bld_vlv.bat index a1d8c5b525..27bc4e7c41 100644
--- a/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -20,8 +20,8 @@ echo.
 ::**********************************************************************
 :: Initial Setup
 ::**********************************************************************
-set WORKSPACE=%CD%
-if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
+REM set WORKSPACE=%CD%
+REM if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
 set /a build_threads=1
 set "Build_Flags= "
 set exitCode=0
@@ -36,7 +36,7 @@ if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt  if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt  if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt  if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
-if exist conf\.cache rmdir /q/s conf\.cache
+if exist %WORKSPACE%\Conf\.cache rmdir /q/s %WORKSPACE%\Conf\.cache
 
 :: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
 :: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding @@ -48,7 +48,7 @@ set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
 set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
 
-set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
+REM set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg
 
 ::create new AutoPlatformCFG.txt file
 copy /y nul %auto_config_inc% >nul
@@ -109,17 +109,17 @@ if "%~1"=="" goto Usage
 
 ::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\  if "%Arch%"=="IA32" (
-    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
+    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env 
+ > %WORKSPACE%\Conf\BiosId.env
     echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
 ) else if "%Arch%"=="X64" (
-    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
+    findstr /b /v "BOARD_ID  BUILD_TYPE" 
+ %PLATFORM_PACKAGE%\BiosIdx64R.env > %WORKSPACE%\Conf\BiosId.env
     echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
 )
 
 :: -- Build flags settings for each Platform --  echo Setting  %1  platform configuration and BIOS ID...
 if /i "%~1" == "MNW2" (
-    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
+    echo BOARD_ID = MNW2MAX >> %WORKSPACE%\Conf\BiosId.env
     echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%
     
 ) else (
@@ -130,37 +130,23 @@ set Platform_Type=%~1
 
 if /i "%~2" == "RELEASE" (
     set target=RELEASE
-    echo BUILD_TYPE = R >> Conf\BiosId.env
+    echo BUILD_TYPE = R >> %WORKSPACE%\Conf\BiosId.env
 ) else (
     set target=DEBUG
-    echo BUILD_TYPE = D >> Conf\BiosId.env
+    echo BUILD_TYPE = D >> %WORKSPACE%\Conf\BiosId.env
 )
 
 ::**********************************************************************
-:: Additional EDK Build Setup/Configuration
-::**********************************************************************
-echo.
+:: Additional EDK Build Setup/Configuration
+::*********************************************************************
+*
+echo.
 echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
-if defined VS90COMNTOOLS (
-   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
-   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
-      set TOOL_CHAIN_TAG=VS2008
-   ) else (
-      set TOOL_CHAIN_TAG=VS2008x86
-   )
- ) else if defined VS100COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
-  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
-    set TOOL_CHAIN_TAG=VS2010
+if defined VS140COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
+  if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2015
   ) else (
-    set TOOL_CHAIN_TAG=VS2010x86
-  )
-) else if defined VS110COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
-  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
-    set TOOL_CHAIN_TAG=VS2012
-  ) else (
-    set TOOL_CHAIN_TAG=VS2012x86
+    set TOOL_CHAIN_TAG=VS2015x86
   )
 ) else if defined VS120COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
@@ -169,35 +155,56 @@ if defined VS90COMNTOOLS (
   ) else (
     set TOOL_CHAIN_TAG=VS2013x86
   )
-) else (
-  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
+) else if defined VS110COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
+  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2012
+  ) else (
+    set TOOL_CHAIN_TAG=VS2012x86
+  )
+) else if defined VS100COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
+  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
+    set TOOL_CHAIN_TAG=VS2010
+  ) else (
+    set TOOL_CHAIN_TAG=VS2010x86
+  )
+) else if defined VS90COMNTOOLS (
+  if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
+  if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
+     set TOOL_CHAIN_TAG=VS2008
+  ) else (
+     set TOOL_CHAIN_TAG=VS2008x86
+  )
+) else (
+  echo  --ERROR: VS2008/VS2010/VS2012/VS2013/VS2015 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS/VS140COMMONTOOLS not defined ^^!
   echo.
   goto :BldFail
-)
+)
 
 echo Ensuring correct build directory is present for GenBiosId...
-set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%
+set 
+BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TA
+G%
 
 echo Modifing Conf files for this build...
 :: Remove lines with these tags from target.txt -findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
+findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  
+ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" 
+%WORKSPACE%\Conf\target.txt > %WORKSPACE%\Conf\target.txt.tmp
 
-echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
+echo TARGET          = %TARGET%                                  >> %WORKSPACE%\Conf\target.txt.tmp
 if "%Arch%"=="IA32" (
-    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
+    echo TARGET_ARCH = IA32                                      >> %WORKSPACE%\Conf\target.txt.tmp
 ) else if "%Arch%"=="X64" (
-    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
+    echo TARGET_ARCH = IA32 X64                                  >> %WORKSPACE%\Conf\target.txt.tmp
 )
-echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
-echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
+echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> %WORKSPACE%\Conf\target.txt.tmp
+echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> %WORKSPACE%\Conf\target.txt.tmp
 if %Source% == 0 (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
+  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> %WORKSPACE%\Conf\target.txt.tmp
 ) else (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
+  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  
+ >> %WORKSPACE%\Conf\target.txt.tmp
 )
-echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp
+echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> %WORKSPACE%\Conf\target.txt.tmp
 
-move /Y Conf\target.txt.tmp Conf\target.txt >nul
+move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt 
+>nul
 
 ::**********************************************************************
 :: Build BIOS
@@ -205,11 +212,11 @@ move /Y Conf\target.txt.tmp Conf\target.txt >nul
 
 echo Creating BiosId...
 pushd %PLATFORM_PACKAGE%
-if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
-  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
+if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
+  GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o 
+%BUILD_PATH%\IA32\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
 if "%Arch%"=="X64" (
-   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
-   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
+   if not exist %BUILD_PATH%\X64  mkdir %BUILD_PATH%\X64
+   GenBiosId.exe -i %WORKSPACE%\Conf\BiosId.env -o 
+ %BUILD_PATH%\X64\BiosId.bin -ob %WORKSPACE%\Conf\BiosId.bat
 )
 popd
 
@@ -230,10 +237,10 @@ echo Running fce...
 
 pushd %PLATFORM_PACKAGE%
 :: Extract Hii data from build and store in HiiDefaultData.txt -fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt
+fce read -i %BUILD_PATH%\FV\Vlv.fd > %BUILD_PATH%\FV\HiiDefaultData.txt
 
 :: save changes to VlvXXX.fd
-fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd
+fce update -i %BUILD_PATH%\FV\Vlv.fd -s 
+%BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Vlv%Arch%.fd
 
 popd
 
@@ -241,7 +248,7 @@ if %ERRORLEVEL% NEQ 0 goto BldFail  ::echo FD successfully updated with default Hii values.
 
 :: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables -find /v "#" Conf\BiosId.env > ver_strings
+find /v "#" %WORKSPACE%\Conf\BiosId.env > ver_strings
 for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j  del /f/q ver_strings >nul
 
@@ -257,7 +264,11 @@ echo -------------------- The EDKII BIOS build has successfully completed. -----  echo.
 
 @REM build capsule here
-if "%openssl_path%" == "" goto Exit
+if "%openssl_path%" == "" (
+    echo -- Error:  OPENSSL_PATH not set.  Capule and Recovery images not generated.
+    set exitCode=1
+    goto Exit
+)
 echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
 build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc
 
--
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch
  2018-03-28  5:33 ` [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch Kinney, Michael D
@ 2018-03-28  7:11   ` Guo, Mang
  0 siblings, 0 replies; 11+ messages in thread
From: Guo, Mang @ 2018-03-28  7:11 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Wei, David, Yao, Jiewen

Reviewed-by:  Guo  Mang <mang.guo@intel.com>

-----Original Message-----
From: Kinney, Michael D 
Sent: Wednesday, March 28, 2018 1:34 PM
To: edk2-devel@lists.01.org
Cc: Wei, David; Guo, Mang; Yao, Jiewen; Kinney, Michael D
Subject: [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch

https://bugzilla.tianocore.org/show_bug.cgi?id=911

Update Minnow Max FLASH libraries to match libraries in the UDK2017 development branch in edk2-platforms.

https://github.com/tianocore/edk2-platforms/tree/devel-MinnowBoardMax-UDK2017

Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../PlatformFlashAccessLib.c                       | 491 ++++++++++++++++++++-
 .../PlatformFlashAccessLib.inf                     |  19 +-
 .../Library/FlashDeviceLib/FlashDeviceLib.c        | 158 ++++++-
 .../Library/FlashDeviceLib/FlashDeviceLib.inf      |   6 +-
 .../Library/FlashDeviceLib/SpiChipDefinitions.h    |   1 +
 5 files changed, 639 insertions(+), 36 deletions(-)

diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index f3cb31daaa..9162e025ed 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/P
+++ latformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017, 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 @@ -11,6 +11,7 @@
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
+#include <Uefi.h>
 
 #include <PiDxe.h>
 
@@ -19,14 +20,366 @@
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
 #include <Library/PlatformFlashAccessLib.h>
-#include <Library/FlashDeviceLib.h>
+//#include <Library/FlashDeviceLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Protocol/Spi.h>
+#include <Library/CacheMaintenanceLib.h> #include "PchAccess.h"
+#include <Library/IoLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PrintLib.h>
 
-#define SECTOR_SIZE_64KB  0x10000      // Common 64kBytes sector size
-#define ALINGED_SIZE  SECTOR_SIZE_64KB
+//#define SECTOR_SIZE_64KB  0x10000      // Common 64kBytes sector size
+//#define ALINGED_SIZE  SECTOR_SIZE_64KB
+
+#define BLOCK_SIZE 0x1000
+#define ALINGED_SIZE BLOCK_SIZE
+
+#define R_PCH_LPC_BIOS_CNTL                       0xDC
+#define B_PCH_LPC_BIOS_CNTL_SMM_BWP               0x20            ///< SMM BIOS write protect disable
+
+//
+// Prefix Opcode Index on the host SPI controller // typedef enum {
+  SPI_WREN,             // Prefix Opcode 0: Write Enable
+  SPI_EWSR,             // Prefix Opcode 1: Enable Write Status Register
+} PREFIX_OPCODE_INDEX;
+//
+// Opcode Menu Index on the host SPI controller // typedef enum {
+  SPI_READ_ID,        // Opcode 0: READ ID, Read cycle with address
+  SPI_READ,           // Opcode 1: READ, Read cycle with address
+  SPI_RDSR,           // Opcode 2: Read Status Register, No address
+  SPI_WRDI_SFDP,      // Opcode 3: Write Disable or Discovery Parameters, No address
+  SPI_SERASE,         // Opcode 4: Sector Erase (4KB), Write cycle with address
+  SPI_BERASE,         // Opcode 5: Block Erase (32KB), Write cycle with address
+  SPI_PROG,           // Opcode 6: Byte Program, Write cycle with address
+  SPI_WRSR,           // Opcode 7: Write Status Register, No address
+} SPI_OPCODE_INDEX;
 
 STATIC EFI_PHYSICAL_ADDRESS     mInternalFdAddress;
 
+EFI_SPI_PROTOCOL  *mSpiProtocol;
+
+/**
+  Read NumBytes bytes of data from the address specified by
+  PAddress into Buffer.
+
+  @param[in]      Address       The starting physical address of the read.
+  @param[in,out]  NumBytes      On input, the number of bytes to read. On output, the number
+                                of bytes actually read.
+  @param[out]     Buffer        The destination data buffer for the read.
+
+  @retval         EFI_SUCCESS       Opertion is successful.
+  @retval         EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashRead (
+  IN     UINTN     Address,
+  IN OUT UINT32    *NumBytes,
+     OUT UINT8     *Buffer
+  )
+{
+  EFI_STATUS    Status = EFI_SUCCESS;
+  UINTN         Offset = 0;
+
+  ASSERT ((NumBytes != NULL) && (Buffer != NULL));
+
+
+  //if (Address >= (UINTN)PcdGet32 (PcdGbeRomBase) && Address < (UINTN)PcdGet32 (PcdPDRRomBase)) {
+    Offset = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+    Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               1, //SPI_READ,
+                               0, //SPI_WREN,
+                               TRUE,
+                               TRUE,
+                               FALSE,
+                               Offset,
+                               BLOCK_SIZE,
+                               Buffer,
+                               EnumSpiRegionAll
+                               );
+    return Status;
+}
+
+/**
+  Write NumBytes bytes of data from Buffer to the address specified by
+  PAddresss.
+
+  @param[in]      Address         The starting physical address of the write.
+  @param[in,out]  NumBytes        On input, the number of bytes to write. On output,
+                                  the actual number of bytes written.
+  @param[in]      Buffer          The source data buffer for the write.
+
+  @retval         EFI_SUCCESS       Opertion is successful.
+  @retval         EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashWrite (
+  IN     UINTN     Address,
+  IN OUT UINT32    *NumBytes,
+  IN     UINT8     *Buffer
+  )
+{
+  EFI_STATUS                Status;
+  UINTN                     Offset;
+  UINT32                    Length;
+  UINT32                    RemainingBytes;
+
+  ASSERT ((NumBytes != NULL) && (Buffer != NULL));  ASSERT (Address >= 
+ (UINTN)PcdGet32 (PcdFlashChipBase));
+
+  Offset    = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+  ASSERT ((*NumBytes + Offset) <= (UINTN)PcdGet32 (PcdFlashChipSize));
+
+  Status = EFI_SUCCESS;
+  RemainingBytes = *NumBytes;
+
+  while (RemainingBytes > 0) {
+    if (RemainingBytes > SIZE_4KB) {
+      Length = SIZE_4KB;
+    } else {
+      Length = RemainingBytes;
+    }
+    Status = mSpiProtocol->Execute (
+                             mSpiProtocol,
+                             SPI_PROG,
+                             SPI_WREN,
+                             TRUE,
+                             TRUE,
+                             TRUE,
+                             (UINT32) Offset,
+                             Length,
+                             Buffer,
+                             EnumSpiRegionAll
+                             );
+    if (EFI_ERROR (Status)) {
+      break;
+    }
+    RemainingBytes -= Length;
+    Offset += Length;
+    Buffer += Length;
+  }
+
+  //
+  // Actual number of bytes written
+  //
+  *NumBytes -= RemainingBytes;
+
+  return Status;
+}
+
+
+EFI_STATUS
+InternalReadBlock (
+  IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+  OUT VOID                  *ReadBuffer
+  )
+{
+  EFI_STATUS    Status;
+  UINT32        BlockSize;
+
+  BlockSize = BLOCK_SIZE;
+
+  Status = SpiFlashRead ((UINTN) BaseAddress, &BlockSize, ReadBuffer);
+
+  return Status;
+}
+
+/**
+  Erase the block starting at Address.
+
+  @param[in]  Address         The starting physical address of the block to be erased.
+                              This library assume that caller garantee that the PAddress
+                              is at the starting address of this block.
+  @param[in]  NumBytes        On input, the number of bytes of the logical block to be erased.
+                              On output, the actual number of bytes erased.
+
+  @retval     EFI_SUCCESS.      Opertion is successful.
+  @retval     EFI_DEVICE_ERROR  If there is any device errors.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFlashBlockErase (
+  IN UINTN    Address,
+  IN UINTN    *NumBytes
+  )
+{
+  EFI_STATUS          Status;
+  UINTN               Offset;
+  UINTN               RemainingBytes;
+
+  ASSERT (NumBytes != NULL);
+  ASSERT (Address >= (UINTN)PcdGet32 (PcdFlashChipBase));
+
+  Offset    = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+  ASSERT ((*NumBytes % SIZE_4KB) == 0);  ASSERT ((*NumBytes + Offset) 
+ <= (UINTN)PcdGet32 (PcdFlashChipSize));
+
+  Status = EFI_SUCCESS;
+  RemainingBytes = *NumBytes;
+
+  //
+  // To adjust the Offset with Bios/Gbe
+  //
+//  if (Address >= (UINTN)PcdGet32 (PcdFlashChipBase)) {
+//    Offset = Address - (UINTN)PcdGet32 (PcdFlashChipBase);
+
+    while (RemainingBytes > 0) {
+      Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               SPI_SERASE,
+                               SPI_WREN,
+                               FALSE,
+                               TRUE,
+                               FALSE,
+                               (UINT32) Offset,
+                               0,
+                               NULL,
+                               EnumSpiRegionAll
+                               );
+      if (EFI_ERROR (Status)) {
+        break;
+      }
+      RemainingBytes -= SIZE_4KB;
+      Offset         += SIZE_4KB;
+    }
+//  }
+
+  //
+  // Actual number of bytes erased
+  //
+  *NumBytes -= RemainingBytes;
+
+  return Status;
+}
+
+/**
+
+Routine Description:
+
+  Erase the whole block.
+
+Arguments:
+
+  BaseAddress  - Base address of the block to be erased.
+
+Returns:
+
+  EFI_SUCCESS - The command completed successfully.
+  Other       - Device error or wirte-locked, operation failed.
+
+**/
+EFI_STATUS
+InternalEraseBlock (
+  IN  EFI_PHYSICAL_ADDRESS BaseAddress
+  )
+{
+  EFI_STATUS                              Status;
+  UINTN                                   NumBytes;
+
+  NumBytes = BLOCK_SIZE;
+
+  Status = SpiFlashBlockErase ((UINTN) BaseAddress, &NumBytes);
+
+  return Status;
+}
+
+EFI_STATUS
+InternalCompareBlock (
+  IN  EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN  UINT8                       *Buffer
+  )
+{
+  EFI_STATUS                              Status;
+  VOID                                    *CompareBuffer;
+  UINT32                                  NumBytes;
+  INTN                                    CompareResult;
+
+  NumBytes = BLOCK_SIZE;
+  CompareBuffer = AllocatePool (NumBytes);  if (CompareBuffer == NULL) 
+ {
+    Status = EFI_OUT_OF_RESOURCES;
+    goto Done;
+  }
+
+  Status = SpiFlashRead ((UINTN) BaseAddress, &NumBytes, 
+ CompareBuffer);  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+  CompareResult = CompareMem (CompareBuffer, Buffer, BLOCK_SIZE);  if 
+ (CompareResult != 0) {
+    Status = EFI_VOLUME_CORRUPTED;
+  }
+
+Done:
+  if (CompareBuffer != NULL) {
+    FreePool (CompareBuffer);
+  }
+
+  return Status;
+}
+
+/**
+
+Routine Description:
+
+  Write a block of data.
+
+Arguments:
+
+  BaseAddress  - Base address of the block.
+  Buffer       - Data buffer.
+  BufferSize   - Size of the buffer.
+
+Returns:
+
+  EFI_SUCCESS           - The command completed successfully.
+  EFI_INVALID_PARAMETER - Invalid parameter, can not proceed.
+  Other                 - Device error or wirte-locked, operation failed.
+
+**/
+EFI_STATUS
+InternalWriteBlock (
+  IN  EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN  UINT8                       *Buffer,
+  IN  UINT32                      BufferSize
+  )
+{
+  EFI_STATUS                              Status;
+
+  Status = SpiFlashWrite ((UINTN) BaseAddress, &BufferSize, Buffer);
+
+  if (EFI_ERROR (Status)) {
+    DEBUG((DEBUG_ERROR, "\nFlash write error."));
+    return Status;
+  }
+
+  WriteBackInvalidateDataCacheRange ((VOID *) (UINTN) BaseAddress, 
+ BLOCK_SIZE);
+
+  Status = InternalCompareBlock (BaseAddress, Buffer);  if (EFI_ERROR 
+ (Status)) {
+    DEBUG((DEBUG_ERROR, "\nError when writing to BaseAddress %x with 
+ different at offset %x.", BaseAddress, Status));  } else {
+    DEBUG((DEBUG_INFO, "\nVerified data written to Block at %x is 
+ correct.", BaseAddress));  }
+
+  return Status;
+
+}
+
 /**
   Perform flash write opreation.
 
@@ -51,36 +404,122 @@ PerformFlashWrite (
   IN UINTN                        Length
   )
 {
-  EFI_STATUS          Status;
+  EFI_STATUS            Status = EFI_SUCCESS;
+  UINTN               Index;
+  EFI_PHYSICAL_ADDRESS  Address;
+  UINTN                 CountOfBlocks;
+  EFI_TPL               OldTpl;
+  BOOLEAN               FlashError;
+  UINT8                 *Buf;
+  UINTN                 LpcBaseAddress;
+  UINT8                 Data8Or;
+  UINT8                 Data8And;
+  UINT8                 BiosCntl;
 
-  DEBUG((DEBUG_INFO, "PerformFlashWrite - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
+  Index             = 0;
+  Address           = 0;
+  CountOfBlocks     = 0;
+  FlashError        = FALSE;
+  Buf               = Buffer;
+
+  DEBUG((DEBUG_INFO | DEBUG_ERROR, "PerformFlashWrite - 0x%x(%x) - 
+ 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
   if (FlashAddressType == FlashAddressTypeRelativeAddress) {
     FlashAddress = FlashAddress + mInternalFdAddress;
   }
 
-  DEBUG((DEBUG_INFO, "                  - 0x%x(%x) - 0x%x\n", (UINTN)FlashAddress, (UINTN)FlashAddressType, Length));
-  LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, FALSE);
+  CountOfBlocks = (UINTN) (Length / BLOCK_SIZE);  Address = 
+ FlashAddress;
 
+  LpcBaseAddress = MmPciAddress (0,
+                    DEFAULT_PCI_BUS_NUMBER_PCH,
+                    PCI_DEVICE_NUMBER_PCH_LPC,
+                    PCI_FUNCTION_NUMBER_PCH_LPC,
+                    0
+                    );
+  BiosCntl = MmioRead8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL);  if 
+ ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+    ///
+    /// Clear SMM_BWP bit (D31:F0:RegDCh[5])
+    ///
+    Data8And  = (UINT8) ~B_PCH_LPC_BIOS_CNTL_SMM_BWP;
+    Data8Or   = 0x00;
+
+    MmioAndThenOr8 (
+      LpcBaseAddress + R_PCH_LPC_BIOS_CNTL,
+      Data8And,
+      Data8Or
+      );
+    DEBUG((DEBUG_INFO, "PerformFlashWrite Clear SMM_BWP bit\n"));  }
+
+    //
+    // Raise TPL to TPL_NOTIFY to block any event handler,
+    // while still allowing RaiseTPL(TPL_NOTIFY) within
+    // output driver during Print()
   //
-  // Erase & Write
-  //
-  Status = LibFvbFlashDeviceBlockErase((UINTN)FlashAddress, Length);
-  ASSERT_EFI_ERROR(Status);
+    OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+    for (Index = 0; Index < CountOfBlocks; Index++) {
+      //
+      // Handle block based on address and contents.
+      //
+      if (!EFI_ERROR (InternalCompareBlock (Address, Buf))) {
+        DEBUG((DEBUG_INFO, "Skipping block at 0x%lx (already programmed)\n", Address));
+      } else {
+        //
+        // Display a dot for each block being updated.
+        //
+        Print (L".");
+
+        //
+        // Make updating process uninterruptable,
+        // so that the flash memory area is not accessed by other entities
+        // which may interfere with the updating process
+        //
+        Status  = InternalEraseBlock (Address);
   if (EFI_ERROR(Status)) {
-    LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
-    DEBUG((DEBUG_ERROR, "Flash Erase error\n"));
-    return Status;
+          gBS->RestoreTPL (OldTpl);
+          FlashError = TRUE;
+          goto Done;
   }
-
-  Status = LibFvbFlashDeviceWrite((UINTN)FlashAddress, &Length, Buffer);
-  ASSERT_EFI_ERROR(Status);
+        Status = InternalWriteBlock (
+                  Address,
+                  Buf,
+                  (UINT32)(Length > BLOCK_SIZE ? BLOCK_SIZE : Length)
+                  );
   if (EFI_ERROR(Status)) {
-    LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
-    DEBUG((DEBUG_ERROR, "Flash write error\n"));
-    return Status;
+          gBS->RestoreTPL (OldTpl);
+          FlashError = TRUE;
+          goto Done;
+        }
   }
 
-  LibFvbFlashDeviceBlockLock((UINTN)FlashAddress, Length, TRUE);
+      //
+      // Move to next block to update.
+      //
+      Address += BLOCK_SIZE;
+      Buf += BLOCK_SIZE;
+      if (Length > BLOCK_SIZE) {
+        Length -= BLOCK_SIZE;
+      } else {
+        Length = 0;
+      }
+    }
+    gBS->RestoreTPL (OldTpl);
+
+  Done:
+  if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+    //
+    // Restore original control setting
+    //
+    MmioWrite8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL, BiosCntl);
+    }
+
+  //
+  // Print flash update failure message if error detected.
+  //
+  if (FlashError) {
+    Print (L"No %r\n", Status);
+  }
 
   return EFI_SUCCESS;
 }
@@ -183,8 +622,16 @@ PerformFlashAccessLibConstructor (
   VOID
   )
 {
+  EFI_STATUS Status;
   mInternalFdAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32(PcdFlashAreaBaseAddress);
   DEBUG((DEBUG_INFO, "PcdFlashAreaBaseAddress - 0x%x\n", mInternalFdAddress));
 
+  Status = gBS->LocateProtocol (
+                  &gEfiSpiProtocolGuid,
+                  NULL,
+                  (VOID **) &mSpiProtocol
+                  );
+  ASSERT_EFI_ERROR(Status);
+
   return EFI_SUCCESS;
 }
diff --git a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
index 17ab38e27f..fbbdb91b64 100644
--- a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/P
+++ latformFlashAccessLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Platform Flash Access library.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2017, 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 @@ -36,13 +36,26 @@ [Packages]
   MdeModulePkg/MdeModulePkg.dec
   SignedCapsulePkg/SignedCapsulePkg.dec
   Vlv2TbltDevicePkg/PlatformPkg.dec
+  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
+  IoLib
   PcdLib
   DebugLib
-  FlashDeviceLib
+#  FlashDeviceLib
   MemoryAllocationLib
+  CacheMaintenanceLib
+
+[Guids]
+  gEdkiiSystemFmpCapsuleConfigFileGuid          ## SOMETIMES_CONSUMES ## GUID
+
+[Protocols]
+  gEfiSpiProtocolGuid                          ## CONSUMES
 
 [Pcd]
-  gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress
+  gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress  ## SOMETIMES_CONSUMES
+  gPlatformModuleTokenSpaceGuid.PcdFlashChipBase         ## SOMETIMES_CONSUMES
+  gPlatformModuleTokenSpaceGuid.PcdFlashChipSize         ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress      ## SOMETIMES_CONSUMES
+
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
index 8e6e5b4728..392ad1c14b 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.c
@@ -19,13 +19,14 @@
 #include <Library/FlashDeviceLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeLib.h>
+#include <Protocol/SmmBase2.h>
 #include <Guid/EventGroup.h>
-#include <Library/SpiFlash.H>
+#include "SpiChipDefinitions.h"
 
-#define FLASH_SIZE  0x400000
-
-#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)  UINTN FlashDeviceBase = FLASH_DEVICE_BASE_ADDRESS;
 
 EFI_SPI_PROTOCOL *mSpiProtocol = NULL;
@@ -77,11 +78,11 @@ SpiFlashBlockErase (
   UINT32              SpiAddress;
 
   SpiAddress = (UINT32)(UINTN)(BaseAddress) - (UINT32)FlashDeviceBase;
-  SectorSize = SECTOR_SIZE_64KB;
+  SectorSize = SECTOR_SIZE_4KB;
   while ( (NumBytes > 0) && (NumBytes <= MAX_FWH_SIZE) ) {
     Status = mSpiProtocol->Execute (
                              mSpiProtocol,
-                             SPI_BERASE,
+                             SPI_SERASE,
                              SPI_WREN,
                              FALSE,
                              TRUE,
@@ -319,3 +320,148 @@ LibFvbFlashDeviceBlockLock (
   return Status;
 }
 
+VOID
+EFIAPI
+LibFvbFlashDeviceVirtualAddressChangeNotifyEvent (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  gRT->ConvertPointer (0, (VOID **) &mSpiProtocol);
+  gRT->ConvertPointer (0, (VOID **) &FlashDeviceBase); }
+
+
+/**
+  The library constructuor.
+
+  The function does the necessary initialization work for this library  
+ instance. Please put all initialization works in it.
+
+  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.
+  @param[in]  SystemTable       A pointer to the EFI system table.
+
+  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.
+                                It will ASSERT on error for debug version.
+  @retval     EFI_ERROR         Please reference LocateProtocol for error code details.
+
+**/
+EFI_STATUS
+EFIAPI
+LibFvbFlashDeviceSupportInit (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  EFI_STATUS Status;
+  EFI_EVENT  Event;
+  UINT8                         SfId[3];
+  UINT8                         FlashIndex;
+  UINT8                         SpiReadError;
+  UINT8                         SpiNotMatchError;
+  EFI_SMM_BASE2_PROTOCOL       *SmmBase;
+  BOOLEAN                       InSmm;
+
+  SpiReadError     = 0x00;
+  SpiNotMatchError = 0x00;
+
+  InSmm = FALSE;
+  Status = gBS->LocateProtocol (
+                  &gEfiSmmBase2ProtocolGuid,
+                  NULL,
+                  (void **)&SmmBase
+                  );
+  if (!EFI_ERROR(Status)) {
+    Status = SmmBase->InSmm(SmmBase, &InSmm);
+    if (EFI_ERROR(Status)) {
+      InSmm = FALSE;
+    }
+  }
+
+  if (!InSmm) {
+    Status = gBS->LocateProtocol (
+                  &gEfiSpiProtocolGuid,
+                  NULL,
+                  (VOID **)&mSpiProtocol
+                  );
+    ASSERT_EFI_ERROR (Status);
+
+    Status = gBS->CreateEventEx (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_NOTIFY,
+                  LibFvbFlashDeviceVirtualAddressChangeNotifyEvent,
+                  NULL,
+                  &gEfiEventVirtualAddressChangeGuid,
+                  &Event
+                  );
+    ASSERT_EFI_ERROR (Status);
+  } else {
+    Status = gBS->LocateProtocol (
+                    &gEfiSmmSpiProtocolGuid,
+                    NULL,
+                    (VOID **)&mSpiProtocol
+                    );
+    ASSERT_EFI_ERROR (Status);
+  }
+
+
+  for (FlashIndex = EnumSpiFlashW25Q64; FlashIndex < EnumSpiFlashMax; FlashIndex++) {
+    Status = mSpiProtocol->Init (mSpiProtocol, &(mInitTable[FlashIndex]));
+    if (!EFI_ERROR (Status)) {
+      //
+      // Read Vendor/Device IDs to check if the driver supports the Serial Flash device.
+      //
+      Status = mSpiProtocol->Execute (
+                               mSpiProtocol,
+                               SPI_READ_ID,
+                               SPI_WREN,
+                               TRUE,
+                               FALSE,
+                               FALSE,
+                               0,
+                               3,
+                               SfId,
+                               EnumSpiRegionAll
+                               );
+      if (!EFI_ERROR (Status)) {
+        if ((SfId[0] == mInitTable[FlashIndex].VendorId)  &&
+            (SfId[1] == mInitTable[FlashIndex].DeviceId0) &&
+            (SfId[2] == mInitTable[FlashIndex].DeviceId1)) {
+            //
+            // Found a matching SPI device, FlashIndex now contains flash device.
+            //
+            DEBUG ((DEBUG_ERROR, "OK - Found SPI Flash Type in SPI Flash Driver, Device Type ID 0 = 0x%02x!\n", mInitTable[FlashIndex].DeviceId0));
+            DEBUG ((DEBUG_ERROR, "Device Type ID 1 = 0x%02x!\n", 
+ mInitTable[FlashIndex].DeviceId1));
+
+            if (mInitTable[FlashIndex].BiosStartOffset == (UINTN) (-1)) {
+              DEBUG ((DEBUG_ERROR, "ERROR - The size of BIOS image is bigger than SPI Flash device!\n"));
+              CpuDeadLoop ();
+            }
+            break;
+        } else {
+          SpiNotMatchError++;
+        }
+      } else {
+        SpiReadError++;
+      }
+    }
+  }
+
+  DEBUG ((DEBUG_ERROR, "SPI flash chip VID = 0x%X, DID0 = 0x%X, DID1 = 
+ 0x%X\n", SfId[0], SfId[1], SfId[2]));
+
+  if (FlashIndex < EnumSpiFlashMax)  {
+    return EFI_SUCCESS;
+  } else {
+  if (SpiReadError != 0) {
+      DEBUG ((DEBUG_ERROR, "ERROR - SPI Read ID execution failed! Error Count = %d\n", SpiReadError));
+   }
+    else {
+      if (SpiNotMatchError != 0) {
+        DEBUG ((DEBUG_ERROR, "ERROR - No supported SPI flash chip found! Error Count = %d\n", SpiNotMatchError));
+        DEBUG ((DEBUG_ERROR, "SPI flash chip VID = 0x%X, DID0 = 0x%X, DID1 = 0x%X\n", SfId[0], SfId[1], SfId[2]));
+      }
+    }
+    return EFI_UNSUPPORTED;
+  }
+}
+
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
index 955b2479f6..3331432b68 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/FlashDeviceLib.inf
@@ -16,7 +16,7 @@
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = FlashDeviceLibRuntimeSmm
+  BASE_NAME                      = FlashDeviceLib
   FILE_GUID                      = E38A1C3C-928C-4bf7-B6C1-7F0EF163FAA5
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
@@ -32,7 +32,6 @@ [Defines]
 
 [Sources]
   FlashDeviceLib.c
-  FlashDeviceLibDxeRuntimeSmm.c
 
 
 [Packages]
@@ -44,9 +43,6 @@ [Packages]
 [LibraryClasses]
   DebugLib
 
-[Guids]
-  gEfiEventVirtualAddressChangeGuid
-
 [Protocols]
   gEfiSpiProtocolGuid
   gEfiSmmSpiProtocolGuid
diff --git a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
index fdf742c1ba..954aadc174 100644
--- a/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
+++ b/Vlv2TbltDevicePkg/Library/FlashDeviceLib/SpiChipDefinitions.h
@@ -17,6 +17,7 @@
 #include <Library/SpiFlash.H>
 
 #define FLASH_SIZE  0x400000
+#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)
 
 //
 // Serial Flash device initialization data table provided to the
--
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-28  7:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28  5:33 [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Kinney, Michael D
2018-03-28  5:33 ` [Patch 1/5] Vlv2TbltDevicePkg: Fix build scripts Kinney, Michael D
2018-03-28  6:48   ` Guo, Mang
2018-03-28  5:33 ` [Patch 2/5] Vlv2TbltDevicePkg: Fix VS2015 build breaks Kinney, Michael D
2018-03-28  6:11   ` Wei, David
2018-03-28  5:33 ` [Patch 3/5] Vlv2TbltDevicePkg: Fix build issues in DSC/FDF Kinney, Michael D
2018-03-28  5:33 ` [Patch 4/5] Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE Kinney, Michael D
2018-03-28  6:20   ` Wei, David
2018-03-28  5:33 ` [Patch 5/5] Vlv2TbltDevicePkg: Sync FLASH libraries from UDK2017 branch Kinney, Michael D
2018-03-28  7:11   ` Guo, Mang
2018-03-28  6:10 ` [Patch 0/5] Fix Vlv2TbltDevicePkg build and boot issues Wei, David

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox