public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guo, Mang" <mang.guo@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Wei, David" <david.wei@intel.com>
Subject: [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] Add SpiAccess build option
Date: Thu, 5 Jul 2018 07:13:00 +0000	[thread overview]
Message-ID: <22D2C85ED001C54AA20BFE3B0E4751D1526A9C85@SHSMSX103.ccr.corp.intel.com> (raw)

Add SpiAccess build option to change flash region access permission for host CPU.

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 BuildBIOS.bat                                        |  1 +
 BuildBIOS.sh                                         |  5 +++++
 Platform/BroxtonPlatformPkg/BuildBxtBios.sh          | 15 ++++++++++++---
 Platform/BroxtonPlatformPkg/BuildIFWI.bat            | 15 ++++++++-------
 Platform/BroxtonPlatformPkg/BuildIFWI.sh             |  5 +++++
 .../Common/Tools/Stitch/IFWIStitch_Simple.bat        | 20 ++++++++++++++++++--
 6 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/BuildBIOS.bat b/BuildBIOS.bat
index dab34d2..b04150c 100644
--- a/BuildBIOS.bat
+++ b/BuildBIOS.bat
@@ -62,6 +62,7 @@ echo        /MX    MinnowBoard 3 Module
 echo        /BG    Benson Glacier Board
 echo        /AG    Aurora Glacier Board
 echo        /LH    LeafHill CRB Board
+echo        /L     Flash region access permission for host CPU
 echo        PlatformName:  Broxton
 echo        BuildTargets:  Release, Debug
 
