Re: [edk2] [Patch v1 4/5] BaseTools/AutoGen: move functions

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Carsey, Jaben 
Sent: Friday, January 11, 2019 2:40 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch v1 4/5] BaseTools/AutoGen: move functions

Move SplitOption and ConvertStringToByteArray from Common.Misc to this file.
There were no other consumers of the functions.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 77 ++--
 BaseTools/Source/Python/Common/Misc.py | 68 -
 2 files changed, 72 insertions(+), 73 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index acd34692b6c2..f68166403edf 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -30,7 +30,7 @@ from io import BytesIO
 
 from .StrGather import *
 from .BuildEngine import BuildRule
-
+import shutil
 from Common.LongFilePathSupport import CopyLongFilePath  from 
Common.BuildToolError import *  from Common.DataType import * @@ -170,6 +170,73 
@@ ${tail_comments}  ## @AsBuilt${BEGIN}
 ##   ${flags_item}${END}
 """)
+## Split command line option string to list # # subprocess.Popen needs 
+the args to be a sequence. Otherwise there's problem # in non-windows 
+platform to launch command # def _SplitOption(OptionString):
+OptionList = []
+LastChar = " "
+OptionStart = 0
+QuotationMark = ""
+for Index in range(0, len(OptionString)):
+CurrentChar = OptionString[Index]
+if CurrentChar in ['"', "'"]:
+if QuotationMark == CurrentChar:
+QuotationMark = ""
+elif QuotationMark == "":
+QuotationMark = CurrentChar
+continue
+elif QuotationMark:
+continue
+
+if CurrentChar in ["/", "-"] and LastChar in [" ", "\t", "\r", "\n"]:
+if Index > OptionStart:
+OptionList.append(OptionString[OptionStart:Index - 1])
+OptionStart = Index
+LastChar = CurrentChar
+OptionList.append(OptionString[OptionStart:])
+return OptionList
+
+#
+# Convert string to C format array
+#
+def _ConvertStringToByteArray(Value):
+Value = Value.strip()
+if not Value:
+return None
+if Value[0] == '{':
+if not Value.endswith('}'):
+return None
+Value = Value.replace(' ', '').replace('{', '').replace('}', '')
+ValFields = Value.split(',')
+try:
+for Index in range(len(ValFields)):
+ValFields[Index] = str(int(ValFields[Index], 0))
+except ValueError:
+return None
+Value = '{' + ','.join(ValFields) + '}'
+return Value
+
+Unicode = False
+if Value.startswith('L"'):
+if not Value.endswith('"'):
+return None
+Value = Value[1:]
+Unicode = True
+elif not Value.startswith('"') or not Value.endswith('"'):
+return None
+
+Value = eval(Value) # translate escape character
+NewValue = '{'
+for Index in range(0, len(Value)):
+if Unicode:
+NewValue = NewValue + str(ord(Value[Index]) % 0x1) + ','
+else:
+NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ','
+Value = NewValue + '0}'
+return Value
 
 ## Base class for AutoGen
 #
@@ -1719,11 +1786,11 @@ class PlatformAutoGen(AutoGen):
 def BuildCommand(self):
 RetVal = []
 if "MAKE" in self.ToolDefinition and "PATH" in 
self.ToolDefinition["MAKE"]:
-RetVal += SplitOption(self.ToolDefinition["MAKE"]["PATH"])
+RetVal += _SplitOption(self.ToolDefinition["MAKE"]["PATH"])
 if "FLAGS" in self.ToolDefinition["MAKE"]:
 NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip()
 if NewOption != '':
-RetVal += SplitOption(NewOption)
+RetVal += _SplitOption(NewOption)
 if "MAKE" in self.EdkIIBuildOption:
 if "FLAGS" in self.EdkIIBuildOption["MAKE"]:
 Flags = self.EdkIIBuildOption["MAKE"]["FLAGS"]
@@ -3425,7 +3492,7 @@ class ModuleAutoGen(AutoGen):
 Guid = gEfiVarStoreGuidPattern.search(Content, Pos)
 if not Guid:
 break
-NameArray = ConvertStringToByteArray('L"' + Name.group(1) + 
'"')
+NameArray = _ConvertStringToByteArray('L"' + 
+ Name.group(1) + '"')
 NameGuids.add((NameArray, 
GuidStructureStringToGuidString(Guid.group(1
 Pos = Content.find('efivarstore', Name.end())
 if not NameGuids:
@@ -3438,7 +3505,7 @@ class ModuleAutoGen(AutoGen):
 Value = GuidValue(SkuInfo.VariableGuid, 
self.PlatformInfo.PackageList, self.MetaFile.Path)
 if not Value:
   

Re: [edk2] [Patch v1 3/5] BaseTools/DscBuildData: move function

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Carsey, Jaben 
Sent: Friday, January 11, 2019 2:40 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch v1 3/5] BaseTools/DscBuildData: move function

Move IsFieldValuieAnArray from Common.Misc to this file.
There were no other consumers of the function.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py| 18 +--
 BaseTools/Source/Python/Workspace/DscBuildData.py | 50 +---
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 25d8f9807fa3..7e8077558da5 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1,7 +1,7 @@
 ## @file
 # Common routines used by all tools
 #
-# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights 
+reserved.
 # This program and the accompanying materials  # are licensed and made 
available under the terms and conditions of the BSD License  # which 
accompanies this distribution.  The full text of the license may be found at @@ 
-1149,22 +1149,6 @@ class tdict:
 keys |= self.data[Key].GetKeys(KeyIndex - 1)
 return keys
 
-def IsFieldValueAnArray (Value):
-Value = Value.strip()
-if Value.startswith(TAB_GUID) and Value.endswith(')'):
-return True
-if Value.startswith('L"') and Value.endswith('"')  and 
len(list(Value[2:-1])) > 1:
-return True
-if Value[0] == '"' and Value[-1] == '"' and len(list(Value[1:-1])) > 1:
-return True
-if Value[0] == '{' and Value[-1] == '}':
-return True
-if Value.startswith("L'") and Value.endswith("'") and 
len(list(Value[2:-1])) > 1:
-return True
-if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:
-return True
-return False
-
 def AnalyzePcdExpression(Setting):
 RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))
 Setting = Setting.replace('', RanStr).strip() diff --git 
a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 3b0b23ca8fcb..f4a8212f412d 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to create a database used by build tool  # -# Copyright 
(c) 2008 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2019, Intel Corporation. All rights 
+reserved.
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP  # This 
program and the accompanying materials  # are licensed and made available under 
the terms and conditions of the BSD License @@ -44,6 +44,22 @@ from 
Workspace.BuildClassObject import PlatformBuildClassObject, StructurePcd, P  
from collections import OrderedDict, defaultdict  from .BuildClassObject import 
ArrayIndex
 
+def _IsFieldValueAnArray (Value):
+Value = Value.strip()
+if Value.startswith(TAB_GUID) and Value.endswith(')'):
+return True
+if Value.startswith('L"') and Value.endswith('"')  and 
len(list(Value[2:-1])) > 1:
+return True
+if Value[0] == '"' and Value[-1] == '"' and len(list(Value[1:-1])) > 1:
+return True
+if Value[0] == '{' and Value[-1] == '}':
+return True
+if Value.startswith("L'") and Value.endswith("'") and 
len(list(Value[2:-1])) > 1:
+return True
+if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1:
+return True
+return False
+
 PcdValueInitName = 'PcdValueInit'
 
 PcdMainCHeader = '''
@@ -1105,7 +1121,7 @@ class DscBuildData(PlatformBuildClassObject):
 IsArray = False
 TokenCName += '.' + FieldName
 if PcdValue.startswith('H'):
-if FieldName and IsFieldValueAnArray(PcdValue[1:]):
+if FieldName and _IsFieldValueAnArray(PcdValue[1:]):
 PcdDatumType = TAB_VOID
 IsArray = True
 if FieldName and not IsArray:
@@ -1116,7 +1132,7 @@ class DscBuildData(PlatformBuildClassObject):
 EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value 
"%s",  %s' %
 (TokenSpaceGuidCName, TokenCName, PcdValue, 
Value))
 elif PcdValue.startswith("L'") or PcdValue.startswith("'"):
-if FieldName and IsFieldValueAnArray(PcdValue):
+if FieldName and _IsFieldValueAnArray(PcdValue):
 PcdDatumType = TAB_VOID
 IsArray = True
 if FieldName and not IsArray:
@@ -1128,7 +1144,7 @@ class DscBuildData(PlatformBuildClassObject):
 (TokenSpaceGuidCName, TokenCName, PcdValue, 
Value))
 elif 

Re: [edk2] [Patch v1 2/5] BaseTools/Workspace/InfBuildData: move functions

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Carsey, Jaben 
Sent: Friday, January 11, 2019 2:40 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch v1 2/5] BaseTools/Workspace/InfBuildData: move functions

Move ProtocolValue and PpiValue from Common.Misc to this file.
There were no other consumers of these 2 functions.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py| 38 
 BaseTools/Source/Python/Workspace/InfBuildData.py | 46 ++--
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 43e016febcbb..25d8f9807fa3 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -611,44 +611,6 @@ def GuidValue(CName, PackageList, Inffile = None):
 return P.Guids[CName]
 return None
 
-## Get Protocol value from given packages -#
-#   @param  CName   The CName of the GUID
-#   @param  PackageList List of packages looking-up in
-#   @param  Inffile The driver file
-#
-#   @retval GuidValue   if the CName is found in any given package
-#   @retval Noneif the CName is not found in all given packages
-#
-def ProtocolValue(CName, PackageList, Inffile = None):
-for P in PackageList:
-ProtocolKeys = P.Protocols.keys()
-if Inffile and P._PrivateProtocols:
-if not Inffile.startswith(P.MetaFile.Dir):
-ProtocolKeys = [x for x in P.Protocols if x not in 
P._PrivateProtocols]
-if CName in ProtocolKeys:
-return P.Protocols[CName]
-return None
-
-## Get PPI value from given packages
-#
-#   @param  CName   The CName of the GUID
-#   @param  PackageList List of packages looking-up in
-#   @param  Inffile The driver file
-#
-#   @retval GuidValue   if the CName is found in any given package
-#   @retval Noneif the CName is not found in all given packages
-#
-def PpiValue(CName, PackageList, Inffile = None):
-for P in PackageList:
-PpiKeys = P.Ppis.keys()
-if Inffile and P._PrivatePpis:
-if not Inffile.startswith(P.MetaFile.Dir):
-PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
-if CName in PpiKeys:
-return P.Ppis[CName]
-return None
-
 ## A string template class
 #
 #  This class implements a template for string replacement. A string template 
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 99bbecfd1f87..351f596d76b4 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -21,6 +21,44 @@ from .MetaFileParser import *  from collections import 
OrderedDict  from Workspace.BuildClassObject import ModuleBuildClassObject, 
LibraryClassObject, PcdClassObject
 
+## Get Protocol value from given packages #
+#   @param  CName   The CName of the GUID
+#   @param  PackageList List of packages looking-up in
+#   @param  Inffile The driver file
+#
+#   @retval GuidValue   if the CName is found in any given package
+#   @retval Noneif the CName is not found in all given packages
+#
+def _ProtocolValue(CName, PackageList, Inffile = None):
+for P in PackageList:
+ProtocolKeys = P.Protocols.keys()
+if Inffile and P._PrivateProtocols:
+if not Inffile.startswith(P.MetaFile.Dir):
+ProtocolKeys = [x for x in P.Protocols if x not in 
P._PrivateProtocols]
+if CName in ProtocolKeys:
+return P.Protocols[CName]
+return None
+
+## Get PPI value from given packages
+#
+#   @param  CName   The CName of the GUID
+#   @param  PackageList List of packages looking-up in
+#   @param  Inffile The driver file
+#
+#   @retval GuidValue   if the CName is found in any given package
+#   @retval Noneif the CName is not found in all given packages
+#
+def _PpiValue(CName, PackageList, Inffile = None):
+for P in PackageList:
+PpiKeys = P.Ppis.keys()
+if Inffile and P._PrivatePpis:
+if not Inffile.startswith(P.MetaFile.Dir):
+PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
+if CName in PpiKeys:
+return P.Ppis[CName]
+return None
+
 ## Module build information from INF file  #  #  This class is used to 
retrieve information stored in database and convert them @@ -645,7 +683,7 @@ 
class InfBuildData(ModuleBuildClassObject):
 RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, 
self._Platform]
 for Record in RecordList:
 CName = Record[0]
-Value = 

Re: [edk2] [Patch v1 1/5] BaseTools/build/build: refactor and move functions

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng  

-Original Message-
From: Carsey, Jaben 
Sent: Friday, January 11, 2019 2:40 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch v1 1/5] BaseTools/build/build: refactor and move functions

Move DataDump and DataRestore from Common.Misc to this file.
There were no other consumers of these 2 functions.

Import threading since that module is used in build.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py | 37   
BaseTools/Source/Python/build/build.py | 46 ++--
 2 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 76a73d1c33db..43e016febcbb 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -487,43 +487,6 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True):
 
 return True
 
-## Make a Python object persistent on file system -#
-#   @param  DataThe object to be stored in file
-#   @param  FileThe path of file to store the object
-#
-def DataDump(Data, File):
-Fd = None
-try:
-Fd = open(File, 'wb')
-pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)
-except:
-EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, 
RaiseError=False)
-finally:
-if Fd is not None:
-Fd.close()
-
-## Restore a Python object from a file
-#
-#   @param  FileThe path of file stored the object
-#
-#   @retval object  A python object
-#   @retval NoneIf failure in file operation
-#
-def DataRestore(File):
-Data = None
-Fd = None
-try:
-Fd = open(File, 'rb')
-Data = pickle.load(Fd)
-except Exception as e:
-EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
-Data = None
-finally:
-if Fd is not None:
-Fd.close()
-return Data
-
 ## Retrieve and cache the real path name in file system  #
 #   @param  RootThe root directory of path relative to
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index b992a4c1b303..85b36cacd00c 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -32,6 +32,7 @@ import multiprocessing
 
 from struct import *
 from threading import *
+import threading
 from optparse import OptionParser
 from subprocess import *
 from Common import Misc as Utils
@@ -71,6 +72,43 @@ gToolsDefinition = "tools_def.txt"
 TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')
 TmpTableDict = {}
 
+## Make a Python object persistent on file system #
+#   @param  DataThe object to be stored in file
+#   @param  FileThe path of file to store the object
+#
+def _DataDump(Data, File):
+Fd = None
+try:
+Fd = open(File, 'wb')
+pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)
+except:
+EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, 
RaiseError=False)
+finally:
+if Fd is not None:
+Fd.close()
+
+## Restore a Python object from a file
+#
+#   @param  FileThe path of file stored the object
+#
+#   @retval object  A python object
+#   @retval NoneIf failure in file operation
+#
+def _DataRestore(File):
+Data = None
+Fd = None
+try:
+Fd = open(File, 'rb')
+Data = pickle.load(Fd)
+except Exception as e:
+EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
+Data = None
+finally:
+if Fd is not None:
+Fd.close()
+return Data
+
 ## Check environment PATH variable to make sure the specified tool is found  #
 #   If the tool is found in the PATH, then True is returned
@@ -2242,19 +2280,19 @@ class Build():
 def DumpBuildData(self):
 CacheDirectory = os.path.dirname(GlobalData.gDatabasePath)
 Utils.CreateDirectory(CacheDirectory)
-Utils.DataDump(Utils.gFileTimeStampCache, os.path.join(CacheDirectory, 
"gFileTimeStampCache"))
-Utils.DataDump(Utils.gDependencyDatabase, os.path.join(CacheDirectory, 
"gDependencyDatabase"))
+Utils._DataDump(Utils.gFileTimeStampCache, 
os.path.join(CacheDirectory, "gFileTimeStampCache"))
+Utils._DataDump(Utils.gDependencyDatabase, 
+ os.path.join(CacheDirectory, "gDependencyDatabase"))
 
 def RestoreBuildData(self):
 FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), 
"gFileTimeStampCache")
 if Utils.gFileTimeStampCache == {} and os.path.isfile(FilePath):
-Utils.gFileTimeStampCache = Utils.DataRestore(FilePath)
+Utils.gFileTimeStampCache = Utils._DataRestore(FilePath)
 if Utils.gFileTimeStampCache is None:
 Utils.gFileTimeStampCache = {}
 
 FilePath = 

Re: [edk2] [PATCH] BaseTools:build break if the Path contains SingleFile.Ext

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, January 15, 2019 5:13 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:build break if the Path contains SingleFile.Ext

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

if SingleFile.Path = "/foo/bar.Sap/yada/source.S" and SingleFile.Ext = ".S". 
Then key would end up "/foo/bar"
instead of "/foo/bar.Sap/yada/source" as intended.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 1aa4a5ca5f..4bffb95ce6 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3012,7 +3012,7 @@ class ModuleAutoGen(AutoGen):
 self.BuildOption
 for SingleFile in FileList:
 if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder 
and SingleFile.Ext in self.BuildRules:
-key = SingleFile.Path.split(SingleFile.Ext)[0]
+key = SingleFile.Path.rsplit(SingleFile.Ext,1)[0]
 if key in Order_Dict:
 Order_Dict[key].append(SingleFile.Ext)
 else:
--
2.14.1.windows.1

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


Re: [edk2] [PATCH V2] BaseTools:Build fail when PCD use in the [DEPEX] section of INF files

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, January 15, 2019 5:11 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH V2] BaseTools:Build fail when PCD use in the [DEPEX] 
section of INF files

Update _FixedPcdVoidTypeDict to FixedVoidTypePcds '_FixedPcdVoidTypeDict' no 
longer exists because edk2 version (b23414f6).
'ModuleAutoGen' object has no attribute '_FixedPcdVoidTypeDict'.
Build fail when PCD use in the [DEPEX] section of INF files

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index cfe2d29099..5149bdd6ec 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2779,10 +2779,10 @@ class ModuleAutoGen(AutoGen):
 if '.' not in item:
 NewList.append(item)
 else:
-if item not in self._FixedPcdVoidTypeDict:
+if item not in self.FixedVoidTypePcds:
 EdkLogger.error("build", FORMAT_INVALID, "{} used 
in [Depex] section should be used as FixedAtBuild type and VOID* datum type in 
the module.".format(item))
 else:
-Value = self._FixedPcdVoidTypeDict[item]
+Value = self.FixedVoidTypePcds[item]
 if len(Value.split(',')) != 16:
 EdkLogger.error("build", FORMAT_INVALID,
 "{} used in [Depex] section 
should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the 
module.".format(item))
--
2.14.1.windows.1

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


Re: [edk2] [PATCH] BaseTools:The BuildOptionPcd value is wrong

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, January 15, 2019 5:14 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:The BuildOptionPcd value is wrong

In GenFds.py, Due to the second assignment, the value is wrong Its value should 
a list, not a string.and this line is not required

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 77383d3378..2baee570ed 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -192,7 +192,6 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
 else:
 EdkLogger.error("GenFds", OPTION_MISSING, "Missing active 
platform")
 
-GlobalData.BuildOptionPcd = FdsCommandDict.get("OptionPcd") if 
FdsCommandDict.get("OptionPcd") else {}
 GenFdsGlobalVariable.ActivePlatform = 
PathClass(NormPath(ActivePlatform))
 
 if FdsCommandDict.get("conf_directory"):
--
2.18.0.windows.1

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


Re: [edk2] [PATCH] BaseTools:Evaluation of undefined macros in dsc files

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Wednesday, January 16, 2019 2:56 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Evaluation of undefined macros in dsc files

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

doc:If macro that is not defined is used in locations that are not expressions 
(where the tools would just do macro expansion as in C flags in a 
[BuildOptions] section), nothing will be emitted.

This is in fact not what happens.Instead, the text
$(MACRO1) is emitted verbatim into the Makefile and left the for make to 
process.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 4da10e3950..fe07564bb3 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -34,7 +34,7 @@ gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ 
\t]*(?:\\(?:\r\n|\r
 
 ## Regular expression for matching macro used in header file inclusion  
gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
-
+gMacroRePattern = re.compile('.*?(\$\(\w*?\)).*?')
 gIsFileMap = {}
 
 ## pattern for include style in Edk.x code @@ -517,7 +517,21 @@ cleanlib:
 continue
 # Remove duplicated include path, if any
 if Attr == "FLAGS":
-Value = RemoveDupOption(Value, IncPrefix, 
MyAgo.IncludePathList)
+Value = ValueCopy = RemoveDupOption(Value, IncPrefix, 
MyAgo.IncludePathList)
+while (ValueCopy.find('$(') != -1):
+for macro in self._AutoGenObject.Macros:
+MacroName = '$(' + macro + ')'
+if (ValueCopy.find(MacroName) != -1):
+ValueCopy = ValueCopy.replace(MacroName, 
self._AutoGenObject.Macros[macro])
+break
+else:
+if gMacroRePattern.search(ValueCopy, 
re.UNICODE):
+FlageReList = 
gMacroRePattern.findall(ValueCopy, re.UNICODE)
+for FlageRe in FlageReList:
+Value = Value.replace(FlageRe, 
'').strip()
+break
+else:
+break
 if Tool == "OPTROM" and PCI_COMPRESS_Flag:
 ValueList = Value.split()
 if ValueList:
--
2.14.1.windows.1

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


[edk2] [PATCH v2] MinPlatformPkg: Support TCO base locked by FSP

2019-01-16 Thread Chasel, Chiu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1457

Per security recommendation TCO Base should be
initialized and locked by FSP and MinPlatform should
support both TCO Base locked and not locked scenarios.

Cc: Michael A Kubacki 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 Silicon/Intel/KabylakeSiliconPkg/Library/SiliconInitLib/SiliconInitPreMem.c
 |  8 +---
 
Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchCycleDecodingLib/PchCycleDecodingLib.c
 | 48 
 Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchCycleDecodingLib.h 
 | 18 +-
 3 files changed, 62 insertions(+), 12 deletions(-)

diff --git 
a/Silicon/Intel/KabylakeSiliconPkg/Library/SiliconInitLib/SiliconInitPreMem.c 
b/Silicon/Intel/KabylakeSiliconPkg/Library/SiliconInitLib/SiliconInitPreMem.c
index 616584ffe7..bb21872e1e 100644
--- 
a/Silicon/Intel/KabylakeSiliconPkg/Library/SiliconInitLib/SiliconInitPreMem.c
+++ 
b/Silicon/Intel/KabylakeSiliconPkg/Library/SiliconInitLib/SiliconInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -80,9 +80,11 @@ EarlySiliconInit (
   PchPwrmBaseSet (PCH_PWRM_BASE_ADDRESS);
 
   ///
-  /// Program TCO BASE
+  /// Program TCO BASE if it is present and not locked
   ///
-  PchTcoBaseSet (PcdGet16 (PcdTcoBaseAddress));
+  if (PchIsTcoBaseSetValid ()) {
+PchTcoBaseSet (PcdGet16 (PcdTcoBaseAddress));
+  }
 
   ///
   /// LPC I/O Configuration
diff --git 
a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchCycleDecodingLib/PchCycleDecodingLib.c
 
b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchCycleDecodingLib/PchCycleDecodingLib.c
index 68b0b5dd4b..d7e91f947b 100644
--- 
a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchCycleDecodingLib/PchCycleDecodingLib.c
+++ 
b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchCycleDecodingLib/PchCycleDecodingLib.c
@@ -1,7 +1,7 @@
 /** @file
   PCH cycle deocding configuration and query library.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
@@ -306,6 +306,36 @@ PchPwrmBaseGet (
 }
 
 /**
+  Check if TCO Base register is present and unlocked.
+  This should be called before calling PchTcoBaseSet ()
+
+  @retval BOOLEAN   FALSE = Either TCO base is locked or 
Smbus not present
+TRUE  = TCO base is not locked
+
+**/
+BOOLEAN
+EFIAPI
+PchIsTcoBaseSetValid (
+  VOID
+  )
+{
+  UINTN SmbusBase;
+
+  SmbusBase = MmPciBase (
+DEFAULT_PCI_BUS_NUMBER_PCH,
+PCI_DEVICE_NUMBER_PCH_SMBUS,
+PCI_FUNCTION_NUMBER_PCH_SMBUS
+);
+  if (MmioRead16 (SmbusBase) == 0x) {
+return FALSE;
+  }
+  //
+  // Verify TCO base is not locked.
+  //
+  return ((MmioRead8 (SmbusBase + R_PCH_SMBUS_TCOCTL) & 
B_PCH_SMBUS_TCOCTL_TCO_BASE_LOCK) == 0);
+}
+
+/**
   Set PCH TCO base address.
   This cycle decoding is allowed to set when DMIC.SRL is 0.
   Programming steps:
@@ -318,7 +348,8 @@ PchPwrmBaseGet (
 
   @retval EFI_SUCCESS   Successfully completed.
   @retval EFI_INVALID_PARAMETER Invalid base address passed.
-  @retval EFI_UNSUPPORTED   DMIC.SRL is set.
+  @retval EFI_UNSUPPORTED   DMIC.SRL is set, or Smbus device not 
present
+  @retval EFI_DEVICE_ERROR  TCO Base register is locked already
 **/
 EFI_STATUS
 EFIAPI
@@ -353,16 +384,17 @@ PchTcoBaseSet (
   //
   // Verify TCO base is not locked.
   //
-  if ((MmioRead8 (SmbusBase + R_PCH_SMBUS_TCOCTL) & 
B_PCH_SMBUS_TCOCTL_TCO_BASE_LOCK) != 0) {
+  if (!PchIsTcoBaseSetValid ()) {
 ASSERT (FALSE);
 return EFI_DEVICE_ERROR;
   }
   //
   // Disable TCO in SMBUS Device first before changing base address.
+  // Byte access to not touch the TCO_BASE_LOCK bit
   //
-  MmioAnd16 (
-SmbusBase + R_PCH_SMBUS_TCOCTL,
-(UINT16) ~B_PCH_SMBUS_TCOCTL_TCO_BASE_EN
+  MmioAnd8 (
+SmbusBase + R_PCH_SMBUS_TCOCTL + 1,
+(UINT8) ~(B_PCH_SMBUS_TCOCTL_TCO_BASE_EN >> 8)
 );
   //
   // Program TCO in SMBUS Device
@@ -373,11 +405,11 @@ PchTcoBaseSet (
 Address
 );
   //
-  // Enable TCO in SMBUS Device
+  // Enable TCO in SMBUS Device 

[edk2] [PATCH] MdePkg/UefiDebugLibDebugPortProtocol: Modify supported type.

2019-01-16 Thread Jiansong Xu
From: jiansonx 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1416
Remove DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type from the supported
module type list in the library INF file. Then, these library instances
don't support DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type any more.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiansong Xu 
Cc: Gao Liming 
---
 .../UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
index 035fc5103e..1627862ef8 100644
--- 
a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
+++ 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
@@ -22,7 +22,7 @@
   FILE_GUID  = 102287b4-6b12-4D41-91e1-ebee1f3aa614
   MODULE_TYPE= UEFI_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
 
 
 #
-- 
2.16.2.windows.1

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


[edk2] [PATCH] MdePkg/UefiDebugLibStdErr: Modify supported type.

2019-01-16 Thread Jiansong Xu
From: jiansonx 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1416
Remove DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type from the supported
module type list in the library INF file. Then, these library instances
don't support DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type any more.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiansong Xu 
Cc: Gao Liming 
---
 MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf 
b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
index fe333b05ce..dd0a9e5d7e 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+++ b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
@@ -22,7 +22,7 @@
   FILE_GUID  = b57a1df6-ffdb-4247-a3df-3a562176751a
   MODULE_TYPE= UEFI_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
 
 
 #
-- 
2.16.2.windows.1

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


[edk2] [PATCH] MdePkg/UefiDebugLibConOut: Modify supported type.

2019-01-16 Thread Jiansong Xu
From: jiansonx 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1416
Remove DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type from the supported
module type list in the library INF file. Then, these library instances
don't support DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER type any more.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiansong Xu 
Cc: Gao Liming 
---
 MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf 
b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
index 097de756a5..e944d1f484 100644
--- a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+++ b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
@@ -22,7 +22,7 @@
   FILE_GUID  = 5cddfaf3-e9a7-4d16-bdce-1e002df475bb
   MODULE_TYPE= UEFI_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = DebugLib|DXE_CORE DXE_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
 
 
 #
-- 
2.16.2.windows.1

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


Re: [edk2] [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib resolution

2019-01-16 Thread Qian, Yi
Reviewed-by: Qian Yi 

Thanks
Qian Yi

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Thursday, January 17, 2019 1:45 AM
> To: Gao, Liming ; Qian, Yi 
> Cc: edk2-devel@lists.01.org; Sun, Zailiang ; Laszlo
> Ersek ; Leif Lindholm ;
> Kinney, Michael D ; Wang, Jian J
> ; Wu, Hao A ; Jagadeesh Ujja
> ; Achin Gupta ;
> Thomas Panakamattam Abraham ; Sami
> Mujawar ; Zeng, Star 
> Subject: Re: [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib
> resolution
> 
> (add Yi as well)
> 
> On Wed, 16 Jan 2019 at 16:14, Gao, Liming  wrote:
> >
> > Zailiang:
> >   Could you help review this change?
> >
> > > -Original Message-
> > > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > > Sent: Monday, January 14, 2019 9:28 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Ard Biesheuvel ; Laszlo Ersek
> > > ; Leif Lindholm ;
> > > Kinney, Michael D ; Gao, Liming
> > > ; Wang, Jian J ; Wu,
> > > Hao A ; Jagadeesh Ujja
> ;
> > > Achin Gupta ; Thomas Panakamattam Abraham
> > > ; Sami Mujawar
> ; Zeng,
> > > Star 
> > > Subject: [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib
> > > resolution
> > >
> > > The SMM based FTW and variable drivers are going to depend on
> > > MmServicesTableLib after a subsequent patch, so add a resolution for
> > > it to various Vlv2TbltDevicePkg .dsc files.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> > > ---
> > >  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
> > >  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
> > >  Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
> > >  3 files changed, 3 insertions(+)
> > >
> > > diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > index d43611550285..eb7c205a10a6 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > @@ -406,6 +406,7 @@ [LibraryClasses.X64.DXE_CORE]  !endif
> > >
> > >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > > +
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTab
> > > + leLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> ableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S
> mmReportStatusCodeLib.inf
> > >
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> moryA
> > > llocationLib.inf diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > index a33816c4d18b..b2f0d73f6d05 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > @@ -406,6 +406,7 @@ [LibraryClasses.IA32.DXE_CORE]  !endif
> > >
> > >  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> > > +
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTab
> > > + leLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> ableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S
> mmReportStatusCodeLib.inf
> > >
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> moryA
> > > llocationLib.inf diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > index 1da1442c64c6..aa62c07f177b 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > @@ -408,6 +408,7 @@ [LibraryClasses.X64.DXE_CORE]  !endif
> > >
> > >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > > +
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTab
> > > + leLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> ableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S
> mmReportStatusCodeLib.inf
> > >
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> moryA
> > > llocationLib.inf
> > > --
> > > 2.20.1
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MinPlatformPkg: Correct typo in INF

2019-01-16 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki 

-Original Message-
From: Chiu, Chasel 
Sent: Wednesday, January 16, 2019 4:11 PM
To: edk2-devel@lists.01.org
Cc: Kubacki, Michael A ; Yao, Jiewen 
; Chiu, Chasel 
Subject: [PATCH] MinPlatformPkg: Correct typo in INF

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

SiliconPolicyInitLibNull.inf and SiliconPolicyUpdateLibNull.inf both had wrong 
BASE_NAME and LIBRARY_CLASS, so correct them to align with file naming and the 
purpose.

Cc: Michael A Kubacki 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
 | 6 +++---
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
 | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
index 593d1490f1..ae696ccc90 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyIn
+++ itLibNull/SiliconPolicyInitLibNull.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component information file for Silicon Init Library  # -# Copyright (c) 
2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights 
+reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under  # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -15,11 +15,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = SiliconInitLibNull
+  BASE_NAME  = SiliconPolicyInitLibNull
   FILE_GUID  = 81B55810-E3DE-4E3E-8477-B8768232193A
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SiliconInitLib
+  LIBRARY_CLASS  = SiliconPolicyInitLib
 
 [LibraryClasses]
   BaseLib
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
index ab03602297..d2018881bb 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUp
+++ dateLibNull/SiliconPolicyUpdateLibNull.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component information file for Silicon Update Library  # -# Copyright (c) 
2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights 
+reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under  # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -15,11 +15,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = SiliconUpdateLibNull
+  BASE_NAME  = SiliconPolicyUpdateLibNull
   FILE_GUID  = 7D4AA651-D23B-42FC-ABE4-8A2FDF260B9F
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SiliconUpdateLib
+  LIBRARY_CLASS  = SiliconPolicyUpdateLib
 
 [LibraryClasses]
   BaseLib
--
2.13.3.windows.1

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


Re: [edk2] [edk2-platforms PATCH] MinPlatformPkg: Use merged variable driver for emulated NV mode

2019-01-16 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki   

-Original Message-
From: Zeng, Star 
Sent: Wednesday, January 16, 2019 2:25 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star ; Kubacki, Michael A 
; Yao, Jiewen 
Subject: [edk2-platforms PATCH] MinPlatformPkg: Use merged variable driver for 
emulated NV mode

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
Merge EmuVariable and Real variable driver.

The real variable driver has been updated to support emulated variable NV mode 
and the EmuVariableRuntimeDxe will be removed later, so use merged variable 
driver for emulated NV mode.

Cc: Michael A Kubacki 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc  | 7 +--
 Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
index 9b033f43a6cb..6bd526a27b09 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights 
+reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under  # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -44,7 +44,10 @@
   NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf
   }
 !else
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+  }
 !endif
 
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf 
b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
index da5ca7619732..be3caad402f9 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
+++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  FDF file of Platform.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights 
+reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under  # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -26,7 +26,7 @@
 INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == TRUE -INF  
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 !endif
 
 INF  
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
--
2.7.0.windows.1

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


Re: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10

2019-01-16 Thread Gao, Liming
Hi, 
 NO_MSABI_VA_FUNCS flag is required. I miss to add it. I don't verify its boot. 
If you have any finding, please reply the mail. 

Thanks
Liming
>-Original Message-
>From: 唐佳诚 [mailto:chasont...@warmbloom.com]
>Sent: Thursday, January 17, 2019 11:45 AM
>To: Gao, Liming ; edk2-devel de...@lists.01.org>
>Subject: Re:RE: [edk2] EmulatorPkg build issue with macOS mojave and Xcode
>10
>
>Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1471
>
>Thanks
>ChasonTang
>  -- Original --From:  "唐佳诚
>";Date:  Thu, Jan 17, 2019 11:25 AMTo:  "Gao,
>Liming"; "edk2-devel";
>Subject:  Re:RE: [edk2] EmulatorPkg build issue with macOS mojave and Xcode
>10 Hi,
>  I clone your git repository and checkout XcodeEmulator branch, but failed
>with some error. The following are the error messages.
>
>> source ./edksetup.sh
>> cd EmulatorPkg
>> ./build.sh
>
>Building from: /Users/QianYun/Downloads/edk2
>using prebuilt tools
>'import sitecustomize' failed; use -v for traceback
>Build environment: Darwin-18.2.0-x86_64-i386-64bit
>Build start time: 11:00:23, Jan.17 2019
>
>WORKSPACE= /Users/QianYun/Downloads/edk2
>EDK_TOOLS_PATH   = /Users/QianYun/Downloads/edk2/BaseTools
>CONF_PATH= /Users/QianYun/Downloads/edk2/Conf
>
>
>Architecture(s)  = X64
>Build target = DEBUG
>Toolchain= XCODE32
>
>Active Platform  =
>/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.dsc
>Flash Image Definition   =
>/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.fdf
>
>Processing meta-data . done!
>Generating code . done!
>Generating makefile . done!
>Building ...
>/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/BaseLib.inf [X64]
>"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar -fno-
>strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -fomit-frame-
>pointer -static -c -include AutoGen.h -fno-stack-protector -o
>/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/
>MdePkg/Library/BaseLib/BaseLib/OUTPUT/./CheckSum.obj -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib -
>I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64
>/MdePkg/Library/BaseLib/BaseLib/DEBUG -
>I/Users/QianYun/Downloads/edk2/MdePkg -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64
>/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/CheckSum.c
>"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar -fno-
>strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -fomit-frame-
>pointer -static -c -include AutoGen.h -fno-stack-protector -o
>/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/
>MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib -
>I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64
>/MdePkg/Library/BaseLib/BaseLib/DEBUG -
>I/Users/QianYun/Downloads/edk2/MdePkg -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64
>/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c
>/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c:66:
>3: error: '__builtin_ms_va_start' used in System V ABI function
>  __builtin_ms_va_start (Marker, NewStack);
>  ^
>1 error generated.
>make: ***
>[/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64
>/MdePkg/Library/BaseLib/BaseLib/OUTPUT/SwitchStack.obj] Error 1
>
>
>build.py...
> : error 7000: Failed to execute command
>   make -f
>/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/
>MdePkg/Library/BaseLib/BaseLib/GNUmakefile pbuild
>[/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64]
>
>- Failed -
>Build end time: 11:00:26, Jan.17 2019
>Build total time: 00:00:03
>
>Then I checked the source code and cc flag between XcodeEmulator branch
>and master.
>XcodeEmulator:
>gcc -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar -fno-strict-
>aliasing -Wall -Werror -Wno-missing-braces -Wno-address -fomit-frame-
>pointer -static -c -include AutoGen.h -fno-stack-protector -o
>/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/
>MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 -
>I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib -
>I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64
>/MdePkg/Library/BaseLib/BaseLib/DEBUG -
>I/Users/QianYun/Downloads/edk2/MdePkg -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include -
>I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64
>/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c
>
>master:
>clang -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -
>fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-

Re: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10

2019-01-16 Thread 唐佳诚
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1471

Thanks
ChasonTang
  -- Original --From:  
"唐佳诚";Date:  Thu, Jan 17, 2019 11:25 AMTo:  "Gao, 
Liming"; "edk2-devel"; Subject:  
Re:RE: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10 Hi,
  I clone your git repository and checkout XcodeEmulator branch, but failed 
with some error. The following are the error messages.

> source ./edksetup.sh
> cd EmulatorPkg
> ./build.sh

Building from: /Users/QianYun/Downloads/edk2
using prebuilt tools
'import sitecustomize' failed; use -v for traceback
Build environment: Darwin-18.2.0-x86_64-i386-64bit
Build start time: 11:00:23, Jan.17 2019

WORKSPACE= /Users/QianYun/Downloads/edk2
EDK_TOOLS_PATH   = /Users/QianYun/Downloads/edk2/BaseTools
CONF_PATH= /Users/QianYun/Downloads/edk2/Conf


Architecture(s)  = X64
Build target = DEBUG
Toolchain= XCODE32

Active Platform  = 
/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.dsc
Flash Image Definition   = 
/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.fdf

Processing meta-data . done!
Generating code . done!
Generating makefile . done!
Building ... /Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/BaseLib.inf 
[X64]
"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./CheckSum.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/CheckSum.c
"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c:66:3: error: 
'__builtin_ms_va_start' used in System V ABI function
  __builtin_ms_va_start (Marker, NewStack);
  ^
1 error generated.
make: *** 
[/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/SwitchStack.obj]
 Error 1


build.py...
 : error 7000: Failed to execute command
make -f 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/GNUmakefile
 pbuild [/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64]

- Failed -
Build end time: 11:00:26, Jan.17 2019
Build total time: 00:00:03

Then I checked the source code and cc flag between XcodeEmulator branch and 
master.
XcodeEmulator:
gcc -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c

master:
clang -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char 
-fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar 
-mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces 
-Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare 
-Wno-varargs 
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D 
NO_MSABI_VA_FUNCS  -o 
/Users/QianYun/Code/edk2/Build/Emulator/DEBUG_XCODE5/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Code/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Code/edk2/MdePkg/Library/BaseLib 

Re: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10

2019-01-16 Thread 唐佳诚
Hi,
  I clone your git repository and checkout XcodeEmulator branch, but failed 
with some error. The following are the error messages.

> source ./edksetup.sh
> cd EmulatorPkg
> ./build.sh

Building from: /Users/QianYun/Downloads/edk2
using prebuilt tools
'import sitecustomize' failed; use -v for traceback
Build environment: Darwin-18.2.0-x86_64-i386-64bit
Build start time: 11:00:23, Jan.17 2019

WORKSPACE= /Users/QianYun/Downloads/edk2
EDK_TOOLS_PATH   = /Users/QianYun/Downloads/edk2/BaseTools
CONF_PATH= /Users/QianYun/Downloads/edk2/Conf


Architecture(s)  = X64
Build target = DEBUG
Toolchain= XCODE32

Active Platform  = 
/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.dsc
Flash Image Definition   = 
/Users/QianYun/Downloads/edk2/EmulatorPkg/EmulatorPkg.fdf

Processing meta-data . done!
Generating code . done!
Generating makefile . done!
Building ... /Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/BaseLib.inf 
[X64]
"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./CheckSum.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/CheckSum.c
"gcc" -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c:66:3: error: 
'__builtin_ms_va_start' used in System V ABI function
  __builtin_ms_va_start (Marker, NewStack);
  ^
1 error generated.
make: *** 
[/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/SwitchStack.obj]
 Error 1


build.py...
 : error 7000: Failed to execute command
make -f 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/GNUmakefile
 pbuild [/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64]

- Failed -
Build end time: 11:00:26, Jan.17 2019
Build total time: 00:00:03

Then I checked the source code and cc flag between XcodeEmulator branch and 
master.
XcodeEmulator:
gcc -arch x86_64 -save-temps -g -O0 -mms-bitfields -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address 
-fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector -o 
/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Downloads/edk2/Build/EmulatorX64/DEBUG_XCODE32/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Downloads/edk2/MdePkg 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include 
-I/Users/QianYun/Downloads/edk2/MdePkg/Include/X64 
/Users/QianYun/Downloads/edk2/MdePkg/Library/BaseLib/SwitchStack.c

master:
clang -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char 
-fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar 
-mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces 
-Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare 
-Wno-varargs 
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D 
NO_MSABI_VA_FUNCS  -o 
/Users/QianYun/Code/edk2/Build/Emulator/DEBUG_XCODE5/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/./SwitchStack.obj
 -I/Users/QianYun/Code/edk2/MdePkg/Library/BaseLib/X64 
-I/Users/QianYun/Code/edk2/MdePkg/Library/BaseLib 
-I/Users/QianYun/Code/edk2/Build/Emulator/DEBUG_XCODE5/X64/MdePkg/Library/BaseLib/BaseLib/DEBUG
 -I/Users/QianYun/Code/edk2/MdePkg -I/Users/QianYun/Code/edk2/MdePkg/Include 
-I/Users/QianYun/Code/edk2/MdePkg/Include/X64 
/Users/QianYun/Code/edk2/MdePkg/Library/BaseLib/SwitchStack.c

Maybe we should add 

[edk2] [PATCH 3/3] FatPkg: Add GPT check in FatPei to support Capsule-on-Disk feature.

2019-01-16 Thread Chen A Chen
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470
This feature is used for finding GPT partition, follow the following step to 
check.
1) Check Protective MBR.
2) Check GPT primary/backup header.
3) Check GPT primary/backup entry array.

Cc: Ruiyu Ni 
Cc: Zhang Chao B 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen 
---
 FatPkg/FatPei/FatLitePeim.h |   1 +
 FatPkg/FatPei/FatPei.inf|   3 +
 FatPkg/FatPei/Gpt.c | 546 
 3 files changed, 550 insertions(+)
 create mode 100644 FatPkg/FatPei/Gpt.c

diff --git a/FatPkg/FatPei/FatLitePeim.h b/FatPkg/FatPei/FatLitePeim.h
index fbf887da5f..afb429c56e 100644
--- a/FatPkg/FatPei/FatLitePeim.h
+++ b/FatPkg/FatPei/FatLitePeim.h
@@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/FatPkg/FatPei/FatPei.inf b/FatPkg/FatPei/FatPei.inf
index 829e87fe92..dd0869f7cd 100644
--- a/FatPkg/FatPei/FatPei.inf
+++ b/FatPkg/FatPei/FatPei.inf
@@ -31,6 +31,7 @@
 
 [Sources]
   Mbr.c
+  Gpt.c
   Eltorito.c
   Part.c
   FatLiteApi.c
@@ -49,6 +50,7 @@
 [LibraryClasses]
   PcdLib
   BaseMemoryLib
+  MemoryAllocationLib
   PeimEntryPoint
   BaseLib
   DebugLib
@@ -61,6 +63,7 @@
   gRecoveryOnFatIdeDiskGuid   ## SOMETIMES_CONSUMES   ## 
UNDEFINED
   gRecoveryOnFatFloppyDiskGuid## SOMETIMES_CONSUMES   ## 
UNDEFINED
   gRecoveryOnFatNvmeDiskGuid  ## SOMETIMES_CONSUMES   ## 
UNDEFINED
+  gEfiPartTypeUnusedGuid  ## SOMETIMES_CONSUMES   ## 
UNDEFINED
 
 
 [Ppis]
diff --git a/FatPkg/FatPei/Gpt.c b/FatPkg/FatPei/Gpt.c
new file mode 100644
index 00..d1f4c1c8b5
--- /dev/null
+++ b/FatPkg/FatPei/Gpt.c
@@ -0,0 +1,546 @@
+/** @file
+  Routines supporting partition discovery and
+  logical device reading
+
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+
+This program and the accompanying materials are licensed and made available
+under the terms and conditions of the BSD License which accompanies this
+distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include "FatLitePeim.h"
+
+//
+// Assumption: 'a' and 'blocksize' are all UINT32 or UINT64.
+// If 'a' and 'blocksize' are not the same type, should use DivU64xU32 to 
calculate.
+//
+#define EFI_SIZE_TO_BLOCKS(a, blocksize)  (((a) / (blocksize)) + (((a) % 
(blocksize)) ? 1 : 0))
+
+//
+// GPT Partition Entry Status
+//
+typedef struct {
+  BOOLEAN OutOfRange;
+  BOOLEAN Overlap;
+  BOOLEAN OsSpecific;
+} EFI_PARTITION_ENTRY_STATUS;
+
+/**
+  Check if the CRC field in the Partition table header is valid
+
+  @param[in]  BlockIo Parent BlockIo interface
+  @param[in]  DiskIo  Disk Io Protocol.
+  @param[in]  PartHeader  Partition table header structure
+
+  @retval TRUE  the CRC is valid
+  @retval FALSE the CRC is invalid
+
+**/
+BOOLEAN
+PartitionCheckGptHeaderCRC (
+  IN  EFI_PARTITION_TABLE_HEADER  *PartHeader
+  )
+{
+  UINT32  GptHdrCrc;
+  UINT32  Crc;
+
+  GptHdrCrc = PartHeader->Header.CRC32;
+
+  //
+  // Set CRC field to zero when doing calcuation
+  //
+  PartHeader->Header.CRC32 = 0;
+
+  Crc = CalculateCrc32 (PartHeader, PartHeader->Header.HeaderSize);
+
+  //
+  // Restore Header CRC
+  //
+  PartHeader->Header.CRC32 = GptHdrCrc;
+
+  return (GptHdrCrc == Crc);
+}
+
+
+/**
+  Check if the CRC field in the Partition table header is valid
+  for Partition entry array.
+
+  @param[in]  BlockIo Parent BlockIo interface
+  @param[in]  DiskIo  Disk Io Protocol.
+  @param[in]  PartHeader  Partition table header structure
+
+  @retval TRUE  the CRC is valid
+  @retval FALSE the CRC is invalid
+
+**/
+BOOLEAN
+PartitionCheckGptEntryArrayCRC (
+  IN  EFI_PARTITION_TABLE_HEADER *PartHeader,
+  IN  EFI_PARTITION_ENTRY*PartEntry
+  )
+{
+  UINT32  Crc;
+  UINTN   Size;
+
+  Size = (UINTN)MultU64x32(PartHeader->NumberOfPartitionEntries, 
PartHeader->SizeOfPartitionEntry);
+  Crc  = CalculateCrc32 (PartEntry, Size);
+
+  return (BOOLEAN) (PartHeader->PartitionEntryArrayCRC32 == Crc);
+}
+
+/**
+  The function is used for valid GPT table. Both for Primary and Backup GPT 
header.
+
+  @param[in]  PrivateData   The global memory map 
+  @param[in]  ParentBlockDevNo  The parent block device
+  @param[in]  IsPrimaryHeader   Indicate to which header will be checked.
+  @param[in]  PartHdr   Stores the partition table that is read
+
+  @retval TRUE  The partition table is valid
+  @retval FALSE The partition table is not valid
+
+**/
+BOOLEAN
+PartitionCheckGptHeader (  
+  IN  PEI_FAT_PRIVATE_DATA*PrivateData,

[edk2] [PATCH 2/2] MdePkg/UefiGpt.h: Add new definition for enable GPT support

2019-01-16 Thread Chen A Chen
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470
This two new definitions are defined for GPT in FatPei diver.

Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Zhang Chao B 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen 
---
 MdePkg/Include/Uefi/UefiGpt.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/MdePkg/Include/Uefi/UefiGpt.h b/MdePkg/Include/Uefi/UefiGpt.h
index f635b05390..8665c8cbc9 100644
--- a/MdePkg/Include/Uefi/UefiGpt.h
+++ b/MdePkg/Include/Uefi/UefiGpt.h
@@ -24,9 +24,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 /// EFI Partition Table Signature: "EFI PART".
 ///
 #define EFI_PTAB_HEADER_ID  SIGNATURE_64 ('E','F','I',' ','P','A','R','T')
+///
+/// Minimum bytes reserve for EFI entry array buffer.
+///
+#define GPT_PART_ENTRY_MIN_SIZE 16384
 
 #pragma pack(1)
 
+///
+/// MBR Partition Entry
+///
+typedef struct {
+  UINT8   BootIndicator;
+  UINT8   StartingCHS[3];
+  UINT8   OSType;
+  UINT8   EndingCHS[3];
+  UINT32  StartingLBA;
+  UINT32  SizeInLBA;
+} MBR_PARTITION_ENTRY;
+
 ///
 /// GPT Partition Table Header.
 ///
-- 
2.16.2.windows.1

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


[edk2] [PATCH 1/2] FatPkg: Break down Part.c file.

2019-01-16 Thread Chen A Chen
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470
Break down partition parsing logic to 2 parts, Eltorito and MBR.

Cc: Ruiyu Ni 
Cc: Zhang Chao B 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen 
---
 FatPkg/FatPei/Eltorito.c | 239 +
 FatPkg/FatPei/FatPei.inf |   2 +
 FatPkg/FatPei/Mbr.c  | 182 ++
 FatPkg/FatPei/Part.c | 385 +--
 4 files changed, 424 insertions(+), 384 deletions(-)
 create mode 100644 FatPkg/FatPei/Eltorito.c
 create mode 100644 FatPkg/FatPei/Mbr.c

diff --git a/FatPkg/FatPei/Eltorito.c b/FatPkg/FatPei/Eltorito.c
new file mode 100644
index 00..ffaef51860
--- /dev/null
+++ b/FatPkg/FatPei/Eltorito.c
@@ -0,0 +1,239 @@
+/** @file
+  Routines supporting partition discovery and
+  logical device reading
+
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+
+This program and the accompanying materials are licensed and made available
+under the terms and conditions of the BSD License which accompanies this
+distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include "FatLitePeim.h"
+
+/**
+  This function finds Eltorito partitions. Main algorithm
+  is ported from DXE partition driver.
+
+  @param  PrivateData   The global memory map
+  @param  ParentBlockDevNo  The parent block device
+
+  @retval TRUE  New partitions are detected and logical block 
devices
+are  added to block device array
+  @retval FALSE No New partitions are added;
+
+**/
+BOOLEAN
+FatFindEltoritoPartitions (
+  IN  PEI_FAT_PRIVATE_DATA *PrivateData,
+  IN  UINTNParentBlockDevNo
+  )
+{
+  EFI_STATUS  Status;
+  BOOLEAN Found;
+  PEI_FAT_BLOCK_DEVICE*BlockDev;
+  PEI_FAT_BLOCK_DEVICE*ParentBlockDev;
+  UINT32  VolDescriptorLba;
+  UINT32  Lba;
+  CDROM_VOLUME_DESCRIPTOR *VolDescriptor;
+  ELTORITO_CATALOG*Catalog;
+  UINTN   Check;
+  UINTN   Index;
+  UINTN   MaxIndex;
+  UINT16  *CheckBuffer;
+  UINT32  SubBlockSize;
+  UINT32  SectorCount;
+  UINT32  VolSpaceSize;
+
+  if (ParentBlockDevNo > PEI_FAT_MAX_BLOCK_DEVICE - 1) {
+return FALSE;
+  }
+
+  Found   = FALSE;
+  ParentBlockDev  = &(PrivateData->BlockDevice[ParentBlockDevNo]);
+  VolSpaceSize= 0;
+
+  //
+  // CD_ROM has the fixed block size as 2048 bytes
+  //
+  if (ParentBlockDev->BlockSize != 2048) {
+return FALSE;
+  }
+
+  VolDescriptor = (CDROM_VOLUME_DESCRIPTOR *) PrivateData->BlockData;
+  Catalog   = (ELTORITO_CATALOG *) VolDescriptor;
+
+  //
+  // the ISO-9660 volume descriptor starts at 32k on the media
+  // and CD_ROM has the fixed block size as 2048 bytes, so...
+  //
+  VolDescriptorLba = 15;
+  //
+  // ((16*2048) / Media->BlockSize) - 1;
+  //
+  // Loop: handle one volume descriptor per time
+  //
+  while (TRUE) {
+
+VolDescriptorLba += 1;
+if (VolDescriptorLba > ParentBlockDev->LastBlock) {
+  //
+  // We are pointing past the end of the device so exit
+  //
+  break;
+}
+
+Status = FatReadBlock (
+  PrivateData,
+  ParentBlockDevNo,
+  VolDescriptorLba,
+  ParentBlockDev->BlockSize,
+  VolDescriptor
+  );
+if (EFI_ERROR (Status)) {
+  break;
+}
+//
+// Check for valid volume descriptor signature
+//
+if (VolDescriptor->Unknown.Type == CDVOL_TYPE_END ||
+CompareMem (VolDescriptor->Unknown.Id, CDVOL_ID, sizeof 
(VolDescriptor->Unknown.Id)) != 0
+) {
+  //
+  // end of Volume descriptor list
+  //
+  break;
+}
+//
+// Read the Volume Space Size from Primary Volume Descriptor 81-88 byte
+//
+if (VolDescriptor->Unknown.Type == CDVOL_TYPE_CODED) {
+  VolSpaceSize = VolDescriptor->PrimaryVolume.VolSpaceSize[1];
+}
+//
+// Is it an El Torito volume descriptor?
+//
+if (CompareMem (
+  VolDescriptor->BootRecordVolume.SystemId,
+  CDVOL_ELTORITO_ID,
+  sizeof (CDVOL_ELTORITO_ID) - 1
+  ) != 0) {
+  continue;
+}
+//
+// Read in the boot El Torito boot catalog
+//
+Lba = UNPACK_INT32 (VolDescriptor->BootRecordVolume.EltCatalog);
+if (Lba > ParentBlockDev->LastBlock) {
+  continue;
+}
+
+Status = FatReadBlock (
+  PrivateData,
+  ParentBlockDevNo,
+  Lba,
+  ParentBlockDev->BlockSize,
+  Catalog
+  );
+if (EFI_ERROR (Status)) {
+  

Re: [edk2] [Patch] BaseTools: Remove EDK_SOURCE keyword from ECC Tool

2019-01-16 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Tuesday, January 15, 2019 7:03 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming 
>Subject: [Patch] BaseTools: Remove EDK_SOURCE keyword from ECC Tool
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>Remove EDK_SOURCE keyword from ECC Tool.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>---
> BaseTools/Source/Python/Ecc/EccMain.py| 27 ---
> .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 20 --
> 2 files changed, 47 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Ecc/EccMain.py
>b/BaseTools/Source/Python/Ecc/EccMain.py
>index 5f9e497e37..0f97447751 100644
>--- a/BaseTools/Source/Python/Ecc/EccMain.py
>+++ b/BaseTools/Source/Python/Ecc/EccMain.py
>@@ -66,47 +66,20 @@ class Ecc(object):
>
> # Parse the options and args
> self.ParseOption()
> EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime())
>+ "[00:00]" + "\n")
>
>-#
>-# Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always
>point to ECP
>-#
> WorkspaceDir =
>os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
> os.environ["WORKSPACE"] = WorkspaceDir
>
> # set multiple workspace
> PackagesPath = os.getenv("PACKAGES_PATH")
> mws.setWs(WorkspaceDir, PackagesPath)
>
>-if "ECP_SOURCE" not in os.environ:
>-os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir,
>GlobalData.gEdkCompatibilityPkg)
>-if "EFI_SOURCE" not in os.environ:
>-os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
>-if "EDK_SOURCE" not in os.environ:
>-os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"]
>-
>-#
>-# Unify case of characters on case-insensitive systems
>-#
>-EfiSourceDir =
>os.path.normcase(os.path.normpath(os.environ["EFI_SOURCE"]))
>-EdkSourceDir =
>os.path.normcase(os.path.normpath(os.environ["EDK_SOURCE"]))
>-EcpSourceDir =
>os.path.normcase(os.path.normpath(os.environ["ECP_SOURCE"]))
>-
>-os.environ["EFI_SOURCE"] = EfiSourceDir
>-os.environ["EDK_SOURCE"] = EdkSourceDir
>-os.environ["ECP_SOURCE"] = EcpSourceDir
>-
> GlobalData.gWorkspace = WorkspaceDir
>-GlobalData.gEfiSource = EfiSourceDir
>-GlobalData.gEdkSource = EdkSourceDir
>-GlobalData.gEcpSource = EcpSourceDir
>
> GlobalData.gGlobalDefines["WORKSPACE"]  = WorkspaceDir
>-GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir
>-GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir
>-GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir
>
> EdkLogger.info("Loading ECC configuration ... done")
> # Generate checkpoints list
> EccGlobalData.gConfig = Configuration(self.ConfigFile)
>
>diff --git
>a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>index 283789fd1d..862974894a 100644
>--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>@@ -608,21 +608,10 @@ class InfParser(MetaFileParser):
> for Index in range(0, len(self._ValueList)):
> Value = self._ValueList[Index]
> if not Value:
> continue
>
>-if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or
>Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:
>-Value = '$(EDK_SOURCE)' + Value[17:]
>-if Value.find('$(EFI_SOURCE)') > -1 or 
>Value.find('$(EDK_SOURCE)') >
>-1:
>-pass
>-elif Value.startswith('.'):
>-pass
>-elif Value.startswith('$('):
>-pass
>-else:
>-Value = '$(EFI_SOURCE)/' + Value
>-
> self._ValueList[Index] = ReplaceMacro(Value, Macros)
>
> ## Parse [Sources] section
> #
> #   Only path can have macro used. So we need to replace them before use.
>@@ -1357,20 +1346,11 @@ class DscParser(MetaFileParser):
> __IncludeMacros = {}
> #
> # Allow using system environment variables  in path after !include
> #
> __IncludeMacros['WORKSPACE'] =
>GlobalData.gGlobalDefines['WORKSPACE']
>-if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys():
>-__IncludeMacros['ECP_SOURCE'] =
>GlobalData.gGlobalDefines['ECP_SOURCE']
>-#
>-# During GenFds phase call DSC parser, will go into this branch.
>-#
>-elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys():
>-__IncludeMacros['ECP_SOURCE'] =
>GlobalData.gCommandLineDefines['ECP_SOURCE']
>
>-

Re: [edk2] [Patch V2] BaseTools: Remove EDK_SOURCE keyword from Inf Parser.

2019-01-16 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Tuesday, January 15, 2019 7:57 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming 
>Subject: [Patch V2] BaseTools: Remove EDK_SOURCE keyword from Inf Parser.
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>Remove unused EDK_SOURCE keyword from Inf Parser.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>Tested-by: Laszlo Ersek 
>---
> .../Source/Python/Workspace/InfBuildData.py   | 34 ---
> 1 file changed, 7 insertions(+), 27 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
>b/BaseTools/Source/Python/Workspace/InfBuildData.py
>index 02d6c1c756..709854de1e 100644
>--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
>@@ -634,38 +634,18 @@ class InfBuildData(ModuleBuildClassObject):
>
> Macros = self._Macros
> Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR',
>self._Arch)
> RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch,
>self._Platform]
> for Record in RecordList:
>-if Record[0].find('EDK_SOURCE') > -1:
>-File = NormPath(Record[0], self._Macros)
>-if File[0] == '.':
>-File = os.path.join(self._ModuleDir, File)
>-else:
>-File = os.path.join(GlobalData.gWorkspace, File)
>-File = RealPath(os.path.normpath(File))
>-if File:
>-RetVal.append(File)
>-
>-# TRICK: let compiler to choose correct header file
>-File = NormPath(Record[0], self._Macros)
>-if File[0] == '.':
>-File = os.path.join(self._ModuleDir, File)
>-else:
>-File = os.path.join(GlobalData.gWorkspace, File)
>-File = RealPath(os.path.normpath(File))
>-if File:
>-RetVal.append(File)
>+File = NormPath(Record[0], Macros)
>+if File[0] == '.':
>+File = os.path.join(self._ModuleDir, File)
> else:
>-File = NormPath(Record[0], Macros)
>-if File[0] == '.':
>-File = os.path.join(self._ModuleDir, File)
>-else:
>-File = mws.join(GlobalData.gWorkspace, File)
>-File = RealPath(os.path.normpath(File))
>-if File:
>-RetVal.append(File)
>+File = mws.join(GlobalData.gWorkspace, File)
>+File = RealPath(os.path.normpath(File))
>+if File:
>+RetVal.append(File)
> return RetVal
>
> ## Retrieve packages this module depends on
> @cached_property
> def Packages(self):
>--
>2.19.1.windows.1

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


Re: [edk2] [Patch V2] BaseTools: Remove EDK_SOURCE keyword from GenFds tool.

2019-01-16 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Feng, Bob C
>Sent: Tuesday, January 15, 2019 7:56 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming 
>Subject: [edk2] [Patch V2] BaseTools: Remove EDK_SOURCE keyword from
>GenFds tool.
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>Remove unused EDK_SOURCE keyword from GenFds tool.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>Tested-by: Laszlo Ersek 
>---
> BaseTools/Source/Python/GenFds/GenFds.py   | 3 ---
> BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 3 ---
> 2 files changed, 6 deletions(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
>b/BaseTools/Source/Python/GenFds/GenFds.py
>index 77383d3378..5a166bf455 100644
>--- a/BaseTools/Source/Python/GenFds/GenFds.py
>+++ b/BaseTools/Source/Python/GenFds/GenFds.py
>@@ -73,11 +73,10 @@ def resetFdsGlobalVariable():
> GenFdsGlobalVariable.FdfParser = None
> GenFdsGlobalVariable.LibDir = ''
> GenFdsGlobalVariable.WorkSpace = None
> GenFdsGlobalVariable.WorkSpaceDir = ''
> GenFdsGlobalVariable.ConfDir = ''
>-GenFdsGlobalVariable.EdkSourceDir = ''
> GenFdsGlobalVariable.OutputDirFromDscDict = {}
> GenFdsGlobalVariable.TargetName = ''
> GenFdsGlobalVariable.ToolChainTag = ''
> GenFdsGlobalVariable.RuleDict = {}
> GenFdsGlobalVariable.ArchList = None
>@@ -141,12 +140,10 @@ def GenFdsApi(FdsCommandDict,
>WorkSpaceDataBase=None):
> EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is
>invalid",
> ExtraData="Please use '-w' switch to pass it or 
> set the
>WORKSPACE environment variable.")
> else:
> Workspace =
>os.path.normcase(FdsCommandDict.get("Workspace",os.environ.get('WORK
>SPACE')))
> GenFdsGlobalVariable.WorkSpaceDir = Workspace
>-if 'EDK_SOURCE' in os.environ:
>-GenFdsGlobalVariable.EdkSourceDir =
>os.path.normcase(os.environ['EDK_SOURCE'])
> if FdsCommandDict.get("debug"):
> GenFdsGlobalVariable.VerboseLogger("Using Workspace:" +
>Workspace)
> if FdsCommandDict.get("GenfdsMultiThread"):
> GenFdsGlobalVariable.EnableGenfdsMultiThread = True
> os.chdir(GenFdsGlobalVariable.WorkSpaceDir)
>diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
>b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
>index 51c9ab046c..febe0737a2 100644
>--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
>+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
>@@ -48,11 +48,10 @@ class GenFdsGlobalVariable:
> FdfParser = None
> LibDir = ''
> WorkSpace = None
> WorkSpaceDir = ''
> ConfDir = ''
>-EdkSourceDir = ''
> OutputDirFromDscDict = {}
> TargetName = ''
> ToolChainTag = ''
> RuleDict = {}
> ArchList = None
>@@ -338,11 +337,10 @@ class GenFdsGlobalVariable:
> GenFdsGlobalVariable.WorkSpace = WorkSpace.Db
> GenFdsGlobalVariable.ArchList = ArchList
> GenFdsGlobalVariable.ToolChainTag =
>GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]
> GenFdsGlobalVariable.TargetName =
>GlobalData.gGlobalDefines["TARGET"]
> GenFdsGlobalVariable.ActivePlatform = GlobalData.gActivePlatform
>-GenFdsGlobalVariable.EdkSourceDir =
>GlobalData.gGlobalDefines["EDK_SOURCE"]
> GenFdsGlobalVariable.ConfDir  = GlobalData.gConfDirectory
> GenFdsGlobalVariable.EnableGenfdsMultiThread =
>GlobalData.gEnableGenfdsMultiThread
> for Arch in ArchList:
> GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(
> os.path.join(GlobalData.gWorkspace,
>@@ -755,11 +753,10 @@ class GenFdsGlobalVariable:
> def MacroExtend (Str, MacroDict={}, Arch=DataType.TAB_COMMON):
> if Str is None:
> return None
>
> Dict = {'$(WORKSPACE)': GenFdsGlobalVariable.WorkSpaceDir,
>-'$(EDK_SOURCE)': GenFdsGlobalVariable.EdkSourceDir,
> #'$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc,
> '$(TARGET)': GenFdsGlobalVariable.TargetName,
> '$(TOOL_CHAIN_TAG)': GenFdsGlobalVariable.ToolChainTag,
> '$(SPACE)': ' '
>}
>--
>2.19.1.windows.1
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2 10/15] ArmVirtXen: Use merged variable driver for emulated NV mode

2019-01-16 Thread Zeng, Star

On 2019/1/16 22:26, Julien Grall wrote:

Hi Laszlo,

On 15/01/2019 09:37, Laszlo Ersek wrote:

On 01/14/19 16:19, Star Zeng wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
Merge EmuVariable and Real variable driver.

The real variable driver has been updated to support emulated
variable NV mode and the EmuVariableRuntimeDxe will be removed
later, so use merged variable driver for emulated NV mode.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Julien Grall 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
  ArmVirtPkg/ArmVirtXen.dsc | 9 +++--
  ArmVirtPkg/ArmVirtXen.fdf | 4 ++--
  2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index a29d8a4ae717..db85fb3402d0 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -1,7 +1,7 @@
  #
  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights 
reserved.
+#  Copyright (c) 2015 - 2019, Intel Corporation. All rights 
reserved.

  #
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions 
of the BSD License

@@ -101,6 +101,11 @@ [PcdsFixedAtBuild.common]
    # Set terminal type to TtyTerm, the value encoded is 
EFI_TTY_TERM_GUID
    gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 
0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 
0x51, 0xef, 0x94}

+  #
+  # Make VariableRuntimeDxe work at emulated non-volatile variable 
mode.

+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+
  [PcdsPatchableInModule.common]
    #
    # This will be overridden in the code
@@ -172,7 +177,7 @@ [Components.common]
    MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
    MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-  
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf

MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf 


MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf

diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 50e670254d52..5655c0df2926 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
  #
  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights 
reserved.
+#  Copyright (c) 2015 - 2019, Intel Corporation. All rights 
reserved.

  #
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions 
of the BSD License

@@ -137,7 +137,7 @@ [FV.FvMain]
    INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
    INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
-  INF 
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
    INF 
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf 

    INF 
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf




Reviewed-by: Laszlo Ersek 

Julien, can you please regression test this series on Xen? The repo URL
and the branch name are in the blurb.


I will have a try and let you know the result.


Thank you, Julien.
I think you can try based on V3 series although there is no essential 
difference between V2 and V3. :)


Repo: g...@github.com:lzeng14/edk2.git
Branch: MergedVariableDriver_EmuNvMode_V3

Thanks,
Star



Cheers,



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


[edk2] [PATCH v1 2/3] NetworkPkg/IScsiDxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of AttemptConfigData is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 83644f51d8..78135b411c 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -1,9 +1,9 @@
 /** @file
   Helper functions for configuring or getting the parameters relating to iSCSI.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -2290,14 +2290,10 @@ IScsiConfigDeleteAttempts (
 //
 // Delete the attempt.
 //
 
 AttemptConfigData = NET_LIST_USER_STRUCT (Entry, 
ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
-if (AttemptConfigData == NULL) {
-  Status = EFI_NOT_FOUND;
-  goto Error;
-}
 
 //
 // Remove this attempt from UI configured attempt list.
 //
 RemoveEntryList (>Link);
-- 
2.17.1.windows.2

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


[edk2] [PATCH v1 3/3] NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of ItemCache4/ItemCache6 is retrieved from the list
Entry, it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/DnsDxe/DnsDriver.c | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c
index b74f5ba18e..6a4214caea 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.c
+++ b/NetworkPkg/DnsDxe/DnsDriver.c
@@ -1,9 +1,9 @@
 /** @file
 The driver binding and service binding protocol for DnsDxe driver.
 
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -374,40 +374,36 @@ DnsUnload (
   gBS->CloseEvent (mDriverData->Timer);
 }
 
 while (!IsListEmpty (>Dns4CacheList)) {
   Entry = NetListRemoveHead (>Dns4CacheList);
+  ASSERT (Entry != NULL);
   ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
-  if (ItemCache4->DnsCache.HostName != NULL) {
-FreePool (ItemCache4->DnsCache.HostName);
-  }
-  if (ItemCache4->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache4->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache4->DnsCache.HostName);
+  FreePool (ItemCache4->DnsCache.IpAddress);
   FreePool (ItemCache4);
 }
 
 while (!IsListEmpty (>Dns4ServerList)) {
   Entry = NetListRemoveHead (>Dns4ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp4);
 }
 
 while (!IsListEmpty (>Dns6CacheList)) {
   Entry = NetListRemoveHead (>Dns6CacheList);
+  ASSERT (Entry != NULL);
   ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
-  if (ItemCache6->DnsCache.HostName != NULL) {
-FreePool (ItemCache6->DnsCache.HostName);
-  }
-  if (ItemCache6->DnsCache.IpAddress != NULL) {
-FreePool (ItemCache6->DnsCache.IpAddress);
-  }
+  FreePool (ItemCache6->DnsCache.HostName);
+  FreePool (ItemCache6->DnsCache.IpAddress);
   FreePool (ItemCache6);
 }
 
 while (!IsListEmpty (>Dns6ServerList)) {
   Entry = NetListRemoveHead (>Dns6ServerList);
+  ASSERT (Entry != NULL);
   ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, 
AllServerLink);
   FreePool (ItemServerIp6);
 }
 
 FreePool (mDriverData);
-- 
2.17.1.windows.2

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


[edk2] [PATCH v1 0/3] Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value retrieved from the list Entry can't be the NULL
pointer, the unnecessary check can be removed.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of Instance is retrieved from the list Entry,
it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..04d47e0759 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1,9 +1,9 @@
 /** @file
   EFI DHCP protocol implementation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1493,15 +1493,15 @@ DhcpOnTimerTick (
   IN EFI_EVENT  Event,
   IN VOID   *Context
   )
 {
   LIST_ENTRY*Entry;
-  LIST_ENTRY*Next;
   DHCP_SERVICE  *DhcpSb;
   DHCP_PROTOCOL *Instance;
   EFI_STATUSStatus;
 
+  Entry= NULL;
   DhcpSb   = (DHCP_SERVICE *) Context;
   Instance = DhcpSb->ActiveChild;
 
   //
   // 0x is the maximum supported value for elapsed time according to RFC.
@@ -1644,18 +1644,15 @@ DhcpOnTimerTick (
 
 ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
-  NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
+  NET_LIST_FOR_EACH (Entry, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
-
-if ((Instance != NULL) && (Instance->Token != NULL)) {
-  Instance->Timeout--;
-  if (Instance->Timeout == 0) {
-PxeDhcpDone (Instance);
-  }
+Instance->Timeout--;
+if (Instance->Timeout == 0) {
+  PxeDhcpDone (Instance);
 }
   }
 
   return ;
 
-- 
2.17.1.windows.2

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


Re: [edk2] [Patch v2] BaseTools: Fix incorrect formatting of GenFds command dictionary

2019-01-16 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Felix Polyudov [mailto:fel...@ami.com] 
Sent: Thursday, January 17, 2019 12:51 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming ; 
Zhu, Yonghong 
Subject: [Patch v2] BaseTools: Fix incorrect formatting of GenFds command 
dictionary

GenFdsCommand returned dictionary with elements that are not compatible with 
GenFdsApi.
As a result the following options were not processed by GenFdsApi:
-v, -q, -d, --genfds-multi-thread, --ignore-sources The issue is introduced by 
commit b3497bad1221704a5dbc5da0b10f42625f1ad2ed.

V2: Remove EFI_SOURCE references

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Felix Polyudov 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 52 +-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index cfe2d29..a795492 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3,6 +3,7 @@
 #
 # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.  # 
Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
+# Copyright (c) 2019, American Megatrends, Inc. All rights 
+reserved.
 #
 # This program and the accompanying materials  # are licensed and made 
available under the terms and conditions of the BSD License @@ -935,7 +936,56 
@@ class WorkspaceAutoGen(AutoGen):
 
 @property
 def GenFdsCommandDict(self):
-return GenMake.TopLevelMakefile(self)._TemplateDict
+FdsCommandDict = {}
+LogLevel = EdkLogger.GetLevel()
+if LogLevel == EdkLogger.VERBOSE:
+FdsCommandDict["verbose"] = True
+elif LogLevel <= EdkLogger.DEBUG_9:
+FdsCommandDict["debug"] = LogLevel - 1
+elif LogLevel == EdkLogger.QUIET:
+FdsCommandDict["quiet"] = True
+
+if GlobalData.gEnableGenfdsMultiThread:
+FdsCommandDict["GenfdsMultiThread"] = True
+if GlobalData.gIgnoreSource:
+FdsCommandDict["IgnoreSources"] = True
+
+FdsCommandDict["OptionPcd"] = []
+for pcd in GlobalData.BuildOptionPcd:
+if pcd[2]:
+pcdname = '.'.join(pcd[0:3])
+else:
+pcdname = '.'.join(pcd[0:2])
+if pcd[3].startswith('{'):
+FdsCommandDict["OptionPcd"].append(pcdname + '=' + 'H' + '"' + 
pcd[3] + '"')
+else:
+FdsCommandDict["OptionPcd"].append(pcdname + '=' + 
+ pcd[3])
+
+MacroList = []
+# macros passed to GenFds
+MacroDict = {}
+MacroDict.update(GlobalData.gGlobalDefines)
+MacroDict.update(GlobalData.gCommandLineDefines)
+for MacroName in MacroDict:
+if MacroDict[MacroName] != "":
+MacroList.append('"%s=%s"' % (MacroName, 
MacroDict[MacroName].replace('\\', '')))
+else:
+MacroList.append('"%s"' % MacroName)
+FdsCommandDict["macro"] = MacroList
+
+FdsCommandDict["fdf_file"] = [self.FdfFile]
+FdsCommandDict["build_target"] = self.BuildTarget
+FdsCommandDict["toolchain_tag"] = self.ToolChain
+FdsCommandDict["active_platform"] = str(self)
+
+FdsCommandDict["conf_directory"] = GlobalData.gConfDirectory
+FdsCommandDict["build_architecture_list"] = ','.join(self.ArchList)
+FdsCommandDict["platform_build_directory"] = self.BuildDir
+
+FdsCommandDict["fd"] = self.FdTargetList
+FdsCommandDict["fv"] = self.FvTargetList
+FdsCommandDict["cap"] = self.CapTargetList
+return FdsCommandDict
 
 ## Create makefile for the platform and modules in it
 #
--
2.10.0.windows.1



Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary 
to American Megatrends, Inc.  This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited.  Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MinPlatformPkg: Correct typo in INF

2019-01-16 Thread Chasel, Chiu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1468

SiliconPolicyInitLibNull.inf and SiliconPolicyUpdateLibNull.inf
both had wrong BASE_NAME and LIBRARY_CLASS, so correct them to
align with file naming and the purpose.

Cc: Michael A Kubacki 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
 | 6 +++---
 
Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
 | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
index 593d1490f1..ae696ccc90 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyInitLibNull/SiliconPolicyInitLibNull.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component information file for Silicon Init Library
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -15,11 +15,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = SiliconInitLibNull
+  BASE_NAME  = SiliconPolicyInitLibNull
   FILE_GUID  = 81B55810-E3DE-4E3E-8477-B8768232193A
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SiliconInitLib
+  LIBRARY_CLASS  = SiliconPolicyInitLib
 
 [LibraryClasses]
   BaseLib
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
index ab03602297..d2018881bb 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component information file for Silicon Update Library
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -15,11 +15,11 @@
 
 [Defines]
   INF_VERSION= 0x00010005
-  BASE_NAME  = SiliconUpdateLibNull
+  BASE_NAME  = SiliconPolicyUpdateLibNull
   FILE_GUID  = 7D4AA651-D23B-42FC-ABE4-8A2FDF260B9F
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SiliconUpdateLib
+  LIBRARY_CLASS  = SiliconPolicyUpdateLib
 
 [LibraryClasses]
   BaseLib
-- 
2.13.3.windows.1

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


Re: [edk2] History question about Base.h and its alternate parallel name space.... Should we change it?

2019-01-16 Thread Felix Polyudov
I agree with Andrew.
In my opinion, moving alias types to Base.h will help to overcome certain 
practical inconveniences without
a significant impact on the ability to detect poorly written Base libraries.

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
Fish via edk2-devel
Sent: Wednesday, January 16, 2019 5:18 PM
To: Mike Kinney
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] History question about Base.h and its alternate parallel 
name space Should we change it?



> On Jan 16, 2019, at 1:19 PM, Kinney, Michael D  
> wrote:
> 
> Hi Andrew,
> 
> I though the reason was a bit more technical.  We have a
> MODULE_TYPE of BASE.  Library instances that use the BASE
> MODULE_TYPE are declaring that the library interfaces are
> safe to be linked against a module of any other type (SEC,
> PEI, DXE, SMM, DXE_RUNTIME, UEFI_DRIVER, UEFI_APP).
> 
> We needed to make sure that a lib of type BASE that
> includes Base.h as its top level include file only has
> visibility to the types that are safe for all the other
> module types.  It is up to the top level include files
> for these other module types to provide the gasket to
> the types in Base.h.
> 
> If we add aliases in Base.h, then we may not get build
> breaks when a lib of type BASE includes files that are
> not compatible with BASE.
> 

Mike,

I don't think having aliases for return types really helps Base code quality  
as RETURN_SUCCESS is almost always just a comment in a header file, and only 
exists in a .c file. Thus RETURN_* seem like a needless duplication, best case 
it is a comment that the code is Base. 

I will agree that not having EFI_GUID defined does case all the PPI and 
Protocol files to blow up if you try to include them. The failure case I was 
helping explain was some one trying to include a PPI, that included a Protocol 
that contained a data structure that was needed. But I would posit that the 
definition of a (EFI_)GUID is state agnostic. Having access to a PPI or 
Protocol definition does not break Base code, what breaks Base code is trying 
to access some service that does not exist. To get more that EFI_GUID you are 
going to need to include Uefi.h, PiPei.h, PiDxe.h, etc. and that will block 
doing anything that is not Base. 

So I'm asking if redefining the name for EFI_GUID to GUID for Base is really 
that helpful? 

Thanks,

Andrew Fish


> Thanks,
> 
> Mike
> 
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-
>> boun...@lists.01.org] On Behalf Of Andrew Fish via edk2-
>> devel
>> Sent: Wednesday, January 16, 2019 1:00 PM
>> To: edk2-devel 
>> Subject: [edk2] History question about Base.h and its
>> alternate parallel name space Should we change it?
>> 
>> I had some one ask me recently why EFI_GUID does not
>> work with #include . I explained they needed to
>> use GUID vs. EFI_GUID. That prompted the question of why
>> we have 2 names for the same thing. Well the
>> historical answer was kind of political as some team
>> wanted to use edk2, but not implement EFI. Thus we have
>> EFI types without the EFI_ prefix in Base.h.
>> 
>> So all this got me thinking  Maybe it makes sense to
>> move some of the renaming from
>> MdePkg/Include/Uefi/UefiBaseType.h to Base.h? Removing
>> the Base.h duplicate types would potentially hit lots of
>> code [1] and break merges with other code bases (break
>> other peoples Base libs etc.).
>> 
>> These lines in MdePkg/Include/Uefi/UefiBaseType.h would
>> get moved to MdePkg/Include/Base.h:
>> typedef GUID  EFI_GUID;
>> typedef RETURN_STATUS EFI_STATUS;
>> #define EFIERR(_a)ENCODE_ERROR(_a)
>> #define EFI_ERROR(A)  RETURN_ERROR(A)
>> 
>> #define EFI_SUCCESS   RETURN_SUCCESS
>> #define EFI_LOAD_ERRORRETURN_LOAD_ERROR
>> #define EFI_INVALID_PARAMETER
>> RETURN_INVALID_PARAMETER
>> #define EFI_UNSUPPORTED   RETURN_UNSUPPORTED
>> #define EFI_BAD_BUFFER_SIZE   RETURN_BAD_BUFFER_SIZE
>> #define EFI_BUFFER_TOO_SMALL
>> RETURN_BUFFER_TOO_SMALL
>> #define EFI_NOT_READY RETURN_NOT_READY
>> #define EFI_DEVICE_ERROR  RETURN_DEVICE_ERROR
>> #define EFI_WRITE_PROTECTED   RETURN_WRITE_PROTECTED
>> #define EFI_OUT_OF_RESOURCES
>> RETURN_OUT_OF_RESOURCES
>> #define EFI_VOLUME_CORRUPTED
>> RETURN_VOLUME_CORRUPTED
>> #define EFI_VOLUME_FULL   RETURN_VOLUME_FULL
>> #define EFI_NO_MEDIA  RETURN_NO_MEDIA
>> #define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
>> #define EFI_NOT_FOUND RETURN_NOT_FOUND
>> #define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
>> #define EFI_NO_RESPONSE   RETURN_NO_RESPONSE
>> #define EFI_NO_MAPPINGRETURN_NO_MAPPING
>> #define EFI_TIMEOUT   RETURN_TIMEOUT
>> #define EFI_NOT_STARTED   RETURN_NOT_STARTED
>> #define EFI_ALREADY_STARTED   RETURN_ALREADY_STARTED
>> #define EFI_ABORTED   

Re: [edk2] History question about Base.h and its alternate parallel name space.... Should we change it?

2019-01-16 Thread Andrew Fish via edk2-devel



> On Jan 16, 2019, at 1:19 PM, Kinney, Michael D  
> wrote:
> 
> Hi Andrew,
> 
> I though the reason was a bit more technical.  We have a
> MODULE_TYPE of BASE.  Library instances that use the BASE
> MODULE_TYPE are declaring that the library interfaces are
> safe to be linked against a module of any other type (SEC,
> PEI, DXE, SMM, DXE_RUNTIME, UEFI_DRIVER, UEFI_APP).
> 
> We needed to make sure that a lib of type BASE that
> includes Base.h as its top level include file only has
> visibility to the types that are safe for all the other
> module types.  It is up to the top level include files
> for these other module types to provide the gasket to
> the types in Base.h.
> 
> If we add aliases in Base.h, then we may not get build
> breaks when a lib of type BASE includes files that are
> not compatible with BASE.
> 

Mike,

I don't think having aliases for return types really helps Base code quality  
as RETURN_SUCCESS is almost always just a comment in a header file, and only 
exists in a .c file. Thus RETURN_* seem like a needless duplication, best case 
it is a comment that the code is Base. 

I will agree that not having EFI_GUID defined does case all the PPI and 
Protocol files to blow up if you try to include them. The failure case I was 
helping explain was some one trying to include a PPI, that included a Protocol 
that contained a data structure that was needed. But I would posit that the 
definition of a (EFI_)GUID is state agnostic. Having access to a PPI or 
Protocol definition does not break Base code, what breaks Base code is trying 
to access some service that does not exist. To get more that EFI_GUID you are 
going to need to include Uefi.h, PiPei.h, PiDxe.h, etc. and that will block 
doing anything that is not Base. 

So I'm asking if redefining the name for EFI_GUID to GUID for Base is really 
that helpful? 

Thanks,

Andrew Fish


> Thanks,
> 
> Mike
> 
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-
>> boun...@lists.01.org] On Behalf Of Andrew Fish via edk2-
>> devel
>> Sent: Wednesday, January 16, 2019 1:00 PM
>> To: edk2-devel 
>> Subject: [edk2] History question about Base.h and its
>> alternate parallel name space Should we change it?
>> 
>> I had some one ask me recently why EFI_GUID does not
>> work with #include . I explained they needed to
>> use GUID vs. EFI_GUID. That prompted the question of why
>> we have 2 names for the same thing. Well the
>> historical answer was kind of political as some team
>> wanted to use edk2, but not implement EFI. Thus we have
>> EFI types without the EFI_ prefix in Base.h.
>> 
>> So all this got me thinking  Maybe it makes sense to
>> move some of the renaming from
>> MdePkg/Include/Uefi/UefiBaseType.h to Base.h? Removing
>> the Base.h duplicate types would potentially hit lots of
>> code [1] and break merges with other code bases (break
>> other peoples Base libs etc.).
>> 
>> These lines in MdePkg/Include/Uefi/UefiBaseType.h would
>> get moved to MdePkg/Include/Base.h:
>> typedef GUID  EFI_GUID;
>> typedef RETURN_STATUS EFI_STATUS;
>> #define EFIERR(_a)ENCODE_ERROR(_a)
>> #define EFI_ERROR(A)  RETURN_ERROR(A)
>> 
>> #define EFI_SUCCESS   RETURN_SUCCESS
>> #define EFI_LOAD_ERRORRETURN_LOAD_ERROR
>> #define EFI_INVALID_PARAMETER
>> RETURN_INVALID_PARAMETER
>> #define EFI_UNSUPPORTED   RETURN_UNSUPPORTED
>> #define EFI_BAD_BUFFER_SIZE   RETURN_BAD_BUFFER_SIZE
>> #define EFI_BUFFER_TOO_SMALL
>> RETURN_BUFFER_TOO_SMALL
>> #define EFI_NOT_READY RETURN_NOT_READY
>> #define EFI_DEVICE_ERROR  RETURN_DEVICE_ERROR
>> #define EFI_WRITE_PROTECTED   RETURN_WRITE_PROTECTED
>> #define EFI_OUT_OF_RESOURCES
>> RETURN_OUT_OF_RESOURCES
>> #define EFI_VOLUME_CORRUPTED
>> RETURN_VOLUME_CORRUPTED
>> #define EFI_VOLUME_FULL   RETURN_VOLUME_FULL
>> #define EFI_NO_MEDIA  RETURN_NO_MEDIA
>> #define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
>> #define EFI_NOT_FOUND RETURN_NOT_FOUND
>> #define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
>> #define EFI_NO_RESPONSE   RETURN_NO_RESPONSE
>> #define EFI_NO_MAPPINGRETURN_NO_MAPPING
>> #define EFI_TIMEOUT   RETURN_TIMEOUT
>> #define EFI_NOT_STARTED   RETURN_NOT_STARTED
>> #define EFI_ALREADY_STARTED   RETURN_ALREADY_STARTED
>> #define EFI_ABORTED   RETURN_ABORTED
>> #define EFI_ICMP_ERRORRETURN_ICMP_ERROR
>> #define EFI_TFTP_ERRORRETURN_TFTP_ERROR
>> #define EFI_PROTOCOL_ERRORRETURN_PROTOCOL_ERROR
>> #define EFI_INCOMPATIBLE_VERSION
>> RETURN_INCOMPATIBLE_VERSION
>> #define EFI_SECURITY_VIOLATION
>> RETURN_SECURITY_VIOLATION
>> #define EFI_CRC_ERROR RETURN_CRC_ERROR
>> #define EFI_END_OF_MEDIA  RETURN_END_OF_MEDIA
>> #define EFI_END_OF_FILE   RETURN_END_OF_FILE
>> #define EFI_INVALID_LANGUAGE
>> RETURN_INVALID_LANGUAGE

Re: [edk2] [PATCH v3] IntelFsp2Pkg: Add FspmArchConfigPpi to support Dispatch mode

2019-01-16 Thread Desimone, Nathaniel L
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chasel, Chiu  
Sent: Monday, January 14, 2019 10:03 PM
To: edk2-devel@lists.01.org
Cc: Nate DeSimone ; Star Zeng 
; Chasel Chiu 
Subject: [PATCH v3] IntelFsp2Pkg: Add FspmArchConfigPpi to support Dispatch mode

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

In Dispatch mode FSP may consume PPI directly so creating FSPM_ARCH_CONFIG_PPI 
to align with FSPM_ARCH_UPD.
Also Keeps new structure size 8 bytes alignment as other structures.

Test: Verified on internal platform to boot with this PPI installed 
successfully.

Cc: Nate DeSimone 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h | 54 
++=+++
 IntelFsp2Pkg/IntelFsp2Pkg.dec|  3 +++
 2 files changed, 57 insertions(+)

diff --git a/IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h 
b/IntelFsp2Pkg/Incl=de/Ppi/FspmArchConfigPpi.h
new file mode 100644
index 00..5bedb95aa7
--- /dev/null
+++ b/IntelFsp2Pkg/Include/Ppi/FspmArchConfigPpi.h
@@ -0,0 +1,54 @@
+/** @file
+  Header file for FSP-M Arch Config PPI for Dispatch mode
+
+ @copyright
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+
+  This program and the accompanying materials are licensed and made 
+ availabl= under  the terms and conditions of the BSD License which 
accompanies this distrib=tion.
+  The full text of the license may be found at  
+ http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI=D.
+
+**/
+
+#ifndef _FSPM_ARCH_CONFIG_PPI_H_
+#define _FSPM_ARCH_CONFIG_PPI_H_
+
+#define FSPM_ARCH_CONFIG_PPI_REVISION 0x1
+
+///
+/// Global ID for the FSPM_ARCH_CONFIG_PPI.
+///
+#define FSPM_ARCH_CONFIG_GUID \
+  { \
+0x824d5a3a, 0xaf92, 0x4c0c, { 0x9f, 0x19, 0x19, 0x52, 0x6d, 0xca, 
+0x4a, =xbb } \
+  }
+
+///
+/// This PPI provides FSP-M Arch Config PPI.
+///
+typedef struct {
+  ///
+  /// Revision of the structure
+  ///
+  UINT8 Revision;
+  UINT8 Reserved[3];
+  ///
+  /// Pointer to the non-volatile storage (NVS) data buffer.
+  /// If it is NULL it indicates the NVS data is not available.
+  ///
+  VOID  *NvsBufferPtr;
+  ///
+  /// Size of memory to be reserved by FSP below "top
+  /// of low usable memory" for bootloader usage.
+  ///
+  UINT32BootLoaderTolumSize;
+  UINT8 Reserved1[4];
+} FSPM_ARCH_CONFIG_PPI;
+
+extern EFI_GUID gFspmArchConfigPpiGuid;
+
+#endif // _FSPM_ARCH_CONFIG_PPI_H_
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dec b/IntelFsp2Pkg/IntelFsp2Pkg.dec 
index 50496241da..de1bece562 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dec
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dec
@@ -70,6 +70,9 @@
   gFspPerformanceDataGuid   = { 0x56ed21b6, 0xba23, 0x429e, { 
=x89, 0x32, 0x37, 0x6d, 0x8e, 0x18, 0x2e, 0xe3 } }
   gFspEventEndOfFirmwareGuid= { 0xbd44f629, 0xeae7, 0x4198, { 
=x87, 0xf1, 0x39, 0xfa, 0xb0, 0xfd, 0x71, 0x7e } }
 
+[Ppis]
+  gFspmArchConfigPpiGuid= { 0x824d5a3a, 0xaf92, 0x4c0c, { 
=x9f, 0x19, 0x19, 0x52, 0x6d, 0xca, 0x4a, 0xbb } }
+
 [PcdsFixedAtBuild]
   gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAddress 
|0xFED00108|UINT32=0x0001
   gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase 
|0xFEF0|UINT32=0x10001001
--
2.13.3.windows.1

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


[edk2] [PATCH 0/4] Various Packages: add MM_STANDALONE support

2019-01-16 Thread Ard Biesheuvel
Add MM_STANDALONE to the list of permitted module types of various
libraries that are required to build the standalone MM authenticated
variable stack.

In some cases, this requires the MODULE_TYPE to be modified to BASE,
given that the constructor prototype is different between DXE/UEFI
and MM_STANDALONE drivers.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Ting Ye 
Cc: Gang Wei 
Cc: Jian Wang 
Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Hao Wu 
Cc: Star Zeng 
Cc: Achin Gupta 
Cc: Jagadeesh Ujja 

Ard Biesheuvel (4):
  CryptoPkg/SmmCryptLib: permit use by MM_STANDALONE modules
  SecurityPkg/PlatformSecureLibNull: permit use by MM_STANDALONE modules
  MdeModulePkg/VarCheckLib: permit use by MM_STANDALONE modules
  MdePkg/UefiDevicePathLib: permit use by MM_STANDALONE modules

 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf   | 2 +-
 MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf | 4 ++--
 .../Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c   | 9 +
 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf   | 2 +-
 .../PlatformSecureLibNull/PlatformSecureLibNull.c| 9 +
 .../PlatformSecureLibNull/PlatformSecureLibNull.inf  | 4 ++--
 6 files changed, 16 insertions(+), 14 deletions(-)

-- 
2.17.1

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


[edk2] [PATCH 4/4] MdePkg/UefiDevicePathLib: permit use by MM_STANDALONE modules

2019-01-16 Thread Ard Biesheuvel
Add MM_STANDALONE to the list of module types that are permitted to
link to this library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf 
b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
index d5f7bfa6af39..89ee87e15d0e 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
@@ -22,7 +22,7 @@ [Defines]
   FILE_GUID  = 91c1677a-e57f-4191-8b8e-eb7711a716e0
   MODULE_TYPE= UEFI_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = DevicePathLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+  LIBRARY_CLASS  = DevicePathLib|DXE_CORE DXE_DRIVER 
DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE 
MM_STANDALONE
 
 
 #
-- 
2.17.1

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


[edk2] [PATCH 3/4] MdeModulePkg/VarCheckLib: permit use by MM_STANDALONE modules

2019-01-16 Thread Ard Biesheuvel
Permit VarCheckLib and VarCheckUefiLib to be used by MM_STANDALONE
modules.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf| 4 ++--
 MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c | 9 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf 
b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
index 128c44d695e1..8873fd51a02a 100644
--- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
@@ -19,9 +19,9 @@ [Defines]
   BASE_NAME  = VarCheckUefiLib
   MODULE_UNI_FILE= VarCheckUefiLib.uni
   FILE_GUID  = AC24A4C7-F845-4665-90E5-6431D6E28DC0
-  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = NULL|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER
+  LIBRARY_CLASS  = NULL|DXE_RUNTIME_DRIVER DXE_SMM_DRIVER 
MM_STANDALONE
   CONSTRUCTOR= VarCheckUefiLibNullClassConstructor
 
 #
diff --git a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c 
b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
index 80dc6341adcf..5e419831e8cc 100644
--- a/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
+++ b/MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 **/
 
+#include 
+
 #include 
 #include 
 #include 
@@ -927,15 +929,14 @@ VariablePropertySetUefiDefined (
   @retval EFI_SUCCESS   The constructor executed correctly.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 EFIAPI
 VarCheckUefiLibNullClassConstructor (
-  IN EFI_HANDLE ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
+  VOID
   )
 {
   VariablePropertySetUefiDefined ();
   VarCheckLibRegisterSetVariableCheckHandler 
(SetVariableCheckHandlerUefiDefined);
 
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
-- 
2.17.1

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


[edk2] [PATCH 2/4] SecurityPkg/PlatformSecureLibNull: permit use by MM_STANDALONE modules

2019-01-16 Thread Ard Biesheuvel
Add MM_STANDALONE to the list of module types that are permitted to
link to this library. Also, since the constructor prototype is
different between MM_STANDALONE and DXE_DRIVER type libraries,
convert the library into BASE type.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c   | 9 
+
 SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c 
b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
index 0c6ded22f3e6..b2493a029393 100644
--- a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
+++ b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
@@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 **/
 
+#include 
+
 BOOLEAN   mUserPhysicalPresence  = FALSE;
 
 /**
@@ -53,15 +55,14 @@ UserPhysicalPresent (
   @retval  EFI_SUCCESS  PcdUserPhysicalPresence is got successfully.
 
 **/
-EFI_STATUS
+RETURN_STATUS
 EFIAPI
 PlatformSecureLibNullConstructor (
-  IN EFI_HANDLEImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
+  VOID
   )
 {
 
   mUserPhysicalPresence = PcdGetBool(PcdUserPhysicalPresence);
 
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
diff --git 
a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf 
b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
index 979a33705de0..70051a27a0a9 100644
--- a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+++ b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
@@ -21,9 +21,9 @@ [Defines]
   BASE_NAME  = PlatformSecureLibNull
   MODULE_UNI_FILE= PlatformSecureLibNull.uni
   FILE_GUID  = 7FA68D82-10A4-4e71-9524-D3D9500D3CDF
-  MODULE_TYPE= DXE_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = PlatformSecureLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_DRIVER
+  LIBRARY_CLASS  = PlatformSecureLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_DRIVER MM_STANDALONE
   CONSTRUCTOR= PlatformSecureLibNullConstructor
 
 #
-- 
2.17.1

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


[edk2] [PATCH 1/4] CryptoPkg/SmmCryptLib: permit use by MM_STANDALONE modules

2019-01-16 Thread Ard Biesheuvel
Permit SmmCryptLib to be used by MM_STANDALONE modules

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index c34699cd62bf..a681fe2f36b8 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -30,7 +30,7 @@ [Defines]
   MODULE_TYPE= DXE_SMM_DRIVER
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x0001000A
-  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE
+  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE 
MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
-- 
2.17.1

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


Re: [edk2] History question about Base.h and its alternate parallel name space.... Should we change it?

2019-01-16 Thread Kinney, Michael D
Hi Andrew,

I though the reason was a bit more technical.  We have a
MODULE_TYPE of BASE.  Library instances that use the BASE
MODULE_TYPE are declaring that the library interfaces are
safe to be linked against a module of any other type (SEC,
PEI, DXE, SMM, DXE_RUNTIME, UEFI_DRIVER, UEFI_APP).

We needed to make sure that a lib of type BASE that
includes Base.h as its top level include file only has
visibility to the types that are safe for all the other
module types.  It is up to the top level include files
for these other module types to provide the gasket to
the types in Base.h.

If we add aliases in Base.h, then we may not get build
breaks when a lib of type BASE includes files that are
not compatible with BASE.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Andrew Fish via edk2-
> devel
> Sent: Wednesday, January 16, 2019 1:00 PM
> To: edk2-devel 
> Subject: [edk2] History question about Base.h and its
> alternate parallel name space Should we change it?
> 
> I had some one ask me recently why EFI_GUID does not
> work with #include . I explained they needed to
> use GUID vs. EFI_GUID. That prompted the question of why
> we have 2 names for the same thing. Well the
> historical answer was kind of political as some team
> wanted to use edk2, but not implement EFI. Thus we have
> EFI types without the EFI_ prefix in Base.h.
> 
> So all this got me thinking  Maybe it makes sense to
> move some of the renaming from
> MdePkg/Include/Uefi/UefiBaseType.h to Base.h? Removing
> the Base.h duplicate types would potentially hit lots of
> code [1] and break merges with other code bases (break
> other peoples Base libs etc.).
> 
> These lines in MdePkg/Include/Uefi/UefiBaseType.h would
> get moved to MdePkg/Include/Base.h:
> typedef GUID  EFI_GUID;
> typedef RETURN_STATUS EFI_STATUS;
> #define EFIERR(_a)ENCODE_ERROR(_a)
> #define EFI_ERROR(A)  RETURN_ERROR(A)
> 
> #define EFI_SUCCESS   RETURN_SUCCESS
> #define EFI_LOAD_ERRORRETURN_LOAD_ERROR
> #define EFI_INVALID_PARAMETER
> RETURN_INVALID_PARAMETER
> #define EFI_UNSUPPORTED   RETURN_UNSUPPORTED
> #define EFI_BAD_BUFFER_SIZE   RETURN_BAD_BUFFER_SIZE
> #define EFI_BUFFER_TOO_SMALL
> RETURN_BUFFER_TOO_SMALL
> #define EFI_NOT_READY RETURN_NOT_READY
> #define EFI_DEVICE_ERROR  RETURN_DEVICE_ERROR
> #define EFI_WRITE_PROTECTED   RETURN_WRITE_PROTECTED
> #define EFI_OUT_OF_RESOURCES
> RETURN_OUT_OF_RESOURCES
> #define EFI_VOLUME_CORRUPTED
> RETURN_VOLUME_CORRUPTED
> #define EFI_VOLUME_FULL   RETURN_VOLUME_FULL
> #define EFI_NO_MEDIA  RETURN_NO_MEDIA
> #define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
> #define EFI_NOT_FOUND RETURN_NOT_FOUND
> #define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
> #define EFI_NO_RESPONSE   RETURN_NO_RESPONSE
> #define EFI_NO_MAPPINGRETURN_NO_MAPPING
> #define EFI_TIMEOUT   RETURN_TIMEOUT
> #define EFI_NOT_STARTED   RETURN_NOT_STARTED
> #define EFI_ALREADY_STARTED   RETURN_ALREADY_STARTED
> #define EFI_ABORTED   RETURN_ABORTED
> #define EFI_ICMP_ERRORRETURN_ICMP_ERROR
> #define EFI_TFTP_ERRORRETURN_TFTP_ERROR
> #define EFI_PROTOCOL_ERRORRETURN_PROTOCOL_ERROR
> #define EFI_INCOMPATIBLE_VERSION
> RETURN_INCOMPATIBLE_VERSION
> #define EFI_SECURITY_VIOLATION
> RETURN_SECURITY_VIOLATION
> #define EFI_CRC_ERROR RETURN_CRC_ERROR
> #define EFI_END_OF_MEDIA  RETURN_END_OF_MEDIA
> #define EFI_END_OF_FILE   RETURN_END_OF_FILE
> #define EFI_INVALID_LANGUAGE
> RETURN_INVALID_LANGUAGE
> #define EFI_COMPROMISED_DATA
> RETURN_COMPROMISED_DATA
> #define EFI_HTTP_ERRORRETURN_HTTP_ERROR
> 
> #define EFI_WARN_UNKNOWN_GLYPH
> RETURN_WARN_UNKNOWN_GLYPH
> #define EFI_WARN_DELETE_FAILURE
> RETURN_WARN_DELETE_FAILURE
> #define EFI_WARN_WRITE_FAILURE
> RETURN_WARN_WRITE_FAILURE
> #define EFI_WARN_BUFFER_TOO_SMALL
> RETURN_WARN_BUFFER_TOO_SMALL
> #define EFI_WARN_STALE_DATA   RETURN_WARN_STALE_DATA
> #define EFI_WARN_FILE_SYSTEM
> RETURN_WARN_FILE_SYSTEM
> 
> I'm interested what folks think about a change like
> this? This change makes the alternate names optional.
> 
> I guess we could also leave the old Base.h definitions
> in Base.h and cleanup the code to only use the EFI form,
> but that is a much bigger change?
> 
> [1] RETURN_SUCCSS usage: git grep -w RETURN_SUCCESS
> 
> Thanks,
> 
> Andrew Fish
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] History question about Base.h and its alternate parallel name space.... Should we change it?

2019-01-16 Thread Andrew Fish via edk2-devel
I had some one ask me recently why EFI_GUID does not work with #include 
. I explained they needed to use GUID vs. EFI_GUID. That prompted the 
question of why we have 2 names for the same thing. Well the historical 
answer was kind of political as some team wanted to use edk2, but not implement 
EFI. Thus we have EFI types without the EFI_ prefix in Base.h.

So all this got me thinking  Maybe it makes sense to move some of the 
renaming from MdePkg/Include/Uefi/UefiBaseType.h to Base.h? Removing the Base.h 
duplicate types would potentially hit lots of code [1] and break merges with 
other code bases (break other peoples Base libs etc.).

These lines in MdePkg/Include/Uefi/UefiBaseType.h would get moved to 
MdePkg/Include/Base.h:
typedef GUID  EFI_GUID;
typedef RETURN_STATUS EFI_STATUS;
#define EFIERR(_a)ENCODE_ERROR(_a)
#define EFI_ERROR(A)  RETURN_ERROR(A)

#define EFI_SUCCESS   RETURN_SUCCESS  
#define EFI_LOAD_ERRORRETURN_LOAD_ERROR   
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
#define EFI_UNSUPPORTED   RETURN_UNSUPPORTED  
#define EFI_BAD_BUFFER_SIZE   RETURN_BAD_BUFFER_SIZE  
#define EFI_BUFFER_TOO_SMALL  RETURN_BUFFER_TOO_SMALL 
#define EFI_NOT_READY RETURN_NOT_READY
#define EFI_DEVICE_ERROR  RETURN_DEVICE_ERROR 
#define EFI_WRITE_PROTECTED   RETURN_WRITE_PROTECTED  
#define EFI_OUT_OF_RESOURCES  RETURN_OUT_OF_RESOURCES 
#define EFI_VOLUME_CORRUPTED  RETURN_VOLUME_CORRUPTED 
#define EFI_VOLUME_FULL   RETURN_VOLUME_FULL  
#define EFI_NO_MEDIA  RETURN_NO_MEDIA 
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
#define EFI_NOT_FOUND RETURN_NOT_FOUND
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
#define EFI_NO_RESPONSE   RETURN_NO_RESPONSE  
#define EFI_NO_MAPPINGRETURN_NO_MAPPING   
#define EFI_TIMEOUT   RETURN_TIMEOUT  
#define EFI_NOT_STARTED   RETURN_NOT_STARTED  
#define EFI_ALREADY_STARTED   RETURN_ALREADY_STARTED  
#define EFI_ABORTED   RETURN_ABORTED  
#define EFI_ICMP_ERRORRETURN_ICMP_ERROR   
#define EFI_TFTP_ERRORRETURN_TFTP_ERROR   
#define EFI_PROTOCOL_ERRORRETURN_PROTOCOL_ERROR   
#define EFI_INCOMPATIBLE_VERSION  RETURN_INCOMPATIBLE_VERSION 
#define EFI_SECURITY_VIOLATIONRETURN_SECURITY_VIOLATION   
#define EFI_CRC_ERROR RETURN_CRC_ERROR   
#define EFI_END_OF_MEDIA  RETURN_END_OF_MEDIA
#define EFI_END_OF_FILE   RETURN_END_OF_FILE
#define EFI_INVALID_LANGUAGE  RETURN_INVALID_LANGUAGE
#define EFI_COMPROMISED_DATA  RETURN_COMPROMISED_DATA
#define EFI_HTTP_ERRORRETURN_HTTP_ERROR

#define EFI_WARN_UNKNOWN_GLYPHRETURN_WARN_UNKNOWN_GLYPH   
#define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE  
#define EFI_WARN_WRITE_FAILURERETURN_WARN_WRITE_FAILURE   
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
#define EFI_WARN_STALE_DATA   RETURN_WARN_STALE_DATA
#define EFI_WARN_FILE_SYSTEM  RETURN_WARN_FILE_SYSTEM

I'm interested what folks think about a change like this? This change makes the 
alternate names optional. 

I guess we could also leave the old Base.h definitions in Base.h and cleanup 
the code to only use the EFI form, but that is a much bigger change? 

[1] RETURN_SUCCSS usage: git grep -w RETURN_SUCCESS

Thanks,

Andrew Fish

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


Re: [edk2] [PATCH edk2-platforms 0/8] Silicon/SynQuacer: add support for 32-bit mode

2019-01-16 Thread Ard Biesheuvel
On Tue, 15 Jan 2019 at 13:08, Leif Lindholm  wrote:
>
> On Mon, Jan 14, 2019 at 06:01:57PM +0100, Ard Biesheuvel wrote:
> > This series fixes various issues that prevent the SynQuacer/DeveloperBox
> > platform from being built or executed in 32-bit mode.
> >
> > Ard Biesheuvel (8):
> >   Silicon/SynQuacer/NetsecDxe: fix 32-bit build
> >   Silicon/SynQuacer/OpteeRngDxe: fix 32-bit build
> >   Silicon/SynQuacerPciHostBridgeLib: fix MMIO32-only configuration
> >   Silicon/SynQuacerMemoryInitPeiLib: don't map memory above
> > MAX_ALLOC_ADDRESS
> >   Silicon/SynQuacerMemoryInitPeiLib: fix 32-bit build
> >   Silicon/SynQuacer/Stage2Tables: fix 32-bit build
> >   Platform/Socionext/DeveloperBox: disable EbcDxe for ARM builds
> >   Platform/Socionext/DeveloperBox: add resolution for ArmSoftFloatLib
>
> For the series:
> Reviewed-by: Leif Lindholm 
>

Thanks

Pushed as ca70cbbcc000..e48031fd75e6

> >  Platform/Socionext/DeveloperBox/DeveloperBox.dsc |  7 ++-
> >  Platform/Socionext/DeveloperBox/DeveloperBox.fdf |  2 ++
> >  .../SynQuacer/Drivers/Net/NetsecDxe/NetsecDxe.c  |  6 +++---
> >  .../Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep.h|  2 +-
> >  .../SynQuacer/Drivers/OpteeRngDxe/OpteeRng.c |  2 +-
> >  .../SynQuacerMemoryInitPeiLib.c  | 11 ---
> >  .../SynQuacerPciHostBridgeLib.c  |  8 
> >  .../Socionext/SynQuacer/Stage2Tables/Stage2Tables.S  | 12 +---
> >  8 files changed, 38 insertions(+), 12 deletions(-)
> >
> > --
> > 2.17.1
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] ArmPkg/DefaultExceptionHandlerLib: add missing UefiLib include

2019-01-16 Thread Ard Biesheuvel
Commit 31f5388006fc ("ArmPkg/DefaultExceptionHandlerLib: use console
if available") added calls to AsciiPrint() to the default exception
handler code, but the ARM version did not include UefiLib.h yet
(even though the .INF declares it unconditionally), resulting in
build breakage. So add the missing include.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c 
b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
index 2e0cfb2d4e03..476ec2061084 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-- 
2.17.1

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


Re: [edk2] [PATCH] EmbeddedPkg/NorFlashInfoLib: convert to BASE library

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 21:18, Leif Lindholm  wrote:
>
> On Wed, Jan 02, 2019 at 02:00:44PM +0100, Ard Biesheuvel wrote:
> > The library's MODULE_TYPE and the module type restrictions it
> > defines are needlessly strict. Just change the library to BASE
> > type and drop the restrictions entirely. Also, drop a bogus
> > library dependency on DxeServicesLib.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
>
> Reviewed-by: Leif Lindholm 
>

Thanks

Pushed as 31f5388006fc..66cffa652512


> > ---
> >  EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf 
> > b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> > index b4b33247fa52..ee207ae7e9d7 100644
> > --- a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> > +++ b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> > @@ -16,9 +16,9 @@ [Defines]
> >INF_VERSION= 0x00010019
> >BASE_NAME  = NorFlashInfoLib
> >FILE_GUID  = 6b639c7e-9b53-4e9f-89a3-2e711729709c
> > -  MODULE_TYPE= DXE_DRIVER
> > +  MODULE_TYPE= BASE
> >VERSION_STRING = 1.0
> > -  LIBRARY_CLASS  = NorFlashInfoLib|DXE_DRIVER 
> > DXE_RUNTIME_DRIVER UEFI_APPLICATION
> > +  LIBRARY_CLASS  = NorFlashInfoLib
> >
> >  [Sources]
> >NorFlashInfoLib.c
> > @@ -30,5 +30,4 @@ [Packages]
> >  [LibraryClasses]
> >BaseLib
> >DebugLib
> > -  DxeServicesLib
> >MemoryAllocationLib
> > --
> > 2.19.2
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/5] ArmPkg: use console for minimal 'exception occurred' message

2019-01-16 Thread Ard Biesheuvel
On Tue, 15 Jan 2019 at 09:23, Ard Biesheuvel  wrote:
>
> When running with a graphical console, no message whatsoever is printed
> when the systems hits an unexpected exception and hangs, because even
> the minimal 'exception occurred' message is only sent to the serial port.
>
> So let's fix that, by updating DefaultExceptionHandlerLib to take the
> availability of a console into account. (#5)
>
> This requires some preparatory decruftication so that we can safely refer
> to the system table and console (#1 .. #4).
>
> Changes since v1:
> - split off ArmVirtPkg patch (#3)
> - always send minimal error message to the serial port before attempting to
>   send it to console->stdout as well (which is more likely to fail) (#5)
> - add Leif's R-b to the series
>
> Ard Biesheuvel (5):
>   ArmPkg/DebugAgentSymbolsBaseLib: remove exception handling
>   ArmPkg/DefaultExceptionHandlerLib: declare the permitted usage context
>   ArmVirtPkg: drop reference to ArmPkg/DefaultExceptionHandlerLibBase
>   ArmPkg/DefaultExceptionHandlerLib: drop BASE variant
>   ArmPkg/DefaultExceptionHandlerLib: use console if available
>

Series pushed as

47d977733137 ArmPkg/DebugAgentSymbolsBaseLib: remove exception handling
74a12eae9f2c ArmPkg/DefaultExceptionHandlerLib: declare the permitted
usage context
ef9f0bff477f ArmVirtPkg: drop reference to ArmPkg/DefaultExceptionHandlerLibBase
1e32c49718c6 ArmPkg/DefaultExceptionHandlerLib: drop BASE variant
31f5388006fc ArmPkg/DefaultExceptionHandlerLib: use console if available

after applying the changes suggested by Laszlo. I failed to include
Laszlo's R-b in 3/5, apologies for that.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/Various: drop DefaultExceptionHandlerLibBase reference

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 20:33, Leif Lindholm  wrote:
>
> On Thu, Dec 20, 2018 at 06:31:53PM +0100, Ard Biesheuvel wrote:
> > Now that DebugAgentSymbolsBaseLib from ArmPkg no longer requires
> > a DefaultExceptionHandlerLib resolution, drop the overrides from
> > the [LibraryClasses.SEC] sections of various platforms.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
>
> Whoops, sorry, I missed this one somehow.
> Reviewed-by: Leif Lindholm 
>

Thanks

Pushed as 307f7f5bfc4f..ca70cbbcc000

> > ---
> >  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc  | 1 -
> >  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc| 1 -
> >  Platform/LeMaker/CelloBoard/CelloBoard.dsc  | 1 -
> >  Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 -
> >  Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
> >  Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc   | 1 -
> >  6 files changed, 7 deletions(-)
> >
> > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > index 49671eefbdea..93d351de5a27 100644
> > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > @@ -173,7 +173,6 @@ [LibraryClasses.common.SEC]
> >ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> >
> >
> > DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> > -  
> > DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> >
> >ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> >
> > diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
> > b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> > index 713c5637b074..e7a77c0ad957 100644
> > --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> > +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> > @@ -148,7 +148,6 @@ [LibraryClasses.common]
> >
> >  [LibraryClasses.common.SEC]
> >
> > DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> > -  
> > DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> >
> >  !ifdef $(EDK2_SKIP_PEICORE)
> >PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
> > diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc 
> > b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > index a70f91bb02d5..dad9cae97ed4 100644
> > --- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > +++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > @@ -156,7 +156,6 @@ [LibraryClasses.common.SEC]
> >ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> >
> >
> > DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> > -  
> > DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> >
> >ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> >
> > diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc 
> > b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > index 722c4adb7a72..7e9728d0430e 100644
> > --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > @@ -155,7 +155,6 @@ [LibraryClasses.common.SEC]
> >ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> >
> >
> > DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> > -  
> > DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> >
> >ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> >
> > diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc 
> > b/Silicon/Hisilicon/Hisilicon.dsc.inc
> > index 63d28a57406b..1282a97801b6 100644
> > --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
> > +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
> > @@ -127,8 +127,6 @@ [LibraryClasses.common]
> >NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> >
> >  [LibraryClasses.common.SEC]
> > -  
> > DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> > -
> >ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> >PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> >BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> > diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
> > b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> > index b3fd1846c0bf..92ff1daf8391 100644
> > --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> > +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> > @@ -154,7 +154,6 @@ [LibraryClasses.common]
> >
> >  [LibraryClasses.common.SEC]
> >
> > DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> > -  
> > 

[edk2] [PATCH v2 10/11] StandaloneMmPkg/StandaloneMmCoreEntryPoint: permit the use of TE images

2019-01-16 Thread Ard Biesheuvel
TE images take up less space when using 4 KB section alignment, since
the FFS/FV generation code optimizes away the redundant, nested padding.
This saves 4 KB of space, which is a worthwhile improvement for code
that executes in place in secure context.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c | 
107 +---
 1 file changed, 46 insertions(+), 61 deletions(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
index 3ca7f6660f47..90299ebbafb6 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
@@ -143,9 +143,12 @@ LocateStandaloneMmCorePeCoffData (
 
   Status = FfsFindSectionData (EFI_SECTION_PE32, FileHeader, TeData, 
TeDataSize);
   if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "Unable to locate Standalone MM Section data - 
0x%x\n",
-  Status));
-return Status;
+Status = FfsFindSectionData (EFI_SECTION_TE, FileHeader, TeData, 
TeDataSize);
+if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Unable to locate Standalone MM Section data - 
%r\n",
+Status));
+  return Status;
+}
   }
 
   DEBUG ((DEBUG_INFO, "Found Standalone MM PE data - 0x%x\n", *TeData));
@@ -155,10 +158,9 @@ LocateStandaloneMmCorePeCoffData (
 STATIC
 EFI_STATUS
 GetPeCoffSectionInformation (
-  IN  CONST PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext,
-  IN  OUT   PE_COFF_LOADER_IMAGE_CONTEXT  *TmpContext,
-  IN  OUT   UINT32*SectionHeaderOffset,
-  IN  OUT   UINT16*NumberOfSections
+  IN  OUT   PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext,
+  OUT   UINT32*SectionHeaderOffset,
+  OUT   UINT16*NumberOfSections
   )
 {
   RETURN_STATUS Status;
@@ -168,44 +170,29 @@ GetPeCoffSectionInformation (
   UINTN ReadSize;
 
   ASSERT (ImageContext != NULL);
-  ASSERT (TmpContext != NULL);
   ASSERT (SectionHeaderOffset != NULL);
   ASSERT (NumberOfSections != NULL);
 
-  //
-  // We need to copy ImageContext since PeCoffLoaderGetImageInfo ()
-  // will mangle the ImageAddress field
-  //
-  CopyMem (TmpContext, ImageContext, sizeof (*TmpContext));
-
-  if (TmpContext->PeCoffHeaderOffset == 0) {
-Status = PeCoffLoaderGetImageInfo (TmpContext);
-if (RETURN_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR,
-  "%a: PeCoffLoaderGetImageInfo () failed (Status = %r)\n",
-  __FUNCTION__, Status));
-  return Status;
-}
-  }
-
-  if (TmpContext->IsTeImage &&
-  TmpContext->ImageAddress == ImageContext->ImageAddress) {
-DEBUG ((DEBUG_INFO, "%a: ignoring XIP TE image at 0x%lx\n", __FUNCTION__,
-ImageContext->ImageAddress));
-return RETURN_UNSUPPORTED;
+  Status = PeCoffLoaderGetImageInfo (ImageContext);
+  if (RETURN_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR,
+"%a: PeCoffLoaderGetImageInfo () failed (Status == %r)\n",
+__FUNCTION__, Status));
+return Status;
   }
 
-  if (TmpContext->SectionAlignment < EFI_PAGE_SIZE) {
+  if (ImageContext->SectionAlignment < EFI_PAGE_SIZE) {
 //
 // The sections need to be at least 4 KB aligned, since that is the
 // granularity at which we can tighten permissions.
 //
-if (!TmpContext->IsTeImage) {
+if (!ImageContext->IsTeImage) {
   DEBUG ((DEBUG_WARN,
   "%a: non-TE Image at 0x%lx has SectionAlignment < 4 KB (%lu)\n",
-  __FUNCTION__, ImageContext->ImageAddress, 
TmpContext->SectionAlignment));
+  __FUNCTION__, ImageContext->ImageAddress, 
ImageContext->SectionAlignment));
+  return RETURN_UNSUPPORTED;
 }
-return RETURN_UNSUPPORTED;
+ImageContext->SectionAlignment = EFI_PAGE_SIZE;
   }
 
   //
@@ -217,9 +204,9 @@ GetPeCoffSectionInformation (
   Hdr.Union = 
   Size = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
   ReadSize = Size;
-  Status = TmpContext->ImageRead (
- TmpContext->Handle,
- TmpContext->PeCoffHeaderOffset,
+  Status = ImageContext->ImageRead (
+ ImageContext->Handle,
+ ImageContext->PeCoffHeaderOffset,
  ,
  Hdr.Pe32
  );
@@ -231,23 +218,28 @@ GetPeCoffSectionInformation (
 return Status;
   }
 
-  ASSERT (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE);
-
-  *SectionHeaderOffset = TmpContext->PeCoffHeaderOffset + sizeof (UINT32) +
-sizeof (EFI_IMAGE_FILE_HEADER);
-  *NumberOfSections= Hdr.Pe32->FileHeader.NumberOfSections;
-
-  

[edk2] [PATCH v2 09/11] StandaloneMmPkg/Core/Dispatcher: don't copy dispatched image twice

2019-01-16 Thread Ard Biesheuvel
The dispatcher uses the PE/COFF loader to load images into the heap,
but only does so after copying the entire image first, leading to
two copies being made for no good reason.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 StandaloneMmPkg/Core/Dispatcher.c | 30 +---
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/StandaloneMmPkg/Core/Dispatcher.c 
b/StandaloneMmPkg/Core/Dispatcher.c
index 8d009b4f80c1..8a2ad5118d92 100644
--- a/StandaloneMmPkg/Core/Dispatcher.c
+++ b/StandaloneMmPkg/Core/Dispatcher.c
@@ -294,7 +294,6 @@ MmLoadImage (
   IN OUT EFI_MM_DRIVER_ENTRY  *DriverEntry
   )
 {
-  VOID   *Buffer;
   UINTN  PageCount;
   EFI_STATUS Status;
   EFI_PHYSICAL_ADDRESS   DstBuffer;
@@ -302,17 +301,12 @@ MmLoadImage (
 
   DEBUG ((DEBUG_INFO, "MmLoadImage - %g\n", >FileName));
 
-  Buffer = AllocateCopyPool (DriverEntry->Pe32DataSize, DriverEntry->Pe32Data);
-  if (Buffer == NULL) {
-return EFI_OUT_OF_RESOURCES;
-  }
-
   Status   = EFI_SUCCESS;
 
   //
   // Initialize ImageContext
   //
-  ImageContext.Handle = Buffer;
+  ImageContext.Handle = DriverEntry->Pe32Data;
   ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
 
   //
@@ -320,9 +314,6 @@ MmLoadImage (
   //
   Status = PeCoffLoaderGetImageInfo ();
   if (EFI_ERROR (Status)) {
-if (Buffer != NULL) {
-  MmFreePool (Buffer);
-}
 return Status;
   }
 
@@ -336,9 +327,6 @@ MmLoadImage (
  
  );
   if (EFI_ERROR (Status)) {
-if (Buffer != NULL) {
-  MmFreePool (Buffer);
-}
 return Status;
   }
 
@@ -355,9 +343,6 @@ MmLoadImage (
   //
   Status = PeCoffLoaderLoadImage ();
   if (EFI_ERROR (Status)) {
-if (Buffer != NULL) {
-  MmFreePool (Buffer);
-}
 MmFreePages (DstBuffer, PageCount);
 return Status;
   }
@@ -367,9 +352,6 @@ MmLoadImage (
   //
   Status = PeCoffLoaderRelocateImage ();
   if (EFI_ERROR (Status)) {
-if (Buffer != NULL) {
-  MmFreePool (Buffer);
-}
 MmFreePages (DstBuffer, PageCount);
 return Status;
   }
@@ -393,9 +375,6 @@ MmLoadImage (
   (VOID 
**)>LoadedImage
   );
 if (EFI_ERROR (Status)) {
-  if (Buffer != NULL) {
-MmFreePool (Buffer);
-  }
   MmFreePages (DstBuffer, PageCount);
   return Status;
 }
@@ -482,13 +461,6 @@ MmLoadImage (
 
   DEBUG_CODE_END ();
 
-  //
-  // Free buffer allocated by Fv->ReadSection.
-  //
-  // The UEFI Boot Services FreePool() function must be used because 
Fv->ReadSection
-  // used the UEFI Boot Services AllocatePool() function
-  //
-  MmFreePool (Buffer);
   return Status;
 }
 
-- 
2.17.1

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


[edk2] [PATCH v2 04/11] StandaloneMmPkg/StandaloneMmCpu: fix typo Standlone -> Standalone

2019-01-16 Thread Ard Biesheuvel
Fix a couple of occurrences of typo Standlone -> Standalone

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Supreeth Venkatesh 
---
 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c   | 2 +-
 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c   | 6 +++---
 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h   | 8 
+---
 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf | 4 ++--
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
index 2814577b3fcc..25114821448a 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
@@ -65,7 +65,7 @@ EFI_MM_CONFIGURATION_PROTOCOL mMmConfig = {
 STATIC EFI_MM_ENTRY_POINT mMmEntryPoint = NULL;
 
 EFI_STATUS
-PiMmStandloneArmTfCpuDriverEntry (
+PiMmStandaloneArmTfCpuDriverEntry (
   IN UINTN EventId,
   IN UINTN CpuNumber,
   IN UINTN NsCommBufferAddr
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c
index 85a9c108aea4..203a32baaaf9 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c
@@ -74,7 +74,7 @@ GetGuidedHobData (
 }
 
 EFI_STATUS
-StandloneMmCpuInitialize (
+StandaloneMmCpuInitialize (
   IN EFI_HANDLE ImageHandle,  // not actual imagehandle
   IN EFI_MM_SYSTEM_TABLE   *SystemTable  // not actual systemtable
   )
@@ -147,8 +147,8 @@ StandloneMmCpuInitialize (
   // Share the entry point of the CPU driver
   DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx = 0x%lx\n",
   (UINT64) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr,
-  (UINT64) PiMmStandloneArmTfCpuDriverEntry));
-  *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = 
PiMmStandloneArmTfCpuDriverEntry;
+  (UINT64) PiMmStandaloneArmTfCpuDriverEntry));
+  *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) = 
PiMmStandaloneArmTfCpuDriverEntry;
 
   // Find the descriptor that contains the whereabouts of the buffer for
   // communication with the Normal world.
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h
index 7b38b65e1242..543467f67576 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h
@@ -40,7 +40,7 @@ extern MP_INFORMATION_HOB_DATA   *mMpInformationHobData;
 extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig;
 
 EFI_STATUS
-PiMmStandloneArmTfCpuDriverEntry (
+PiMmStandaloneArmTfCpuDriverEntry (
   IN UINTN EventId,
   IN UINTN CpuNumber,
   IN UINTN NsCommBufferAddr
@@ -55,10 +55,4 @@ PiMmCpuTpFwRootMmiHandler (
   IN OUT UINTN*CommBufferSize  OPTIONAL
   );
 
-EFI_STATUS _PiMmStandloneArmTfCpuDriverEntry (
-  IN UINTN EventId,
-  IN UINTN CpuNumber,
-  IN UINTN NsCommBufferAddr
-  );
-
 #endif
diff --git 
a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
index 9e6bbabdb103..d261e51ebc75 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
@@ -18,12 +18,12 @@
 
 [Defines]
   INF_VERSION= 0x0001001A
-  BASE_NAME  = StandloneMmCpu
+  BASE_NAME  = StandaloneMmCpu
   FILE_GUID  = 58F7A62B-6280-42A7-BC38-10535A64A92C
   MODULE_TYPE= MM_STANDALONE
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x00010032
-  ENTRY_POINT= StandloneMmCpuInitialize
+  ENTRY_POINT= StandaloneMmCpuInitialize
 
 [Sources]
   StandaloneMmCpu.c
-- 
2.17.1

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


[edk2] [PATCH v2 11/11] StandaloneMmPkg/Core: permit encapsulated firmware volumes

2019-01-16 Thread Ard Biesheuvel
Standalone MM requires 4 KB section alignment for all images, so that
strict permissions can be applied. Unfortunately, this results in a
lot of wasted space, which is usually costly in the secure world
environment that standalone MM is expected to operate in.

So let's permit the standalone MM drivers (but not the core) to be
delivered in a compressed firmware volume.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 StandaloneMmPkg/Core/FwVol.c   
 | 99 ++--
 StandaloneMmPkg/Core/StandaloneMmCore.inf  
 |  1 +
 
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
 |  5 +
 
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
   |  3 +
 4 files changed, 99 insertions(+), 9 deletions(-)

diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c
index 5abf98c24797..8eb827dda5c4 100644
--- a/StandaloneMmPkg/Core/FwVol.c
+++ b/StandaloneMmPkg/Core/FwVol.c
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 #include "StandaloneMmCore.h"
 #include 
+#include 
 
 //
 // List of file types supported by dispatcher
@@ -65,15 +66,25 @@ Returns:
 
 --*/
 {
-  EFI_STATUS  Status;
-  EFI_STATUS  DepexStatus;
-  EFI_FFS_FILE_HEADER *FileHeader;
-  EFI_FV_FILETYPE FileType;
-  VOID*Pe32Data;
-  UINTN   Pe32DataSize;
-  VOID*Depex;
-  UINTN   DepexSize;
-  UINTN   Index;
+  EFI_STATUS  Status;
+  EFI_STATUS  DepexStatus;
+  EFI_FFS_FILE_HEADER *FileHeader;
+  EFI_FV_FILETYPE FileType;
+  VOID*Pe32Data;
+  UINTN   Pe32DataSize;
+  VOID*Depex;
+  UINTN   DepexSize;
+  UINTN   Index;
+  EFI_COMMON_SECTION_HEADER   *Section;
+  VOID*SectionData;
+  UINTN   SectionDataSize;
+  UINT32  DstBufferSize;
+  VOID*ScratchBuffer;
+  UINT32  ScratchBufferSize;
+  VOID*DstBuffer;
+  UINT16  SectionAttribute;
+  UINT32  AuthenticationStatus;
+  EFI_FIRMWARE_VOLUME_HEADER  *InnerFvHeader;
 
   DEBUG ((DEBUG_INFO, "MmCoreFfsFindMmDriver - 0x%x\n", FwVolHeader));
 
@@ -83,6 +94,71 @@ Returns:
 
   FvIsBeingProcesssed (FwVolHeader);
 
+  //
+  // First check for encapsulated compressed firmware volumes
+  //
+  FileHeader = NULL;
+  do {
+Status = FfsFindNextFile (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,
+   FwVolHeader, );
+if (EFI_ERROR (Status)) {
+  break;
+}
+Status = FfsFindSectionData (EFI_SECTION_GUID_DEFINED, FileHeader,
+   , );
+if (EFI_ERROR (Status)) {
+  break;
+}
+Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
+Status = ExtractGuidedSectionGetInfo (Section, ,
+   , );
+if (EFI_ERROR (Status)) {
+  break;
+}
+
+//
+// Allocate scratch buffer
+//
+ScratchBuffer = (VOID *)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES 
(ScratchBufferSize));
+if (ScratchBuffer == NULL) {
+  return EFI_OUT_OF_RESOURCES;
+}
+
+//
+// Allocate destination buffer
+//
+DstBuffer = (VOID *)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES 
(DstBufferSize));
+if (DstBuffer == NULL) {
+  return EFI_OUT_OF_RESOURCES;
+}
+
+//
+// Call decompress function
+//
+Status = ExtractGuidedSectionDecode (Section, , ScratchBuffer,
+   );
+FreePages (ScratchBuffer, EFI_SIZE_TO_PAGES (ScratchBufferSize));
+if (EFI_ERROR (Status)) {
+  goto FreeDstBuffer;
+}
+
+DEBUG ((DEBUG_INFO,
+  "Processing compressed firmware volume (AuthenticationStatus == %x)\n",
+  AuthenticationStatus));
+
+Status = FindFfsSectionInSections (DstBuffer, DstBufferSize,
+   EFI_SECTION_FIRMWARE_VOLUME_IMAGE, );
+if (EFI_ERROR (Status)) {
+  goto FreeDstBuffer;
+}
+
+InnerFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(Section + 1);
+Status = MmCoreFfsFindMmDriver (InnerFvHeader);
+if (EFI_ERROR (Status)) {
+  goto FreeDstBuffer;
+}
+  } while (TRUE);
+
   for (Index = 0; Index < sizeof (mMmFileTypes) / sizeof (mMmFileTypes[0]); 
Index++) {
 DEBUG ((DEBUG_INFO, "Check MmFileTypes - 0x%x\n", mMmFileTypes[Index]));
 FileType = mMmFileTypes[Index];
@@ -100,5 +176,10 @@ Returns:
 } while (!EFI_ERROR (Status));
   }
 
+  return 

[edk2] [PATCH v2 07/11] StandaloneMmPkg/StandaloneMmCoreEntryPoint: remove bogus ASSERT_EFI_ERROR()s

2019-01-16 Thread Ard Biesheuvel
ASSERT_EFI_ERROR (x) is a shorthand for ASSERT(!EFI_ERROR(x)), and so
it should only be used with EFI_STATUS type expressions.

So drop two instances that operate on other types, since neither looks
particularly useful.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Supreeth Venkatesh 
---
 
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
 | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
index 05ed6c8dd0b5..5cca532456fd 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c
@@ -295,7 +295,6 @@ _ModuleEntryPoint (
   //
   ProcessModuleEntryPointList (HobStart);
 
-  ASSERT_EFI_ERROR (CpuDriverEntryPoint);
   DEBUG ((DEBUG_INFO, "Shared Cpu Driver EP 0x%lx\n", (UINT64) 
CpuDriverEntryPoint));
 
 finish:
@@ -303,5 +302,4 @@ finish:
   InitMmFoundationSvcArgs.Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
   InitMmFoundationSvcArgs.Arg1 = Status;
   DelegatedEventLoop ();
-  ASSERT_EFI_ERROR (0);
 }
-- 
2.17.1

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


[edk2] [PATCH v2 06/11] StandaloneMmPkg/StandaloneMmCoreEntryPoint: use %a modifier for ASCII strings

2019-01-16 Thread Ard Biesheuvel
PE/COFF section names are ASCII strings so use %a not %s.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Supreeth Venkatesh 
---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c | 
2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
index 60c1f66b83fa..3ca7f6660f47 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c
@@ -78,7 +78,7 @@ UpdateMmFoundationPeCoffPermissions (
 "%a: Section %d of image at 0x%lx has 0x%x permissions\n",
 __FUNCTION__, Index, ImageContext->ImageAddress, 
SectionHeader.Characteristics));
 DEBUG ((DEBUG_INFO,
-"%a: Section %d of image at 0x%lx has %s name\n",
+"%a: Section %d of image at 0x%lx has %a name\n",
 __FUNCTION__, Index, ImageContext->ImageAddress, 
SectionHeader.Name));
 DEBUG ((DEBUG_INFO,
 "%a: Section %d of image at 0x%lx has 0x%x address\n",
-- 
2.17.1

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


[edk2] [PATCH v2 05/11] StandaloneMmPkg/StandaloneMmCoreEntryPoint: add missing SerialPortLib ref

2019-01-16 Thread Ard Biesheuvel
StandaloneMmCoreEntryPoint calls SerialPortInitialize() explicitly,
so add SerialPortLib to its list of LibraryClasses.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Supreeth Venkatesh 
---
 
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
 | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
index 3222cd359f3e..769eaeeefbea 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
@@ -43,6 +43,7 @@ [Packages.AARCH64]
 [LibraryClasses]
   BaseLib
   DebugLib
+  SerialPortLib
 
 [LibraryClasses.AARCH64]
   StandaloneMmMmuLib
-- 
2.17.1

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


[edk2] [PATCH v2 08/11] StandaloneMmPkg/StandaloneMmPeCoffExtraActionLib: ignore runtime attribute

2019-01-16 Thread Ard Biesheuvel
The special handling of the EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
attribute is only necessary for images that are relocated twice, i.e.,
in the context of SetVirtualAddressMap (). This does not apply to
standalone MM modules, so drop the check.

Drop some redundant DEBUG output while at it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 
StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
 | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
 
b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
index 1c9fec201916..f6bfcc875751 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
@@ -145,8 +145,7 @@ UpdatePeCoffPermissions (
 
 if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_MEM_EXECUTE) == 0) {
 
-  if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_MEM_WRITE) == 0 &&
-  TmpContext.ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
+  if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_MEM_WRITE) == 0) {
 
 DEBUG ((DEBUG_INFO,
   "%a: Mapping section %d of image at 0x%lx with RO-XN permissions and 
size 0x%x\n",
@@ -158,14 +157,10 @@ UpdatePeCoffPermissions (
   __FUNCTION__, Index, Base, SectionHeader.Misc.VirtualSize));
   }
 } else {
-DEBUG ((DEBUG_INFO,
-  "%a: Mapping section %d of image at 0x%lx with RO-XN permissions and 
size 0x%x\n",
-   __FUNCTION__, Index, Base, SectionHeader.Misc.VirtualSize));
-ReadOnlyUpdater (Base, SectionHeader.Misc.VirtualSize);
-
 DEBUG ((DEBUG_INFO,
   "%a: Mapping section %d of image at 0x%lx with RO-X permissions and 
size 0x%x\n",
   __FUNCTION__, Index, Base, SectionHeader.Misc.VirtualSize));
+ReadOnlyUpdater (Base, SectionHeader.Misc.VirtualSize);
 NoExecUpdater (Base, SectionHeader.Misc.VirtualSize);
 }
 
-- 
2.17.1

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


[edk2] [PATCH v2 03/11] StandaloneMmPkg/StandaloneMmCoreHobLib: restrict to MM_CORE_STANDALONE

2019-01-16 Thread Ard Biesheuvel
Remove MM_STANDALONE from the list of permitted modules for this library.
It should only be used by the standalone MM core.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
Signed-off-by: Ard Biesheuvel 
---
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf | 2 
+-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
index db19d3c926e8..ac036e31cf5e 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
@@ -24,7 +24,7 @@ [Defines]
   MODULE_TYPE= MM_CORE_STANDALONE
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x00010032
-  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE MM_STANDALONE
+  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE
 
 #
 #  VALID_ARCHITECTURES   = AARCH64
-- 
2.17.1

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


[edk2] [PATCH v2 01/11] StandaloneMmPkg: add HobLib implementation for MM_STANDALONE modules

2019-01-16 Thread Ard Biesheuvel
This HobLib code is based on the staging implementation of
StandaloneMmPkg, with the following changes:
- drop the unused AArch64/StandaloneMmCoreHobLibInternal.c source file
- remove hack from HobLibConstructor()
- update code comments referring the MM core

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
Signed-off-by: Ard Biesheuvel 
---
 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c   | 649 

 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf |  45 ++
 2 files changed, 694 insertions(+)

diff --git a/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
new file mode 100644
index ..cc1a08166470
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
@@ -0,0 +1,649 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+//
+// Cache copy of HobList pointer.
+//
+STATIC VOID *gHobList = NULL;
+
+/**
+  The constructor function caches the pointer to HOB list.
+
+  The constructor function gets the start address of HOB list from system 
configuration table.
+  It will ASSERT() if that operation fails and it will always return 
EFI_SUCCESS.
+
+  @param  ImageHandle The firmware allocated handle for the image.
+  @param  MmSystemTable   A pointer to the MM System Table.
+
+  @retval EFI_SUCCESS The constructor successfully gets HobList.
+  @retval Other value The constructor can't get HobList.
+
+**/
+EFI_STATUS
+EFIAPI
+HobLibConstructor (
+  IN EFI_HANDLE ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE*MmSystemTable
+  )
+{
+  UINTN   Index;
+
+  for (Index = 0; Index < gMmst->NumberOfTableEntries; Index++) {
+if (CompareGuid (, 
>MmConfigurationTable[Index].VendorGuid)) {
+  gHobList = gMmst->MmConfigurationTable[Index].VendorTable;
+  break;
+}
+  }
+  return EFI_SUCCESS;
+}
+
+/**
+  Returns the pointer to the HOB list.
+
+  This function returns the pointer to first HOB in the list.
+  If the pointer to the HOB list is NULL, then ASSERT().
+
+  @return The pointer to the HOB list.
+
+**/
+VOID *
+EFIAPI
+GetHobList (
+  VOID
+  )
+{
+  UINTN   Index;
+
+  if (gHobList == NULL) {
+for (Index = 0; Index < gMmst->NumberOfTableEntries; Index++) {
+  if (CompareGuid (, 
>MmConfigurationTable[Index].VendorGuid)) {
+gHobList = gMmst->MmConfigurationTable[Index].VendorTable;
+break;
+  }
+}
+  }
+  ASSERT (gHobList != NULL);
+  return gHobList;
+}
+
+/**
+  Returns the next instance of a HOB type from the starting HOB.
+
+  This function searches the first instance of a HOB type from the starting 
HOB pointer.
+  If there does not exist such HOB type from the starting HOB pointer, it will 
return NULL.
+  In contrast with macro GET_NEXT_HOB(), this function does not skip the 
starting HOB pointer
+  unconditionally: it returns HobStart back if HobStart itself meets the 
requirement;
+  caller is required to use GET_NEXT_HOB() if it wishes to skip current 
HobStart.
+
+  If HobStart is NULL, then ASSERT().
+
+  @param  Type  The HOB type to return.
+  @param  HobStart  The starting HOB pointer to search from.
+
+  @return The next instance of a HOB type from the starting HOB.
+
+**/
+VOID *
+EFIAPI
+GetNextHob (
+  IN UINT16 Type,
+  IN CONST VOID *HobStart
+  )
+{
+  EFI_PEI_HOB_POINTERS  Hob;
+
+  ASSERT (HobStart != NULL);
+
+  Hob.Raw = (UINT8 *) HobStart;
+  //
+  // Parse the HOB list until end of list or matching type is found.
+  //
+  while (!END_OF_HOB_LIST (Hob)) {
+if (Hob.Header->HobType == Type) {
+  return Hob.Raw;
+}
+Hob.Raw = GET_NEXT_HOB (Hob);
+  }
+  return NULL;
+}
+
+/**
+  Returns the first instance of a HOB type among the whole HOB list.
+
+  This function searches the first instance of a HOB type among the whole HOB 
list.
+  If there does not exist such HOB type in the HOB list, it will return NULL.
+
+  If the pointer to the HOB list is NULL, then ASSERT().
+
+  @param  Type  The HOB type to return.
+
+  @return The next instance of a HOB type from the starting HOB.
+
+**/
+VOID *
+EFIAPI
+GetFirstHob (
+  IN UINT16 Type
+  )
+{
+  VOID  *HobList;
+

[edk2] [PATCH v2 02/11] StandaloneMmPkg: add MM_STANDALONE MemoryAllocationLib implementation

2019-01-16 Thread Ard Biesheuvel
This MemoryAllocationLib code is based on the staging implementation of
StandaloneMmPkg, with the following changes:
- use correct MODULE_TYPE
- include MmServicesTableLib instead of declaring gMmst directly
- update code comments referring to the MM core

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
Signed-off-by: Ard Biesheuvel 
---
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
   | 822 
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
 |  42 +
 2 files changed, 864 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
 
b/StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
new file mode 100644
index ..c7c1282babff
--- /dev/null
+++ 
b/StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
@@ -0,0 +1,822 @@
+/** @file
+  Support routines for memory allocation routines based on Standalone MM Core 
internal functions.
+
+  Copyright (c) 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Allocates one or more 4KB pages of a certain memory type.
+
+  Allocates the number of 4KB pages of a certain memory type and returns a 
pointer to the allocated
+  buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, 
then NULL is returned.
+  If there is not enough memory remaining to satisfy the request, then NULL is 
returned.
+
+  @param  MemoryTypeThe type of memory to allocate.
+  @param  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+InternalAllocatePages (
+  IN EFI_MEMORY_TYPE  MemoryType,
+  IN UINTNPages
+  )
+{
+  EFI_STATUSStatus;
+  EFI_PHYSICAL_ADDRESS  Memory;
+
+  if (Pages == 0) {
+return NULL;
+  }
+
+  Status = gMmst->MmAllocatePages (AllocateAnyPages, MemoryType, Pages, 
);
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+  return (VOID *)(UINTN)Memory;
+}
+
+/**
+  Allocates one or more 4KB pages of type EfiBootServicesData.
+
+  Allocates the number of 4KB pages of type EfiBootServicesData and returns a 
pointer to the
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If 
Pages is 0, then NULL
+  is returned.  If there is not enough memory remaining to satisfy the 
request, then NULL is
+  returned.
+
+  @param  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocatePages (
+  IN UINTN  Pages
+  )
+{
+  return InternalAllocatePages (EfiRuntimeServicesData, Pages);
+}
+
+/**
+  Allocates one or more 4KB pages of type EfiRuntimeServicesData.
+
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns 
a pointer to the
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If 
Pages is 0, then NULL
+  is returned.  If there is not enough memory remaining to satisfy the 
request, then NULL is
+  returned.
+
+  @param  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocateRuntimePages (
+  IN UINTN  Pages
+  )
+{
+  return InternalAllocatePages (EfiRuntimeServicesData, Pages);
+}
+
+/**
+  Allocates one or more 4KB pages of type EfiReservedMemoryType.
+
+  Allocates the number of 4KB pages of type EfiReservedMemoryType and returns 
a pointer to the
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If 
Pages is 0, then NULL
+  is returned.  If there is not enough memory remaining to satisfy the 
request, then NULL is
+  returned.
+
+  @param  Pages The number of 4 KB pages to allocate.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocateReservedPages (
+  IN UINTN  Pages
+  )
+{
+  return NULL;
+}
+
+/**
+  Frees one or more 4KB pages that were previously allocated with one of the 
page allocation
+  functions in the Memory Allocation Library.
+
+  Frees the number of 4KB pages specified by Pages from the buffer specified 
by Buffer.  Buffer
+  must have been allocated on a previous call to the page allocation 

[edk2] [PATCH v2 00/11] StandaloneMmPkg: assorted fixes and improvements

2019-01-16 Thread Ard Biesheuvel
This series addresses a number of issues I ran into while bringing up
the standalone MM based authenticated variable store on the SynQuacer
(AArch64) platform.

Patches #1 - #3 are based on Jagadeesh's patch that imports some staging
code into StandaloneMmPkg, with the following changes:
- drop unused source files, GUID references are other unused bit,
- clean up comments referring to the MM core implementation.

Patches #4 - #9 are obvious fixes/improvements.

Patch #10 adds support for TE formatted MM_CORE_STANDALONE binaries.
This is useful given that the 4 KB section alignment we require in
AArch64 implementations of standalone MM (due to the strict separation
between code and date) results in 8 KB of wasted space at the start of
the firmware volume. This can be reduced to 4 KB when using a TE image
and the FIXED attribute in the associated [Rule] section, by leveraging
an existing optimization in the FFS generation code that aligns TE images
by reducing FFS padding rather than adding more.

Patch #11 is another space optimization: it reuses the existing support
for encapsulated compressed firmware volumes in FFS files to shrink the
size of the primary standalone MM FV considerably. Again, due to
alignment requirements, there is significant bloat in the uncompressed
images (4 KB for the PE/COFF header, and up to 4 KB per section for the
.text, .data and .reloc sections), making the absolute minimum size of
any trivial MM_STANDALONE module 16 KB.

Changes since v1:
- add patches #1 - #3
- add Supreeth's ack to patches #4 - #7

Cc: Achin Gupta 
Cc: Jiewen Yao 
Cc: Supreeth Venkatesh 
Cc: Leif Lindholm 
Cc: Jagadeesh Ujja 
Cc: Thomas Panakamattam Abraham 
Cc: Sami Mujawar 

Ard Biesheuvel (11):
  StandaloneMmPkg: add HobLib implementation for MM_STANDALONE modules
  StandaloneMmPkg: add MM_STANDALONE MemoryAllocationLib implementation
  StandaloneMmPkg/StandaloneMmCoreHobLib: restrict to MM_CORE_STANDALONE
  StandaloneMmPkg/StandaloneMmCpu: fix typo Standlone -> Standalone
  StandaloneMmPkg/StandaloneMmCoreEntryPoint: add missing SerialPortLib
ref
  StandaloneMmPkg/StandaloneMmCoreEntryPoint: use %a modifier for ASCII
strings
  StandaloneMmPkg/StandaloneMmCoreEntryPoint: remove bogus
ASSERT_EFI_ERROR()s
  StandaloneMmPkg/StandaloneMmPeCoffExtraActionLib: ignore runtime
attribute
  StandaloneMmPkg/Core/Dispatcher: don't copy dispatched image twice
  StandaloneMmPkg/StandaloneMmCoreEntryPoint: permit the use of TE
images
  StandaloneMmPkg/Core: permit encapsulated firmware volumes

 StandaloneMmPkg/Core/Dispatcher.c |  30 +-
 StandaloneMmPkg/Core/FwVol.c  |  99 ++-
 StandaloneMmPkg/Core/StandaloneMmCore.inf |   1 +
 .../StandaloneMmCpu/AArch64/EventHandle.c |   2 +-
 .../StandaloneMmCpu/AArch64/StandaloneMmCpu.c |   6 +-
 .../StandaloneMmCpu/AArch64/StandaloneMmCpu.h |   8 +-
 .../AArch64/StandaloneMmCpu.inf   |   4 +-
 .../AArch64/SetPermissions.c  | 109 +--
 .../AArch64/StandaloneMmCoreEntryPoint.c  |   7 +-
 .../StandaloneMmCoreEntryPoint.inf|   4 +
 .../StandaloneMmCoreHobLib.inf|   2 +-
 .../StandaloneMmHobLib/StandaloneMmHobLib.c   | 649 ++
 .../StandaloneMmHobLib/StandaloneMmHobLib.inf |  45 +
 .../StandaloneMmMemoryAllocationLib.c | 822 ++
 .../StandaloneMmMemoryAllocationLib.inf   |  42 +
 .../StandaloneMmPeCoffExtraActionLib.c|   9 +-
 16 files changed, 1716 insertions(+), 123 deletions(-)
 create mode 100644 
StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
 create mode 100644 
StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf
 create mode 100644 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
 create mode 100644 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf

-- 
2.17.1

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


Re: [edk2] [PATCH] EmbeddedPkg/NorFlashInfoLib: convert to BASE library

2019-01-16 Thread Leif Lindholm
On Wed, Jan 02, 2019 at 02:00:44PM +0100, Ard Biesheuvel wrote:
> The library's MODULE_TYPE and the module type restrictions it
> defines are needlessly strict. Just change the library to BASE
> type and drop the restrictions entirely. Also, drop a bogus
> library dependency on DxeServicesLib.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf 
> b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> index b4b33247fa52..ee207ae7e9d7 100644
> --- a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> +++ b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
> @@ -16,9 +16,9 @@ [Defines]
>INF_VERSION= 0x00010019
>BASE_NAME  = NorFlashInfoLib
>FILE_GUID  = 6b639c7e-9b53-4e9f-89a3-2e711729709c
> -  MODULE_TYPE= DXE_DRIVER
> +  MODULE_TYPE= BASE
>VERSION_STRING = 1.0
> -  LIBRARY_CLASS  = NorFlashInfoLib|DXE_DRIVER 
> DXE_RUNTIME_DRIVER UEFI_APPLICATION
> +  LIBRARY_CLASS  = NorFlashInfoLib
>  
>  [Sources]
>NorFlashInfoLib.c
> @@ -30,5 +30,4 @@ [Packages]
>  [LibraryClasses]
>BaseLib
>DebugLib
> -  DxeServicesLib
>MemoryAllocationLib
> -- 
> 2.19.2
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/Various: drop DefaultExceptionHandlerLibBase reference

2019-01-16 Thread Leif Lindholm
On Thu, Dec 20, 2018 at 06:31:53PM +0100, Ard Biesheuvel wrote:
> Now that DebugAgentSymbolsBaseLib from ArmPkg no longer requires
> a DefaultExceptionHandlerLib resolution, drop the overrides from
> the [LibraryClasses.SEC] sections of various platforms.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Whoops, sorry, I missed this one somehow.
Reviewed-by: Leif Lindholm 

> ---
>  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc  | 1 -
>  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc| 1 -
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc  | 1 -
>  Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 -
>  Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
>  Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc   | 1 -
>  6 files changed, 7 deletions(-)
> 
> diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> index 49671eefbdea..93d351de5a27 100644
> --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> @@ -173,7 +173,6 @@ [LibraryClasses.common.SEC]
>ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
>  
>
> DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
>  
>ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
>  
> diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
> b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> index 713c5637b074..e7a77c0ad957 100644
> --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> @@ -148,7 +148,6 @@ [LibraryClasses.common]
>  
>  [LibraryClasses.common.SEC]
>
> DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
>  
>  !ifdef $(EDK2_SKIP_PEICORE)
>PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
> diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc 
> b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> index a70f91bb02d5..dad9cae97ed4 100644
> --- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> +++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> @@ -156,7 +156,6 @@ [LibraryClasses.common.SEC]
>ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
>  
>
> DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
>  
>ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
>  
> diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc 
> b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> index 722c4adb7a72..7e9728d0430e 100644
> --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> @@ -155,7 +155,6 @@ [LibraryClasses.common.SEC]
>ArmPlatformLib|Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
>  
>
> DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
>  
>ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
>  
> diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc 
> b/Silicon/Hisilicon/Hisilicon.dsc.inc
> index 63d28a57406b..1282a97801b6 100644
> --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
> +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
> @@ -127,8 +127,6 @@ [LibraryClasses.common]
>NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
>  
>  [LibraryClasses.common.SEC]
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
> -
>ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
>PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
> b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> index b3fd1846c0bf..92ff1daf8391 100644
> --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> @@ -154,7 +154,6 @@ [LibraryClasses.common]
>  
>  [LibraryClasses.common.SEC]
>
> DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
> -  
> DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
>  
>PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
>
> ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
> -- 
> 2.19.2

Re: [edk2] [PATCH v2 00/17] implement standalone MM versions of the variable runtime drivers

2019-01-16 Thread Ard Biesheuvel
On Tue, 15 Jan 2019 at 09:25, Wang, Jian J  wrote:
>
> Ard,
>
> For patch 1,5,6,7,8,12,13,14,15,16,17
>
> Reviewed-by: Jian J Wang 
>


Series pushed as 2f4a5a9f4c17..5072c47411b8

Thanks all.


>
> > -Original Message-
> > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > Sent: Monday, January 14, 2019 9:28 PM
> > To: edk2-devel@lists.01.org
> > Cc: Ard Biesheuvel ; Laszlo Ersek
> > ; Leif Lindholm ; Kinney,
> > Michael D ; Gao, Liming ;
> > Wang, Jian J ; Wu, Hao A ;
> > Jagadeesh Ujja ; Achin Gupta
> > ; Thomas Panakamattam Abraham
> > ; Sami Mujawar ;
> > Zeng, Star 
> > Subject: [PATCH v2 00/17] implement standalone MM versions of the variable
> > runtime drivers
> >
> > This v2 series is a followup to [0], and updates the SMM implementations of
> > the fault tolerant write and variable runtime drivers to provide standalone
> > MM versions that share as much of the existing code as possible with the
> > traditional SMM implementations.
> >
> > The meat is in patches #5 - #8, which were part of v1. I updated them 
> > according
> > to the received feedback, and added tags that were given on list.
> >
> > Patches #1 - #4 add library class resolutions for MmServiceTableLib, which 
> > was
> > introduced in v1 of the series, and has already been merged (at the request 
> > of
> > Liming) so that downstream platforms can add the resolution as well.
> >
> > The remaining patches #9 - #17 are new, and have been added so that the new
> > standalone MM drivers can be added to and built from MdeModulePkg.dsc, but
> > for coverage only (the resulting binaries won't actually work)
> > - patches #9 and #10 add a definition and implementation of
> >   StandaloneMmDriverEntryPoint, which is rather straight-forward and has no
> >   dependencies on the standalone MM core, so it is reasonable to add it to
> >   MdePkg directly. Note that this version contains the _gMmVersion check 
> > that
> >   is missing from the one in StandaloneMmPkg
> > - patch #11 adds a standalone MM implementation of MmServicesTableLib to
> > MdePkg,
> >   which -again- does not depend on the standalone MM core at all, so added
> > here
> >   for simplicity
> > - patches #12 and #13 add NULL implementations of MemoryAllocationLib and
> > HobLib
> >   so that the FTW and variable MM_STANDALONE modules can be built without
> >   depending on StandaloneMmPkg
> > - patch #14 is an unrelated fix so that MdeModulePkg.dsc can be built for
> >   AARCH64
> > - patches #15 and #16 add MM_STANDALONE support to a couple of libraries
> > that
> >   the new modules depend on
> > - patch #17 adds the FTW and variable standalone MM drivers to
> > MdeModulePkg.dsc
> >
> > NOTE: the drivers added in patches #10 and #11 supersede the ones that 
> > reside
> > in
> > or have been proposed for StandaloneMmPkg
> >
> > Patches can be found here:
> > https://github.com/ardbiesheuvel/edk2/tree/variable-ftw-standalone-mm-
> > conversion
> >
> > Cc: Laszlo Ersek 
> > Cc: Leif Lindholm 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Jian J Wang 
> > Cc: Hao Wu 
> > Cc: Jagadeesh Ujja 
> > Cc: Achin Gupta 
> > Cc: Thomas Panakamattam Abraham 
> > Cc: Sami Mujawar 
> > Cc: Star Zeng 
> >
> > [0] https://lists.01.org/pipermail/edk2-devel/2019-January/034608.html
> >
> > Ard Biesheuvel (17):
> >   MdeModulePkg/MdeModulePkg.dsc: add MmServicesTableLib resolution
> >   OvmfPkg: add MmServicesTableLib resolution
> >   QuarkPlatformPkg: add MmServicesTableLib resolution
> >   Vlv2TbltDevicePkg: add MmServicesTableLib resolution
> >   MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accesses
> >   MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM version
> >   MdeModulePkg/VariableRuntimeDxe: factor out boot service accesses
> >   MdeModulePkg/VariableRuntimeDxe: implement standalone MM version
> >   MdePkg: introduce standalone MM entry point library class
> >   MdePkg: introduce standalone MM entry point library implementation
> >   MdePkg: add MM_STANDALONE implementation of MmServicesTableLib
> >   MdeModulePkg: implement NULL instance of HobLib library class
> >   MdeModulePkg: implement NULL instance of MemoryAllocationLib library
> > class
> >   MdeModulePkg/MdeModulePkg/dsc: move DxeDebugSupportDxe to x86 only
> > section
> >   MdeModulePkg/AuthVariableLibNull: add MM_STANDALONE support
> >   MdeModulePkg/VarCheckLib: add MM_STANDALONE support
> >   MdeModulePkg/MdeModulePkg.dsc: add MM_STANDALONE FTW and variable
> > modules
> >
> >  MdePkg/MdePkg.dec  
> > |   3 +
> >  MdeModulePkg/MdeModulePkg.dsc
> > |  12 +-
> >  MdePkg/MdePkg.dsc  
> > |   3 +
> >  OvmfPkg/OvmfPkgIa32.dsc
> > |   1
> > +
> >  OvmfPkg/OvmfPkgIa32X64.dsc

Re: [edk2] [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib resolution

2019-01-16 Thread Kinney, Michael D
Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Ard Biesheuvel
> Sent: Wednesday, January 16, 2019 9:45 AM
> To: Gao, Liming ; Qian, Yi
> 
> Cc: Wu, Hao A ; edk2-
> de...@lists.01.org; Kinney, Michael D
> ; Laszlo Ersek
> ; Zeng, Star 
> Subject: Re: [edk2] [PATCH v2 04/17] Vlv2TbltDevicePkg:
> add MmServicesTableLib resolution
> 
> (add Yi as well)
> 
> On Wed, 16 Jan 2019 at 16:14, Gao, Liming
>  wrote:
> >
> > Zailiang:
> >   Could you help review this change?
> >
> > > -Original Message-
> > > From: Ard Biesheuvel
> [mailto:ard.biesheu...@linaro.org]
> > > Sent: Monday, January 14, 2019 9:28 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Ard Biesheuvel ;
> Laszlo Ersek ; Leif Lindholm
> ; Kinney,
> > > Michael D ; Gao, Liming
> ; Wang, Jian J
> ; Wu, Hao A
> > > ; Jagadeesh Ujja
> ; Achin Gupta
> ; Thomas Panakamattam
> > > Abraham ; Sami Mujawar
> ; Zeng, Star 
> > > Subject: [PATCH v2 04/17] Vlv2TbltDevicePkg: add
> MmServicesTableLib resolution
> > >
> > > The SMM based FTW and variable drivers are going to
> depend on
> > > MmServicesTableLib after a subsequent patch, so add
> a resolution
> > > for it to various Vlv2TbltDevicePkg .dsc files.
> > >
> > > Contributed-under: TianoCore Contribution Agreement
> 1.1
> > > Signed-off-by: Ard Biesheuvel
> 
> > > ---
> > >  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
> > >  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
> > >  Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
> > >  3 files changed, 3 insertions(+)
> > >
> > > diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > index d43611550285..eb7c205a10a6 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > > @@ -406,6 +406,7 @@ [LibraryClasses.X64.DXE_CORE]
> > >  !endif
> > >
> > >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmS
> ervicesTableLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/S
> mmServicesTableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatus
> CodeLib/SmmReportStatusCodeLib.inf
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLi
> b/SmmMemoryAllocationLib.inf
> > > diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > index a33816c4d18b..b2f0d73f6d05 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > > @@ -406,6 +406,7 @@ [LibraryClasses.IA32.DXE_CORE]
> > >  !endif
> > >
> > >  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmS
> ervicesTableLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/S
> mmServicesTableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatus
> CodeLib/SmmReportStatusCodeLib.inf
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLi
> b/SmmMemoryAllocationLib.inf
> > > diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > index 1da1442c64c6..aa62c07f177b 100644
> > > --- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > +++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > > @@ -408,6 +408,7 @@ [LibraryClasses.X64.DXE_CORE]
> > >  !endif
> > >
> > >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmS
> ervicesTableLib.inf
> > >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/S
> mmServicesTableLib.inf
> > >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatus
> CodeLib/SmmReportStatusCodeLib.inf
> > >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLi
> b/SmmMemoryAllocationLib.inf
> > > --
> > > 2.20.1
> >
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [RFC v2] Proposal to add edk2-libc

2019-01-16 Thread Kinney, Michael D
Hello,

I shared an RFC in November to add an edk2-apps repository.

https://lists.01.org/pipermail/edk2-devel/2018-November/00.html

Feedback in this thread discussed that there are three types
of applications.  Apps that use libc, UEFI Shell apps,
and UEFI Applications.  I would like this RFC to focus on libc
applications, and changes related to UEFI Shell apps and
UEFI Applications can be handled separately.  The updated
RFC is shown below.  The repo name has been changed from
edk2-apps to edk2-libc based on feedback from Leif.



I would like to propose the creation of a new
repository called edk2-libc.  This repository
would initially be used to host the following
packages from the edk2 repository:

* AppPkg
* StdLib
* StdLibPrivateInternalFiles

These 3 packages provide support for the libc along
with applications that depend on libc.  None of the
other packages in the edk2 repository use these
packages, so these 3 package can be safely moved
without any impacts to platform firmware builds.
Build configurations that do use libc features can
clone the edk2-libc repository and add it to
PACKAGES_PATH.

The history of these 3 packages would be preserved
when importing the content into edk2-libc.  After
the import is verified, these 3 packages would be
deleted from the edk2 repository.

This proposal helps reduce the size of the edk2
repository and focuses edk2 repository on packages
used to provide UEFI/PI conformant firmware.

If there are no concerns with this proposal, I will
enter a Tianocore BZs for the two steps.

Best regards,

Mike

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


Re: [edk2] [PATCH V3 15/17] QuarkMin: Use merged variable driver for emulated NV mode

2019-01-16 Thread Steele, Kelly
Reviewed-by: Kelly Steele 

> -Original Message-
> From: Zeng, Star
> Sent: January 15, 2019 02:30
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Kinney, Michael D
> ; Steele, Kelly 
> Subject: [PATCH V3 15/17] QuarkMin: Use merged variable driver for
> emulated NV mode
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
> Merge EmuVariable and Real variable driver.
> 
> The real variable driver has been updated to support emulated
> variable NV mode and the EmuVariableRuntimeDxe will be removed
> later, so use merged variable driver for emulated NV mode.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  QuarkPlatformPkg/QuarkMin.dsc | 8 ++--
>  QuarkPlatformPkg/QuarkMin.fdf | 4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/QuarkPlatformPkg/QuarkMin.dsc
> b/QuarkPlatformPkg/QuarkMin.dsc
> index d7a25686a30b..bf3a9a8bfd0e 100644
> --- a/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/QuarkPlatformPkg/QuarkMin.dsc
> @@ -2,7 +2,7 @@
>  # Clanton Peak CRB platform with 32-bit DXE for 4MB/8MB flash devices.
>  #
>  # This package provides Clanton Peak CRB platform specific modules.
> -# Copyright (c) 2013 - 2018 Intel Corporation.
> +# Copyright (c) 2013 - 2019 Intel Corporation.
>  #
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and conditions of the BSD
> License
> @@ -342,6 +342,10 @@ [PcdsFixedAtBuild]
>  !endif
>gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x2000
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x1
> 000
> +  #
> +  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
> +  #
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
>## RTC Update Timeout Value, need to increase timeout since also
># waiting for RTC to be busy.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|5000
> 00
> @@ -553,7 +557,7 @@ [Components.IA32]
>MdeModulePkg/Universal/Metronome/Metronome.inf
>MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> -
> MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntime
> Dxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> 
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCoun
> terRuntimeDxe.inf
> 
> MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.inf
> diff --git a/QuarkPlatformPkg/QuarkMin.fdf
> b/QuarkPlatformPkg/QuarkMin.fdf
> index b793fbd9a340..6e5545c16d3b 100644
> --- a/QuarkPlatformPkg/QuarkMin.fdf
> +++ b/QuarkPlatformPkg/QuarkMin.fdf
> @@ -2,7 +2,7 @@
>  # FDF file of Clanton Peak CRB platform with 32-bit DXE
>  #
>  # This package provides QuarkNcSocId platform specific modules.
> -# Copyright (c) 2013 - 2017 Intel Corporation.
> +# Copyright (c) 2013 - 2019 Intel Corporation.
>  #
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and conditions of the BSD
> License
> @@ -388,7 +388,7 @@ [FV.FVMAIN]
>  INF  MdeModulePkg/Universal/Metronome/Metronome.inf
>  INF  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>  INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> -INF
> MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntime
> Dxe.inf
> +INF
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>  INF
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCoun
> terRuntimeDxe.inf
>  INF
> MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.inf
> --
> 2.7.0.windows.1

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


Re: [edk2] [PATCH V3 15/17] QuarkMin: Use merged variable driver for emulated NV mode

2019-01-16 Thread Kinney, Michael D
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, January 15, 2019 2:30 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Kinney, Michael D
> ; Steele, Kelly
> 
> Subject: [PATCH V3 15/17] QuarkMin: Use merged variable
> driver for emulated NV mode
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
> Merge EmuVariable and Real variable driver.
> 
> The real variable driver has been updated to support
> emulated
> variable NV mode and the EmuVariableRuntimeDxe will be
> removed
> later, so use merged variable driver for emulated NV
> mode.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  QuarkPlatformPkg/QuarkMin.dsc | 8 ++--
>  QuarkPlatformPkg/QuarkMin.fdf | 4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/QuarkPlatformPkg/QuarkMin.dsc
> b/QuarkPlatformPkg/QuarkMin.dsc
> index d7a25686a30b..bf3a9a8bfd0e 100644
> --- a/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/QuarkPlatformPkg/QuarkMin.dsc
> @@ -2,7 +2,7 @@
>  # Clanton Peak CRB platform with 32-bit DXE for 4MB/8MB
> flash devices.
>  #
>  # This package provides Clanton Peak CRB platform
> specific modules.
> -# Copyright (c) 2013 - 2018 Intel Corporation.
> +# Copyright (c) 2013 - 2019 Intel Corporation.
>  #
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and
> conditions of the BSD License
> @@ -342,6 +342,10 @@ [PcdsFixedAtBuild]
>  !endif
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x000
> 02000
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariab
> leSize|0x1000
> +  #
> +  # Make VariableRuntimeDxe work at emulated non-
> volatile variable mode.
> +  #
> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnabl
> e|TRUE
>## RTC Update Timeout Value, need to increase timeout
> since also
># waiting for RTC to be busy.
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTim
> eout|50
> @@ -553,7 +557,7 @@ [Components.IA32]
>MdeModulePkg/Universal/Metronome/Metronome.inf
> 
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.in
> f
>MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> -
> MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariabl
> eRuntimeDxe.inf
> +
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRunti
> meDxe.inf
> 
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeD
> xe.inf
> 
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/Monoto
> nicCounterRuntimeDxe.inf
> 
> MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem
> RuntimeDxe.inf
> diff --git a/QuarkPlatformPkg/QuarkMin.fdf
> b/QuarkPlatformPkg/QuarkMin.fdf
> index b793fbd9a340..6e5545c16d3b 100644
> --- a/QuarkPlatformPkg/QuarkMin.fdf
> +++ b/QuarkPlatformPkg/QuarkMin.fdf
> @@ -2,7 +2,7 @@
>  # FDF file of Clanton Peak CRB platform with 32-bit DXE
>  #
>  # This package provides QuarkNcSocId platform specific
> modules.
> -# Copyright (c) 2013 - 2017 Intel Corporation.
> +# Copyright (c) 2013 - 2019 Intel Corporation.
>  #
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and
> conditions of the BSD License
> @@ -388,7 +388,7 @@ [FV.FVMAIN]
>  INF  MdeModulePkg/Universal/Metronome/Metronome.inf
>  INF
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.in
> f
>  INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> -INF
> MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariabl
> eRuntimeDxe.inf
> +INF
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRunti
> meDxe.inf
>  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeD
> xe.inf
>  INF
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/Monoto
> nicCounterRuntimeDxe.inf
>  INF
> MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem
> RuntimeDxe.inf
> --
> 2.7.0.windows.1

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


Re: [edk2] [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib resolution

2019-01-16 Thread Ard Biesheuvel
(add Yi as well)

On Wed, 16 Jan 2019 at 16:14, Gao, Liming  wrote:
>
> Zailiang:
>   Could you help review this change?
>
> > -Original Message-
> > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > Sent: Monday, January 14, 2019 9:28 PM
> > To: edk2-devel@lists.01.org
> > Cc: Ard Biesheuvel ; Laszlo Ersek 
> > ; Leif Lindholm ; Kinney,
> > Michael D ; Gao, Liming ; 
> > Wang, Jian J ; Wu, Hao A
> > ; Jagadeesh Ujja ; Achin Gupta 
> > ; Thomas Panakamattam
> > Abraham ; Sami Mujawar ; 
> > Zeng, Star 
> > Subject: [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib 
> > resolution
> >
> > The SMM based FTW and variable drivers are going to depend on
> > MmServicesTableLib after a subsequent patch, so add a resolution
> > for it to various Vlv2TbltDevicePkg .dsc files.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
> >  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
> >  Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
> > b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > index d43611550285..eb7c205a10a6 100644
> > --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> > @@ -406,6 +406,7 @@ [LibraryClasses.X64.DXE_CORE]
> >  !endif
> >
> >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > +  
> > MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
> >
> > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
> >
> > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
> >
> > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> > diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
> > b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > index a33816c4d18b..b2f0d73f6d05 100644
> > --- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > +++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > @@ -406,6 +406,7 @@ [LibraryClasses.IA32.DXE_CORE]
> >  !endif
> >
> >  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> > +  
> > MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
> >
> > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
> >
> > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
> >
> > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> > diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
> > b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > index 1da1442c64c6..aa62c07f177b 100644
> > --- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > +++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > @@ -408,6 +408,7 @@ [LibraryClasses.X64.DXE_CORE]
> >  !endif
> >
> >  [LibraryClasses.X64.DXE_SMM_DRIVER]
> > +  
> > MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
> >
> > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
> >
> > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
> >
> > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> > --
> > 2.20.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-test][RFC] Integrating SBBR tests into SCT - A design proposal

2019-01-16 Thread Supreeth Venkatesh
Eric,

SBBR test cases does not affect the normal flow of UEFI-SCT, so I don't think 
it causes any issues to UEFI-SCT, but will instead have added value to UEFI-SCT.
However, Please carefully review the pre-processing workflow, when Sakar sends 
SBBR Patches.

Sakar,
I need more clarification on the multiple parameters you are proposing.
>From your statement in the email:
"Tests with attribute SBBR are meant to run for both UEFI and SBBR compliance, 
while those with attribute SBBR_EXCL are only meant for SBBR compliance."


Scenario 1:
Top level Test suite (in this case - Yocto based ACS) will have to invoke UEFI 
SCT once with SBBR to ensure both UEFI and SBBR compliance.
What's the use of SBBR_EXCL in this case?

Scenario 2:
Top Level Test suite (Yocto based ACS) will invoke SBBR_EXCL to ensure SBBR 
specific test cases (which are not pre-existing in UEFI-SCT, but new test cases 
you are proposing to add).
However, it does not completely satisfy SBBR specification as some of the SBBR 
specification is realized by running pre-existing tests in UEFI-SCT.
For this, Top level test suite will have to invoke UEFI_SCT **again** without 
any parameters. correct?
This will create unnecessary issues for integrating into top level test suite.

Please clarify on how you are going to use these parameters. (use case 
scenario.)
If this gets clarified, then I have no objections with this proposal.

Thanks,
Supreeth

-Original Message-
From: Jin, Eric 
Sent: Tuesday, January 15, 2019 1:23 AM
To: Sakar Arora ; Supreeth Venkatesh 

Cc: edk2-devel@lists.01.org; Jin, Eric 
Subject: RE: [edk2][edk2-test][RFC] Integrating SBBR tests into SCT - A design 
proposal

Hi Sakar,

Thank for the clarification.
Now, I understand that the SBBR wants to add/modify in existing 
edk2-test/uefi-sct. In your description, '-s' is not suitable for sbbr purpose.

The fundamental point to be discussed is that edk2-test/uefi-sct is UEFI Self 
Compliance Test and should keep the alignment to UEFI spec.
To my understanding, the SBBR is published by arm and gives special 
requirements on UEFI/ACPI/SMBIOS areas.
I remember some new files/new directories with the prefix "sbbr" in 
file/directory name are adding into the edk2-test/uefi-sct In previous push 
request emails, it makes me confused. And it is the reason that I ask for the 
possible standalone space.

Could you please send the patches for review? We can discuss further based on 
them and explore the correct direction. At least, the baseline is it doesn't 
impact existing test result (I want to hear the comments from Supreeth on this 
baseline).

Best Regards
Eric

-Original Message-
From: Sakar Arora 
Sent: Friday, January 11, 2019 8:23 PM
To: Jin, Eric ; Supreeth Venkatesh 
; edk2-devel@lists.01.org
Cc: Prasanth Pulla 
Subject: RE: [edk2][edk2-test][RFC] Integrating SBBR tests into SCT - A design 
proposal

Hi Supreeth, Eric,

My replies inlined.

Thanks,
Sakar
-Original Message-
From: Jin, Eric 
Sent: Tuesday, January 8, 2019 7:30 AM
To: Supreeth Venkatesh ; Sakar Arora 
; edk2-devel@lists.01.org
Cc: Prasanth Pulla 
Subject: RE: [edk2][edk2-test][RFC] Integrating SBBR tests into SCT - A design 
proposal

Hello Sakar,

SBBR spec is not published by UEFI Forum and can be considered as a supplement 
to ARM UEFI. The evolution of edk2-test/uefi-sct should be tagged to UEFI Spec 
only.
Can we land SBBR test on standalone space under edk2-test currently or in 
short-term?  I mean SBBR test can leverage edk2-test/uefi-sct (as sub-module)or 
not to build test efi files itself and these test efi files can be integrated 
into UEFI SCT to execute with user usage.

[Sakar] If I understand correctly, you want a separate directory in edk2-test 
for SBBR code, rather than having it in edk2-test/uefi-sct.
The problem I see here is that apart from standalone SBBR test cases, there are 
some changes to the existing test cases inside edk2-test/uefi-sct, that we 
would need pushed for SBBR compliance (These changes will only take effect if 
"-sbbr" parameter is passed while running SCT). So SBBR tests are not exactly 
standalone. Keeping all SBBR specific stuff away, would mean maintaining 
patches to SCT code, which will be difficult. I hope I am making sense.

For the new attributes - SBBR and SBBR_EXCL, I agree with Supreeth that they 
are more like the additional parameters. So they are not the similar cases to 
(AUTO, MANUAL, DESTRUCTIVE, or RESET_REQUIRED).

[Sakar] The reasoning for proposing these 2 attributes is this.
There are some SBBR tests that are needed only for SBBR compliance. When SCT 
app is run *without* the "-sbbr" cmdline parameter, it should run all tests, 
excluding those specific to SBBR. So it needs to differentiate, at runtime, 
tests that are valid for both SBBR and UEFI compliance from the ones that are 
exclusively for SBBR. Tests with attribute SBBR are meant to run for both UEFI 
and SBBR compliance, while those with attribute SBBR_EXCL are only 

Re: [edk2] EDK II Network Stack Issue

2019-01-16 Thread Laszlo Ersek
On 01/16/19 13:57, Karin Willers wrote:
> On 2019-01-10 13:40, Karin Willers wrote:
>> On 2019-01-07 20:27, Laszlo Ersek wrote:
>>> On 01/04/19 15:02, Karin Willers wrote:
 G'Day!

 I'm trying to get networking under edk2 up and running. I tried
 AppPkg/Applications/Sockets/RawIp4Tx
 under OVMF. The raw packet is sent out on the network, but the
 application never returns from the
 socket close routine.

 I'm currently using UDK2017 with the latest security patches
 (downloaded
 December 18 2018). The network
 driver under OVMF is the e1000 driver.

 The effect that the socket close never returns is also visible when
 running RawIp4Tx on real hardware,
 so I think the behavior has nothing to do with OVMF or the UEFI itself.

 Does anyone see similar effects? Any hints on setting up networking
 under edk2 correctly?
>>>
>>> The socket (= libc-level networking) APIs are not the most robust ones
>>> in edk2, in my -- admittedly limited -- experience. I'd suggest using
>>> applications and shell commands that use UEFI protocols instead, for
>>> networking. (I understand that could be a challenge if you are porting a
>>> standard C program to UEFI.)
>>>
>>> Thanks
>>> Laszlo
>>
>> The reason for this undertaking initially was to compile a Python.efi
>> that
>> supports sockets. We wanted that to be able to run the Chipsec suite with
>> external network test partners under UEFI. The Chipsec guys do provide
>> pre-compiled Pyhon executables, but these do not include the network
>> stack.
>>
>> I think, I have to debug the issue myself ...
>>
>> Greetings,  Karin
> 
> Could please someone shed some light on how to enable debug prints using
> UefiDebugLibConOut
> in EfiSocketLib/Socket.c. Enabling debug prints is, IMHO, not very
> intuitive in edk2 ...

Can you build your platform and/or application with the --log and
--report-file options, and share the outputs? The following could all
matter:

- what you pass to "build" with "-b" (NOOPT/DEBUG/RELEASE),
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask,
- gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel,
- gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel,
- what lib instance you resolve the DebugLib class to,
- whether you apply the above just to your application, or all other DXE
  components in your platform.

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


[edk2] [Patch v2] BaseTools: Fix incorrect formatting of GenFds command dictionary

2019-01-16 Thread Felix Polyudov
GenFdsCommand returned dictionary with elements that
are not compatible with GenFdsApi.
As a result the following options were not processed by GenFdsApi:
-v, -q, -d, --genfds-multi-thread, --ignore-sources
The issue is introduced by commit b3497bad1221704a5dbc5da0b10f42625f1ad2ed.

V2: Remove EFI_SOURCE references

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Felix Polyudov 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 52 +-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index cfe2d29..a795492 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3,6 +3,7 @@
 #
 # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
 # Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
+# Copyright (c) 2019, American Megatrends, Inc. All rights reserved.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
@@ -935,7 +936,56 @@ class WorkspaceAutoGen(AutoGen):
 
 @property
 def GenFdsCommandDict(self):
-return GenMake.TopLevelMakefile(self)._TemplateDict
+FdsCommandDict = {}
+LogLevel = EdkLogger.GetLevel()
+if LogLevel == EdkLogger.VERBOSE:
+FdsCommandDict["verbose"] = True
+elif LogLevel <= EdkLogger.DEBUG_9:
+FdsCommandDict["debug"] = LogLevel - 1
+elif LogLevel == EdkLogger.QUIET:
+FdsCommandDict["quiet"] = True
+
+if GlobalData.gEnableGenfdsMultiThread:
+FdsCommandDict["GenfdsMultiThread"] = True
+if GlobalData.gIgnoreSource:
+FdsCommandDict["IgnoreSources"] = True
+
+FdsCommandDict["OptionPcd"] = []
+for pcd in GlobalData.BuildOptionPcd:
+if pcd[2]:
+pcdname = '.'.join(pcd[0:3])
+else:
+pcdname = '.'.join(pcd[0:2])
+if pcd[3].startswith('{'):
+FdsCommandDict["OptionPcd"].append(pcdname + '=' + 'H' + '"' + 
pcd[3] + '"')
+else:
+FdsCommandDict["OptionPcd"].append(pcdname + '=' + pcd[3])
+
+MacroList = []
+# macros passed to GenFds
+MacroDict = {}
+MacroDict.update(GlobalData.gGlobalDefines)
+MacroDict.update(GlobalData.gCommandLineDefines)
+for MacroName in MacroDict:
+if MacroDict[MacroName] != "":
+MacroList.append('"%s=%s"' % (MacroName, 
MacroDict[MacroName].replace('\\', '')))
+else:
+MacroList.append('"%s"' % MacroName)
+FdsCommandDict["macro"] = MacroList
+
+FdsCommandDict["fdf_file"] = [self.FdfFile]
+FdsCommandDict["build_target"] = self.BuildTarget
+FdsCommandDict["toolchain_tag"] = self.ToolChain
+FdsCommandDict["active_platform"] = str(self)
+
+FdsCommandDict["conf_directory"] = GlobalData.gConfDirectory
+FdsCommandDict["build_architecture_list"] = ','.join(self.ArchList)
+FdsCommandDict["platform_build_directory"] = self.BuildDir
+
+FdsCommandDict["fd"] = self.FdTargetList
+FdsCommandDict["fv"] = self.FvTargetList
+FdsCommandDict["cap"] = self.CapTargetList
+return FdsCommandDict
 
 ## Create makefile for the platform and modules in it
 #
-- 
2.10.0.windows.1



Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary 
to American Megatrends, Inc.  This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited.  Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add MmServicesTableLib resolution

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 17:05, Yao, Jiewen  wrote:
>
> Reviewed-by: jiewen@intel.com
>
>
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Gao, Liming
> > Sent: Wednesday, January 16, 2019 6:57 AM
> > To: Ard Biesheuvel ; edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg:
> > add MmServicesTableLib resolution
> >
> > Reviewed-by: Liming Gao 
> >

Thanks all

Pushed as cc0bd1afbc09..9da76451349e


> > > -Original Message-
> > > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > > Sent: Tuesday, January 15, 2019 1:25 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Gao, Liming ; Ard Biesheuvel
> > 
> > > Subject: [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add
> > MmServicesTableLib resolution
> > >
> > > Ensure that the platform will still build when we move the upstream
> > > FTW and variable SMM runtime drivers to use the new MmServiceTableLib
> > > library class.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> > > ---
> > >  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > > index 1103572408d0..1ed3591f360a 100644
> > > --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > > +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > > @@ -77,6 +77,7 @@ [LibraryClasses.common.UEFI_DRIVER]
> > >  [LibraryClasses.common.DXE_SMM_DRIVER]
> > >PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
> > >
> > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> > ableLib.inf
> > > +
> > MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTabl
> > eLib.inf
> > >
> > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/Sm
> > mReportStatusCodeLib.inf
> > >
> > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> > moryAllocationLib.inf
> > >
> > LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.i
> > nf
> > > --
> > > 2.17.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix the build report issue for VPD

2019-01-16 Thread Feng, Bob C
OK. I'll submit BZ. The two patches are to fix two issues that have different 
root cause, so I think two patches would be better. 

-Original Message-
From: Gao, Liming 
Sent: Thursday, January 17, 2019 12:03 AM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools: Fix the build report issue for VPD

Bob:
  Please submit BZ for this issue. Could we merge these two patches? Seemly, 
they are both build report issue. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Feng, Bob C
> Sent: Wednesday, January 16, 2019 11:30 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch] BaseTools: Fix the build report issue for VPD
> 
> From: BobCF 
> 
> Make sure the PlatformAutoGen.AllPcdList always be latest, or build 
> report will fail sometimes.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index cfe2d29099..85d966c62f 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1029,11 +1029,10 @@ class PlatformAutoGen(AutoGen):
>  self.Arch = Arch
>  self.SourceDir = PlatformFile.SubDir
>  self.SourceOverrideDir = None
>  self.FdTargetList = self.Workspace.FdTargetList
>  self.FvTargetList = self.Workspace.FvTargetList
> -self.AllPcdList = []
>  # get the original module/package/platform objects
>  self.BuildDatabase = Workspace.BuildDatabase
>  self.DscBuildDataObj = Workspace.Platform
> 
>  # flag indicating if the makefile/C-code file has been 
> created or not @@ -1110,10 +1109,13 @@ class PlatformAutoGen(AutoGen):
>  self.LibraryBuildDirectoryList = 
> Makefile.GetLibraryBuildDirectoryList()
>  self.ModuleBuildDirectoryList = 
> Makefile.GetModuleBuildDirectoryList()
> 
>  self.IsMakeFileCreated = True
> 
> +@property
> +def AllPcdList(self):
> +return self.DynamicPcdList + self.NonDynamicPcdList
>  ## Deal with Shared FixedAtBuild Pcds
>  #
>  def CollectFixedAtBuildPcds(self):
>  for LibAuto in self.LibraryAutoGenList:
>  FixedAtBuildPcds = {}
> @@ -1624,11 +1626,10 @@ class PlatformAutoGen(AutoGen):
>  if type(SkuId) in (str, unicode) and eval(SkuId) == 0 or 
> SkuId == 0:
>  continue
>  pcd.SkuInfoList[SkuName] = 
> copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])
>  pcd.SkuInfoList[SkuName].SkuId = SkuId
>  pcd.SkuInfoList[SkuName].SkuIdName = SkuName
> -self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
> 
>  def FixVpdOffset(self, VpdFile ):
>  FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
>  if not os.path.exists(FvPath):
>  try:
> --
> 2.19.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Allow empty value for HiiPcd in Dsc

2019-01-16 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1466

DEC file defines PCD default value and PCD supported type.
DSC can configure PCD type and value.
If the value is same to default value in DEC file,
DSC can only configure PCD type and leave empty for value.
This usage supports all type PCD except for DynamicHii type.
So, DynamicHii PCD should support this usage. Below is one example in DSC.

for example,
[PcdsDynamicHii.common.DEFAULT]
PcdPkgTokenSpaceGuid.PcdCName|L"VarName"|gVarGuid|0x00||NV,BS

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 76a73d1c33..feb2c7e394 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1523,12 +1523,10 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
 Guid = FieldList[1]
 if len(FieldList) > 2:
 Offset = FieldList[2]
 if len(FieldList) > 3:
 Value = FieldList[3]
-if not Value:
-IsValid = False
 if len(FieldList) > 4:
 Attribute = FieldList[4]
 return [HiiString, Guid, Offset, Value, Attribute], IsValid, 3
 return [], False, 0
 
-- 
2.19.1.windows.1

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


Re: [edk2] [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add MmServicesTableLib resolution

2019-01-16 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Gao, Liming
> Sent: Wednesday, January 16, 2019 6:57 AM
> To: Ard Biesheuvel ; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg:
> add MmServicesTableLib resolution
> 
> Reviewed-by: Liming Gao 
> 
> > -Original Message-
> > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > Sent: Tuesday, January 15, 2019 1:25 AM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming ; Ard Biesheuvel
> 
> > Subject: [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add
> MmServicesTableLib resolution
> >
> > Ensure that the platform will still build when we move the upstream
> > FTW and variable SMM runtime drivers to use the new MmServiceTableLib
> > library class.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > index 1103572408d0..1ed3591f360a 100644
> > --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> > @@ -77,6 +77,7 @@ [LibraryClasses.common.UEFI_DRIVER]
> >  [LibraryClasses.common.DXE_SMM_DRIVER]
> >PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
> >
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> ableLib.inf
> > +
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTabl
> eLib.inf
> >
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/Sm
> mReportStatusCodeLib.inf
> >
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> moryAllocationLib.inf
> >
> LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.i
> nf
> > --
> > 2.17.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix the build report issue for VPD

2019-01-16 Thread Gao, Liming
Bob:
  Please submit BZ for this issue. Could we merge these two patches? Seemly, 
they are both build report issue. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
> Bob C
> Sent: Wednesday, January 16, 2019 11:30 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch] BaseTools: Fix the build report issue for VPD
> 
> From: BobCF 
> 
> Make sure the PlatformAutoGen.AllPcdList always be latest,
> or build report will fail sometimes.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index cfe2d29099..85d966c62f 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1029,11 +1029,10 @@ class PlatformAutoGen(AutoGen):
>  self.Arch = Arch
>  self.SourceDir = PlatformFile.SubDir
>  self.SourceOverrideDir = None
>  self.FdTargetList = self.Workspace.FdTargetList
>  self.FvTargetList = self.Workspace.FvTargetList
> -self.AllPcdList = []
>  # get the original module/package/platform objects
>  self.BuildDatabase = Workspace.BuildDatabase
>  self.DscBuildDataObj = Workspace.Platform
> 
>  # flag indicating if the makefile/C-code file has been created or not
> @@ -1110,10 +1109,13 @@ class PlatformAutoGen(AutoGen):
>  self.LibraryBuildDirectoryList = 
> Makefile.GetLibraryBuildDirectoryList()
>  self.ModuleBuildDirectoryList = 
> Makefile.GetModuleBuildDirectoryList()
> 
>  self.IsMakeFileCreated = True
> 
> +@property
> +def AllPcdList(self):
> +return self.DynamicPcdList + self.NonDynamicPcdList
>  ## Deal with Shared FixedAtBuild Pcds
>  #
>  def CollectFixedAtBuildPcds(self):
>  for LibAuto in self.LibraryAutoGenList:
>  FixedAtBuildPcds = {}
> @@ -1624,11 +1626,10 @@ class PlatformAutoGen(AutoGen):
>  if type(SkuId) in (str, unicode) and eval(SkuId) == 0 or 
> SkuId == 0:
>  continue
>  pcd.SkuInfoList[SkuName] = 
> copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])
>  pcd.SkuInfoList[SkuName].SkuId = SkuId
>  pcd.SkuInfoList[SkuName].SkuIdName = SkuName
> -self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
> 
>  def FixVpdOffset(self, VpdFile ):
>  FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
>  if not os.path.exists(FvPath):
>  try:
> --
> 2.19.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10

2019-01-16 Thread Gao, Liming
Hi, 
  I do the minimal change in Edk2 to make sure EmulatorPkg pass build in MAC. 
Here is the code https://github.com/lgao4/edk2/tree/XcodeEmulator. Please try 
to verify its functionality. If you request add this support, please enter one 
BZ (https://bugzilla.tianocore.org) for it. 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gao, 
> Liming
> Sent: Wednesday, January 16, 2019 12:10 AM
> To: 唐佳诚 ; edk2-devel 
> Subject: Re: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10
> 
> I check the history. EmulatorPkg doesn't support macOS. EmulatorePkg depends 
> on XCODE32 tool chain to generate the host application.
> But, XCODE32 tool chain has been removed at edk2 
> f7bd152c2a05bd75471305184c25f14f01ccf0b7.
> 
> I just try to add back this change, and call build.sh without the change. I 
> meet with new issue. Seemly, I need to install XQuartz. I will
> continue to try it. Besides, I suggest you directly use edk2 master instead 
> of UDK2018 branch. If I do some fix, you can directly get it.
> 
> /Users/tiano/lgao4/AllPkg/Edk2/EmulatorPkg/Unix/Host/X11GraphicsWindow.c:21:10:
>  fatal error: 'X11/Xlib.h' file not found
> 
> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 唐佳诚
> > Sent: Tuesday, January 15, 2019 10:57 AM
> > To: edk2-devel 
> > Subject: [edk2] EmulatorPkg build issue with macOS mojave and Xcode 10
> >
> > Hi Dear EmulatorPkg Maintainer:
> >   I'm a newbie at this, I am sorry for the wrong format of the previous 
> > mail. There are some issue when building EmulatorPkg. Any
> > inspiration or help will appreciated!
> >
> > OS Environment: macOS mojave with Xcode 10 command line tool and installed 
> > macOS_SDK_headers_for_macOS_10.14.pkg
> > Download edk2-UDK2018.zip
> > Initializing workspace
> > > source ./edk2setup.sh
> >
> > WORKSPACE: /Users/QianYun/Downloads/edk2-vUDK2018
> > EDK_TOOLS_PATH: /Users/QianYun/Downloads/edk2-vUDK2018/BaseTools
> > CONF_PATH: /Users/QianYun/Downloads/edk2-vUDK2018/Conf
> > Copying $EDK_TOOLS_PATH/Conf/build_rule.template
> >  to /Users/QianYun/Downloads/edk2-vUDK2018/Conf/build_rule.txt
> > Copying $EDK_TOOLS_PATH/Conf/tools_def.template
> >  to /Users/QianYun/Downloads/edk2-vUDK2018/Conf/tools_def.txt
> > Copying $EDK_TOOLS_PATH/Conf/target.template
> >  to /Users/QianYun/Downloads/edk2-vUDK2018/Conf/target.txt
> >
> > > cd EmulatorPkg && ./build.sh
> >
> > The BaseTools will build successfully, and EmulatorPkg will fail to build.
> >
> > 'import sitecustomize' failed; use -v for traceback
> > Build environment: Darwin-18.2.0-x86_64-i386-64bit
> > Build start time: 15:10:45, Jan.14 2019
> >
> > WORKSPACE= /Users/QianYun/Downloads/edk2-vUDK2018
> > ECP_SOURCE   = 
> > /Users/QianYun/Downloads/edk2-vUDK2018/EdkCompatibilityPkg
> > EDK_SOURCE   = 
> > /Users/QianYun/Downloads/edk2-vUDK2018/EdkCompatibilityPkg
> > EFI_SOURCE   = 
> > /Users/QianYun/Downloads/edk2-vUDK2018/EdkCompatibilityPkg
> > EDK_TOOLS_PATH   = /Users/QianYun/Downloads/edk2-vUDK2018/BaseTools
> > CONF_PATH= /Users/QianYun/Downloads/edk2-vUDK2018/Conf
> > build: : warning: Tool chain [XCODE32] is not defined
> >
> >
> > build.py...
> >  : error 4000: Not available
> > [XCODE32] not defined. No toolchain available for build!
> >
> >
> > - Failed -
> > Build end time: 15:10:46, Jan.14 2019
> > Build total time: 00:00:00
> >
> > Edit EmulatorPkg/build.sh and ./build.sh again
> >
> > diff --git a/build.sh.new b/build.sh
> > index 4f653d2..339c6b3 100755
> > --- a/build.sh.new
> > +++ b/build.sh
> > @@ -63,8 +63,17 @@ case `uname` in
> >  echo UnixPkg requires Snow Leopard or later OS
> >  exit 1
> >else
> > -HOST_TOOLS=XCODE5
> > -TARGET_TOOLS=XCODE5
> > +CLANG_VER=$(clang -ccc-host-triple x86_64-pc-win32-macho 2>&1 
> > >/dev/null) || true
> > +if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
> > +then
> > +# only older versions of Xcode support -ccc-host-tripe, for newer 
> > versions
> > +# it is -target
> > +  HOST_TOOLS=XCODE32
> > +  TARGET_TOOLS=XCODE5
> > +else
> > +  HOST_TOOLS=XCODE32
> > +  TARGET_TOOLS=XCLANG
> > +fi
> >fi
> >BUILD_NEW_SHELL="-D BUILD_NEW_SHELL"
> >BUILD_FAT="-D BUILD_FAT"
> >
> > However, this attempt still failed.
> >
> > Building ... 
> > /Users/QianYun/Downloads/edk2-vUDK2018/EmulatorPkg/Unix/Host/Host.inf [X64]
> > "clang" -target x86_64-pc-win32-macho -c -g -Os -Wall -Werror -Wextra 
> > -include AutoGen.h -funsigned-char -fno-ms-extensions
> > -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float 
> > -mms-bitfields -Wno-unused-parameter -Wno-missing-braces
> > -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare 
> > -Wno-varargs
> > 

[edk2] [Patch] BaseTools: Fix the build report issue for VPD

2019-01-16 Thread Feng, Bob C
From: BobCF 

Make sure the PlatformAutoGen.AllPcdList always be latest,
or build report will fail sometimes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index cfe2d29099..85d966c62f 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1029,11 +1029,10 @@ class PlatformAutoGen(AutoGen):
 self.Arch = Arch
 self.SourceDir = PlatformFile.SubDir
 self.SourceOverrideDir = None
 self.FdTargetList = self.Workspace.FdTargetList
 self.FvTargetList = self.Workspace.FvTargetList
-self.AllPcdList = []
 # get the original module/package/platform objects
 self.BuildDatabase = Workspace.BuildDatabase
 self.DscBuildDataObj = Workspace.Platform
 
 # flag indicating if the makefile/C-code file has been created or not
@@ -1110,10 +1109,13 @@ class PlatformAutoGen(AutoGen):
 self.LibraryBuildDirectoryList = 
Makefile.GetLibraryBuildDirectoryList()
 self.ModuleBuildDirectoryList = Makefile.GetModuleBuildDirectoryList()
 
 self.IsMakeFileCreated = True
 
+@property
+def AllPcdList(self):
+return self.DynamicPcdList + self.NonDynamicPcdList
 ## Deal with Shared FixedAtBuild Pcds
 #
 def CollectFixedAtBuildPcds(self):
 for LibAuto in self.LibraryAutoGenList:
 FixedAtBuildPcds = {}
@@ -1624,11 +1626,10 @@ class PlatformAutoGen(AutoGen):
 if type(SkuId) in (str, unicode) and eval(SkuId) == 0 or 
SkuId == 0:
 continue
 pcd.SkuInfoList[SkuName] = 
copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])
 pcd.SkuInfoList[SkuName].SkuId = SkuId
 pcd.SkuInfoList[SkuName].SkuIdName = SkuName
-self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
 
 def FixVpdOffset(self, VpdFile ):
 FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
 if not os.path.exists(FvPath):
 try:
-- 
2.19.1.windows.1

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


[edk2] [Patch] BaseTools: Fix build report issue.

2019-01-16 Thread Feng, Bob C
The Pcd Array feature changes the Pcd Default value
data structure which is used by build report. This
patch is going to update build report to adapt that change.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/build/BuildReport.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 654a69e05c..ae37a6ce0e 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1243,13 +1243,15 @@ class PcdReport(object):
 Value = '{} ({:d})'.format(Value, int(Value, 0))
 else:
 Value = "0x{:X} ({})".format(int(Value, 0), Value)
 FileWrite(File, '%*s = %s' % (self.MaxLen + 19, 'DEC 
DEFAULT', Value))
 if IsStructure:
-self.PrintStructureInfo(File, Pcd.DefaultValues)
+for filedvalues in Pcd.DefaultValues.values():
+self.PrintStructureInfo(File, filedvalues)
 if DecMatch and IsStructure:
-self.PrintStructureInfo(File, Pcd.DefaultValues)
+for filedvalues in Pcd.DefaultValues.values():
+self.PrintStructureInfo(File, filedvalues)
 
 def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, 
DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, 
DecDefaultValue, Flag = '  '):
 if not Pcd.SkuInfoList:
 Value = Pcd.DefaultValue
 IsByteArray, ArrayList = ByteArrayForamt(Value)
-- 
2.19.1.windows.1

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


Re: [edk2] [PATCH v2 03/17] QuarkPlatformPkg: add MmServicesTableLib resolution

2019-01-16 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Monday, January 14, 2019 9:28 PM
> To: edk2-devel@lists.01.org
> Cc: Ard Biesheuvel ; Laszlo Ersek 
> ; Leif Lindholm ; Kinney,
> Michael D ; Gao, Liming ; 
> Wang, Jian J ; Wu, Hao A
> ; Jagadeesh Ujja ; Achin Gupta 
> ; Thomas Panakamattam
> Abraham ; Sami Mujawar ; Zeng, 
> Star 
> Subject: [PATCH v2 03/17] QuarkPlatformPkg: add MmServicesTableLib resolution
> 
> The SMM based FTW and variable drivers are going to depend on
> MmServicesTableLib after a subsequent patch, so add a resolution
> for it to various QuarkPlatformPkg .dsc files.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  QuarkPlatformPkg/Quark.dsc| 1 +
>  QuarkPlatformPkg/QuarkMin.dsc | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
> index 96ae404f476c..0e69b3c51f97 100644
> --- a/QuarkPlatformPkg/Quark.dsc
> +++ b/QuarkPlatformPkg/Quark.dsc
> @@ -282,6 +282,7 @@ [LibraryClasses.IA32.DXE_CORE]
>  !endif
> 
>  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
>
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc
> index d7a25686a30b..0f6da821cb82 100644
> --- a/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/QuarkPlatformPkg/QuarkMin.dsc
> @@ -242,6 +242,7 @@ [LibraryClasses.IA32.DXE_CORE]
>  !endif
> 
>  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
>
> ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> --
> 2.20.1

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


Re: [edk2] [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib resolution

2019-01-16 Thread Gao, Liming
Zailiang:
  Could you help review this change?

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Monday, January 14, 2019 9:28 PM
> To: edk2-devel@lists.01.org
> Cc: Ard Biesheuvel ; Laszlo Ersek 
> ; Leif Lindholm ; Kinney,
> Michael D ; Gao, Liming ; 
> Wang, Jian J ; Wu, Hao A
> ; Jagadeesh Ujja ; Achin Gupta 
> ; Thomas Panakamattam
> Abraham ; Sami Mujawar ; Zeng, 
> Star 
> Subject: [PATCH v2 04/17] Vlv2TbltDevicePkg: add MmServicesTableLib resolution
> 
> The SMM based FTW and variable drivers are going to depend on
> MmServicesTableLib after a subsequent patch, so add a resolution
> for it to various Vlv2TbltDevicePkg .dsc files.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
>  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
>  Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
> b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> index d43611550285..eb7c205a10a6 100644
> --- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> +++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> @@ -406,6 +406,7 @@ [LibraryClasses.X64.DXE_CORE]
>  !endif
> 
>  [LibraryClasses.X64.DXE_SMM_DRIVER]
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
>
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
> b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> index a33816c4d18b..b2f0d73f6d05 100644
> --- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> +++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> @@ -406,6 +406,7 @@ [LibraryClasses.IA32.DXE_CORE]
>  !endif
> 
>  [LibraryClasses.IA32.DXE_SMM_DRIVER]
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
>
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
> b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> index 1da1442c64c6..aa62c07f177b 100644
> --- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> +++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> @@ -408,6 +408,7 @@ [LibraryClasses.X64.DXE_CORE]
>  !endif
> 
>  [LibraryClasses.X64.DXE_SMM_DRIVER]
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
>
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
> --
> 2.20.1

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


Re: [edk2] [PATCH v2 09/17] MdePkg: introduce standalone MM entry point library class

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 15:56, Gao, Liming  wrote:
>
> Ard:
>   I have no other comment for the changes in MdePkg. You can add my R-B for 
> MdePkg. Besides, I have updated our internal platform too consume new 
> MmServicesTableLib.
>

Thank you Liming. I will go through all Star's comments, and fix up
the patches before pushing.

What about the Quark and Vlv2 changes? (adding MmServicesTableLib)


> > From: Zeng, Star
> > Sent: Wednesday, January 16, 2019 2:32 PM
> > To: Ard Biesheuvel ; edk2-devel@lists.01.org
> > Cc: Wu, Hao A ; Gao, Liming ; 
> > Kinney, Michael D ; Laszlo
> > Ersek ; Zeng, Star 
> > Subject: Re: [edk2] [PATCH v2 09/17] MdePkg: introduce standalone MM entry 
> > point library class
> >
> > On 2019/1/14 21:27, Ard Biesheuvel wrote:
> > > Add the library interface for the standalone MM driver entry point.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> > > ---
> > >   MdePkg/MdePkg.dec |   3 +
> > >   MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h | 134 
> > > 
> > >   2 files changed, 137 insertions(+)
> > >
> > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> > > index a7383b6daafb..a4854083105d 100644
> > > --- a/MdePkg/MdePkg.dec
> > > +++ b/MdePkg/MdePkg.dec
> > > @@ -247,6 +247,9 @@ [LibraryClasses]
> > > #Only available to MM_STANDALONE, SMM/DXE Combined 
> > > and SMM module types.
> > > MmServicesTableLib|Include/Library/MmServicesTableLib.h
> > >
> > > +  ##  @libraryclass  Module entry point library for standalone MM 
> > > drivers.
> > > +  
> > > StandaloneMmDriverEntryPoint|Include/Library/StandaloneMmDriverEntryPoint.h
> > > +
> > >   [LibraryClasses.IA32, LibraryClasses.X64]
> > > ##  @libraryclass  Abstracts both S/W SMI generation and detection.
> > > ##
> > > diff --git a/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h 
> > > b/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h
> > > new file mode 100644
> > > index ..d08a73303dbb
> > > --- /dev/null
> > > +++ b/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h
> > > @@ -0,0 +1,134 @@
> > > +/** @file
> > > +  Module entry point library for Standalone MM Drivers.
> > > +
> > > +Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
> > > +Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> > > +Copyright (c) 2018, Linaro, Limited. All rights reserved.
> > > +
> > > +This program and the accompanying materials are licensed and made 
> > > available
> > > +under the terms and conditions of the BSD License which accompanies this
> > > +distribution.  The full text of the license may be found at
> > > +http://opensource.org/licenses/bsd-license.php
> > > +
> > > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> > > IMPLIED.
> > > +
> > > +**/
> > > +
> > > +#ifndef __MODULE_ENTRY_POINT_H__
> > > +#define __MODULE_ENTRY_POINT_H__
> > > +
> > > +///
> > > +/// Declare the PI Specification Revision that this driver requires to 
> > > execute
> > > +/// correctly.
> > > +///
> > > +extern CONST UINT32   _gMmRevision;
> > > +
> > > +/**
> > > +  The entry point of PE/COFF Image for a Standalone MM Driver.
> > > +
> > > +  This function is the entry point for a Standalone MM Driver.
> > > +  This function must call ProcessLibraryConstructorList() and
> > > +  ProcessModuleEntryPointList().
> > > +  If the return status from ProcessModuleEntryPointList()
> > > +  is an error status, then ProcessLibraryDestructorList() must be called.
> > > +  The return value from ProcessModuleEntryPointList() is returned.
> >
> > noop
> >
> > > +  If _gDriverUnloadImageCount is greater
> > > +  than zero, then an unload handler must be registered for this image and
> > > +  the unload handler must invoke ProcessModuleUnloadList().
> >
> > This block could be removed.
> >
> > > +  If _gMmRevision is not zero and SystemTable->Hdr.Revision is
> >
> > SystemTable should be MmSystemTable.
> >
> > > +  less than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION.
> >
> > _gUefiDriverRevison should be _gMmRevision.
> >
> > > +
> > > +  @param  ImageHandle  The image handle of the Standalone MM Driver.
> > > +  @param  SystemTable  A pointer to the EFI System Table.
> > > +
> > > +  @retval  EFI_SUCCESS   The Standalone MM Driver exited 
> > > normally.
> > > +  @retval  EFI_INCOMPATIBLE_VERSION  _gMmRevision is greater than
> > > + SystemTable->Hdr.Revision.
> >
> > SystemTable should be MmSystemTable.
> >
> > These feedback may be also applied to the implementation in next patch.
> >
> > With them handled, Acked-by: Star Zeng  to this and
> > next patches.
> >
> > Thanks,
> > Star
> >
> >
> > > +  @retval  Other Return value from
> > > +   

Re: [edk2] [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add MmServicesTableLib resolution

2019-01-16 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Tuesday, January 15, 2019 1:25 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Ard Biesheuvel 
> 
> Subject: [PATCH edk2-platforms] Platform/Intel/MinPlatformPkg: add 
> MmServicesTableLib resolution
> 
> Ensure that the platform will still build when we move the upstream
> FTW and variable SMM runtime drivers to use the new MmServiceTableLib
> library class.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 
> ---
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc 
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> index 1103572408d0..1ed3591f360a 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc
> @@ -77,6 +77,7 @@ [LibraryClasses.common.UEFI_DRIVER]
>  [LibraryClasses.common.DXE_SMM_DRIVER]
>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
> +  MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
>
> ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
>
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
>LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf
> --
> 2.17.1

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


Re: [edk2] [PATCH v2 09/17] MdePkg: introduce standalone MM entry point library class

2019-01-16 Thread Gao, Liming
Ard:
  I have no other comment for the changes in MdePkg. You can add my R-B for 
MdePkg. Besides, I have updated our internal platform too consume new 
MmServicesTableLib. 

Thanks
Liming
> -Original Message-
> From: Zeng, Star
> Sent: Wednesday, January 16, 2019 2:32 PM
> To: Ard Biesheuvel ; edk2-devel@lists.01.org
> Cc: Wu, Hao A ; Gao, Liming ; 
> Kinney, Michael D ; Laszlo
> Ersek ; Zeng, Star 
> Subject: Re: [edk2] [PATCH v2 09/17] MdePkg: introduce standalone MM entry 
> point library class
> 
> On 2019/1/14 21:27, Ard Biesheuvel wrote:
> > Add the library interface for the standalone MM driver entry point.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> > ---
> >   MdePkg/MdePkg.dec |   3 +
> >   MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h | 134 
> > 
> >   2 files changed, 137 insertions(+)
> >
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> > index a7383b6daafb..a4854083105d 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -247,6 +247,9 @@ [LibraryClasses]
> > #Only available to MM_STANDALONE, SMM/DXE Combined and 
> > SMM module types.
> > MmServicesTableLib|Include/Library/MmServicesTableLib.h
> >
> > +  ##  @libraryclass  Module entry point library for standalone MM drivers.
> > +  
> > StandaloneMmDriverEntryPoint|Include/Library/StandaloneMmDriverEntryPoint.h
> > +
> >   [LibraryClasses.IA32, LibraryClasses.X64]
> > ##  @libraryclass  Abstracts both S/W SMI generation and detection.
> > ##
> > diff --git a/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h 
> > b/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h
> > new file mode 100644
> > index ..d08a73303dbb
> > --- /dev/null
> > +++ b/MdePkg/Include/Library/StandaloneMmDriverEntryPoint.h
> > @@ -0,0 +1,134 @@
> > +/** @file
> > +  Module entry point library for Standalone MM Drivers.
> > +
> > +Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
> > +Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> > +Copyright (c) 2018, Linaro, Limited. All rights reserved.
> > +
> > +This program and the accompanying materials are licensed and made available
> > +under the terms and conditions of the BSD License which accompanies this
> > +distribution.  The full text of the license may be found at
> > +http://opensource.org/licenses/bsd-license.php
> > +
> > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> > IMPLIED.
> > +
> > +**/
> > +
> > +#ifndef __MODULE_ENTRY_POINT_H__
> > +#define __MODULE_ENTRY_POINT_H__
> > +
> > +///
> > +/// Declare the PI Specification Revision that this driver requires to 
> > execute
> > +/// correctly.
> > +///
> > +extern CONST UINT32   _gMmRevision;
> > +
> > +/**
> > +  The entry point of PE/COFF Image for a Standalone MM Driver.
> > +
> > +  This function is the entry point for a Standalone MM Driver.
> > +  This function must call ProcessLibraryConstructorList() and
> > +  ProcessModuleEntryPointList().
> > +  If the return status from ProcessModuleEntryPointList()
> > +  is an error status, then ProcessLibraryDestructorList() must be called.
> > +  The return value from ProcessModuleEntryPointList() is returned.
> 
> noop
> 
> > +  If _gDriverUnloadImageCount is greater
> > +  than zero, then an unload handler must be registered for this image and
> > +  the unload handler must invoke ProcessModuleUnloadList().
> 
> This block could be removed.
> 
> > +  If _gMmRevision is not zero and SystemTable->Hdr.Revision is
> 
> SystemTable should be MmSystemTable.
> 
> > +  less than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION.
> 
> _gUefiDriverRevison should be _gMmRevision.
> 
> > +
> > +  @param  ImageHandle  The image handle of the Standalone MM Driver.
> > +  @param  SystemTable  A pointer to the EFI System Table.
> > +
> > +  @retval  EFI_SUCCESS   The Standalone MM Driver exited 
> > normally.
> > +  @retval  EFI_INCOMPATIBLE_VERSION  _gMmRevision is greater than
> > + SystemTable->Hdr.Revision.
> 
> SystemTable should be MmSystemTable.
> 
> These feedback may be also applied to the implementation in next patch.
> 
> With them handled, Acked-by: Star Zeng  to this and
> next patches.
> 
> Thanks,
> Star
> 
> 
> > +  @retval  Other Return value from
> > + ProcessModuleEntryPointList().
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +_ModuleEntryPoint (
> > +  IN EFI_HANDLE ImageHandle,
> > +  IN EFI_MM_SYSTEM_TABLE*MmSystemTable
> > +  );
> > +
> > +
> > +/**
> > +  Auto generated function that calls the library constructors for all of 
> > the
> > +  module's dependent libraries.
> > +
> > +  This function must be called by 

Re: [edk2] [PATCH V2 10/15] ArmVirtXen: Use merged variable driver for emulated NV mode

2019-01-16 Thread Julien Grall

Hi Laszlo,

On 15/01/2019 09:37, Laszlo Ersek wrote:

On 01/14/19 16:19, Star Zeng wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
Merge EmuVariable and Real variable driver.

The real variable driver has been updated to support emulated
variable NV mode and the EmuVariableRuntimeDxe will be removed
later, so use merged variable driver for emulated NV mode.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Julien Grall 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
  ArmVirtPkg/ArmVirtXen.dsc | 9 +++--
  ArmVirtPkg/ArmVirtXen.fdf | 4 ++--
  2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index a29d8a4ae717..db85fb3402d0 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -1,7 +1,7 @@
  #
  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
  #
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -101,6 +101,11 @@ [PcdsFixedAtBuild.common]
# Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 
0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
  
+  #

+  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+
  [PcdsPatchableInModule.common]
#
# This will be overridden in the code
@@ -172,7 +177,7 @@ [Components.common]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
  
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
  
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf

MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 50e670254d52..5655c0df2926 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -1,7 +1,7 @@
  #
  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
  #
  #  This program and the accompanying materials
  #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -137,7 +137,7 @@ [FV.FvMain]
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
  
-  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
  
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf

INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf



Reviewed-by: Laszlo Ersek 

Julien, can you please regression test this series on Xen? The repo URL
and the branch name are in the blurb.


I will have a try and let you know the result.

Cheers,

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


Re: [edk2] [PATCH V3 12/17] ArmVirtXen: Use merged variable driver for emulated NV mode

2019-01-16 Thread Ard Biesheuvel
On Tue, 15 Jan 2019 at 11:29, Star Zeng  wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
> Merge EmuVariable and Real variable driver.
>
> The real variable driver has been updated to support emulated
> variable NV mode and the EmuVariableRuntimeDxe will be removed
> later, so use merged variable driver for emulated NV mode.
>
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Julien Grall 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> Reviewed-by: Laszlo Ersek 

Reviewed-by: Ard Biesheuvel 

> ---
>  ArmVirtPkg/ArmVirtXen.dsc | 9 +++--
>  ArmVirtPkg/ArmVirtXen.fdf | 4 ++--
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index a29d8a4ae717..db85fb3402d0 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -101,6 +101,11 @@ [PcdsFixedAtBuild.common]
># Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
>gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 
> 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
>
> +  #
> +  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> +
>  [PcdsPatchableInModule.common]
>#
># This will be overridden in the code
> @@ -172,7 +177,7 @@ [Components.common]
>MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>
> -  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>
>
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
>MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index 50e670254d52..5655c0df2926 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -137,7 +137,7 @@ [FV.FvMain]
>INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>
> -  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>
>INF 
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
>INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> --
> 2.7.0.windows.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V3 13/17] ArmVirtXen: Link VarCheckUefiLib NULL class library instance

2019-01-16 Thread Ard Biesheuvel
On Tue, 15 Jan 2019 at 11:29, Star Zeng  wrote:
>
> This patch is not related directly to
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
> Merge EmuVariable and Real variable driver.
>
> It just makes ArmVirtXen be aligned with ArmVirtQemuXXX to
> link VarCheckUefiLib NULL class library instance.
>
> Suggested-by: Laszlo Ersek 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Julien Grall 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> Reviewed-by: Laszlo Ersek 

Reviewed-by: Ard Biesheuvel 

> ---
>  ArmVirtPkg/ArmVirtXen.dsc | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index db85fb3402d0..e58444e6ae27 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -177,7 +177,10 @@ [Components.common]
>MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>
> -  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> +
> +  NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> +  }
>
>
> MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
>MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> --
> 2.7.0.windows.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EDK II Network Stack Issue

2019-01-16 Thread Karin Willers

On 2019-01-10 13:40, Karin Willers wrote:

On 2019-01-07 20:27, Laszlo Ersek wrote:

On 01/04/19 15:02, Karin Willers wrote:

G'Day!

I'm trying to get networking under edk2 up and running. I tried
AppPkg/Applications/Sockets/RawIp4Tx
under OVMF. The raw packet is sent out on the network, but the
application never returns from the
socket close routine.

I'm currently using UDK2017 with the latest security patches 
(downloaded

December 18 2018). The network
driver under OVMF is the e1000 driver.

The effect that the socket close never returns is also visible when
running RawIp4Tx on real hardware,
so I think the behavior has nothing to do with OVMF or the UEFI 
itself.


Does anyone see similar effects? Any hints on setting up networking
under edk2 correctly?


The socket (= libc-level networking) APIs are not the most robust ones
in edk2, in my -- admittedly limited -- experience. I'd suggest using
applications and shell commands that use UEFI protocols instead, for
networking. (I understand that could be a challenge if you are porting 
a

standard C program to UEFI.)

Thanks
Laszlo


The reason for this undertaking initially was to compile a Python.efi 
that
supports sockets. We wanted that to be able to run the Chipsec suite 
with

external network test partners under UEFI. The Chipsec guys do provide
pre-compiled Pyhon executables, but these do not include the network 
stack.


I think, I have to debug the issue myself ...

Greetings,  Karin


Could please someone shed some light on how to enable debug prints using 
UefiDebugLibConOut
in EfiSocketLib/Socket.c. Enabling debug prints is, IMHO, not very 
intuitive in edk2 ...


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


Re: [edk2] [edk2-platforms PATCH] Platform D03/D05: Remove EmuVariableRuntimeDxe including

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 11:25, Star Zeng  wrote:
>
> For https://bugzilla.tianocore.org/show_bug.cgi?id=1323,
> EmuVariable will be merged to real variable driver, and
> EmuVariableRuntimeDxe will be removed finally.
>
> As D03 and D05 are using the real variable driver VariableRuntimeDxe,
> this patch removes EmuVariableRuntimeDxe including in D03.dsc and
> D05.dsc directly.
>
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 

Reviewed-by: Ard Biesheuvel 

> ---
>  Platform/Hisilicon/D03/D03.dsc | 1 -
>  Platform/Hisilicon/D05/D05.dsc | 2 --
>  2 files changed, 3 deletions(-)
>
> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
> index 23764ef0e961..3f59be22ec8e 100644
> --- a/Platform/Hisilicon/D03/D03.dsc
> +++ b/Platform/Hisilicon/D03/D03.dsc
> @@ -348,7 +348,6 @@ [Components.common]
>Platform/Hisilicon/D03/Drivers/SFC/SfcDxeDriver.inf
>
>MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> -  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
>Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
>  
> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
> index ee306a8be555..25db1c38d287 100644
> --- a/Platform/Hisilicon/D05/D05.dsc
> +++ b/Platform/Hisilicon/D05/D05.dsc
> @@ -481,8 +481,6 @@ [Components.common]
>Platform/Hisilicon/D05/Drivers/SFC/SfcDxeDriver.inf
>
>MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> -  # Sometimes we can use EmuVariableRuntimeDxe instead of real flash 
> variable store for debug.
> -  #MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
>Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
>MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
>  
> --
> 2.7.0.windows.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-platforms PATCH] Platform HiKeyXXX: Use merged variable driver for emulated NV mode

2019-01-16 Thread Ard Biesheuvel
On Wed, 16 Jan 2019 at 11:25, Star Zeng  wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
> Merge EmuVariable and Real variable driver.
>
> The real variable driver has been updated to support emulated
> variable NV mode and the EmuVariableRuntimeDxe will be removed
> later, so use merged variable driver for emulated NV mode.
>
> NOTE:
> FaultTolerantWriteDxe is not needed at all for emulated NV mode,
> so remove FaultTolerantWriteDxe including.
>
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 

Reviewed-by: Ard Biesheuvel 

> ---
>  Platform/Hisilicon/HiKey/HiKey.dsc   | 13 +++--
>  Platform/Hisilicon/HiKey/HiKey.fdf   |  3 +--
>  Platform/Hisilicon/HiKey960/HiKey960.dsc | 14 --
>  Platform/Hisilicon/HiKey960/HiKey960.fdf |  3 +--
>  4 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
> b/Platform/Hisilicon/HiKey/HiKey.dsc
> index 38fee902690c..7e05babb6c51 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -59,6 +59,12 @@ [LibraryClasses.common]
>IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
>UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
>
> +  # VariableRuntimeDxe Requirements
> +  
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
> +  
> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
> +  
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
> +  VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> +
>  [LibraryClasses.common.SEC]
>PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
>
> ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
> @@ -144,6 +150,10 @@ [PcdsFixedAtBuild.common]
>
> gHiKeyTokenSpaceGuid.PcdAndroidBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00D023F700)/eMMC(0x0)/Ctrl(0x0)/HD(6,GPT,5C0F213C-17E1-4149-88C8-8B50FB4EC70E,0x7000,0x2)/\\EFI\\BOOT\\GRUBAA64.EFI"
>
> gHiKeyTokenSpaceGuid.PcdSdBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00E023F700)/SD(0x0)"
>
> +  #
> +  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
>
>  
> 
>  #
> @@ -183,8 +193,7 @@ [Components.common]
>MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
>MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
>
> -  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> -  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>
>ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf 
> b/Platform/Hisilicon/HiKey/HiKey.fdf
> index b0e533c5b1de..7e6c8083bbca 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.fdf
> +++ b/Platform/Hisilicon/HiKey/HiKey.fdf
> @@ -182,8 +182,7 @@ [FV.FvMain]
>INF FatPkg/EnhancedFatDxe/Fat.inf
>INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>
> -  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> -  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>
>INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
>
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc 
> b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> index bd26b759dce0..a4a1a371de19 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> @@ -59,6 +59,12 @@ [LibraryClasses.common]
>IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
>UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
>
> +  # VariableRuntimeDxe Requirements
> +  
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
> +  
> AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
> +  
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
> +  VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> +
>  [LibraryClasses.common.SEC]
>PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
>
> ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
> @@ -135,6 +141,11 @@ [PcdsFixedAtBuild.common]
>
> gHiKey960TokenSpaceGuid.PcdAndroidBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,3BFF00)/UFS(0x0,0x3)/HD(7,GPT,D3340696-9B95-4C64-8DF6-E6D4548FBA41,0x12100,0x4000)/\\EFI\\BOOT\\GRUBAA64.EFI"
>  

[edk2] [edk2-platforms PATCH] Platform D03/D05: Remove EmuVariableRuntimeDxe including

2019-01-16 Thread Star Zeng
For https://bugzilla.tianocore.org/show_bug.cgi?id=1323,
EmuVariable will be merged to real variable driver, and
EmuVariableRuntimeDxe will be removed finally.

As D03 and D05 are using the real variable driver VariableRuntimeDxe,
this patch removes EmuVariableRuntimeDxe including in D03.dsc and
D05.dsc directly.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Platform/Hisilicon/D03/D03.dsc | 1 -
 Platform/Hisilicon/D05/D05.dsc | 2 --
 2 files changed, 3 deletions(-)

diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index 23764ef0e961..3f59be22ec8e 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -348,7 +348,6 @@ [Components.common]
   Platform/Hisilicon/D03/Drivers/SFC/SfcDxeDriver.inf
 
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
   Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
 
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index ee306a8be555..25db1c38d287 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -481,8 +481,6 @@ [Components.common]
   Platform/Hisilicon/D05/Drivers/SFC/SfcDxeDriver.inf
 
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
-  # Sometimes we can use EmuVariableRuntimeDxe instead of real flash variable 
store for debug.
-  #MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
   Silicon/Hisilicon/Drivers/FlashFvbDxe/FlashFvbDxe.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
 
-- 
2.7.0.windows.1

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


[edk2] [edk2-platforms PATCH] Platform HiKeyXXX: Use merged variable driver for emulated NV mode

2019-01-16 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
Merge EmuVariable and Real variable driver.

The real variable driver has been updated to support emulated
variable NV mode and the EmuVariableRuntimeDxe will be removed
later, so use merged variable driver for emulated NV mode.

NOTE:
FaultTolerantWriteDxe is not needed at all for emulated NV mode,
so remove FaultTolerantWriteDxe including.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Platform/Hisilicon/HiKey/HiKey.dsc   | 13 +++--
 Platform/Hisilicon/HiKey/HiKey.fdf   |  3 +--
 Platform/Hisilicon/HiKey960/HiKey960.dsc | 14 --
 Platform/Hisilicon/HiKey960/HiKey960.fdf |  3 +--
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
b/Platform/Hisilicon/HiKey/HiKey.dsc
index 38fee902690c..7e05babb6c51 100644
--- a/Platform/Hisilicon/HiKey/HiKey.dsc
+++ b/Platform/Hisilicon/HiKey/HiKey.dsc
@@ -59,6 +59,12 @@ [LibraryClasses.common]
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
 
+  # VariableRuntimeDxe Requirements
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+  VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+
 [LibraryClasses.common.SEC]
   PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
   
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
@@ -144,6 +150,10 @@ [PcdsFixedAtBuild.common]
   
gHiKeyTokenSpaceGuid.PcdAndroidBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00D023F700)/eMMC(0x0)/Ctrl(0x0)/HD(6,GPT,5C0F213C-17E1-4149-88C8-8B50FB4EC70E,0x7000,0x2)/\\EFI\\BOOT\\GRUBAA64.EFI"
   
gHiKeyTokenSpaceGuid.PcdSdBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00E023F700)/SD(0x0)"
 
+  #
+  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
 
 

 #
@@ -183,8 +193,7 @@ [Components.common]
   MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
   MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
 
-  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf 
b/Platform/Hisilicon/HiKey/HiKey.fdf
index b0e533c5b1de..7e6c8083bbca 100644
--- a/Platform/Hisilicon/HiKey/HiKey.fdf
+++ b/Platform/Hisilicon/HiKey/HiKey.fdf
@@ -182,8 +182,7 @@ [FV.FvMain]
   INF FatPkg/EnhancedFatDxe/Fat.inf
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 
-  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
-  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc 
b/Platform/Hisilicon/HiKey960/HiKey960.dsc
index bd26b759dce0..a4a1a371de19 100644
--- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
+++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
@@ -59,6 +59,12 @@ [LibraryClasses.common]
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
 
+  # VariableRuntimeDxe Requirements
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+  VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+
 [LibraryClasses.common.SEC]
   PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
   
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
@@ -135,6 +141,11 @@ [PcdsFixedAtBuild.common]
   
gHiKey960TokenSpaceGuid.PcdAndroidBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,3BFF00)/UFS(0x0,0x3)/HD(7,GPT,D3340696-9B95-4C64-8DF6-E6D4548FBA41,0x12100,0x4000)/\\EFI\\BOOT\\GRUBAA64.EFI"
   
gHiKey960TokenSpaceGuid.PcdSdBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00F037FF00)/SD(0x0)"
 
+  #
+  # Make VariableRuntimeDxe work at emulated non-volatile variable mode.
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+
 

[edk2] [edk2-platforms PATCH] MinPlatformPkg: Use merged variable driver for emulated NV mode

2019-01-16 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323
Merge EmuVariable and Real variable driver.

The real variable driver has been updated to support emulated
variable NV mode and the EmuVariableRuntimeDxe will be removed
later, so use merged variable driver for emulated NV mode.

Cc: Michael A Kubacki 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc  | 7 +--
 Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc 
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
index 9b033f43a6cb..6bd526a27b09 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -44,7 +44,10 @@
   NULL|MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLib.inf
   }
 !else
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+  }
 !endif
 
   
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf 
b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
index da5ca7619732..be3caad402f9 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
+++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  FDF file of Platform.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License which accompanies this 
distribution.
@@ -26,7 +26,7 @@
 INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == TRUE
-INF  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
 !endif
 
 INF  
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH] MdeModulePkg/UefiBootManagerLib: Match the nested partitions

2019-01-16 Thread Laszlo Ersek
On 01/16/19 03:16, Gary Lin wrote:
> On Tue, Jan 15, 2019 at 12:58:10PM +0100, Laszlo Ersek wrote:
>> On 01/15/19 10:45, Gary Lin wrote:
>>> In some cases, such as MD RAID1 in Linux, the bootloader may be in a
>>> nested EFI system partition partition. For example, sda1 and sdb1 are
>>> combined as md0 and the first partition of md0, md0p1, is an EFI system
>>> partition. Then, the bootloader can be located by the following device
>>> paths:
>>>
>>> PCI()/SATA(sda)/Partition(sda1)/Partition(md0p1)/File(bootloader.efi)
>>> PCI()/SATA(sdb)/Partition(sdb1)/Partition(md0p1)/File(bootloader.efi)
>>
>> How does edk2 recognize the nested partition md0p1 in the first place?
>>
>> I would assume that the "outer" partitions (sda1, sdb1) start with some
>> kind of MD RAID1 header that allows Linux to combine sda1 and sdb1 into
>> md0p1. How does edk2 get past that header?
>>
>> Hmmm... based on
>> , does
>> Linux use "footers" instead of "headers"?
>>
> See the "Sub-versions of the version-1 superblock" section:
> 
> 
> For MD 0.9 and 1.0, the metadata is stored in the end of the disk, and
> those partitions, nested or not, are just like the normal partitions, so
> the firmare can see them without the knowledge of MD metadata. MD 1.1
> and 1.2 would be a different story because those two use "headers".
> 
> Anyway, I have tested RAID1 with MD 1.0 and OVMF actually appended md0p1
> in the device path. I only need to iterate the nested partitions in the
> match function to make my boot option work.

Thanks for the explanation! I'll let Ray review the change.
Laszlo

>>>
>>> To make the boot option more resilient, we may create a boot option with
>>> the short-form device path like "Partition(md0p1)/File(bootloader.efi)".
>>>
>>> However, BmMatchPartitionDevicePathNode() only matched the first
>>> partition node and ignored the nested partitions, so the firmware would
>>> refuse to load bootloader.efi since "Partition(md0p1)" doesn't match
>>> either "Partition(sda1)" or "Partition(sda2)".
>>>
>>> This commit modifies BmMatchPartitionDevicePathNode() to iterate all
>>> nested partitions so that the above boot option could work.
>>>
>>> Cc: Ruiyu Ni 
>>> Cc: Star Zeng 
>>> Cc: Jian J Wang 
>>> Cc: Hao Wu 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Gary Lin 
>>> ---
>>>  .../Library/UefiBootManagerLib/BmBoot.c   | 37 ---
>>>  1 file changed, 23 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
>>> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>>> index 6a23477eb873..8354c2af674b 100644
>>> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>>> @@ -1995,21 +1995,30 @@ BmMatchPartitionDevicePathNode (
>>>  return FALSE;
>>>}
>>>  
>>> -  //
>>> -  // See if the harddrive device path in blockio matches the orig Hard 
>>> Drive Node
>>> -  //
>>> -  Node = (HARDDRIVE_DEVICE_PATH *) BlockIoDevicePath;
>>> +  do {
>>> +//
>>> +// See if the harddrive device path in blockio matches the orig Hard 
>>> Drive Node
>>> +//
>>> +Node = (HARDDRIVE_DEVICE_PATH *) BlockIoDevicePath;
>>>  
>>> -  //
>>> -  // Match Signature and PartitionNumber.
>>> -  // Unused bytes in Signature are initiaized with zeros.
>>> -  //
>>> -  return (BOOLEAN) (
>>> -(Node->PartitionNumber == HardDriveDevicePath->PartitionNumber) &&
>>> -(Node->MBRType == HardDriveDevicePath->MBRType) &&
>>> -(Node->SignatureType == HardDriveDevicePath->SignatureType) &&
>>> -(CompareMem (Node->Signature, HardDriveDevicePath->Signature, sizeof 
>>> (Node->Signature)) == 0)
>>> -);
>>> +//
>>> +// Match Signature and PartitionNumber.
>>> +// Unused bytes in Signature are initiaized with zeros.
>>> +//
>>> +if ((Node->PartitionNumber == HardDriveDevicePath->PartitionNumber) &&
>>> +(Node->MBRType == HardDriveDevicePath->MBRType) &&
>>> +(Node->SignatureType == HardDriveDevicePath->SignatureType) &&
>>> +(CompareMem (Node->Signature, HardDriveDevicePath->Signature, 
>>> sizeof (Node->Signature)) == 0)) {
>>> +  return TRUE;
>>> +}
>>> +
>>> +// See if a nested partition exists
>>> +BlockIoDevicePath = NextDevicePathNode (BlockIoDevicePath);
>>> +  } while (!IsDevicePathEnd (BlockIoDevicePath) &&
>>> +   (DevicePathType (BlockIoDevicePath) == MEDIA_DEVICE_PATH) &&
>>> +   (DevicePathSubType (BlockIoDevicePath) == MEDIA_HARDDRIVE_DP));
>>> +
>>> +  return FALSE;
>>>  }
>>>  
>>>  /**
>>>
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>

___
edk2-devel mailing list

Re: [edk2] [PATCH v1 1/2] MdeModulePkg/NetLib.h: Fix the possible NULL pointer dereference issue.

2019-01-16 Thread Wu, Jiaxin
Hi Laszlo,

Thanks review the patch.

> 
> (1) The linked list from BaseLib (LIST_ENTRY) always has at least one
> element (the head element), and the list is empty if the head element
> points back to itself. In other words, ForwardLink may never be NULL.
> 
> So why is it necessary to check against that case here?
> 

I agree the ForwardLink in valid LIST_ENTRY can't be NULL. Here, I added the 
more condition check was considering the possible broken case of the 
LIST_ENTRY. But I also checked the other usage of *_FOR_EACH_SAFE /*_FOR_EACH, 
looks never or unnecessary to consider that case.

If so,  please drop the series patches and I will create another series patches 
to remove the unnecessary check after retrieving the value from list Entry.


> (2) If the NULL check is indeed necessary for some reason, then we
> should write
> 
>   Entry != (ListHead) && Entry != NULL
> 
> in the controlling expression. Because, with the comma operator, the
> (Entry != (ListHead)) expression would be evaluated, but its result
> would be ignored.
> 

Yes, I was also awared that, so I created patch v2 to fix that: 

[edk2] [PATCH v2 1/2] MdeModulePkg/NetLib.h: Fix the possible NULL pointer 
dereference issue.
Fix the wrong condition in for cycle.

Thanks,
Jiaxin


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