Re: [edk2] [PATCH 1/1] ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

2018-08-28 Thread Bhupesh Sharma
Hi Sumit,

On Tue, Aug 28, 2018 at 10:04 PM, Sumit Garg  wrote:
> Hi Achin,
>
> On Tue, 28 Aug 2018 at 18:38, Achin Gupta  wrote:
>>
>> Hi Sumit,
>>
>> Apologies for not replying sooner. Some questions and thoughts inline.
>>
>> On Mon, Aug 27, 2018 at 03:28:52PM +0530, Sumit Garg wrote:
>> > On Fri, 24 Aug 2018 at 23:33, Matteo Carlini  
>> > wrote:
>> > >
>> > > +Achin
>> > >
>> > > SPD (for OP-TEE and other Trusted-OSes payloads running at S-EL1) and 
>> > > SPM (for Secure Partitions at S-EL0) are currently mutually exclusive 
>> > > into Trusted Firmware-A codebase.
>> > >
>> > > In other words, you cannot turn them on in parallel and execute both a 
>> > > S-EL1 Trusted OS AND (one or many) S-EL0 Secure Partitions in the Secure 
>> > > World with the current Software Architecture.
>> > >
>> >
>> > IIUC, currently BL32 image is common in Trusted Firmware-A code-base.
>> > If we turn on SPD then BL32= else if we turn on SPM
>> > then BL32=, correct?
>>
>> Yes! BL32 is a TOS image if SPD is enabled. It is a S-EL0 Standalone MM 
>> Secure
>> partition image if SPM is enabled.
>>
>> >
>> > But I think SMC calling conventions (SMC Calling Convention [1] and
>> > Management Mode Interface Specification [2]) doesn't put any such
>> > restrictions as SMC function IDs are totally separate.
>>
>> Yes, this was an implementation choice to ensure that either a S-EL1 payload
>> (Trusted OS) or a S-EL0 payload (MM SP) could be included in an Arm TF build 
>> but
>> not both.
>>
>> >
>> > > Achin and other Arm architects are trying to figure out a way for 
>> > > solving this problem without the need for a v8.4 Secure-EL2 Hypervisor, 
>> > > obviously without leveraging the isolation benefits of it (see also [1]).
>> > >
>> >
>> > Agree we won't be having isolation benefits which provides added level
>> > of Security.
>> >
>> > > But Ard is right: there could be use-cases to ship UEFI systems with 
>> > > OP-TEE and TAs on top...and this should still be currently possible 
>> > > using the SPD dispatcher into TF-A. I've not looked deeply into this 
>> > > patch, but it doesn’t seem to contradict the above Sw architecture.
>> > >
>> > > The question would be: would you foresee the need for running one (or 
>> > > many) other (UEFI/EDK2-based) Secure Services in the Secure World into a 
>> > > Secure Partition (using the StandaloneMmPkg) *together* with OP-TEE?
>> > >
>> >
>> > As per following quote from Management Mode Interface Specification [2]:
>> >
>> > "Management Mode (MM) provides an environment for implementing OS
>> > agnostic services (MM services) like RAS error handling, secure
>> > variable storage, and firmware updates in system firmware. The
>> > services can be invoked synchronously and asynchronously."
>> >
>> > It seems that MM mode is designed for more robust and platform
>> > specific services whereas OP-TEE (or any trusted OS) use-cases seem to
>> > be more complex like Entropy pool (RNG as in our case), DRM (could be
>> > valid use-case for Android TV or Chromebook), keymaster or keystore
>> > (for Edge devices) etc.
>>
>> It really depends upon the secure sw stack, use case and the requirements. MM
>> interface specification specifies a blocking SMC (MM_COMMUNICATE) to access a
>> secure service implemented in S-EL0.
>>
>> In the UEFI/PI/EDK2 context, MM drivers are used to satisfy a variety of use
>> cases during boot through the EFI_MM_COMMUNICATION_PROTOCOL (the bad press of
>> SMM aside!). MM_COMMUNICATE SMC provides a channel into the secure world to 
>> the
>> backend of this protocol on Arm systems. So any service accessible through 
>> this
>> protocol could be implemented on Arm systems in a MM SP.
>>
>> IIUC, in your case there is OP-TEE and firmware in the secure world. OP-TEE 
>> has
>> a static TA that provides the random data service and you want to leverage 
>> it at
>> boot time? Ditto for other services?
>
> Correct, actually we tried to create OP-TEE static (pseudo) TA that
> provides RNG service using thermal sensor noise and secure timer
> interrupts (FIQs) to fill entropy pool. Using this service via OP-TEE
> library in UEFI (subset in terms of functionality as compared to
> OP-TEE kernel driver) for features like KASLR etc.

Commenting on this from a distribution p-o-v, we have arn64 boards
available which have good entropy sources available but do not support
EFI_RNG_PROTOCOL as they would not like the EFI firmware running in
EL2 mode to use the secure entropy sources (which should be touched
only by secure EL3 or EL1 softwares).

In such cases, we are not able to support KASLR linux boot on such
boards as there is basically no EFI_RNG_PROTOCOL support (see [1]).
Ofcourse we can ask them to plug-in usb keys (Ard has a driver
available for the Chaos Usb Key, see [2]) to help generate the random
entropy for us, but it is not always possible in a production
environment. Using on-board entropy sources (if available), is the
best possible alternative there.

We rely on using 

Re: [edk2] [PATCH 1/1] ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

2018-08-28 Thread Udit Kumar
 
> > So you do not really need an MM partition running alongside OP-TEE?
> >
> 
> Agree that most of secure services can be implemented as static
> (pseudo) TAs. But if I think about services like RAS error handling and
> firmware updates. Is Trusted OS (OP-TEE or any third party OS) an
> appropriate place to implement these platform specific services?

In my view, UEFI/MM services should be TOS specific. 
These must be independent of TOS. 

> Regards,
> Sumit
> 
> > >
> > > So it looks like they complement each other and we will have more
> > > robustness once we migrate to v8.4 Secure-EL2 Hypervisor for
> > > isolation support.
> >
> > In a way yes! The robustness bit is not really related to the
> > interface used to access as service.
> >
> > >
> > > Please feel free to correct me if I missed something.
> >
> > Hope this makes sense.
> >
> > cheers,
> > Achin
> >
> > >
> > > Regards,
> > > Sumit
> > >
> > > [1]
> > >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fin
> > >
> focenter.arm.com%2Fhelp%2Ftopic%2Fcom.arm.doc.den0028b%2FARM_DE
> N0028
> > >
> B_SMC_Calling_Convention.pdfdata=02%7C01%7Cudit.kumar%40nxp.
> com
> > >
> %7C8e3b0815c5424819b54f08d60d043499%7C686ea1d3bc2b4c6fa92cd99c5
> c3016
> > >
> 35%7C0%7C0%7C636710709050808156sdata=ad%2BlzFhGuZo9weUA
> CLYz3h%2
> > > FiGtRRbibouX7uXxrRQfw%3Dreserved=0
> > > [2]
> > >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fin
> > >
> focenter.arm.com%2Fhelp%2Ftopic%2Fcom.arm.doc.den0060a%2FDEN0060
> A_AR
> > >
> M_MM_Interface_Specification.pdfdata=02%7C01%7Cudit.kumar%40
> nxp
> > >
> .com%7C8e3b0815c5424819b54f08d60d043499%7C686ea1d3bc2b4c6fa92cd
> 99c5c
> > >
> 301635%7C0%7C0%7C636710709050808156sdata=CdVkFdX0dYkb%2F
> 8LzQXtJ
> > > WjlKjIsBoG1QHjxVvTIlV8k%3Dreserved=0
> > >
> > > > Thanks
> > > > Matteo
> > > >
> > > > [1]:
> > > >
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
> > > >
> Fcommunity.arm.com%2Fprocessors%2Fb%2Fblog%2Fposts%2Farchitecting-
> > > > more-secure-world-with-isolation-and-virtualizationdata=02%7C
> > > >
> 01%7Cudit.kumar%40nxp.com%7C8e3b0815c5424819b54f08d60d043499%7
> C686
> > > >
> ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636710709050808156
> p;sda
> > > >
> ta=fCaQAmaYd7Qur81A%2BRPvJ373e2uRuE0IJFTUDx8JzfU%3Dreserve
> d=0
> > > >
> > > > > -Original Message-
> > > > > From: Udit Kumar 
> > > > > Sent: 24 August 2018 18:46
> > > > > To: Ard Biesheuvel ; Matteo Carlini
> > > > > 
> > > > > Cc: Sumit Garg ; edk2-devel@lists.01.org;
> > > > > tee- d...@lists.linaro.org; daniel.thomp...@linaro.org;
> > > > > jens.wiklan...@linaro.org; Rod Dorris 
> > > > > Subject: RE: [edk2] [PATCH 1/1] ArmPkg/OpteeLib: Add APIs to
> > > > > communicate with OP-TEE
> > > > >
> > > > > Hi Ard
> > > > >
> > > > > > If MM mode is fundamentally incompatible with OP-TEE, then you
> > > > > > cannot run both at the same time,
> > > > >
> > > > > Both cannot coexist unless you have v8.4 CPU
> > > > >
> > > > > Regards
> > > > > Udit
> > > > >
> > > > > >
> > > > > >
> > > > > > >> -Original Message-
> > > > > > >> From: edk2-devel  On
> > > > > > >> Behalf Of Sumit Garg
> > > > > > >> Sent: Friday, August 24, 2018 2:51 PM
> > > > > > >> To: edk2-devel@lists.01.org
> > > > > > >> Cc: daniel.thomp...@linaro.org; tee-...@lists.linaro.org;
> > > > > > >> jens.wiklan...@linaro.org
> > > > > > >> Subject: [edk2] [PATCH 1/1] ArmPkg/OpteeLib: Add APIs to
> > > > > > >> communicate with OP-TEE
> > > > > > >>
> > > > > > >> Add following APIs to communicate with OP-TEE static TA:
> > > > > > >> 1. OpteeInit
> > > > > > >> 2. OpteeOpenSession
> > > > > > >> 3. OpteeCloseSession
> > > > > > >> 4. OpteeInvokeFunc
> > > > > > >>
> > > > > > >> Cc: Ard Biesheuvel 
> > > > > > >> Cc: Leif Lindholm 
> > > > > > >> Contributed-under: TianoCore Contribution Agreement 1.1
> > > > > > >> Signed-off-by: Sumit Garg 
> > > > > > >> ---
> > > > > > >>  ArmPkg/Include/Library/OpteeLib.h  | 102 ++
> > > > > > >>  ArmPkg/Library/OpteeLib/Optee.c| 358
> > > > > > >> +
> > > > > > >>  ArmPkg/Library/OpteeLib/OpteeLib.inf   |   2 +
> > > > > > >>  ArmPkg/Library/OpteeLib/OpteeSmc.h |  43 +++
> > > > > > >>  .../Include/IndustryStandard/GlobalPlatform.h  |  60 ++--
> > > > > > >>  5 files changed, 531 insertions(+), 34 deletions(-)
> > > > > > >> create mode
> > > > > > >> 100644 ArmPkg/Library/OpteeLib/OpteeSmc.h
> > > > > > >>  copy ArmPkg/Include/Library/OpteeLib.h =>
> > > > > > >> MdePkg/Include/IndustryStandard/GlobalPlatform.h (53%)
> > > > > > >>
> > > > > > >> diff --git a/ArmPkg/Include/Library/OpteeLib.h
> > > > > > >> b/ArmPkg/Include/Library/OpteeLib.h
> > > > > > >> index f65d8674d9b8..c323f49072f8 100644
> > > > > > >> --- a/ArmPkg/Include/Library/OpteeLib.h
> > > > > > >> +++ b/ArmPkg/Include/Library/OpteeLib.h
> > > > > > >> @@ -25,10 +25,112 @@
> > > > > > >>  #define OPTEE_OS_UID2  

[edk2] [Patch] BaseTools: include variable namespace GUIDs of HII PCDs in Guid.xref

2018-08-28 Thread Yonghong Zhu
From: zhijufan 

[PcdsDynamicHii]
gFooTokenSpaceGuid.PcdBar|L"Variable"|gVarNameSpaceGuid|0x0|FALSE|NV,BS

This patch add the variable namespace GUIDs in "Guid.xref" that are
used with dynamic HII PCDs.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=452
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 2307a19..9dec9c5 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -601,16 +601,27 @@ class GenFds :
 print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType)
 
 def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
 GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, 
"Guid.xref")
 GuidXRefFile = BytesIO('')
+PkgGuidDict = {}
 GuidDict = {}
 ModuleList = []
 FileGuidList = []
 GuidPattern = gGuidPattern
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+PkgList = 
GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
 Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag)
+for P in PkgList:
+PkgGuidDict.update(P.Guids)
+for Name, Guid in PlatformDataBase.Pcds:
+Pcd = PlatformDataBase.Pcds[Name, Guid]
+if Pcd.Type in [TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_EX_HII]:
+for SkuId in Pcd.SkuInfoList:
+Sku = Pcd.SkuInfoList[SkuId]
+if Sku.VariableGuid and Sku.VariableGuid in 
PkgGuidDict.keys():
+GuidDict[Sku.VariableGuid] = 
PkgGuidDict[Sku.VariableGuid]
 for ModuleFile in PlatformDataBase.Modules:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 if Module in ModuleList:
 continue
 else:
-- 
2.6.1.windows.1

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


Re: [edk2] [PATCH 00/10] Quality improvement for EmulatorPkg Win Host

2018-08-28 Thread Ni, Ruiyu
Hao,
Thanks for the comments.
I just sent out a patch with title "[edk2] [PATCH] EmulatorPkg: formalize line 
endings".
My patch sets will be re-generated after the line ending formalization patch is 
commit. 

Thanks/Ray

> -Original Message-
> From: Wu, Hao A
> Sent: Wednesday, August 29, 2018 9:58 AM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH 00/10] Quality improvement for EmulatorPkg Win
> Host
> 
> Hi Ray,
> 
> One general-level comment, I saw some file was originally with Unix line
> ending format (LF), but after the series, the line ending is in a mixed state
> (both containing Unix LF & Windows CRLF). Can you help to perform the line
> ending format cleanup for those files?
> 
> Also, please help to run the PatchCheck tool to verify the format of the
> commits. Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Ruiyu Ni
> > Sent: Monday, August 27, 2018 3:53 PM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH 00/10] Quality improvement for EmulatorPkg Win
> > Host
> >
> > The patch sets make Win Host boot in 64 bit, fix all SCT issues
> > regarding to console input/output, switch to use MdeModulePkg/Bds.
> >
> > Ruiyu Ni (10):
> >   EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure
> >   EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode
> >   EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation
> >   EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState
> >   EmulatorPkg/Win: Do not zero out file content
> >   EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 64bit)
> >   EmulatorPkg/AutoScanPei: Report the correct CPU address size
> >   EmulatorPkg/Win: Add VS2017 project file
> >   EmulatorPkg: Use MdeModulePkg/Bds module
> >   EmulatorPkg: IoThunk->Close() is called too early, may causing hang
> >
> >  EmulatorPkg/AutoScanPei/AutoScanPei.c  |  17 +-
> >  EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c |  14 +-
> >  EmulatorPkg/EmuGopDxe/GopInput.c   |  11 +-
> >  EmulatorPkg/EmuGopDxe/GopScreen.c  |   8 +-
> >  .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |  10 +-
> >  EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c  |  32 +-
> >  EmulatorPkg/EmulatorPkg.dsc|  38 +-
> >  EmulatorPkg/EmulatorPkg.fdf|  21 +-
> >  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c| 559 
> > -
> >  EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 435
> > 
> >  .../BdsPlatform.h => PlatformBmLib/PlatformBm.h}   |  57 +--
> >  .../PlatformBmData.c}  |  13 +-
> >  .../PlatformBmLib.inf} |  28 +-
> >  .../Library/PlatformBmLib/PlatformBmMemoryTest.c   | 133 +
> >  EmulatorPkg/Win/Host/WinBlockIo.c  |  30 +-
> >  EmulatorPkg/Win/Host/WinGop.h  |   4 +-
> >  EmulatorPkg/Win/Host/WinGopInput.c |  17 +
> >  EmulatorPkg/Win/Host/WinGopScreen.c| 218 +++-
> >  EmulatorPkg/Win/Host/WinHost.c |   2 +-
> >  EmulatorPkg/Win/Host/WinHost.inf   |   1 +
> >  EmulatorPkg/Win/VS2017/BuildVS.bat |   3 +
> >  EmulatorPkg/Win/VS2017/Win.sln |  31 ++
> >  EmulatorPkg/Win/VS2017/Win.vcxproj | 120 +
> >  EmulatorPkg/Win/VS2017/Win.vcxproj.filters |  50 ++
> >  EmulatorPkg/Win/VS2017/Win.vcxproj.user|  13 +
> >  25 files changed, 1046 insertions(+), 819 deletions(-)  delete mode
> > 100644 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
> >  create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
> >  rename EmulatorPkg/Library/{EmuBdsLib/BdsPlatform.h =>
> > PlatformBmLib/PlatformBm.h} (62%)  rename
> > EmulatorPkg/Library/{EmuBdsLib/PlatformData.c =>
> > PlatformBmLib/PlatformBmData.c} (77%)  rename
> > EmulatorPkg/Library/{EmuBdsLib/EmuBdsLib.inf =>
> > PlatformBmLib/PlatformBmLib.inf} (71%)  create mode 100644
> > EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c
> >  create mode 100644 EmulatorPkg/Win/VS2017/BuildVS.bat
> >  create mode 100644 EmulatorPkg/Win/VS2017/Win.sln  create mode
> 100644
> > EmulatorPkg/Win/VS2017/Win.vcxproj
> >  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.filters
> >  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.user
> >
> > --
> > 2.16.1.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message

2018-08-28 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Wang, Jian J
> Sent: Wednesday, August 29, 2018 11:22 AM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric ; Laszlo Ersek 
> Subject: [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message
> 
> It's reported the debug message in CpuDxe driver is quite annoying in boot
> and shell, and slow down the boot process. To solve this issue, this patch
> changes the DEBUG_INFO to DEBUG_VERBOSE. On a typical Intel real
> platform, at least 16s boot time can be saved.
> 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c   | 2 +-
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index cfd4c415ae..76661cbcd9 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -404,7 +404,7 @@ CpuSetMemoryAttributes (
>// to avoid unnecessary computing.
>//
>if (mIsFlushingGCD) {
> -DEBUG((DEBUG_INFO, "  Flushing GCD\n"));
> +DEBUG((DEBUG_VERBOSE, "  Flushing GCD\n"));
>  return EFI_SUCCESS;
>}
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> index df021798c0..609df58e3a 100644
> --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> @@ -528,7 +528,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page4K);
>  if (SplitAttribute == Page4K) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
> @@ -549,7 +549,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page2M || SplitAttribute == Page4K);
>  if ((SplitAttribute == Page2M || SplitAttribute == Page4K)) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
> --
> 2.16.2.windows.1

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


[edk2] [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message

2018-08-28 Thread Jian J Wang
It's reported the debug message in CpuDxe driver is quite annoying in
boot and shell, and slow down the boot process. To solve this issue,
this patch changes the DEBUG_INFO to DEBUG_VERBOSE. On a typical Intel
real platform, at least 16s boot time can be saved.

Cc: Eric Dong 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c   | 2 +-
 UefiCpuPkg/CpuDxe/CpuPageTable.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index cfd4c415ae..76661cbcd9 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -404,7 +404,7 @@ CpuSetMemoryAttributes (
   // to avoid unnecessary computing.
   //
   if (mIsFlushingGCD) {
-DEBUG((DEBUG_INFO, "  Flushing GCD\n"));
+DEBUG((DEBUG_VERBOSE, "  Flushing GCD\n"));
 return EFI_SUCCESS;
   }
 
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c
index df021798c0..609df58e3a 100644
--- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
@@ -528,7 +528,7 @@ SplitPage (
 ASSERT (SplitAttribute == Page4K);
 if (SplitAttribute == Page4K) {
   NewPageEntry = AllocatePagesFunc (1);
-  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
+  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
   if (NewPageEntry == NULL) {
 return RETURN_OUT_OF_RESOURCES;
   }
@@ -549,7 +549,7 @@ SplitPage (
 ASSERT (SplitAttribute == Page2M || SplitAttribute == Page4K);
 if ((SplitAttribute == Page2M || SplitAttribute == Page4K)) {
   NewPageEntry = AllocatePagesFunc (1);
-  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
+  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
   if (NewPageEntry == NULL) {
 return RETURN_OUT_OF_RESOURCES;
   }
-- 
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 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size

2018-08-28 Thread Ni, Ruiyu

On 8/29/2018 9:54 AM, Wu, Hao A wrote:

-Original Message-
From: Ni, Ruiyu
Sent: Monday, August 27, 2018 3:53 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A; Andrew Fish
Subject: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU
address size

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

Today's implementation unconditionally reports CPU address size
as 36 through CPU HOB. But when WinHost is running at 64bit,
the system memory might be allocated above 2^36.

It causes system asserts when DxeCore code tries to find the
corresponding GCD entry for a given valid address.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
  EmulatorPkg/AutoScanPei/AutoScanPei.c | 17 +
  1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c
b/EmulatorPkg/AutoScanPei/AutoScanPei.c
index 78a40db3a2..bf9958a4a9 100644
--- a/EmulatorPkg/AutoScanPei/AutoScanPei.c
+++ b/EmulatorPkg/AutoScanPei/AutoScanPei.c
@@ -1,6 +1,6 @@
  /*++ @file

-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
  Portions copyright (c) 2011, Apple Inc. All rights reserved.
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD
License
@@ -51,7 +51,8 @@ Returns:
EFI_PHYSICAL_ADDRESSMemoryBase;
UINTN   Index;
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
-
+  UINTN   HighBitSet;
+  UINT8   SizeOfMemorySpace;

DEBUG ((EFI_D_ERROR, "Emu Autoscan PEIM Loaded\n"));

@@ -66,7 +67,8 @@ Returns:
   );
ASSERT_EFI_ERROR (Status);

-  Index = 0;
+  SizeOfMemorySpace = 0;
+  Index = 0;
do {
  Status = Thunk->MemoryAutoScan (Index, , );
  if (!EFI_ERROR (Status)) {
@@ -96,6 +98,12 @@ Returns:
  MemoryBase,
  MemorySize
  );
+  HighBitSet= HighBitSet64 (MemoryBase + MemorySize);
+  SizeOfMemorySpace = MAX (SizeOfMemorySpace, (UINT8)HighBitSet + 1);
+  DEBUG ((
+DEBUG_INFO, "Emu Memory Discoverred[%d]: Base = %016lx / Size
= %016x\n",
+Index, MemoryBase, MemorySize
+));
  }
  Index++;
} while (!EFI_ERROR (Status));
@@ -103,7 +111,8 @@ Returns:
//
// Build the CPU hob with 36-bit addressing and 16-bits of IO space.
//
-  BuildCpuHob (36, 16);
+  DEBUG ((DEBUG_INFO, "Emu SizeOfMemorySpace = %d\n",
SizeOfMemorySpace));
+  BuildCpuHob (SizeOfMemorySpace, 16);


Hi Ray,

Just a question, I saw the implementation in Nt32Pkg just hard-code the
address size to 52 to support both 32-bit and 64-bit. Is there a concern
for hard coding it to 52?


I didn't check the NT32 implementation. I will try to use 64 directly.
52 may become insufficient when 5-level paging is widely used in OS.



Best Regards,
Hao Wu



return Status;
  }
--
2.16.1.windows.1





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


Re: [edk2] [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-28 Thread Wu, Jiaxin
Against the below condition code in Ip4Route():

  //
  // We will always try to use the direct destination address when /32 subnet 
mask is used.
  //
  if (RtEntry == NULL && SubnetMask != IP4_ALLONE_ADDRESS) {
return NULL;
  }

If there is no default route { Dest: 0.0.0.0, Mask: 0.0.0.0,NextHope: Gataway } 
in instance route table, while it exists in default route table, the failure 
will happen. So, we need update the code to handle such case.

Thanks,
Jiaxin

> -Original Message-
> From: Fu, Siyuan
> Sent: Tuesday, August 28, 2018 5:41 PM
> To: Wu, Jiaxin ; edk2-devel@lists.01.org
> Cc: Ye, Ting 
> Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> support for IP4 PXE boot.
> 
> Hi, Jiaxin
> 
> The IP4 routing logic for /32 subnet mask can be explain as below, maybe I
> need to add it to the commit log or in code comments.
> 
> Ip4Output() is called to send a packet
>   If a matching route cache (src, dest -> xxx) can be find,
>   send the packet to address xxx according to the route cache.
>   else
>   create a new route cache (src, dest -> dest)
><-
> This is done in Ip4Route()
>   if a default gateway is configured, save it to the route cache
> TAG.<- This is done in Ip4Route()
>   send the packet to dest 
><- This is
> done in Ip4SendFrame()
>   if ARP resolve failed for dest
>   find the matching route cache and check TAG to see
> if there is a default gateway  <- This is done in
> Ip4SendFrameToDefaultRoute ()
>   if yes
>   update the route cache to (src, dest ->
> default gw)
>   send the packet to the default gw
> 
> 
> BestRegards
> Fu Siyuan
> 
> 
> > -Original Message-
> > From: Wu, Jiaxin
> > Sent: Tuesday, August 28, 2018 4:53 PM
> > To: Fu, Siyuan ; edk2-devel@lists.01.org
> > Cc: Ye, Ting 
> > Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> > support for IP4 PXE boot.
> >
> >
> > Hi Siyuan,
> >
> > Below is my code review understanding, maybe something is wrong,
> please
> > correct me.
> >
> > > The "default route" means a route entry with zero SubnetAddress and
> zero
> > > SubnetMask, which will match all the dest address that can't match any
> > other
> > > non-zero Subnet* route entry.
> > > The "instance route table" is a list of route entries which belong to an
> > IP child
> > > instance.
> > > The "default route table" is the route table used by these IP child
> > instances
> > > with default IP address.
> > > A default route (which is just one route entry) may belong to the
> > default
> > > route table, or any instance route table.
> > >
> >
> > Yes, I agree. If there is a default route {Dest: 0.0.0.0, Mask: 0.0.0.0,
> > NextHope: Gataway} in the instance route table, it must be set via IP-
> > >Routes().
> >
> >
> > > The new function Ip4SendFrameToDefaultRoute() will always try to send
> > the
> > > frames to the default entry, so the naming is correct.
> >
> > According above, we want to send the packet to the router (Gataway) via
> > the default route {Dest: 0.0.0.0, Mask: 0.0.0.0, NextHope: Gataway} info,
> > right? But the comments in Ip4Route() said:
> >   //
> >   // When using /32 subnet mask, the packet will always be sent to the
> > direct
> >   // destination first, if we can't find a matching route cache.
> >   //
> >
> > > While how to
> > > determine the default route entry is not in this function, the Ip4Route()
> > has
> > > been updated to handle the /32 subnet mask specially, and Ip4Output()
> > will
> > > guarantee we check the instance route table first, then default route
> > table
> > > (the code you quoted).
> >
> > After the code I quoted below in Ip4Output(), the route cache entry found
> > in Ip4SendFrameToDefaultRoute() is {Dest: X.X.X.X, Src: Y.Y.Y.Y, NextHope:
> > X.X.X.X, Tag: { Dest: X.X.X.X, Mask: 255.255.255.255, NextHope:
> > 0.0.0.0} }, if so, looks the package will be sent to  NextHope:  0.0.0.0?
> >
> >
> > >
> > > BestRegards
> > > Fu Siyuan
> > >
> > > > -Original Message-
> > > > From: Wu, Jiaxin
> > > > Sent: Tuesday, August 28, 2018 2:51 PM
> > > > To: Fu, Siyuan ; edk2-devel@lists.01.org
> > > > Cc: Ye, Ting 
> > > > Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet
> mask
> > > > support for IP4 PXE boot.
> > > >
> > > > Hi Siyuan,
> > > >
> > > > In Ip4SendFrameToDefaultRoute(), you tried to find the default
> gateway
> > IP
> > > > address by using the found RtCacheEntry->Tag, I'm confused why it's
> > the
> > > > default gateway? In my understanding, tag is the cache's corresponding
> > > > route entry.  Besides, why we must send the frame to "DefaultRouter",
> > > > should be the instance router first, then default router? If so, I
> > suggest
> > > > to rename the function to 

Re: [edk2] [PATCH 00/10] Quality improvement for EmulatorPkg Win Host

2018-08-28 Thread Wu, Hao A
Hi Ray,

One general-level comment, I saw some file was originally with Unix line
ending format (LF), but after the series, the line ending is in a mixed
state (both containing Unix LF & Windows CRLF). Can you help to perform
the line ending format cleanup for those files?

Also, please help to run the PatchCheck tool to verify the format of the
commits. Thanks in advance.

Best Regards,
Hao Wu


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu
> Ni
> Sent: Monday, August 27, 2018 3:53 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH 00/10] Quality improvement for EmulatorPkg Win Host
> 
> The patch sets make Win Host boot in 64 bit, fix all SCT issues
> regarding to console input/output, switch to use MdeModulePkg/Bds.
> 
> Ruiyu Ni (10):
>   EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure
>   EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode
>   EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation
>   EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState
>   EmulatorPkg/Win: Do not zero out file content
>   EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 64bit)
>   EmulatorPkg/AutoScanPei: Report the correct CPU address size
>   EmulatorPkg/Win: Add VS2017 project file
>   EmulatorPkg: Use MdeModulePkg/Bds module
>   EmulatorPkg: IoThunk->Close() is called too early, may causing hang
> 
>  EmulatorPkg/AutoScanPei/AutoScanPei.c  |  17 +-
>  EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c |  14 +-
>  EmulatorPkg/EmuGopDxe/GopInput.c   |  11 +-
>  EmulatorPkg/EmuGopDxe/GopScreen.c  |   8 +-
>  .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |  10 +-
>  EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c  |  32 +-
>  EmulatorPkg/EmulatorPkg.dsc|  38 +-
>  EmulatorPkg/EmulatorPkg.fdf|  21 +-
>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c| 559 
> -
>  EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 435
> 
>  .../BdsPlatform.h => PlatformBmLib/PlatformBm.h}   |  57 +--
>  .../PlatformBmData.c}  |  13 +-
>  .../PlatformBmLib.inf} |  28 +-
>  .../Library/PlatformBmLib/PlatformBmMemoryTest.c   | 133 +
>  EmulatorPkg/Win/Host/WinBlockIo.c  |  30 +-
>  EmulatorPkg/Win/Host/WinGop.h  |   4 +-
>  EmulatorPkg/Win/Host/WinGopInput.c |  17 +
>  EmulatorPkg/Win/Host/WinGopScreen.c| 218 +++-
>  EmulatorPkg/Win/Host/WinHost.c |   2 +-
>  EmulatorPkg/Win/Host/WinHost.inf   |   1 +
>  EmulatorPkg/Win/VS2017/BuildVS.bat |   3 +
>  EmulatorPkg/Win/VS2017/Win.sln |  31 ++
>  EmulatorPkg/Win/VS2017/Win.vcxproj | 120 +
>  EmulatorPkg/Win/VS2017/Win.vcxproj.filters |  50 ++
>  EmulatorPkg/Win/VS2017/Win.vcxproj.user|  13 +
>  25 files changed, 1046 insertions(+), 819 deletions(-)
>  delete mode 100644 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
>  create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
>  rename EmulatorPkg/Library/{EmuBdsLib/BdsPlatform.h =>
> PlatformBmLib/PlatformBm.h} (62%)
>  rename EmulatorPkg/Library/{EmuBdsLib/PlatformData.c =>
> PlatformBmLib/PlatformBmData.c} (77%)
>  rename EmulatorPkg/Library/{EmuBdsLib/EmuBdsLib.inf =>
> PlatformBmLib/PlatformBmLib.inf} (71%)
>  create mode 100644
> EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c
>  create mode 100644 EmulatorPkg/Win/VS2017/BuildVS.bat
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.sln
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.filters
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.user
> 
> --
> 2.16.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size

2018-08-28 Thread Wu, Hao A
> -Original Message-
> From: Ni, Ruiyu
> Sent: Monday, August 27, 2018 3:53 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A; Andrew Fish
> Subject: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU
> address size
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1119
> 
> Today's implementation unconditionally reports CPU address size
> as 36 through CPU HOB. But when WinHost is running at 64bit,
> the system memory might be allocated above 2^36.
> 
> It causes system asserts when DxeCore code tries to find the
> corresponding GCD entry for a given valid address.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Hao Wu 
> Cc: Andrew Fish 
> ---
>  EmulatorPkg/AutoScanPei/AutoScanPei.c | 17 +
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c
> b/EmulatorPkg/AutoScanPei/AutoScanPei.c
> index 78a40db3a2..bf9958a4a9 100644
> --- a/EmulatorPkg/AutoScanPei/AutoScanPei.c
> +++ b/EmulatorPkg/AutoScanPei/AutoScanPei.c
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2011, Apple Inc. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
> @@ -51,7 +51,8 @@ Returns:
>EFI_PHYSICAL_ADDRESSMemoryBase;
>UINTN   Index;
>EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
> -
> +  UINTN   HighBitSet;
> +  UINT8   SizeOfMemorySpace;
> 
>DEBUG ((EFI_D_ERROR, "Emu Autoscan PEIM Loaded\n"));
> 
> @@ -66,7 +67,8 @@ Returns:
>   );
>ASSERT_EFI_ERROR (Status);
> 
> -  Index = 0;
> +  SizeOfMemorySpace = 0;
> +  Index = 0;
>do {
>  Status = Thunk->MemoryAutoScan (Index, , );
>  if (!EFI_ERROR (Status)) {
> @@ -96,6 +98,12 @@ Returns:
>  MemoryBase,
>  MemorySize
>  );
> +  HighBitSet= HighBitSet64 (MemoryBase + MemorySize);
> +  SizeOfMemorySpace = MAX (SizeOfMemorySpace, (UINT8)HighBitSet + 1);
> +  DEBUG ((
> +DEBUG_INFO, "Emu Memory Discoverred[%d]: Base = %016lx / Size
> = %016x\n",
> +Index, MemoryBase, MemorySize
> +));
>  }
>  Index++;
>} while (!EFI_ERROR (Status));
> @@ -103,7 +111,8 @@ Returns:
>//
>// Build the CPU hob with 36-bit addressing and 16-bits of IO space.
>//
> -  BuildCpuHob (36, 16);
> +  DEBUG ((DEBUG_INFO, "Emu SizeOfMemorySpace = %d\n",
> SizeOfMemorySpace));
> +  BuildCpuHob (SizeOfMemorySpace, 16);

Hi Ray,

Just a question, I saw the implementation in Nt32Pkg just hard-code the
address size to 52 to support both 32-bit and 64-bit. Is there a concern
for hard coding it to 52?

Best Regards,
Hao Wu

> 
>return Status;
>  }
> --
> 2.16.1.windows.1

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


Re: [edk2] [PATCH 05/10] EmulatorPkg/Win: Do not zero out file content

2018-08-28 Thread Wu, Hao A
> -Original Message-
> From: Ni, Ruiyu
> Sent: Monday, August 27, 2018 3:53 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A; Andrew Fish
> Subject: [PATCH 05/10] EmulatorPkg/Win: Do not zero out file content
> 
> The patch changes the behavior to not zero out file content
> when the file size is not multiple of block size.
> Instead, it just provides access to the contents that are
> multiple of block size and leaves the remaining content (less than
> block size) untouched.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Hao Wu 
> Cc: Andrew Fish 
> ---
>  EmulatorPkg/Win/Host/WinBlockIo.c | 28 +---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/EmulatorPkg/Win/Host/WinBlockIo.c
> b/EmulatorPkg/Win/Host/WinBlockIo.c
> index 14491a6e90..7df7d42c7c 100644
> --- a/EmulatorPkg/Win/Host/WinBlockIo.c
> +++ b/EmulatorPkg/Win/Host/WinBlockIo.c
> @@ -90,6 +90,7 @@ WinNtBlockIoOpenDevice (
>  {
>EFI_STATUSStatus;
>UINT64FileSize;
> +  UINT64EndOfFile;
> 
>//
>// If the device is already opened, close it
> @@ -112,7 +113,7 @@ WinNtBlockIoOpenDevice (
>);
> 
>if (Private->NtHandle == INVALID_HANDLE_VALUE) {
> -DEBUG ((EFI_D_INFO, "OpenBlock: Could not open %S, %x\n", Private-
> >FileName, GetLastError ()));
> +DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %S, %x\n", Private-
> >FileName, GetLastError ()));
>  Media->MediaPresent = FALSE;
>  Status = EFI_NO_MEDIA;
>  goto Done;
> @@ -124,14 +125,35 @@ WinNtBlockIoOpenDevice (
>Status = SetFilePointer64 (Private, 0, , FILE_END);
> 
>if (EFI_ERROR (Status)) {
> -DEBUG ((EFI_D_ERROR, "OpenBlock: Could not get filesize of %s\n", 
> Private-
> >FileName));
> +DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n",
> Private->FileName));
>  Status = EFI_UNSUPPORTED;
>  goto Done;
>}
> 
>Media->LastBlock = DivU64x32 (FileSize, (UINT32)Private->BlockSize) - 1;
> 
> -  DEBUG ((EFI_D_INIT, "OpenBlock: opened %S\n", Private->FileName));
> +  EndOfFile = MultU64x32 (Media->LastBlock + 1, (UINT32)Private->BlockSize);
> +

Hi Ray,

The below logic seems actually zeroing out the file content if the file
size is not a multiple of block size. Could you help to double confirm
this one?

Best Regards,
Hao Wu

> +  if (FileSize != EndOfFile) {
> +//
> +// file is not the proper size, change it
> +//
> +DEBUG ((EFI_D_INIT, "PlOpenBlock: Initializing block device: %hs\n",
> Private->FileName));
> +
> +//
> +// first set it to 0
> +//
> +SetFilePointer64 (Private, 0, NULL, FILE_BEGIN);
> +SetEndOfFile (Private->NtHandle);
> +
> +//
> +// then set it to the needed file size (OS will zero fill it)
> +//
> +SetFilePointer64 (Private, EndOfFile, NULL, FILE_BEGIN);
> +SetEndOfFile (Private->NtHandle);
> +  }
> +
> +  DEBUG ((EFI_D_INIT, "PlOpenBlock: opened %S\n", Private->FileName));
>Status = EFI_SUCCESS;
> 
>  Done:
> --
> 2.16.1.windows.1

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


Re: [edk2] [Patch 2/2] ShellPkg: Update Ifconfig command to accept 32bit subnet mask.

2018-08-28 Thread Ni, Ruiyu

On 8/28/2018 10:55 PM, Carsey, Jaben wrote:

looks good to me.  Ray?

Reviewed-by: Jaben Carsey 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu
Siyuan
Sent: Monday, August 27, 2018 6:53 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Ye, Ting ; Wu, Jiaxin

Subject: [edk2] [Patch 2/2] ShellPkg: Update Ifconfig command to accept
32bit subnet mask.
Importance: High

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan 
Cc: Ruiyu Ni 
Cc: Ye Ting 
Cc: Wu Jiaxin 
---
  ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index 52415e0ad0..e9f644c739 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -1032,6 +1032,7 @@ IfConfigSetInterfaceInfo (
SubnetMask  = NTOHL (SubnetMask);
TempGateway = NTOHL (TempGateway);
if ((SubnetMask != 0) &&
+  (SubnetMask != 0xu) &&
!NetIp4IsUnicast (TempGateway, SubnetMask)) {
  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
(STR_IFCONFIG_INVALID_GATEWAY), gShellNetwork1HiiHandle, VarArg-

Arg);

  ShellStatus = SHELL_INVALID_PARAMETER;
--
2.18.0.windows.1

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

Reviewed-by: Ruiyu Ni 

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


Re: [edk2] [PATCH v3 16/16] ShellPkg/UefiShellDebug1CommandsLib: Remove unused PCDs

2018-08-28 Thread Ni, Ruiyu

On 8/28/2018 11:42 AM, shenglei wrote:

The PCDs below are unused, so they have been removed from inf.
gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
---
  .../UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf   | 2 --
  1 file changed, 2 deletions(-)

diff --git 
a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
index 3ea51ec082..ec1f87ae19 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
@@ -119,8 +119,6 @@
  
  [Pcd]

gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask  ## CONSUMES
-  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize## CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength  ## CONSUMES
  
  [Protocols]

gEfiPciRootBridgeIoProtocolGuid ## SOMETIMES_CONSUMES


Reviewed-by: Ruiyu Ni 

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


Re: [edk2] [PATCH v3 14/16] ShellPkg/DpDynamicCommand: Remove unused PCDs

2018-08-28 Thread Ni, Ruiyu

On 8/28/2018 11:42 AM, shenglei wrote:

The PCDs below are unused, so they have been removed from inf.
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize in DpApp.inf
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize in
DpDynamicCommand.inf

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
---
  ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf| 2 --
  ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf | 3 ---
  2 files changed, 5 deletions(-)

diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf 
b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
index cedb333b28..c35a3087cf 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
@@ -69,5 +69,3 @@
gEfiLoadedImageDevicePathProtocolGuid   ## 
SOMETIMES_CONSUMES
gEfiHiiPackageListProtocolGuid  ## CONSUMES
  
-[Pcd]

-  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize   ## CONSUMES
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf 
b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
index 8fd3bbd5df..2d07b32266 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
@@ -71,8 +71,5 @@
gEfiHiiPackageListProtocolGuid  ## CONSUMES
gEfiShellDynamicCommandProtocolGuid ## PRODUCES
  
-[Pcd]

-  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize   ## CONSUMES
-
  [DEPEX]
TRUE


Reviewed-by: Ruiyu Ni 

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


Re: [edk2] [PATCH v3 13/16] ShellPkg/Shell: Remove unused PCDs

2018-08-28 Thread Ni, Ruiyu

On 8/28/2018 11:42 AM, shenglei wrote:

The PCDs below are unused, so they have been removed from inf.
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize
gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: shenglei 
Reviewed-by: Ruiyu Ni 
---
  ShellPkg/Application/Shell/Shell.inf | 2 --
  1 file changed, 2 deletions(-)

diff --git a/ShellPkg/Application/Shell/Shell.inf 
b/ShellPkg/Application/Shell/Shell.inf
index d89f85bb76..83049844d6 100644
--- a/ShellPkg/Application/Shell/Shell.inf
+++ b/ShellPkg/Application/Shell/Shell.inf
@@ -102,10 +102,8 @@
gEfiShellPkgTokenSpaceGuid.PcdShellRequireHiiPlatform ## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellSupportFrameworkHii## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellPageBreakDefault   ## CONSUMES
-  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize  ## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellInsertModeDefault  ## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellScreenLogCount ## CONSUMES
-  gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength  ## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellForceConsole   ## CONSUMES
gEfiShellPkgTokenSpaceGuid.PcdShellSupplier   ## CONSUMES


Reviewed-by: Ruiyu Ni 

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


[edk2] [Patch 2/3] MdeModulePkg Lzma: Update LZMA SDK version to 18.05

2018-08-28 Thread Liming Gao
New formal release in https://www.7-zip.org/sdk.html is 18.05.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|   6 +-
 .../LzmaCustomDecompressLib.inf|   6 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 220 ---
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  22 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |   3 +-
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 166 +++--
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 163 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 401 +
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  47 ++-
 .../Sdk/DOC/lzma-history.txt   |  63 +++-
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   |   2 +-
 15 files changed, 773 insertions(+), 352 deletions(-)

diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
index 0824bd7..3f3895b 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
@@ -1,4 +1,4 @@
-LzmaCustomDecompressLib is based on the LZMA SDK 16.04.
-LZMA SDK 16.04 was placed in the public domain on
-2016-10-04.  It was released on the
+LzmaCustomDecompressLib is based on the LZMA SDK 18.05.
+LZMA SDK 18.05 was placed in the public domain on
+2018-04-30.  It was released on the
 http://www.7-zip.org/sdk.html website.
diff --git 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
index ccd620b..82edae2 100644
--- 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
+++ 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaArchCustomDecompressLib produces LZMA custom decompression algorithm 
with the converter for the different arch code.
 #
-#  It is based on the LZMA SDK 16.04
-#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
+#  It is based on the LZMA SDK 18.05
+#  LZMA SDK 18.05 was placed in the public domain on 2018-04-30.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2012 - 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
diff --git 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
index 127c7de..80823de 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
 #
-#  It is based on the LZMA SDK 16.04.
-#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
+#  It is based on the LZMA SDK 18.05.
+#  LZMA SDK 18.05 was placed in the public domain on 2018-04-30.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2009 - 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
diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
index 501a15d..a873eda 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
@@ -36,7 +36,7 @@ typedef struct
 **/
 VOID *
 SzAlloc (
-  VOID *P,
+  CONST ISzAlloc *P,
   size_t Size
   )
 {
@@ -64,7 +64,7 @@ SzAlloc (
 **/
 VOID
 SzFree (
-  VOID *P,
+  CONST ISzAlloc *P,
   VOID *Address
   )
 {
diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
index 838dac7..a5fcb50 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
@@ -1,5 +1,5 @@
 /* 7zTypes.h -- Basic types
-2013-11-12 : Igor Pavlov : Public domain */
+2017-07-17 : Igor Pavlov : Public domain */
 
 #ifndef __7Z_TYPES_H
 #define __7Z_TYPES_H
@@ -46,13 +46,23 @@ EXTERN_C_BEGIN
 
 typedef int SRes;
 

[edk2] [Patch 0/3] Update LZMA SDK version to the latest 18.05

2018-08-28 Thread Liming Gao
Liming Gao (3):
  IntelFrameworkModulePkg Lzma: Update LZMA SDK version to 18.05
  MdeModulePkg Lzma: Update LZMA SDK version to 18.05
  BaseTools Lzma: Update LZMA SDK version to 18.05

 .../Source/C/LzmaCompress/LZMA-SDK-README.txt  |4 +-
 BaseTools/Source/C/LzmaCompress/LzmaCompress.c |8 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c |   28 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h |8 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c   |  111 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h|  220 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h  |   22 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c  |  399 +++-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h  |   20 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c  |4 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h   |3 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h|  166 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c |  163 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h |   12 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c   |   67 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h   |6 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c|  401 ++--
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h|   47 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c| 2334 
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h|   48 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c|   14 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h|5 +-
 .../Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt |   63 +-
 .../Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt |2 +-
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|6 +-
 .../LzmaArchCustomDecompressLib.inf|6 +-
 .../LzmaCustomDecompressLib.inf|6 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h|  220 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |   22 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |4 +-
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |3 +-
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h|  166 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c |  163 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |   12 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c|  401 ++--
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|   47 +-
 .../Sdk/DOC/lzma-history.txt   |   63 +-
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   |2 +-
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|6 +-
 .../LzmaArchCustomDecompressLib.inf|6 +-
 .../LzmaCustomDecompressLib.inf|6 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h|  220 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |   22 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |4 +-
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |3 +-
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h|  166 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c |  163 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |   12 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c|  401 ++--
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|   47 +-
 .../Sdk/DOC/lzma-history.txt   |   63 +-
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   |2 +-
 54 files changed, 4230 insertions(+), 2175 deletions(-)

-- 
2.10.0.windows.1

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


[edk2] [Patch 1/3] IntelFrameworkModulePkg Lzma: Update LZMA SDK version to 18.05

2018-08-28 Thread Liming Gao
New formal release in https://www.7-zip.org/sdk.html is 18.05.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|   6 +-
 .../LzmaCustomDecompressLib.inf|   6 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 220 ---
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  22 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |   3 +-
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 166 +++--
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 163 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 401 +
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  47 ++-
 .../Sdk/DOC/lzma-history.txt   |  63 +++-
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   |   2 +-
 15 files changed, 773 insertions(+), 352 deletions(-)

diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
index 0824bd7..3f3895b 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
@@ -1,4 +1,4 @@
-LzmaCustomDecompressLib is based on the LZMA SDK 16.04.
-LZMA SDK 16.04 was placed in the public domain on
-2016-10-04.  It was released on the
+LzmaCustomDecompressLib is based on the LZMA SDK 18.05.
+LZMA SDK 18.05 was placed in the public domain on
+2018-04-30.  It was released on the
 http://www.7-zip.org/sdk.html website.
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
index ccd620b..82edae2 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaArchCustomDecompressLib produces LZMA custom decompression algorithm 
with the converter for the different arch code.
 #
-#  It is based on the LZMA SDK 16.04
-#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
+#  It is based on the LZMA SDK 18.05
+#  LZMA SDK 18.05 was placed in the public domain on 2018-04-30.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2012 - 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
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
index df485ac..80823de 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -1,8 +1,8 @@
 ## @file
 #  LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
 #
-#  It is based on the LZMA SDK 16.04.
-#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
+#  It is based on the LZMA SDK 18.05.
+#  LZMA SDK 18.05 was placed in the public domain on 2018-04-30.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
@@ -30,7 +30,7 @@
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
 #
 
 [Sources]
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
index 501a15d..a873eda 100644
--- a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
+++ b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
@@ -36,7 +36,7 @@ typedef struct
 **/
 VOID *
 SzAlloc (
-  VOID *P,
+  CONST ISzAlloc *P,
   size_t Size
   )
 {
@@ -64,7 +64,7 @@ SzAlloc (
 **/
 VOID
 SzFree (
-  VOID *P,
+  CONST ISzAlloc *P,
   VOID *Address
   )
 {
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
index 838dac7..a5fcb50 100644
--- a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
+++ 

[edk2] [PATCH v1 1/1] BaseTools: minimize assignment processing

2018-08-28 Thread Jaben Carsey
Reverse the checking and only assign once to each variable.

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

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623fd3..e4f5cba156c5 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1534,15 +1534,16 @@ class DscBuildData(PlatformBuildClassObject):
 PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, 
DatumType, MaxDatumSize)}
 
 for ((PcdCName, TokenSpaceGuid), PcdSetting) in 
PcdValueDict.iteritems():
-PcdValue = None
-DatumType = None
-MaxDatumSize = None
-if TAB_COMMON in PcdSetting:
-PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON]
-if TAB_DEFAULT in PcdSetting:
-PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT]
 if self.SkuIdMgr.SystemSkuId in PcdSetting:
 PcdValue, DatumType, MaxDatumSize = 
PcdSetting[self.SkuIdMgr.SystemSkuId]
+elif TAB_DEFAULT in PcdSetting:
+PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT]
+elif TAB_COMMON in PcdSetting:
+PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON]
+else:
+PcdValue = None
+DatumType = None
+MaxDatumSize = None
 
 Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
 PcdCName,
-- 
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 1/1] ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

2018-08-28 Thread Sumit Garg
Hi Achin,

On Tue, 28 Aug 2018 at 18:38, Achin Gupta  wrote:
>
> Hi Sumit,
>
> Apologies for not replying sooner. Some questions and thoughts inline.
>
> On Mon, Aug 27, 2018 at 03:28:52PM +0530, Sumit Garg wrote:
> > On Fri, 24 Aug 2018 at 23:33, Matteo Carlini  wrote:
> > >
> > > +Achin
> > >
> > > SPD (for OP-TEE and other Trusted-OSes payloads running at S-EL1) and SPM 
> > > (for Secure Partitions at S-EL0) are currently mutually exclusive into 
> > > Trusted Firmware-A codebase.
> > >
> > > In other words, you cannot turn them on in parallel and execute both a 
> > > S-EL1 Trusted OS AND (one or many) S-EL0 Secure Partitions in the Secure 
> > > World with the current Software Architecture.
> > >
> >
> > IIUC, currently BL32 image is common in Trusted Firmware-A code-base.
> > If we turn on SPD then BL32= else if we turn on SPM
> > then BL32=, correct?
>
> Yes! BL32 is a TOS image if SPD is enabled. It is a S-EL0 Standalone MM Secure
> partition image if SPM is enabled.
>
> >
> > But I think SMC calling conventions (SMC Calling Convention [1] and
> > Management Mode Interface Specification [2]) doesn't put any such
> > restrictions as SMC function IDs are totally separate.
>
> Yes, this was an implementation choice to ensure that either a S-EL1 payload
> (Trusted OS) or a S-EL0 payload (MM SP) could be included in an Arm TF build 
> but
> not both.
>
> >
> > > Achin and other Arm architects are trying to figure out a way for solving 
> > > this problem without the need for a v8.4 Secure-EL2 Hypervisor, obviously 
> > > without leveraging the isolation benefits of it (see also [1]).
> > >
> >
> > Agree we won't be having isolation benefits which provides added level
> > of Security.
> >
> > > But Ard is right: there could be use-cases to ship UEFI systems with 
> > > OP-TEE and TAs on top...and this should still be currently possible using 
> > > the SPD dispatcher into TF-A. I've not looked deeply into this patch, but 
> > > it doesn’t seem to contradict the above Sw architecture.
> > >
> > > The question would be: would you foresee the need for running one (or 
> > > many) other (UEFI/EDK2-based) Secure Services in the Secure World into a 
> > > Secure Partition (using the StandaloneMmPkg) *together* with OP-TEE?
> > >
> >
> > As per following quote from Management Mode Interface Specification [2]:
> >
> > "Management Mode (MM) provides an environment for implementing OS
> > agnostic services (MM services) like RAS error handling, secure
> > variable storage, and firmware updates in system firmware. The
> > services can be invoked synchronously and asynchronously."
> >
> > It seems that MM mode is designed for more robust and platform
> > specific services whereas OP-TEE (or any trusted OS) use-cases seem to
> > be more complex like Entropy pool (RNG as in our case), DRM (could be
> > valid use-case for Android TV or Chromebook), keymaster or keystore
> > (for Edge devices) etc.
>
> It really depends upon the secure sw stack, use case and the requirements. MM
> interface specification specifies a blocking SMC (MM_COMMUNICATE) to access a
> secure service implemented in S-EL0.
>
> In the UEFI/PI/EDK2 context, MM drivers are used to satisfy a variety of use
> cases during boot through the EFI_MM_COMMUNICATION_PROTOCOL (the bad press of
> SMM aside!). MM_COMMUNICATE SMC provides a channel into the secure world to 
> the
> backend of this protocol on Arm systems. So any service accessible through 
> this
> protocol could be implemented on Arm systems in a MM SP.
>
> IIUC, in your case there is OP-TEE and firmware in the secure world. OP-TEE 
> has
> a static TA that provides the random data service and you want to leverage it 
> at
> boot time? Ditto for other services?

Correct, actually we tried to create OP-TEE static (pseudo) TA that
provides RNG service using thermal sensor noise and secure timer
interrupts (FIQs) to fill entropy pool. Using this service via OP-TEE
library in UEFI (subset in terms of functionality as compared to
OP-TEE kernel driver) for features like KASLR etc.

> So you do not really need an MM partition
> running alongside OP-TEE?
>

Agree that most of secure services can be implemented as static
(pseudo) TAs. But if I think about services like RAS error handling
and firmware updates. Is Trusted OS (OP-TEE or any third party OS) an
appropriate place to implement these platform specific services?

> In any case, what we are working on is to define a set of standard SMC
> interfaces that can be used to talk to a secure service in a payload in S-EL1 
> or
> S-EL0. This standard ABI will avoid the need to use payload specific SMCs in 
> the
> normal world e.g. OP-TEE specific SMCs.
>

It would be nice to have such standard ABI.

> Side topic! Do you foresee a usecase for DRM through UEFI during boot? Would 
> it
> work in the absence of RPC support in the Optee Library? IIUC, at runtime, DRM
> traffic will be routed through the OP-TEE driver in the OS instead of UEFI 
> since
> 

Re: [edk2] [Patch] BaseTools: Support multi thread build Basetool on Windows

2018-08-28 Thread Carsey, Jaben
This looks like a great change.  Why not delete the bat file?

Reviewed-by Jaben Carsey: 

Jaben

> On Aug 28, 2018, at 8:28 AM, Liming Gao  wrote:
> 
> From: Dongao Guo 
> 
> Add NmakeSubdirs.py to replace NmakeSubdirs.bat in VS Makefile. This script 
> will
> invoke nmake in multi thread mode. It can save more than half time of 
> BaseTools
> C clean build.
> GCC make supports multiple thread in make phase. So, GNNmakefile doesn't need 
> apply
> this script.
> 
> single task or job=1:
>just single thread and invoke subprocess,subprocess will use
>system.stdout to print output.
> multi task:
>thread number is logic cpu count.All subprocess output will pass to
>python script by PIPE and then script print it to system.stdout.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dongao Guo
> Reviewed-by: Liming Gao 
> Test-by: Liming Gao 
> ---
> BaseTools/Makefile   |  12 +-
> BaseTools/Source/C/Makefile  |  14 +--
> BaseTools/Source/C/Makefiles/NmakeSubdirs.py | 169 +++
> 3 files changed, 182 insertions(+), 13 deletions(-)
> create mode 100644 BaseTools/Source/C/Makefiles/NmakeSubdirs.py
> 
> diff --git a/BaseTools/Makefile b/BaseTools/Makefile
> index 3736d85..b98cd85 100644
> --- a/BaseTools/Makefile
> +++ b/BaseTools/Makefile
> @@ -1,7 +1,7 @@
> ## @file
> # Windows makefile for Base Tools project build.
> #
> -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> # This program and the accompanying materials
> # are licensed and made available under the terms and conditions of the BSD 
> License
> # which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -20,19 +20,19 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C 
> $(BASE_TOOLS_PATH)\Source\Python
> all: c python
> 
> c :
> -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
> $(BASE_TOOLS_PATH)\Source\C
> +  @$(PYTHON_HOME)\python.exe 
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
> $(BASE_TOOLS_PATH)\Source\C
> 
> python:
> -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
> $(BASE_TOOLS_PATH)\Source\Python
> +  @$(PYTHON_HOME)\python.exe 
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
> $(BASE_TOOLS_PATH)\Source\Python
> 
> subdirs: $(SUBDIRS)
> -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all $**
> +  @$(PYTHON_HOME)\python.exe 
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**
> 
> .PHONY: clean
> clean:
> -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat clean $(SUBDIRS)
> +  $(PYTHON_HOME)\python.exe 
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
> 
> .PHONY: cleanall
> cleanall:
> -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat cleanall $(SUBDIRS)
> +  $(PYTHON_HOME)\python.exe 
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)
> 
> diff --git a/BaseTools/Source/C/Makefile b/BaseTools/Source/C/Makefile
> index 5428180..1246d23 100644
> --- a/BaseTools/Source/C/Makefile
> +++ b/BaseTools/Source/C/Makefile
> @@ -1,7 +1,7 @@
> ## @file
> # Windows makefile for C tools build.
> #
> -# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
> # This program and the accompanying materials
> # are licensed and made available under the terms and conditions of the BSD 
> License
> # which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -16,7 +16,7 @@ HOST_ARCH = IA32
> 
> LIBRARIES = Common
> APPLICATIONS = \
> -  BootSectImage \
> +  VfrCompile \
>   BrotliCompress \
>   EfiLdrImage \
>   EfiRom \
> @@ -32,7 +32,7 @@ APPLICATIONS = \
>   Split \
>   TianoCompress \
>   VolInfo \
> -  VfrCompile \
> +  BootSectImage \
>   DevicePath
> 
> all: libs apps install
> @@ -43,7 +43,7 @@ libs: $(LIBRARIES)
>@echo # Build libraries
>@echo ##
>@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
> -@Makefiles\NmakeSubdirs.bat all $**
> +@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
> 
> apps: $(APPLICATIONS)
>@echo.
> @@ -51,7 +51,7 @@ apps: $(APPLICATIONS)
>@echo # Build executables
>@echo ##
>@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
> -@Makefiles\NmakeSubdirs.bat all $**
> +@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
> 
> install: $(LIB_PATH) $(BIN_PATH)
>@echo.
> @@ -65,11 +65,11 @@ install: $(LIB_PATH) $(BIN_PATH)
> 
> .PHONY: clean
> clean:
> -  @Makefiles\NmakeSubdirs.bat clean $(LIBRARIES) $(APPLICATIONS)
> +  @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) 
> $(APPLICATIONS)
> 
> .PHONY: cleanall
> cleanall:
> -  @Makefiles\NmakeSubdirs.bat cleanall $(LIBRARIES) $(APPLICATIONS)
> +  @$(PYTHON_HOME)\python.exe 

[edk2] [Patch] BaseTools: Support multi thread build Basetool on Windows

2018-08-28 Thread Liming Gao
From: Dongao Guo 

Add NmakeSubdirs.py to replace NmakeSubdirs.bat in VS Makefile. This script will
invoke nmake in multi thread mode. It can save more than half time of BaseTools
C clean build.
GCC make supports multiple thread in make phase. So, GNNmakefile doesn't need 
apply
this script.

single task or job=1:
just single thread and invoke subprocess,subprocess will use
system.stdout to print output.
multi task:
thread number is logic cpu count.All subprocess output will pass to
python script by PIPE and then script print it to system.stdout.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dongao Guo
Reviewed-by: Liming Gao 
Test-by: Liming Gao 
---
 BaseTools/Makefile   |  12 +-
 BaseTools/Source/C/Makefile  |  14 +--
 BaseTools/Source/C/Makefiles/NmakeSubdirs.py | 169 +++
 3 files changed, 182 insertions(+), 13 deletions(-)
 create mode 100644 BaseTools/Source/C/Makefiles/NmakeSubdirs.py

diff --git a/BaseTools/Makefile b/BaseTools/Makefile
index 3736d85..b98cd85 100644
--- a/BaseTools/Makefile
+++ b/BaseTools/Makefile
@@ -1,7 +1,7 @@
 ## @file
 # Windows makefile for Base Tools project build.
 #
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -20,19 +20,19 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C 
$(BASE_TOOLS_PATH)\Source\Python
 all: c python
 
 c :
-  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
$(BASE_TOOLS_PATH)\Source\C
+  @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
$(BASE_TOOLS_PATH)\Source\C
 
 python:
-  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
$(BASE_TOOLS_PATH)\Source\Python
+  @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
$(BASE_TOOLS_PATH)\Source\Python
 
 subdirs: $(SUBDIRS)
-  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all $**
+  @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**
 
 .PHONY: clean
 clean:
-  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat clean $(SUBDIRS)
+  $(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
 
 .PHONY: cleanall
 cleanall:
-  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat cleanall $(SUBDIRS)
+  $(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)
 
diff --git a/BaseTools/Source/C/Makefile b/BaseTools/Source/C/Makefile
index 5428180..1246d23 100644
--- a/BaseTools/Source/C/Makefile
+++ b/BaseTools/Source/C/Makefile
@@ -1,7 +1,7 @@
 ## @file
 # Windows makefile for C tools build.
 #
-# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -16,7 +16,7 @@ HOST_ARCH = IA32
 
 LIBRARIES = Common
 APPLICATIONS = \
-  BootSectImage \
+  VfrCompile \
   BrotliCompress \
   EfiLdrImage \
   EfiRom \
@@ -32,7 +32,7 @@ APPLICATIONS = \
   Split \
   TianoCompress \
   VolInfo \
-  VfrCompile \
+  BootSectImage \
   DevicePath
 
 all: libs apps install
@@ -43,7 +43,7 @@ libs: $(LIBRARIES)
@echo # Build libraries
@echo ##
@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
-   @Makefiles\NmakeSubdirs.bat all $**
+   @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
 
 apps: $(APPLICATIONS)
@echo.
@@ -51,7 +51,7 @@ apps: $(APPLICATIONS)
@echo # Build executables
@echo ##
@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
-   @Makefiles\NmakeSubdirs.bat all $**
+   @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
 
 install: $(LIB_PATH) $(BIN_PATH)
@echo.
@@ -65,11 +65,11 @@ install: $(LIB_PATH) $(BIN_PATH)
 
 .PHONY: clean
 clean:
-  @Makefiles\NmakeSubdirs.bat clean $(LIBRARIES) $(APPLICATIONS)
+  @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) 
$(APPLICATIONS)
 
 .PHONY: cleanall
 cleanall:
-  @Makefiles\NmakeSubdirs.bat cleanall $(LIBRARIES) $(APPLICATIONS)
+  @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) 
$(APPLICATIONS)
 
 !INCLUDE Makefiles\ms.rule
 
diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py 
b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
new file mode 100644
index 000..29bb5df
--- /dev/null
+++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
@@ -0,0 +1,169 @@
+# @file 

Re: [edk2] [PATCH v3 00/16] Removed unused PCDs

2018-08-28 Thread Carsey, Jaben
For 13,14,15,16 about the ShellPkg content.

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> shenglei
> Sent: Monday, August 27, 2018 8:43 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v3 00/16] Removed unused PCDs
> Importance: High
> 
> A lot of unused PCDs are removed from inf.
> All packages are built and the results are "pass".
> 
> v2:
> 1.Split MdeModulePkg into separated patches.
> 2.Split IntelFsp2Pkg into separated patches.
> 
> v3:
> 1.Split ShellPkg into separated patches.
> 2.Split SecurityPkg into separated patches.
> 3.Split IntelFsp2WrapperPkg into separated patches.
> 4.Split IntelFspPkg into separated patches.
> 5.Update the message in the cover letter.
> 
> shenglei (16):
>   IntelFsp2Pkg FspSecCore: Remove unused PCDs
>   IntelFsp2Pkg/BaseFspCommonLib: Remove unused PCDs
>   IntelFsp2Pkg/BaseFspPlatformLib: Remove unused PCDs
>   IntelFsp2Pkg/BaseFspSwitchStackLib: Remove unused PCDs
>   IntelFsp2WrapperPkg/FspWrapperNotifyDxe: Remove an unused PCD
>   IntelFsp2WrapperPkg/BaseFspWrapperPlatformLibSample: Remove PCDs
>   SecurityPkg/Tcg2ConfigPei: Remove an unused PCD
>   SecurityPkg/Tcg2Dxe: Remove unused PCDs
>   UefiCpuPkg/CpuCommonFeaturesLib: Remove an unused PCD
>   MdePkg/BaseLib: Remove an unused PCD
>   MdeModulePkg/DxeCapsuleLibFmp: Remove unused PCDs
>   MdeModulePkg/FirmwarePerformanceDataTableDxe: Remove an unused
> PCD
>   ShellPkg/Shell: Remove unused PCDs
>   ShellPkg/DpDynamicCommand: Remove unused PCDs
>   ShellPkg/UefiHandleParsingLib: Remove an unused PCD
>   ShellPkg/UefiShellDebug1CommandsLib: Remove unused PCDs
> 
>  IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf   |  6 --
>  IntelFsp2Pkg/FspSecCore/FspSecCoreS.inf   | 11 ---
>  IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf   |  5 -
>  .../Library/BaseFspCommonLib/BaseFspCommonLib.inf |  5 -
>  .../Library/BaseFspPlatformLib/BaseFspPlatformLib.inf |  9 -
>  .../BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf   |  4 
>  .../FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf   |  1 -
>  .../BaseFspWrapperPlatformLibSample.inf   |  3 ---
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c |  1 -
>  .../Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf | 11 ---
>  .../FirmwarePerformanceDxe.inf|  1 -
>  MdePkg/Library/BaseLib/BaseLib.inf|  1 -
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf  |  1 -
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf   |  6 --
>  ShellPkg/Application/Shell/Shell.inf  |  2 --
>  ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf|  2 --
>  .../DpDynamicCommand/DpDynamicCommand.inf |  3 ---
>  .../UefiHandleParsingLib/UefiHandleParsingLib.inf |  1 -
>  .../UefiShellDebug1CommandsLib.inf|  2 --
>  .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf |  1 -
>  20 files changed, 76 deletions(-)
> 
> --
> 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 2/2] ShellPkg: Update Ifconfig command to accept 32bit subnet mask.

2018-08-28 Thread Carsey, Jaben
looks good to me.  Ray?

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu
> Siyuan
> Sent: Monday, August 27, 2018 6:53 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Ye, Ting ; Wu, Jiaxin
> 
> Subject: [edk2] [Patch 2/2] ShellPkg: Update Ifconfig command to accept
> 32bit subnet mask.
> Importance: High
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan 
> Cc: Ruiyu Ni 
> Cc: Ye Ting 
> Cc: Wu Jiaxin 
> ---
>  ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> index 52415e0ad0..e9f644c739 100644
> --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> @@ -1032,6 +1032,7 @@ IfConfigSetInterfaceInfo (
>SubnetMask  = NTOHL (SubnetMask);
>TempGateway = NTOHL (TempGateway);
>if ((SubnetMask != 0) &&
> +  (SubnetMask != 0xu) &&
>!NetIp4IsUnicast (TempGateway, SubnetMask)) {
>  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_IFCONFIG_INVALID_GATEWAY), gShellNetwork1HiiHandle, VarArg-
> >Arg);
>  ShellStatus = SHELL_INVALID_PARAMETER;
> --
> 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 v2 7/7] ArmPkg: Extra action to update permissions for S-ELO MM Image

2018-08-28 Thread Achin Gupta
Hi Ard,

Apologies for the delay! CIL.

On Fri, Aug 24, 2018 at 03:55:29PM +0100, Ard Biesheuvel wrote:
> On 21 August 2018 at 07:50, Sughosh Ganu  wrote:
> > hi Ard,
> >
> > On Tue July 23, 2018 at 11:03PM +0530, Supreeth Venkatesh wrote:
> >>
> >> On Sat, 2018-07-21 at 20:06 +0900, Ard Biesheuvel wrote:
> >> > On 20 July 2018 at 21:38, Sughosh Ganu  wrote:
> >> > >
> >> > > From: Achin Gupta 
> >> > >
> >> > > The Standalone MM drivers runs in S-EL0 in AArch64 on ARM Standard
> >> > > Platforms and is deployed during SEC phase. The memory allocated to
> >> > > the Standalone MM drivers should be marked as RO+X.

This is a bit misleading. For Standalone MM drivers, memory is allocated from
the heap which is marked as RW+XN by the SPM in the S-EL1 page tables. This
allows PeCoffLoaderLoadImage() to load the image from the FV into its newly
allocated buffer. Before the driver can be executed, its rodata and code
sections need a permission update from RW+XN to RO+XN and RO+X respectively. 

This patch does these permission changes after the relocation fixups have been
done in PeCoffLoaderRelocateImageExtraAction().

> >> > >
> >> > > During PE/COFF Image section parsing, this patch implements extra
> >> > > action "UpdatePeCoffPermissions" to request the privileged firmware
> >> > > in
> >> > > EL3 to update the permissions.
> >> > >
> >> > > Contributed-under: TianoCore Contribution Agreement 1.1
> >> > > Signed-off-by: Sughosh Ganu 
> >> > Apologies for bringing this up only now, but I don't think I was ever
> >> > cc'ed on these patches.
> >> >
> >> Apologies if you have missed it. But I am pretty sure it was part of
> >> earlier large patch-set on which you and leif were copied, as it was
> >> part of ArmPkg.
> >> >
> >> > We are relying on a debug hook in the PE/COFF loader to ensure that
> >> > we
> >> > don't end up with memory that is both writable and executable in the
> >> > secure world. Do we really think that is a good idea?
> >> >
> >> > (I know this code was derived from a proof of concept that I did
> >> > years
> >> > ago, but that was just a PoC)
> >> I think we need a little bit more details on what is your suggestion?
> >>
> >> A little bit background here: This code runs in S-EL0 and Request gets
> >> sent to secure world SPM to ensure that the region permissions are
> >> updated correctly via the "ArmMmuStandaloneMmCoreLib" SVC -
> >> ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64.
> >>
> >> DebugPeCoffExtraActionLib is just used to extract image region
> >> information, but the region permission
> >> update request is sent to secure world for validation.
> >>
> >> With the above explanation, can you provide an insight into what was
> >> your thinking?
> >> Do you want us to create a separate library and call it
> >> as PeCoffExtraActionLib to avoid the "Debug" word though it is a hook
> >> to PeCoffExtraActionLib in MdePkg or do we want to create this library
> >> in a separate package (may be in MdePkg?) or something totally
> >> different.
> >
> > Supreeth had replied to your comments on the patch. Can you please
> > check this. If you feel that this needs to be implemented differently,
> > can you please suggest it to us. Thanks.
> >
> 
> My point is that such a fundamental action that needs to occur while
> loading the PE/COFF image should not be hooked into the loader this
> way.

IIUC, your concern is about the way the PeCoffLoaderRelocateImageExtraAction()
has been used? Is it meant to fulfil a different purpose? PE-COFF image loading
and relocation is done by generic code and this seemed like the best mechanism
to introduce an arch. specific hook.

I agree that implementing the hooks in a DebugPeCoffExtraActionLib is not
suitable for upstreaming. We could implement this within the StandaloneMmPkg as
an Aarch64 library since it is unlikely it will ever be used in the ArmPkg
itself.

Please let us know what you think.

cheers,
Achin
> ___
> 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 1/1] ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

2018-08-28 Thread Achin Gupta
Hi Sumit,

Apologies for not replying sooner. Some questions and thoughts inline.

On Mon, Aug 27, 2018 at 03:28:52PM +0530, Sumit Garg wrote:
> On Fri, 24 Aug 2018 at 23:33, Matteo Carlini  wrote:
> >
> > +Achin
> >
> > SPD (for OP-TEE and other Trusted-OSes payloads running at S-EL1) and SPM 
> > (for Secure Partitions at S-EL0) are currently mutually exclusive into 
> > Trusted Firmware-A codebase.
> >
> > In other words, you cannot turn them on in parallel and execute both a 
> > S-EL1 Trusted OS AND (one or many) S-EL0 Secure Partitions in the Secure 
> > World with the current Software Architecture.
> >
> 
> IIUC, currently BL32 image is common in Trusted Firmware-A code-base.
> If we turn on SPD then BL32= else if we turn on SPM
> then BL32=, correct?

Yes! BL32 is a TOS image if SPD is enabled. It is a S-EL0 Standalone MM Secure
partition image if SPM is enabled.

> 
> But I think SMC calling conventions (SMC Calling Convention [1] and
> Management Mode Interface Specification [2]) doesn't put any such
> restrictions as SMC function IDs are totally separate.

Yes, this was an implementation choice to ensure that either a S-EL1 payload
(Trusted OS) or a S-EL0 payload (MM SP) could be included in an Arm TF build but
not both.

> 
> > Achin and other Arm architects are trying to figure out a way for solving 
> > this problem without the need for a v8.4 Secure-EL2 Hypervisor, obviously 
> > without leveraging the isolation benefits of it (see also [1]).
> >
> 
> Agree we won't be having isolation benefits which provides added level
> of Security.
> 
> > But Ard is right: there could be use-cases to ship UEFI systems with OP-TEE 
> > and TAs on top...and this should still be currently possible using the SPD 
> > dispatcher into TF-A. I've not looked deeply into this patch, but it 
> > doesn’t seem to contradict the above Sw architecture.
> >
> > The question would be: would you foresee the need for running one (or many) 
> > other (UEFI/EDK2-based) Secure Services in the Secure World into a Secure 
> > Partition (using the StandaloneMmPkg) *together* with OP-TEE?
> >
> 
> As per following quote from Management Mode Interface Specification [2]:
> 
> "Management Mode (MM) provides an environment for implementing OS
> agnostic services (MM services) like RAS error handling, secure
> variable storage, and firmware updates in system firmware. The
> services can be invoked synchronously and asynchronously."
> 
> It seems that MM mode is designed for more robust and platform
> specific services whereas OP-TEE (or any trusted OS) use-cases seem to
> be more complex like Entropy pool (RNG as in our case), DRM (could be
> valid use-case for Android TV or Chromebook), keymaster or keystore
> (for Edge devices) etc.

It really depends upon the secure sw stack, use case and the requirements. MM
interface specification specifies a blocking SMC (MM_COMMUNICATE) to access a
secure service implemented in S-EL0.  

In the UEFI/PI/EDK2 context, MM drivers are used to satisfy a variety of use
cases during boot through the EFI_MM_COMMUNICATION_PROTOCOL (the bad press of
SMM aside!). MM_COMMUNICATE SMC provides a channel into the secure world to the
backend of this protocol on Arm systems. So any service accessible through this
protocol could be implemented on Arm systems in a MM SP.

IIUC, in your case there is OP-TEE and firmware in the secure world. OP-TEE has
a static TA that provides the random data service and you want to leverage it at
boot time? Ditto for other services? So you do not really need an MM partition
running alongside OP-TEE?

In any case, what we are working on is to define a set of standard SMC
interfaces that can be used to talk to a secure service in a payload in S-EL1 or
S-EL0. This standard ABI will avoid the need to use payload specific SMCs in the
normal world e.g. OP-TEE specific SMCs.

Side topic! Do you foresee a usecase for DRM through UEFI during boot? Would it
work in the absence of RPC support in the Optee Library? IIUC, at runtime, DRM
traffic will be routed through the OP-TEE driver in the OS instead of UEFI since
there is no UEFI runtime service interface to do DRM?

> 
> So it looks like they complement each other and we will have more
> robustness once we migrate to v8.4 Secure-EL2 Hypervisor for isolation
> support.

In a way yes! The robustness bit is not really related to the interface used to
access as service.

> 
> Please feel free to correct me if I missed something.

Hope this makes sense.

cheers,
Achin

> 
> Regards,
> Sumit
> 
> [1] 
> http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf
> [2] 
> http://infocenter.arm.com/help/topic/com.arm.doc.den0060a/DEN0060A_ARM_MM_Interface_Specification.pdf
> 
> > Thanks
> > Matteo
> >
> > [1]: 
> > https://community.arm.com/processors/b/blog/posts/architecting-more-secure-world-with-isolation-and-virtualization
> >
> > > -Original Message-
> > > From: Udit Kumar 
> > > Sent: 24 

[edk2] [Patch] BaseTools: Fixed the PcdValue trailing zero issue.

2018-08-28 Thread BobCF
1. Not append trailing zero for PcdValue
2. make sure the point to Variable Name in PCD
DataBase 2 bytes aligned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/GenPcdDb.py   | 6 ++
 BaseTools/Source/Python/Common/StringUtils.py | 7 +--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py 
b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index 2176bbefeb..5b260cd515 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1182,10 +1182,16 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, 
DynamicPcdList, Phase):
 Pcd.InitString = 'INIT'
 # Store all variable names of one HII PCD under different SKU 
to stringTable
 # and calculate the VariableHeadStringIndex
 
 VariableNameStructure = StringToArray(Sku.VariableName)
+
+#  Make pointer of VaraibleName(HII PCD) 2 bytes aligned
+VariableNameStructureBytes = 
VariableNameStructure.lstrip("{").rstrip("}").split(",")
+if len(VariableNameStructureBytes) % 2:
+VariableNameStructure = "{%s,0x00}" % 
",".join(VariableNameStructureBytes)
+
 if VariableNameStructure not in Dict['STRING_TABLE_VALUE']:
 Dict['STRING_TABLE_CNAME'].append(CName)
 Dict['STRING_TABLE_GUID'].append(TokenSpaceGuid)
 if StringTableIndex == 0:
 Dict['STRING_TABLE_INDEX'].append('')
diff --git a/BaseTools/Source/Python/Common/StringUtils.py 
b/BaseTools/Source/Python/Common/StringUtils.py
index da2949dbad..d5afde7a95 100644
--- a/BaseTools/Source/Python/Common/StringUtils.py
+++ b/BaseTools/Source/Python/Common/StringUtils.py
@@ -833,16 +833,11 @@ def StringToArray(String):
 if StringLen % 2:
 return "{%s,0x00}" % ",".join("0x%02x" % ord(C) for C in 
String[1:-1])
 else:
 return "{%s,0x00,0x00}" % ",".join("0x%02x" % ord(C) for C in 
String[1:-1])
 elif String.startswith('{'):
-StringLen = len(String.split(","))
-if StringLen % 2:
-return "{%s,0x00}" % ",".join(C.strip() for C in 
String[1:-1].split(','))
-else:
-return "{%s}" % ",".join(C.strip() for C in 
String[1:-1].split(','))
-
+return "{%s}" % ",".join(C.strip() for C in String[1:-1].split(','))
 else:
 if len(String.split()) % 2:
 return '{%s,0}' % ','.join(String.split())
 else:
 return '{%s,0,0}' % ','.join(String.split())
-- 
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 1/2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-28 Thread Fu, Siyuan
Hi, Jiaxin

The IP4 routing logic for /32 subnet mask can be explain as below, maybe I need 
to add it to the commit log or in code comments.

Ip4Output() is called to send a packet
If a matching route cache (src, dest -> xxx) can be find, 
send the packet to address xxx according to the route cache.
else
create a new route cache (src, dest -> dest)
   <- This is done in Ip4Route()
if a default gateway is configured, save it to the route cache 
TAG.<- This is done in Ip4Route()
send the packet to dest 
   <- This is done in Ip4SendFrame()
if ARP resolve failed for dest
find the matching route cache and check TAG to see if 
there is a default gateway  <- This is done in 
Ip4SendFrameToDefaultRoute ()
if yes
update the route cache to (src, dest -> default 
gw)
send the packet to the default gw


BestRegards
Fu Siyuan


> -Original Message-
> From: Wu, Jiaxin
> Sent: Tuesday, August 28, 2018 4:53 PM
> To: Fu, Siyuan ; edk2-devel@lists.01.org
> Cc: Ye, Ting 
> Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> support for IP4 PXE boot.
> 
> 
> Hi Siyuan,
> 
> Below is my code review understanding, maybe something is wrong, please
> correct me.
> 
> > The "default route" means a route entry with zero SubnetAddress and zero
> > SubnetMask, which will match all the dest address that can't match any
> other
> > non-zero Subnet* route entry.
> > The "instance route table" is a list of route entries which belong to an
> IP child
> > instance.
> > The "default route table" is the route table used by these IP child
> instances
> > with default IP address.
> > A default route (which is just one route entry) may belong to the
> default
> > route table, or any instance route table.
> >
> 
> Yes, I agree. If there is a default route {Dest: 0.0.0.0, Mask: 0.0.0.0,
> NextHope: Gataway} in the instance route table, it must be set via IP-
> >Routes().
> 
> 
> > The new function Ip4SendFrameToDefaultRoute() will always try to send
> the
> > frames to the default entry, so the naming is correct.
> 
> According above, we want to send the packet to the router (Gataway) via
> the default route {Dest: 0.0.0.0, Mask: 0.0.0.0, NextHope: Gataway} info,
> right? But the comments in Ip4Route() said:
>   //
>   // When using /32 subnet mask, the packet will always be sent to the
> direct
>   // destination first, if we can't find a matching route cache.
>   //
> 
> > While how to
> > determine the default route entry is not in this function, the Ip4Route()
> has
> > been updated to handle the /32 subnet mask specially, and Ip4Output()
> will
> > guarantee we check the instance route table first, then default route
> table
> > (the code you quoted).
> 
> After the code I quoted below in Ip4Output(), the route cache entry found
> in Ip4SendFrameToDefaultRoute() is {Dest: X.X.X.X, Src: Y.Y.Y.Y, NextHope:
> X.X.X.X, Tag: { Dest: X.X.X.X, Mask: 255.255.255.255, NextHope:
> 0.0.0.0} }, if so, looks the package will be sent to  NextHope:  0.0.0.0?
> 
> 
> >
> > BestRegards
> > Fu Siyuan
> >
> > > -Original Message-
> > > From: Wu, Jiaxin
> > > Sent: Tuesday, August 28, 2018 2:51 PM
> > > To: Fu, Siyuan ; edk2-devel@lists.01.org
> > > Cc: Ye, Ting 
> > > Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> > > support for IP4 PXE boot.
> > >
> > > Hi Siyuan,
> > >
> > > In Ip4SendFrameToDefaultRoute(), you tried to find the default gateway
> IP
> > > address by using the found RtCacheEntry->Tag, I'm confused why it's
> the
> > > default gateway? In my understanding, tag is the cache's corresponding
> > > route entry.  Besides, why we must send the frame to "DefaultRouter",
> > > should be the instance router first, then default router? If so, I
> suggest
> > > to rename the function to Ip4SendFrameToRoute(). Then, the logic in
> the
> > > function to retrieve the gateway should be:
> > > {
> > > if (IpInstance == NULL) {
> > >   CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head-
> > >Src,
> > > IpIf->SubnetMask);
> > > } else {
> > >   CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head-
> >Src,
> > > IpIf->SubnetMask);
> > >   if (CacheEntry == NULL) {
> > > CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst,
> Head-
> > > >Src, IpIf->SubnetMask);
> > >   }
> > > }
> > >
> > > if (CacheEntry == NULL) {
> > >   return EFI_NOT_FOUND;
> > > }
> > > GateWay = CacheEntry->NextHop;
> > > Ip4FreeRouteCacheEntry (CacheEntry);
> > > }
> > >
> > > What do you think?
> > >
> > > Thanks,
> > > Jiaxin
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Fu, Siyuan
> > > > 

Re: [edk2] [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-28 Thread Wu, Jiaxin


Hi Siyuan,

Below is my code review understanding, maybe something is wrong, please correct 
me.

> The "default route" means a route entry with zero SubnetAddress and zero
> SubnetMask, which will match all the dest address that can't match any other
> non-zero Subnet* route entry.
> The "instance route table" is a list of route entries which belong to an IP 
> child
> instance.
> The "default route table" is the route table used by these IP child instances
> with default IP address.
> A default route (which is just one route entry) may belong to the default
> route table, or any instance route table.
> 

Yes, I agree. If there is a default route {Dest: 0.0.0.0, Mask: 0.0.0.0, 
NextHope: Gataway} in the instance route table, it must be set via IP->Routes().


> The new function Ip4SendFrameToDefaultRoute() will always try to send the
> frames to the default entry, so the naming is correct. 

According above, we want to send the packet to the router (Gataway) via the 
default route {Dest: 0.0.0.0, Mask: 0.0.0.0, NextHope: Gataway} info, right? 
But the comments in Ip4Route() said:
  //
  // When using /32 subnet mask, the packet will always be sent to the direct
  // destination first, if we can't find a matching route cache.
  //

> While how to
> determine the default route entry is not in this function, the Ip4Route() has
> been updated to handle the /32 subnet mask specially, and Ip4Output() will
> guarantee we check the instance route table first, then default route table
> (the code you quoted).

After the code I quoted below in Ip4Output(), the route cache entry found in 
Ip4SendFrameToDefaultRoute() is {Dest: X.X.X.X, Src: Y.Y.Y.Y, NextHope:  
X.X.X.X, Tag: { Dest: X.X.X.X, Mask: 255.255.255.255, NextHope:  0.0.0.0} }, if 
so, looks the package will be sent to  NextHope:  0.0.0.0?


> 
> BestRegards
> Fu Siyuan
> 
> > -Original Message-
> > From: Wu, Jiaxin
> > Sent: Tuesday, August 28, 2018 2:51 PM
> > To: Fu, Siyuan ; edk2-devel@lists.01.org
> > Cc: Ye, Ting 
> > Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> > support for IP4 PXE boot.
> >
> > Hi Siyuan,
> >
> > In Ip4SendFrameToDefaultRoute(), you tried to find the default gateway IP
> > address by using the found RtCacheEntry->Tag, I'm confused why it's the
> > default gateway? In my understanding, tag is the cache's corresponding
> > route entry.  Besides, why we must send the frame to "DefaultRouter",
> > should be the instance router first, then default router? If so, I suggest
> > to rename the function to Ip4SendFrameToRoute(). Then, the logic in the
> > function to retrieve the gateway should be:
> > {
> > if (IpInstance == NULL) {
> >   CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head-
> >Src,
> > IpIf->SubnetMask);
> > } else {
> >   CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src,
> > IpIf->SubnetMask);
> >   if (CacheEntry == NULL) {
> > CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head-
> > >Src, IpIf->SubnetMask);
> >   }
> > }
> >
> > if (CacheEntry == NULL) {
> >   return EFI_NOT_FOUND;
> > }
> > GateWay = CacheEntry->NextHop;
> > Ip4FreeRouteCacheEntry (CacheEntry);
> > }
> >
> > What do you think?
> >
> > Thanks,
> > Jiaxin
> >
> >
> >
> >
> >
> >
> >
> >
> > > -Original Message-
> > > From: Fu, Siyuan
> > > Sent: Tuesday, August 28, 2018 9:53 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Ye, Ting ; Wu, Jiaxin 
> > > Subject: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> > > support for IP4 PXE boot.
> > >
> > > This patch updates IP4 stack to support 32bit subnet mask in PXE boot
> > > process.
> > > When 32bit subnet mask is used, the IP4 driver couldn't use the subnet
> > mask
> > > to determine
> > > whether destination IP address is on-link or not, so it will always try
> > to send
> > > all the
> > > packets to the destination IP address directly first, if failed it will
> > continue
> > > to try the default gateway.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Fu Siyuan 
> > > Cc: Ye Ting 
> > > Cc: Wu Jiaxin 
> > > ---
> > >  MdeModulePkg/Include/Library/NetLib.h |   5 +-
> > >  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c|  13 +-
> > >  .../Universal/Network/Ip4Dxe/Ip4Common.h  |   2 +-
> > >  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 117
> > > --
> > >  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h |   5 +-
> > >  .../Universal/Network/Ip4Dxe/Ip4Impl.c|   2 +-
> > >  .../Universal/Network/Ip4Dxe/Ip4Output.c  |  11 +-
> > >  .../Universal/Network/Ip4Dxe/Ip4Route.c   |  21 +++-
> > >  .../Universal/Network/Ip4Dxe/Ip4Route.h   |   5 +-
> > >  .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   6 +-
> > >  10 files changed, 154 insertions(+), 33 deletions(-)
> > >
> > > diff --git a/MdeModulePkg/Include/Library/NetLib.h
> > > b/MdeModulePkg/Include/Library/NetLib.h
> 

