[edk2] [PATCH v2 edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation

2018-11-08 Thread Ard Biesheuvel
Commit 9dd8190e4995 ("Silicon/SynQuacer: tweak PCI I/O windows for
ACPI/Linux support") updated the min/max/offset definitions for the
PCIe I/O resource windows on SynQuacer, and updated the read path of
the platform's EfiCpuIo2 protocol implementation, but failed to update
the write path as well, resulting in spurious errors if when attempting
to write to PCIe I/O ports on PCIe RC #1, which uses translation for the
I/O BAR window.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
v2: use helper function and temp vars

 
Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
 | 62 
 1 file changed, 37 insertions(+), 26 deletions(-)

diff --git 
a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
 
b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
index 736b20cd5129..049657231cab 100644
--- 
a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
+++ 
b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
@@ -354,6 +354,37 @@ CpuMemoryServiceWrite (
   return EFI_SUCCESS;
 }
 
+STATIC
+EFI_STATUS
+TranslateIoAddress (
+  IN  OUT UINT64 *Address
+  )
+{
+  UINT64 Start;
+  UINT64 End;
+  UINT64 Shift;
+
+  Start = SYNQUACER_PCI_SEG0_PORTIO_MIN + SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
+  End   = SYNQUACER_PCI_SEG0_PORTIO_MAX + SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
+  Shift = SYNQUACER_PCI_SEG0_PORTIO_MEMBASE - SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
+
+  if (*Address >= Start && *Address <= End) {
+*Address += Shift;
+return EFI_SUCCESS;
+  }
+
+  Start = SYNQUACER_PCI_SEG1_PORTIO_MIN + SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
+  End   = SYNQUACER_PCI_SEG1_PORTIO_MAX + SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
+  Shift = SYNQUACER_PCI_SEG1_PORTIO_MEMBASE - SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
+
+  if (*Address >= Start && *Address <= End) {
+*Address += Shift;
+return EFI_SUCCESS;
+  }
+  ASSERT (FALSE);
+  return EFI_INVALID_PARAMETER;
+}
+
 /**
   Reads I/O registers.
 
@@ -415,22 +445,9 @@ CpuIoServiceRead (
 return Status;
   }
 
-  if ((Address >= (SYNQUACER_PCI_SEG0_PORTIO_MIN +
-   SYNQUACER_PCI_SEG0_PORTIO_OFFSET)) &&
-  (Address <= (SYNQUACER_PCI_SEG0_PORTIO_MAX +
-   SYNQUACER_PCI_SEG0_PORTIO_OFFSET))) {
-Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE -
-   SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
-  } else if ((Address >= (SYNQUACER_PCI_SEG1_PORTIO_MIN +
-  SYNQUACER_PCI_SEG1_PORTIO_OFFSET)) &&
- (Address <= (SYNQUACER_PCI_SEG1_PORTIO_MAX +
-  SYNQUACER_PCI_SEG1_PORTIO_OFFSET))) {
-Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE -
-   SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
-
-  } else {
-ASSERT (FALSE);
-return EFI_INVALID_PARAMETER;
+  Status = TranslateIoAddress ();
+  if (EFI_ERROR (Status)) {
+return Status;
   }
 
   //
@@ -518,16 +535,9 @@ CpuIoServiceWrite (
 return Status;
   }
 
-  if ((Address >= SYNQUACER_PCI_SEG0_PORTIO_MIN) &&
-  (Address <= SYNQUACER_PCI_SEG0_PORTIO_MAX)) {
-Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE;
-  } else if ((Address >= SYNQUACER_PCI_SEG1_PORTIO_MIN) &&
- (Address <= SYNQUACER_PCI_SEG1_PORTIO_MAX)) {
-Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE;
-
-  } else {
-ASSERT (FALSE);
-return EFI_INVALID_PARAMETER;
+  Status = TranslateIoAddress ();
+  if (EFI_ERROR (Status)) {
+return Status;
   }
 
   //
-- 
2.19.1

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


[edk2] [PATCH v4 1/2] EmulatorPkg: Remove EdkShellBinPkg in FDF and DEC

2018-11-08 Thread Shenglei Zhang
From: shenglei 

Remove EdkShellBinPkg in EmulatorPkg.dec and
EmulatorPkg.fdf.
https://bugzilla.tianocore.org/show_bug.cgi?id=1108

v2: Remove USE_OLD_SHELL because it will not be used.

v4: Remove PcdShellFile in EmulatorPkg.dsc.
https://bugzilla.tianocore.org/show_bug.cgi?id=1298

Cc: Jordan Justen 
Cc: Ruiyu Ni 
Cc: Andrew Fish 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 EmulatorPkg/EmulatorPkg.dec | 2 +-
 EmulatorPkg/EmulatorPkg.dsc | 5 -
 EmulatorPkg/EmulatorPkg.fdf | 4 
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index 25f79c92c9..9be8a90e5b 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -96,7 +96,7 @@
   gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk|L"disk.dmg:FW"|VOID*|0x1001
 
   gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"|VOID*|0x1018
-  
gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L".!../../../../../EdkShellBinPkg/bin/ia32/Apps"|VOID*|0x1004
+  gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L"."|VOID*|0x1004
   gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"|VOID*|0x1002
   gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"|VOID*|0x100d
 
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 3bfb48..4097e1192e 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -196,9 +196,6 @@
   # Change PcdBootManagerMenuFile to UiApp
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
 
-!ifndef $(USE_OLD_SHELL)
-  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 
0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
-!endif
 
 #define BOOT_WITH_FULL_CONFIGURATION  0x00
 #define BOOT_WITH_MINIMAL_CONFIGURATION   0x01
@@ -393,7 +390,6 @@
 
   FatPkg/EnhancedFatDxe/Fat.inf
 
-!ifndef $(USE_OLD_SHELL)
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
   gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
@@ -421,7 +417,6 @@
   gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
   }
-!endif
 
 !endif
 
diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf
index 4595796d51..45697da258 100644
--- a/EmulatorPkg/EmulatorPkg.fdf
+++ b/EmulatorPkg/EmulatorPkg.fdf
@@ -208,12 +208,8 @@ INF  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
 
 INF FatPkg/EnhancedFatDxe/Fat.inf
 
-!ifndef $(USE_OLD_SHELL)
 INF  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
 INF  ShellPkg/Application/Shell/Shell.inf
-!else
-INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
-!endif
 
 [Rule.Common.SEC]
   FILE SEC = $(NAMED_GUID)  {
-- 
2.18.0.windows.1

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


[edk2] [PATCH v4 2/2] Nt32Pkg: Remove EdkShellBinPkg in FDF and DEC

2018-11-08 Thread Shenglei Zhang
From: shenglei 

Remove EdkShellBinPkg in Nt32Pkg.dec and Nt32Pkg.fdf.
https://bugzilla.tianocore.org/show_bug.cgi?id=1108

v2: Remove USE_OLD_SHELL because it will not be used.

v4:Remove PcdShellFile in Nt32Pkg.dsc.
https://bugzilla.tianocore.org/show_bug.cgi?id=1298

Cc: Ruiyu Ni 
Cc: Hao Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 Nt32Pkg/Nt32Pkg.dec | 2 +-
 Nt32Pkg/Nt32Pkg.dsc | 7 ++-
 Nt32Pkg/Nt32Pkg.fdf | 4 
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/Nt32Pkg/Nt32Pkg.dec b/Nt32Pkg/Nt32Pkg.dec
index 06da067bc1..7b2cb8e8d0 100644
--- a/Nt32Pkg/Nt32Pkg.dec
+++ b/Nt32Pkg/Nt32Pkg.dec
@@ -89,7 +89,7 @@
   
gEfiNt32PkgTokenSpaceGuid.PcdWinNtVirtualDisk|L"FW;40960;512"|VOID*|0x1001
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|0x1002
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtUga|L"UGA Window 1!UGA Window 
2"|VOID*|0x1003
-  
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"|VOID*|0x1004
+  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|0x1004
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySize|L"64!64"|VOID*|0x1005
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtConsole|L"Bus Driver Console 
Window"|VOID*|0x100a
   gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 
2"|VOID*|0x100d
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 4293ca39fd..4dbde0cc45 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -280,9 +280,6 @@
   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
 !endif
 
-!ifndef $(USE_OLD_SHELL)
-  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 
0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
-!endif
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   # override the default values from SecurityPkg to ensure images from all 
sources are verified in secure boot
@@ -316,10 +313,10 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
 
 [PcdsDynamicDefault.Ia32]
-  
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\Ia32\Apps"|VOID*|106
+  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|106
 
 [PcdsDynamicDefault.x64]
-  
gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L".!..\..\..\..\EdkShellBinPkg\Bin\X64\Apps"|VOID*|106
+  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFileSystem|L"."|VOID*|106
 
 [PcdsDynamicHii.common.DEFAULT]
   
gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|L"SetupConsoleConfig"|gEfiNt32PkgTokenSpaceGuid|0x0|80
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index 65d9bf812b..b65c95201b 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -284,11 +284,7 @@ INF  
MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
 # for binary shell, binary fat and logo module.
 #
 

-!ifndef $(USE_OLD_SHELL)
 INF  ShellPkg/Application/Shell/Shell.inf
-!else
-INF  EdkShellBinPkg/FullShell/FullShell.inf
-!endif
 
 INF FatPkg/EnhancedFatDxe/Fat.inf
 INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
-- 
2.18.0.windows.1

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


[edk2] [PATCH v4 0/2] Remove PcdShellFile in DSC

2018-11-08 Thread Shenglei Zhang
The PcdShellFile is not used so it is removed from DSC
in Nt32Pkg and EmulatorPkg.
https://bugzilla.tianocore.org/show_bug.cgi?id=1298

Cc: Ruiyu Ni 
Cc: Hao Wu 
Cc: Jordan Justen 
Cc: Andrew Fish 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
shenglei (2):
  EmulatorPkg: Remove EdkShellBinPkg in FDF and DEC
  Nt32Pkg: Remove EdkShellBinPkg in FDF and DEC

 EmulatorPkg/EmulatorPkg.dec | 2 +-
 EmulatorPkg/EmulatorPkg.dsc | 5 -
 EmulatorPkg/EmulatorPkg.fdf | 4 
 Nt32Pkg/Nt32Pkg.dec | 2 +-
 Nt32Pkg/Nt32Pkg.dsc | 7 ++-
 Nt32Pkg/Nt32Pkg.fdf | 4 
 6 files changed, 4 insertions(+), 20 deletions(-)

-- 
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] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

2018-11-08 Thread Ard Biesheuvel
On 9 November 2018 at 01:19, Gao, Liming  wrote:
> Ard:
>   This is a small fix. And, this patch is sent before the hard freeze. It is 
> the low risk for this release. So, I push it.
>

OK, fair enough.

>>-Original Message-
>>From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>>Sent: Friday, November 09, 2018 2:25 AM
>>To: Zeng, Star 
>>Cc: Bi, Dandan ; edk2-devel@lists.01.org; Wu, Hao A
>>; Dong, Eric ; Gao, Liming
>>
>>Subject: Re: [edk2] [patch] MdeModulePkg/DisplayEngine: Remove useless
>>NULL ptr check for NewPos
>>
>>On 8 November 2018 at 02:09, Zeng, Star  wrote:
>>> Reviewed-by: Star Zeng 
>>>
>>> -Original Message-
>>> From: Bi, Dandan
>>> Sent: Wednesday, November 7, 2018 10:53 PM
>>> To: edk2-devel@lists.01.org
>>> Cc: Gao, Liming ; Dong, Eric ;
>>Zeng, Star ; Wu, Hao A 
>>> Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr
>>check for NewPos
>>>
>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1306
>>>
>>> In function UiDisplayMenu, the NewPos ptr which used to point to the
>>highlight menu entry. It will always point to the menu entry which need to be
>>highlighted or the gMenuOption menu if the highlight menu is not found.
>>> So we can remove the NULL ptr check for NewPos in this function.
>>> And add the ASSERT code to avoid if any false positive reports of NULL
>>pointer dereference issue raised from static analysis.
>>>
>>> Cc: Liming Gao 
>>> Cc: Eric Dong 
>>> Cc: Star Zeng 
>>> Cc: Hao Wu 
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Dandan Bi 
>>
>>Why was this patch merged today? Surely, this doesn't meet the hard
>>freeze requirements ?
>>
>>> ---
>>>  MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>>b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>>> index 7390f954b6..44f087fe01 100644
>>> --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>>> +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>>> @@ -2880,10 +2880,11 @@ UiDisplayMenu (
>>>// MenuOption is set to NULL in Repaint
>>>// NewPos: Current menu option that need to hilight
>>>//
>>>ControlFlag = CfUpdateHelpString;
>>>
>>> +  ASSERT (NewPos != NULL);
>>>UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
>>>
>>>if (SkipHighLight) {
>>>  SkipHighLight = FALSE;
>>>  MenuOption= SavedMenuOption;
>>> @@ -2908,11 +2909,11 @@ UiDisplayMenu (
>>>  Temp2 = SkipValue;
>>>} else {
>>>  Temp2 = 0;
>>>}
>>>
>>> -  if (NewPos != NULL && (MenuOption == NULL || NewPos !=
>>>Link)) {
>>> +  if (MenuOption == NULL || NewPos != >Link) {
>>>  if (MenuOption != NULL) {
>>>//
>>>// Remove the old highlight menu.
>>>//
>>>Status = DisplayOneMenu (MenuOption,
>>> --
>>> 2.18.0.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] BaseTools: Replace the sqlite database with list

2018-11-08 Thread Feng, Bob C
Hi Felix,

Yes. There will not be build.db under Conf/.cache folder after this patch.

I'll take parsing dsc file as example to explain how the build.db works in 
current code firstly. 
For the first build, from a .dsc file to a dscbuild data, there are several 
steps:
1. read .dsc file and create a table in build.db
2. Parse each line of dsc file and translate the line string into a data item 
in dsc table.
 The data have the structure as:
 (ID, 
Model,Value1,Value2,Value3,Scope1,Scope2,Scope3,BelongsToItem,FromItem,StartLine,StartColumn,EndLine,EndColumn,Enabled
 )
 At this time, the Macro and the condition in !IF are not evaluated, the 
!INCLUDE is not extend
3. Do the post_process()
 Read the all content from that table and process the Macro, condition, 
!INCLUDE and etc. And save the processed data into a temporary table.
4. Generate build data from the temporary table. The temporary table is in 
memory, it's not saved in build.db

For the second build, tool will check each file's timestamp and compare it with 
the timestamp saved in build.db, if metadata file is not changed, skip the step 
1 and 2.
Step 3 and 4 execute always. So the build.db for build performance is limited.

Here is the performance data. I used cProfile to profile each function's time 
for OvmfX64. You can see after applying patch, the method 'execute' of 
'sqlite3.Cursor' objects time cost is gone. And also nt.stat calls are reduced. 
This patch can improve the performance for both clean build and incremental 
build.

Note: Since cProfile tool adds some overload, the time here is bigger than real 
case.

Current code:
Clean build
22972010 function calls (22055610 primitive calls) in 16.308 seconds

   Ordered by: internal time
   List reduced from 766 to 50 due to restriction <50>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   7848045.0030.0005.0030.000 {nt.stat}
495831.3610.0001.3610.000 {method 'execute' of 
'sqlite3.Cursor' objects}
460571.2410.0007.6440.000 
C:\Python27\lib\traceback.py:281(extract_stack)
   7723260.6500.0005.5360.000 
C:\Python27\lib\linecache.py:47(checkcache)
675949/14410.5320.0001.0560.001 
C:\Python27\lib\copy.py:145(deepcopy)
   7723260.3350.0000.6100.000 
C:\Python27\lib\linecache.py:13(getline)
   6893580.2760.0000.4710.000 
D:\edk2\BaseTools\Source\Python\Common\Misc.py:1744(__eq__)
595200.2380.0000.2790.000 
D:\edk2\BaseTools\Source\Python\Common\StringUtils.py:402(CleanString2)

Incremental build:

15253810 function calls (14517810 primitive calls) in 8.392 seconds

   Ordered by: internal time
   List reduced from 732 to 50 due to restriction <50>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2022271.3410.0001.3410.000 {nt.stat}
165950.9720.0000.9720.000 {method 'execute' of 
'sqlite3.Cursor' objects}
499562/9740.3880.0000.7740.001 
C:\Python27\lib\copy.py:145(deepcopy)
130690.3210.0001.9420.000 
C:\Python27\lib\traceback.py:281(extract_stack)
   6893580.2780.0000.4730.000 
D:\edk2\BaseTools\Source\Python\Common\Misc.py:1744(__eq__)
 21360.1800.0000.4860.000 
D:\edk2\BaseTools\Source\Python\Workspace\MetaFileTable.py:231(GetValidExpression)
515450.1780.0000.3360.000 
C:\Python27\lib\ntpath.py:415(normpath)
10.1750.1750.2550.255 
D:\edk2\BaseTools\Source\Python\Common\ToolDefClassObject.py:69(LoadToolDefFile)
   1898570.1660.0001.3930.000 
C:\Python27\lib\linecache.py:47(checkcache)
109500.1640.0000.2450.000 
D:\edk2\BaseTools\Source\Python\GenFds\FdfParser.py:285(_SkipWhiteSpace)

After patch:
Clean build is the same as Incremental build

16557449 function calls (15641049 primitive calls) in 6.662 seconds

   Ordered by: internal time
   List reduced from 746 to 50 due to restriction <50>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
675949/14410.5380.0001.0640.001 
C:\Python27\lib\copy.py:145(deepcopy)
   6893580.2750.0000.4680.000 
D:\edk2\BaseTools\Source\Python\Common\Misc.py:1744(__eq__)
 21360.2360.0000.2510.000 
D:\edk2\BaseTools\Source\Python\ParserDb\MetaFileTable.py:269(GetValidExpression)
595200.2320.0000.2680.000 
D:\edk2\BaseTools\Source\Python\Common\StringUtils.py:402(CleanString2)
276120.2130.0000.2130.000 {nt.stat}
   6662830.1960.0000.2570.000 
C:\Python27\lib\copy.py:267(_keep_alive)
516670.1780.0000.3150.000 
C:\Python27\lib\ntpath.py:415(normpath)

Thanks,
Bob

-Original Message-
From: Felix Polyudov [mailto:fel...@ami.com] 
Sent: Friday, November 9, 2018 12:48 AM
To: Feng, Bob C ; Ni, Ruiyu ; 
edk2-devel@lists.01.org
Cc: 

Re: [edk2] [RFC PATCH 7/9] SecurityPkg/AuthVariableLib:allow reusability as MM_STANDALONE

2018-11-08 Thread Zhang, Chao B
Reviewed-by : Chao Zhang 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Jagadeesh Ujja
Sent: Wednesday, October 31, 2018 7:10 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [RFC PATCH 7/9] SecurityPkg/AuthVariableLib:allow reusability 
as MM_STANDALONE

“AuthVariableLib” library will be used by MM_STANDALONE driver too, hence 
adding LIBRARY_CLASS as MM_STANDALONE

Change-Id: I67a10e1c60b3c859283c995f442d5b8709de89e1
Signed-off-by: Jagadeesh Ujja 
---
 SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
index 572ba4e..4294d3b 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
@@ -2,6 +2,7 @@
 #  Provides authenticated variable services.
 #
 #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions @@ -21,12 +22,12 @@
   FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
--
1.9.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] SecurityPkg: Fix TPM device compatibility issue

2018-11-08 Thread Zhang, Chao B
Issue Statement:
TPM InterfaceId cache feature is introduced by 
f15cb995bb3880b77e15afe6facd3da05e599a17. It follows TCG PTP spec 1.3
to improve TPM transmission performance and also addresses defects in some 
TPM2.0 devices. But some other TPM devices like
NTC1310 SPI TPM is found function abnormally with this feature, causing extra 
device compatibility issue.

Solution:
Add a policy indicator in PcdActiveTpmInterfaceType to disable TPM interface ID 
cache to support those existing TPM devices

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhang, Chao B 
Cc: Andrew Fish 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Yao Jiewen 
---
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c | 23 +++-
 SecurityPkg/SecurityPkg.dec |  3 +-
 SecurityPkg/SecurityPkg.uni |  3 +-
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 49 +
 SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c   | 42 +
 5 files changed, 117 insertions(+), 3 deletions(-)

diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c 
b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
index ad2f188b46..66aa8794ac 100644
--- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
+++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
@@ -524,10 +524,17 @@ DumpPtpInfo (
 
   Vid = 0x;
   Did = 0x;
   Rid = 0xFF;
   PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);
+  if (PtpInterface == 0xFE) {
+//
+// TPM interface type cache disabled. Always read Interface type from TPM
+//
+PtpInterface = Tpm2GetPtpInterface (Register);
+  }
+
   DEBUG ((EFI_D_INFO, "PtpInterface - %x\n", PtpInterface));
   switch (PtpInterface) {
   case Tpm2PtpInterfaceCrb:
 Vid = MmioRead16 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->Vid);
 Did = MmioRead16 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->Did);
@@ -568,11 +575,18 @@ DTpm2SubmitCommand (
   IN UINT8 *OutputParameterBlock
   )
 {
   TPM2_PTP_INTERFACE_TYPE  PtpInterface;
 
-  PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);
+  PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);  
+  if (PtpInterface == 0xFE) {
+//
+// Always read Interface type from TPM to get more device compatibility
+//
+PtpInterface = Tpm2GetPtpInterface ((VOID *) (UINTN) PcdGet64 
(PcdTpmBaseAddress));
+  }
+
   switch (PtpInterface) {
   case Tpm2PtpInterfaceCrb:
 return PtpCrbTpmCommand (
(PTP_CRB_REGISTERS_PTR) (UINTN) PcdGet64 (PcdTpmBaseAddress),
InputParameterBlock,
@@ -608,10 +622,17 @@ DTpm2RequestUseTpm (
   )
 {
   TPM2_PTP_INTERFACE_TYPE  PtpInterface;
 
   PtpInterface = PcdGet8(PcdActiveTpmInterfaceType);
+  if (PtpInterface == 0xFE) {
+//
+// Always read Interface type from TPM to get more device compatibility
+//
+PtpInterface = Tpm2GetPtpInterface ((VOID *) (UINTN) PcdGet64 
(PcdTpmBaseAddress));
+  }
+
   switch (PtpInterface) {
   case Tpm2PtpInterfaceCrb:
 return PtpCrbRequestUseTpm ((PTP_CRB_REGISTERS_PTR) (UINTN) PcdGet64 
(PcdTpmBaseAddress));
   case Tpm2PtpInterfaceFifo:
   case Tpm2PtpInterfaceTis:
diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
index 8d64b4fefe..2aef4ba128 100644
--- a/SecurityPkg/SecurityPkg.dec
+++ b/SecurityPkg/SecurityPkg.dec
@@ -467,11 +467,12 @@
   ## This PCD indicates current active TPM interface type.
   #  Accodingt to TCG PTP spec 1.3, there are 3 types defined in 
TPM2_PTP_INTERFACE_TYPE.
   #  0x00 - FIFO interface as defined in TIS 1.3 is active.
   #  0x01 - FIFO interface as defined in PTP for TPM 2.0 is active.
   #  0x02 - CRB interface is active.
-  #  0xFF - Contains no current active TPM interface type.
+  #  0xFE - Disable TPM interface type cache feature.
+  #  0xFF - Enable TPM interface cache and contain no current active TPM 
interface type.
   #
   # @Prompt current active TPM interface type.
   gEfiSecurityPkgTokenSpaceGuid.PcdActiveTpmInterfaceType|0xFF|UINT8|0x0001001E
 
   ## This PCD records IdleByass status supported by current active TPM 
interface.
diff --git a/SecurityPkg/SecurityPkg.uni b/SecurityPkg/SecurityPkg.uni
index 400fe6015e..44182bb62a 100644
--- a/SecurityPkg/SecurityPkg.uni
+++ b/SecurityPkg/SecurityPkg.uni
@@ -252,11 +252,12 @@
 
 #string STR_gEfiSecurityPkgTokenSpaceGuid_PcdActiveTpmInterfaceType_HELP  
#language en-US "This PCD indicates current active TPM interface type.\n"

   "0x00 - FIFO interface as defined in TIS 1.3 is active.\n"

   "0x01 - FIFO interface as defined in PTP for TPM 2.0 is 
active.\n"

   "0x02 - CRB interface is active.\n"
-   
   "0xFF - 

Re: [edk2] [Patch 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Separate semaphore container.

2018-11-08 Thread Dong, Eric
Hi Laszlo,


> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, November 9, 2018 1:51 AM
> To: Dong, Eric ; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu 
> Subject: Re: [edk2] [Patch 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Separate
> semaphore container.
> 
> On 11/08/18 14:33, Laszlo Ersek wrote:
> > On 11/08/18 03:58, Eric Dong wrote:
> >> In current implementation, core level semaphore use same container
> >> with package level semaphore. This design will let the core level
> >> semaphore not works as expected in below case:
> >> 1. Feature A has CPU_FEATURE_CORE_BEFORE dependence with Feature
> B.
> >> 2. Feature C has CPU_FEATURE_PACKAGE_AFTER dependence with
> Feature B.
> >> in this case an core level semaphore will be add between A and B, and
> >> an package level semaphore will be add between B and C.
> >>
> >> For a CPU has one package, two cores and 4 threads. Execute like below:
> >>
> >>   Thread 1  Thread 2. Thread 4
> >> ReleaseSemaph(1,2)  -|
> >> WaitForSemaph(1(2)) -|<---These two are Core Semaph
> >>   ReleaseSemaph(1,2) -|
> >>   WaitForSemaph(2)   -| <---  Core Semaph
> >>
> >> ReleaseSemaph (1,2,3,4) -|
> >> WaitForSemaph (1(4))-| <  Package Semaph
> >>
> >>   ReleaseSemaph(3,4)
> >>   WaitForSemaph(4(2)) <- Core
> >> Semaph
> >>
> >> In above case, for thread 4, when it executes a core semaphore, i
> >> will found WaitForSemaph(4(2)) is met because Thread 1 has execute a
> >> package semaphore and ReleaseSemaph(4) for it before. This is not an
> >> expect behavior. Thread 4 should wait for thread 3 to do this.
> >>
> >> Fix this issue by separate the semaphore container for core level and
> >> package level.
> >>
> >> Cc: Laszlo Ersek 
> >> Cc: Ruiyu Ni 
> >> Contributed-under: TianoCore Contribution Agreement 1.1
> >> Signed-off-by: Eric Dong 
> >> ---
> >>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 ++---
> >>  1 file changed, 14 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> >> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> >> index a45e2dd3d7..65461485a4 100644
> >> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> >> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> >> @@ -41,9 +41,10 @@ typedef struct {
> >>  // Flags used when program the register.
> >>  //
> >>  typedef struct {
> >> -  volatile UINTN   ConsoleLogLock;   // Spinlock used to 
> >> control
> console.
> >> -  volatile UINTN   MemoryMappedLock; // Spinlock used to
> program mmio
> >> -  volatile UINT32  *SemaphoreCount;  // Semaphore used to
> program semaphore.
> >> +  volatile UINTN   ConsoleLogLock;  // Spinlock used to 
> >> control
> console.
> >> +  volatile UINTN   MemoryMappedLock;// Spinlock used to
> program mmio
> >> +  volatile UINT32  *CoreSemaphoreCount; // Semaphore used to
> program semaphore.
> >> +  volatile UINT32  *PackageSemaphoreCount;  // Semaphore used to
> program semaphore.
> >>  } PROGRAM_CPU_REGISTER_FLAGS;
> >>
> >>  //
> >> @@ -348,11 +349,12 @@ ProgramProcessorRegister (
> >>ASSERT (
> >>  (ApLocation != NULL) &&
> >>  (CpuStatus->ValidCoreCountPerPackage != 0) &&
> >> -(CpuFlags->SemaphoreCount) != NULL
> >> +(CpuFlags->CoreSemaphoreCount != NULL) &&
> >> +(CpuFlags->PackageSemaphoreCount != NULL)
> >>  );
> >> -  SemaphorePtr = CpuFlags->SemaphoreCount;
> >>switch (RegisterTableEntry->Value) {
> >>case CoreDepType:
> >> +SemaphorePtr = CpuFlags->CoreSemaphoreCount;
> >>  //
> >>  // Get Offset info for the first thread in the core which current 
> >> thread
> belongs to.
> >>  //
> >> @@ -373,6 +375,7 @@ ProgramProcessorRegister (
> >>  break;
> >>
> >>case PackageDepType:
> >> +SemaphorePtr = CpuFlags->PackageSemaphoreCount;
> >>  ValidCoreCountPerPackage = (UINT32 *)(UINTN)CpuStatus-
> >ValidCoreCountPerPackage;
> >>  //
> >>  // Get Offset info for the first thread in the package which 
> >> current
> thread belongs to.
> >> @@ -1037,10 +1040,14 @@ GetAcpiCpuData (
> >>  ASSERT (mAcpiCpuData.ApLocation != 0);
> >>}
> >>if (CpuStatus->PackageCount != 0) {
> >> -mCpuFlags.SemaphoreCount = AllocateZeroPool (
> >> +mCpuFlags.CoreSemaphoreCount = AllocateZeroPool (
> >>   sizeof (UINT32) * 
> >> CpuStatus->PackageCount *
> >>   CpuStatus->MaxCoreCount * CpuStatus-
> >MaxThreadCount);
> >> -ASSERT (mCpuFlags.SemaphoreCount != NULL);
> >> +ASSERT (mCpuFlags.CoreSemaphoreCount != NULL);
> >> +mCpuFlags.PackageSemaphoreCount = AllocateZeroPool (
> >> + sizeof (UINT32) * 
> >> CpuStatus->PackageCount *
> 

[edk2] [edk2-test][Patch v3 2/2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

2018-11-08 Thread Eric Jin
The patch is applied to IHV part.

UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol
are required to return KeyData.Key and KeyData.KeyState values.
These drivers must always return the most current state of
KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.

The change in spec is "EFI_NOT_READY - There was no keystroke
data available. Current KeyData.KeyState values are exposed."

Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin 
---
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   6 +-
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-
 .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 217 -
 .../BlackBoxTest/SimpleTextInputExBBTestMain.c |  11 +-
 .../BlackBoxTest/SimpleTextInputExBBTestMain.h |  20 +-
 5 files changed, 261 insertions(+), 5 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
index b79772c..4f8ab80 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2015 Unified EFI, Inc.
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 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
@@ -63,3 +63,7 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid007 = 
EFI_TEST_SIMPLETEXTI
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
 
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
index 6c90fca..2a6be48 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2010 Unified EFI, Inc.
-  Copyright (c) 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 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
@@ -119,3 +119,13 @@ extern EFI_GUID 
gSimpleTextInputExBBTestFunctionAssertionGuid008;
 { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, 0x84 
} }
 
 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8, 0x67 
} }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40, 0x71 
} }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index ce5a80a..08d93a0 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,79 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
 }
 
 
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL   *This,
+  IN VOID   *ClientInterface,
+  IN EFI_TEST_LEVEL TestLevel,
+  IN EFI_HANDLE SupportHandle
+  )
+{
+  EFI_STANDARD_TEST_LIBRARY_PROTOCOL*StandardLib;
+  EFI_STATUSStatus;
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+  
+  EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+  CHAR16   *DevicePathStr;
+
+  //
+  // init
+  //
+  SimpleTextInputEx = (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+   SupportHandle,
+   ,
+

[edk2] [edk2-test][Patch v3 1/2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

2018-11-08 Thread Eric Jin
The patch is applied to the EFI part.

UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol
are required to return KeyData.Key and KeyData.KeyState values.
These drivers must always return the most current state of
KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.

The change in spec is "EFI_NOT_READY - There was no keystroke
data available. Current KeyData.KeyState values are exposed."

Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin 
---
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   6 +-
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-
 .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 215 +
 .../BlackBoxTest/SimpleTextInputExBBTestMain.c |  11 +-
 .../BlackBoxTest/SimpleTextInputExBBTestMain.h |  20 +-
 5 files changed, 260 insertions(+), 4 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
index 9cb19f4..f72bbdd 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2012 Unified EFI, Inc.
-  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 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
@@ -63,3 +63,7 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid007 = 
EFI_TEST_SIMPLETEXTI
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
 
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
index 6c90fca..2a6be48 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2010 Unified EFI, Inc.
-  Copyright (c) 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 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
@@ -119,3 +119,13 @@ extern EFI_GUID 
gSimpleTextInputExBBTestFunctionAssertionGuid008;
 { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, 0x84 
} }
 
 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \
+{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8, 0x67 
} }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \
+{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40, 0x71 
} }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index 153ade0..2f6ad7d 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,79 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
 }
 
 
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL   *This,
+  IN VOID   *ClientInterface,
+  IN EFI_TEST_LEVEL TestLevel,
+  IN EFI_HANDLE SupportHandle
+  )
+{
+  EFI_STANDARD_TEST_LIBRARY_PROTOCOL*StandardLib;
+  EFI_STATUSStatus;
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInputEx;
+  
+  EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+  CHAR16   *DevicePathStr;
+
+  //
+  // init
+  //
+  SimpleTextInputEx = (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+   SupportHandle,
+   ,

[edk2] [Patch] UefiCpuPkg/RegisterCpuFeaturesLib: Adjust Order.

2018-11-08 Thread Eric Dong
V2 changes:
V1 change has regression which caused by change feature order.
V2 changes logic to detect dependence not only for the
neighborhood features. It need to check all features in the list.

V1 Changes:
In current code logic, only adjust feature position if current
CPU feature position not follow the request order. Just like
Feature A need to be executed before feature B, but current
feature A registers after feature B. So code will adjust the
position for feature A, move it to just before feature B. If
the position already met the requirement, code will not adjust
the position.

This logic has issue when met all below cases:
1. feature A has core or package level dependence with feature B.
2. feature A is register before feature B.
3. Also exist other features exist between feature A and B.

Root cause is driver ignores the dependence for this case, so
threads may execute not follow the dependence order.

Fix this issue by change code logic to adjust feature position
for CPU features which has dependence relationship.

Cc: Laszlo Ersek 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong 
---
 .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c |  71 
 .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h   |  16 +++
 .../RegisterCpuFeaturesLib.c   | 122 +
 3 files changed, 189 insertions(+), 20 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c 
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 4bed0ce3a4..69e2c04daf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -534,6 +534,28 @@ DumpRegisterTableOnProcessor (
   }
 }
 
+/**
+  Get the biggest dependence type.
+  PackageDepType > CoreDepType > ThreadDepType > NoneDepType.
+
+  @param[in]  BeforeDep   Before dependence type.
+  @param[in]  AfterDepAfter dependence type.
+  @param[in]  NoneNeibBeforeDep   Before dependence type for not neighborhood 
features.
+  @param[in]  NoneNeibAfterDepAfter dependence type for not neighborhood 
features.
+
+  @retval  Return the biggest dependence type.
+**/
+CPU_FEATURE_DEPENDENCE_TYPE
+BiggestDep (
+  IN CPU_FEATURE_DEPENDENCE_TYPE  BeforeDep,
+  IN CPU_FEATURE_DEPENDENCE_TYPE  AfterDep,
+  IN CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibBeforeDep,
+  IN CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibAfterDep
+  )
+{
+  return MAX(MAX (MAX(BeforeDep, AfterDep), NoneNeibBeforeDep), 
NoneNeibAfterDep);
+}
+
 /**
   Analysis register CPU features on each processor and save CPU setting in CPU 
register table.
 
@@ -558,6 +580,8 @@ AnalysisProcessorFeatures (
   BOOLEAN  Success;
   CPU_FEATURE_DEPENDENCE_TYPE  BeforeDep;
   CPU_FEATURE_DEPENDENCE_TYPE  AfterDep;
+  CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibBeforeDep;
+  CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibAfterDep;
 
   CpuFeaturesData = GetCpuFeaturesData ();
   CpuFeaturesData->CapabilityPcd = AllocatePool (CpuFeaturesData->BitMaskSize);
@@ -634,14 +658,9 @@ AnalysisProcessorFeatures (
 //
 CpuInfo = >InitOrder[ProcessorNumber].CpuInfo;
 Entry = GetFirstNode (>OrderList);
-NextEntry = Entry->ForwardLink;
 while (!IsNull (>OrderList, Entry)) {
   CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
-  if (!IsNull (>OrderList, NextEntry)) {
-NextCpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (NextEntry);
-  } else {
-NextCpuFeatureInOrder = NULL;
-  }
+
   Success = FALSE;
   if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, 
CpuFeaturesData->SettingPcd)) {
 Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, 
CpuFeatureInOrder->ConfigData, TRUE);
@@ -674,31 +693,43 @@ AnalysisProcessorFeatures (
   }
 
   if (Success) {
-//
-// If feature has dependence with the next feature (ONLY care 
core/package dependency).
-// and feature initialize succeed, add sync semaphere here.
-//
-if (NextCpuFeatureInOrder != NULL) {
+NextEntry = Entry->ForwardLink;
+if (!IsNull (>OrderList, NextEntry)) {
+  NextCpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (NextEntry);
+
+  //
+  // If feature has dependence with the next feature (ONLY care 
core/package dependency).
+  // and feature initialize succeed, add sync semaphere here.
+  //
   BeforeDep = DetectFeatureScope (CpuFeatureInOrder, TRUE, 
NextCpuFeatureInOrder->FeatureMask);
   AfterDep  = DetectFeatureScope (NextCpuFeatureInOrder, FALSE, 
CpuFeatureInOrder->FeatureMask);
+  //
+  // Check whether next feature has After type dependence with not 
neighborhood CPU
+  // Features in former CPU features.
+  //
+  NoneNeibAfterDep = 

Re: [edk2] [patch] MdePkg: Fix incorrect check for DisplayOnly text format in AcpiEx

2018-11-08 Thread Bi, Dandan
Hi Stewards and package maintainers:

Since this is a clear bug.  And the risk for this release is small.
So I plan to push this patch before edk2-stable201811 tag is created.

If you have any concern, please raise here. 


Thanks,
Dandan

> -Original Message-
> From: Gao, Liming
> Sent: Thursday, November 8, 2018 9:56 PM
> To: Bi, Dandan ; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Kinney, Michael D
> 
> Subject: RE: [patch] MdePkg: Fix incorrect check for DisplayOnly text format
> in AcpiEx
> 
> Reviewed-by: Liming Gao 
> 
> > -Original Message-
> > From: Bi, Dandan
> > Sent: Thursday, November 8, 2018 9:50 PM
> > To: edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu ; Kinney, Michael D
> > ; Gao, Liming 
> > Subject: [patch] MdePkg: Fix incorrect check for DisplayOnly text
> > format in AcpiEx
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1312
> >
> > Text format for AcpiEx device path in UEFI Spec:
> > AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR)
> > AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only)
> >
> > When convert device path to text for ACPI device path, current code
> > check AllowShortcuts parameter to convert the device path to
> > DisplayOnly text format(shorter text
> > representation) by mistake.
> > It should check DisplayOnly parameter.
> >
> > This commit is to fix this issue.
> >
> > Cc: Ruiyu Ni 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Dandan Bi 
> > ---
> >  MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> > b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> > index cdcdb3623a..97d279eeb2 100644
> > --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> > +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> > @@ -495,11 +495,11 @@ DevPathToTextAcpiEx (
> >  CIDText,
> >  UIDStr
> > );
> >  }
> >} else {
> > -if (AllowShortcuts) {
> > +if (DisplayOnly) {
> >//
> >// display only
> >//
> >if (AcpiEx->HID == 0) {
> >  UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);
> > --
> > 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: Optimize string concatenation

2018-11-08 Thread Feng, Bob C
Hi Leif,

Yes. I should show the data.

My unites scripts is as below. The parameter lines is a string list which size 
is 43395. The test result is

''.join(String list) time:  0.042262
String += String time  :  3.822699

def TestPlus(lines):
str_target = ""

for line in lines:
str_target += line

return str_target

def TestJoin(lines):
str_target = []

for line in lines:
str_target.append(line)

return "".join(str_target)

def CompareStrCat():
lines = GetStrings()
print (len(lines))

begin = time.perf_counter()
for _ in range(10):
TestJoin(lines)
end = time.perf_counter() - begin
print ("''.join(String list) time: %f" % end)

begin = time.perf_counter()
for _ in range(10):
TestPlus(lines)
end = time.perf_counter() - begin
print ("String += String time: %f" % end)

For build OvmfX64, it's not very effective, it saves 2~3 second in 
Parse/AutoGen phase, because OvmfX64 is relatively simple. It does not enable 
much features such as Multiple SKU and structure PCD by default and there is no 
big size Autogen.c/Autogen.h/Makefile generated either. but for the complex 
platform, this patch will be much effective. The unites above simulates a real 
case that there is a 43395 lines of Autogen.c generated.

Since this patch mostly effect the Parser/AutoGen phase, I just use "build 
genmake" to show the improvement data. 
The final result for clean build is:
Current code:  17 seconds
After patch:  15 seconds

Details:
Current data:

d:\edk2 (master -> origin)
λ build genmake -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 -t VS2015x86
Build environment: Windows-10-10.0.10240
Build start time: 10:12:32, Nov.09 2018

WORKSPACE= d:\edk2
ECP_SOURCE   = d:\edk2\edkcompatibilitypkg
EDK_SOURCE   = d:\edk2\edkcompatibilitypkg
EFI_SOURCE   = d:\edk2\edkcompatibilitypkg
EDK_TOOLS_PATH   = d:\edk2\basetools
EDK_TOOLS_BIN= d:\edk2\basetools\bin\win32
CONF_PATH= d:\edk2\conf

Architecture(s)  = IA32 X64
Build target = DEBUG
Toolchain= VS2015x86

Active Platform  = d:\edk2\OvmfPkg\OvmfPkgIa32X64.dsc
Flash Image Definition   = d:\edk2\OvmfPkg\OvmfPkgIa32X64.fdf

Processing meta-data ... done!
Generating code . done!
Generating makefile . done!
Generating code .. done!
Generating makefile .. done!

- Done -
Build end time: 10:12:49, Nov.09 2018
Build total time: 00:00:17

After applying this patch:

d:\edk2 (master -> origin)
λ build genmake -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 -
Build environment: Windows-10-10.0.10240  
Build start time: 10:11:41, Nov.09 2018   
  
WORKSPACE= d:\edk2
ECP_SOURCE   = d:\edk2\edkcompatibilitypkg
EDK_SOURCE   = d:\edk2\edkcompatibilitypkg
EFI_SOURCE   = d:\edk2\edkcompatibilitypkg
EDK_TOOLS_PATH   = d:\edk2\basetools  
EDK_TOOLS_BIN= d:\edk2\basetools\bin\win32
CONF_PATH= d:\edk2\conf   
  
  
Architecture(s)  = IA32 X64   
Build target = DEBUG  
Toolchain= VS2015x86  
  
Active Platform  = d:\edk2\OvmfPkg\OvmfPkgIa32X64.dsc 
Flash Image Definition   = d:\edk2\OvmfPkg\OvmfPkgIa32X64.fdf 
  
Processing meta-data . done!  
Generating code . done!   
Generating makefile . done!   
Generating code .. done!  
Generating makefile .. done!  
  
- Done -  
Build end time: 10:11:56, Nov.09 2018 
Build total time: 00:00:15


Thanks,
Bob


-Original Message-
From: Leif Lindholm [mailto:leif.lindh...@linaro.org] 
Sent: Friday, November 9, 2018 12:53 AM
To: Feng, Bob C 
Cc: edk2-devel@lists.01.org; Carsey, Jaben ; Gao, 
Liming 
Subject: Re: [edk2] [Patch] BaseTools: Optimize string concatenation

On Thu, Nov 08, 2018 at 06:16:25PM +0800, BobCF wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement series 
> patches.
> 
> This patch is going to use join function instead of string += string2 
> statement.
> 
> Current code use string += string2 

[edk2] [PATCH] IntelFrameworkModulePkg: Remove SmmRuntimeDxeReportStatusCodeLibFramework

2018-11-08 Thread Shenglei Zhang
I find the library instance is not used. So instead of fixing the bug, I remove
the whole instance.
https://bugzilla.tianocore.org/show_bug.cgi?id=1059

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../IntelFrameworkModulePkg.dsc   |   1 -
 .../ReportStatusCodeLib.c | 493 --
 .../ReportStatusCodeLibInternal.h |  73 ---
 ...RuntimeDxeReportStatusCodeLibFramework.inf |  73 ---
 ...RuntimeDxeReportStatusCodeLibFramework.uni |  23 -
 .../SmmRuntimeDxeSupport.c| 335 
 6 files changed, 998 deletions(-)
 delete mode 100644 
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
 delete mode 100644 
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
 delete mode 100644 
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
 delete mode 100644 
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.uni
 delete mode 100644 
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c

diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc 
b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
index 894c5340a0..90f81708f2 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
@@ -113,7 +113,6 @@
   IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf
   IntelFrameworkModulePkg/Library/PeiRecoveryLib/PeiRecoveryLib.inf
   
IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
-  
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
   
IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
   IntelFrameworkModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
   IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
diff --git 
a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
 
b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
deleted file mode 100644
index c49dacaeb1..00
--- 
a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/** @file
-  API implementation for instance of Report Status Code Library.
-
-  Copyright (c) 2006 - 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.
-
-**/
-
-#include "ReportStatusCodeLibInternal.h"
-
-/**
-  Converts a status code to an 8-bit POST code value.
-
-  Converts the status code specified by CodeType and Value to an 8-bit POST 
code
-  and returns the 8-bit POST code in PostCode.  If CodeType is an
-  EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of 
PostCode
-  are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits
-  24..26 of Value., and TRUE is returned.  Otherwise, FALSE is returned.
-
-  If PostCode is NULL, then ASSERT().
-
-  @param  CodeType  The type of status code being converted.
-  @param  Value The status code value being converted.
-  @param  PostCode  A pointer to the 8-bit POST code value to return.
-
-  @retval  TRUE   The status code specified by CodeType and Value was converted
-  to an 8-bit POST code and returned in  PostCode.
-  @retval  FALSE  The status code specified by CodeType and Value could not be
-  converted to an 8-bit POST code value.
-
-**/
-BOOLEAN
-EFIAPI
-CodeTypeToPostCode (
-  IN  EFI_STATUS_CODE_TYPE   CodeType,
-  IN  EFI_STATUS_CODE_VALUE  Value,
-  OUT UINT8  *PostCode
-  )
-{
-  //
-  // If PostCode is NULL, then ASSERT()
-  //
-  ASSERT (PostCode != NULL);
-
-  //
-  // Convert Value to an 8 bit post code
-  //
-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||
-  ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)   ) {
-*PostCode  = (UINT8) Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |
-  (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 
0x1f));
-return TRUE;
-  }
-  return FALSE;
-}
-
-
-/**
-  Extracts ASSERT() information from a status code structure.
-
-  Converts the status code specified by CodeType, Value, and Data to the 

Re: [edk2] [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

2018-11-08 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Gao, Liming 
Sent: Friday, November 09, 2018 7:58 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

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

This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Source/C/Common/Decompress.c   | 6 ++
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/BaseTools/Source/C/Common/Decompress.c 
b/BaseTools/Source/C/Common/Decompress.c
index 71313b1179..33e0f0d160 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -662,6 +662,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+return ;
+  }
 }
   }
 
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 2d6fc4c952..a77f6798ec 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2682,6 +2682,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+goto Done ;
+  }
 }
   }
 
-- 
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 v3 2/2] MdeModulePkg/BaseSortLib: Enable for all module types

2018-11-08 Thread Zeng, Star
As I remember, Liming and I have given RB to the patch at V1 series.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff 
Brasen
Sent: Friday, November 9, 2018 3:04 AM
To: edk2-devel@lists.01.org
Cc: Jeff Brasen 
Subject: [edk2] [PATCH v3 2/2] MdeModulePkg/BaseSortLib: Enable for all module 
types

Expose BaseSortLib for use in SEC and PEI phases.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
---
 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
index f807cd7..5bd1aa1 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
@@ -18,9 +18,9 @@
   BASE_NAME  = BaseSortLib
   MODULE_UNI_FILE= BaseSortLib.uni
   FILE_GUID  = 03F3331B-F12D-494f-BF37-E55A657F2497
-  MODULE_TYPE= UEFI_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SortLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = SortLib
 
 #
 #  VALID_ARCHITECTURES   = IA32 X64 EBC
-- 
2.7.4

___
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] [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

2018-11-08 Thread Jin, Eric
Supreeth,

The Patch will be split in 2 patches in series, one of the test driver in EFI 
part, and the other in the IHV part.
The attribute alignment can be ignored due to the wordwrap in mail format.
RecordMessage format will be consistent and extra parenthesis will be added in 
the if statement.
Besides above, more comments are added to describe the checkpoint intention.

The Patch V3 will be sent out later. 

Best Regards
Eric

-Original Message-
From: Supreeth Venkatesh  
Sent: Thursday, November 8, 2018 4:00 AM
To: Jin, Eric ; edk2-devel@lists.01.org
Subject: Re: [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of 
ReadKeyStrokeEx Toggle state

Eric,

Could you please split these as PATCH (perhaps 3 or more) series as there are 
more than 10 files changed in a single patch?.

Please see comments inline.

On Wed, 2018-11-07 at 14:47 +0800, Eric Jin wrote:
> UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol are 
> required to return KeyData.Key and KeyData.KeyState values.
> These drivers must always return the most current state of 
> KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.
> 
> The change in spec is "EFI_NOT_READY - There was no keystroke data 
> available. Current KeyData.KeyState values are exposed."
> 
> Cc: Supreeth Venkatesh 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin 
> ---
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-  
> .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 211
> 
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.c |  13 +-
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.h |  22 ++-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-  
> .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 213
> -
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.c |  11 +-
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.h |  20 +-
>  10 files changed, 515 insertions(+), 13 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> index 9cb19f4..ff2d50f 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>Copyright 2006 - 2012 Unified EFI, Inc.
> -  Copyright (c) 2010 - 2012, Intel Corporation. All rights 
> reserved.
> +  Copyright (c) 2010 - 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 @@ -63,3 +63,8 @@ EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid007 = 
> EFI_TEST_SIMPLETEXTI  EFI_GUID 
> gSimpleTextInputExBBTestFunctionAssertionGuid008 = 
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
>  
>  EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 = 
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
> +
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> index 6c90fca..2a6be48 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>Copyright 2006 - 2010 Unified EFI, Inc.
> -  Copyright (c) 2010, Intel Corporation. All rights reserved.
> +  Copyright (c) 2010 - 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 @@ -119,3 +119,13 @@ extern EFI_GUID 
> gSimpleTextInputExBBTestFunctionAssertionGuid008;
>  { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 
> 0xeb, 0x84 } }
>  
>  extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
> \
> +{ 0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
> 0xa8, 0x67 } }
> +
> +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
> \
> +{ 0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
> 0x40, 0x71 } }
> +
> +extern 

Re: [edk2] [Patch] Maintainers.txt: Update EDK II Releases to EDK-II-Release-Planning wiki

2018-11-08 Thread Gao, Liming
Thanks for your review. I would like to push this change for this stable tag 
edk2-stable201811. It has no impact for the release. Are you OK for it?

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Laszlo Ersek
>Sent: Friday, November 09, 2018 1:45 AM
>To: Leif Lindholm ; Gao, Liming
>
>Cc: Kinney, Michael D ; edk2-
>de...@lists.01.org
>Subject: Re: [edk2] [Patch] Maintainers.txt: Update EDK II Releases to EDK-II-
>Release-Planning wiki
>
>On 11/08/18 18:13, Leif Lindholm wrote:
>> I'm generally happy with this if the rest of you are?
>>
>> Reviewed-by: Leif Lindholm 
>>
>> /
>> Leif
>>
>> On Thu, Nov 08, 2018 at 10:49:34PM +0800, Liming Gao wrote:
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Liming Gao 
>>> ---
>>>  Maintainers.txt | 4 +---
>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/Maintainers.txt b/Maintainers.txt
>>> index 6c9156169a..fc183d6477 100644
>>> --- a/Maintainers.txt
>>> +++ b/Maintainers.txt
>>> @@ -51,9 +51,7 @@ W:
>https://github.com/tianocore/tianocore.github.io/wiki/Security
>>>
>>>  EDK II Releases:
>>>  
>>> -UDK2014
>>> -W: http://www.tianocore.org/udk2014/
>>> -S: Supported
>>> +W: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-
>Release-Planning
>>>
>>>  EDK II Packages:
>>>  
>
>Reviewed-by: Laszlo Ersek 
>
>Thanks
>Laszlo
>
>___
>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] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

2018-11-08 Thread Gao, Liming
Ard:
  This is a small fix. And, this patch is sent before the hard freeze. It is 
the low risk for this release. So, I push it. 

Thanks
Liming
>-Original Message-
>From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>Sent: Friday, November 09, 2018 2:25 AM
>To: Zeng, Star 
>Cc: Bi, Dandan ; edk2-devel@lists.01.org; Wu, Hao A
>; Dong, Eric ; Gao, Liming
>
>Subject: Re: [edk2] [patch] MdeModulePkg/DisplayEngine: Remove useless
>NULL ptr check for NewPos
>
>On 8 November 2018 at 02:09, Zeng, Star  wrote:
>> Reviewed-by: Star Zeng 
>>
>> -Original Message-
>> From: Bi, Dandan
>> Sent: Wednesday, November 7, 2018 10:53 PM
>> To: edk2-devel@lists.01.org
>> Cc: Gao, Liming ; Dong, Eric ;
>Zeng, Star ; Wu, Hao A 
>> Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr
>check for NewPos
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1306
>>
>> In function UiDisplayMenu, the NewPos ptr which used to point to the
>highlight menu entry. It will always point to the menu entry which need to be
>highlighted or the gMenuOption menu if the highlight menu is not found.
>> So we can remove the NULL ptr check for NewPos in this function.
>> And add the ASSERT code to avoid if any false positive reports of NULL
>pointer dereference issue raised from static analysis.
>>
>> Cc: Liming Gao 
>> Cc: Eric Dong 
>> Cc: Star Zeng 
>> Cc: Hao Wu 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Dandan Bi 
>
>Why was this patch merged today? Surely, this doesn't meet the hard
>freeze requirements ?
>
>> ---
>>  MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>> index 7390f954b6..44f087fe01 100644
>> --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>> +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
>> @@ -2880,10 +2880,11 @@ UiDisplayMenu (
>>// MenuOption is set to NULL in Repaint
>>// NewPos: Current menu option that need to hilight
>>//
>>ControlFlag = CfUpdateHelpString;
>>
>> +  ASSERT (NewPos != NULL);
>>UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
>>
>>if (SkipHighLight) {
>>  SkipHighLight = FALSE;
>>  MenuOption= SavedMenuOption;
>> @@ -2908,11 +2909,11 @@ UiDisplayMenu (
>>  Temp2 = SkipValue;
>>} else {
>>  Temp2 = 0;
>>}
>>
>> -  if (NewPos != NULL && (MenuOption == NULL || NewPos !=
>>Link)) {
>> +  if (MenuOption == NULL || NewPos != >Link) {
>>  if (MenuOption != NULL) {
>>//
>>// Remove the old highlight menu.
>>//
>>Status = DisplayOneMenu (MenuOption,
>> --
>> 2.18.0.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 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

2018-11-08 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Source/C/Common/Decompress.c   | 6 ++
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/BaseTools/Source/C/Common/Decompress.c 
b/BaseTools/Source/C/Common/Decompress.c
index 71313b1179..33e0f0d160 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -662,6 +662,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+return ;
+  }
 }
   }
 
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 2d6fc4c952..a77f6798ec 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2682,6 +2682,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+goto Done ;
+  }
 }
   }
 
-- 
2.16.2.windows.1

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


[edk2] [Patch 3/3] IntelFrameworkModulePkg: Fix UEFI and Tiano Decompression logic issue

2018-11-08 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by 684db6da64bc7b5faee4e1174e801c245f563b5c.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
 | 6 ++
 1 file changed, 6 insertions(+)

diff --git 
a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
 
b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
index 3a07c3..970795b1da 100644
--- 
a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
+++ 
b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
@@ -634,6 +634,12 @@ Decode (
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+goto Done ;
+  }
 }
   }
 
-- 
2.16.2.windows.1

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


[edk2] [Patch 2/3] MdePkg BaseUefiDecompressLib: Fix UEFI Decompression logic issue

2018-11-08 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by 2ec7953d49677142c5f7552e9e3d96fb406ba0c4.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Michael Kinney 
---
 MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c 
b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index 9fc637e058..c1e8c5581a 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -641,6 +641,12 @@ Decode (
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+goto Done;
+  }
 }
   }
 
-- 
2.16.2.windows.1

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


[edk2] [Patch 0/3] Fix UEFI and Tiano Decompression logic issue

2018-11-08 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by previous change with more checkers in 
UefiDecompress. In Decode() function, once mOutBuf is fully filled, Decode() 
should return. Current logic misses the checker of mOutBuf after while() loop.

Liming Gao (3):
  BaseTools: Fix UEFI and Tiano Decompression logic issue
  MdePkg BaseUefiDecompressLib: Fix UEFI Decompression logic issue
  IntelFrameworkModulePkg: Fix UEFI and Tiano Decompression logic issue

 BaseTools/Source/C/Common/Decompress.c 
 | 6 ++
 BaseTools/Source/C/TianoCompress/TianoCompress.c   
 | 6 ++
 
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
 | 6 ++
 MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c   
 | 6 ++
 4 files changed, 24 insertions(+)

-- 
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 v3 0/2] SortLib for UEFI SEC

2018-11-08 Thread Carsey, Jaben
For the series.
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jeff Brasen
> Sent: Thursday, November 08, 2018 11:04 AM
> To: edk2-devel@lists.01.org
> Cc: Jeff Brasen 
> Subject: [edk2] [PATCH v3 0/2] SortLib for UEFI SEC
> 
> This patch series enables support for BaseSortLib in UEFI SEC Phase.
> This requires the addition of the AllocateZeroPool which is implemented
> in the PrePiMemoryAllocationLib.
> 
> Changelog:
> v1 - Initial version
> v2 - Update order of NULL check in MemoryAllocationLib
> v3 - Switch to ZeroMem from SetMem
> 
> Jeff Brasen (2):
>   EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()
>   MdeModulePkg/BaseSortLib: Enable for all module types
> 
>  .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32
> ++
>  MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf   |  4 +--
>  2 files changed, 34 insertions(+), 2 deletions(-)
> 
> --
> 2.7.4
> 
> ___
> 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 v3 2/2] MdeModulePkg/BaseSortLib: Enable for all module types

2018-11-08 Thread Jeff Brasen
Expose BaseSortLib for use in SEC and PEI phases.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
---
 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
index f807cd7..5bd1aa1 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
@@ -18,9 +18,9 @@
   BASE_NAME  = BaseSortLib
   MODULE_UNI_FILE= BaseSortLib.uni
   FILE_GUID  = 03F3331B-F12D-494f-BF37-E55A657F2497
-  MODULE_TYPE= UEFI_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SortLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = SortLib
 
 #
 #  VALID_ARCHITECTURES   = IA32 X64 EBC
-- 
2.7.4

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


[edk2] [PATCH v3 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

2018-11-08 Thread Jeff Brasen
This function is exposed by the MemoryAllocationLib header.
An AllocateZeroPool() function has been added to fix modules depending on
this library and this function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
---
 .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++
 1 file changed, 32 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c 
b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
index 0e75e23..55e9249 100644
--- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
@@ -16,6 +16,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -195,6 +196,37 @@ AllocatePool (
 }
 
 /**
+  Allocates and zeros a buffer of type EfiBootServicesData.
+
+  Allocates the number bytes specified by AllocationSize of type 
EfiBootServicesData, clears the
+  buffer with zeros, and returns a pointer to the allocated buffer.  If 
AllocationSize is 0, then a
+  valid buffer of 0 size is returned.  If there is not enough memory remaining 
to satisfy the
+  request, then NULL is returned.
+
+  @param  AllocationSizeThe number of bytes to allocate and zero.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocateZeroPool (
+  IN UINTN  AllocationSize
+  )
+{
+  VOID *Buffer;
+
+  Buffer = AllocatePool (AllocationSize);
+  if (Buffer == NULL) {
+return NULL;
+  }
+
+  ZeroMem (Buffer, AllocationSize);
+
+  return Buffer;
+}
+
+/**
   Frees a buffer that was previously allocated with one of the pool allocation 
functions in the
   Memory Allocation Library.
 
-- 
2.7.4

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


[edk2] [PATCH v3 0/2] SortLib for UEFI SEC

2018-11-08 Thread Jeff Brasen
This patch series enables support for BaseSortLib in UEFI SEC Phase.
This requires the addition of the AllocateZeroPool which is implemented
in the PrePiMemoryAllocationLib.

Changelog:
v1 - Initial version
v2 - Update order of NULL check in MemoryAllocationLib
v3 - Switch to ZeroMem from SetMem

Jeff Brasen (2):
  EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()
  MdeModulePkg/BaseSortLib: Enable for all module types

 .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++
 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf   |  4 +--
 2 files changed, 34 insertions(+), 2 deletions(-)

-- 
2.7.4

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


[edk2] [PATCH 2/2] MdeModulePkg/SdMmcPciHcDxe: Add V4 64bit ADMA2 support.

2018-11-08 Thread Ashish Singhal
If V4 64 bit address mode is enabled in compatibility register,
program controller to enable V4 host mode and use appropriate
ADMA descriptors supporting 64 bit addresses.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal 
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |   4 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 183 +
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  28 +++-
 3 files changed, 183 insertions(+), 32 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
index c683600..22795df 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
@@ -2,6 +2,7 @@
 
   Provides some data structure definitions used by the SD/MMC host controller 
driver.
 
+Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
 Copyright (c) 2015, 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
@@ -144,7 +145,8 @@ typedef struct {
   BOOLEAN Started;
   UINT64  Timeout;
 
-  SD_MMC_HC_ADMA_DESC_LINE*AdmaDesc;
+  SD_MMC_HC_ADMA_32_DESC_LINE *Adma32Desc;
+  SD_MMC_HC_ADMA_64_DESC_LINE *Adma64Desc;
   EFI_PHYSICAL_ADDRESSAdmaDescPhy;
   VOID*AdmaMap;
   UINT32  AdmaPages;
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index e506875..bcd2707 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -4,6 +4,7 @@
 
   It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use.
 
+  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
   Copyright (c) 2015 - 2017, 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
@@ -418,6 +419,36 @@ SdMmcHcWaitMmioSet (
 }
 
 /**
+  Get the controller version information from the specified slot.
+
+  @param[in]  PciIo   The PCI IO protocol instance.
+  @param[in]  SlotThe slot number of the SD card to send the 
command to.
+  @param[out] Version The buffer to store the version information.
+
+  @retval EFI_SUCCESS The operation executes successfully.
+  @retval Others  The operation fails.
+
+**/
+EFI_STATUS
+SdMmcHcGetControllerVersion (
+  IN EFI_PCI_IO_PROTOCOL  *PciIo,
+  IN UINT8Slot,
+ OUT UINT16   *Version
+  )
+{
+  EFI_STATUSStatus;
+
+  Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CTRL_VER, TRUE, sizeof 
(UINT16), Version);
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  *Version &= 0xFF;
+
+  return EFI_SUCCESS;
+}
+
+/**
   Software reset the specified SD/MMC host controller and enable all 
interrupts.
 
   @param[in] PrivateA pointer to the SD_MMC_HC_PRIVATE_DATA instance.
@@ -776,18 +807,18 @@ SdMmcHcClockSupply (
 
   DEBUG ((DEBUG_INFO, "BaseClkFreq %dMHz Divisor %d ClockFreq %dKhz\n", 
BaseClkFreq, Divisor, ClockFreq));
 
-  Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CTRL_VER, TRUE, sizeof 
(ControllerVer), );
+  Status = SdMmcHcGetControllerVersion (PciIo, Slot, );
   if (EFI_ERROR (Status)) {
 return Status;
   }
   //
   // Set SDCLK Frequency Select and Internal Clock Enable fields in Clock 
Control register.
   //
-  if (((ControllerVer & 0xFF) >= SD_MMC_HC_CTRL_VER_300) &&
-  ((ControllerVer & 0xFF) <= SD_MMC_HC_CTRL_VER_420)) {
+  if ((ControllerVer >= SD_MMC_HC_CTRL_VER_300) &&
+  (ControllerVer <= SD_MMC_HC_CTRL_VER_420)) {
 ASSERT (Divisor <= 0x3FF);
 ClockCtrl = ((Divisor & 0xFF) << 8) | ((Divisor & 0x300) >> 2);
-  } else if (((ControllerVer & 0xFF) == 0) || ((ControllerVer & 0xFF) == 1)) {
+  } else if ((ControllerVer == 0) || (ControllerVer == 1)) {
 //
 // Only the most significant bit can be used as divisor.
 //
@@ -935,6 +966,41 @@ SdMmcHcSetBusWidth (
 }
 
 /**
+  Configure V4 64 bit system address support at initialization.
+
+  @param[in] PciIo  The PCI IO protocol instance.
+  @param[in] Slot   The slot number of the SD card to send the command 
to.
+  @param[in] Capability The capability of the slot.
+
+  @retval EFI_SUCCESS   The clock is supplied successfully.
+
+**/
+EFI_STATUS
+SdMmcHcV4Init64BitSupport (
+  IN EFI_PCI_IO_PROTOCOL*PciIo,
+  IN UINT8  Slot,
+  IN SD_MMC_HC_SLOT_CAP Capability
+  )
+{
+  EFI_STATUSStatus;
+  UINT16HostCtrl2;
+
+  //
+  // Check if V4 64bit support is available
+  //
+  if (Capability.SysBus64V4 == TRUE) {
+

[edk2] [PATCH 1/2] MdeModulePkg/SdMmcPciHcDxe: Declare V4 64 bit address capability

2018-11-08 Thread Ashish Singhal
Add capability declaration for V4.x 64 bit system address support.
This would be used for host controllers working in version 4. Enable
64 bit DMA support in PCI layer if V3 or V4 64 bit support is
enabled in host capability register.

The usage of this new field does not need a guard for version check as
spec for previous SDMMC versions defines this field as reserved with
default value of 0.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal 
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c |  4 ++--
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   |  3 ++-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   | 10 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index bf9869d..1c18ea4 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -617,7 +617,6 @@ SdMmcPciHcDriverBindingStart (
 }
   }
 
-  Support64BitDma = TRUE;
   for (Slot = FirstBar; Slot < (FirstBar + SlotNum); Slot++) {
 Private->Slot[Slot].Enable = TRUE;
 
@@ -638,7 +637,8 @@ SdMmcPciHcDriverBindingStart (
 }
 DumpCapabilityReg (Slot, >Capability[Slot]);
 
-Support64BitDma &= Private->Capability[Slot].SysBus64;
+Support64BitDma = (Private->Capability[Slot].SysBus64V3 |
+   Private->Capability[Slot].SysBus64V4);
 
 Status = SdMmcHcGetMaxCurrent (PciIo, Slot, >MaxCurrent[Slot]);
 if (EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index bedc968..e506875 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -45,7 +45,8 @@ DumpCapabilityReg (
   DEBUG ((DEBUG_INFO, "   Voltage 3.3   %a\n", Capability->Voltage33 ? 
"TRUE" : "FALSE"));
   DEBUG ((DEBUG_INFO, "   Voltage 3.0   %a\n", Capability->Voltage30 ? 
"TRUE" : "FALSE"));
   DEBUG ((DEBUG_INFO, "   Voltage 1.8   %a\n", Capability->Voltage18 ? 
"TRUE" : "FALSE"));
-  DEBUG ((DEBUG_INFO, "   64-bit Sys Bus%a\n", Capability->SysBus64 ? 
"TRUE" : "FALSE"));
+  DEBUG ((DEBUG_INFO, "   V4 64-bit Sys Bus %a\n", Capability->SysBus64V4 ? 
"TRUE" : "FALSE"));
+  DEBUG ((DEBUG_INFO, "   V3 64-bit Sys Bus %a\n", Capability->SysBus64V3 ? 
"TRUE" : "FALSE"));
   DEBUG ((DEBUG_INFO, "   Async Interrupt   %a\n", Capability->AsyncInt ? 
"TRUE" : "FALSE"));
   DEBUG ((DEBUG_INFO, "   SlotType  "));
   if (Capability->SlotType == 0x00) {
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
index 7e3f588..cc138fc 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
@@ -114,24 +114,24 @@ typedef struct {
   UINT32   Voltage33:1;   // bit 24
   UINT32   Voltage30:1;   // bit 25
   UINT32   Voltage18:1;   // bit 26
-  UINT32   Reserved3:1;   // bit 27
-  UINT32   SysBus64:1;// bit 28
+  UINT32   SysBus64V4:1;  // bit 27
+  UINT32   SysBus64V3:1;  // bit 28
   UINT32   AsyncInt:1;// bit 29
   UINT32   SlotType:2;// bit 30:31
   UINT32   Sdr50:1;   // bit 32
   UINT32   Sdr104:1;  // bit 33
   UINT32   Ddr50:1;   // bit 34
-  UINT32   Reserved4:1;   // bit 35
+  UINT32   Reserved3:1;   // bit 35
   UINT32   DriverTypeA:1; // bit 36
   UINT32   DriverTypeC:1; // bit 37
   UINT32   DriverTypeD:1; // bit 38
   UINT32   DriverType4:1; // bit 39
   UINT32   TimerCount:4;  // bit 40:43
-  UINT32   Reserved5:1;   // bit 44
+  UINT32   Reserved4:1;   // bit 44
   UINT32   TuningSDR50:1; // bit 45
   UINT32   RetuningMod:2; // bit 46:47
   UINT32   ClkMultiplier:8;   // bit 48:55
-  UINT32   Reserved6:7;   // bit 56:62
+  UINT32   Reserved5:7;   // bit 56:62
   UINT32   Hs400:1;   // bit 63
 } SD_MMC_HC_SLOT_CAP;
 
-- 
2.7.4

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


Re: [edk2] [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:09, Zeng, Star  wrote:
> Reviewed-by: Star Zeng 
>
> -Original Message-
> From: Bi, Dandan
> Sent: Wednesday, November 7, 2018 10:53 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Dong, Eric ; 
> Zeng, Star ; Wu, Hao A 
> Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check 
> for NewPos
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1306
>
> In function UiDisplayMenu, the NewPos ptr which used to point to the 
> highlight menu entry. It will always point to the menu entry which need to be 
> highlighted or the gMenuOption menu if the highlight menu is not found.
> So we can remove the NULL ptr check for NewPos in this function.
> And add the ASSERT code to avoid if any false positive reports of NULL 
> pointer dereference issue raised from static analysis.
>
> Cc: Liming Gao 
> Cc: Eric Dong 
> Cc: Star Zeng 
> Cc: Hao Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 

Why was this patch merged today? Surely, this doesn't meet the hard
freeze requirements ?

> ---
>  MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c 
> b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
> index 7390f954b6..44f087fe01 100644
> --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
> +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
> @@ -2880,10 +2880,11 @@ UiDisplayMenu (
>// MenuOption is set to NULL in Repaint
>// NewPos: Current menu option that need to hilight
>//
>ControlFlag = CfUpdateHelpString;
>
> +  ASSERT (NewPos != NULL);
>UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
>
>if (SkipHighLight) {
>  SkipHighLight = FALSE;
>  MenuOption= SavedMenuOption;
> @@ -2908,11 +2909,11 @@ UiDisplayMenu (
>  Temp2 = SkipValue;
>} else {
>  Temp2 = 0;
>}
>
> -  if (NewPos != NULL && (MenuOption == NULL || NewPos != 
> >Link)) {
> +  if (MenuOption == NULL || NewPos != >Link) {
>  if (MenuOption != NULL) {
>//
>// Remove the old highlight menu.
>//
>Status = DisplayOneMenu (MenuOption,
> --
> 2.18.0.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 edk2-platforms 14/27] Silicon/NXP: Add i.MX6 GPT and EPIT timer headers

2018-11-08 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:05AM +, Chris Co wrote:
> This adds the definitions for the NXP i.MX6 General Purpose Timer
> and the Enhanced Periodic Interrupt Timer modules.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Include/common_epit.h | 118 +
>  Silicon/NXP/iMX6Pkg/Include/common_gpt.h  | 271 
>  2 files changed, 389 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Include/common_epit.h 
> b/Silicon/NXP/iMX6Pkg/Include/common_epit.h
> new file mode 100644
> index ..485d6ccbc51e
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Include/common_epit.h

Rename to CamelCase?

> @@ -0,0 +1,118 @@
> +/** @file
> +*
> +*  Provides definitions for the EPIT (Enhanced Periodic Interrupt Timer)
> +*  module that are common to Freescale SoCs.
> +*
> +*  Copyright (c) 2018 Microsoft Corporation. All rights reserved.
> +*  Copyright (c) 2004-2010, Freescale Semiconductor, Inc. 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 __COMMON_EPIT_H
> +#define __COMMON_EPIT_H

COMMON is a bit too common. Can we at least stick an IMX on the front?

This is really also a problem for all of the structs and #defines
below as well.

> +
> +typedef struct {
> +  UINT32 CR;
> +  UINT32 SR;
> +  UINT32 LR;
> +  UINT32 CMPR;
> +  UINT32 CNT;
> +} CSP_EPIT_REG, *PCSP_EPIT_REG;

I'm really not a fan of typedef pointers. Please drop the *PSCP one.

> +
> +#define EPIT_CR_OFFSET  0x
> +#define EPIT_SR_OFFSET  0x0004
> +#define EPIT_LR_OFFSET  0x0008
> +#define EPIT_CMPR_OFFSET0x000C
> +#define EPIT_CNR_OFFSET 0x0010
> +
> +#define EPIT_CR_EN_LSH  0

What is LSH?

> +#define EPIT_CR_ENMOD_LSH   1
> +#define EPIT_CR_OCIEN_LSH   2
> +#define EPIT_CR_RLD_LSH 3
> +#define EPIT_CR_PRESCALAR_LSH   4
> +#define EPIT_CR_SWR_LSH 16
> +#define EPIT_CR_IOVW_LSH17
> +#define EPIT_CR_DBGEN_LSH   18
> +#define EPIT_CR_WAITEN_LSH  19
> +#define EPIT_CR_DOZEN_LSH   20
> +#define EPIT_CR_STOPEN_LSH  21
> +#define EPIT_CR_OM_LSH  22
> +#define EPIT_CR_CLKSRC_LSH  24
> +
> +#define EPIT_SR_OCIF_LSH0
> +#define EPIT_LR_LOAD_LSH0
> +#define EPIT_CMPR_COMPARE_LSH   0
> +#define EPIT_CNT_COUNT_LSH  0
> +
> +#define EPIT_CR_EN_WID  1

What is WID?

> +#define EPIT_CR_ENMOD_WID   1
> +#define EPIT_CR_OCIEN_WID   2
> +#define EPIT_CR_RLD_WID 1
> +#define EPIT_CR_PRESCALAR_WID   12
> +#define EPIT_CR_SWR_WID 1
> +#define EPIT_CR_IOVW_WID1
> +#define EPIT_CR_DBGEN_WID   1
> +#define EPIT_CR_WAITEN_WID  1
> +#define EPIT_CR_DOZEN_WID   1
> +#define EPIT_CR_STOPEN_WID  1
> +#define EPIT_CR_OM_WID  2
> +#define EPIT_CR_CLKSRC_WID  2
> +
> +#define EPIT_SR_OCIF_WID1
> +#define EPIT_LR_LOAD_WID32
> +#define EPIT_CMPR_COMPARE_WID   32
> +#define EPIT_CNT_COUNT_WID  32
> +
> +// CR
> +#define EPIT_CR_EN_DISABLE  0
> +#define EPIT_CR_EN_ENABLE   1
> +
> +#define EPIT_CR_ENMOD_RESUME0
> +#define EPIT_CR_ENMOD_LOAD  1
> +
> +#define EPIT_CR_OCIEN_DISABLE   0
> +#define EPIT_CR_OCIEN_ENABLE1
> +
> +#define EPIT_CR_RLD_ROLLOVER0
> +#define EPIT_CR_RLD_RELOAD  1
> +
> +#define EPIT_CR_SWR_NORESET 0
> +#define EPIT_CR_SWR_RESET   1
> +
> +#define EPIT_CR_IOVW_NOOVR  0
> +#define EPIT_CR_IOVW_OVR1
> +
> +#define EPIT_CR_DBGEN_INACTIVE  0
> +#define EPIT_CR_DBGEN_ACTIVE1
> +
> +#define EPIT_CR_WAITEN_DISABLE  0
> +#define EPIT_CR_WAITEN_ENABLE   1
> +
> +#define EPIT_CR_DOZEN_DISABLE   0
> +#define EPIT_CR_DOZEN_ENABLE1
> +
> +#define EPIT_CR_STOPEN_DISABLE  0
> +#define EPIT_CR_STOPEN_ENABLE   1
> +
> +#define EPIT_CR_OM_DICONNECT0
> +#define EPIT_CR_OM_TOGGLE   1
> +#define EPIT_CR_OM_CLEAR2
> +#define EPIT_CR_OM_SET  3
> +
> +#define EPIT_CR_CLKSRC_OFF  0
> +#define EPIT_CR_CLKSRC_IPGCLK   1
> +#define EPIT_CR_CLKSRC_HIGHFREQ 2   // High freq is sourcing from PERCLK
> +#define EPIT_CR_CLKSRC_CKIL 3
> +
> +// CNT
> +#define EPIT_CNT_COUNT_MAX  0x

MAX_UINT32?

> +
> +#endif // __COMMON_EPIT_H
> diff --git a/Silicon/NXP/iMX6Pkg/Include/common_gpt.h 
> b/Silicon/NXP/iMX6Pkg/Include/common_gpt.h
> new file mode 100644

Re: [edk2] [PATCH edk2-platforms 12/27] Silicon/NXP: Add i.MX6 I/O MUX library

2018-11-08 Thread Leif Lindholm
On Fri, Sep 21, 2018 at 08:26:03AM +, Chris Co wrote:
> This adds support for initializing and manipulating the I/O Pads
> on NXP i.MX6 SoCs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Christopher Co 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> ---
>  Silicon/NXP/iMX6Pkg/Library/iMX6IoMuxLib/iMX6IoMux.c  | 151 
> 
>  Silicon/NXP/iMX6Pkg/Library/iMX6IoMuxLib/iMX6IoMuxLib.inf |  41 ++
>  2 files changed, 192 insertions(+)
> 
> diff --git a/Silicon/NXP/iMX6Pkg/Library/iMX6IoMuxLib/iMX6IoMux.c 
> b/Silicon/NXP/iMX6Pkg/Library/iMX6IoMuxLib/iMX6IoMux.c
> new file mode 100644
> index ..7c0c7b54a2fe
> --- /dev/null
> +++ b/Silicon/NXP/iMX6Pkg/Library/iMX6IoMuxLib/iMX6IoMux.c
> @@ -0,0 +1,151 @@
> +/** @file
> +*
> +*  Copyright (c) 2018 Microsoft 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 
> +#include 
> +
> +// Muxing functions
> +VOID
> +ImxPadConfig (
> +  IN  IMX_PAD Pad,
> +  IN  IMX_PADCFG  PadConfig

I'll get back to reviewing patch 11 at some point, but that one is
hard going. So I'll point out here what I'll mention then:
Please just use UINT64. Typedefs are useful to reduce pointless
repetition for structs, but here it just obscures what is
programatically going on.

> +  )
> +{
> +  // Configure Mux Control
> +  MmioWrite32 (
> +IMX_IOMUXC_BASE + _IMX_PAD_MUX_OFFSET (Pad),
> +_IMX_PADCFG_MUX_CTL (PadConfig));

It would be worth adding macros or simple accessor functions for these -
there's a lot of text in this file that has no semantic value and
needs to be manually filtered when reading.

I.e. IomuxWrite32 (Pad, ...), IomuxRead32 (Pad), ...

Other comment really belonging to 11:
Please drop leading _ from macros. Such macros are intended for
internal use by toolchains.

> +
> +  // Configure Select Input Control
> +  if (_IMX_PADCFG_SEL_INP (PadConfig) != 0) {
> +DEBUG ((DEBUG_INFO, "Setting INPUT_SELECT %x value %x\n",
> +_IMX_SEL_INP_REGISTER (_IMX_PADCFG_SEL_INP (PadConfig)),
> +_IMX_SEL_INP_VALUE (_IMX_PADCFG_SEL_INP (PadConfig;
> +
> +MmioWrite32 (
> +  _IMX_SEL_INP_REGISTER (_IMX_PADCFG_SEL_INP (PadConfig)),
> +  _IMX_SEL_INP_VALUE (_IMX_PADCFG_SEL_INP (PadConfig)));
> +  }
> +
> +  // Configure Pad Control
> +  MmioWrite32 (
> +IMX_IOMUXC_BASE + _IMX_PAD_CTL_OFFSET (Pad),
> +_IMX_PADCFG_PAD_CTL (PadConfig));
> +}
> +
> +VOID
> +ImxPadDumpConfig (
> +  IN  CHAR8 *SignalFriendlyName,
> +  IN  IMX_PAD Pad
> +  )
> +{
> +  IMX_IOMUXC_MUX_CTL  MuxCtl;
> +  IMX_IOMUXC_PAD_CTL  PadCtl;
> +
> +  MuxCtl.AsUint32 = MmioRead32 (
> +  IMX_IOMUXC_BASE + _IMX_PAD_MUX_OFFSET (Pad));
> +
> +  DEBUG ((
> +   DEBUG_INIT,
> +   "- %a MUX_CTL(0x%p)=0x%08x: MUX_MODE:%d SION:%d | ",
> +   SignalFriendlyName,
> +   IMX_IOMUXC_BASE + _IMX_PAD_MUX_OFFSET (Pad),
> +   MuxCtl.AsUint32,
> +   MuxCtl.Fields.MUX_MODE,
> +   MuxCtl.Fields.SION));
> +
> +  PadCtl.AsUint32 = MmioRead32 (
> +  IMX_IOMUXC_BASE + _IMX_PAD_CTL_OFFSET (Pad));
> +
> +  DEBUG ((
> +   DEBUG_INIT,
> +   "PAD_CTL(0x%p)=0x%08x: SRE:%d DSE:%d SPEED:%d ODE:%d PKE:%d 
> PUE:%d PUS:%d HYS:%d\n",
> +   IMX_IOMUXC_BASE + _IMX_PAD_CTL_OFFSET (Pad),
> +   PadCtl.AsUint32,
> +   PadCtl.Fields.SRE,
> +   PadCtl.Fields.DSE,
> +   PadCtl.Fields.SPEED,
> +   PadCtl.Fields.ODE,
> +   PadCtl.Fields.PKE,
> +   PadCtl.Fields.PUE,
> +   PadCtl.Fields.PUS,
> +   PadCtl.Fields.HYS));
> +}
> +
> +// GPIO functions
> +VOID
> +ImxGpioDirection (
> +  IN  IMX_GPIO_BANK   Bank,
> +  IN  UINT32  IoNumber,
> +  IN  IMX_GPIO_DIRDirection
> +  )
> +{
> +  volatile IMX_GPIO_REGISTERS   *gpioRegisters;

What makes this pointer volatile?
(Hint: drop it, it does nothing useful here.)

That initial 'g', following EDK2 naming rules, says that this is a
variable in the global namespace, exported from this module. It should
be GpioRegisters.

> +
> +  ASSERT (IoNumber < 32);

That 32 needs a #define.

> +
> +  gpioRegisters = (IMX_GPIO_REGISTERS *) IMX_GPIO_BASE;
> +  if (Direction == IMX_GPIO_DIR_INPUT) {
> +MmioAnd32 ((UINTN) >Banks[Bank - 1].GDIR, ~ (1 << 
> IoNumber));

This 'Bank - 1' stuff looks a bit scary. Why aren't we passing the
inde to use? A comment block before the function could explain 

Re: [edk2] [Patch 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Separate semaphore container.

2018-11-08 Thread Laszlo Ersek
On 11/08/18 14:33, Laszlo Ersek wrote:
> On 11/08/18 03:58, Eric Dong wrote:
>> In current implementation, core level semaphore use same container
>> with package level semaphore. This design will let the core level
>> semaphore not works as expected in below case:
>> 1. Feature A has CPU_FEATURE_CORE_BEFORE dependence with Feature B.
>> 2. Feature C has CPU_FEATURE_PACKAGE_AFTER dependence with Feature B.
>> in this case an core level semaphore will be add between A and B, and
>> an package level semaphore will be add between B and C.
>>
>> For a CPU has one package, two cores and 4 threads. Execute like below:
>>
>>   Thread 1  Thread 2. Thread 4
>> ReleaseSemaph(1,2)  -|
>> WaitForSemaph(1(2)) -|<---These two are Core Semaph
>>   ReleaseSemaph(1,2) -|
>>   WaitForSemaph(2)   -| <---  Core Semaph
>>
>> ReleaseSemaph (1,2,3,4) -|
>> WaitForSemaph (1(4))-| <  Package Semaph
>>
>>   ReleaseSemaph(3,4)
>>   WaitForSemaph(4(2)) <- Core Semaph
>>
>> In above case, for thread 4, when it executes a core semaphore, i will
>> found WaitForSemaph(4(2)) is met because Thread 1 has execute a package
>> semaphore and ReleaseSemaph(4) for it before. This is not an expect
>> behavior. Thread 4 should wait for thread 3 to do this.
>>
>> Fix this issue by separate the semaphore container for core level and
>> package level.
>>
>> Cc: Laszlo Ersek 
>> Cc: Ruiyu Ni 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Eric Dong 
>> ---
>>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 ++---
>>  1 file changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c 
>> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>> index a45e2dd3d7..65461485a4 100644
>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
>> @@ -41,9 +41,10 @@ typedef struct {
>>  // Flags used when program the register.
>>  //
>>  typedef struct {
>> -  volatile UINTN   ConsoleLogLock;   // Spinlock used to 
>> control console.
>> -  volatile UINTN   MemoryMappedLock; // Spinlock used to 
>> program mmio
>> -  volatile UINT32  *SemaphoreCount;  // Semaphore used to 
>> program semaphore.
>> +  volatile UINTN   ConsoleLogLock;  // Spinlock used to 
>> control console.
>> +  volatile UINTN   MemoryMappedLock;// Spinlock used to 
>> program mmio
>> +  volatile UINT32  *CoreSemaphoreCount; // Semaphore used to 
>> program semaphore.
>> +  volatile UINT32  *PackageSemaphoreCount;  // Semaphore used to 
>> program semaphore.
>>  } PROGRAM_CPU_REGISTER_FLAGS;
>>  
>>  //
>> @@ -348,11 +349,12 @@ ProgramProcessorRegister (
>>ASSERT (
>>  (ApLocation != NULL) &&
>>  (CpuStatus->ValidCoreCountPerPackage != 0) &&
>> -(CpuFlags->SemaphoreCount) != NULL
>> +(CpuFlags->CoreSemaphoreCount != NULL) &&
>> +(CpuFlags->PackageSemaphoreCount != NULL)
>>  );
>> -  SemaphorePtr = CpuFlags->SemaphoreCount;
>>switch (RegisterTableEntry->Value) {
>>case CoreDepType:
>> +SemaphorePtr = CpuFlags->CoreSemaphoreCount;
>>  //
>>  // Get Offset info for the first thread in the core which current 
>> thread belongs to.
>>  //
>> @@ -373,6 +375,7 @@ ProgramProcessorRegister (
>>  break;
>>  
>>case PackageDepType:
>> +SemaphorePtr = CpuFlags->PackageSemaphoreCount;
>>  ValidCoreCountPerPackage = (UINT32 
>> *)(UINTN)CpuStatus->ValidCoreCountPerPackage;
>>  //
>>  // Get Offset info for the first thread in the package which 
>> current thread belongs to.
>> @@ -1037,10 +1040,14 @@ GetAcpiCpuData (
>>  ASSERT (mAcpiCpuData.ApLocation != 0);
>>}
>>if (CpuStatus->PackageCount != 0) {
>> -mCpuFlags.SemaphoreCount = AllocateZeroPool (
>> +mCpuFlags.CoreSemaphoreCount = AllocateZeroPool (
>>   sizeof (UINT32) * CpuStatus->PackageCount *
>>   CpuStatus->MaxCoreCount * 
>> CpuStatus->MaxThreadCount);
>> -ASSERT (mCpuFlags.SemaphoreCount != NULL);
>> +ASSERT (mCpuFlags.CoreSemaphoreCount != NULL);
>> +mCpuFlags.PackageSemaphoreCount = AllocateZeroPool (
>> + sizeof (UINT32) * CpuStatus->PackageCount *
>> + CpuStatus->MaxCoreCount * 
>> CpuStatus->MaxThreadCount);
>> +ASSERT (mCpuFlags.PackageSemaphoreCount != NULL);
>>}
>>InitializeSpinLock((SPIN_LOCK*) );
>>InitializeSpinLock((SPIN_LOCK*) );
>>
> 
> The patch looks OK, superficially speaking.
> 
> Also this looks like a bugfix to a new feature already committed in this
> development cycle, so I think it may go in during the hard feature freeze.
> 
> I have some requests (no need to repost):

[edk2] [PATCH] ArmPkg/ArmScmiDxe: Add clock enable function

2018-11-08 Thread Jeff Brasen
Add function to allow enabling and disabling of the clock using the SCMI
interface. Update the protocol GUID as the protocol interface has
changed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Grish Pathak 
---
 ArmPkg/ArmPkg.dec  |  2 +-
 .../ArmScmiDxe/ArmScmiClockProtocolPrivate.h   |  7 +++
 ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c  | 50 +-
 ArmPkg/Include/Protocol/ArmScmiClockProtocol.h | 21 -
 4 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 84e57a0..a7b55a1 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -57,7 +57,7 @@
 
   ## Arm System Control and Management Interface(SCMI) Clock management 
protocol
   ## ArmPkg/Include/Protocol/ArmScmiClockProtocol.h
-  gArmScmiClockProtocolGuid = { 0x91ce67a8, 0xe0aa, 0x4012, { 0xb9, 0x9f, 
0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa } }
+  gArmScmiClockProtocolGuid = { 0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 
0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } }
 
   ## Arm System Control and Management Interface(SCMI) Clock management 
protocol
   ## ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
diff --git a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h 
b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
index 0d1ec6f..c135bac 100644
--- a/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
+++ b/ArmPkg/Drivers/ArmScmiDxe/ArmScmiClockProtocolPrivate.h
@@ -59,6 +59,13 @@ typedef struct {
   CLOCK_RATE_DWORD Rate;
 } CLOCK_RATE_SET_ATTRIBUTES;
 
+
+// Message parameters for CLOCK_CONFIG_SET command.
+typedef struct {
+  UINT32 ClockId;
+  UINT32 Attributes;
+} CLOCK_CONFIG_SET_ATTRIBUTES;
+
 //  if ClockAttr Bit[0] is set then clock device is enabled.
 #define CLOCK_ENABLE_MASK 0x1
 #define CLOCK_ENABLED(ClockAttr)  ((ClockAttr & CLOCK_ENABLE_MASK) == 1)
diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c 
b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c
index 64d2afa..493eb45 100644
--- a/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c
+++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiClockProtocol.c
@@ -388,6 +388,53 @@ ClockRateSet (
   return Status;
 }
 
+/** Enable/Disable specified clock.
+
+  @param[in]  ThisA Pointer to SCMI_CLOCK_PROTOCOL Instance.
+  @param[in]  ClockId Identifier for the clock device.
+  @param[in]  Enable  TRUE to enable, FALSE to disable.
+
+  @retval EFI_SUCCESS  Clock enable/disable successful.
+  @retval EFI_DEVICE_ERROR SCP returns an SCMI error.
+  @retval !(EFI_SUCCESS)   Other errors.
+**/
+STATIC
+EFI_STATUS
+ClockEnable (
+  IN SCMI_CLOCK_PROTOCOL  *This,
+  IN UINT32   ClockId,
+  IN BOOLEAN  Enable
+  )
+{
+  EFI_STATUS  Status;
+  CLOCK_CONFIG_SET_ATTRIBUTES *ClockConfigSetAttributes;
+  SCMI_COMMANDCmd;
+  UINT32  PayloadLength;
+
+  Status = ScmiCommandGetPayload ((UINT32**));
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  // Fill arguments for clock protocol command.
+  ClockConfigSetAttributes->ClockId= ClockId;
+  ClockConfigSetAttributes->Attributes = Enable ? BIT0 : 0;
+
+  Cmd.ProtocolId = SCMI_PROTOCOL_ID_CLOCK;
+  Cmd.MessageId  = SCMI_MESSAGE_ID_CLOCK_CONFIG_SET;
+
+  PayloadLength = sizeof (CLOCK_CONFIG_SET_ATTRIBUTES);
+
+  // Execute and wait for response on a SCMI channel.
+  Status = ScmiCommandExecute (
+ ,
+ ,
+ NULL
+ );
+
+  return Status;
+}
+
 // Instance of the SCMI clock management protocol.
 STATIC CONST SCMI_CLOCK_PROTOCOL ScmiClockProtocol = {
   ClockGetVersion,
@@ -395,7 +442,8 @@ STATIC CONST SCMI_CLOCK_PROTOCOL ScmiClockProtocol = {
   ClockGetClockAttributes,
   ClockDescribeRates,
   ClockRateGet,
-  ClockRateSet
+  ClockRateSet,
+  ClockEnable
  };
 
 /** Initialize clock management protocol and install protocol on a given 
handle.
diff --git a/ArmPkg/Include/Protocol/ArmScmiClockProtocol.h 
b/ArmPkg/Include/Protocol/ArmScmiClockProtocol.h
index 3db26cb..d367f37 100644
--- a/ArmPkg/Include/Protocol/ArmScmiClockProtocol.h
+++ b/ArmPkg/Include/Protocol/ArmScmiClockProtocol.h
@@ -21,7 +21,7 @@
 #include 
 
 #define ARM_SCMI_CLOCK_PROTOCOL_GUID { \
-  0x91ce67a8, 0xe0aa, 0x4012, {0xb9, 0x9f, 0xb6, 0xfc, 0xf3, 0x4, 0x8e, 0xaa} \
+  0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf 
} \
   }
 
 extern EFI_GUID gArmScmiClockProtocolGuid;
@@ -205,6 +205,24 @@ EFI_STATUS
   IN UINT64   Rate
   );
 
+/** Enable/Disable specified clock.
+
+  @param[in]  ThisA Pointer to SCMI_CLOCK_PROTOCOL Instance.
+  @param[in]  ClockId Identifier for the clock device.
+  @param[in]  Enable  TRUE to enable, FALSE to disable.
+
+  @retval EFI_SUCCESS  Clock enable/disable successful.
+  @retval EFI_DEVICE_ERROR SCP returns an SCMI error.
+  @retval 

Re: [edk2] [PATCH v2 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

2018-11-08 Thread Laszlo Ersek
On 11/08/18 18:09, Jeff Brasen wrote:
> This function is exposed by the MemoryAllocationLib header.
> An AllocateZeroPool() function has been added to fix modules depending on
> this library and this function.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen 
> ---
>  .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 
> ++
>  1 file changed, 32 insertions(+)
> 
> diff --git 
> a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c 
> b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> index 0e75e23..c39d140 100644
> --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> @@ -16,6 +16,7 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -195,6 +196,37 @@ AllocatePool (
>  }
>  
>  /**
> +  Allocates and zeros a buffer of type EfiBootServicesData.
> +
> +  Allocates the number bytes specified by AllocationSize of type 
> EfiBootServicesData, clears the
> +  buffer with zeros, and returns a pointer to the allocated buffer.  If 
> AllocationSize is 0, then a
> +  valid buffer of 0 size is returned.  If there is not enough memory 
> remaining to satisfy the
> +  request, then NULL is returned.
> +
> +  @param  AllocationSizeThe number of bytes to allocate and zero.
> +
> +  @return A pointer to the allocated buffer or NULL if allocation fails.
> +
> +**/
> +VOID *
> +EFIAPI
> +AllocateZeroPool (
> +  IN UINTN  AllocationSize
> +  )
> +{
> +  VOID *Buffer;
> +
> +  Buffer = AllocatePool (AllocationSize);
> +  if (Buffer == NULL) {
> +return NULL;
> +  }
> +
> +  SetMem (Buffer, AllocationSize, 0);
> +
> +  return Buffer;
> +}
> +
> +/**
>Frees a buffer that was previously allocated with one of the pool 
> allocation functions in the
>Memory Allocation Library.
>  
> 

Drive-by comment: can you use ZeroMem()? It's a tiny bit more idiomatic.

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


Re: [edk2] [Patch] Maintainers.txt: Update EDK II Releases to EDK-II-Release-Planning wiki

2018-11-08 Thread Laszlo Ersek
On 11/08/18 18:13, Leif Lindholm wrote:
> I'm generally happy with this if the rest of you are?
> 
> Reviewed-by: Leif Lindholm 
> 
> /
> Leif
> 
> On Thu, Nov 08, 2018 at 10:49:34PM +0800, Liming Gao wrote:
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Liming Gao 
>> ---
>>  Maintainers.txt | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/Maintainers.txt b/Maintainers.txt
>> index 6c9156169a..fc183d6477 100644
>> --- a/Maintainers.txt
>> +++ b/Maintainers.txt
>> @@ -51,9 +51,7 @@ W: 
>> https://github.com/tianocore/tianocore.github.io/wiki/Security
>>  
>>  EDK II Releases:
>>  
>> -UDK2014
>> -W: http://www.tianocore.org/udk2014/
>> -S: Supported
>> +W: 
>> https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning
>>  
>>  EDK II Packages:
>>  

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

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


[edk2] [edk2-wiki PATCH] release planning: announce the soft and hard feature freezes

2018-11-08 Thread Laszlo Ersek
Add a paragraph to each of the SoftFeatureFreeze and HardFeatureFreeze
articles about the respective announcements on edk2-devel.

Cc: Andrew Fish 
Cc: Brian Richardson 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Michael Kinney 
Cc: Stephano Cetola 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
Check out the rendered pages in my clone of the wiki:

https://github.com/lersek/edk2/wiki/SoftFeatureFreeze
https://github.com/lersek/edk2/wiki/HardFeatureFreeze

 HardFeatureFreeze.md | 8 
 SoftFeatureFreeze.md | 8 
 2 files changed, 16 insertions(+)

diff --git a/HardFeatureFreeze.md b/HardFeatureFreeze.md
index 01288dd03f71..e08f4c047e8d 100644
--- a/HardFeatureFreeze.md
+++ b/HardFeatureFreeze.md
@@ -4,3 +4,11 @@ tag](EDK-II#stable-tags).
 
 (This definition is modeled after QEMU's [hard feature
 freeze](https://wiki.qemu.org/Planning/HardFeatureFreeze)).
+
+# Announcing the hard feature freeze
+
+The proposed schedule for the active development cycle is shown in the [EDK II
+Release Planning](EDK-II-Release-Planning) article. Shortly before the hard
+feature freeze, an announcement email is sent to the
+[edk2-devel](https://lists.01.org/mailman/listinfo/edk2-devel) mailing list; by
+default by [Liming Gao](https://github.com/lgao4/).
diff --git a/SoftFeatureFreeze.md b/SoftFeatureFreeze.md
index 9dc7d9c19369..e33dd80ccbee 100644
--- a/SoftFeatureFreeze.md
+++ b/SoftFeatureFreeze.md
@@ -40,3 +40,11 @@ communicate with the maintainer about their intentions. It 
also helps if you:
 
 (This definition is modeled after QEMU's [soft feature
 freeze](https://wiki.qemu.org/Planning/SoftFeatureFreeze).)
+
+# Announcing the soft feature freeze
+
+The proposed schedule for the active development cycle is shown in the [EDK II
+Release Planning](EDK-II-Release-Planning) article. Shortly before the soft
+feature freeze, an announcement email is sent to the
+[edk2-devel](https://lists.01.org/mailman/listinfo/edk2-devel) mailing list; by
+default by [Liming Gao](https://github.com/lgao4/).
-- 
2.19.1.3.g30247aa5d201

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


Re: [edk2] Soft Feature Freeze has started since Nov.1 for dk2-stable201811

2018-11-08 Thread Laszlo Ersek
On 11/08/18 14:57, Gao, Liming wrote:
> Laszlo:
>   Please list my name (Liming Gao ) as the sender. 

Thanks. In the first version, I'm going to add a link to your github
user page instead; I don't think we should directly expose your email
address in a wiki article.

Thanks!
Laszlo


>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Thursday, November 8, 2018 9:10 PM
>> To: Gao, Liming ; Zeng, Star ; 
>> Leif Lindholm 
>> Cc: edk2-devel@lists.01.org; Cetola, Stephano ; 
>> Richardson, Brian ; Kinney,
>> Michael D 
>> Subject: Re: [edk2] Soft Feature Freeze has started since Nov.1 for 
>> dk2-stable201811
>>
>> On 11/08/18 06:39, Gao, Liming wrote:
>>
>>> Laszlo: Thanks for your feedback. We will send the separate announce
>>> mail ahead of the feature freeze date for next release cycle. And, I
>>> suggest to update SoftFeatureFreeze and HardFeatureFreeze wiki page
>>> with the announce mail requirement. For this release, I would like to
>>> dry run this process. So, I will send another  announcement for Hard
>>> Feature Freeze today.
>>
>> I'm happy to update these wiki pages. Whom should I identify in the
>> articles as the expected sender(s) of the announcements?
>>
>> Thanks!
>> Laszlo

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


Re: [edk2] [Patch] Maintainers.txt: Update EDK II Releases to EDK-II-Release-Planning wiki

2018-11-08 Thread Leif Lindholm
I'm generally happy with this if the rest of you are?

Reviewed-by: Leif Lindholm 

/
Leif

On Thu, Nov 08, 2018 at 10:49:34PM +0800, Liming Gao wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Liming Gao 
> ---
>  Maintainers.txt | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 6c9156169a..fc183d6477 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -51,9 +51,7 @@ W: 
> https://github.com/tianocore/tianocore.github.io/wiki/Security
>  
>  EDK II Releases:
>  
> -UDK2014
> -W: http://www.tianocore.org/udk2014/
> -S: Supported
> +W: 
> https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning
>  
>  EDK II Packages:
>  
> -- 
> 2.13.0.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 v2 2/2] MdeModulePkg/BaseSortLib: Enable for all module types

2018-11-08 Thread Jeff Brasen
Expose BaseSortLib for use in SEC and PEI phases.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
---
 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
index f807cd7..5bd1aa1 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
@@ -18,9 +18,9 @@
   BASE_NAME  = BaseSortLib
   MODULE_UNI_FILE= BaseSortLib.uni
   FILE_GUID  = 03F3331B-F12D-494f-BF37-E55A657F2497
-  MODULE_TYPE= UEFI_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SortLib|DXE_DRIVER DXE_RUNTIME_DRIVER 
UEFI_APPLICATION UEFI_DRIVER
+  LIBRARY_CLASS  = SortLib
 
 #
 #  VALID_ARCHITECTURES   = IA32 X64 EBC
-- 
2.7.4

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


[edk2] [PATCH v2 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

2018-11-08 Thread Jeff Brasen
This function is exposed by the MemoryAllocationLib header.
An AllocateZeroPool() function has been added to fix modules depending on
this library and this function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen 
---
 .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++
 1 file changed, 32 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c 
b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
index 0e75e23..c39d140 100644
--- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
@@ -16,6 +16,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -195,6 +196,37 @@ AllocatePool (
 }
 
 /**
+  Allocates and zeros a buffer of type EfiBootServicesData.
+
+  Allocates the number bytes specified by AllocationSize of type 
EfiBootServicesData, clears the
+  buffer with zeros, and returns a pointer to the allocated buffer.  If 
AllocationSize is 0, then a
+  valid buffer of 0 size is returned.  If there is not enough memory remaining 
to satisfy the
+  request, then NULL is returned.
+
+  @param  AllocationSizeThe number of bytes to allocate and zero.
+
+  @return A pointer to the allocated buffer or NULL if allocation fails.
+
+**/
+VOID *
+EFIAPI
+AllocateZeroPool (
+  IN UINTN  AllocationSize
+  )
+{
+  VOID *Buffer;
+
+  Buffer = AllocatePool (AllocationSize);
+  if (Buffer == NULL) {
+return NULL;
+  }
+
+  SetMem (Buffer, AllocationSize, 0);
+
+  return Buffer;
+}
+
+/**
   Frees a buffer that was previously allocated with one of the pool allocation 
functions in the
   Memory Allocation Library.
 
-- 
2.7.4

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


[edk2] [PATCH v2 0/2] SortLib for UEFI SEC

2018-11-08 Thread Jeff Brasen
This patch series enables support for BaseSortLib in UEFI SEC Phase.
This requires the addition of the AllocateZeroPool which is implemented
in the PrePiMemoryAllocationLib.

Changelog:
v1 - Initial version
v2 - Update order of NULL check in MemoryAllocationLib

Jeff Brasen (2):
  EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()
  MdeModulePkg/BaseSortLib: Enable for all module types

 .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 ++
 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf   |  4 +--
 2 files changed, 34 insertions(+), 2 deletions(-)

-- 
2.7.4

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


Re: [edk2] Edk2 uni file encoding

2018-11-08 Thread Oram, Isaac W
This info is also somewhat stated in the coding standards.  
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Specifications 

5.1.3 Files may only contain the ASCII characters 0x0A, 0x0D, and 0x20 through 
0x7E
Files should be saved using either ASCII or UTF8 encoding.

It would be good for one of you who knows the detailed differences to clarify 
that text and link to the UNI spec as appropriate.

Regards,
Isaac

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Kinney, 
Michael D
Sent: Thursday, November 8, 2018 8:46 AM
To: Sean Brogan ; Gao, Liming 
; edk2-devel@lists.01.org
Subject: Re: [edk2] Edk2 uni file encoding

Sean,

As a clarification.  The UNI specs does list 2 on-disk formats.
This was done so tools could support both in the transition from UTF-16LE with 
BOM to UTF-8 without BOM.

The strong recommendation is for all EDK II open source packages to use UTF-8 
without a BOM.  Since platform packages not maintained in EDK II could be 
pulling forward UNI files in UTF-16LE, we have not changed the UNI spec or 
tools to consider UTF-16LE as unsupported.

Doing patch email reviews of UNI files in UTF-16LE is a challenge so requiring 
UTF-8 without a BOM make this much easier.

The EDK II open source package conversion to UTF-8 without a BO was performed 
in late 2015.  Here is one example:

https://github.com/tianocore/edk2/commit/3f5287971ffdb5c42e3325a3a94c101f08d3a02a#diff-14d2171dacfcac1fd2e1b1f7b885e530

A helper python script was added to help perform these conversions:

https://github.com/tianocore/edk2/blob/master/BaseTools/Scripts/ConvertUni.py

At some point, it may make sense to *require* UTF-8 without a BOM for all UNI 
files and all tools and for tools to reject UNI files that are not in UTF-8 
without a BOM format.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Sean Brogan via edk2-devel
> Sent: Wednesday, November 7, 2018 11:11 PM
> To: Gao, Liming 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] Edk2 uni file encoding
> 
> Liming,
> That was exactly what I was looking for.
> 
> Thanks
> Sean
> 
> 
> 
> 
> -Original Message-
> From: Gao, Liming 
> Sent: Wednesday, November 7, 2018 10:01 PM
> To: Sean Brogan 
> Cc: edk2-devel@lists.01.org
> Subject: RE: Edk2 uni file encoding
> 
> Sean:
>   EDKII UNI spec
> (https://na01.safelinks.protection.outlook.com/?url=htt
> ps%3A%2F%2Fgithub.com%2Ftianocore%2Ftianocore.github.io
> %2Fwiki%2FEDK-II-
> Specificationsdata=02%7C01%7Csean.brogan%40microso
> ft.com%7C5ffeb105737e4c00150208d6453fa46a%7C72f988bf86f
> 141af91ab2d7cd011db47%7C1%7C0%7C636772536983024335
> sdata=veov60rbEtr3ub7RcreuFuqJvc4%2BdtAowph7kBGXW54%3D&
> amp;reserved=0) Chapter 2 defines UNI file format.
> EdkCompatibilityPkg is obsolete. BZ
> https://na01.safelinks.protection.outlook.com/?url=http
> s%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D
> 1103data=02%7C01%7Csean.brogan%40microsoft.com%7C5
> ffeb105737e4c00150208d6453fa46a%7C72f988bf86f141af91ab2
> d7cd011db47%7C1%7C0%7C636772536983024335sdata=LOLe
> zJzuK9kwu8QK78UM5nnCD%2FZEY5fxr1VQzk8sqY8%3Dreserv
> ed=0 is submitted to delete EdkCompatibilityPkg from edk2/master. We 
> will work on it.
> 
> EDK II Unicode files are used for mapping token names to localized 
> strings that are identified by an RFC4646 language code. The format 
> for storing EDK II Unicode files on disk is UTF-8 (without a BOM 
> character) or UTF-16LE (with a BOM character). The character content 
> must be UCS-2.
> 
> Thanks
> Liming
> >-Original Message-
> >From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of
> >Sean Brogan via edk2-devel
> >Sent: Thursday, November 08, 2018 7:00 AM
> >To: edk2-devel@lists.01.org
> >Subject: [edk2] Edk2 uni file encoding
> >
> >Is there a definitive answer for the file encoding for
> all UNI files in edk2?
> >If not I would like to propose one.  Incorrect
> encoding causes tool
> >issues and is something we can easily check for and
> fix.
> >
> >Proposal: All UNI files in edk2 should be
> >
> >
> >  1.  UTF-8
> >Or
> >
> >  1.  Use a BOM and be UTF-16
> >
> >https://na01.safelinks.protection.outlook.com/?url=htt
> ps%3A%2F%2Fen.wik
> >ipedia.org%2Fwiki%2FByte_order_markdata=02%7C01%7
> Csean.brogan%40mi
> >crosoft.com%7C5ffeb105737e4c00150208d6453fa46a%7C72f98
> 8bf86f141af91ab2d
> >7cd011db47%7C1%7C0%7C636772536983024335sdata=1IET
> 4LN5l9FfMscffzgk0
> >t7IqYGyYNU9IrZafvi9osU%3Dreserved=0
> >
> >Results from searching edk2:
> >1 - UTF-16 LE BOM file:
> >EdkCompatibilityPkg\Compatibility\FrameworkHiiOnUefiHi
> iThunk\Strings.un
> >i
> >919 - Without BOM and decoded as UTF-8
> >
> >Thoughts?
> >
> >Future question:  Can we make rule for all other
> standard file types
> >(c, h, dec, dsc, fdf, inf,)?
> >
> >Thanks
> >Sean
> >
> >
> >
> >___
> >edk2-devel mailing list
> 

Re: [edk2] [Patch] BaseTools: Replace the sqlite database with list

2018-11-08 Thread Felix Polyudov
Bob,

Does it mean that after this patch the build data is no longer saved to a file 
and is recreated on every build?
Do you have any data regarding build process performance improvements after 
applying the patch?
Does this patch improve full build time and incremental build time?

Thanks
Felix

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
Bob C
Sent: Thursday, November 08, 2018 12:39 AM
To: Ni, Ruiyu; edk2-devel@lists.01.org
Cc: Carsey, Jaben; Gao, Liming
Subject: Re: [edk2] [Patch] BaseTools: Replace the sqlite database with list

Hi Ray,

Right. No SQL dependency any more after this patch.

Thanks,
Bob

-Original Message-
From: Ni, Ruiyu 
Sent: Thursday, November 8, 2018 1:37 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Carsey, Jaben ; Gao, Liming 
Subject: Re: [edk2] [Patch] BaseTools: Replace the sqlite database with list

On 11/8/2018 11:15 AM, BobCF wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement series 
> patches.
> 
> This patch is going to use python list to store the parser data 
> instead of using sqlite database.
> 
> The replacement solution is as below:
> 
> SQL insert: list.append()
> SQL select: list comprehension. for example:
> Select * from table where field = “something”
> ->
> [ item for item in table if item[3] == “something”]
> 
> SQL update: python map function. for example:
> Update table set field1=newvalue where filed2 = “something”.
> -> map(lambda x: x[1] = newvalue,
> [item for item in table if item[2] == “something”])
> 
> SQL delete: list comprehension.
> 
> With this change, We can save the time of interpreting SQL statement 
> and the time of write database to file system
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: BobCF 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---

Bob,
I am curious. After this patch, there is no SQL dependency in build tool?

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

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 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

2018-11-08 Thread Jeff Brasen





From: Ard Biesheuvel 
Sent: Thursday, November 8, 2018 4:13 AM
To: Jeff Brasen; Leif Lindholm
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added 
AllocateZeroPool()

On 30 October 2018 at 22:30, Jeff Brasen  wrote:
> This function is exposed by the MemoryAllocationLib header.
> An AllocateZeroPool() function has been added to fix modules depending on
> this library and this function.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen 
> ---
>  .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 
> ++
>  1 file changed, 32 insertions(+)
>
> diff --git 
> a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c 
> b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> index 0e75e23..f93f9cf 100644
> --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> @@ -16,6 +16,7 @@
>  #include 
>
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -195,6 +196,37 @@ AllocatePool (
>  }
>
>  /**
> +  Allocates and zeros a buffer of type EfiBootServicesData.
> +
> +  Allocates the number bytes specified by AllocationSize of type 
> EfiBootServicesData, clears the
> +  buffer with zeros, and returns a pointer to the allocated buffer.  If 
> AllocationSize is 0, then a
> +  valid buffer of 0 size is returned.

I guess this is just boilerplate, but what on earth is 'a valid buffer
of 0 size'?

[JB] Copied this from the MemoryAllocationLib but allocate with create creates 
a free-able buffer is created with a unique pointer but you can't read/write to 
it (as it has no .

>  If there is not enough memory remaining to satisfy the
> +  request, then NULL is returned.
> +
> +  @param  AllocationSizeThe number of bytes to allocate and zero.
> +
> +  @return A pointer to the allocated buffer or NULL if allocation fails.
> +
> +**/
> +VOID *
> +EFIAPI
> +AllocateZeroPool (
> +  IN UINTN  AllocationSize
> +  )
> +{
> +  VOID *Buffer;
> +
> +  Buffer = AllocatePool (AllocationSize);
> +  if (NULL == Buffer) {

Please don't use Yoda speak

[JB] Will update, habit of mine from before compilers would generally report a 
warning for assignments in if statements.

> +return NULL;
> +  }
> +
> +  SetMem (Buffer, AllocationSize, 0);
> +
> +  return Buffer;
> +}
> +
> +/**
>Frees a buffer that was previously allocated with one of the pool 
> allocation functions in the
>Memory Allocation Library.
>
> --
> 2.7.4
>
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


Thanks,

Jeff


Thanks,

Jeff

---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-11-08 Thread Leif Lindholm
On Thu, Nov 08, 2018 at 06:16:25PM +0800, BobCF wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement
> series patches.
> 
> This patch is going to use join function instead of
> string += string2 statement.
> 
> Current code use string += string2 in a loop to combine
> a string. while creating a string list in a loop and using
> "".join(stringlist) after the loop will be much faster.

Do you have any numbers on the level of improvement seen?

Either for the individual scripts when called identically, or (if
measurable) on the build of an entire platform (say OvmfX64?).

Regards,

Leif

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: BobCF 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---
>  BaseTools/Source/Python/AutoGen/StrGather.py  | 39 +--
>  BaseTools/Source/Python/Common/Misc.py| 21 +-
>  .../Source/Python/Workspace/InfBuildData.py   |  4 +-
>  .../Python/Workspace/WorkspaceCommon.py   | 11 ++
>  4 files changed, 44 insertions(+), 31 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py 
> b/BaseTools/Source/Python/AutoGen/StrGather.py
> index 361d499076..d34a9e9447 100644
> --- a/BaseTools/Source/Python/AutoGen/StrGather.py
> +++ b/BaseTools/Source/Python/AutoGen/StrGather.py
> @@ -135,11 +135,11 @@ def AscToHexList(Ascii):
>  # @param UniGenCFlag  UniString is generated into AutoGen C file when it 
> is set to True
>  #
>  # @retval Str:   A string of .h file content
>  #
>  def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, 
> UniGenCFlag):
> -Str = ''
> +Str = []
>  ValueStartPtr = 60
>  Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME + ' ' * 
> (ValueStartPtr - len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) + 
> DecToHexStr(0, 4) + COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
>  Line = COMMENT_DEFINE_STR + ' ' + PRINTABLE_LANGUAGE_NAME_STRING_NAME + 
> ' ' * (ValueStartPtr - len(DEFINE_STR + PRINTABLE_LANGUAGE_NAME_STRING_NAME)) 
> + DecToHexStr(1, 4) + COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
> @@ -164,16 +164,16 @@ def CreateHFileContent(BaseName, UniObjectClass, 
> IsCompatibleMode, UniGenCFlag):
>  Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + 
> DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
>  else:
>  Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * 
> (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + 
> COMMENT_NOT_REFERENCED
>  UnusedStr = WriteLine(UnusedStr, Line)
>  
> -Str = ''.join([Str, UnusedStr])
> +Str.extend( UnusedStr)
>  
>  Str = WriteLine(Str, '')
>  if IsCompatibleMode or UniGenCFlag:
>  Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 
> 'Strings[];')
> -return Str
> +return "".join(Str)
>  
>  ## Create a complete .h file
>  #
>  # Create a complet .h file with file header and file content
>  #
> @@ -185,11 +185,11 @@ def CreateHFileContent(BaseName, UniObjectClass, 
> IsCompatibleMode, UniGenCFlag):
>  # @retval Str:   A string of complete .h file
>  #
>  def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
>  HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass, 
> IsCompatibleMode, UniGenCFlag))
>  
> -return HFile
> +return "".join(HFile)
>  
>  ## Create a buffer to store all items in an array
>  #
>  # @param BinBuffer   Buffer to contain Binary data.
>  # @param Array:  The array need to be formatted
> @@ -209,11 +209,11 @@ def CreateBinBuffer(BinBuffer, Array):
>  #
>  def CreateArrayItem(Array, Width = 16):
>  MaxLength = Width
>  Index = 0
>  Line = '  '
> -ArrayItem = ''
> +ArrayItem = []
>  
>  for Item in Array:
>  if Index < MaxLength:
>  Line = Line + Item + ',  '
>  Index = Index + 1
> @@ -221,11 +221,11 @@ def CreateArrayItem(Array, Width = 16):
>  ArrayItem = WriteLine(ArrayItem, Line)
>  Line = '  ' + Item + ',  '
>  Index = 1
>  ArrayItem = Write(ArrayItem, Line.rstrip())
>  
> -return ArrayItem
> +return "".join(ArrayItem)
>  
>  ## CreateCFileStringValue
>  #
>  # Create a line with string value
>  #
> @@ -236,11 +236,11 @@ def CreateArrayItem(Array, Width = 16):
>  
>  def CreateCFileStringValue(Value):
>  Value = [StringBlockType] + Value
>  Str = WriteLine('', CreateArrayItem(Value))
>  
> -return Str
> +return "".join(Str)
>  
>  ## GetFilteredLanguage
>  #
>  # apply get best language rules to the UNI language code list
>  #
> @@ -438,11 +438,11 @@ def CreateCFileContent(BaseName, UniObjectClass, 
> IsCompatibleMode, UniBinBuffer,
>  #
>  # Join package data
>  #
>  AllStr = Write(AllStr, Str)
>  
> -return AllStr
> +return "".join(AllStr)
>  
>  ## Create end of .c file
>  #
>  # 

Re: [edk2] Edk2 uni file encoding

2018-11-08 Thread Kinney, Michael D
Sean,

As a clarification.  The UNI specs does list 2 on-disk formats.
This was done so tools could support both in the transition
from UTF-16LE with BOM to UTF-8 without BOM.

The strong recommendation is for all EDK II open source packages to
use UTF-8 without a BOM.  Since platform packages not maintained
in EDK II could be pulling forward UNI files in UTF-16LE, we
have not changed the UNI spec or tools to consider UTF-16LE
as unsupported.

Doing patch email reviews of UNI files in UTF-16LE is a challenge
so requiring UTF-8 without a BOM make this much easier.

The EDK II open source package conversion to UTF-8 without a BO
was performed in late 2015.  Here is one example:

https://github.com/tianocore/edk2/commit/3f5287971ffdb5c42e3325a3a94c101f08d3a02a#diff-14d2171dacfcac1fd2e1b1f7b885e530

A helper python script was added to help perform these conversions:

https://github.com/tianocore/edk2/blob/master/BaseTools/Scripts/ConvertUni.py

At some point, it may make sense to *require* UTF-8 without a 
BOM for all UNI files and all tools and for tools to reject
UNI files that are not in UTF-8 without a BOM format.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Sean Brogan via
> edk2-devel
> Sent: Wednesday, November 7, 2018 11:11 PM
> To: Gao, Liming 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] Edk2 uni file encoding
> 
> Liming,
> That was exactly what I was looking for.
> 
> Thanks
> Sean
> 
> 
> 
> 
> -Original Message-
> From: Gao, Liming 
> Sent: Wednesday, November 7, 2018 10:01 PM
> To: Sean Brogan 
> Cc: edk2-devel@lists.01.org
> Subject: RE: Edk2 uni file encoding
> 
> Sean:
>   EDKII UNI spec
> (https://na01.safelinks.protection.outlook.com/?url=htt
> ps%3A%2F%2Fgithub.com%2Ftianocore%2Ftianocore.github.io
> %2Fwiki%2FEDK-II-
> Specificationsdata=02%7C01%7Csean.brogan%40microso
> ft.com%7C5ffeb105737e4c00150208d6453fa46a%7C72f988bf86f
> 141af91ab2d7cd011db47%7C1%7C0%7C636772536983024335
> sdata=veov60rbEtr3ub7RcreuFuqJvc4%2BdtAowph7kBGXW54%3D&
> amp;reserved=0) Chapter 2 defines UNI file format.
> EdkCompatibilityPkg is obsolete. BZ
> https://na01.safelinks.protection.outlook.com/?url=http
> s%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D
> 1103data=02%7C01%7Csean.brogan%40microsoft.com%7C5
> ffeb105737e4c00150208d6453fa46a%7C72f988bf86f141af91ab2
> d7cd011db47%7C1%7C0%7C636772536983024335sdata=LOLe
> zJzuK9kwu8QK78UM5nnCD%2FZEY5fxr1VQzk8sqY8%3Dreserv
> ed=0 is submitted to delete EdkCompatibilityPkg from
> edk2/master. We will work on it.
> 
> EDK II Unicode files are used for mapping token names
> to localized strings that are identified by an RFC4646
> language code. The format for storing EDK II Unicode
> files on disk is UTF-8 (without a BOM character) or
> UTF-16LE (with a BOM character). The character content
> must be UCS-2.
> 
> Thanks
> Liming
> >-Original Message-
> >From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of
> >Sean Brogan via edk2-devel
> >Sent: Thursday, November 08, 2018 7:00 AM
> >To: edk2-devel@lists.01.org
> >Subject: [edk2] Edk2 uni file encoding
> >
> >Is there a definitive answer for the file encoding for
> all UNI files in edk2?
> >If not I would like to propose one.  Incorrect
> encoding causes tool
> >issues and is something we can easily check for and
> fix.
> >
> >Proposal: All UNI files in edk2 should be
> >
> >
> >  1.  UTF-8
> >Or
> >
> >  1.  Use a BOM and be UTF-16
> >
> >https://na01.safelinks.protection.outlook.com/?url=htt
> ps%3A%2F%2Fen.wik
> >ipedia.org%2Fwiki%2FByte_order_markdata=02%7C01%7
> Csean.brogan%40mi
> >crosoft.com%7C5ffeb105737e4c00150208d6453fa46a%7C72f98
> 8bf86f141af91ab2d
> >7cd011db47%7C1%7C0%7C636772536983024335sdata=1IET
> 4LN5l9FfMscffzgk0
> >t7IqYGyYNU9IrZafvi9osU%3Dreserved=0
> >
> >Results from searching edk2:
> >1 - UTF-16 LE BOM file:
> >EdkCompatibilityPkg\Compatibility\FrameworkHiiOnUefiHi
> iThunk\Strings.un
> >i
> >919 - Without BOM and decoded as UTF-8
> >
> >Thoughts?
> >
> >Future question:  Can we make rule for all other
> standard file types
> >(c, h, dec, dsc, fdf, inf,)?
> >
> >Thanks
> >Sean
> >
> >
> >
> >___
> >edk2-devel mailing list
> >edk2-devel@lists.01.org
> >https://na01.safelinks.protection.outlook.com/?url=htt
> ps%3A%2F%2Flists.
> >01.org%2Fmailman%2Flistinfo%2Fedk2-
> develdata=02%7C01%7Csean.brogan
> >%40microsoft.com%7C5ffeb105737e4c00150208d6453fa46a%7C
> 72f988bf86f141af9
> >1ab2d7cd011db47%7C1%7C0%7C636772536983024335sdata
> =HhfPaCyS0sKHu1fF
> >Gkfh%2FQ4pm34X68YKiaM6IN7%2Fzj0%3Dreserved=0
> ___
> 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] Edk2 uni file encoding

2018-11-08 Thread Leif Lindholm
Hi Sean,

On Wed, Nov 07, 2018 at 11:00:24PM +, Sean Brogan via edk2-devel wrote:
> Is there a definitive answer for the file encoding for all UNI files in edk2?
> If not I would like to propose one.  Incorrect encoding causes tool
> issues and is something we can easily check for and fix.
> 
> Proposal: All UNI files in edk2 should be
> 
>   1.  UTF-8
> Or
> 
>   1.  Use a BOM and be UTF-16
> 
> https://en.wikipedia.org/wiki/Byte_order_mark
> 
> Results from searching edk2:
> 1 - UTF-16 LE BOM file: 
> EdkCompatibilityPkg\Compatibility\FrameworkHiiOnUefiHiiThunk\Strings.uni

Which is going to be deleted at some point anyway.

> 919 - Without BOM and decoded as UTF-8
> 
> Thoughts?

I would be quite happy to make UTF-8 the official norm if that doesn't
severely impact others.

(As a sidenote, the 'file' command gives the following summaries
  2 ASCII text
815 ASCII text, with CRLF line terminators
 72 ASCII text, with very long lines, with CRLF line terminators
  3 C source, ASCII text, with CRLF line terminators
  1 Little-endian UTF-16 Unicode text, with CRLF, CR line terminators
 26 UTF-8 Unicode text, with CRLF line terminators
  1 UTF-8 Unicode text, with very long lines, with CRLF line terminators

I expect "ASCII text" is simply "doesn't contain any characters > 127".)

> Future question:  Can we make rule for all other standard file types
> (c, h, dec, dsc, fdf, inf,)?

I think c and h have toolchain implications that would need to be
investigated in greater detail (i.e., it is possible we would need to
retire some profiles from BaseTools that would no longer be able to
compile new code). But as long as we don't permit > ASCII 127 in the
C code, we probably wouldn't see build failures.

Other than that, I'd be happy to go full UTF-8.

Regards,

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


Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-11-08 Thread Kinney, Michael D
Bob,

Is this for edk2/master or for the Python 3 conversion in the
edk2-staging branch?  If it is for the edk-staging branch, then
the Subject is not correct.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of BobCF
> Sent: Thursday, November 8, 2018 2:16 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Gao, Liming
> 
> Subject: [edk2] [Patch] BaseTools: Optimize string
> concatenation
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement
> series patches.
> 
> This patch is going to use join function instead of
> string += string2 statement.
> 
> Current code use string += string2 in a loop to combine
> a string. while creating a string list in a loop and
> using
> "".join(stringlist) after the loop will be much faster.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: BobCF 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---
>  BaseTools/Source/Python/AutoGen/StrGather.py  | 39
> +--
>  BaseTools/Source/Python/Common/Misc.py| 21
> +-
>  .../Source/Python/Workspace/InfBuildData.py   |  4 +-
>  .../Python/Workspace/WorkspaceCommon.py   | 11 ++-
> ---
>  4 files changed, 44 insertions(+), 31 deletions(-)
> 
> diff --git
> a/BaseTools/Source/Python/AutoGen/StrGather.py
> b/BaseTools/Source/Python/AutoGen/StrGather.py
> index 361d499076..d34a9e9447 100644
> --- a/BaseTools/Source/Python/AutoGen/StrGather.py
> +++ b/BaseTools/Source/Python/AutoGen/StrGather.py
> @@ -135,11 +135,11 @@ def AscToHexList(Ascii):
>  # @param UniGenCFlag  UniString is generated into
> AutoGen C file when it is set to True
>  #
>  # @retval Str:   A string of .h file content
>  #
>  def CreateHFileContent(BaseName, UniObjectClass,
> IsCompatibleMode, UniGenCFlag):
> -Str = ''
> +Str = []
>  ValueStartPtr = 60
>  Line = COMMENT_DEFINE_STR + ' ' +
> LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr -
> len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) +
> DecToHexStr(0, 4) + COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
>  Line = COMMENT_DEFINE_STR + ' ' +
> PRINTABLE_LANGUAGE_NAME_STRING_NAME + ' ' *
> (ValueStartPtr - len(DEFINE_STR +
> PRINTABLE_LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(1,
> 4) + COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
> @@ -164,16 +164,16 @@ def CreateHFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniGenCFlag):
>  Line = COMMENT_DEFINE_STR + ' ' +
> Name + ' ' + DecToHexStr(Token, 4) +
> COMMENT_NOT_REFERENCED
>  else:
>  Line = COMMENT_DEFINE_STR + ' ' +
> Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) +
> DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
>  UnusedStr = WriteLine(UnusedStr, Line)
> 
> -Str = ''.join([Str, UnusedStr])
> +Str.extend( UnusedStr)
> 
>  Str = WriteLine(Str, '')
>  if IsCompatibleMode or UniGenCFlag:
>  Str = WriteLine(Str, 'extern unsigned char ' +
> BaseName + 'Strings[];')
> -return Str
> +return "".join(Str)
> 
>  ## Create a complete .h file
>  #
>  # Create a complet .h file with file header and file
> content
>  #
> @@ -185,11 +185,11 @@ def CreateHFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniGenCFlag):
>  # @retval Str:   A string of complete .h file
>  #
>  def CreateHFile(BaseName, UniObjectClass,
> IsCompatibleMode, UniGenCFlag):
>  HFile = WriteLine('', CreateHFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniGenCFlag))
> 
> -return HFile
> +return "".join(HFile)
> 
>  ## Create a buffer to store all items in an array
>  #
>  # @param BinBuffer   Buffer to contain Binary data.
>  # @param Array:  The array need to be formatted
> @@ -209,11 +209,11 @@ def CreateBinBuffer(BinBuffer,
> Array):
>  #
>  def CreateArrayItem(Array, Width = 16):
>  MaxLength = Width
>  Index = 0
>  Line = '  '
> -ArrayItem = ''
> +ArrayItem = []
> 
>  for Item in Array:
>  if Index < MaxLength:
>  Line = Line + Item + ',  '
>  Index = Index + 1
> @@ -221,11 +221,11 @@ def CreateArrayItem(Array, Width
> = 16):
>  ArrayItem = WriteLine(ArrayItem, Line)
>  Line = '  ' + Item + ',  '
>  Index = 1
>  ArrayItem = Write(ArrayItem, Line.rstrip())
> 
> -return ArrayItem
> +return "".join(ArrayItem)
> 
>  ## CreateCFileStringValue
>  #
>  # Create a line with string value
>  #
> @@ -236,11 +236,11 @@ def CreateArrayItem(Array, Width
> = 16):
> 
>  def CreateCFileStringValue(Value):
>  Value = [StringBlockType] + Value
>  Str = WriteLine('', CreateArrayItem(Value))
> 
> -return Str
> +return "".join(Str)
> 
>  ## GetFilteredLanguage
>  #
>  # apply get best language rules to the UNI language
> code list
>  #
> @@ -438,11 +438,11 @@ def CreateCFileContent(BaseName,
> 

Re: [edk2] [Patch] BaseTools: Optimize string concatenation

2018-11-08 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, November 08, 2018 2:16 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Carsey, Jaben
> 
> Subject: [Patch] BaseTools: Optimize string concatenation
> Importance: High
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement
> series patches.
> 
> This patch is going to use join function instead of
> string += string2 statement.
> 
> Current code use string += string2 in a loop to combine
> a string. while creating a string list in a loop and using
> "".join(stringlist) after the loop will be much faster.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: BobCF 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---
>  BaseTools/Source/Python/AutoGen/StrGather.py  | 39 +
> --
>  BaseTools/Source/Python/Common/Misc.py| 21 +-
>  .../Source/Python/Workspace/InfBuildData.py   |  4 +-
>  .../Python/Workspace/WorkspaceCommon.py   | 11 ++
>  4 files changed, 44 insertions(+), 31 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py
> b/BaseTools/Source/Python/AutoGen/StrGather.py
> index 361d499076..d34a9e9447 100644
> --- a/BaseTools/Source/Python/AutoGen/StrGather.py
> +++ b/BaseTools/Source/Python/AutoGen/StrGather.py
> @@ -135,11 +135,11 @@ def AscToHexList(Ascii):
>  # @param UniGenCFlag  UniString is generated into AutoGen C file when it
> is set to True
>  #
>  # @retval Str:   A string of .h file content
>  #
>  def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode,
> UniGenCFlag):
> -Str = ''
> +Str = []
>  ValueStartPtr = 60
>  Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME
> + ' ' * (ValueStartPtr - len(DEFINE_STR +
> LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(0, 4) +
> COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
>  Line = COMMENT_DEFINE_STR + ' ' +
> PRINTABLE_LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr -
> len(DEFINE_STR + PRINTABLE_LANGUAGE_NAME_STRING_NAME)) +
> DecToHexStr(1, 4) + COMMENT_NOT_REFERENCED
>  Str = WriteLine(Str, Line)
> @@ -164,16 +164,16 @@ def CreateHFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniGenCFlag):
>  Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' +
> DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
>  else:
>  Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * 
> (ValueStartPtr -
> len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) +
> COMMENT_NOT_REFERENCED
>  UnusedStr = WriteLine(UnusedStr, Line)
> 
> -Str = ''.join([Str, UnusedStr])
> +Str.extend( UnusedStr)
> 
>  Str = WriteLine(Str, '')
>  if IsCompatibleMode or UniGenCFlag:
>  Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 
> 'Strings[];')
> -return Str
> +return "".join(Str)
> 
>  ## Create a complete .h file
>  #
>  # Create a complet .h file with file header and file content
>  #
> @@ -185,11 +185,11 @@ def CreateHFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniGenCFlag):
>  # @retval Str:   A string of complete .h file
>  #
>  def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode,
> UniGenCFlag):
>  HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass,
> IsCompatibleMode, UniGenCFlag))
> 
> -return HFile
> +return "".join(HFile)
> 
>  ## Create a buffer to store all items in an array
>  #
>  # @param BinBuffer   Buffer to contain Binary data.
>  # @param Array:  The array need to be formatted
> @@ -209,11 +209,11 @@ def CreateBinBuffer(BinBuffer, Array):
>  #
>  def CreateArrayItem(Array, Width = 16):
>  MaxLength = Width
>  Index = 0
>  Line = '  '
> -ArrayItem = ''
> +ArrayItem = []
> 
>  for Item in Array:
>  if Index < MaxLength:
>  Line = Line + Item + ',  '
>  Index = Index + 1
> @@ -221,11 +221,11 @@ def CreateArrayItem(Array, Width = 16):
>  ArrayItem = WriteLine(ArrayItem, Line)
>  Line = '  ' + Item + ',  '
>  Index = 1
>  ArrayItem = Write(ArrayItem, Line.rstrip())
> 
> -return ArrayItem
> +return "".join(ArrayItem)
> 
>  ## CreateCFileStringValue
>  #
>  # Create a line with string value
>  #
> @@ -236,11 +236,11 @@ def CreateArrayItem(Array, Width = 16):
> 
>  def CreateCFileStringValue(Value):
>  Value = [StringBlockType] + Value
>  Str = WriteLine('', CreateArrayItem(Value))
> 
> -return Str
> +return "".join(Str)
> 
>  ## GetFilteredLanguage
>  #
>  # apply get best language rules to the UNI language code list
>  #
> @@ -438,11 +438,11 @@ def CreateCFileContent(BaseName,
> UniObjectClass, IsCompatibleMode, UniBinBuffer,
>  #
>  # Join package data
>  #
>  AllStr = Write(AllStr, Str)
> 
> -return AllStr
> +return "".join(AllStr)
> 
>  ## Create end of .c file
>  #
>  # 

Re: [edk2] [Patch] BaseTools: Customize deepcopy function.

2018-11-08 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> BobCF
> Sent: Wednesday, November 07, 2018 10:04 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Gao, Liming
> 
> Subject: [edk2] [Patch] BaseTools: Customize deepcopy function.
> Importance: High
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1288
> 
> This patch is one of build tool performance improvement
> series patches.
> 
> This patch is going to customize the deepcopy function for
> SkuClass, PcdClassObject and python dictionary.
> 
> python deepcopy copy everything of a object, but for our current
> usage we just need to copy the data we care about recursively.
> 
> By implementing __deepcopy__ for SkuClass, PcdClassObject, we can
> customize
> deepcopy function for them.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: BobCF 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---
>  BaseTools/Source/Python/Common/Expression.py  |  4 +-
>  BaseTools/Source/Python/Common/Misc.py| 16 ++
>  .../Python/CommonDataClass/CommonClass.py | 15 ++
>  .../Python/Workspace/BuildClassObject.py  | 52 +++
>  .../Source/Python/Workspace/DscBuildData.py   |  6 +--
>  5 files changed, 88 insertions(+), 5 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Common/Expression.py
> b/BaseTools/Source/Python/Common/Expression.py
> index a21ab5daa7..091c0f4296 100644
> --- a/BaseTools/Source/Python/Common/Expression.py
> +++ b/BaseTools/Source/Python/Common/Expression.py
> @@ -15,11 +15,11 @@
>  from __future__ import print_function
>  from __future__ import absolute_import
>  from Common.GlobalData import *
>  from CommonDataClass.Exceptions import BadExpression
>  from CommonDataClass.Exceptions import WrnExpression
> -from .Misc import GuidStringToGuidStructureString, ParseFieldValue
> +from .Misc import GuidStringToGuidStructureString,
> ParseFieldValue,CopyDict
>  import Common.EdkLogger as EdkLogger
>  import copy
>  from Common.DataType import *
>  import sys
>  from random import sample
> @@ -353,11 +353,11 @@ class ValueExpression(BaseExpression):
>  raise BadExpression(ERR_EMPTY_EXPR)
> 
>  #
>  # The symbol table including PCD and macro mapping
>  #
> -self._Symb = copy.deepcopy(SymbolTable)
> +self._Symb = CopyDict(SymbolTable)
>  self._Symb.update(self.LogicalOperators)
>  self._Idx = 0
>  self._Len = len(self._Expr)
>  self._Token = ''
>  self._WarnExcept = None
> diff --git a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index 3b8efb2e71..80236db160 100644
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -39,10 +39,11 @@ from Common.LongFilePathSupport import
> OpenLongFilePath as open
>  from Common.MultipleWorkspace import MultipleWorkspace as mws
>  import uuid
>  from CommonDataClass.Exceptions import BadExpression
>  from Common.caching import cached_property
>  import subprocess
> +from collections import OrderedDict
>  ## Regular expression used to find out place holders in string template
>  gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE |
> re.UNICODE)
> 
>  ## regular expressions for map file processing
>  startPatternGeneral = re.compile("^Start[' ']+Length[' ']+Name[' ']+Class")
> @@ -2129,10 +2130,25 @@ def PackByteFormatGUID(Guid):
>  Guid[8],
>  Guid[9],
>  Guid[10],
>  )
> 
> +## DeepCopy dict/OrderedDict recusively
> +#
> +#   @param  ori_dicta nested dict or ordereddict
> +#
> +#   @retval new dict or orderdict
> +#
> +def CopyDict(ori_dict):
> +dict_type = ori_dict.__class__
> +new_dict = dict_type()
> +for key in ori_dict:
> +if isinstance(ori_dict[key],(dict,OrderedDict)):
> +new_dict[key] = CopyDict(ori_dict[key])
> +else:
> +new_dict[key] = ori_dict[key]
> +return new_dict
>  ##
>  #
>  # This acts like the main() function for the script, unless it is 'import'ed 
> into
> another
>  # script.
>  #
> diff --git a/BaseTools/Source/Python/CommonDataClass/CommonClass.py
> b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
> index a98cf8a7c5..336bb11671 100644
> --- a/BaseTools/Source/Python/CommonDataClass/CommonClass.py
> +++ b/BaseTools/Source/Python/CommonDataClass/CommonClass.py
> @@ -78,5 +78,20 @@ class SkuInfoClass(object):
>  'VariableOffset = ' + str(self.VariableOffset) + "," + \
>  'HiiDefaultValue = ' + str(self.HiiDefaultValue) + "," + 
> \
>  'VpdOffset = ' + str(self.VpdOffset) + "," + \
>  'DefaultValue = ' + str(self.DefaultValue) + ","
>  return Rtn
> +
> +def __deepcopy__(self,memo):
> +new_sku = SkuInfoClass()
> +

[edk2] [Patch] Maintainers.txt: Update EDK II Releases to EDK-II-Release-Planning wiki

2018-11-08 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 Maintainers.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index 6c9156169a..fc183d6477 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -51,9 +51,7 @@ W: 
https://github.com/tianocore/tianocore.github.io/wiki/Security
 
 EDK II Releases:
 
-UDK2014
-W: http://www.tianocore.org/udk2014/
-S: Supported
+W: 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning
 
 EDK II Packages:
 
-- 
2.13.0.windows.1

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


Re: [edk2] Soft Feature Freeze has started since Nov.1 for dk2-stable201811

2018-11-08 Thread Gao, Liming
Laszlo:
  Please list my name (Liming Gao ) as the sender. 

Thanks
Liming
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, November 8, 2018 9:10 PM
> To: Gao, Liming ; Zeng, Star ; 
> Leif Lindholm 
> Cc: edk2-devel@lists.01.org; Cetola, Stephano ; 
> Richardson, Brian ; Kinney,
> Michael D 
> Subject: Re: [edk2] Soft Feature Freeze has started since Nov.1 for 
> dk2-stable201811
> 
> On 11/08/18 06:39, Gao, Liming wrote:
> 
> > Laszlo: Thanks for your feedback. We will send the separate announce
> > mail ahead of the feature freeze date for next release cycle. And, I
> > suggest to update SoftFeatureFreeze and HardFeatureFreeze wiki page
> > with the announce mail requirement. For this release, I would like to
> > dry run this process. So, I will send another  announcement for Hard
> > Feature Freeze today.
> 
> I'm happy to update these wiki pages. Whom should I identify in the
> articles as the expected sender(s) of the announcements?
> 
> Thanks!
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] MdePkg: Fix incorrect check for DisplayOnly text format in AcpiEx

2018-11-08 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Bi, Dandan
> Sent: Thursday, November 8, 2018 9:50 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Kinney, Michael D 
> ; Gao, Liming 
> Subject: [patch] MdePkg: Fix incorrect check for DisplayOnly text format in 
> AcpiEx
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1312
> 
> Text format for AcpiEx device path in UEFI Spec:
> AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR)
> AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only)
> 
> When convert device path to text for ACPI device path,
> current code check AllowShortcuts parameter to convert
> the device path to DisplayOnly text format(shorter text
> representation) by mistake.
> It should check DisplayOnly parameter.
> 
> This commit is to fix this issue.
> 
> Cc: Ruiyu Ni 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 
> ---
>  MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
> b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> index cdcdb3623a..97d279eeb2 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> @@ -495,11 +495,11 @@ DevPathToTextAcpiEx (
>  CIDText,
>  UIDStr
> );
>  }
>} else {
> -if (AllowShortcuts) {
> +if (DisplayOnly) {
>//
>// display only
>//
>if (AcpiEx->HID == 0) {
>  UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);
> --
> 2.18.0.windows.1

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


[edk2] [patch] MdePkg: Fix incorrect check for DisplayOnly text format in AcpiEx

2018-11-08 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1312

Text format for AcpiEx device path in UEFI Spec:
AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR)
AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only)

When convert device path to text for ACPI device path,
current code check AllowShortcuts parameter to convert
the device path to DisplayOnly text format(shorter text
representation) by mistake.
It should check DisplayOnly parameter.

This commit is to fix this issue.

Cc: Ruiyu Ni 
Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index cdcdb3623a..97d279eeb2 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -495,11 +495,11 @@ DevPathToTextAcpiEx (
 CIDText,
 UIDStr
);
 }
   } else {
-if (AllowShortcuts) {
+if (DisplayOnly) {
   //
   // display only
   //
   if (AcpiEx->HID == 0) {
 UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);
-- 
2.18.0.windows.1

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


Re: [edk2] Edk2 uni file encoding

2018-11-08 Thread Laszlo Ersek
On 11/08/18 00:00, Sean Brogan via edk2-devel wrote:

> Future question:  Can we make rule for all other standard file types (c, h, 
> dec, dsc, fdf, inf,)?

My suggestion: 7-bit ASCII.

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


Re: [edk2] [Patch 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Separate semaphore container.

2018-11-08 Thread Laszlo Ersek
On 11/08/18 03:58, Eric Dong wrote:
> In current implementation, core level semaphore use same container
> with package level semaphore. This design will let the core level
> semaphore not works as expected in below case:
> 1. Feature A has CPU_FEATURE_CORE_BEFORE dependence with Feature B.
> 2. Feature C has CPU_FEATURE_PACKAGE_AFTER dependence with Feature B.
> in this case an core level semaphore will be add between A and B, and
> an package level semaphore will be add between B and C.
> 
> For a CPU has one package, two cores and 4 threads. Execute like below:
> 
>   Thread 1  Thread 2. Thread 4
> ReleaseSemaph(1,2)  -|
> WaitForSemaph(1(2)) -|<---These two are Core Semaph
>   ReleaseSemaph(1,2) -|
>   WaitForSemaph(2)   -| <---  Core Semaph
> 
> ReleaseSemaph (1,2,3,4) -|
> WaitForSemaph (1(4))-| <  Package Semaph
> 
>   ReleaseSemaph(3,4)
>   WaitForSemaph(4(2)) <- Core Semaph
> 
> In above case, for thread 4, when it executes a core semaphore, i will
> found WaitForSemaph(4(2)) is met because Thread 1 has execute a package
> semaphore and ReleaseSemaph(4) for it before. This is not an expect
> behavior. Thread 4 should wait for thread 3 to do this.
> 
> Fix this issue by separate the semaphore container for core level and
> package level.
> 
> Cc: Laszlo Ersek 
> Cc: Ruiyu Ni 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong 
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 ++---
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> index a45e2dd3d7..65461485a4 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> @@ -41,9 +41,10 @@ typedef struct {
>  // Flags used when program the register.
>  //
>  typedef struct {
> -  volatile UINTN   ConsoleLogLock;   // Spinlock used to control 
> console.
> -  volatile UINTN   MemoryMappedLock; // Spinlock used to program 
> mmio
> -  volatile UINT32  *SemaphoreCount;  // Semaphore used to 
> program semaphore.
> +  volatile UINTN   ConsoleLogLock;  // Spinlock used to 
> control console.
> +  volatile UINTN   MemoryMappedLock;// Spinlock used to 
> program mmio
> +  volatile UINT32  *CoreSemaphoreCount; // Semaphore used to 
> program semaphore.
> +  volatile UINT32  *PackageSemaphoreCount;  // Semaphore used to 
> program semaphore.
>  } PROGRAM_CPU_REGISTER_FLAGS;
>  
>  //
> @@ -348,11 +349,12 @@ ProgramProcessorRegister (
>ASSERT (
>  (ApLocation != NULL) &&
>  (CpuStatus->ValidCoreCountPerPackage != 0) &&
> -(CpuFlags->SemaphoreCount) != NULL
> +(CpuFlags->CoreSemaphoreCount != NULL) &&
> +(CpuFlags->PackageSemaphoreCount != NULL)
>  );
> -  SemaphorePtr = CpuFlags->SemaphoreCount;
>switch (RegisterTableEntry->Value) {
>case CoreDepType:
> +SemaphorePtr = CpuFlags->CoreSemaphoreCount;
>  //
>  // Get Offset info for the first thread in the core which current 
> thread belongs to.
>  //
> @@ -373,6 +375,7 @@ ProgramProcessorRegister (
>  break;
>  
>case PackageDepType:
> +SemaphorePtr = CpuFlags->PackageSemaphoreCount;
>  ValidCoreCountPerPackage = (UINT32 
> *)(UINTN)CpuStatus->ValidCoreCountPerPackage;
>  //
>  // Get Offset info for the first thread in the package which current 
> thread belongs to.
> @@ -1037,10 +1040,14 @@ GetAcpiCpuData (
>  ASSERT (mAcpiCpuData.ApLocation != 0);
>}
>if (CpuStatus->PackageCount != 0) {
> -mCpuFlags.SemaphoreCount = AllocateZeroPool (
> +mCpuFlags.CoreSemaphoreCount = AllocateZeroPool (
>   sizeof (UINT32) * CpuStatus->PackageCount *
>   CpuStatus->MaxCoreCount * 
> CpuStatus->MaxThreadCount);
> -ASSERT (mCpuFlags.SemaphoreCount != NULL);
> +ASSERT (mCpuFlags.CoreSemaphoreCount != NULL);
> +mCpuFlags.PackageSemaphoreCount = AllocateZeroPool (
> + sizeof (UINT32) * CpuStatus->PackageCount *
> + CpuStatus->MaxCoreCount * 
> CpuStatus->MaxThreadCount);
> +ASSERT (mCpuFlags.PackageSemaphoreCount != NULL);
>}
>InitializeSpinLock((SPIN_LOCK*) );
>InitializeSpinLock((SPIN_LOCK*) );
> 

The patch looks OK, superficially speaking.

Also this looks like a bugfix to a new feature already committed in this
development cycle, so I think it may go in during the hard feature freeze.

I have some requests (no need to repost):

(1) Please make sure there is a TianoCore BZ for this issue.

(2) Please reference said BZ in the commit message.

(For example, commit c60d36b4d1, for

Re: [edk2] Soft Feature Freeze has started since Nov.1 for dk2-stable201811

2018-11-08 Thread Laszlo Ersek
On 11/08/18 06:39, Gao, Liming wrote:

> Laszlo: Thanks for your feedback. We will send the separate announce
> mail ahead of the feature freeze date for next release cycle. And, I
> suggest to update SoftFeatureFreeze and HardFeatureFreeze wiki page
> with the announce mail requirement. For this release, I would like to
> dry run this process. So, I will send another  announcement for Hard
> Feature Freeze today.

I'm happy to update these wiki pages. Whom should I identify in the
articles as the expected sender(s) of the announcements?

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


Re: [edk2] [platforms: PATCH v3 2/7] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information

2018-11-08 Thread Marcin Wojtas
czw., 8 lis 2018 o 12:47 Ard Biesheuvel  napisał(a):
>
> On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> > From: Tomasz Michalec 
> >
> > Added fields specific for Xenon host controller and declaration
> > of ArmadaBoardDescSdMmcGet function.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marcin Wojtas 
> > ---
> >  Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 17 -
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h 
> > b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> > index ee8e06e..4bb7a43 100644
> > --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> > +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> > @@ -14,6 +14,8 @@
> >  #ifndef __ARMADA_BOARD_DESC_LIB_H__
> >  #define __ARMADA_BOARD_DESC_LIB_H__
> >
> > +#include 
> > +
>
> I don't like this at all. We are depending on an internal header of a
> certain implementation. Please find a better way to share these
> definitions.
>

Sure, forgot about this one. I will use a local enum for the SlotType,
which will be equivalent to EFI_SD_MMC_SLOT_TYPE.

> >  #include 
> >
> >  //
> > @@ -57,7 +59,12 @@ typedef struct {
> >  //
> >  typedef struct {
> >MV_SOC_SDMMC_DESC *SoC;
> > -  UINTN  SdMmcDevCount;
> > +  UINTNSdMmcDevCount;
> > +  BOOLEAN  Xenon1v8Enabled;
> > +  BOOLEAN  Xenon8BitBusEnabled;
> > +  BOOLEAN  XenonSlowModeEnabled;
> > +  UINT8XenonTuningStepDivisor;
> > +  EFI_SD_MMC_SLOT_TYPE SlotType;
> >  } MV_BOARD_SDMMC_DESC;
> >
> >  //
> > @@ -84,4 +91,12 @@ typedef struct {
> >UINTN UtmiDevCount;
> >UINTN UtmiPortType;
> >  } MV_BOARD_UTMI_DESC;
> > +
> > +EFI_STATUS
> > +EFIAPI
> > +ArmadaBoardDescSdMmcGet (
> > +  IN OUT UINTN   *SdMmcDevCount,
> > +  IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
> > +  );
> > +
> >  #endif /* __ARMADA_SOC_DESC_LIB_H__ */
> > --
> > 2.7.4
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [platforms: PATCH v3 2/7] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> From: Tomasz Michalec 
>
> Added fields specific for Xenon host controller and declaration
> of ArmadaBoardDescSdMmcGet function.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 
> ---
>  Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 17 -
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h 
> b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> index ee8e06e..4bb7a43 100644
> --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h
> @@ -14,6 +14,8 @@
>  #ifndef __ARMADA_BOARD_DESC_LIB_H__
>  #define __ARMADA_BOARD_DESC_LIB_H__
>
> +#include 
> +

I don't like this at all. We are depending on an internal header of a
certain implementation. Please find a better way to share these
definitions.

>  #include 
>
>  //
> @@ -57,7 +59,12 @@ typedef struct {
>  //
>  typedef struct {
>MV_SOC_SDMMC_DESC *SoC;
> -  UINTN  SdMmcDevCount;
> +  UINTNSdMmcDevCount;
> +  BOOLEAN  Xenon1v8Enabled;
> +  BOOLEAN  Xenon8BitBusEnabled;
> +  BOOLEAN  XenonSlowModeEnabled;
> +  UINT8XenonTuningStepDivisor;
> +  EFI_SD_MMC_SLOT_TYPE SlotType;
>  } MV_BOARD_SDMMC_DESC;
>
>  //
> @@ -84,4 +91,12 @@ typedef struct {
>UINTN UtmiDevCount;
>UINTN UtmiPortType;
>  } MV_BOARD_UTMI_DESC;
> +
> +EFI_STATUS
> +EFIAPI
> +ArmadaBoardDescSdMmcGet (
> +  IN OUT UINTN   *SdMmcDevCount,
> +  IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
> +  );
> +
>  #endif /* __ARMADA_SOC_DESC_LIB_H__ */
> --
> 2.7.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [platforms: PATCH v3 1/7] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> The newest changes in the SdMmcOverride protocol added additional
> arguments to the NotifyPhase and Capability routines. Update
> according places in the Synquacer Emmc driver.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 

Reviewed-by: Ard Biesheuvel 

> ---
>  Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c 
> b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> index e0987c9..47f5ccc 100644
> --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c
> @@ -72,6 +72,8 @@ STATIC VOID *mEventRegistration;
>@param[in]  ControllerHandle  The EFI_HANDLE of the controller.
>@param[in]  Slot  The 0 based slot index.
>@param[in,out]  SdMmcHcSlotCapability The SDHCI capability structure.
> +  @param[in,out]  BaseClkFreq   The base clock frequency value that
> +optionally can be updated.
>
>@retval EFI_SUCCESS   The override function completed successfully.
>@retval EFI_NOT_FOUND The specified controller or slot does not 
> exist.
> @@ -84,7 +86,8 @@ EFIAPI
>  SynQuacerSdMmcCapability (
>IN  EFI_HANDLE  ControllerHandle,
>IN  UINT8   Slot,
> -  IN  OUT VOID*SdMmcHcSlotCapability
> +  IN OUT  VOID*SdMmcHcSlotCapability,
> +  IN OUT  UINT32  *BaseClkFreq
>)
>  {
>UINT64 Capability;
> @@ -117,6 +120,7 @@ SynQuacerSdMmcCapability (
>@param[in]  PhaseType The type of operation and whether the
>  hook is invoked right before (pre) or
>  right after (post)
> +  @param[in,out]  PhaseData The pointer to a phase-specific data.
>
>@retval EFI_SUCCESS   The override function completed successfully.
>@retval EFI_NOT_FOUND The specified controller or slot does not 
> exist.
> @@ -129,7 +133,8 @@ EFIAPI
>  SynQuacerSdMmcNotifyPhase (
>IN  EFI_HANDLE  ControllerHandle,
>IN  UINT8   Slot,
> -  IN  EDKII_SD_MMC_PHASE_TYPE PhaseType
> +  IN  EDKII_SD_MMC_PHASE_TYPE PhaseType,
> +  IN OUT  VOID   *PhaseData
>)
>  {
>if (ControllerHandle != mSdMmcControllerHandle) {
> --
> 2.7.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] Platform/ARM: Fix FVP broken build with "-D DT_SUPPORT"

2018-11-08 Thread Leif Lindholm
On Thu, Nov 01, 2018 at 11:35:42AM +, Andrew Turner wrote:
> The UEFI build fails for ArmVExpress-FVP-AArch64 when using the
> "-D DT_SUPPORT" buildoption.
> 
> ArmVExpressDtPlatformDtbLoaderLib is missing the ArmVExpressPkg.dec package
> and fails with:
> .../Platform/ARM/VExpressPkg/Include/Platform/RTSM/ArmPlatform.h:19:33:
> fatal error: VExpressMotherBoard.h: No such file or directory
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Andrew Turner 
> ---
>  .../ArmVExpressDtPlatformDtbLoaderLib.inf| 1 
> +
>  1 file changed, 1 insertion(+)
> 
> diff --git 
> a/Platform/ARM/VExpressPkg/Library/ArmVExpressDtPlatformDtbLoaderLib/ArmVExpressDtPlatformDtbLoaderLib.inf
>  
> b/Platform/ARM/VExpressPkg/Library/ArmVExpressDtPlatformDtbLoaderLib/ArmVExpressDtPlatformDtbLoaderLib.inf
> index 5012101..eb821c7 100644
> --- 
> a/Platform/ARM/VExpressPkg/Library/ArmVExpressDtPlatformDtbLoaderLib/ArmVExpressDtPlatformDtbLoaderLib.inf
> +++ 
> b/Platform/ARM/VExpressPkg/Library/ArmVExpressDtPlatformDtbLoaderLib/ArmVExpressDtPlatformDtbLoaderLib.inf
> @@ -26,6 +26,7 @@
>  [Packages]
>ArmPkg/ArmPkg.dec
>MdePkg/MdePkg.dec
> ++  Platform/ARM/VExpressPkg/ArmVExpressPkg.dec

Dropped this extra leading + (is this some sort of alternative diff
format or a character encoding issue?). With that:
Reviewed-by: Leif Lindholm 

Pushed as 113d2def98.

>EmbeddedPkg/EmbeddedPkg.dec
>  
>  [LibraryClasses]
> -- 
> 2.7.4
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 3/4] MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride

2018-11-08 Thread Marcin Wojtas
czw., 8 lis 2018 o 12:09 Ard Biesheuvel  napisał(a):
>
> On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> > From: Tomasz Michalec 
> >
> > Some SD Host Controlers need to do additional opperations after clock
> > frequency switch.
> >
> > This patch add new callback type to NotifyPhase of the SdMmcOverride
> > protocol. It is called after EmmcSwitchClockFreq and SdMmcHcClockSupply.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marcin Wojtas 
> > ---
> >  MdeModulePkg/Include/Protocol/SdMmcOverride.h   |  1 +
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 60 
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c   | 18 ++
> >  3 files changed, 79 insertions(+)
> >
> > diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> > b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > index f948bef..6160b5b 100644
> > --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > @@ -48,6 +48,7 @@ typedef enum {
> >EdkiiSdMmcInitHostPre,
> >EdkiiSdMmcInitHostPost,
> >EdkiiSdMmcUhsSignaling,
> > +  EdkiiSdMmcSwitchClockFreqPost,
> >  } EDKII_SD_MMC_PHASE_TYPE;
> >
> >  /**
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > index 473df8d..6fc6871 100755
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > @@ -794,6 +794,27 @@ EmmcSwitchToHighSpeed (
> >
> >HsTiming = 1;
> >Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, 
> > ClockFreq);
> > +  if (EFI_ERROR (Status)) {
> > +return Status;
> > +  }
> > +
> > +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> > +Status = mOverride->NotifyPhase (
> > +  Private->ControllerHandle,
> > +  Slot,
> > +  EdkiiSdMmcSwitchClockFreqPost,
> > +  
> > +  );
> > +if (EFI_ERROR (Status)) {
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"%a: SD/MMC switch clock freq post notifier callback failed - 
> > %r\n",
> > +__FUNCTION__,
> > +Status
> > +));
> > +  return Status;
> > +}
> > +  }
>
> Is there a way we could move this into EmmcSwitchClockFreq() rather
> than duplicate it?
>

Yes, it will only require modifying EmmcSwitchClockFreq argument list,
but this is no cost.

> >
> >return Status;
> >  }
> > @@ -904,6 +925,24 @@ EmmcSwitchToHS200 (
> >  return Status;
> >}
> >
> > +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> > +Status = mOverride->NotifyPhase (
> > +  Private->ControllerHandle,
> > +  Slot,
> > +  EdkiiSdMmcSwitchClockFreqPost,
> > +  
> > +  );
> > +if (EFI_ERROR (Status)) {
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"%a: SD/MMC switch clock freq post notifier callback failed - 
> > %r\n",
> > +__FUNCTION__,
> > +Status
> > +));
> > +  return Status;
> > +}
> > +  }
> > +
> >Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusWidth);
> >
> >return Status;
> > @@ -988,6 +1027,27 @@ EmmcSwitchToHS400 (
> >
> >HsTiming = 3;
> >Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, 
> > ClockFreq);
> > +  if (EFI_ERROR (Status)) {
> > +return Status;
> > +  }
> > +
> > +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> > +Status = mOverride->NotifyPhase (
> > +  Private->ControllerHandle,
> > +  Slot,
> > +  EdkiiSdMmcSwitchClockFreqPost,
> > +  
> > +  );
> > +if (EFI_ERROR (Status)) {
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"%a: SD/MMC switch clock freq post notifier callback failed - 
> > %r\n",
> > +__FUNCTION__,
> > +Status
> > +));
> > +  return Status;
> > +}
> > +  }
> >
> >return Status;
> >  }
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c 
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > index 850ad26..5408bbc 100644
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > @@ -887,6 +887,24 @@ SdCardSetBusMode (
> >  return Status;
> >}
> >
> > +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> > +Status = mOverride->NotifyPhase (
> > +  Private->ControllerHandle,
> > +  Slot,
> > +  EdkiiSdMmcSwitchClockFreqPost,
> > +  
> > +  );
> > +if (EFI_ERROR (Status)) {
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +   

Re: [edk2] [PATCH v3 2/4] MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol

2018-11-08 Thread Marcin Wojtas
Hi Ard,

I'm glad you're back :)

czw., 8 lis 2018 o 12:06 Ard Biesheuvel  napisał(a):
>
> On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> > From: Tomasz Michalec 
> >
> > Some SD Host Controllers use different values in Host Control 2 Register
> > to select UHS Mode. This patch adds a new UhsSignaling type routine to
> > the NotifyPhase of the SdMmcOverride protocol.
> >
> > UHS signaling configuration is moved to a common, default routine
> > (SdMmcHcUhsSignaling). After it is executed, the protocol producer
> > can override the values if needed..
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marcin Wojtas 
> > ---
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h |  32 +
> >  MdeModulePkg/Include/Protocol/SdMmcOverride.h|  17 +++
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c  | 136 +---
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c|  31 -
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c |  66 ++
> >  5 files changed, 225 insertions(+), 57 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h 
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> > index 7e3f588..1a11d51 100644
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> > @@ -63,6 +63,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 
> > EITHER EXPRESS OR IMPLIED.
> >  #define SD_MMC_HC_CTRL_VER0xFE
> >
> >  //
> > +// SD Host Controller bits to HOST_CTRL2 register
> > +//
> > +#define SD_MMC_HC_CTRL_UHS_MASK   0x0007
> > +#define SD_MMC_HC_CTRL_UHS_SDR12  0x
> > +#define SD_MMC_HC_CTRL_UHS_SDR25  0x0001
> > +#define SD_MMC_HC_CTRL_UHS_SDR50  0x0002
> > +#define SD_MMC_HC_CTRL_UHS_SDR104 0x0003
> > +#define SD_MMC_HC_CTRL_UHS_DDR50  0x0004
> > +#define SD_MMC_HC_CTRL_MMC_LEGACY 0x
> > +#define SD_MMC_HC_CTRL_MMC_HS_SDR 0x0001
> > +#define SD_MMC_HC_CTRL_MMC_HS_DDR 0x0004
> > +#define SD_MMC_HC_CTRL_MMC_HS200  0x0003
> > +#define SD_MMC_HC_CTRL_MMC_HS400  0x0005
> > +
> > +//
> >  // The transfer modes supported by SD Host Controller
> >  // Simplified Spec 3.0 Table 1-2
> >  //
> > @@ -518,4 +533,21 @@ SdMmcHcInitTimeoutCtrl (
> >IN UINT8  Slot
> >);
> >
> > +/**
> > +  Set SD Host Controller control 2 registry according to selected speed.
> > +
> > +  @param[in] PciIo  The PCI IO protocol instance.
> > +  @param[in] Slot   The slot number of the SD card to send the 
> > command to.
> > +  @param[in] Timing The timing to select.
> > +
> > +  @retval EFI_SUCCESS   The timing is set successfully.
> > +  @retval OthersThe timing isn't set successfully.
> > +**/
> > +EFI_STATUS
> > +SdMmcHcUhsSignaling (
> > +  IN EFI_PCI_IO_PROTOCOL*PciIo,
> > +  IN UINT8  Slot,
> > +  IN SD_MMC_BUS_MODETiming
> > +  );
> > +
> >  #endif
> > diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> > b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > index 8a7669e..f948bef 100644
> > --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> > @@ -26,11 +26,28 @@
> >
> >  typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;
> >
> > +//
> > +// Bus timing modes
> > +//
> > +typedef enum {
> > +  SdMmcUhsSdr12,
> > +  SdMmcUhsSdr25,
> > +  SdMmcUhsSdr50,
> > +  SdMmcUhsSdr104,
> > +  SdMmcUhsDdr50,
> > +  SdMmcMmcLegacy,
> > +  SdMmcMmcHsSdr,
> > +  SdMmcMmcHsDdr,
> > +  SdMmcMmcHs200,
> > +  SdMmcMmcHs400,
> > +} SD_MMC_BUS_MODE;
> > +
> >  typedef enum {
> >EdkiiSdMmcResetPre,
> >EdkiiSdMmcResetPost,
> >EdkiiSdMmcInitHostPre,
> >EdkiiSdMmcInitHostPost,
> > +  EdkiiSdMmcUhsSignaling,
> >  } EDKII_SD_MMC_PHASE_TYPE;
> >
> >  /**
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > index c5fd214..473df8d 100755
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > @@ -740,10 +740,13 @@ EmmcSwitchToHighSpeed (
> >IN UINT8  BusWidth
> >)
> >  {
> > -  EFI_STATUS  Status;
> > -  UINT8   HsTiming;
> > -  UINT8   HostCtrl1;
> > -  UINT8   HostCtrl2;
> > +  EFI_STATUS  Status;
> > +  UINT8   HsTiming;
> > +  UINT8   HostCtrl1;
> > +  SD_MMC_BUS_MODE Timing;
> > +  SD_MMC_HC_PRIVATE_DATA  *Private;
> > +
> > +  Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);
> >
> >Status = EmmcSwitchBusWidth (PciIo, PassThru, Slot, Rca, IsDdr, 
> > BusWidth);
> >if (EFI_ERROR (Status)) {
> > @@ -758,29 +761,37 @@ EmmcSwitchToHighSpeed (
> >  return Status;
> >}
> >
> > -  //
> > -  // Clean UHS Mode Select field of Host Control 2 reigster before update
> > -  //
> > -  

Re: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()

2018-11-08 Thread Ard Biesheuvel
On 30 October 2018 at 22:30, Jeff Brasen  wrote:
> This function is exposed by the MemoryAllocationLib header.
> An AllocateZeroPool() function has been added to fix modules depending on
> this library and this function.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen 
> ---
>  .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 
> ++
>  1 file changed, 32 insertions(+)
>
> diff --git 
> a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c 
> b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> index 0e75e23..f93f9cf 100644
> --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> @@ -16,6 +16,7 @@
>  #include 
>
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -195,6 +196,37 @@ AllocatePool (
>  }
>
>  /**
> +  Allocates and zeros a buffer of type EfiBootServicesData.
> +
> +  Allocates the number bytes specified by AllocationSize of type 
> EfiBootServicesData, clears the
> +  buffer with zeros, and returns a pointer to the allocated buffer.  If 
> AllocationSize is 0, then a
> +  valid buffer of 0 size is returned.

I guess this is just boilerplate, but what on earth is 'a valid buffer
of 0 size'?

>  If there is not enough memory remaining to satisfy the
> +  request, then NULL is returned.
> +
> +  @param  AllocationSizeThe number of bytes to allocate and zero.
> +
> +  @return A pointer to the allocated buffer or NULL if allocation fails.
> +
> +**/
> +VOID *
> +EFIAPI
> +AllocateZeroPool (
> +  IN UINTN  AllocationSize
> +  )
> +{
> +  VOID *Buffer;
> +
> +  Buffer = AllocatePool (AllocationSize);
> +  if (NULL == Buffer) {

Please don't use Yoda speak

> +return NULL;
> +  }
> +
> +  SetMem (Buffer, AllocationSize, 0);
> +
> +  return Buffer;
> +}
> +
> +/**
>Frees a buffer that was previously allocated with one of the pool 
> allocation functions in the
>Memory Allocation Library.
>
> --
> 2.7.4
>
> ___
> 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 v3 4/4] MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> Some SdMmc host controllers are run by clocks with different
> frequency than it is reflected in Capabilities Register 1.
> It is allowed by SDHCI specification ver. 4.2 - if BaseClkFreq
> field value of the Capability Register 1 is zero, the clock
> frequency must be obtained via another method.
>
> Because the bitfield is only 8 bits wide, a maximum value
> that could be obtained from hardware is 255MHz.
> In case the actual frequency exceeds 255MHz, the 8-bit BaseClkFreq
> member of SD_MMC_HC_SLOT_CAP structure occurs to be not sufficient
> to be used for setting the clock speed in SdMmcHcClockSupply
> function.
>
> This patch adds new UINT32 array ('BaseClkFreq[]') to
> SD_MMC_HC_PRIVATE_DATA structure for specifying
> the input clock speed for each slot of the host controller.
> All routines that are used for clock configuration are
> updated accordingly.
>
> This patch also adds new IN OUT BaseClockFreq field
> in the Capability callback of the SdMmcOverride,
> protocol which allows to update BaseClkFreq value.
>
> The patch reuses original commit from edk2-platforms:
> 20f6f144d3a8 ("Marvell/Drivers: XenonDxe: Allow overriding base clock
> frequency")
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 

Reviewed-by: Ard Biesheuvel 

> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |  6 +
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  8 +++
>  MdeModulePkg/Include/Protocol/SdMmcOverride.h  |  7 --
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c|  4 ++--
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c  |  4 ++--
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 ++-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 23 ++--
>  7 files changed, 43 insertions(+), 22 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
> index c683600..8c1a589 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
> @@ -118,6 +118,12 @@ typedef struct {
>UINT64  MaxCurrent[SD_MMC_HC_MAX_SLOT];
>
>UINT32  ControllerVersion;
> +
> +  //
> +  // Some controllers may require to override base clock frequency
> +  // value stored in Capabilities Register 1.
> +  //
> +  UINT32  BaseClkFreq[SD_MMC_HC_MAX_SLOT];
>  } SD_MMC_HC_PRIVATE_DATA;
>
>  #define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> index 1a11d51..8eefc31 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> @@ -423,7 +423,7 @@ SdMmcHcStopClock (
>@param[in] PciIo  The PCI IO protocol instance.
>@param[in] Slot   The slot number of the SD card to send the 
> command to.
>@param[in] ClockFreq  The max clock frequency to be set. The unit is 
> KHz.
> -  @param[in] Capability The capability of the slot.
> +  @param[in] BaseClkFreqThe base clock frequency of host controller in 
> MHz.
>
>@retval EFI_SUCCESS   The clock is supplied successfully.
>@retval OthersThe clock isn't supplied successfully.
> @@ -434,7 +434,7 @@ SdMmcHcClockSupply (
>IN EFI_PCI_IO_PROTOCOL*PciIo,
>IN UINT8  Slot,
>IN UINT64 ClockFreq,
> -  IN SD_MMC_HC_SLOT_CAP Capability
> +  IN UINT32 BaseClkFreq
>);
>
>  /**
> @@ -482,7 +482,7 @@ SdMmcHcSetBusWidth (
>
>@param[in] PciIo  The PCI IO protocol instance.
>@param[in] Slot   The slot number of the SD card to send the 
> command to.
> -  @param[in] Capability The capability of the slot.
> +  @param[in] BaseClkFreqThe base clock frequency of host controller in 
> MHz.
>
>@retval EFI_SUCCESS   The clock is supplied successfully.
>@retval OthersThe clock isn't supplied successfully.
> @@ -492,7 +492,7 @@ EFI_STATUS
>  SdMmcHcInitClockFreq (
>IN EFI_PCI_IO_PROTOCOL*PciIo,
>IN UINT8  Slot,
> -  IN SD_MMC_HC_SLOT_CAP Capability
> +  IN UINT32 BaseClkFreq
>);
>
>  /**
> diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> index 6160b5b..0aaf258 100644
> --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> @@ -22,7 +22,7 @@
>  #define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
>{ 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 
> 0x23 } }
>
> -#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x1
> +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x2
>
>  

Re: [edk2] [PATCH v3 3/4] MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> From: Tomasz Michalec 
>
> Some SD Host Controlers need to do additional opperations after clock
> frequency switch.
>
> This patch add new callback type to NotifyPhase of the SdMmcOverride
> protocol. It is called after EmmcSwitchClockFreq and SdMmcHcClockSupply.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 
> ---
>  MdeModulePkg/Include/Protocol/SdMmcOverride.h   |  1 +
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 60 
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c   | 18 ++
>  3 files changed, 79 insertions(+)
>
> diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> index f948bef..6160b5b 100644
> --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> @@ -48,6 +48,7 @@ typedef enum {
>EdkiiSdMmcInitHostPre,
>EdkiiSdMmcInitHostPost,
>EdkiiSdMmcUhsSignaling,
> +  EdkiiSdMmcSwitchClockFreqPost,
>  } EDKII_SD_MMC_PHASE_TYPE;
>
>  /**
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> index 473df8d..6fc6871 100755
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> @@ -794,6 +794,27 @@ EmmcSwitchToHighSpeed (
>
>HsTiming = 1;
>Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, 
> ClockFreq);
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> +
> +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> +Status = mOverride->NotifyPhase (
> +  Private->ControllerHandle,
> +  Slot,
> +  EdkiiSdMmcSwitchClockFreqPost,
> +  
> +  );
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((
> +DEBUG_ERROR,
> +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
> +__FUNCTION__,
> +Status
> +));
> +  return Status;
> +}
> +  }

Is there a way we could move this into EmmcSwitchClockFreq() rather
than duplicate it?

>
>return Status;
>  }
> @@ -904,6 +925,24 @@ EmmcSwitchToHS200 (
>  return Status;
>}
>
> +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> +Status = mOverride->NotifyPhase (
> +  Private->ControllerHandle,
> +  Slot,
> +  EdkiiSdMmcSwitchClockFreqPost,
> +  
> +  );
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((
> +DEBUG_ERROR,
> +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
> +__FUNCTION__,
> +Status
> +));
> +  return Status;
> +}
> +  }
> +
>Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusWidth);
>
>return Status;
> @@ -988,6 +1027,27 @@ EmmcSwitchToHS400 (
>
>HsTiming = 3;
>Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, 
> ClockFreq);
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> +
> +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> +Status = mOverride->NotifyPhase (
> +  Private->ControllerHandle,
> +  Slot,
> +  EdkiiSdMmcSwitchClockFreqPost,
> +  
> +  );
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((
> +DEBUG_ERROR,
> +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
> +__FUNCTION__,
> +Status
> +));
> +  return Status;
> +}
> +  }
>
>return Status;
>  }
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> index 850ad26..5408bbc 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> @@ -887,6 +887,24 @@ SdCardSetBusMode (
>  return Status;
>}
>
> +  if (mOverride != NULL && mOverride->NotifyPhase != NULL) {
> +Status = mOverride->NotifyPhase (
> +  Private->ControllerHandle,
> +  Slot,
> +  EdkiiSdMmcSwitchClockFreqPost,
> +  
> +  );
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((
> +DEBUG_ERROR,
> +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n",
> +__FUNCTION__,
> +Status
> +));
> +  return Status;
> +}
> +  }
> +
>if ((AccessMode == 3) || ((AccessMode == 2) && (Capability->TuningSDR50 != 
> 0))) {
>  Status = SdCardTuningClock (PciIo, PassThru, Slot);
>  if (EFI_ERROR (Status)) {
> --
> 2.7.4
>
___
edk2-devel mailing list

Re: [edk2] [PATCH v3 2/4] MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol

2018-11-08 Thread Ard Biesheuvel
On 8 November 2018 at 02:57, Marcin Wojtas  wrote:
> From: Tomasz Michalec 
>
> Some SD Host Controllers use different values in Host Control 2 Register
> to select UHS Mode. This patch adds a new UhsSignaling type routine to
> the NotifyPhase of the SdMmcOverride protocol.
>
> UHS signaling configuration is moved to a common, default routine
> (SdMmcHcUhsSignaling). After it is executed, the protocol producer
> can override the values if needed..
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 
> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h |  32 +
>  MdeModulePkg/Include/Protocol/SdMmcOverride.h|  17 +++
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c  | 136 +---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c|  31 -
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c |  66 ++
>  5 files changed, 225 insertions(+), 57 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> index 7e3f588..1a11d51 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
> @@ -63,6 +63,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #define SD_MMC_HC_CTRL_VER0xFE
>
>  //
> +// SD Host Controller bits to HOST_CTRL2 register
> +//
> +#define SD_MMC_HC_CTRL_UHS_MASK   0x0007
> +#define SD_MMC_HC_CTRL_UHS_SDR12  0x
> +#define SD_MMC_HC_CTRL_UHS_SDR25  0x0001
> +#define SD_MMC_HC_CTRL_UHS_SDR50  0x0002
> +#define SD_MMC_HC_CTRL_UHS_SDR104 0x0003
> +#define SD_MMC_HC_CTRL_UHS_DDR50  0x0004
> +#define SD_MMC_HC_CTRL_MMC_LEGACY 0x
> +#define SD_MMC_HC_CTRL_MMC_HS_SDR 0x0001
> +#define SD_MMC_HC_CTRL_MMC_HS_DDR 0x0004
> +#define SD_MMC_HC_CTRL_MMC_HS200  0x0003
> +#define SD_MMC_HC_CTRL_MMC_HS400  0x0005
> +
> +//
>  // The transfer modes supported by SD Host Controller
>  // Simplified Spec 3.0 Table 1-2
>  //
> @@ -518,4 +533,21 @@ SdMmcHcInitTimeoutCtrl (
>IN UINT8  Slot
>);
>
> +/**
> +  Set SD Host Controller control 2 registry according to selected speed.
> +
> +  @param[in] PciIo  The PCI IO protocol instance.
> +  @param[in] Slot   The slot number of the SD card to send the 
> command to.
> +  @param[in] Timing The timing to select.
> +
> +  @retval EFI_SUCCESS   The timing is set successfully.
> +  @retval OthersThe timing isn't set successfully.
> +**/
> +EFI_STATUS
> +SdMmcHcUhsSignaling (
> +  IN EFI_PCI_IO_PROTOCOL*PciIo,
> +  IN UINT8  Slot,
> +  IN SD_MMC_BUS_MODETiming
> +  );
> +
>  #endif
> diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h 
> b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> index 8a7669e..f948bef 100644
> --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h
> @@ -26,11 +26,28 @@
>
>  typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;
>
> +//
> +// Bus timing modes
> +//
> +typedef enum {
> +  SdMmcUhsSdr12,
> +  SdMmcUhsSdr25,
> +  SdMmcUhsSdr50,
> +  SdMmcUhsSdr104,
> +  SdMmcUhsDdr50,
> +  SdMmcMmcLegacy,
> +  SdMmcMmcHsSdr,
> +  SdMmcMmcHsDdr,
> +  SdMmcMmcHs200,
> +  SdMmcMmcHs400,
> +} SD_MMC_BUS_MODE;
> +
>  typedef enum {
>EdkiiSdMmcResetPre,
>EdkiiSdMmcResetPost,
>EdkiiSdMmcInitHostPre,
>EdkiiSdMmcInitHostPost,
> +  EdkiiSdMmcUhsSignaling,
>  } EDKII_SD_MMC_PHASE_TYPE;
>
>  /**
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> index c5fd214..473df8d 100755
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> @@ -740,10 +740,13 @@ EmmcSwitchToHighSpeed (
>IN UINT8  BusWidth
>)
>  {
> -  EFI_STATUS  Status;
> -  UINT8   HsTiming;
> -  UINT8   HostCtrl1;
> -  UINT8   HostCtrl2;
> +  EFI_STATUS  Status;
> +  UINT8   HsTiming;
> +  UINT8   HostCtrl1;
> +  SD_MMC_BUS_MODE Timing;
> +  SD_MMC_HC_PRIVATE_DATA  *Private;
> +
> +  Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru);
>
>Status = EmmcSwitchBusWidth (PciIo, PassThru, Slot, Rca, IsDdr, BusWidth);
>if (EFI_ERROR (Status)) {
> @@ -758,29 +761,37 @@ EmmcSwitchToHighSpeed (
>  return Status;
>}
>
> -  //
> -  // Clean UHS Mode Select field of Host Control 2 reigster before update
> -  //
> -  HostCtrl2 = (UINT8)~0x7;
> -  Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof 
> (HostCtrl2), );
> -  if (EFI_ERROR (Status)) {
> -return Status;
> -  }
> -  //
> -  // Set UHS Mode Select field of Host Control 2 reigster to SDR12/25/50
> -  //
>if (IsDdr) {
> -HostCtrl2 = BIT2;
> +Timing = SdMmcMmcHsDdr;
>} else if (ClockFreq 

[edk2] [Patch] BaseTools: Optimize string concatenation

2018-11-08 Thread BobCF
https://bugzilla.tianocore.org/show_bug.cgi?id=1288

This patch is one of build tool performance improvement
series patches.

This patch is going to use join function instead of
string += string2 statement.

Current code use string += string2 in a loop to combine
a string. while creating a string list in a loop and using
"".join(stringlist) after the loop will be much faster.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: BobCF 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/StrGather.py  | 39 +--
 BaseTools/Source/Python/Common/Misc.py| 21 +-
 .../Source/Python/Workspace/InfBuildData.py   |  4 +-
 .../Python/Workspace/WorkspaceCommon.py   | 11 ++
 4 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py 
b/BaseTools/Source/Python/AutoGen/StrGather.py
index 361d499076..d34a9e9447 100644
--- a/BaseTools/Source/Python/AutoGen/StrGather.py
+++ b/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -135,11 +135,11 @@ def AscToHexList(Ascii):
 # @param UniGenCFlag  UniString is generated into AutoGen C file when it 
is set to True
 #
 # @retval Str:   A string of .h file content
 #
 def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, 
UniGenCFlag):
-Str = ''
+Str = []
 ValueStartPtr = 60
 Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME + ' ' * 
(ValueStartPtr - len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(0, 
4) + COMMENT_NOT_REFERENCED
 Str = WriteLine(Str, Line)
 Line = COMMENT_DEFINE_STR + ' ' + PRINTABLE_LANGUAGE_NAME_STRING_NAME + ' 
' * (ValueStartPtr - len(DEFINE_STR + PRINTABLE_LANGUAGE_NAME_STRING_NAME)) + 
DecToHexStr(1, 4) + COMMENT_NOT_REFERENCED
 Str = WriteLine(Str, Line)
@@ -164,16 +164,16 @@ def CreateHFileContent(BaseName, UniObjectClass, 
IsCompatibleMode, UniGenCFlag):
 Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + 
DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
 else:
 Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * 
(ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + 
COMMENT_NOT_REFERENCED
 UnusedStr = WriteLine(UnusedStr, Line)
 
-Str = ''.join([Str, UnusedStr])
+Str.extend( UnusedStr)
 
 Str = WriteLine(Str, '')
 if IsCompatibleMode or UniGenCFlag:
 Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')
-return Str
+return "".join(Str)
 
 ## Create a complete .h file
 #
 # Create a complet .h file with file header and file content
 #
@@ -185,11 +185,11 @@ def CreateHFileContent(BaseName, UniObjectClass, 
IsCompatibleMode, UniGenCFlag):
 # @retval Str:   A string of complete .h file
 #
 def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
 HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass, 
IsCompatibleMode, UniGenCFlag))
 
-return HFile
+return "".join(HFile)
 
 ## Create a buffer to store all items in an array
 #
 # @param BinBuffer   Buffer to contain Binary data.
 # @param Array:  The array need to be formatted
@@ -209,11 +209,11 @@ def CreateBinBuffer(BinBuffer, Array):
 #
 def CreateArrayItem(Array, Width = 16):
 MaxLength = Width
 Index = 0
 Line = '  '
-ArrayItem = ''
+ArrayItem = []
 
 for Item in Array:
 if Index < MaxLength:
 Line = Line + Item + ',  '
 Index = Index + 1
@@ -221,11 +221,11 @@ def CreateArrayItem(Array, Width = 16):
 ArrayItem = WriteLine(ArrayItem, Line)
 Line = '  ' + Item + ',  '
 Index = 1
 ArrayItem = Write(ArrayItem, Line.rstrip())
 
-return ArrayItem
+return "".join(ArrayItem)
 
 ## CreateCFileStringValue
 #
 # Create a line with string value
 #
@@ -236,11 +236,11 @@ def CreateArrayItem(Array, Width = 16):
 
 def CreateCFileStringValue(Value):
 Value = [StringBlockType] + Value
 Str = WriteLine('', CreateArrayItem(Value))
 
-return Str
+return "".join(Str)
 
 ## GetFilteredLanguage
 #
 # apply get best language rules to the UNI language code list
 #
@@ -438,11 +438,11 @@ def CreateCFileContent(BaseName, UniObjectClass, 
IsCompatibleMode, UniBinBuffer,
 #
 # Join package data
 #
 AllStr = Write(AllStr, Str)
 
-return AllStr
+return "".join(AllStr)
 
 ## Create end of .c file
 #
 # Create end of .c file
 #
@@ -465,11 +465,11 @@ def CreateCFileEnd():
 #
 def CreateCFile(BaseName, UniObjectClass, IsCompatibleMode, FilterInfo):
 CFile = ''
 CFile = WriteLine(CFile, CreateCFileContent(BaseName, UniObjectClass, 
IsCompatibleMode, None, FilterInfo))
 CFile = WriteLine(CFile, CreateCFileEnd())
-return CFile
+return "".join(CFile)
 
 ## GetFileList
 #
 # Get a list for all files
 #
@@ -572,17 +572,34 @@ def GetStringFiles(UniFilList, SourceFileList, 
IncludeList, IncludePathList, Ski
 
 #
 # 

Re: [edk2] Help on Error Handling

2018-11-08 Thread Fu, Siyuan
Hi, Siva

Is the exception occurs inside the Tcp->Close() function or 
HttpCloseConnection(). Are you able to check which function could be mapping to 
"RIP  - 657026F8"?

BestRegards
Fu Siyuan

From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in]
Sent: Thursday, November 8, 2018 4:38 PM
To: Fu, Siyuan ; edk2-devel@lists.01.org
Cc: Arun Subramanian B 
Subject: reg: Help on Error Handling

Hello All,

We are seeing an issue in HTTPDxe module when there is a hot unplug of a USB 
Network device while HTTP Post is happening.

Details:

An application tries to post the data to HTTPS Server using an USB Network 
device in UEFI environment. When the HTTP Post request Initiated there was a 
sudden disconnection happening in USB End and In HttpCloseConnection() 
Exception occurs in HttpInstance->Tcp6->Close .

 X64 Exception Type - 0D(#GP - General Protection)  CPU Apic ID -  

ExceptionData - 
RIP  - 657026F8, CS  - 0038, RFLAGS - 00010212
RAX  - 62D22E38, RCX - 62D22E38, RDX - 62D22110
RBX  - 0007, RSP - 6BDCE0F0, RBP - 
RSI  - 0004, RDI - 
R8   - 000A, R9  - , R10 - 62D42298
R11  - 6BC48918, R12 - 0004, R13 - 
R14  - 8003, R15 - 0007
DS   - 0030, ES  - 0030, FS  - 0030
GS   - 0030, SS  - 0030
CR0  - 8013, CR2 - , CR3 - 6BC4E000
CR4  - 0668, CR8 - 
DR0  - , DR1 - , DR2 - 
DR3  - , DR6 - 0FF0, DR7 - 0400
GDTR - 65D9D6A0 0047, LDTR - 
IDTR - 63064018 0FFF,   TR - 
FXSAVE_STATE - 6BDCDD50

Any idea how this case can be handled without exception in the environment 
where dynamic unplug of a network device which performs UNDI operation.

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


[edk2] reg: Help on Error Handling

2018-11-08 Thread Sivaraman Nainar
Hello All,

We are seeing an issue in HTTPDxe module when there is a hot unplug of a USB 
Network device while HTTP Post is happening.

Details:

An application tries to post the data to HTTPS Server using an USB Network 
device in UEFI environment. When the HTTP Post request Initiated there was a 
sudden disconnection happening in USB End and In HttpCloseConnection() 
Exception occurs in HttpInstance->Tcp6->Close .

 X64 Exception Type - 0D(#GP - General Protection)  CPU Apic ID -  

ExceptionData - 
RIP  - 657026F8, CS  - 0038, RFLAGS - 00010212
RAX  - 62D22E38, RCX - 62D22E38, RDX - 62D22110
RBX  - 0007, RSP - 6BDCE0F0, RBP - 
RSI  - 0004, RDI - 
R8   - 000A, R9  - , R10 - 62D42298
R11  - 6BC48918, R12 - 0004, R13 - 
R14  - 8003, R15 - 0007
DS   - 0030, ES  - 0030, FS  - 0030
GS   - 0030, SS  - 0030
CR0  - 8013, CR2 - , CR3 - 6BC4E000
CR4  - 0668, CR8 - 
DR0  - , DR1 - , DR2 - 
DR3  - , DR6 - 0FF0, DR7 - 0400
GDTR - 65D9D6A0 0047, LDTR - 
IDTR - 63064018 0FFF,   TR - 
FXSAVE_STATE - 6BDCDD50

Any idea how this case can be handled without exception in the environment 
where dynamic unplug of a network device which performs UNDI operation.

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


[edk2] Hard Feature Freeze starts today for edk2-stable201811

2018-11-08 Thread Gao, Liming
Hi, all
  Today, we enter into Hard Feature Freeze phase until edk2-stable201811 tag is 
created at 2018-11-15. In this phase, there is no feature to be pushed. The bug 
fix is still allowed. 

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gao,
>Liming
>Sent: Wednesday, November 07, 2018 9:12 AM
>To: edk2-devel@lists.01.org
>Subject: [edk2] Soft Feature Freeze has started since Nov.1 for dk2-
>stable201811
>
>Hi, all
>  https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-
>Planning lists edk2-stable201811 tag planning. Now, we enter into Soft
>Feature Freeze phase. In this phase, the feature under review will not be
>allowed to be pushed. The patch review can continue without break. Here is
>edk2-stable201811 tag planning.
>2018-08-15 Beginning of development
>2018-11-01 Soft Feature Freeze
>2018-11-08 Hard Feature Freeze
>2018-11-15 Release
>
>Thanks
>Liming
>___
>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