diff --git a/BuildBIOS.sh b/BuildBIOS.sh
index b80f8c7..c7e1532 100755
--- a/BuildBIOS.sh
+++ b/BuildBIOS.sh
@@ -25,6 +25,7 @@ function Usage () {
   echo "       Build_Flags:                 /A     Set FabId to A "
   echo "       Build_Flags:                 /B     Set FabId to B (default:  FAB_B)"
   echo "       Build_Flags:                 /D     Set FabId to D "
+  echo "       Build_Flags:                 /L     Flash region access permission for host CPU"
   echo "       PlatformName [optional]:     Broxton  "                   
   echo "       Target_Flag:                 Release, Debug       "
   echo
@@ -82,6 +83,10 @@ for (( i=1; i<=$#; ))
       FabId=A
       Build_Flags="$Build_Flags /A"
       shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
+      FabId=A
+      Build_Flags="$Build_Flags /L"
+      shift
     else
       break
     fi
diff --git a/Platform/BroxtonPlatformPkg/BuildBxtBios.sh b/Platform/BroxtonPlatformPkg/BuildBxtBios.sh
index 6358eeb..80ed924 100755
--- a/Platform/BroxtonPlatformPkg/BuildBxtBios.sh
+++ b/Platform/BroxtonPlatformPkg/BuildBxtBios.sh
@@ -30,6 +30,7 @@ exitCode=0
 Arch=X64
 FabId=B
 BoardId=MN
+SpiAccessControl=0
 
 ## Initialize all the build flags to FALSE
 ## depending on the cmd line input, some will be set to TRUE prior to building
@@ -126,6 +127,9 @@ for (( i=1; i<=$#; ))
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/A" ]; then
       FabId=A
       shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
+      SpiAccessControl=1
+      shift
     else
       break
     fi
@@ -394,10 +398,12 @@ if [ $BoardId == "MX" ]; then
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_B/SpiChunk1.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_B/SpiChunk2.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_B/SpiChunk3.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_B/SpiChunk1SpiAccessControl.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
   else
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_A/SpiChunk1.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_A/SpiChunk2.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_A/SpiChunk3.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/MinnowBoard3Next/IFWI/FAB_A/SpiChunk1SpiAccessControl.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
   fi
 fi
 
@@ -406,6 +412,7 @@ if [ $BoardId == "LH" ]; then
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/LeafHill/IFWI/FAB_D/SpiChunk1.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/LeafHill/IFWI/FAB_D/SpiChunk2.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
     cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/LeafHill/IFWI/FAB_D/SpiChunk3.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Board/LeafHill/IFWI/FAB_D/SpiChunk1SpiAccessControl.bin  $PLATFORM_PATH/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
   fi
 fi
 
@@ -419,9 +426,11 @@ cat FVIBBL.Fv > IBBL.Fv
 cat FVIBBM.Fv FSP_M.Fv > IBB.Fv
 
 cat FSP_S.Fv FVIBBR.Fv FVOBB.Fv FVOBBX.Fv > OBB.Fv
-
-cat SpiChunk1.bin IBBL.Fv IBB.Fv SpiChunk2.bin OBB.Fv NvStorage.Fv SpiChunk3.bin > $BIOS_Name"_GCC".bin
-
+if [ $SpiAccessControl == 0 ]; then
+  cat SpiChunk1.bin IBBL.Fv IBB.Fv SpiChunk2.bin OBB.Fv NvStorage.Fv SpiChunk3.bin > $BIOS_Name"_GCC".bin
+else
+  cat SpiChunk1SpiAccessControl.bin IBBL.Fv IBB.Fv SpiChunk2.bin OBB.Fv NvStorage.Fv SpiChunk3.bin > $BIOS_Name"_GCC".bin
+fi
 popd
 
 echo
diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.bat b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
index f4c887d..35f4c8d 100644
--- a/Platform/BroxtonPlatformPkg/BuildIFWI.bat
+++ b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
@@ -5,6 +5,7 @@ SetLocal EnableDelayedExpansion EnableExtensions
 set thisscript=%0
 set exitCode=0
 set "Build_Flags= "
+set "Stitch_Flags= "
 set Arch=X64
 set SkipUsageFlag=FALSE
 set FabId=B
@@ -30,11 +31,6 @@ if /i "%~1"=="" goto Usage
 if /i "%~1"=="/?" goto Usage
 
 ::Build Flags
-if /i "%~1"=="/l" (
-    set Build_Flags=%Build_Flags% /l
-    shift
-    goto OptLoop
-)
 if /i "%~1" == "/c" (
     set Build_Flags=%Build_Flags% /c
     shift
@@ -143,6 +139,11 @@ if /i "%~1"=="/m" (
     goto OptLoop
 )
 
+if /i "%~1"=="/L" (
+    set Stitch_Flags=L
+    shift
+    goto OptLoop
+)
 
 :: Require 2 input parameters
 if "%~2"=="" (
@@ -191,8 +192,8 @@ echo.
 echo BIOS ROM input:  %BIOS_Name%
 echo.
 pushd %STITCH_PATH%
-   echo  - call IFWIStitch_Simple.bat %WORKSPACE%\%STITCH_PATH%\%BIOS_Name% %FabId% %BoardId%
-   call IFWIStitch_Simple.bat %WORKSPACE%\%STITCH_PATH%\%BIOS_Name% %FabId% %BoardId%
+   echo  - call IFWIStitch_Simple.bat %WORKSPACE%\%STITCH_PATH%\%BIOS_Name% %FabId% %BoardId% %Stitch_Flags%
+   call IFWIStitch_Simple.bat %WORKSPACE%\%STITCH_PATH%\%BIOS_Name% %FabId% %BoardId% %Stitch_Flags%
    @echo off
 popd
 if ErrorLevel 1 (
diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.sh b/Platform/BroxtonPlatformPkg/BuildIFWI.sh
index cca9c34..128d8d6 100755
--- a/Platform/BroxtonPlatformPkg/BuildIFWI.sh
+++ b/Platform/BroxtonPlatformPkg/BuildIFWI.sh
@@ -26,6 +26,7 @@ function Usage () {
   echo "       Build_Flags:                 /A     Set FabId to A"
   echo "       Build_Flags:                 /B     Set FabId to B (default)"
   echo "       Build_Flags:                 /D     Set FabId to D"
+  echo "       Build_Flags:                 /L     Flash region access permission for host CPU"
   echo "       Platform_Type [optional]:    Broxton "                   
   echo "       Build_Target:                Release, Debug "
   echo
@@ -89,6 +90,10 @@ for (( i=1; i<=$#; ))
       FabId=A
       Build_Flags="$Build_Flags /A"
       shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
+      FabId=A
+      Build_Flags="$Build_Flags /L"
+      shift
     else
       break
     fi
diff --git a/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat b/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat
index 351ccd8..b8abaf3 100644
--- a/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat
+++ b/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/IFWIStitch_Simple.bat
@@ -30,6 +30,7 @@ if /i "%~1"=="Help" goto Usage
 set FspWrapper=FALSE
 set FabId=B
 set BoardId=MN
+set SpiAccessControl=0
 
 if /i "%~2"=="B" (
     set FabId=B
@@ -59,6 +60,10 @@ if /i "%~3"=="LH" (
     set BoardId=LH
 )
 
+if /i "%~4"=="L" (
+    set SpiAccessControl=1
+)
+
 :OptLoop1
 
 if /i "%~1"=="/FspW" (
@@ -126,6 +131,7 @@ set IFWI_Name=!IFWI_Prefix!_%IFWI_Suffix%
 echo.
 echo ------------------------------------------
 echo.
+echo %SpiAccessControl%
 echo   Generating SPI Image...
 mkdir BIOS_COMPONENTS
 copy /y /b %BIOS_Names%\IBBL.Fv .\BIOS_COMPONENTS
@@ -168,12 +174,22 @@ if %BoardId%==BG (
            copy /y /b ..\..\..\Board\MinnowBoard3Next\IFWI\FAB_A\SpiChunk1.bin .
            copy /y /b ..\..\..\Board\MinnowBoard3Next\IFWI\FAB_A\SpiChunk2.bin .
            copy /y /b ..\..\..\Board\MinnowBoard3Next\IFWI\FAB_A\SpiChunk3.bin .
-           copy /y /b SpiChunk1.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           copy /y /b ..\..\..\Board\MinnowBoard3Next\IFWI\FAB_A\SpiChunk1SpiAccessControl.bin .
+           if %SpiAccessControl% EQU 0 (
+             copy /y /b SpiChunk1.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           ) else (
+             copy /y /b SpiChunk1SpiAccessControl.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           )
 ) else if %BoardId%==LH (
            copy /y /b ..\..\..\Board\LeafHill\IFWI\FAB_D\SpiChunk1.bin .
            copy /y /b ..\..\..\Board\LeafHill\IFWI\FAB_D\SpiChunk2.bin .
            copy /y /b ..\..\..\Board\LeafHill\IFWI\FAB_D\SpiChunk3.bin .
-           copy /y /b SpiChunk1.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           copy /y /b ..\..\..\Board\LeafHill\IFWI\FAB_D\SpiChunk1SpiAccessControl.bin .
+           if %SpiAccessControl% EQU 0 (
+             copy /y /b SpiChunk1.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           ) else (
+             copy /y /b SpiChunk1SpiAccessControl.bin+.\BIOS_COMPONENTS\IBBL.Fv+.\BIOS_COMPONENTS\IBB.Fv+SpiChunk2.bin+.\BIOS_COMPONENTS\OBB.Fv+.\BIOS_COMPONENTS\NvStorage.Fv+SpiChunk3.bin spi_out.bin
+           )
 )
 move /y spi_out.bin %BIOS_ID%.bin  >> Stitching.log
 
-- 
2.10.1.windows.1



                 reply	other threads:[~2018-07-05  7:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22D2C85ED001C54AA20BFE3B0E4751D1526A9C85@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox