[edk2] [PATCH v1 9/9] BaseTools: FfsInfStatement - remove unused function

2018-04-13 Thread Jaben Carsey
From: Jaben 

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 21 
 1 file changed, 21 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py 
b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 4f9936a97342..8ae29b285d06 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -1065,27 +1065,6 @@ class FfsInfStatement(FfsInfStatementClassObject):
  )
 return FfsOutput
 
-## __GetGenFfsCmdParameter__() method
-#
-#   Create parameter string for GenFfs
-#
-#   @param  RuleThe rule object used to generate section
-#   @retval tuple   (FileType, Fixed, CheckSum, Alignment)
-#
-@staticmethod
-def __GetGenFfsCmdParameter__(Rule):
-result = tuple()
-result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])
-if Rule.Fixed != False:
-result += ('-x',)
-if Rule.CheckSum != False:
-result += ('-s',)
-
-if Rule.Alignment is not None and Rule.Alignment != '':
-result += ('-a', Rule.Alignment)
-
-return result
- 
 ## __GetBuildOutputMapFileVfrUniInfo() method
 #
 #   Find the offset of UNI/INF object offset in the EFI image file.
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 1/9] BaseTools: remove unused local variable.

2018-04-13 Thread Jaben Carsey
From: Jaben 

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 6766f059b0f7..39ac73a04867 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -279,8 +279,6 @@ class DscBuildData(PlatformBuildClassObject):
 ## handle Override Path of Module
 def _HandleOverridePath(self):
 RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
-Macros = self._Macros
-Macros["EDK_SOURCE"] = GlobalData.gEcpSource
 for Record in RecordList:
 ModuleId = Record[6]
 LineNo = Record[7]
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 0/9] BaseTools: refactoring

2018-04-13 Thread Jaben Carsey
group of patches for refactoring BaseTools.  removing unused functions, 
variables, and parameters.  make functions statis where apropriate.

Jaben (9):
  BaseTools: remove unused local variable.
  BaseTools: change DscBuildData functions without need for self to
staticmethod
  BaseTools: Remove unused functions from DscBuildData
  BaseTools: move RegEx compile out of loops
  BaseTools: use dictionary.get() when we have value if not found
  BaseTools: refactor DepexSection.GenSection
  BaseTools: FdfParser refactor to remove a dictionary
  BaseTools: FdfParser - refactor functions to make static
  BaseTools: FfsInfStatement - remove unused function

 BaseTools/Source/Python/GenFds/DepexSection.py|  14 +-
 BaseTools/Source/Python/GenFds/FdfParser.py   |  20 +--
 BaseTools/Source/Python/GenFds/FfsInfStatement.py |  27 +---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 146 +---
 BaseTools/Source/Python/build/build.py|   4 +-
 5 files changed, 87 insertions(+), 124 deletions(-)

-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 2/9] BaseTools: change DscBuildData functions without need for self to staticmethod

2018-04-13 Thread Jaben Carsey
From: Jaben 

prepend functiosn with @staticmethod
change calls to use class name, not self

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 102 
 1 file changed, 64 insertions(+), 38 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 39ac73a04867..6177a964a1ad 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -650,14 +650,17 @@ class DscBuildData(PlatformBuildClassObject):
 if not IsValidWord(Record[1]):
 EdkLogger.error('build', FORMAT_INVALID, "The format of 
the Sku ID name is invalid. The correct format is 
'(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
 File=self.MetaFile, Line=Record[-1])
-self._SkuIds[Record[1].upper()] = (str(self.ToInt(Record[0])), 
Record[1].upper(), Record[2].upper())
+self._SkuIds[Record[1].upper()] = 
(str(DscBuildData.ToInt(Record[0])), Record[1].upper(), Record[2].upper())
 if 'DEFAULT' not in self._SkuIds:
 self._SkuIds['DEFAULT'] = ("0","DEFAULT","DEFAULT")
 if 'COMMON' not in self._SkuIds:
 self._SkuIds['COMMON'] = ("0","DEFAULT","DEFAULT")
 return self._SkuIds
-def ToInt(self,intstr):
+
+@staticmethod
+def ToInt(intstr):
 return int(intstr,16) if intstr.upper().startswith("0X") else 
int(intstr)
+
 def _GetDefaultStores(self):
 if self.DefaultStores is None:
 self.DefaultStores = OrderedDict()
@@ -677,7 +680,7 @@ class DscBuildData(PlatformBuildClassObject):
 if not IsValidWord(Record[1]):
 EdkLogger.error('build', FORMAT_INVALID, "The format of 
the DefaultStores ID name is invalid. The correct format is 
'(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
 File=self.MetaFile, Line=Record[-1])
-self.DefaultStores[Record[1].upper()] = 
(self.ToInt(Record[0]),Record[1].upper())
+self.DefaultStores[Record[1].upper()] = 
(DscBuildData.ToInt(Record[0]),Record[1].upper())
 if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores:
 self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] = 
(0,TAB_DEFAULT_STORES_DEFAULT)
 GlobalData.gDefaultStores = self.DefaultStores.keys()
@@ -1034,9 +1037,9 @@ class DscBuildData(PlatformBuildClassObject):
 EdkLogger.error('build', AUTOGEN_ERROR, "The Pcd %s is 
not found in the DEC file." % (DisplayName))
 pcdvalue = pcdvalue.replace("\\'", 
'\\"').replace('\\\'', '\'').replace('\\"', "\\'")
 if FieldName:
-pcdvalue = self.HandleFlexiblePcd(TokenSpaceGuidCName, 
TokenCName, pcdvalue, PcdDatumType, self._GuidDict, FieldName)
+pcdvalue = 
DscBuildData.HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, pcdvalue, 
PcdDatumType, self._GuidDict, FieldName)
 else:
-pcdvalue = self.HandleFlexiblePcd(TokenSpaceGuidCName, 
TokenCName, pcdvalue, PcdDatumType, self._GuidDict)
+pcdvalue = 
DscBuildData.HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, pcdvalue, 
PcdDatumType, self._GuidDict)
 IsValid, Cause = CheckPcdDatum(PcdDatumType, pcdvalue)
 if not IsValid:
 EdkLogger.error("build", FORMAT_INVALID, Cause, 
ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
@@ -1050,7 +1053,8 @@ class DscBuildData(PlatformBuildClassObject):
 if (TokenSpaceGuidCName, TokenCName) == 
(PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="":
 PcdItem.DefaultValue = pcdvalue
 
-def HandleFlexiblePcd(self, TokenSpaceGuidCName, TokenCName, PcdValue, 
PcdDatumType, GuidDict, FieldName=''):
+@staticmethod
+def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, 
PcdDatumType, GuidDict, FieldName=''):
 if FieldName:
 IsArray = False
 TokenCName += '.' + FieldName
@@ -1203,7 +1207,9 @@ class DscBuildData(PlatformBuildClassObject):
 structure_pcd_data[(item[0],item[1])].append(item)
 
 return structure_pcd_data
-def OverrideByFdfComm(self,StruPcds):
+
+@staticmethod
+def OverrideByFdfComm(StruPcds):
 StructurePcdInCom = OrderedDict()
 for item in GlobalData.BuildOptionPcd:
 if len(item) == 5 and (item[1],item[0]) in StruPcds:
@@ -1223,6 +1229,7 @@ class DscBuildData(PlatformBuildClassObject):
 Pcd.PcdFieldValueFromComm[field][1] = FieldValues[field][1][0]
  

[edk2] [PATCH v1 4/9] BaseTools: move RegEx compile out of loops

2018-04-13 Thread Jaben Carsey
From: Jaben 

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index ea001eef0281..fb0def46f331 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -95,6 +95,9 @@ MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C
 LIBS = -lCommon
 '''
 
+## regular expressions for finding decimal and hex numbers
+Pattern = re.compile('^[1-9]\d*|0$')
+HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
 ## Regular expression for finding header file inclusions
 from AutoGen.GenMake import gIncludePattern
 
@@ -642,9 +645,7 @@ class DscBuildData(PlatformBuildClassObject):
 if Record[1] in [None, '']:
 EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name',
 File=self.MetaFile, Line=Record[-1])
-Pattern = re.compile('^[1-9]\d*|0$')
-HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
-if Pattern.match(Record[0]) is None and 
HexPattern.match(Record[0]) is None:
+if not Pattern.match(Record[0]) and not 
HexPattern.match(Record[0]):
 EdkLogger.error('build', FORMAT_INVALID, "The format of 
the Sku ID number is invalid. It only support Integer and HexNumber",
 File=self.MetaFile, Line=Record[-1])
 if not IsValidWord(Record[1]):
@@ -672,9 +673,7 @@ class DscBuildData(PlatformBuildClassObject):
 if Record[1] in [None, '']:
 EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores 
ID name',
 File=self.MetaFile, Line=Record[-1])
-Pattern = re.compile('^[1-9]\d*|0$')
-HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
-if Pattern.match(Record[0]) is None and 
HexPattern.match(Record[0]) is None:
+if not Pattern.match(Record[0]) and not 
HexPattern.match(Record[0]):
 EdkLogger.error('build', FORMAT_INVALID, "The format of 
the DefaultStores ID number is invalid. It only support Integer and HexNumber",
 File=self.MetaFile, Line=Record[-1])
 if not IsValidWord(Record[1]):
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 8/9] BaseTools: FdfParser - refactor functions to make static

2018-04-13 Thread Jaben Carsey
From: Jaben 

make functions that doesn't use self into @staticmethod

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FdfParser.py   | 11 ++-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 10 +-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 662c232c86e4..dce41701a510 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1131,7 +1131,8 @@ class FdfParser:
 self.__UndoToken()
 return False
 
-def __Verify(self, Name, Value, Scope):
+@staticmethod
+def __Verify(Name, Value, Scope):
 if Scope in ['UINT64', 'UINT8']:
 ValueNumber = 0
 try:
@@ -3200,16 +3201,16 @@ class FdfParser:
 raise Warning("expected value of %s" % Name, 
self.FileName, self.CurrentLineNumber)
 Value = self.__Token
 if Name == 'IMAGE_HEADER_INIT_VERSION':
-if self.__Verify(Name, Value, 'UINT8'):
+if FdfParser.__Verify(Name, Value, 'UINT8'):
 FmpData.Version = Value
 elif Name == 'IMAGE_INDEX':
-if self.__Verify(Name, Value, 'UINT8'):
+if FdfParser.__Verify(Name, Value, 'UINT8'):
 FmpData.ImageIndex = Value
 elif Name == 'HARDWARE_INSTANCE':
-if self.__Verify(Name, Value, 'UINT8'):
+if FdfParser.__Verify(Name, Value, 'UINT8'):
 FmpData.HardwareInstance = Value
 elif Name == 'MONOTONIC_COUNT':
-if self.__Verify(Name, Value, 'UINT64'):
+if FdfParser.__Verify(Name, Value, 'UINT64'):
 FmpData.MonotonicCount = Value
 if FmpData.MonotonicCount.upper().startswith('0X'):
 FmpData.MonotonicCount = 
(long)(FmpData.MonotonicCount, 16)
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py 
b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 5364569b96d7..4f9936a97342 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -1011,7 +1011,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
 if VfrUniOffsetList:
 UniVfrOffsetFileName = 
os.path.join(self.OutputPath, self.BaseName + '.offset')
 UniVfrOffsetFileSection = 
os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')
-self.__GenUniVfrOffsetFile (VfrUniOffsetList, 
UniVfrOffsetFileName)
+FfsInfStatement.__GenUniVfrOffsetFile 
(VfrUniOffsetList, UniVfrOffsetFileName)
 UniVfrOffsetFileNameList = []
 
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
 """Call GenSection"""
@@ -1069,11 +1069,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
 #
 #   Create parameter string for GenFfs
 #
-#   @param  selfThe object pointer
 #   @param  RuleThe rule object used to generate section
 #   @retval tuple   (FileType, Fixed, CheckSum, Alignment)
 #
-def __GetGenFfsCmdParameter__(self, Rule):
+@staticmethod
+def __GetGenFfsCmdParameter__(Rule):
 result = tuple()
 result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])
 if Rule.Fixed != False:
@@ -1103,11 +1103,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
 #
 #   Generate the offset file for the module which contain VFR or UNI file.
 #
-#   @param  selfThe object pointer
 #   @param  VfrUniOffsetListA list contain the VFR/UNI offsets in 
the EFI image file.
 #   @param  UniVfrOffsetFileNameThe output offset file name.
 #
-def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):
+@staticmethod
+def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):
 
 # Use a instance of StringIO to cache data
 fStringIO = StringIO.StringIO('')  
-- 
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] MdePkg: add big-endian MMIO BaseBeIoLib

2018-04-13 Thread Leif Lindholm
On Fri, Apr 13, 2018 at 07:24:06PM +, Kinney, Michael D wrote:
> Hi Leif,
> 
> I think we need to look at the names.  I see a mix of
> "Be" and "Swap".  We should pick one and use it 
> consistently.

This was what I meant by the comments:
---
This modified version introduces a single BeIoLib instance, backed by
a source-file that could be used also for a hypothetical LeIoLib.
There is no LeIoLib.h included though.

While this is arguably overengineered, I do feel reasonably strongly
that code should be named for what it does, not for how it is used,
and doing it this way lets me follow that rule.
---

Clearly this is open for discussion, but the above is my opinion and
the code intentionally reflects that.

Regards,

Leif

> Mike
> 
> > -Original Message-
> > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > Sent: Friday, April 13, 2018 10:42 AM
> > To: edk2-devel@lists.01.org
> > Cc: Kinney, Michael D ;
> > Gao, Liming ; Laszlo Ersek
> > ; udit.ku...@nxp.com
> > Subject: [PATCH] MdePkg: add big-endian MMIO
> > BaseBeIoLib
> > 
> > When performing MMIO to a destination of the opposite
> > endianness to the
> > executing processor, this library provides automatic
> > byte order reversal
> > on inputs and outputs.
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leif Lindholm 
> > ---
> > 
> > Udit, many apologies for this dragging out - back-to-
> > back conferences,
> > holidays, and lots of catching up.
> > 
> > This modified version introduces a single BeIoLib
> > instance, backed by
> > a source-file that could be used also for a
> > hypothetical LeIoLib.
> > There is no LeIoLib.h included though.
> > 
> > While this is arguably overengineered, I do feel
> > reasonably strongly
> > that code should be named for what it does, not for how
> > it is used,
> > and doing it this way lets me follow that rule.
> > 
> > I have not duplicated the .uni file together with the
> > .inf, since
> > this follows what is done in BaseIoLibIntrinsic.
> > 
> >  MdePkg/Include/Library/BeIoLib.h   | 376
> > +++
> >  MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf   |  48
> > +++
> >  MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni |  23
> > ++
> >  MdePkg/Library/BaseIoLibSwap/IoLibSwap.c   | 477
> > +
> >  MdePkg/MdePkg.dec  |   3 +
> >  5 files changed, 927 insertions(+)
> >  create mode 100644 MdePkg/Include/Library/BeIoLib.h
> >  create mode 100644
> > MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf
> >  create mode 100644
> > MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni
> >  create mode 100644
> > MdePkg/Library/BaseIoLibSwap/IoLibSwap.c
> > 
> > diff --git a/MdePkg/Include/Library/BeIoLib.h
> > b/MdePkg/Include/Library/BeIoLib.h
> > new file mode 100644
> > index 00..5b2dc1a8e1
> > --- /dev/null
> > +++ b/MdePkg/Include/Library/BeIoLib.h
> > @@ -0,0 +1,376 @@
> > +/** @file
> > +  Provide byte-swapping services to access MMIO
> > registers.
> > +
> > +Copyright (c) 2006 - 2012, Intel Corporation. All
> > rights reserved.
> > +Copyright (c) 2017, AMD Incorporated. 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.
> > +
> > +**/
> > +
> > +#ifndef __BE_IO_LIB_H__
> > +#define __BE_IO_LIB_H__
> > +
> > +/**
> > +  Reads a 16-bit MMIO register of opposite endianness.
> > +
> > +  Reads the 16-bit MMIO register specified by Address.
> > +  The 16-bit read value is returned in reversed byte
> > order.
> > +  This function must guarantee that all MMIO read and
> > write
> > +  operations are serialized.
> > +
> > +  @param  Address The MMIO register to read.
> > +
> > +  @return The value read.
> > +
> > +**/
> > +UINT16
> > +EFIAPI
> > +BeMmioRead16 (
> > +  IN  UINTN Address
> > +  );
> > +
> > +/**
> > +  Writes a 16-bit MMIO register of opposite
> > endianness.
> > +
> > +  Writes the 16-bit MMIO register specified by Address
> > with the byte-reversed
> > +  version of the value specified by Value and returns
> > the original Value.
> > +  This function must guarantee that all MMIO read and
> > write
> > +  operations are serialized.
> > +
> > +  @param  Address The MMIO register to write.
> > +  @param  Value   The value to write to the MMIO
> > register.
> > +
> > +  @return Value.
> > +
> > +**/
> > +UINT16
> > +EFIAPI
> > +BeMmioWrite16 (
> > +  IN  UINTN   

[edk2] [PATCH v1] BaseTools: delete an unused file

2018-04-13 Thread Jaben
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/CommonDataClass/ModuleClass.py | 485 

 BaseTools/Source/Python/Makefile   |   1 -
 2 files changed, 486 deletions(-)

diff --git a/BaseTools/Source/Python/CommonDataClass/ModuleClass.py 
b/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
deleted file mode 100644
index c5ea15af5b97..
--- a/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
+++ /dev/null
@@ -1,485 +0,0 @@
-## @file
-# This file is used to define a class object to describe a module
-#
-# Copyright (c) 2007 - 2010, 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.
-
-##
-# Import Modules
-#
-from CommonClass import *
-
-## ModuleHeaderClass
-#
-# This class defined header items used in Module file
-# 
-# @param IdentificationClass:Inherited from IdentificationClass class
-# @param CommonHeaderClass:  Inherited from CommonHeaderClass class
-# @param DefineClass:Inherited from DefineClass class
-#
-# @var ModuleType:   To store value for ModuleType
-# @var SupArchList:  To store value for SupArchList, selection 
scope is in below list
-#EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64
-# @var BinaryModule: To store value for BinaryModule
-# @var OutputFileBasename:   To store value for OutputFileBasename
-# @var ClonedFrom:   To store value for ClonedFrom, it is a set 
structure as
-#[ ClonedRecordClass, ... ]
-# @var PcdIsDriver:  To store value for PcdIsDriver, selection 
scope is in below list
-#PEI_PCD_DRIVER | DXE_PCD_DRIVER
-# @var TianoEdkFlashMap_h:   To store value for TianoEdkFlashMap_h
-# @var InfVersion:   To store value for InfVersion
-# @var UefiSpecificationVersion: To store value for UefiSpecificationVersion
-# @var EdkReleaseVersion:To store value for EdkReleaseVersion
-# @var LibraryClass: To store value for LibraryClass, it is a set 
structure as
-#[ LibraryClassClass, ...]
-# @var ComponentType:To store value for ComponentType, selection 
scope is in below list
-#LIBRARY | SECURITY_CORE | PEI_CORE | 
COMBINED_PEIM_DRIVER | PIC_PEIM | RELOCATABLE_PEIM | BS_DRIVER | RT_DRIVER | 
SAL_RT_DRIVER | APPLICATION
-# @var MakefileName: To store value for MakefileName
-# @var BuildNumber:  To store value for BuildNumber
-# @var BuildType:To store value for BuildType
-# @var FfsExt:   To store value for FfsExt
-# @var FvExt:To store value for FvExt
-# @var SourceFv: To store value for SourceFv
-# @var CustomMakefile:   To store value for CustomMakefile, it is a 
set structure as
-#{ Family : Filename, ... }
-# @var Shadow:   To store value for Shadow
-# @var MacroDefines  To store the defined macros
-#
-class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
-def __init__(self):
-IdentificationClass.__init__(self)
-CommonHeaderClass.__init__(self)
-DefineClass.__init__(self)
-self.ModuleType = ''
-self.SupModuleList = []
-self.SupArchList = []
-self.BinaryModule = False
-self.OutputFileBasename = ''
-self.ClonedFrom = []
-self.PcdIsDriver = ''
-self.TianoEdkFlashMap_h = False
-self.InfVersion = ''
-self.PiSpecificationVersion = ''
-self.UefiSpecificationVersion = ''
-self.EdkReleaseVersion = ''
-self.LibraryClass = []
-self.ComponentType = ''
-self.MakefileName = ''
-self.BuildNumber = ''
-self.BuildType = ''
-self.FfsExt = ''
-self.FvExt = ''
-self.SourceFv = ''
-self.CustomMakefile = {}
-self.Shadow = ''
-self.MacroDefines = {}
-self.SourceOverridePath = ''
-self.Specification = []
-
-## ModuleSourceFileClass
-#
-# This class defined source file item used in Module file
-# 
-# @param CommonClass:  Inherited from CommonClass class
-# @param SourceFile:   Input value for SourceFile, default is ''
-# @param TagName:  Input value for TagName, default 

Re: [edk2] [PATCH v2 1/2] CryptoPkg/OpensslLib: Fix the documentation about submodule update

2018-04-13 Thread Laszlo Ersek
On 04/12/18 12:03, Long, Qin wrote:
> 
> Ah, "it's wrong here" means "the existence of "--remote" in original 
> suggested command is wrong". 
> "It's important" looks also make sense to address the "update" goal.  I can 
> update that, if old message will cause confusion.

With the commit message clarified:

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Thursday, April 12, 2018 5:56 PM
> To: Long, Qin ; Ye, Ting 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [PATCH v2 1/2] CryptoPkg/OpensslLib: Fix the documentation about 
> submodule update
> 
> Hello Qin,
> 
> On 04/12/18 05:08, Long Qin wrote:
>> This patch is to drop "--remote" option from the original suggested 
>> submodule update command ("$ git submodule update --recursive
>> --remote") in HOWTO document.
>>
>> "--remote" option will integrate changes from the upstream subproject 
>> with the submodules's "current HEAD", instead of using the edk2 
>> superproject's "recorded SHA-1". It is wrong here for the edk2
> 
> The commit message makes sense, and the patch is good, but I think there's a 
> significant typo in the commit message.
> 
> Namely, the word "wrong" is wrong :) Instead, it should be "important".
> 
> Or else, "it is the goal for the edk2 consumes to ...".
> 
> Do you agree?
> 
> (I'll come to the second patch sometime later.)
> 
> Thanks!
> Laszlo
> 
>> consumers to updating the working tree of the submodules to match the 
>> commit / release tag that the superproject expects.
>>
>> Removing "--remote" option to fix the documentation issue here.
>>
>> Cc: Laszlo Ersek 
>> Cc: Ye Ting 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Long Qin 
>> ---
>>  CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt 
>> b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
>> index ac63d4c077..36f8e711dd 100644
>> --- a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
>> +++ b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
>> @@ -40,7 +40,7 @@ or
>>And use the following combined commands to pull the remote 
>> submodule updates  (e.g. Updating the new supported OpenSSL release tag):
>>   $ git pull --recurse-submodules && \
>> -   git submodule update --recursive --remote
>> +   git submodule update --recursive
>>  
>>  
>> =
>>About process_files.pl
>>
> 
> ___
> 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 2/2] CryptoPkg/OpensslLib: Update OpenSSL version to 1.1.0h

2018-04-13 Thread Laszlo Ersek
On 04/12/18 05:08, Long Qin wrote:
> (https://bugzilla.tianocore.org/show_bug.cgi?id=927)
> 
> (V2 Update:
> Removing the wrong "--remote" option from git submodule update
> command in this commit message. Thanks Leszlo's clarification
> to correct this)

(1) "Laszlo", not "Leszlo" :)

> 
> Update OpenSSL version to 1.1.0h release (27-Mar-2018) to include the
> fix for CVE-2018-0739 issue (Handling of crafted recursive ASN.1
> structures can cause a stack overflow and resulting denial of service,
> Refer to https://www.openssl.org/news/secadv/20180327.txt for more
> information).
> 
> Please note "git pull" will not update the submodule repository.
> use the following commend to make your existing submodule track this
> update:
>$ git submodule update -–recursive

(2) OK, so this is a tricky one. The "--recursive" option starts with
two hyphen characters (ASCII 0x2D). However, the string above starts
with a hyphen (ASCII 0x2D) and then a unicode EN DASH codepoint
(U+2013). Please replace it with a normal hyphen.

More below:

> 
> Cc: Laszlo Ersek 
> Cc: Ye Ting 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Long Qin 
> ---
>  CryptoPkg/Library/OpensslLib/openssl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Library/OpensslLib/openssl 
> b/CryptoPkg/Library/OpensslLib/openssl
> index b2758a2292..d4e4bd2a81 16
> --- a/CryptoPkg/Library/OpensslLib/openssl
> +++ b/CryptoPkg/Library/OpensslLib/openssl
> @@ -1 +1 @@
> -Subproject commit b2758a2292aceda93e9f44c219b94fe21bb9a650
> +Subproject commit d4e4bd2a8163f355fa8a3884077eaec7adc75ff7
> 

With the commit msg updates:

Reviewed-by: Laszlo Ersek 

I also tested this patch, with an off-disk Secure Boot, and an HTTPS
boot. Both worked fine.

Tested-by: Laszlo Ersek 

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


[edk2] [PATCH v1 7/9] BaseTools: FdfParser refactor to remove a dictionary

2018-04-13 Thread Jaben Carsey
From: Jaben 

__GetInfStatement() does not use the dict parameter, so remove it
from the API and from all callers.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 0427b80b2460..662c232c86e4 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2158,7 +2158,7 @@ class FdfParser:
 self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())
 
 while True:
-isInf = self.__GetInfStatement(FvObj, MacroDict = 
FvObj.DefineVarDict.copy())
+isInf = self.__GetInfStatement(FvObj)
 isFile = self.__GetFileStatement(FvObj, MacroDict = 
FvObj.DefineVarDict.copy())
 if not isInf and not isFile:
 break
@@ -2423,7 +2423,7 @@ class FdfParser:
 MacroDict.update(AprSectionObj.DefineVarDict)
 
 while True:
-IsInf = self.__GetInfStatement( AprSectionObj, MacroDict = 
MacroDict)
+IsInf = self.__GetInfStatement(AprSectionObj)
 IsFile = self.__GetFileStatement( AprSectionObj)
 if not IsInf and not IsFile:
 break
@@ -2486,11 +2486,10 @@ class FdfParser:
 #
 #   @param  selfThe object pointer
 #   @param  Obj for whom inf statement is got
-#   @param  MacroDict   dictionary used to replace macro
 #   @retval TrueSuccessfully find inf statement
 #   @retval False   Not able to find inf statement
 #
-def __GetInfStatement(self, Obj, ForCapsule=False, MacroDict={}):
+def __GetInfStatement(self, Obj, ForCapsule=False):
 ffsInf = self.__ParseInfStatement()
 if not ffsInf:
 return False
@@ -2926,7 +2925,7 @@ class FdfParser:
 self.__GetAprioriSection(FvObj, MacroDict.copy())
 
 while True:
-IsInf = self.__GetInfStatement(FvObj, MacroDict.copy())
+IsInf = self.__GetInfStatement(FvObj)
 IsFile = self.__GetFileStatement(FvObj, MacroDict.copy())
 if not IsInf and not IsFile:
 break
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 5/9] BaseTools: use dictionary.get() when we have value if not found

2018-04-13 Thread Jaben Carsey
From: Jaben 

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/build/build.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 6fb2e0ed3d09..ede963bc231a 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1604,9 +1604,7 @@ class Build():
 SmmModuleList[Module.MetaFile] = ImageInfo
 SmmSize += ImageInfo.Image.Size
 if Module.ModuleType == 'DXE_SMM_DRIVER':
-PiSpecVersion = '0x'
-if 'PI_SPECIFICATION_VERSION' in 
Module.Module.Specification:
-PiSpecVersion = 
Module.Module.Specification['PI_SPECIFICATION_VERSION']
+PiSpecVersion = 
Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x')
 # for PI specification < PI1.1, DXE_SMM_DRIVER 
also runs as BOOT time driver.
 if int(PiSpecVersion, 16) < 0x0001000A:
 BtModuleList[Module.MetaFile] = ImageInfo
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 6/9] BaseTools: refactor DepexSection.GenSection

2018-04-13 Thread Jaben Carsey
From: Jaben 

change default parameter value to None since the parameter isn't used.
remove temporary dictionary and just do the reaplce call.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/DepexSection.py | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py 
b/BaseTools/Source/Python/GenFds/DepexSection.py
index ef30a2f083c6..4ed1aa779292 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -1,7 +1,7 @@
 ## @file
 # process depex section generation
 #
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 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
@@ -76,12 +76,10 @@ class DepexSection (DepexSectionClassObject):
 #   @param  Dictdictionary contains macro and its value
 #   @retval tuple   (Generated file name list, section alignment)
 #
-def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, 
FfsFile = None, Dict = {}, IsMakefile = False):
-
+def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, 
FfsFile = None, Dict = None, IsMakefile = False):
 if self.ExpressionProcessed == False:
 self.Expression = self.Expression.replace("\n", " ").replace("\r", 
" ")
 ExpList = self.Expression.split()
-ExpGuidDict = {}
 
 for Exp in ExpList:
 if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 
'SOR', 'BEFORE', 'AFTER', 'END'):
@@ -90,10 +88,7 @@ class DepexSection (DepexSectionClassObject):
 EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,
 "Depex GUID %s could not be found in 
build DB! (ModuleName: %s)" % (Exp, ModuleName))
 
-ExpGuidDict[Exp] = GuidStr
-
-for Item in ExpGuidDict:
-self.Expression = self.Expression.replace(Item, 
ExpGuidDict[Item])
+self.Expression = self.Expression.replace(Exp, GuidStr)
 
 self.Expression = self.Expression.strip()
 self.ExpressionProcessed = True
@@ -120,5 +115,4 @@ class DepexSection (DepexSectionClassObject):
 OutputFile = os.path.normpath(OutputFile)
 
 GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], 
Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)
-FileList = [OutputFile]
-return FileList, self.Alignment
+return [OutputFile], self.Alignment
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 3/9] BaseTools: Remove unused functions from DscBuildData

2018-04-13 Thread Jaben Carsey
From: Jaben 

3 functions were never called:
_dumpPcdInfo
__STRING2OCTList
__UNICODE2OCTList

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 31 
 1 file changed, 31 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 6177a964a1ad..ea001eef0281 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1145,17 +1145,6 @@ class DscBuildData(PlatformBuildClassObject):
 self.RecoverCommandLinePcd()
 return self._Pcds
 
-def _dumpPcdInfo(self,Pcds):
-for pcd in Pcds:
-pcdobj = Pcds[pcd]
-if not pcdobj.TokenCName.startswith("Test"):
-continue
-for skuid in pcdobj.SkuInfoList:
-if pcdobj.Type in 
(self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]):
-for storename in 
pcdobj.SkuInfoList[skuid].DefaultStoreDict:
-print "PcdCName: %s, SkuName: %s, StoreName: %s, 
Value: %s" % (".".join((pcdobj.TokenSpaceGuidCName, pcdobj.TokenCName)), 
skuid,storename,str(pcdobj.SkuInfoList[skuid].DefaultStoreDict[storename]))
-else:
-print "PcdCName: %s, SkuName: %s, Value: %s" % 
(".".join((pcdobj.TokenSpaceGuidCName, pcdobj.TokenCName)), 
skuid,str(pcdobj.SkuInfoList[skuid].DefaultValue))
 ## Retrieve [BuildOptions]
 def _GetBuildOptions(self):
 if self._BuildOptions is None:
@@ -1514,26 +1503,6 @@ class DscBuildData(PlatformBuildClassObject):
 
 return Pcds
 
-def __UNICODE2OCTList(self,Value):
-Value = Value.strip()
-Value = Value[2:-1]
-List = []
-for Item in Value:
-Temp = '%04X' % ord(Item)
-List.append('0x' + Temp[2:4])
-List.append('0x' + Temp[0:2])
-List.append('0x00')
-List.append('0x00')
-return List
-def __STRING2OCTList(self,Value):
-OCTList = []
-Value = Value.strip('"')
-for char in Value:
-Temp = '%02X' % ord(char)
-OCTList.append('0x' + Temp)
-OCTList.append('0x00')
-return OCTList
-
 def GetStructurePcdMaxSize(self, str_pcd):
 pcd_default_value = str_pcd.DefaultValue
 sku_values = [skuobj.HiiDefaultValue if str_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]] else skuobj.DefaultValue for 
skuobj in str_pcd.SkuInfoList.values()]
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1] BaseTools: remove an unused file

2018-04-13 Thread Jaben
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/CommonDataClass/PackageClass.py | 127 

 BaseTools/Source/Python/Makefile|   1 -
 2 files changed, 128 deletions(-)

diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py 
b/BaseTools/Source/Python/CommonDataClass/PackageClass.py
deleted file mode 100644
index ba7d7eb67911..
--- a/BaseTools/Source/Python/CommonDataClass/PackageClass.py
+++ /dev/null
@@ -1,127 +0,0 @@
-## @file
-# This file is used to define a class object to describe a package
-#
-# Copyright (c) 2007, 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.
-
-##
-# Import Modules
-#
-from CommonClass import *
-from collections import OrderedDict
-
-## PackageHeaderClass
-#
-# This class defined header items used in Package file
-# 
-# @param IdentificationClass:  Inherited from IdentificationClass class
-# @param CommonHeaderClass:Inherited from CommonHeaderClass class
-#
-# @var DecSpecification:   To store value for DecSpecification
-# @var ReadOnly:   To store value for ReadOnly
-# @var RePackage:  To store value for RePackage
-# @var ClonedFrom: To store value for ClonedFrom, it is a set 
structure as
-#  [ ClonedRecordClass, ...]
-#
-class PackageHeaderClass(IdentificationClass, CommonHeaderClass):
-def __init__(self):
-IdentificationClass.__init__(self)
-CommonHeaderClass.__init__(self)
-self.DecSpecification = ''
-self.ReadOnly = False
-self.RePackage = False
-self.PackagePath = ''
-self.ClonedFrom = []
-
-## PackageIndustryStdHeaderClass
-#
-# This class defined industry std header items used in Package file
-# 
-# @param CommonHeaderClass:  Inherited from CommonHeaderClass class
-#
-# @var Name: To store value for Name
-# @var IncludeHeader:To store value for IncludeHeader
-#
-class PackageIndustryStdHeaderClass(CommonClass):
-def __init__(self):
-self.Name = ''
-self.IncludeHeader = ''
-CommonClass.__init__(self)
-
-## PackageIncludePkgHeaderClass
-#
-# This class defined include Pkg header items used in Package file
-# 
-# @param object:   Inherited from object class
-#
-# @var IncludeHeader:  To store value for IncludeHeader
-# @var ModuleType: To store value for ModuleType, it is a set structure as
-#  BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | 
DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | 
UEFI_APPLICATION | USER_DEFINED | SMM_CORE | MM_STANDALONE | MM_CORE_STANDALONE
-#
-class PackageIncludePkgHeaderClass(object):
-def __init__(self):
-self.IncludeHeader = ''
-self.ModuleType = []
-
-## PackageClass
-#
-# This class defined a complete package item
-# 
-# @param object:  Inherited from object class
-#
-# @var Header:To store value for Header, it is a structure 
as
-# {Arch : PackageHeaderClass}
-# @var Includes:  To store value for Includes, it is a list 
structure as
-# [ IncludeClass, ...]
-# @var LibraryClassDeclarations:  To store value for LibraryClassDeclarations, 
it is a list structure as
-# [ LibraryClassClass, ...]
-# @var IndustryStdHeaders:To store value for IndustryStdHeaders, it is 
a list structure as
-# [ PackageIndustryStdHeader, ...]
-# @var ModuleFiles:   To store value for ModuleFiles, it is a list 
structure as
-# [ '', '', ...] 
-# @var PackageIncludePkgHeaders:  To store value for PackageIncludePkgHeaders, 
it is a list structure as
-# [ PackageIncludePkgHeader, ...]
-# @var GuidDeclarations:  To store value for GuidDeclarations, it is a 
list structure as
-# [ GuidClass, ...]
-# @var ProtocolDeclarations:  To store value for ProtocolDeclarations, it 
is a list structure as
-# [ ProtocolClass, ...]
-# @var PpiDeclarations:   To store value for PpiDeclarations, it is a 
list structure as
-# [ PpiClass, ...]
-# @var PcdDeclarations:   To store value for 

Re: [edk2] [PATCH] MdePkg: add big-endian MMIO BaseBeIoLib

2018-04-13 Thread Kinney, Michael D
Hi Leif,

I think we need to look at the names.  I see a mix of
"Be" and "Swap".  We should pick one and use it 
consistently.

Mike

> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Friday, April 13, 2018 10:42 AM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D ;
> Gao, Liming ; Laszlo Ersek
> ; udit.ku...@nxp.com
> Subject: [PATCH] MdePkg: add big-endian MMIO
> BaseBeIoLib
> 
> When performing MMIO to a destination of the opposite
> endianness to the
> executing processor, this library provides automatic
> byte order reversal
> on inputs and outputs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Leif Lindholm 
> ---
> 
> Udit, many apologies for this dragging out - back-to-
> back conferences,
> holidays, and lots of catching up.
> 
> This modified version introduces a single BeIoLib
> instance, backed by
> a source-file that could be used also for a
> hypothetical LeIoLib.
> There is no LeIoLib.h included though.
> 
> While this is arguably overengineered, I do feel
> reasonably strongly
> that code should be named for what it does, not for how
> it is used,
> and doing it this way lets me follow that rule.
> 
> I have not duplicated the .uni file together with the
> .inf, since
> this follows what is done in BaseIoLibIntrinsic.
> 
>  MdePkg/Include/Library/BeIoLib.h   | 376
> +++
>  MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf   |  48
> +++
>  MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni |  23
> ++
>  MdePkg/Library/BaseIoLibSwap/IoLibSwap.c   | 477
> +
>  MdePkg/MdePkg.dec  |   3 +
>  5 files changed, 927 insertions(+)
>  create mode 100644 MdePkg/Include/Library/BeIoLib.h
>  create mode 100644
> MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf
>  create mode 100644
> MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni
>  create mode 100644
> MdePkg/Library/BaseIoLibSwap/IoLibSwap.c
> 
> diff --git a/MdePkg/Include/Library/BeIoLib.h
> b/MdePkg/Include/Library/BeIoLib.h
> new file mode 100644
> index 00..5b2dc1a8e1
> --- /dev/null
> +++ b/MdePkg/Include/Library/BeIoLib.h
> @@ -0,0 +1,376 @@
> +/** @file
> +  Provide byte-swapping services to access MMIO
> registers.
> +
> +Copyright (c) 2006 - 2012, Intel Corporation. All
> rights reserved.
> +Copyright (c) 2017, AMD Incorporated. 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.
> +
> +**/
> +
> +#ifndef __BE_IO_LIB_H__
> +#define __BE_IO_LIB_H__
> +
> +/**
> +  Reads a 16-bit MMIO register of opposite endianness.
> +
> +  Reads the 16-bit MMIO register specified by Address.
> +  The 16-bit read value is returned in reversed byte
> order.
> +  This function must guarantee that all MMIO read and
> write
> +  operations are serialized.
> +
> +  @param  Address The MMIO register to read.
> +
> +  @return The value read.
> +
> +**/
> +UINT16
> +EFIAPI
> +BeMmioRead16 (
> +  IN  UINTN Address
> +  );
> +
> +/**
> +  Writes a 16-bit MMIO register of opposite
> endianness.
> +
> +  Writes the 16-bit MMIO register specified by Address
> with the byte-reversed
> +  version of the value specified by Value and returns
> the original Value.
> +  This function must guarantee that all MMIO read and
> write
> +  operations are serialized.
> +
> +  @param  Address The MMIO register to write.
> +  @param  Value   The value to write to the MMIO
> register.
> +
> +  @return Value.
> +
> +**/
> +UINT16
> +EFIAPI
> +BeMmioWrite16 (
> +  IN  UINTN Address,
> +  IN  UINT16Value
> +  );
> +
> +/**
> +  Reads a 16-bit MMIO register of opposite endianness,
> performs a bitwise OR,
> +  and writes the result back to the 16-bit MMIO
> register.
> +
> +  Reads the 16-bit MMIO register specified by Address,
> byte-reverses the read
> +  result, performs a bitwise OR between the read
> result and the value specified
> +  by OrData, byte-reverses the result, and writes the
> result to the 16-bit MMIO
> +  register specified by Address. The pre-reversal
> value written to the MMIO
> +  register is returned.
> +  This function must guarantee that all MMIO read and
> write
> +  operations are serialized.
> +
> +  @param  Address The MMIO register to write.
> +  @param  OrData  The value to OR with the read value
> from the MMIO register.
> +
> +  @return The value written back to the MMIO 

[edk2] [PATCH] MdePkg: add big-endian MMIO BaseBeIoLib

2018-04-13 Thread Leif Lindholm
When performing MMIO to a destination of the opposite endianness to the
executing processor, this library provides automatic byte order reversal
on inputs and outputs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm 
---

Udit, many apologies for this dragging out - back-to-back conferences,
holidays, and lots of catching up.

This modified version introduces a single BeIoLib instance, backed by
a source-file that could be used also for a hypothetical LeIoLib.
There is no LeIoLib.h included though.

While this is arguably overengineered, I do feel reasonably strongly
that code should be named for what it does, not for how it is used,
and doing it this way lets me follow that rule.

I have not duplicated the .uni file together with the .inf, since
this follows what is done in BaseIoLibIntrinsic.

 MdePkg/Include/Library/BeIoLib.h   | 376 +++
 MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf   |  48 +++
 MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni |  23 ++
 MdePkg/Library/BaseIoLibSwap/IoLibSwap.c   | 477 +
 MdePkg/MdePkg.dec  |   3 +
 5 files changed, 927 insertions(+)
 create mode 100644 MdePkg/Include/Library/BeIoLib.h
 create mode 100644 MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf
 create mode 100644 MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni
 create mode 100644 MdePkg/Library/BaseIoLibSwap/IoLibSwap.c

diff --git a/MdePkg/Include/Library/BeIoLib.h b/MdePkg/Include/Library/BeIoLib.h
new file mode 100644
index 00..5b2dc1a8e1
--- /dev/null
+++ b/MdePkg/Include/Library/BeIoLib.h
@@ -0,0 +1,376 @@
+/** @file
+  Provide byte-swapping services to access MMIO registers.
+
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Incorporated. 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.
+
+**/
+
+#ifndef __BE_IO_LIB_H__
+#define __BE_IO_LIB_H__
+
+/**
+  Reads a 16-bit MMIO register of opposite endianness.
+
+  Reads the 16-bit MMIO register specified by Address.
+  The 16-bit read value is returned in reversed byte order.
+  This function must guarantee that all MMIO read and write
+  operations are serialized.
+
+  @param  Address The MMIO register to read.
+
+  @return The value read.
+
+**/
+UINT16
+EFIAPI
+BeMmioRead16 (
+  IN  UINTN Address
+  );
+
+/**
+  Writes a 16-bit MMIO register of opposite endianness.
+
+  Writes the 16-bit MMIO register specified by Address with the byte-reversed
+  version of the value specified by Value and returns the original Value.
+  This function must guarantee that all MMIO read and write
+  operations are serialized.
+
+  @param  Address The MMIO register to write.
+  @param  Value   The value to write to the MMIO register.
+
+  @return Value.
+
+**/
+UINT16
+EFIAPI
+BeMmioWrite16 (
+  IN  UINTN Address,
+  IN  UINT16Value
+  );
+
+/**
+  Reads a 16-bit MMIO register of opposite endianness, performs a bitwise OR,
+  and writes the result back to the 16-bit MMIO register.
+
+  Reads the 16-bit MMIO register specified by Address, byte-reverses the read
+  result, performs a bitwise OR between the read result and the value specified
+  by OrData, byte-reverses the result, and writes the result to the 16-bit MMIO
+  register specified by Address. The pre-reversal value written to the MMIO
+  register is returned.
+  This function must guarantee that all MMIO read and write
+  operations are serialized.
+
+  @param  Address The MMIO register to write.
+  @param  OrData  The value to OR with the read value from the MMIO register.
+
+  @return The value written back to the MMIO register.
+
+**/
+UINT16
+EFIAPI
+BeMmioOr16 (
+  IN  UINTN Address,
+  IN  UINT16OrData
+  );
+
+/**
+  Reads a 16-bit MMIO register of opposite endianness, performs a bitwise AND,
+  and writes the result back to the 16-bit MMIO register.
+
+  Reads the 16-bit MMIO register specified by Address, byte-reverses the read
+  result, performs a bitwise AND between the read result and the value 
specified
+  by AndData, byte-reverses the result, and writes the result to the 16-bit 
MMIO
+  register specified by Address. The pre-reversal value written to the MMIO
+  register is returned.
+  This function must guarantee that all MMIO read and write
+  operations are serialized.
+
+  @param  Address The MMIO register to write.
+  @param  AndData The value to AND 

[edk2] [PATCH] Maintainers.txt: add Laszlo Ersek to stewards

2018-04-13 Thread Leif Lindholm
Cc: Andrew Fish 
Cc: Laszlo Ersek 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm 
---
 Maintainers.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 256133810f..7295cd6b83 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -41,6 +41,7 @@ T: svn (read-only, deprecated) - 
https://svn.code.sf.net/p/edk2/code/trunk/edk2
 Tianocore Stewards
 --
 M: Andrew Fish 
+M: Laszlo Ersek 
 M: Leif Lindholm 
 M: Michael D Kinney 
 
-- 
2.11.0

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


Re: [edk2] [PATCH] MdePkg: add big-endian MMIO BaseBeIoLib

2018-04-13 Thread Kinney, Michael D
Leif,

I am curious why a Swap class/instances is not sufficient.

Currently EDK II follows the UEFI/PI specs, which for
all supported CPU architectures use little endian ABI.
The BaseIoLib follows the endianness of the CPU.  If
UEFI/PI added a CPU that was big endian, I would expect
BaseIoLib when built for that CPU would perform big endian
operations.

Am I missing something?

Mike


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Leif Lindholm
> Sent: Friday, April 13, 2018 12:32 PM
> To: Kinney, Michael D 
> Cc: edk2-devel@lists.01.org; Laszlo Ersek
> ; Gao, Liming 
> Subject: Re: [edk2] [PATCH] MdePkg: add big-endian MMIO
> BaseBeIoLib
> 
> On Fri, Apr 13, 2018 at 07:24:06PM +, Kinney,
> Michael D wrote:
> > Hi Leif,
> >
> > I think we need to look at the names.  I see a mix of
> > "Be" and "Swap".  We should pick one and use it
> > consistently.
> 
> This was what I meant by the comments:
> ---
> This modified version introduces a single BeIoLib
> instance, backed by
> a source-file that could be used also for a
> hypothetical LeIoLib.
> There is no LeIoLib.h included though.
> 
> While this is arguably overengineered, I do feel
> reasonably strongly
> that code should be named for what it does, not for how
> it is used,
> and doing it this way lets me follow that rule.
> ---
> 
> Clearly this is open for discussion, but the above is
> my opinion and
> the code intentionally reflects that.
> 
> Regards,
> 
> Leif
> 
> > Mike
> >
> > > -Original Message-
> > > From: Leif Lindholm
> [mailto:leif.lindh...@linaro.org]
> > > Sent: Friday, April 13, 2018 10:42 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Kinney, Michael D ;
> > > Gao, Liming ; Laszlo Ersek
> > > ; udit.ku...@nxp.com
> > > Subject: [PATCH] MdePkg: add big-endian MMIO
> > > BaseBeIoLib
> > >
> > > When performing MMIO to a destination of the
> opposite
> > > endianness to the
> > > executing processor, this library provides
> automatic
> > > byte order reversal
> > > on inputs and outputs.
> > >
> > > Contributed-under: TianoCore Contribution Agreement
> 1.1
> > > Signed-off-by: Leif Lindholm
> 
> > > ---
> > >
> > > Udit, many apologies for this dragging out - back-
> to-
> > > back conferences,
> > > holidays, and lots of catching up.
> > >
> > > This modified version introduces a single BeIoLib
> > > instance, backed by
> > > a source-file that could be used also for a
> > > hypothetical LeIoLib.
> > > There is no LeIoLib.h included though.
> > >
> > > While this is arguably overengineered, I do feel
> > > reasonably strongly
> > > that code should be named for what it does, not for
> how
> > > it is used,
> > > and doing it this way lets me follow that rule.
> > >
> > > I have not duplicated the .uni file together with
> the
> > > .inf, since
> > > this follows what is done in BaseIoLibIntrinsic.
> > >
> > >  MdePkg/Include/Library/BeIoLib.h   |
> 376
> > > +++
> > >  MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf   |
> 48
> > > +++
> > >  MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni |
> 23
> > > ++
> > >  MdePkg/Library/BaseIoLibSwap/IoLibSwap.c   |
> 477
> > > +
> > >  MdePkg/MdePkg.dec  |
> 3 +
> > >  5 files changed, 927 insertions(+)
> > >  create mode 100644
> MdePkg/Include/Library/BeIoLib.h
> > >  create mode 100644
> > > MdePkg/Library/BaseIoLibSwap/BaseBeIoLib.inf
> > >  create mode 100644
> > > MdePkg/Library/BaseIoLibSwap/BaseIoLibSwap.uni
> > >  create mode 100644
> > > MdePkg/Library/BaseIoLibSwap/IoLibSwap.c
> > >
> > > diff --git a/MdePkg/Include/Library/BeIoLib.h
> > > b/MdePkg/Include/Library/BeIoLib.h
> > > new file mode 100644
> > > index 00..5b2dc1a8e1
> > > --- /dev/null
> > > +++ b/MdePkg/Include/Library/BeIoLib.h
> > > @@ -0,0 +1,376 @@
> > > +/** @file
> > > +  Provide byte-swapping services to access MMIO
> > > registers.
> > > +
> > > +Copyright (c) 2006 - 2012, Intel Corporation. All
> > > rights reserved.
> > > +Copyright (c) 2017, AMD Incorporated. 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.
> > > +
> > > +**/
> > > +
> > > +#ifndef __BE_IO_LIB_H__
> > > +#define __BE_IO_LIB_H__
> > > +
> > > +/**
> > > +  Reads a 16-bit MMIO register of opposite
> 

[edk2] [PATCH] ArmPkg/ArmMmuLib ARM: fix Mva to use idx instead of table base

2018-04-13 Thread Chris Co
Mva address calculation should use the left-shifted current
section index instead of the left-shifted table base address.

Using the table base address here has the side-effect of potentially
causing an access violation depending on the base address value.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Christopher Co 
---
 ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c 
b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
index 774a7ccf59..9bf4ba03fd 100644
--- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
@@ -716,7 +716,7 @@ UpdateSectionEntries (
   Descriptor |= EntryValue;
 
   if (CurrentDescriptor  != Descriptor) {
-Mva = (VOID *)(UINTN)(((UINTN)FirstLevelTable) << 
TT_DESCRIPTOR_SECTION_BASE_SHIFT);
+Mva = (VOID *)(UINTN)(((UINTN)FirstLevelIdx + i) << 
TT_DESCRIPTOR_SECTION_BASE_SHIFT);
 
 // Clean/invalidate the cache for this section, but only
 // if we are modifying the memory type attributes
-- 
2.15.1.gvfs.2.39.g03d366a

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


Re: [edk2] [PATCH edk2-platforms 00/12] Hisilicon/D0x: Switch to generic PciHostBridge

2018-04-13 Thread Ard Biesheuvel
On 13 April 2018 at 04:05, Guo Heyi  wrote:
> Hi Ard,
>
> Any comments?
>

Apologies for the delay. I have been travelling and am behind on email.

> Anyway we can modify the code if you insist on using an intermediate CPU IO
> address space.
>

I have not made up my mind yet, to be honest. I agree there is a
certain elegance to merging both translations, but I am concerned that
existing EDK2 code may deal poorly with I/O addresses that require
more than 32 bits to express.

Did you try the mm command in the shell for instance? As you know, I
recently removed an artificial address range limit there, but I wonder
if it uses 64-bit variables for I/O ports.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/Terminal: Check status of OpenProtocol in BindingStart

2018-04-13 Thread Laszlo Ersek
Hi Star,

On 04/13/18 07:15, Zeng, Star wrote:
> Generally, I am ok with the change.
> But, what is the case for the change?
> If the new "if condition" is TRUE, the ASSERT above it will happen, so the 
> new "if condition" is for RELEASE build case?
> And if the code passes Support() check, then seemingly, the "if condition" in 
> Start() will not happen.
> Could more detailed information in the commit log or code comments?

I believe this patch is for
. It seems to be for
the "input Controller handle is invalid" case.

Comment 0 in that BZ describes the issue, but I agree the commit message
should at least reference the BZ.

Thanks
Laszlo


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu 
> Ni
> Sent: Friday, April 13, 2018 12:14 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star 
> Subject: [edk2] [PATCH] MdeModulePkg/Terminal: Check status of OpenProtocol 
> in BindingStart
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Steven Shi 
> Cc: Star Zeng 
> ---
>  MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c 
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index 60de2d4d6d..66dd3ad550 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> @@ -2,7 +2,7 @@
>Produces Simple Text Input Protocol, Simple Text Input Extended Protocol 
> and
>Simple Text Output Protocol upon Serial IO Protocol.
>  
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> +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 @@ -488,6 +488,9 
> @@ TerminalDriverBindingStart (
>EFI_OPEN_PROTOCOL_BY_DRIVER
>);
>ASSERT ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED));
> +  if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
> +return Status;
> +  }
>  
>//
>// Open the Serial I/O Protocol BY_DRIVER.  It might already be started.
> @@ -501,6 +504,9 @@ TerminalDriverBindingStart (
>EFI_OPEN_PROTOCOL_BY_DRIVER
>);
>ASSERT ((Status == EFI_SUCCESS) || (Status == EFI_ALREADY_STARTED));
> +  if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
> +return Status;
> +  }
>  
>if (!IsHotPlugDevice (ParentDevicePath)) {
>  //
> --
> 2.14.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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] SignedCapsulePkg SystemFirmwareUpdateDxe: Fix failure caused by d69d922

2018-04-13 Thread Star Zeng
d69d9227d046211265de1fab5580c50a65944614 caused system firmware update
failure. It is because FindMatchingFmpHandles() is expected to return
handles matched, but the function returns all handles found.

This patch is to fix the issue.
This patch also assigns mSystemFmpPrivate->Handle for "case 1:" path
in case the Handle is needed by other place in future.

Cc: Michael D Kinney 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c  | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git 
a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c 
b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
index d0b1c9913ca8..fa0c5f03ffdd 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
@@ -602,6 +602,7 @@ FindMatchingFmpHandles (
   )
 {
   EFI_STATUS Status;
+  UINTN  TempHandleCount;
   EFI_HANDLE *HandleBuffer;
   UINTN  Index;
   UINTN  Index2;
@@ -613,20 +614,20 @@ FindMatchingFmpHandles (
   BOOLEANMatchFound;
 
   *HandleCount  = 0;
+  TempHandleCount = 0;
   HandleBuffer = NULL;
   Status = gBS->LocateHandleBuffer (
ByProtocol,
ProtocolGuid,
NULL,
-   HandleCount,
+   ,

);
   if (EFI_ERROR (Status)) {
-*HandleCount  = 0;
 return NULL;
   }
 
-  for (Index = 0; Index < *HandleCount; Index++) {
+  for (Index = 0; Index < TempHandleCount; Index++) {
 OriginalFmpImageInfoBuf = GetFmpImageDescriptors (
 HandleBuffer[Index],
 ProtocolGuid,
@@ -657,12 +658,21 @@ FindMatchingFmpHandles (
   //
   FmpImageInfoBuf = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 
*)FmpImageInfoBuf) + DescriptorSize);
 }
-if (!MatchFound) {
-  HandleBuffer[Index] = NULL;
+if (MatchFound) {
+  HandleBuffer[*HandleCount] = HandleBuffer[Index];
+  (*HandleCount)++;
 }
 
 FreePool (OriginalFmpImageInfoBuf);
   }
+
+  if ((*HandleCount) == 0) {
+//
+// No any matching handle.
+//
+FreePool (HandleBuffer);
+return NULL;
+  }
   return HandleBuffer;
 }
 
@@ -801,6 +811,7 @@ SystemFirmwareUpdateMainDxe (
 // Install System FMP protocol onto handle with matching FMP Protocol
 //
 DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: Install System FMP onto 
matching FMP handle\n"));
+mSystemFmpPrivate->Handle = HandleBuffer[0];
 Status = gBS->InstallMultipleProtocolInterfaces (
 [0],
 ,
-- 
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/Terminal: Check status of OpenProtocol in BindingStart

2018-04-13 Thread Zeng, Star
Thanks Laszlo.

If the commit log is updated to reference the BZ link or even add more detailed 
information.
Reviewed-by: Star Zeng 


Thanks,
Star
-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, April 13, 2018 5:00 PM
To: Zeng, Star ; Ni, Ruiyu ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH] MdeModulePkg/Terminal: Check status of OpenProtocol 
in BindingStart

Hi Star,

On 04/13/18 07:15, Zeng, Star wrote:
> Generally, I am ok with the change.
> But, what is the case for the change?
> If the new "if condition" is TRUE, the ASSERT above it will happen, so the 
> new "if condition" is for RELEASE build case?
> And if the code passes Support() check, then seemingly, the "if condition" in 
> Start() will not happen.
> Could more detailed information in the commit log or code comments?

I believe this patch is for
. It seems to be for the 
"input Controller handle is invalid" case.

Comment 0 in that BZ describes the issue, but I agree the commit message should 
at least reference the BZ.

Thanks
Laszlo


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Ruiyu Ni
> Sent: Friday, April 13, 2018 12:14 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star 
> Subject: [edk2] [PATCH] MdeModulePkg/Terminal: Check status of 
> OpenProtocol in BindingStart
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Steven Shi 
> Cc: Star Zeng 
> ---
>  MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c 
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index 60de2d4d6d..66dd3ad550 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> @@ -2,7 +2,7 @@
>Produces Simple Text Input Protocol, Simple Text Input Extended Protocol 
> and
>Simple Text Output Protocol upon Serial IO Protocol.
>  
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights 
> reserved.
> +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 @@ -488,6 +488,9 
> @@ TerminalDriverBindingStart (
>EFI_OPEN_PROTOCOL_BY_DRIVER
>);
>ASSERT ((Status == EFI_SUCCESS) || (Status == 
> EFI_ALREADY_STARTED));
> +  if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
> +return Status;
> +  }
>  
>//
>// Open the Serial I/O Protocol BY_DRIVER.  It might already be started.
> @@ -501,6 +504,9 @@ TerminalDriverBindingStart (
>EFI_OPEN_PROTOCOL_BY_DRIVER
>);
>ASSERT ((Status == EFI_SUCCESS) || (Status == 
> EFI_ALREADY_STARTED));
> +  if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
> +return Status;
> +  }
>  
>if (!IsHotPlugDevice (ParentDevicePath)) {
>  //
> --
> 2.14.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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/9] {Ovmf, Mde, Network, Crypto}Pkg: fixes+features for setting HTTPS cipher suites

2018-04-13 Thread Laszlo Ersek
On 04/11/18 12:42, Laszlo Ersek wrote:
> Repo:   https://github.com/lersek/edk2.git
> Branch: tls_ciphers_v2
> 
> This is version 2 of the series posted earlier at
> 
>   20180403145149.8925-1-lersek@redhat.com">http://mid.mail-archive.com/20180403145149.8925-1-lersek@redhat.com
>   https://lists.01.org/pipermail/edk2-devel/2018-April/023402.html
> 
> Changes are noted per patch. One important change cannot be highlighted
> that way however, because it involves the dropping of the following two
> patches from v1:
> 
>   [edk2] [PATCH 08/13] CryptoPkg/TlsLib: add the "TlsMappingTable.sh"
>POSIX shell script
> 
>   [edk2] [PATCH 09/13] CryptoPkg/TlsLib: extend "TlsCipherMappingTable"
> 
> I retested HTTPS boot with this series; it succeeded. The TLS cipher
> suite preference list came from the system-wide configuration on my
> RHEL-7 laptop; basically the binary CipherId array from the command
> "openssl ciphers -V". The relevant lines from the OVMF log were:
> 
>> TlsAuthConfigDxe:SetCipherSuites: stored list of cipher suites (190 byte(s))
>> [...]
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC030
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02C
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC028
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC024
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC014
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC00A
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A5
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A3
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A1
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x009F
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x006A
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0038
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0088
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0087
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0086
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0085
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC032
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02E
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02A
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC026
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC00F
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC005
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x009D
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0084
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x008D
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02F
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02B
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC027
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC023
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC013
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC009
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A4
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A2
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x00A0
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x009E
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0040
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0032
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x009A
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0099
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0098
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0097
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0045
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0044
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0043
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0042
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC031
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC02D
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC029
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC025
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC00E
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC004
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x009C
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0096
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0041
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x008C
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC012
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC008
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0013
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0010
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x000D
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC00D
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC003
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0007
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x008B
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0021
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x001F
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0025
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x0023
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC011
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC007
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC00C
>> TlsDxe:TlsSetCipherList: skipping CipherId=0xC002
>> TlsDxe:TlsSetCipherList: skipping CipherId=0x008A
>> TlsDxe:TlsSetCipherList: skipping