Re: [edk2] [PATCH] MdePkg: Add the missing spec version information for header files

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

>-Original Message-
>From: Zhang, Shenglei
>Sent: Wednesday, August 22, 2018 1:23 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Gao, Liming
>
>Subject: [PATCH] MdePkg: Add the missing spec version information for
>header files
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: shenglei 
>---
> MdePkg/Include/Protocol/AbsolutePointer.h| 3 +++
> MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h | 3 +++
> MdePkg/Include/Protocol/AcpiTable.h  | 3 +++
> MdePkg/Include/Protocol/AtaPassThru.h| 3 +++
> MdePkg/Include/Protocol/BlockIoCrypto.h  | 5 -
> MdePkg/Include/Protocol/ExtendedSalBootService.h | 3 +++
> MdePkg/Include/Protocol/ExtendedSalServiceClasses.h  | 3 +++
> MdePkg/Include/Protocol/HiiConfigAccess.h| 3 +++
> MdePkg/Include/Protocol/HiiConfigKeyword.h   | 4 
> MdePkg/Include/Protocol/HiiConfigRouting.h   | 4 
> MdePkg/Include/Protocol/HiiDatabase.h| 3 +++
> MdePkg/Include/Protocol/HiiFont.h| 3 +++
> MdePkg/Include/Protocol/HiiImage.h   | 3 +++
> MdePkg/Include/Protocol/HiiImageDecoder.h| 5 -
> MdePkg/Include/Protocol/HiiImageEx.h | 5 -
> MdePkg/Include/Protocol/HiiPopup.h   | 5 -
> MdePkg/Include/Protocol/HiiString.h  | 3 +++
> MdePkg/Include/Protocol/MmReportStatusCodeHandler.h  | 3 +++
> MdePkg/Include/Protocol/NvmExpressPassthru.h | 3 +++
> MdePkg/Include/Protocol/Pcd.h| 3 +++
> MdePkg/Include/Protocol/PcdInfo.h| 3 +++
> MdePkg/Include/Protocol/RegularExpressionProtocol.h  | 5 -
> MdePkg/Include/Protocol/ReportStatusCodeHandler.h| 3 +++
> MdePkg/Include/Protocol/SmartCardEdge.h  | 5 -
> MdePkg/Include/Protocol/SmmReportStatusCodeHandler.h | 3 +++
> MdePkg/Include/Protocol/UsbFunctionIo.h  | 5 -
> 26 files changed, 87 insertions(+), 7 deletions(-)
>
>diff --git a/MdePkg/Include/Protocol/AbsolutePointer.h
>b/MdePkg/Include/Protocol/AbsolutePointer.h
>index ecf476d7c0..ac1103aa35 100644
>--- a/MdePkg/Include/Protocol/AbsolutePointer.h
>+++ b/MdePkg/Include/Protocol/AbsolutePointer.h
>@@ -11,6 +11,9 @@
>   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>
>+  @par Revision Reference:
>+  This Protocol was introduced in UEFI Specification 2.3.
>+
> **/
>
> #ifndef __ABSOLUTE_POINTER_H__
>diff --git a/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
>b/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
>index c8bd429f1f..96913c68d1 100644
>--- a/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
>+++ b/MdePkg/Include/Protocol/AcpiSystemDescriptionTable.h
>@@ -10,6 +10,9 @@
>   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>
>+  @par Revision Reference:
>+  This Protocol was introduced in PI Specification 1.2.
>+
> **/
>
> #ifndef __ACPI_SYSTEM_DESCRIPTION_TABLE_H___
>diff --git a/MdePkg/Include/Protocol/AcpiTable.h
>b/MdePkg/Include/Protocol/AcpiTable.h
>index 753d79e6bb..fbbd68d289 100644
>--- a/MdePkg/Include/Protocol/AcpiTable.h
>+++ b/MdePkg/Include/Protocol/AcpiTable.h
>@@ -11,6 +11,9 @@
>   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>
>+  @par Revision Reference:
>+  This Protocol was introduced in UEFI Specification 2.3.
>+
> **/
>
> #ifndef __ACPI_TABLE_H___
>diff --git a/MdePkg/Include/Protocol/AtaPassThru.h
>b/MdePkg/Include/Protocol/AtaPassThru.h
>index 6d9b9f10b4..4979fadbfd 100644
>--- a/MdePkg/Include/Protocol/AtaPassThru.h
>+++ b/MdePkg/Include/Protocol/AtaPassThru.h
>@@ -12,6 +12,9 @@
>   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>
>+  @par Revision Reference:
>+  This Protocol was introduced in UEFI Specification 2.3.
>+
> **/
>
> #ifndef __ATA_PASS_THROUGH_H__
>diff --git a/MdePkg/Include/Protocol/BlockIoCrypto.h
>b/MdePkg/Include/Protocol/BlockIoCrypto.h
>index 821b846d30..ac3740dcde 100644
>--- a/MdePkg/Include/Protocol/BlockIoCrypto.h
>+++ b/MdePkg/Include/Protocol/BlockIoCrypto.h
>@@ -2,7 +2,7 @@
>   The UEFI Inline Cryptographic Interface protocol provides services to
>abstract
>   access to inline cryptographic capabilities.
>
>-  Copyright (c) 2015, Intel Corporation. All rights reserved.
>+  Copyright (c) 2015-2018, Intel Corporation. All rights reserved.
>   This program and the accompanying materials
>   are licensed and made available under the terms and conditions of the BSD
>License
>   which accompanies this 

[edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] LPDDR4 Change.

2018-08-28 Thread zwei4
Change MRC parameters in FSP-M UPD to enable different memory configurations.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei 
CC: Mike Wu  
CC: Mang Guo 
---
 .../Board/UP2/BoardInitPreMem/BoardInitMiscs.c | 145 -
 .../Board/UP2/BoardInitPreMem/PlatformId.c |  59 +
 .../Board/UP2/BoardInitPreMem/PlatformId.h |   7 +
 .../PlatformSetupDxe/SouthClusterConfig.vfi|   4 +-
 4 files changed, 184 insertions(+), 31 deletions(-)

diff --git 
a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitPreMem/BoardInitMiscs.c 
b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitPreMem/BoardInitMiscs.c
index d5092c2490..b155830523 100644
--- a/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitPreMem/BoardInitMiscs.c
+++ b/Platform/BroxtonPlatformPkg/Board/UP2/BoardInitPreMem/BoardInitMiscs.c
@@ -15,6 +15,7 @@
 
 #include "BoardInitMiscs.h"
 #include "MmrcData.h"
+#include "PlatformId.h"
 
 UPDATE_FSPM_UPD_FUNC mUp2UpdateFspmUpdPtr = Up2UpdateFspmUpd;
 DRAM_CREATE_POLICY_DEFAULTS_FUNC   mUp2DramCreatePolicyDefaultsPtr = 
Up2DramCreatePolicyDefaults;
@@ -43,6 +44,10 @@ Up2UpdateFspmUpd (
   BOOT_VARIABLE_NV_DATA  *BootVariableNvData;
   MRC_PARAMS_SAVE_RESTORE*MrcParamsHob;
   BOOT_VARIABLE_NV_DATA  *BootVariableNvDataHob;
+  SYSTEM_CONFIGURATIONSystemConfiguration;
+  UINTN   VariableSize;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;
+  UINT8   DdrId;
 
   Status = (*PeiServices)->LocatePpi (
  PeiServices,
@@ -98,13 +103,6 @@ Up2UpdateFspmUpd (
 }
 
   }
-  //
-  // Override RankEnable settings for UP2
-  //
-  FspUpdRgn->FspmConfig.Ch0_RankEnable   = 1;
-  FspUpdRgn->FspmConfig.Ch1_RankEnable   = 1;
-  FspUpdRgn->FspmConfig.Ch2_RankEnable   = 0;
-  FspUpdRgn->FspmConfig.Ch3_RankEnable   = 0;
 
   DEBUG ((DEBUG_INFO, "UpdateFspmUpd - gEfiPlatformInfoGuid\n"));
   Hob.Raw = GetFirstGuidHob ();
@@ -131,34 +129,97 @@ Up2UpdateFspmUpd (
   FspUpdRgn->FspmConfig.DIMM1SPDAddress = 0;
   FspUpdRgn->FspmConfig.DDR3LPageSize   = 0;
   FspUpdRgn->FspmConfig.DDR3LASR= 0;
-
-  FspUpdRgn->FspmConfig.Ch0_RankEnable   = 1; // 
-  FspUpdRgn->FspmConfig.Ch0_DeviceWidth  = 1; 
-  FspUpdRgn->FspmConfig.Ch0_DramDensity  = 2;
-  FspUpdRgn->FspmConfig.Ch0_Option   = 3;
-
-  FspUpdRgn->FspmConfig.Ch1_RankEnable   = 1; 
-  FspUpdRgn->FspmConfig.Ch1_DeviceWidth  = 1; // x16
-  FspUpdRgn->FspmConfig.Ch1_DramDensity  = 2; // 8GB
-  FspUpdRgn->FspmConfig.Ch1_Option   = 3;
-
-  FspUpdRgn->FspmConfig.Ch2_RankEnable   = 0; // empty
-  FspUpdRgn->FspmConfig.Ch2_DeviceWidth  = 1;
-  FspUpdRgn->FspmConfig.Ch2_DramDensity  = 2;
-  FspUpdRgn->FspmConfig.Ch2_Option   = 3;
-
-  FspUpdRgn->FspmConfig.Ch3_RankEnable   = 0;
-  FspUpdRgn->FspmConfig.Ch3_DeviceWidth  = 1;
-  FspUpdRgn->FspmConfig.Ch3_DramDensity  = 2;
-  FspUpdRgn->FspmConfig.Ch3_Option   = 3;
-
   FspUpdRgn->FspmConfig.ChannelHashMask   = 0;
   FspUpdRgn->FspmConfig.SliceHashMask = 0;
   FspUpdRgn->FspmConfig.ChannelsSlicesEnable  = 0;
   FspUpdRgn->FspmConfig.ScramblerSupport  = 1;
   FspUpdRgn->FspmConfig.InterleavedMode   = 0;
   FspUpdRgn->FspmConfig.MinRefRate2xEnable= 0;
-  FspUpdRgn->FspmConfig.DualRankSupportEnable = 0;
+
+  //
+  // DDR_ID1DDR_ID0  Memory
+  // GPIO_215   GPIO_214
+  //  0  02G
+  //  0  14G
+  //  1  08G
+  //
+  Status = Up2GetDdrId(PeiServices, );
+  
+  if (DdrId == 0x00) { // 2GB, SK, Single Rank
+  
+FspUpdRgn->FspmConfig.DualRankSupportEnable = 0;
+
+FspUpdRgn->FspmConfig.Ch0_RankEnable   = 1;  
+FspUpdRgn->FspmConfig.Ch0_DeviceWidth  = 1; 
+FspUpdRgn->FspmConfig.Ch0_DramDensity  = 2;
+FspUpdRgn->FspmConfig.Ch0_Option   = 3;
+
+FspUpdRgn->FspmConfig.Ch1_RankEnable   = 1; 
+FspUpdRgn->FspmConfig.Ch1_DeviceWidth  = 1; // x16
+FspUpdRgn->FspmConfig.Ch1_DramDensity  = 2; // 8GB
+FspUpdRgn->FspmConfig.Ch1_Option   = 3;
+ 
+FspUpdRgn->FspmConfig.Ch2_RankEnable   = 0; // empty
+FspUpdRgn->FspmConfig.Ch2_DeviceWidth  = 1;
+FspUpdRgn->FspmConfig.Ch2_DramDensity  = 2;
+FspUpdRgn->FspmConfig.Ch2_Option   = 3;
+
+FspUpdRgn->FspmConfig.Ch3_RankEnable   = 0; // empty
+FspUpdRgn->FspmConfig.Ch3_DeviceWidth  = 1;
+FspUpdRgn->FspmConfig.Ch3_DramDensity  = 2;
+FspUpdRgn->FspmConfig.Ch3_Option   = 3;
+
+  }else if (DdrId == 0x01) { // 4GB, SK, Single Rank
+  
+FspUpdRgn->FspmConfig.DualRankSupportEnable = 0;
+
+FspUpdRgn->FspmConfig.Ch0_RankEnable   = 1; // 
+FspUpdRgn->FspmConfig.Ch0_DeviceWidth  = 1; 
+FspUpdRgn->FspmConfig.Ch0_DramDensity  = 2;
+FspUpdRgn->FspmConfig.Ch0_Option   = 3;
+
+FspUpdRgn->FspmConfig.Ch1_RankEnable   = 1; 
+FspUpdRgn->FspmConfig.Ch1_DeviceWidth  = 1; // x16
+FspUpdRgn->FspmConfig.Ch1_DramDensity  = 2; // 8GB
+

Re: [edk2] [V2 patch] ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0

2018-08-28 Thread Zeng, Star
Hi Dandan,

Two comments.
1. The "if (PeerGroupCount > 0) {" for Type 9 is redundant.
2. The length check for Type 17 new XXXSize fields is wrong.

With them corrected, Reviewed-by: Star Zeng .


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Tuesday, August 28, 2018 2:27 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben ; Ni, Ruiyu ; 
Zeng, Star 
Subject: [edk2] [V2 patch] ShellPkg/SmbiosView: Update SmbiosView for 
SMBIOS3.2.0

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

Update SmbiosView to parse the new definitions which are introduced in 
SMBIOS3.2.0

V2:
1. Add structure length check before dump the fileds in Type 9 and Type 17 in 
case some fileds are not organized and reported by drivers.
2. Dump the InterfaceTypeSpecificData in Type 42.

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../SmbiosView/PrintInfo.c |  88 +++---
 .../SmbiosView/QueryTable.c| 135 -
 .../SmbiosView/QueryTable.h|  26 +++-
 .../SmbiosView/SmbiosViewStrings.uni   |   9 +-
 4 files changed, 239 insertions(+), 19 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index 93c6094df1..a91677e670 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -541,26 +541,51 @@ SmbiosPrintStructure (
 
   //
   // System Slots (Type 9)
   //
   case 9:
-PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
-DisplaySystemSlotType (Struct->Type9->SlotType, Option);
-DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
-DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
-DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
-DisplaySystemSlotId (
-  Struct->Type9->SlotID,
-  Struct->Type9->SlotType,
-  Option
- );
-DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
-DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
-if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
-  PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+{
+  MISC_SLOT_PEER_GROUP  *PeerGroupPtr;
+  UINT8 PeerGroupCount;
+
+  PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
+  DisplaySystemSlotType (Struct->Type9->SlotType, Option);
+  DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
+  DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
+  DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
+  DisplaySystemSlotId (
+Struct->Type9->SlotID,
+Struct->Type9->SlotType,
+Option
+   );
+  DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
+  DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
+  if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
+PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+  }
+  if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+if (Struct->Hdr->Length > 0x11) {
+  PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
+}
+if (Struct->Hdr->Length > 0x12) {
+  PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
+
+  PeerGroupCount = Struct->Type9->PeerGroupingCount;
+  if (PeerGroupCount > 0) {
+PeerGroupPtr   = Struct->Type9->PeerGroups;
+for (Index = 0; Index < PeerGroupCount; Index++) {
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].SegmentGroupNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].BusNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DevFuncNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DataBusWidth);
+}
+  }
+}
+  }
 }
 break;
 
   //
   // On Board Devices 

Re: [edk2] [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-28 Thread Fu, Siyuan
Hi, Jiaxin

The "default route" means a route entry with zero SubnetAddress and zero 
SubnetMask, which will match all the dest address that can't match any other 
non-zero Subnet* route entry. 
The "instance route table" is a list of route entries which belong to an IP 
child instance.
The "default route table" is the route table used by these IP child instances 
with default IP address.
A default route (which is just one route entry) may belong to the default route 
table, or any instance route table.

The new function Ip4SendFrameToDefaultRoute() will always try to send the 
frames to the default entry, so the naming is correct. While how to determine 
the default route entry is not in this function, the Ip4Route() has been 
updated to handle the /32 subnet mask specially, and Ip4Output() will guarantee 
we check the instance route table first, then default route table (the code you 
quoted).

BestRegards
Fu Siyuan

> -Original Message-
> From: Wu, Jiaxin
> Sent: Tuesday, August 28, 2018 2:51 PM
> To: Fu, Siyuan ; edk2-devel@lists.01.org
> Cc: Ye, Ting 
> Subject: RE: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> support for IP4 PXE boot.
> 
> Hi Siyuan,
> 
> In Ip4SendFrameToDefaultRoute(), you tried to find the default gateway IP
> address by using the found RtCacheEntry->Tag, I'm confused why it's the
> default gateway? In my understanding, tag is the cache's corresponding
> route entry.  Besides, why we must send the frame to "DefaultRouter",
> should be the instance router first, then default router? If so, I suggest
> to rename the function to Ip4SendFrameToRoute(). Then, the logic in the
> function to retrieve the gateway should be:
> {
> if (IpInstance == NULL) {
>   CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src,
> IpIf->SubnetMask);
> } else {
>   CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src,
> IpIf->SubnetMask);
>   if (CacheEntry == NULL) {
> CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head-
> >Src, IpIf->SubnetMask);
>   }
> }
> 
> if (CacheEntry == NULL) {
>   return EFI_NOT_FOUND;
> }
> GateWay = CacheEntry->NextHop;
> Ip4FreeRouteCacheEntry (CacheEntry);
> }
> 
> What do you think?
> 
> Thanks,
> Jiaxin
> 
> 
> 
> 
> 
> 
> 
> 
> > -Original Message-
> > From: Fu, Siyuan
> > Sent: Tuesday, August 28, 2018 9:53 AM
> > To: edk2-devel@lists.01.org
> > Cc: Ye, Ting ; Wu, Jiaxin 
> > Subject: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> > support for IP4 PXE boot.
> >
> > This patch updates IP4 stack to support 32bit subnet mask in PXE boot
> > process.
> > When 32bit subnet mask is used, the IP4 driver couldn't use the subnet
> mask
> > to determine
> > whether destination IP address is on-link or not, so it will always try
> to send
> > all the
> > packets to the destination IP address directly first, if failed it will
> continue
> > to try the default gateway.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Fu Siyuan 
> > Cc: Ye Ting 
> > Cc: Wu Jiaxin 
> > ---
> >  MdeModulePkg/Include/Library/NetLib.h |   5 +-
> >  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c|  13 +-
> >  .../Universal/Network/Ip4Dxe/Ip4Common.h  |   2 +-
> >  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 117
> > --
> >  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h |   5 +-
> >  .../Universal/Network/Ip4Dxe/Ip4Impl.c|   2 +-
> >  .../Universal/Network/Ip4Dxe/Ip4Output.c  |  11 +-
> >  .../Universal/Network/Ip4Dxe/Ip4Route.c   |  21 +++-
> >  .../Universal/Network/Ip4Dxe/Ip4Route.h   |   5 +-
> >  .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   6 +-
> >  10 files changed, 154 insertions(+), 33 deletions(-)
> >
> > diff --git a/MdeModulePkg/Include/Library/NetLib.h
> > b/MdeModulePkg/Include/Library/NetLib.h
> > index ef7bc429c1..b7ef99c7b5 100644
> > --- a/MdeModulePkg/Include/Library/NetLib.h
> > +++ b/MdeModulePkg/Include/Library/NetLib.h
> > @@ -422,8 +422,9 @@ NetGetIpClass (
> >
> >If all bits of the host address of IP are 0 or 1, IP is also not a
> valid unicast
> > address,
> >except when the originator is one of the endpoints of a point-to-
> point link
> > with a 31-bit
> > -  mask (RFC3021).
> > -
> > +  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special
> network
> > environment (e.g.
> > +  PPP link).
> > +
> >@param[in]  IpThe IP to check against.
> >@param[in]  NetMask   The mask of the IP.
> >
> > diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> > b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> > index bf8f5523e6..63f4724062 100644
> > --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> > +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> > @@ -654,8 +654,9 @@ NetGetIpClass (
> >
> >If all bits of the host address of IP are 0 or 1, IP is also not a
> valid unicast
> > address,
> >except 

Re: [edk2] [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-28 Thread Wu, Jiaxin
Hi Siyuan,

In Ip4SendFrameToDefaultRoute(), you tried to find the default gateway IP 
address by using the found RtCacheEntry->Tag, I'm confused why it's the default 
gateway? In my understanding, tag is the cache's corresponding route entry.  
Besides, why we must send the frame to "DefaultRouter", should be the instance 
router first, then default router? If so, I suggest to rename the function to 
Ip4SendFrameToRoute(). Then, the logic in the function to retrieve the gateway 
should be: 
{
if (IpInstance == NULL) {
  CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src, 
IpIf->SubnetMask);
} else {
  CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src, 
IpIf->SubnetMask);
  if (CacheEntry == NULL) {
CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src, 
IpIf->SubnetMask);
  }
}

if (CacheEntry == NULL) {
  return EFI_NOT_FOUND;
}
GateWay = CacheEntry->NextHop;
Ip4FreeRouteCacheEntry (CacheEntry);
}

What do you think?

Thanks,
Jiaxin








> -Original Message-
> From: Fu, Siyuan
> Sent: Tuesday, August 28, 2018 9:53 AM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Wu, Jiaxin 
> Subject: [Patch 1/2] MdeModulePkg/Network: Add 32bit subnet mask
> support for IP4 PXE boot.
> 
> This patch updates IP4 stack to support 32bit subnet mask in PXE boot
> process.
> When 32bit subnet mask is used, the IP4 driver couldn't use the subnet mask
> to determine
> whether destination IP address is on-link or not, so it will always try to 
> send
> all the
> packets to the destination IP address directly first, if failed it will 
> continue
> to try the default gateway.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Fu Siyuan 
> Cc: Ye Ting 
> Cc: Wu Jiaxin 
> ---
>  MdeModulePkg/Include/Library/NetLib.h |   5 +-
>  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c|  13 +-
>  .../Universal/Network/Ip4Dxe/Ip4Common.h  |   2 +-
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 117
> --
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h |   5 +-
>  .../Universal/Network/Ip4Dxe/Ip4Impl.c|   2 +-
>  .../Universal/Network/Ip4Dxe/Ip4Output.c  |  11 +-
>  .../Universal/Network/Ip4Dxe/Ip4Route.c   |  21 +++-
>  .../Universal/Network/Ip4Dxe/Ip4Route.h   |   5 +-
>  .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   6 +-
>  10 files changed, 154 insertions(+), 33 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Library/NetLib.h
> b/MdeModulePkg/Include/Library/NetLib.h
> index ef7bc429c1..b7ef99c7b5 100644
> --- a/MdeModulePkg/Include/Library/NetLib.h
> +++ b/MdeModulePkg/Include/Library/NetLib.h
> @@ -422,8 +422,9 @@ NetGetIpClass (
> 
>If all bits of the host address of IP are 0 or 1, IP is also not a valid 
> unicast
> address,
>except when the originator is one of the endpoints of a point-to-point link
> with a 31-bit
> -  mask (RFC3021).
> -
> +  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network
> environment (e.g.
> +  PPP link).
> +
>@param[in]  IpThe IP to check against.
>@param[in]  NetMask   The mask of the IP.
> 
> diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> index bf8f5523e6..63f4724062 100644
> --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> @@ -654,8 +654,9 @@ NetGetIpClass (
> 
>If all bits of the host address of IP are 0 or 1, IP is also not a valid 
> unicast
> address,
>except when the originator is one of the endpoints of a point-to-point link
> with a 31-bit
> -  mask (RFC3021).
> -
> +  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network
> environment (e.g.
> +  PPP link).
> +
>@param[in]  IpThe IP to check against.
>@param[in]  NetMask   The mask of the IP.
> 
> @@ -669,18 +670,20 @@ NetIp4IsUnicast (
>IN IP4_ADDR   NetMask
>)
>  {
> +  INTN   MaskLength;
> +
>ASSERT (NetMask != 0);
> 
>if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {
>  return FALSE;
>}
> 
> -  if (NetGetMaskLength (NetMask) != 31) {
> +  MaskLength = NetGetMaskLength (NetMask);
> +  ASSERT ((MaskLength >= 0) && (MaskLength <= IP4_MASK_NUM));
> +  if (MaskLength < 31) {
>  if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {
>return FALSE;
>  }
> -  } else {
> -return TRUE;
>}
> 
>return TRUE;
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
> index e0fffc9d0d..994a81f4de 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
> @@ -55,7 +55,7 @@ typedef struct _IP4_SERVICEIP4_SERVICE;
>  /// Compose the fragment field to be used in the IP4 header.
>  ///
>  #define IP4_HEAD_FRAGMENT_FIELD(Df, 

Re: [edk2] [PATCH v1 1/1] BaseTools: AutoGen.py remove unused import

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

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Tuesday, August 28, 2018 6:08 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: AutoGen.py remove unused import

AutoGen does not use anything defined in BuildClassObject

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

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..314a321e95c6 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -39,7 +39,6 @@ from Common.StringUtils import *  import Common.GlobalData as 
GlobalData  from GenFds.FdfParser import *  from CommonDataClass.CommonClass 
import SkuInfoClass -from Workspace.BuildClassObject import *  from 
GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile  import 
Common.VpdInfoFile as VpdInfoFile  from .GenPcdDb import CreatePcdDatabaseCode
--
2.16.2.windows.1

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


[edk2] [V2 patch] ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0

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

Update SmbiosView to parse the new definitions which
are introduced in SMBIOS3.2.0

V2:
1. Add structure length check before dump the fileds in
Type 9 and Type 17 in case some fileds are not organized
and reported by drivers.
2. Dump the InterfaceTypeSpecificData in Type 42.

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../SmbiosView/PrintInfo.c |  88 +++---
 .../SmbiosView/QueryTable.c| 135 -
 .../SmbiosView/QueryTable.h|  26 +++-
 .../SmbiosView/SmbiosViewStrings.uni   |   9 +-
 4 files changed, 239 insertions(+), 19 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index 93c6094df1..a91677e670 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -541,26 +541,51 @@ SmbiosPrintStructure (
 
   //
   // System Slots (Type 9)
   //
   case 9:
-PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
-DisplaySystemSlotType (Struct->Type9->SlotType, Option);
-DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
-DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
-DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
-DisplaySystemSlotId (
-  Struct->Type9->SlotID,
-  Struct->Type9->SlotType,
-  Option
- );
-DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
-DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
-if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
-  PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+{
+  MISC_SLOT_PEER_GROUP  *PeerGroupPtr;
+  UINT8 PeerGroupCount;
+
+  PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
+  DisplaySystemSlotType (Struct->Type9->SlotType, Option);
+  DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
+  DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
+  DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
+  DisplaySystemSlotId (
+Struct->Type9->SlotID,
+Struct->Type9->SlotType,
+Option
+   );
+  DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
+  DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
+  if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
+PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+  }
+  if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+if (Struct->Hdr->Length > 0x11) {
+  PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
+}
+if (Struct->Hdr->Length > 0x12) {
+  PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
+
+  PeerGroupCount = Struct->Type9->PeerGroupingCount;
+  if (PeerGroupCount > 0) {
+PeerGroupPtr   = Struct->Type9->PeerGroups;
+for (Index = 0; Index < PeerGroupCount; Index++) {
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].SegmentGroupNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].BusNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DevFuncNum);
+  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DataBusWidth);
+}
+  }
+}
+  }
 }
 break;
 
   //
   // On Board Devices Information (Type 10)
@@ -753,10 +778,33 @@ SmbiosPrintStructure (
 if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
   PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
   PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage);
   PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage);
 }
+if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+  if (Struct->Hdr->Length > 0x28) {
+DisplayMemoryDeviceMemoryTechnology (Struct->Type17->MemoryTechnology, 
Option);
+

Re: [edk2] [Patch] BaseTools: Fix one expression bug to support ~ operate

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

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Yonghong Zhu
> Sent: Wednesday, August 22, 2018 3:17 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Fix one expression bug to support ~ operate
> 
> current use (0x41>=~0x0&0x41|0x0) as Pcd value cause build failure
> because the ~ is not correctly recognized.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/Common/Expression.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/Common/Expression.py 
> b/BaseTools/Source/Python/Common/Expression.py
> index 0091e47..78c69fa 100644
> --- a/BaseTools/Source/Python/Common/Expression.py
> +++ b/BaseTools/Source/Python/Common/Expression.py
> @@ -786,11 +786,11 @@ class ValueExpression(BaseExpression):
>  return ''
> 
>  OpToken = ''
>  for Ch in Expr:
>  if Ch in self.NonLetterOpLst:
> -if '!' == Ch and OpToken:
> +if Ch in ['!', '~'] and OpToken:
>  break
>  self._Idx += 1
>  OpToken += Ch
>  else:
>  break
> --
> 2.6.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel