Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Gao, Liming
I agree with Andrew to only add the missing Ppi/Protocol/Guid used in Library 
INF file. 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Lin,
> Derek (HPS UEFI Dev)
> Sent: Thursday, October 27, 2016 1:50 PM
> To: af...@apple.com
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> Andrew,
> 
> The ModuleGuidDict was not for performance, it's because Arch IA32 X64
> have same library name/FILE_GUID pair, for not duplicate it.
> You are right the patch add library FILE_GUID but they are not end up in the
> ROM, I'm ok remove it or not.
> 
> Feel free to update the patch.
> 
> Thanks,
> Derek
> 
> -Original Message-
> From: af...@apple.com [mailto:af...@apple.com]
> Sent: Thursday, October 27, 2016 1:25 PM
> To: Lin, Derek (HPS UEFI Dev) 
> Cc: edk2-devel@lists.01.org; Shia, Cinnamon 
> Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> 
> > On Oct 26, 2016, at 9:09 PM, Lin, Derek (HPS UEFI Dev)
>  wrote:
> >
> > Hi Andrew,
> >
> > We also see this issue recently. And we have a fix. I've send email patch
> minutes ago.
> >
> 
> Derek,
> 
> Thanks for sharing the fix.
> 
> I noticed it introduced a build failure for a badly formed library INF file. I
> assume that means this fix is pulling in libraries that are in the DSC file, 
> but
> not currently being built? That is not really a problem as it means you have
> too many GUID vs. not enough.
> 
> I also noticed that your fix adds the FILE_GUID values for all the libraries. 
> The
> FILE_GUID values for the any PEIM, DXE/UEFI driver that end up in an FV will
> be present in the ROM, but the library values do not end up in the ROM. Also
> by changing the code to use a Python dictionary the order of everything
> changed. I had a debugger command that would just dump out the
> FILE_GUDs, so it would be good to maintain the old behavior.
> 
>  GuidDict = {}
>  for Arch in ArchList:
>  PlatformDataBase =
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> -for ModuleFile in PlatformDataBase.Modules:
> +for ModuleFile in [x for x in PlatformDataBase.Modules] + [x for 
> x in
> PlatformDataBase.LibraryInstances]:
>  Module = BuildDb.BuildObject[ModuleFile, Arch,
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> -GuidXRefFile.write("%s %s\n" % (Module.Guid, 
> Module.BaseName))
> +if ModuleFile in PlatformDataBase.Modules:
> +GuidXRefFile.write("%s %s\n" % (Module.Guid,
> Module.BaseName))
>  for key, item in Module.Protocols.items():
>  GuidDict[key] = item
>  for key, item in Module.Guids.items():
> 
> If your adding ModuleGuidDict was a performance fix, I guess I could just
> make it a list to keep order.
> 
> Thanks,
> 
> Andrew Fish
> 
> > Thanks,
> > Derek
> >
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Andrew Fish
> > Sent: Thursday, October 27, 2016 9:08 AM
> > To: edk2-devel 
> > Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> >
> > I noticed if a GUID (PPI & Protocol) was only used via a library it does not
> end up in the Guid.xref file.
> >
> > It looks to me like this code is only extracting the GUIDs from the Drivers
> INF file and the GUIDs defined in dependent libraries are skipped?
> >
> >
> >
> https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/
> GenFds/GenFds.py#L701
>  n/GenFds/GenFds.py#L701>
> >
> >for Arch in ArchList:
> >PlatformDataBase =
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> >for ModuleFile in PlatformDataBase.Modules:
> >Module = BuildDb.BuildObject[ModuleFile, Arch,
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> >GuidXRefFile.write("%s %s\n" % (Module.Guid,
> Module.BaseName))
> >for key, item in Module.Protocols.items():
> >GuidDict[key] = item
> >for key, item in Module.Guids.items():
> >GuidDict[key] = item
> >for key, item in Module.Ppis.items():
> >GuidDict[key] = item
> >
> >
> > Does anyone know how to extract the info from the dependent libs?
> >
> > I have an lldb type formatter for EFI_GUID that will print out the GUID C
> name so I noticed when some of them went missing.
> >
> > Thanks,
> >
> > Andrew Fish
> > ___
> > edk2-devel mailing 

Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Lin, Derek (HPS UEFI Dev)
Andrew,

The ModuleGuidDict was not for performance, it's because Arch IA32 X64 have 
same library name/FILE_GUID pair, for not duplicate it.
You are right the patch add library FILE_GUID but they are not end up in the 
ROM, I'm ok remove it or not.

Feel free to update the patch.

Thanks,
Derek

-Original Message-
From: af...@apple.com [mailto:af...@apple.com] 
Sent: Thursday, October 27, 2016 1:25 PM
To: Lin, Derek (HPS UEFI Dev) 
Cc: edk2-devel@lists.01.org; Shia, Cinnamon 
Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.


> On Oct 26, 2016, at 9:09 PM, Lin, Derek (HPS UEFI Dev)  
> wrote:
> 
> Hi Andrew,
> 
> We also see this issue recently. And we have a fix. I've send email patch 
> minutes ago.
> 

Derek,

Thanks for sharing the fix. 

I noticed it introduced a build failure for a badly formed library INF file. I 
assume that means this fix is pulling in libraries that are in the DSC file, 
but not currently being built? That is not really a problem as it means you 
have too many GUID vs. not enough. 

I also noticed that your fix adds the FILE_GUID values for all the libraries. 
The FILE_GUID values for the any PEIM, DXE/UEFI driver that end up in an FV 
will be present in the ROM, but the library values do not end up in the ROM. 
Also by changing the code to use a Python dictionary the order of everything 
changed. I had a debugger command that would just dump out the FILE_GUDs, so it 
would be good to maintain the old behavior. 

 GuidDict = {}
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-for ModuleFile in PlatformDataBase.Modules:
+for ModuleFile in [x for x in PlatformDataBase.Modules] + [x for x 
in PlatformDataBase.LibraryInstances]:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+if ModuleFile in PlatformDataBase.Modules:
+GuidXRefFile.write("%s %s\n" % (Module.Guid, 
Module.BaseName))
 for key, item in Module.Protocols.items():
 GuidDict[key] = item
 for key, item in Module.Guids.items():

If your adding ModuleGuidDict was a performance fix, I guess I could just make 
it a list to keep order. 

Thanks,

Andrew Fish

> Thanks,
> Derek
> 
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
> Fish
> Sent: Thursday, October 27, 2016 9:08 AM
> To: edk2-devel 
> Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
> end up in the Guid.xref file. 
> 
> It looks to me like this code is only extracting the GUIDs from the Drivers 
> INF file and the GUIDs defined in dependent libraries are skipped?  
> 
> 
> https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
>  
> 
> 
>for Arch in ArchList:
>PlatformDataBase = 
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>for ModuleFile in PlatformDataBase.Modules:
>Module = BuildDb.BuildObject[ModuleFile, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
>for key, item in Module.Protocols.items():
>GuidDict[key] = item
>for key, item in Module.Guids.items():
>GuidDict[key] = item
>for key, item in Module.Ppis.items():
>GuidDict[key] = item
> 
> 
> Does anyone know how to extract the info from the dependent libs? 
> 
> I have an lldb type formatter for EFI_GUID that will print out the GUID C 
> name so I noticed when some of them went missing. 
> 
> Thanks,
> 
> Andrew Fish
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

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


Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Andrew Fish

> On Oct 26, 2016, at 9:09 PM, Lin, Derek (HPS UEFI Dev)  
> wrote:
> 
> Hi Andrew,
> 
> We also see this issue recently. And we have a fix. I've send email patch 
> minutes ago.
> 

Derek,

Thanks for sharing the fix. 

I noticed it introduced a build failure for a badly formed library INF file. I 
assume that means this fix is pulling in libraries that are in the DSC file, 
but not currently being built? That is not really a problem as it means you 
have too many GUID vs. not enough. 

I also noticed that your fix adds the FILE_GUID values for all the libraries. 
The FILE_GUID values for the any PEIM, DXE/UEFI driver that end up in an FV 
will be present in the ROM, but the library values do not end up in the ROM. 
Also by changing the code to use a Python dictionary the order of everything 
changed. I had a debugger command that would just dump out the FILE_GUDs, so it 
would be good to maintain the old behavior. 

 GuidDict = {}
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-for ModuleFile in PlatformDataBase.Modules:
+for ModuleFile in [x for x in PlatformDataBase.Modules] + [x for x 
in PlatformDataBase.LibraryInstances]:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+if ModuleFile in PlatformDataBase.Modules:
+GuidXRefFile.write("%s %s\n" % (Module.Guid, 
Module.BaseName))
 for key, item in Module.Protocols.items():
 GuidDict[key] = item
 for key, item in Module.Guids.items():

If your adding ModuleGuidDict was a performance fix, I guess I could just make 
it a list to keep order. 

Thanks,

Andrew Fish

> Thanks,
> Derek
> 
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
> Fish
> Sent: Thursday, October 27, 2016 9:08 AM
> To: edk2-devel 
> Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
> end up in the Guid.xref file. 
> 
> It looks to me like this code is only extracting the GUIDs from the Drivers 
> INF file and the GUIDs defined in dependent libraries are skipped?  
> 
> 
> https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
>  
> 
> 
>for Arch in ArchList:
>PlatformDataBase = 
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>for ModuleFile in PlatformDataBase.Modules:
>Module = BuildDb.BuildObject[ModuleFile, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
>for key, item in Module.Protocols.items():
>GuidDict[key] = item
>for key, item in Module.Guids.items():
>GuidDict[key] = item
>for key, item in Module.Ppis.items():
>GuidDict[key] = item
> 
> 
> Does anyone know how to extract the info from the dependent libs? 
> 
> I have an lldb type formatter for EFI_GUID that will print out the GUID C 
> name so I noticed when some of them went missing. 
> 
> Thanks,
> 
> Andrew Fish
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

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


Re: [edk2] [RESEND PATCH 1/1] ArmPlatformPkg/ArmTrustZone: Add support for specifying Subregions to be disabled

2016-10-26 Thread Bhupesh Sharma
Hi Ard,

> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Monday, October 17, 2016 7:46 PM
> 
> On 17 October 2016 at 14:25, Leif Lindholm 
> wrote:
> > On Mon, Oct 17, 2016 at 10:18:01AM +, Bhupesh Sharma wrote:
> >> Hi Ard, Leif,
> >>
> >> Any comments on this patch ?
> >
> > You didn't cc me before :)
> >
> > But more importantly, I don't really have any platform to test this
> > on, so I could use a Tested-by: from someone who does. Evan, do you?
> >
> >> > From: Bhupesh Sharma [mailto:bhupesh.sha...@nxp.com]
> >> > Sent: Friday, October 14, 2016 4:40 PM
> >> >
> >> > ARM TZASC-380 IP provides a mechanism to split memory regions
> being
> >> > protected via it into eight equal-sized sub-regions, with a bit
> >> > setting allowing the corresponding subregion to be disabled.
> >> >
> >> > Several NXP/FSL SoCs support the TZASC-380 IP block and allow the
> >> > DDR connected via the TZASC to be partitioned into regions having
> >> > different security settings.
> >> >
> >> > This patch enables this support and can be used for SoCs which
> >> > support such partition of DDR regions.
> >> >
> >> > Details of the 'subregion_disable'
> >
> > This is not actually what the register is called in the link you're
> > providing.
> >
> >> > register can be viewed here:
> >> >
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0431
> >> > c/CJ
> >> > ABCFHB.html
> >> >
> >> > Contributed-under: TianoCore Contribution Agreement 1.0
> >> > Signed-off-by: Bhupesh Sharma 
> >> > Cc: Ard Biesheuvel 
> >> > ---
> >> >  .../Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c | 21
> >> > ++---
> >> >  ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c  |  5 +++--
> >> >  ArmPlatformPkg/Include/Drivers/ArmTrustzone.h   |  3 ++-
> >> >  3 files changed, 19 insertions(+), 10 deletions(-)
> >> >
> >> > diff --git
> >> >
> a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA
> >> > 9x4S
> >> > ec.c
> >> >
> b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA
> >> > 9x4S
> >> > ec.c
> >> > index 6fa0774..d358d65 100644
> >> > ---
> >> >
> a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA
> >> > 9x4S
> >> > ec.c
> >> > +++
> >> >
> b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA
> >> > 9
> >> > +++ x4Sec.c
> >> > @@ -72,18 +72,21 @@ ArmPlatformSecTrustzoneInit (
> >> >// NOR Flash 0 non secure (BootMon)
> >> >TZASCSetRegion(ARM_VE_TZASC_BASE,1,TZASC_REGION_ENABLED,
> >> >ARM_VE_SMB_NOR0_BASE,0,
> >> > -  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> >> > +  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW,
> >> > +  0);
> >> >
> >> >// NOR Flash 1. The first half of the NOR Flash1 must be secure
> >> > for the secure firmware (sec_uefi.bin)
> >> >if (PcdGetBool (PcdTrustzoneSupport) == TRUE) {
> >> >  //Note: Your OS Kernel must be aware of the secure regions
> >> > before to enable this region
> >> >  TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
> >> >  ARM_VE_SMB_NOR1_BASE + SIZE_32MB,0,
> >> > -TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
> >> > +TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW,
> >> > +   0);
> >
> > TAB used (convert to spaces).
> >
> >> >} else {
> >> >  TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
> >> >  ARM_VE_SMB_NOR1_BASE,0,
> >> > -TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> >> > +TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW,
> >> > +   0);
> >
> > TAB used (convert to spaces).
> >
> >> >}
> >> >
> >> >// Base of SRAM. Only half of SRAM in Non Secure world @@ -
> 92,22
> >> > +95,26 @@ ArmPlatformSecTrustzoneInit (
> >> >  //Note: Your OS Kernel must be aware of the secure regions
> >> > before to enable this region
> >> >  TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
> >> >  ARM_VE_SMB_SRAM_BASE,0,
> >> > -TZASC_REGION_SIZE_16MB, TZASC_REGION_SECURITY_NSRW);
> >> > +TZASC_REGION_SIZE_16MB, TZASC_REGION_SECURITY_NSRW,
> >> > +   0);
> >
> > TAB used (convert to spaces).
> >
> >> >} else {
> >> >  TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
> >> >  ARM_VE_SMB_SRAM_BASE,0,
> >> > -TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
> >> > +TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW,
> >> > +   0);
> >
> > TAB used (convert to spaces).
> >
> > (These are all found by BaseTools/Scripts/PatchCheck.py, which also
> > points out that the subject line is too long.)
> >
> >> >}
> >> >
> >> >// Memory Mapped Peripherals. All in non secure world
> >> >TZASCSetRegion(ARM_VE_TZASC_BASE,4,TZASC_REGION_ENABLED,
> >> >ARM_VE_SMB_PERIPH_BASE,0,
> >> > -  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> >> > +  

Re: [edk2] [RESEND PATCH 1/1] ArmPlatformPkg/ArmTrustZone: Add support for specifying Subregions to be disabled

2016-10-26 Thread Bhupesh Sharma
Hi Leif,

Thanks for the review.

Please see my replies in-line.

> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Monday, October 17, 2016 6:55 PM
> 
> On Mon, Oct 17, 2016 at 10:18:01AM +, Bhupesh Sharma wrote:
> > Hi Ard, Leif,
> >
> > Any comments on this patch ?
> 
> You didn't cc me before :)
> 
> But more importantly, I don't really have any platform to test this on,
> so I could use a Tested-by: from someone who does. Evan, do you?
> 
> > > From: Bhupesh Sharma [mailto:bhupesh.sha...@nxp.com]
> > > Sent: Friday, October 14, 2016 4:40 PM
> > >
> > > ARM TZASC-380 IP provides a mechanism to split memory regions being
> > > protected via it into eight equal-sized sub-regions, with a bit
> > > setting allowing the corresponding subregion to be disabled.
> > >
> > > Several NXP/FSL SoCs support the TZASC-380 IP block and allow the
> > > DDR connected via the TZASC to be partitioned into regions having
> > > different security settings.
> > >
> > > This patch enables this support and can be used for SoCs which
> > > support such partition of DDR regions.
> > >
> > > Details of the 'subregion_disable'
> 
> This is not actually what the register is called in the link you're
> providing.
> 
> > > register can be viewed here:
> > >
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0431c
> > > /CJ
> > > ABCFHB.html
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Bhupesh Sharma 
> > > Cc: Ard Biesheuvel 
> > > ---
> > >  .../Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c | 21
> > > ++---
> > >  ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.c  |  5 +++--
> > >  ArmPlatformPkg/Include/Drivers/ArmTrustzone.h   |  3 ++-
> > >  3 files changed, 19 insertions(+), 10 deletions(-)
> > >
> > > diff --git
> > >
> a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9
> > > x4S
> > > ec.c
> > >
> b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9
> > > x4S
> > > ec.c
> > > index 6fa0774..d358d65 100644
> > > ---
> > >
> a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9
> > > x4S
> > > ec.c
> > > +++
> > >
> b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9
> > > +++ x4Sec.c
> > > @@ -72,18 +72,21 @@ ArmPlatformSecTrustzoneInit (
> > >// NOR Flash 0 non secure (BootMon)
> > >TZASCSetRegion(ARM_VE_TZASC_BASE,1,TZASC_REGION_ENABLED,
> > >ARM_VE_SMB_NOR0_BASE,0,
> > > -  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> > > +  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW,
> > > +  0);
> > >
> > >// NOR Flash 1. The first half of the NOR Flash1 must be secure
> > > for the secure firmware (sec_uefi.bin)
> > >if (PcdGetBool (PcdTrustzoneSupport) == TRUE) {
> > >  //Note: Your OS Kernel must be aware of the secure regions
> > > before to enable this region
> > >  TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
> > >  ARM_VE_SMB_NOR1_BASE + SIZE_32MB,0,
> > > -TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
> > > +TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW,
> > > + 0);
> 
> TAB used (convert to spaces).

Ok.
 
> > >} else {
> > >  TZASCSetRegion(ARM_VE_TZASC_BASE,2,TZASC_REGION_ENABLED,
> > >  ARM_VE_SMB_NOR1_BASE,0,
> > > -TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> > > +TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW,
> > > + 0);
> 
> TAB used (convert to spaces).

Ok.
 
> > >}
> > >
> > >// Base of SRAM. Only half of SRAM in Non Secure world @@ -92,22
> > > +95,26 @@ ArmPlatformSecTrustzoneInit (
> > >  //Note: Your OS Kernel must be aware of the secure regions
> > > before to enable this region
> > >  TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
> > >  ARM_VE_SMB_SRAM_BASE,0,
> > > -TZASC_REGION_SIZE_16MB, TZASC_REGION_SECURITY_NSRW);
> > > +TZASC_REGION_SIZE_16MB, TZASC_REGION_SECURITY_NSRW,
> > > + 0);
> 
> TAB used (convert to spaces).

Ok.
 
> > >} else {
> > >  TZASCSetRegion(ARM_VE_TZASC_BASE,3,TZASC_REGION_ENABLED,
> > >  ARM_VE_SMB_SRAM_BASE,0,
> > > -TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW);
> > > +TZASC_REGION_SIZE_32MB, TZASC_REGION_SECURITY_NSRW,
> > > + 0);
> 
> TAB used (convert to spaces).

Ok.
> (These are all found by BaseTools/Scripts/PatchCheck.py, which also
> points out that the subject line is too long.)

Thanks for the pointer. I was looking for a checkpatch.pl kind of
equivalent for EDK2. Looks like I found one now :)

> 
> > >}
> > >
> > >// Memory Mapped Peripherals. All in non secure world
> > >TZASCSetRegion(ARM_VE_TZASC_BASE,4,TZASC_REGION_ENABLED,
> > >ARM_VE_SMB_PERIPH_BASE,0,
> > > -  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW);
> > > +  TZASC_REGION_SIZE_64MB, TZASC_REGION_SECURITY_NSRW,
> > > +  

Re: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion

2016-10-26 Thread Tian, Feng
Mike,

You are right, the VS2015x64 IA32 build would fail.

With your fix, the code could pass build.

If there is no objection, I will help to push this fix tomorrow after adding 
EDKII commit log with your Sign-off and my Review-by.

Thanks
Feng

-Original Message-
From: Kinney, Michael D 
Sent: Thursday, October 27, 2016 11:10 AM
To: Brian J. Johnson ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Zeng, Star 
Subject: RE: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm 
cursor motion

Tian Feng,

Unfortunately, this patch that was pushed to edk2/master today breaks on IA32 
VS2015x86 builds with a signed/unsigned mismatch on 3 lines.  I think the right 
fix might be:

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index e9b5ed0..9625f4d 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -790,13 +790,13 @@ TerminalConOutSetCursorPosition (
   // it isn't necessary.
   //
   if (TerminalDevice->TerminalType == TTYTERMTYPE &&
-  Mode->CursorRow == Row) {
-if (Mode->CursorColumn > Column) {
+  (UINTN)Mode->CursorRow == Row) {
+if ((UINTN)Mode->CursorColumn > Column) {
   mCursorBackwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + 
((Mode->CursorColumn - Column) / 10));
   mCursorBackwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + 
((Mode->CursorColumn - Column) % 10));
   String = mCursorBackwardString;
 }
-else if (Column > Mode->CursorColumn) {
+else if (Column > (UINTN)Mode->CursorColumn) {
   mCursorForwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + ((Column - 
Mode->CursorColumn) / 10));
   mCursorForwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + ((Column - 
Mode->CursorColumn) % 10));
   String = mCursorForwardString;

Please see if you can reproduce this issue.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Brian J. Johnson
> Sent: Friday, October 7, 2016 7:54 AM
> To: edk2-devel@lists.01.org
> Cc: Brian J. Johnson ; Tian, Feng 
> ; Zeng, Star 
> Subject: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm 
> cursor motion
> 
> For TtyTerm terminals, output a shorter escape sequence when possible 
> to move the cursor within the current line, and don't print any escape 
> sequence if the cursor is already at the correct position.  This 
> removes extra cursor motion activity at the EFI shell prompt, 
> improving performance.  It also makes it possible in many cases to 
> successfully use a terminal window which is taller than the driver's 
> mode setting (eg. 80x25.)
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Brian Johnson 
> Cc: Feng Tian 
> Cc: Star Zeng 
> ---
>  .../Universal/Console/TerminalDxe/Terminal.h   |  2 ++
>  .../Universal/Console/TerminalDxe/TerminalConOut.c | 36 
> +++---
>  2 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> index 269d2ae..3ee3969 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> @@ -2,6 +2,7 @@
>Header file for Terminal driver.
> 
>  Copyright (c) 2006 - 2014, Intel Corporation. All rights 
> reserved.
> +Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at @@ -157,6 +158,7 @@ typedef union {  #define 
> BACKGROUND_CONTROL_OFFSET 11
>  #define ROW_OFFSET2
>  #define COLUMN_OFFSET 5
> +#define FW_BACK_OFFSET2
> 
>  typedef struct {
>UINT16  Unicode;
> diff --git 
> a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> index b11e83f..e9b5ed0 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> @@ -83,6 +83,8 @@ CHAR16 mSetModeString[]= { ESC, '[', '=', '3', 
> 'h', 0 };
>  CHAR16 mSetAttributeString[]   = { ESC, '[', '0', 'm', ESC, '[', '4', 
> '0', 'm',
> ESC, '[', '4', '0', 'm', 0 };
>  CHAR16 mClearScreenString[]= { ESC, '[', '2', 'J', 0 };
>  CHAR16 mSetCursorPositionString[]  = { ESC, '[', '0', '0', ';', '0', 
> '0', 'H', 0 };
> +CHAR16 mCursorForwardString[]  = { ESC, '[', '0', 

Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Lin, Derek (HPS UEFI Dev)
Hi Andrew,

We also see this issue recently. And we have a fix. I've send email patch 
minutes ago.

Thanks,
Derek

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
Fish
Sent: Thursday, October 27, 2016 9:08 AM
To: edk2-devel 
Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
end up in the Guid.xref file. 

It looks to me like this code is only extracting the GUIDs from the Drivers INF 
file and the GUIDs defined in dependent libraries are skipped?  


https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
 


for Arch in ArchList:
PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
for key, item in Module.Protocols.items():
GuidDict[key] = item
for key, item in Module.Guids.items():
GuidDict[key] = item
for key, item in Module.Ppis.items():
GuidDict[key] = item


Does anyone know how to extract the info from the dependent libs? 

I have an lldb type formatter for EFI_GUID that will print out the GUID C name 
so I noticed when some of them went missing. 

Thanks,

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


[edk2] [PATCH] BaseTools/Genfds: Fix Guid.xref missing GUIDs defined in Library.

2016-10-26 Thread Derek Lin
The original Guid.xref lost some Guid which only defined in Library. When the 
library is used by a driver, its Guids were not listed in Guid.xref. Now they 
will.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index c2e9418..9c2f0ad 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -2,6 +2,7 @@
 # generate flash image
 #
 #  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+#  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -698,18 +699,22 @@ class GenFds :
 def GenerateGuidXRefFile(BuildDb, ArchList):
 GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, 
"Guid.xref")
 GuidXRefFile = StringIO.StringIO('')
+ModuleGuidDict = {}
 GuidDict = {}
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-for ModuleFile in PlatformDataBase.Modules:
+for ModuleFile in [x for x in PlatformDataBase.Modules] + [x for x 
in PlatformDataBase.LibraryInstances]:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+ModuleGuidDict[Module.BaseName] = Module.Guid
 for key, item in Module.Protocols.items():
 GuidDict[key] = item
 for key, item in Module.Guids.items():
 GuidDict[key] = item
 for key, item in Module.Ppis.items():
 GuidDict[key] = item
+# Append Module/Lib Guid to the Xref file
+for key, item in ModuleGuidDict.items():
+GuidXRefFile.write("%s %s\n" % (item.upper(), key))
# Append GUIDs, Protocols, and PPIs to the Xref file
 GuidXRefFile.write("\n")
 for key, item in GuidDict.items():
-- 
2.7.4.windows.1

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


Re: [edk2] [Patch] MdePkg/PciSegmentLib: Optimize PCI_SEGMENT_LIB_ADDRESS()

2016-10-26 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Kinney, Michael D
> Sent: Thursday, October 27, 2016 5:18 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [Patch] MdePkg/PciSegmentLib: Optimize
> PCI_SEGMENT_LIB_ADDRESS()
> 
> The PCI_SEGMENT_LIB_ADDRESS() macro puts the Segment number
> into bits 32..47 of the logical address that is returned.
> The portable method to put Segment in this bit range is to
> use LShitU64().  For 64-bit CPUs, this is optimized well
> by the compiler.  For 32-bit CPUs, a call to LSHiftU64()
> is included in the generated binaries.  However, if the
> Segment parameter is 0, then no shift is required.  Add
> a check for Segment set to 0 and provide an optimized
> macro implementation that does not call LShiftU64().
> 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Michael Kinney 
> ---
>  MdePkg/Include/Library/PciSegmentLib.h | 19 +--
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/PciSegmentLib.h
> b/MdePkg/Include/Library/PciSegmentLib.h
> index 1135010..5175e07 100644
> --- a/MdePkg/Include/Library/PciSegmentLib.h
> +++ b/MdePkg/Include/Library/PciSegmentLib.h
> @@ -23,7 +23,7 @@
>access method.  Modules will typically use the PCI Segment Library for its
> PCI configuration
>accesses when PCI Segments other than Segment #0 must be accessed.
> 
> -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2016, 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
> @@ -56,11 +56,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF
> ANY KIND, EITHER EXPRESS OR IMPLIED.
> 
>  **/
>  #define
> PCI_SEGMENT_LIB_ADDRESS(Segment,Bus,Device,Function,Register) \
> -  ( ((Register) & 0xfff)  | \
> -(((Function) & 0x07) << 12)   | \
> -(((Device) & 0x1f) << 15) | \
> -(((Bus) & 0xff) << 20)| \
> -(LShiftU64((Segment) & 0x, 32)) \
> +  ((Segment != 0) ? \
> +( ((Register) & 0xfff) | \
> +  (((Function) & 0x07) << 12)  | \
> +  (((Device) & 0x1f) << 15)| \
> +  (((Bus) & 0xff) << 20)   | \
> +  (LShiftU64 ((Segment) & 0x, 32))   \
> +) :  \
> +( ((Register) & 0xfff) | \
> +  (((Function) & 0x07) << 12)  | \
> +  (((Device) & 0x1f) << 15)| \
> +  (((Bus) & 0xff) << 20) \
> +)\
>)
> 
>  /**
> --
> 2.6.3.windows.1

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


Re: [edk2] [PATCH 09/47] OvmfPkg/XenBusDxe: remove module-local ARRAY_SIZE macro

2016-10-26 Thread Gary Lin
On Wed, Oct 26, 2016 at 09:04:26PM +0200, Laszlo Ersek wrote:
> Rely on the central macro definition from "MdePkg/Include/Base.h" instead.
> 
Reviewed-by: Gary Lin 

> Cc: Gary Lin 
> Cc: Jordan Justen 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  OvmfPkg/XenBusDxe/XenStore.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c
> index 9eeb6f54fb50..1666c4b8f90f 100644
> --- a/OvmfPkg/XenBusDxe/XenStore.c
> +++ b/OvmfPkg/XenBusDxe/XenStore.c
> @@ -713,9 +713,6 @@ static XenStoreErrors gXenStoreErrors[] = {
>{ XENSTORE_STATUS_EISCONN, "EISCONN" },
>{ XENSTORE_STATUS_E2BIG, "E2BIG" }
>  };
> -#ifndef ARRAY_SIZE
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
> -#endif
>  
>  STATIC
>  XENSTORE_STATUS
> -- 
> 2.9.2
> 
> 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 04/47] OvmfPkg/XenBusDxe: guard the definition of ARRAY_SIZE

2016-10-26 Thread Gary Lin
On Wed, Oct 26, 2016 at 09:04:21PM +0200, Laszlo Ersek wrote:
> In one of the next patches, we'll introduce ARRAY_SIZE in
> "MdePkg/Include/Base.h". In order to proceed in small steps, make the
> module-local definition of ARRAY_SIZE conditional. This way the
> introduction of the macro under MdePkg will silently switch this module
> over (after which we can remove the module-local definition completely).

It's nice to have a centralized macro.

Reviewed-by: Gary Lin 

> 
> Cc: Gary Lin 
> Cc: Jordan Justen 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  OvmfPkg/XenBusDxe/XenStore.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c
> index b7ae1d04863d..9eeb6f54fb50 100644
> --- a/OvmfPkg/XenBusDxe/XenStore.c
> +++ b/OvmfPkg/XenBusDxe/XenStore.c
> @@ -713,7 +713,9 @@ static XenStoreErrors gXenStoreErrors[] = {
>{ XENSTORE_STATUS_EISCONN, "EISCONN" },
>{ XENSTORE_STATUS_E2BIG, "E2BIG" }
>  };
> +#ifndef ARRAY_SIZE
>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
> +#endif
>  
>  STATIC
>  XENSTORE_STATUS
> -- 
> 2.9.2
> 
> 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 16/47] IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Fan, Jeff
Reviewed-by: Jeff Fan 

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:05 AM
To: edk2-devel-01
Cc: Fan, Jeff
Subject: [PATCH 16/47] IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE()

Cc: Jeff Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c|  2 +-
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c|  4 ++--
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c |  8 

 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c|  2 +-
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c |  6 +++---
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c| 10 
+-
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c  |  2 +-
 IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c|  2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
index ae7ad2153c51..bf81de40a31d 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -581,7 +581,7 @@ BdsEntry (
   Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
   DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", 
Status));
   if (!EFI_ERROR (Status)) {
-for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof 
(mReadOnlyVariables[0]); Index++) {
+for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
   Status = VariableLock->RequestToLock (VariableLock, 
mReadOnlyVariables[Index], );
   ASSERT_EFI_ERROR (Status);
 }
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
index 6a0b525f1581..2ef9cf13ebb8 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
@@ -206,7 +206,7 @@ GroupMultipleLegacyBootOption4SameType (
   //
   // Legacy Boot Option
   //
-  ASSERT BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 
0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]));
+  ASSERT BBS_BBS_DEVICE_PATH *) 
+ BootOption->DevicePath)->DeviceType & 0xF) < ARRAY_SIZE 
+ (DeviceTypeIndex));
   NextIndex = [((BBS_BBS_DEVICE_PATH *) 
BootOption->DevicePath)->DeviceType & 0xF];
 
   if (*NextIndex == (UINTN) -1) {
@@ -225,7 +225,7 @@ GroupMultipleLegacyBootOption4SameType (
 //
 // Update the DeviceTypeIndex array to reflect the right shift 
operation
 //
-for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof 
(DeviceTypeIndex[0]); DeviceIndex++) {
+for (DeviceIndex = 0; DeviceIndex < ARRAY_SIZE 
+ (DeviceTypeIndex); DeviceIndex++) {
   if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && 
DeviceTypeIndex[DeviceIndex] >= *NextIndex) {
 DeviceTypeIndex[DeviceIndex]++;
   }
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
index 96f84ece2a9a..d5ea0f457705 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -520,16 +520,16 @@ BootMaintRouteConfig (
 ASSERT (NewMenuEntry != NULL);
 NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
 NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index];
-ASSERT (NewBmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof 
(BaudRateList[0])));
+ASSERT (NewBmmData->COMBaudRate[Index] < (ARRAY_SIZE 
+ (BaudRateList)));
 NewTerminalContext->BaudRate  = 
BaudRateList[NewBmmData->COMBaudRate[Index]].Value;
 NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index];
-ASSERT (NewBmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof 
(DataBitsList[0])));
+ASSERT (NewBmmData->COMDataRate[Index] < (ARRAY_SIZE 
+ (DataBitsList)));
 NewTerminalContext->DataBits  = (UINT8) 
DataBitsList[NewBmmData->COMDataRate[Index]].Value;
 NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index];
-ASSERT (NewBmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof 
(StopBitsList[0])));
+ASSERT (NewBmmData->COMStopBits[Index] < (ARRAY_SIZE 
+ (StopBitsList)));
 NewTerminalContext->StopBits  = (UINT8) 
StopBitsList[NewBmmData->COMStopBits[Index]].Value;
 NewTerminalContext->ParityIndex   = NewBmmData->COMParity[Index];
-ASSERT (NewBmmData->COMParity[Index] < (sizeof (ParityList) / sizeof 
(ParityList[0])));
+ASSERT 

Re: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion

2016-10-26 Thread Kinney, Michael D
Tian Feng,

Unfortunately, this patch that was pushed to edk2/master today
breaks on IA32 VS2015x86 builds with a signed/unsigned mismatch
on 3 lines.  I think the right fix might be:

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index e9b5ed0..9625f4d 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -790,13 +790,13 @@ TerminalConOutSetCursorPosition (
   // it isn't necessary.
   //
   if (TerminalDevice->TerminalType == TTYTERMTYPE &&
-  Mode->CursorRow == Row) {
-if (Mode->CursorColumn > Column) {
+  (UINTN)Mode->CursorRow == Row) {
+if ((UINTN)Mode->CursorColumn > Column) {
   mCursorBackwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + 
((Mode->CursorColumn - Column) / 10));
   mCursorBackwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + 
((Mode->CursorColumn - Column) % 10));
   String = mCursorBackwardString;
 }
-else if (Column > Mode->CursorColumn) {
+else if (Column > (UINTN)Mode->CursorColumn) {
   mCursorForwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + ((Column - 
Mode->CursorColumn) / 10));
   mCursorForwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + ((Column - 
Mode->CursorColumn) % 10));
   String = mCursorForwardString;

Please see if you can reproduce this issue.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Brian 
> J. Johnson
> Sent: Friday, October 7, 2016 7:54 AM
> To: edk2-devel@lists.01.org
> Cc: Brian J. Johnson ; Tian, Feng ; 
> Zeng, Star
> 
> Subject: [edk2] [PATCH 2/3] MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor 
> motion
> 
> For TtyTerm terminals, output a shorter escape sequence when possible
> to move the cursor within the current line, and don't print any escape
> sequence if the cursor is already at the correct position.  This
> removes extra cursor motion activity at the EFI shell prompt,
> improving performance.  It also makes it possible in many cases to
> successfully use a terminal window which is taller than the driver's
> mode setting (eg. 80x25.)
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Brian Johnson 
> Cc: Feng Tian 
> Cc: Star Zeng 
> ---
>  .../Universal/Console/TerminalDxe/Terminal.h   |  2 ++
>  .../Universal/Console/TerminalDxe/TerminalConOut.c | 36 
> +++---
>  2 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> index 269d2ae..3ee3969 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> @@ -2,6 +2,7 @@
>Header file for Terminal driver.
> 
>  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -157,6 +158,7 @@ typedef union {
>  #define BACKGROUND_CONTROL_OFFSET 11
>  #define ROW_OFFSET2
>  #define COLUMN_OFFSET 5
> +#define FW_BACK_OFFSET2
> 
>  typedef struct {
>UINT16  Unicode;
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> index b11e83f..e9b5ed0 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
> @@ -83,6 +83,8 @@ CHAR16 mSetModeString[]= { ESC, '[', '=', '3', 
> 'h', 0 };
>  CHAR16 mSetAttributeString[]   = { ESC, '[', '0', 'm', ESC, '[', '4', 
> '0', 'm',
> ESC, '[', '4', '0', 'm', 0 };
>  CHAR16 mClearScreenString[]= { ESC, '[', '2', 'J', 0 };
>  CHAR16 mSetCursorPositionString[]  = { ESC, '[', '0', '0', ';', '0', '0', 
> 'H', 0 };
> +CHAR16 mCursorForwardString[]  = { ESC, '[', '0', '0', 'C', 0 };
> +CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 };
> 
>  //
>  // Body of the ConOut functions
> @@ -755,6 +757,7 @@ TerminalConOutSetCursorPosition (
>UINTN   MaxRow;
>EFI_STATUS  Status;
>TERMINAL_DEV*TerminalDevice;
> +  CHAR16  *String;
> 
>TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
> 
> @@ -782,13 +785,36 @@ TerminalConOutSetCursorPosition (
>//
>// control sequence to move the cursor
>//
> -  mSetCursorPositionString[ROW_OFFSET + 0]= (CHAR16) ('0' + ((Row + 1) / 
> 

Re: [edk2] [PATCH 15/47] IntelFrameworkModulePkg/LegacyBootManagerLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Fan, Jeff
Reviewed-by: Jeff Fan 

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:05 AM
To: edk2-devel-01
Cc: Fan, Jeff
Subject: [PATCH 15/47] IntelFrameworkModulePkg/LegacyBootManagerLib: rebase to 
ARRAY_SIZE()

Cc: Jeff Fan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c 
b/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
index d3b48e8d0b9e..c56a8786391a 100644
--- a/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
+++ b/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
@@ -183,7 +183,7 @@ LegacyBmBuildLegacyDevNameString (
 //
 CopyMem (StringBufferA, StringDesc, LEGACY_BM_BOOT_DESCRIPTION_LENGTH);
 StringBufferA[LEGACY_BM_BOOT_DESCRIPTION_LENGTH] = 0;
-AsciiStrToUnicodeStrS (StringBufferA, StringBufferU, sizeof 
(StringBufferU) / sizeof (StringBufferU[0]));
+AsciiStrToUnicodeStrS (StringBufferA, StringBufferU, ARRAY_SIZE 
(StringBufferU));
 Fmt   = L"%s";
 Type  = StringBufferU;
   }
-- 
2.9.2


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


Re: [edk2] [PATCH] CorebootModulePkgPkg: Expose FindCbTag API from CbParseLib

2016-10-26 Thread Ma, Maurice
Guo,

I think it is better to add  "EFIAPI" to force the calling convention.

Thanks
Maurice

-Original Message-
From: Dong, Guo 
Sent: Wednesday, October 26, 2016 5:35 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootModulePkgPkg: Expose FindCbTag API from 
CbParseLib

CbPlatformSupportLib might use FindCbTag() API to parse platform specific 
information.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 CorebootModulePkg/Include/Library/CbParseLib.h | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/CorebootModulePkg/Include/Library/CbParseLib.h 
b/CorebootModulePkg/Include/Library/CbParseLib.h
index 064baf3..e1fda7e 100644
--- a/CorebootModulePkg/Include/Library/CbParseLib.h
+++ b/CorebootModulePkg/Include/Library/CbParseLib.h
@@ -2,7 +2,7 @@
   This library will parse the coreboot table in memory and extract those 
required
   information.
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, 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 @@ -18,6 +18,23 @@ typedef RETURN_STATUS \
 (*CB_MEM_INFO_CALLBACK) (UINT64 Base, UINT64 Size, UINT32 Type, VOID 
*Param);
 
 /**
+  Find coreboot record with given Tag from the memory Start in 4096  
+ bytes range.
+
+  @param  Start  The start memory to be searched in
+  @param  TagThe tag id to be found
+
+  @retval NULL  The Tag is not found.
+  @retval OthersThe poiter to the record found.
+
+**/
+VOID *
+FindCbTag (
+  IN  VOID *Start,
+  IN  UINT32   Tag
+  );
+
+/**
   Acquire the memory information from the coreboot table in memory.
 
   @param  MemInfoCallback The callback routine
--
2.7.0.windows.1

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


Re: [edk2] [PATCH] CorebootPayloadPkg: Add "Down" key to Boot Manager Menu

2016-10-26 Thread Ma, Maurice
Reviewed-by: Maurice Ma 


-Original Message-
From: Dong, Guo 
Sent: Wednesday, October 26, 2016 5:45 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootPayloadPkg: Add "Down" key to Boot Manager Menu

Also add Down key to Boot Manager Menu since some serial terminals don't 
support F2 key.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c| 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a31384a..c16a6b3 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana
+++ ger.c
@@ -181,6 +181,7 @@ PlatformBootManagerBeforeConsole (  {
   EFI_INPUT_KEYEnter;
   EFI_INPUT_KEYF2;
+  EFI_INPUT_KEYDown;
   EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
 
   PlatformConsoleInit ();
@@ -201,6 +202,14 @@ PlatformBootManagerBeforeConsole (
   EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 
0, , NULL);
 
   //
+  // Also add Down key to Boot Manager Menu since some serial terminals don't 
support F2 key.
+  //
+  Down.ScanCode= SCAN_DOWN;
+  Down.UnicodeChar = CHAR_NULL;
+  EfiBootManagerGetBootManagerMenu ();  
+ EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) 
+ BootOption.OptionNumber, 0, , NULL);
+
+  //
   // Register UEFI Shell
   //
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE); @@ -239,8 +248,8 @@ PlatformBootManagerAfterConsole (
 
   Print (
 L"\n"
-L"F2  to enter Boot Manager Menu.\n"
-L"ENTER   to boot directly.\n"
+L"F2 or Down  to enter Boot Manager Menu.\n"
+L"ENTER   to boot directly.\n"
 L"\n"
   );
 
--
2.7.0.windows.1

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


Re: [edk2] [PATCH] CorebootPayloadPkg: Make EFI shell the last boot option.

2016-10-26 Thread Ma, Maurice
Reviewed-by: Maurice Ma 

-Original Message-
From: Dong, Guo 
Sent: Wednesday, October 26, 2016 5:51 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootPayloadPkg: Make EFI shell the last boot option.

To let it boot to OS automatically, make built in shell as the last boot option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c   | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a31384a..1546e48 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana
+++ ger.c
@@ -201,11 +201,6 @@ PlatformBootManagerBeforeConsole (
   EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 
0, , NULL);
 
   //
-  // Register UEFI Shell
-  //
-  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
-
-  //
   // Install ready to lock.
   // This needs to be done before option rom dispatched.
   //
@@ -237,6 +232,11 @@ PlatformBootManagerAfterConsole (
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
+  //
+  // Register UEFI Shell
+  //
+  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI 
+ Shell", LOAD_OPTION_ACTIVE);
+  
   Print (
 L"\n"
 L"F2  to enter Boot Manager Menu.\n"
--
2.7.0.windows.1

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


Re: [edk2] [PATCH 01/19] MdePkg/DebugLib.h: add ASSERT_RETURN_ERROR()

2016-10-26 Thread Kinney, Michael D
Hi Laszlo,

I investigated the QuarkSocPkg ones.

The extra #include of BaseType.h should be removed from:
QuarkSocPkg/QuarkNorthCluster/Library/QNCSmmLib/QNCSmmLib.c

However, it should not be removed from the other one:
QuarkSocPkg/QuarkNorthCluster/Library/ResetSystemLib/ResetSystemLib.c

The ResetSystemLib uses EFI_TIME that is defined in BaseType.h.

I will send patch for QNCSmmLib.

Mike

From: Gao, Liming
Sent: Tuesday, October 25, 2016 3:33 AM
To: Laszlo Ersek ; Kinney, Michael D 

Cc: edk2-devel-01 ; Justen, Jordan L 
; Ard Biesheuvel 
Subject: RE: [edk2] [PATCH 01/19] MdePkg/DebugLib.h: add ASSERT_RETURN_ERROR()

Laszlo:
  Thanks for your report them. I just investigate MdePkg and MdeModulePkg ones. 
MdePkg BaseLib should be BASE type. It doesn't depend on UEFI. I will clean up 
it. MdeModulePkg FrameBufferBltLib is designed for UEFI GOP BLT operation. This 
library instance type should be UEFI_DRIVER.

  I will provide the patch to clean up them.

Thanks
Liming
From: Laszlo Ersek [mailto:ler...@redhat.com]
Sent: Tuesday, October 25, 2016 3:54 PM
To: Kinney, Michael D 
>; Gao, Liming 
>
Cc: edk2-devel-01 >; 
Justen, Jordan L >; 
Ard Biesheuvel >
Subject: Re: [edk2] [PATCH 01/19] MdePkg/DebugLib.h: add ASSERT_RETURN_ERROR()

On 10/25/16 01:05, Kinney, Michael D wrote:
> Hi Laszlo,
>
> Sorry for the delay. I was traveling last week.
>
> I did see this and I have been thinking about it.
> I think it does make sense to add this new macro
> for libraries of type BASE. I am surprised we did
> not run into an issue before that would have required
> the introduction of this macro earlier. Unless the
> workaround has been to add #include of
> , which makes me think we should
> review BASE libraries to make sure that extra include
> is not present.

I spent a few minutes on the following shell script, to identify such
libraries:

{

# Locate the INF files that have a LIBRARY_CLASS define with a client
# module type list that explicitly includes BASE
git grep -l -E '\' -- \
'*.inf'

# Locate the INF files that have MODULE_TYPE=BASE, and a LIBRARY_CLASS
# define without a client type list.
git grep -l -E '\' -- '*inf' \
| xargs -r -- grep -l -E '\[^|]+$' --

} \
| {

# Cut off the last pathname component, in order to get the pathname of
# the directory containing the INF file
rev | cut -f 2- -d / | rev

} \
| {

# If a directory has several matching INF files, list the directory
# only once.
sort -u

} \
| {

# Check if any file in these directories includes
# "Uefi/UefiBaseType.h".
xargs -r -- grep -r -l Uefi/UefiBaseType.h --

}

It prints the following files:

CorebootModulePkg/Library/CbParseLib/CbParseLib.c
CorebootPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
MdePkg/Library/BaseLib/FilePaths.c
OvmfPkg/Library/XenConsoleSerialPortLib/XenConsoleSerialPortLib.c
QuarkSocPkg/QuarkNorthCluster/Library/QNCSmmLib/QNCSmmLib.c
QuarkSocPkg/QuarkNorthCluster/Library/ResetSystemLib/ResetSystemLib.c

We should likely investigate them.

I'll handle the OvmfPkg one.

>
> The EFI_* error codes are mapped to RETURN_* error
> codes. So the only feedback I was considering was
> to implement ASSERT_EFI_ERROR() using
> ASSERT_RETURN_ERROR(), but that might not always be
> the right mapping because the RETURN_* codes are
> a subset of EFI_* error codes.
>
> Reviewed-by: Michael Kinney

Thank you!
Laszlo

> Best regards,
>
> Mike
>
>
>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Monday, October 24, 2016 2:00 PM
>> To: Kinney, Michael D ; Gao, Liming
>>
>> Cc: edk2-devel-01
>> Subject: Re: [edk2] [PATCH 01/19] MdePkg/DebugLib.h: add 
>> ASSERT_RETURN_ERROR()
>>
>> Mike, Liming,
>>
>> On 10/21/16 23:27, Laszlo Ersek wrote:
>>> ASSERT_EFI_ERROR() cannot be used in BASE type modules because
>>> - the replacement text calls EFI_ERROR(),
>>> - EFI_ERROR() is defined in "MdePkg/Include/Uefi/UefiBaseType.h",
>>> - the inclusion of "UefiBaseType.h" is not required for BASE type modules.
>>>
>>> While
>>>
>>> ASSERT (!RETURN_ERROR (StatusParameter))
>>>
>>> would be a functional statement in BASE type modules, it would be less
>>> convenient and less informative: ASSERT_EFI_ERROR() prints the actual
>>> StatusParameter.
>>>
>>> Hence add ASSERT_RETURN_ERROR(), paralleling ASSERT_EFI_ERROR(). Copy the
>>> original macro definition and update it as follows:
>>> - replace EFI with RETURN,
>>> - wrap overlong lines in the comment block and in the code,
>>> - EFI_D_ERROR is deprecated, so employ DEBUG_ERROR instead.
>>>
>>> Cc: 

Re: [edk2] [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Wu, Jiaxin
Reviewed-By: Wu Jiaxin 


Best Regards!
Jiaxin

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:05 AM
> To: edk2-devel-01 
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()
> 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/TcpDxe/TcpOutput.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/TcpDxe/TcpOutput.c
> b/NetworkPkg/TcpDxe/TcpOutput.c index 91e56d369a71..a46cb6099ea8
> 100644
> --- a/NetworkPkg/TcpDxe/TcpOutput.c
> +++ b/NetworkPkg/TcpDxe/TcpOutput.c
> @@ -797,7 +797,7 @@ TcpToSendData (
>  Len   = TcpDataToSend (Tcb, Force);
>  Seq   = Tcb->SndNxt;
> 
> -ASSERT ((Tcb->State) < (sizeof (mTcpOutFlag) / sizeof (mTcpOutFlag[0])));
> +ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag)));
>  Flag  = mTcpOutFlag[Tcb->State];
> 
>  if ((Flag & TCP_FLG_SYN) != 0) {
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()

2016-10-26 Thread Zeng, Star
Reviewed-by: Star Zeng  to MdeModulePkg changes.

Thanks,
Star
-Original Message-
From: Tian, Feng 
Sent: Thursday, October 27, 2016 9:17 AM
To: Laszlo Ersek ; edk2-devel-01 
Cc: Ard Biesheuvel ; Cecil Sheng 
; Zhang, Chao B ; Bi, Dandan 
; Daryl McDaniel ; Wei, David 
; Dong, Eric ; Gary Lin 
; Carsey, Jaben ; Fan, Jeff 
; Wu, Jiaxin ; Justen, Jordan L 
; Gao, Liming ; Kinney, 
Michael D ; Ni, Ruiyu ; Fu, 
Siyuan ; Zeng, Star ; Tim He 
; Tian, Feng 
Subject: RE: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()

MdeModulePkg

reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:04 AM
To: edk2-devel-01 
Cc: Ard Biesheuvel ; Cecil Sheng 
; Zhang, Chao B ; Bi, Dandan 
; Daryl McDaniel ; Wei, David 
; Dong, Eric ; Tian, Feng 
; Gary Lin ; Carsey, Jaben 
; Fan, Jeff ; Wu, Jiaxin 
; Justen, Jordan L ; Gao, 
Liming ; Kinney, Michael D ; 
Ni, Ruiyu ; Fu, Siyuan ; Zeng, Star 
; Tim He 
Subject: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()

I'm sure most of us have wished at some point that ARRAY_SIZE() had existed in 
a central header file, like it does in many other open source projects. This 
series implements that.

Patches 01-04 round up the modules that #define ARRAY_SIZE() just for 
themselves, and wrap their definitions in #ifndef ARRAY_SIZE.

Patch 05 defines ARRAY_SIZE() in "MdePkg/Include/Base.h". This flips the 
previously modified modules to MdePkg's macro definition.

Patches 06-09 modify the same set of modules as patches 01-04 do; this time the 
(now unused) module-local ARRAY_SIZE() macro definitions are eliminated.

The rest of the patches (10-47) migrate the edk2 tree to ARRAY_SIZE(), covering 
the most obvious open-coded ARRAY_SIZE() expressions. These expressions were 
located and converted with the following shell
pipeline:

  git ls-files \
  | xargs --no-run-if-empty -- \
  sed --regexp-extended --in-place \
--expression='s,sizeof \(([a-zA-Z0-9_]+)\) / sizeof 
\((\*\1|\1\[0\])\),ARRAY_SIZE (\1),g' \
--

This pipeline lists all tracked files with "git". The pathnames are then 
composed with "xargs" into maximal length "sed" command lines, and those "sed" 
commands are run.

Here the "sed" stream editor filters and modifies all the listed files in 
place. The extended regular expression replaces the following two
patterns:

  sizeof (ArrayName) / sizeof (*ArrayName)
  sizeof (ArrayName) / sizeof (ArrayName[0])

with

  ARRAY_SIZE (ArrayName)

The regexp uses a backreference in the match, ensuring that the sizeof operator 
in the dividend and the sizeof operator in the divisor both refer to the same 
ArrayName. If there are multiple occurrences on the same line, the sed command 
replaces all of them.

I collected the changes into patches manually, and I reviewed them all.

I test-built all of the modified packages, repeating the command

  build -a X64 -t GCC48 -b DEBUG -p FooPkg/FooPkg.dsc

as many times as necessary. Two packages were impossible to build like
this: Nt32Pkg and Vlv2TbltDevicePkg, so I couldn't build-test them.

I did some light-weight testing with OVMF: boot with Secure Boot enabled, S3 
suspend/resume with and without SMM. I also booted ArmVirtQemu once.

Repository: https://github.com/lersek/edk2.git
Branch: array_size

Cc: Ard Biesheuvel 
Cc: Cecil Sheng 
Cc: Chao Zhang 
Cc: Dandan Bi 
Cc: Daryl McDaniel 
Cc: David Wei 
Cc: Eric Dong 
Cc: Feng Tian 
Cc: Gary Lin 
Cc: Jaben Carsey 
Cc: Jeff Fan 
Cc: Jiaxin Wu 
Cc: Jordan Justen 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Ruiyu Ni 
Cc: Siyuan Fu 
Cc: Star Zeng 

Re: [edk2] [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro

2016-10-26 Thread Wu, Jiaxin
Reviewed-By: Wu Jiaxin 

Best Regards!
Jiaxin

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:04 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local
> ARRAY_SIZE macro
> 
> Rely on the central macro definition from "MdePkg/Include/Base.h" instead.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> index 79a436a7b3b2..95bb6961136d 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> @@ -27,10 +27,6 @@
> 
>  #include 
> 
> -#ifndef ARRAY_SIZE
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif
> -
>  #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus"
> 
>  #define BIT(x)   (UINT32) (1 << (x))
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE

2016-10-26 Thread Wu, Jiaxin
Reviewed-By: Wu Jiaxin 

Best Regards!
Jiaxin

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:04 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of
> ARRAY_SIZE
> 
> In one of the next patches, we'll introduce ARRAY_SIZE in
> "MdePkg/Include/Base.h". In order to proceed in small steps, make the
> module-local definition of ARRAY_SIZE conditional. This way the introduction 
> of
> the macro under MdePkg will silently switch this module over (after which we
> can remove the module-local definition completely).
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> index 8ebc599a12e7..79a436a7b3b2 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> @@ -27,7 +27,9 @@
> 
>  #include 
> 
> +#ifndef ARRAY_SIZE
>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
> +#endif
> 
>  #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus"
> 
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro

2016-10-26 Thread Kinney, Michael D
With that change:

Reviewed-by: Michael Kinney 

Mike

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Wednesday, October 26, 2016 3:26 PM
> To: Kinney, Michael D ; edk2-devel-01  de...@ml01.01.org>
> Cc: Ni, Ruiyu ; Tim He ; Tian, Feng
> ; Dong, Eric ; Cecil Sheng
> ; Ard Biesheuvel ; Justen, 
> Jordan L
> ; Gao, Liming ; Bi, Dandan
> ; Wu, Jiaxin ; Gary Lin 
> ;
> Zeng, Star ; Daryl McDaniel 
> ; Carsey,
> Jaben ; Fu, Siyuan ; Fan, Jeff
> ; Zhang, Chao B ; Wei, David
> 
> Subject: Re: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the 
> ARRAY_SIZE()
> function-like macro
> 
> On 10/27/16 00:13, Kinney, Michael D wrote:
> > Hi Laszlo,
> >
> > One comment inline below.
> >
> > Mike
> >
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> >> Laszlo Ersek
> >> Sent: Wednesday, October 26, 2016 12:04 PM
> >> To: edk2-devel-01 
> >> Cc: Ni, Ruiyu ; Tim He ; Tian, Feng
> >> ; Kinney, Michael D ; 
> >> Dong, Eric
> >> ; Cecil Sheng ; Ard Biesheuvel
> >> ; Justen, Jordan L ; 
> >> Gao,
> Liming
> >> ; Bi, Dandan ; Wu, Jiaxin
> >> ; Gary Lin ; Zeng, Star 
> >> ;
> >> Daryl McDaniel ; Carsey, Jaben 
> >> ;
> >> Fu, Siyuan ; Fan, Jeff ; Zhang, 
> >> Chao B
> >> ; Wei, David 
> >> Subject: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the 
> >> ARRAY_SIZE()
> >> function-like macro
> >>
> >> Several modules use ARRAY_SIZE() already; centralize the definition. (The
> >> module-specific macro definitions are guarded by #ifndef directives at
> >> this point.)
> >>
> >> Cc: Ard Biesheuvel 
> >> Cc: Cecil Sheng 
> >> Cc: Chao Zhang 
> >> Cc: Dandan Bi 
> >> Cc: Daryl McDaniel 
> >> Cc: David Wei 
> >> Cc: Eric Dong 
> >> Cc: Feng Tian 
> >> Cc: Gary Lin 
> >> Cc: Jaben Carsey 
> >> Cc: Jeff Fan 
> >> Cc: Jiaxin Wu 
> >> Cc: Jordan Justen 
> >> Cc: Liming Gao 
> >> Cc: Michael D Kinney 
> >> Cc: Ruiyu Ni 
> >> Cc: Siyuan Fu 
> >> Cc: Star Zeng 
> >> Cc: Tim He 
> >> Contributed-under: TianoCore Contribution Agreement 1.0
> >> Signed-off-by: Laszlo Ersek 
> >> ---
> >>  MdePkg/Include/Base.h | 13 +
> >>  1 file changed, 13 insertions(+)
> >>
> >> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
> >> index c66614846488..8bdb257e37bd 100644
> >> --- a/MdePkg/Include/Base.h
> >> +++ b/MdePkg/Include/Base.h
> >> @@ -1211,5 +1211,18 @@ typedef UINTN RETURN_STATUS;
> >>#define RETURN_ADDRESS(L) ((VOID *) 0)
> >>  #endif
> >>
> >> +/**
> >> +  Return the number of elements in an array.
> >> +
> >> +  @param  Array  An object of array type. Array is only used as an 
> >> argument to
> >> + the sizeof operator, therefore Array is never evaluated. 
> >> The
> >> + caller is responsible for ensuring that Array's type is 
> >> not
> >> + incomplete; that is, Array must have known constant size.
> >> +
> >> +  @return The number of elements in Array. The result has type UINTN.
> >> +
> >> +**/
> >> +#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof (Array)[0])
> >
> > I think adding one extra set of () makes this clearer:
> >
> > #define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))
> 
> Sure, will do.
> 
> Thanks!
> Laszlo
> 
> >> +
> >>  #endif
> >>
> >> --
> >> 2.9.2
> >>
> >>
> >> ___
> >> 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 22/47] MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE()

2016-10-26 Thread Kinney, Michael D
Reviewed-by: Michael Kinney 

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Wednesday, October 26, 2016 12:05 PM
> To: edk2-devel-01 
> Cc: Tian, Feng ; Kinney, Michael D 
> ;
> Zeng, Star 
> Subject: [PATCH 22/47] MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE()
> 
> Cc: Feng Tian 
> Cc: Michael D Kinney 
> Cc: Star Zeng 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  MdeModulePkg/Core/PiSmmCore/Pool.c   | 2 +-
>  MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c 
> b/MdeModulePkg/Core/PiSmmCore/Pool.c
> index 9d447025883d..02dab0142560 100644
> --- a/MdeModulePkg/Core/PiSmmCore/Pool.c
> +++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
> @@ -42,7 +42,7 @@ SmmInitializeMemoryServices (
>//
>// Initialize Pool list
>//
> -  for (Index = sizeof (mSmmPoolLists) / sizeof (*mSmmPoolLists); Index > 0;) 
> {
> +  for (Index = ARRAY_SIZE (mSmmPoolLists); Index > 0;) {
>  InitializeListHead ([--Index]);
>}
>CurrentSmramRangesIndex = 0;
> diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
> b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
> index 93585f199df9..d983cefbb3dc 100644
> --- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
> +++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
> @@ -2670,7 +2670,7 @@ ProfileMemoryTypeToStr (
>)
>  {
>UINTN Index;
> -  for (Index = 0; Index < sizeof (mMemoryTypeString) / sizeof 
> (mMemoryTypeString[0]);
> Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mMemoryTypeString); Index++) {
>  if (mMemoryTypeString[Index].MemoryType == MemoryType) {
>return mMemoryTypeString[Index].MemoryTypeStr;
>  }
> @@ -2697,12 +2697,12 @@ ProfileActionToStr (
>CHAR8 **ActionString;
> 
>ActionString = mSmmActionString;
> -  ActionStringCount = sizeof (mSmmActionString) / sizeof 
> (mSmmActionString[0]);
> +  ActionStringCount = ARRAY_SIZE (mSmmActionString);
> 
>if ((UINTN) (UINT32) Action < ActionStringCount) {
>  return ActionString[Action];
>}
> -  for (Index = 0; Index < sizeof (mExtActionString) / sizeof 
> (mExtActionString[0]);
> Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mExtActionString); Index++) {
>  if (mExtActionString[Index].Action == Action) {
>return mExtActionString[Index].String;
>  }
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add capsule/recovery handling.

2016-10-26 Thread Kinney, Michael D
Jiewen,

Thanks.  That makes sense.

Let's make sure the array is handled correctly in this platform specific 
solution and the new tool feature.

Mike

From: Yao, Jiewen
Sent: Wednesday, October 26, 2016 6:48 PM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B 
Subject: RE: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add 
capsule/recovery handling.

Yes, Mike. You are right.

We do have plan to make it generic. As we discussed before, we will enhance the 
tool to detect such info and set a PCD at build time. Then we can include that 
in the UiApp driver to report such error directly.

The tool is not ready yet. So current platform solution is just a temporary 
solution.

We do have plan to migrate to the new solution after the tool is ready. Then we 
can clean up the platform BDS code.

Thank you
Yao Jiewen


From: Kinney, Michael D
Sent: Thursday, October 27, 2016 7:36 AM
To: Yao, Jiewen >; 
edk2-devel@lists.01.org; Kinney, Michael D 
>
Cc: Tian, Feng >; Gao, Liming 
>; Zeng, Star 
>; Zhang, Chao B 
>
Subject: RE: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add 
capsule/recovery handling.

Jiewen,

Can the code that checks for the use of a test key be moved into a common BDS 
lib or module?
Maybe in MdeModulePkg\Universal\BdsDxe\BdsEntry.c right before the call to
PlatformBootManagerAfterConsole()?  The logic in BdsEntry.c can do the check 
and set the
PcdTestKeyUsed PCD and can go a DEBUG() message for the use of a test key.

With the current design, you depend on a platform specific BDS library to 
include the test
key check, and we want to make sure the check for the use of a test key is 
always performed.

Also, the test key check against PcdRsa2048Sha256PublicKeyBuffer is incomplete. 
The DEC file
description of this PCD is as follows:

  ## Provides one or more SHA 256 Hashes of the RSA 2048 public keys used to 
verify Recovery and Capsule Update images
  #  WARNING: The default value is treated as test key. Please do not use 
default value in the production.
  # @Prompt One or more SHA 256 Hashes of RSA 2048 bit public keys used to 
verify Recovery and Capsule Update images
  #
  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0x91, 0x29, 
0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 
0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 
0xa2, 0xd4, 0xa6, 0x4d}|VOID*|0x00010013

Since this PCD provides one or more SHA 256 Hashes, the check for the use of a 
test key needs to get the
Size, determine how many hashes are in this PCD, and compare the test key value 
against each entry in
this array.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >
> Subject: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add
> capsule/recovery handling.
>
> 1) Add capsule and recovery boot path handling in platform BDS.
> 2) Add check if the platform is using default test key for recovery or update.
> Produce PcdTestKeyUsed to indicate if there is any
> test key used in current BIOS, such as recovery key,
> or capsule update key.
> Then the generic UI may consume this PCD to show warning information.
>
> Cc: Michael D Kinney 
> >
> Cc: Kelly Steele >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> ---
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c  | 
> 131
> +++-
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.h  

Re: [edk2] [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Fu, Siyuan


Reviewed-by: Fu Siyuan siyuan...@intel.com




> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:05 AM
> To: edk2-devel-01 
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()
> 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/TcpDxe/TcpOutput.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c
> index 91e56d369a71..a46cb6099ea8 100644
> --- a/NetworkPkg/TcpDxe/TcpOutput.c
> +++ b/NetworkPkg/TcpDxe/TcpOutput.c
> @@ -797,7 +797,7 @@ TcpToSendData (
>  Len   = TcpDataToSend (Tcb, Force);
>  Seq   = Tcb->SndNxt;
> 
> -ASSERT ((Tcb->State) < (sizeof (mTcpOutFlag) / sizeof
> (mTcpOutFlag[0])));
> +ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag)));
>  Flag  = mTcpOutFlag[Tcb->State];
> 
>  if ((Flag & TCP_FLG_SYN) != 0) {
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 33/47] NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Fu, Siyuan


Reviewed-by: Fu Siyuan siyuan...@intel.com




> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:05 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 33/47] NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE()
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/IScsiDxe/IScsiConfig.c | 4 ++--
>  NetworkPkg/IScsiDxe/IScsiDriver.c | 2 +-
>  NetworkPkg/IScsiDxe/IScsiMisc.c   | 6 +++---
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c
> b/NetworkPkg/IScsiDxe/IScsiConfig.c
> index 3631e72e3455..16a90a6206aa 100644
> --- a/NetworkPkg/IScsiDxe/IScsiConfig.c
> +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
> @@ -,7 +,7 @@ IScsiConfigUpdateAttempt (
>NET_LIST_FOR_EACH (Entry, >AttemptConfigs) {
>  AttemptConfigData = NET_LIST_USER_STRUCT (Entry,
> ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
> 
> -AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName,
> sizeof (AttemptName) / sizeof (AttemptName[0]));
> +AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName,
> ARRAY_SIZE (AttemptName));
>  UnicodeSPrint (mPrivate->PortString, (UINTN) 128, L"Attempt %s",
> AttemptName);
>  AttemptConfigData->AttemptTitleToken = HiiSetString (
>   mCallbackInfo-
> >RegisteredHandle,
> @@ -1240,7 +1240,7 @@ IScsiConfigDeleteAttempts (
>mPrivate->SinglePathCount--;
>  }
> 
> -AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> sizeof (MacString) / sizeof (MacString[0]));
> +AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> ARRAY_SIZE (MacString));
> 
>  UnicodeSPrint (
>mPrivate->PortString,
> diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c
> b/NetworkPkg/IScsiDxe/IScsiDriver.c
> index 279f1c049679..ac10fa26d1b9 100644
> --- a/NetworkPkg/IScsiDxe/IScsiDriver.c
> +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
> @@ -673,7 +673,7 @@ IScsiStart (
>  Session->ConfigData = AttemptConfigData;
>  Session->AuthType   = AttemptConfigData->AuthenticationType;
> 
> -AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> sizeof (MacString) / sizeof (MacString[0]));
> +AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> ARRAY_SIZE (MacString));
>  UnicodeSPrint (
>mPrivate->PortString,
>(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
> diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c
> b/NetworkPkg/IScsiDxe/IScsiMisc.c
> index 64bb2ade7b0a..11a80f2e10e4 100644
> --- a/NetworkPkg/IScsiDxe/IScsiMisc.c
> +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
> @@ -1109,7 +1109,7 @@ IScsiGetConfigData (
>//
>// Refresh the state of this attempt to NVR.
>//
> -  AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof
> (MacString) / sizeof (MacString[0]));
> +  AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString,
> ARRAY_SIZE (MacString));
>UnicodeSPrint (
>  mPrivate->PortString,
>  (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
> @@ -1148,7 +1148,7 @@ IScsiGetConfigData (
>  //
>  // Refresh the state of this attempt to NVR.
>  //
> -AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof
> (MacString) / sizeof (MacString[0]));
> +AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString,
> ARRAY_SIZE (MacString));
>  UnicodeSPrint (
>mPrivate->PortString,
>(UINTN) ISCSI_NAME_IFR_MAX_SIZE,
> @@ -1239,7 +1239,7 @@ IScsiGetConfigData (
>//
>// Refresh the state of this attempt to NVR.
>//
> -  AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> sizeof (MacString) / sizeof (MacString[0]));
> +  AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString,
> ARRAY_SIZE (MacString));
>UnicodeSPrint (
>  mPrivate->PortString,
>  (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro

2016-10-26 Thread Fu, Siyuan


Reviewed-by: Fu Siyuan siyuan...@intel.com




> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:04 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 07/47] NetworkPkg/IpsecConfig: remove module-local
> ARRAY_SIZE macro
> 
> Rely on the central macro definition from "MdePkg/Include/Base.h" instead.
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> index 79a436a7b3b2..95bb6961136d 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> @@ -27,10 +27,6 @@
> 
>  #include 
> 
> -#ifndef ARRAY_SIZE
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
> -#endif
> -
>  #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus"
> 
>  #define BIT(x)   (UINT32) (1 << (x))
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE

2016-10-26 Thread Fu, Siyuan


Reviewed-by: Fu Siyuan siyuan...@intel.com


> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, October 27, 2016 3:04 AM
> To: edk2-devel-01 
> Cc: Wu, Jiaxin ; Fu, Siyuan 
> Subject: [PATCH 02/47] NetworkPkg/IpsecConfig: guard the definition of
> ARRAY_SIZE
> 
> In one of the next patches, we'll introduce ARRAY_SIZE in
> "MdePkg/Include/Base.h". In order to proceed in small steps, make the
> module-local definition of ARRAY_SIZE conditional. This way the
> introduction of the macro under MdePkg will silently switch this module
> over (after which we can remove the module-local definition completely).
> 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  NetworkPkg/Application/IpsecConfig/IpSecConfig.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> index 8ebc599a12e7..79a436a7b3b2 100644
> --- a/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> +++ b/NetworkPkg/Application/IpsecConfig/IpSecConfig.h
> @@ -27,7 +27,9 @@
> 
>  #include 
> 
> +#ifndef ARRAY_SIZE
>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
> +#endif
> 
>  #define IPSECCONFIG_STATUS_NAMEL"IpSecStatus"
> 
> --
> 2.9.2
> 

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


Re: [edk2] [PATCH 14/47] FatPkg/EnhancedFatDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Ni, Ruiyu 
>Subject: [PATCH 14/47] FatPkg/EnhancedFatDxe: rebase to ARRAY_SIZE()
>
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> FatPkg/EnhancedFatDxe/DirectoryManage.c | 4 ++--
> FatPkg/EnhancedFatDxe/FileName.c| 4 ++--
> FatPkg/EnhancedFatDxe/Hash.c| 4 ++--
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c 
>b/FatPkg/EnhancedFatDxe/DirectoryManage.c
>index 91e7599e2722..3328ae31fed9 100644
>--- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
>+++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
>@@ -118,7 +118,7 @@ Returns:
> SetMem (LfnBuffer, sizeof (CHAR16) * LFN_CHAR_TOTAL * EntryCount, 0xff);
> Status = StrCpyS (
>LfnBuffer,
>-   sizeof (LfnBuffer) / sizeof (LfnBuffer[0]),
>+   ARRAY_SIZE (LfnBuffer),
>DirEnt->FileString
>);
> if (EFI_ERROR (Status)) {
>@@ -360,7 +360,7 @@ Returns:
> FatGetFileNameViaCaseFlag (
>   DirEnt,
>   LfnBuffer,
>-  sizeof (LfnBuffer) / sizeof (LfnBuffer[0])
>+  ARRAY_SIZE (LfnBuffer)
>   );
>   }
>
>diff --git a/FatPkg/EnhancedFatDxe/FileName.c 
>b/FatPkg/EnhancedFatDxe/FileName.c
>index 551cda53b9a4..5df403625d64 100644
>--- a/FatPkg/EnhancedFatDxe/FileName.c
>+++ b/FatPkg/EnhancedFatDxe/FileName.c
>@@ -310,7 +310,7 @@ Returns:
>   // Lower case a copy of the string, if it matches the
>   // original then the string is lower case
>   //
>-  StrCpyS (Buffer, sizeof (Buffer) / sizeof (Buffer[0]), Str);
>+  StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str);
>   FatStrLwr (Buffer);
>   if (StrCmp (Str, Buffer) == 0) {
> OutCaseFlag = InCaseFlag;
>@@ -319,7 +319,7 @@ Returns:
>   // Upper case a copy of the string, if it matches the
>   // original then the string is upper case
>   //
>-  StrCpyS (Buffer, sizeof (Buffer) / sizeof (Buffer[0]), Str);
>+  StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str);
>   FatStrUpr (Buffer);
>   if (StrCmp (Str, Buffer) == 0) {
> OutCaseFlag = 0;
>diff --git a/FatPkg/EnhancedFatDxe/Hash.c b/FatPkg/EnhancedFatDxe/Hash.c
>index 3d0ffe6fb879..f827368ef5eb 100644
>--- a/FatPkg/EnhancedFatDxe/Hash.c
>+++ b/FatPkg/EnhancedFatDxe/Hash.c
>@@ -49,9 +49,9 @@ Returns:
>   CHAR16  UpCasedLongFileName[EFI_PATH_STRING_LENGTH];
>   StrnCpyS (
> UpCasedLongFileName,
>-sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]),
>+ARRAY_SIZE (UpCasedLongFileName),
> LongNameString,
>-sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]) - 1
>+ARRAY_SIZE (UpCasedLongFileName) - 1
> );
>   FatStrUpr (UpCasedLongFileName);
>   gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), 
> );
>--
>2.9.2
>

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


Re: [edk2] [PATCH 27/47] MdeModulePkg/Logo: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 27/47] MdeModulePkg/Logo: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Logo/Logo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
>index f0792addd3a9..313dd4a7937d 100644
>--- a/MdeModulePkg/Logo/Logo.c
>+++ b/MdeModulePkg/Logo/Logo.c
>@@ -69,7 +69,7 @@ GetImage (
>   }
>
>   Current = *Instance;
>-  if (Current >= sizeof (mLogos) / sizeof (mLogos[0])) {
>+  if (Current >= ARRAY_SIZE (mLogos)) {
> return EFI_NOT_FOUND;
>   }
>
>--
>2.9.2
>

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


Re: [edk2] [PATCH 18/47] MdeModulePkg/PciBusDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 18/47] MdeModulePkg/PciBusDxe: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c 
>b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
>index 337a6db7defa..4d297fdb23c7 100644
>--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
>+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
>@@ -868,7 +868,7 @@ PciHostBridgeResourceAllocator (
>   Resources[2] = PMem32Bridge;
>   Resources[3] = Mem64Bridge;
>   Resources[4] = PMem64Bridge;
>-  DumpResourceMap (RootBridgeDev, Resources, sizeof (Resources) / sizeof 
>(Resources[0]));
>+  DumpResourceMap (RootBridgeDev, Resources, ARRAY_SIZE (Resources));
> );
>
> FreePool (AcpiConfig);
>--
>2.9.2
>

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


Re: [edk2] [PATCH 28/47] MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 28/47] MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
>b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>index c86cd7a576ad..aacc4a64794d 100644
>--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>@@ -654,7 +654,7 @@ BdsEntry (
>   Status = gBS->LocateProtocol (, NULL, (VOID 
> **) );
>   DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", 
> Status));
>   if (!EFI_ERROR (Status)) {
>-for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof 
>(mReadOnlyVariables[0]); Index++) {
>+for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
>   Status = VariableLock->RequestToLock (VariableLock, 
> mReadOnlyVariables[Index], );
>   ASSERT_EFI_ERROR (Status);
> }
>--
>2.9.2
>

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


Re: [edk2] [PATCH 28/47] MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 28/47] MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
>b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>index c86cd7a576ad..aacc4a64794d 100644
>--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>@@ -654,7 +654,7 @@ BdsEntry (
>   Status = gBS->LocateProtocol (, NULL, (VOID 
> **) );
>   DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", 
> Status));
>   if (!EFI_ERROR (Status)) {
>-for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof 
>(mReadOnlyVariables[0]); Index++) {
>+for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
>   Status = VariableLock->RequestToLock (VariableLock, 
> mReadOnlyVariables[Index], );
>   ASSERT_EFI_ERROR (Status);
> }
>--
>2.9.2
>

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


Re: [edk2] [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c  | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c  | 4 ++--
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>index f086764f24da..050647d8f186 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>@@ -632,7 +632,7 @@ BmGetBootDescription (
>   // Firstly get the default boot description
>   //
>   DefaultDescription = NULL;
>-  for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof 
>(mBmBootDescriptionHandlers[0]); Index++) {
>+  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
> DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
> if (DefaultDescription != NULL) {
>   //
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>index a13917bd0844..43895e10f85b 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>@@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable (
>   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
>   EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;
>
>-  if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) {
>+  if (ConsoleType >= ARRAY_SIZE (mConVarName)) {
> return EFI_INVALID_PARAMETER;
>   }
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>index 55df7e9a5f31..35131a94f61d 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>@@ -680,7 +680,7 @@ BmProcessKeyOption (
>
>   KeyShiftStateCount = 0;
>   BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, 
> KeyShiftStates, );
>-  ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof 
>(KeyShiftStates[0]));
>+  ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates));
>
>   EfiAcquireLock ();
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>index 9af98de0afaf..e638e5fc67e6 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>@@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
> return FALSE;
>   }
>
>-  for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof 
>(mBmLoadOptionName[0]); Index++) {
>+  for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) {
> if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) &&
> (StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 
> 4) == 0)
> ) {
>@@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
> }
>   }
>
>-  if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) {
>+  if (Index == ARRAY_SIZE (mBmLoadOptionName)) {
> return FALSE;
>   }
>
>--
>2.9.2
>

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


Re: [edk2] [PATCH 19/47] MdeModulePkg/PciHostBridgeDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 19/47] MdeModulePkg/PciHostBridgeDxe: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
>b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
>index c866e8801607..9005deeac225 100644
>--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
>+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c
>@@ -415,7 +415,7 @@ InitializePciHostBridge (
> MemApertures[2] = [Index].PMem;
> MemApertures[3] = [Index].PMemAbove4G;
>
>-for (MemApertureIndex = 0; MemApertureIndex < sizeof (MemApertures) / 
>sizeof (MemApertures[0]);
>MemApertureIndex++) {
>+for (MemApertureIndex = 0; MemApertureIndex < ARRAY_SIZE (MemApertures); 
>MemApertureIndex++) {
>   if (MemApertures[MemApertureIndex]->Base <= 
> MemApertures[MemApertureIndex]->Limit) {
> Status = AddMemoryMappedIoSpace (
>MemApertures[MemApertureIndex]->Base,
>--
>2.9.2
>

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


Re: [edk2] [PATCH 35/47] Nt32Pkg/WinNtSerialIoDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Ni, Ruiyu 
>Subject: [PATCH 35/47] Nt32Pkg/WinNtSerialIoDxe: rebase to ARRAY_SIZE()
>
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c 
>b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
>index 0dc031393e71..23d3329d9db1 100644
>--- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
>+++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
>@@ -984,7 +984,7 @@ Returns:
>   //The lower baud rate supported by the serial device will be selected 
> without exceeding the unsupported BaudRate
>parameter
>   //
>
>-  for (Index = 1; Index < (sizeof (mBaudRateCurrentSupport) / sizeof 
>(mBaudRateCurrentSupport[0])); Index++) {
>+  for (Index = 1; Index < (ARRAY_SIZE (mBaudRateCurrentSupport)); Index++) {
> if (BaudRate < mBaudRateCurrentSupport[Index]) {
>   BaudRate = mBaudRateCurrentSupport[Index-1];
>   break;
>--
>2.9.2
>

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


Re: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add capsule/recovery handling.

2016-10-26 Thread Yao, Jiewen
Yes, Mike. You are right.

We do have plan to make it generic. As we discussed before, we will enhance the 
tool to detect such info and set a PCD at build time. Then we can include that 
in the UiApp driver to report such error directly.

The tool is not ready yet. So current platform solution is just a temporary 
solution.

We do have plan to migrate to the new solution after the tool is ready. Then we 
can clean up the platform BDS code.

Thank you
Yao Jiewen


From: Kinney, Michael D
Sent: Thursday, October 27, 2016 7:36 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B 
Subject: RE: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add 
capsule/recovery handling.

Jiewen,

Can the code that checks for the use of a test key be moved into a common BDS 
lib or module?
Maybe in MdeModulePkg\Universal\BdsDxe\BdsEntry.c right before the call to
PlatformBootManagerAfterConsole()?  The logic in BdsEntry.c can do the check 
and set the
PcdTestKeyUsed PCD and can go a DEBUG() message for the use of a test key.

With the current design, you depend on a platform specific BDS library to 
include the test
key check, and we want to make sure the check for the use of a test key is 
always performed.

Also, the test key check against PcdRsa2048Sha256PublicKeyBuffer is incomplete. 
The DEC file
description of this PCD is as follows:

  ## Provides one or more SHA 256 Hashes of the RSA 2048 public keys used to 
verify Recovery and Capsule Update images
  #  WARNING: The default value is treated as test key. Please do not use 
default value in the production.
  # @Prompt One or more SHA 256 Hashes of RSA 2048 bit public keys used to 
verify Recovery and Capsule Update images
  #
  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0x91, 0x29, 
0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 
0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 
0xa2, 0xd4, 0xa6, 0x4d}|VOID*|0x00010013

Since this PCD provides one or more SHA 256 Hashes, the check for the use of a 
test key needs to get the
Size, determine how many hashes are in this PCD, and compare the test key value 
against each entry in
this array.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >
> Subject: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add
> capsule/recovery handling.
>
> 1) Add capsule and recovery boot path handling in platform BDS.
> 2) Add check if the platform is using default test key for recovery or update.
> Produce PcdTestKeyUsed to indicate if there is any
> test key used in current BIOS, such as recovery key,
> or capsule update key.
> Then the generic UI may consume this PCD to show warning information.
>
> Cc: Michael D Kinney 
> >
> Cc: Kelly Steele >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> ---
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c  | 
> 131
> +++-
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.h  | 
>   9 +-
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 
>  16 ++-
>  3 files changed, 151 insertions(+), 5 deletions(-)
>
> diff --git 
> a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> index 19ff3d0..f327c89 100644
> --- a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> +++ b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> @@ -2,7 +2,7 @@
>  This file include all platform action which can be customized
>  by IBV/OEM.
>
> -Copyright (c) 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
>  This program 

Re: [edk2] [PATCH 42/47] ShellPkg/UefiShellLevel2CommandsLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 
>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Carsey, Jaben ; Ni, Ruiyu 
>Subject: [PATCH 42/47] ShellPkg/UefiShellLevel2CommandsLib: rebase to 
>ARRAY_SIZE()
>
>Cc: Jaben Carsey 
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
>b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
>index 3ebc72a0afa8..5383cffe879c 100644
>--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
>+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
>@@ -942,7 +942,7 @@ ShellCommandRunTimeZone (
> //
> if (ShellCommandLineGetFlag (Package, L"-f")) {
>   for ( LoopVar = 0
>-  ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0])
>+  ; LoopVar < ARRAY_SIZE (TimeZoneList)
>   ; LoopVar++
>  ){
> if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
>--
>2.9.2
>

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


Re: [edk2] [PATCH 36/47] OptionRomPkg/AtapiPassThruDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 
>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Ni, Ruiyu 
>Subject: [PATCH 36/47] OptionRomPkg/AtapiPassThruDxe: rebase to ARRAY_SIZE()
>
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c 
>b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
>index 3578a1e4459c..e2654e5c2566 100644
>--- a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
>+++ b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
>@@ -1752,7 +1752,7 @@ Returns:
>   UINT8 ArrayLen;
>
>   OpCode = (UINT8 *) (Packet->Cdb);
>-  ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof 
>(gSupportedATAPICommands[0]));
>+  ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands));
>
>   for (Index = 0; (Index < ArrayLen) && (CompareMem 
> ([Index], , sizeof
>(SCSI_COMMAND_SET)) != 0); Index++) {
>
>@@ -1995,7 +1995,7 @@ Returns:
>   UINT8 ArrayLen;
>
>   OpCode = (UINT8 *) (Packet->Cdb);
>-  ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof 
>(gSupportedATAPICommands[0]));
>+  ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands));
>
>   for (Index = 0; (Index < ArrayLen) && (CompareMem 
> ([Index], , sizeof
>(SCSI_COMMAND_SET)) != 0); Index++) {
>
>--
>2.9.2
>

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


Re: [edk2] [PATCH 41/47] ShellPkg/UefiDpLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 
>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Carsey, Jaben ; Ni, Ruiyu 
>Subject: [PATCH 41/47] ShellPkg/UefiDpLib: rebase to ARRAY_SIZE()
>
>Cc: Jaben Carsey 
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> ShellPkg/Library/UefiDpLib/DpTrace.c | 10 +-
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c 
>b/ShellPkg/Library/UefiDpLib/DpTrace.c
>index f3f781fdb989..eca2ef309bbc 100644
>--- a/ShellPkg/Library/UefiDpLib/DpTrace.c
>+++ b/ShellPkg/Library/UefiDpLib/DpTrace.c
>@@ -220,8 +220,8 @@ DumpAllTrace(
>   ++Count;// Count the number of records printed
>
>   // If Handle is non-zero, see if we can determine a name for the driver
>-  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
>(mGaugeString) / sizeof (mGaugeString[0])); //
>Use Module by default
>-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
>(mUnicodeToken) / sizeof (mUnicodeToken[0]));
>+  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
>(mGaugeString)); // Use Module by
>default
>+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
>(mUnicodeToken));
>   if (Measurement.Handle != NULL) {
> // See if the Handle is in the HandleBuffer
> for (TIndex = 0; TIndex < HandleCount; TIndex++) {
>@@ -595,7 +595,7 @@ ProcessHandles(
> continue;
>   }
>   mGaugeString[0] = 0;// Empty driver name by default
>-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
>(mUnicodeToken) / sizeof (mUnicodeToken[0]));
>+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
>(mUnicodeToken));
>   // See if the Handle is in the HandleBuffer
>   for (Index = 0; Index < HandleCount; Index++) {
> if (Measurement.Handle == HandleBuffer[Index]) {
>@@ -776,8 +776,8 @@ ProcessGlobal(
>   ,
>   )) != 0)
>   {
>-AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
>(mGaugeString) / sizeof (mGaugeString[0]));
>-AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
>(mUnicodeToken) / sizeof (mUnicodeToken[0]));
>+AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
>(mGaugeString));
>+AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
>(mUnicodeToken));
> mGaugeString[25] = 0;
> mUnicodeToken[31] = 0;
> if ( ! ( IsPhase( )  ||
>--
>2.9.2
>

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


Re: [edk2] [Patch] PcAtChipsetPkg/HpetTimerDxe: Fix race condition in SetTimerPeriod()

2016-10-26 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni 
>-Original Message-
>From: Kinney, Michael D
>Sent: Thursday, October 27, 2016 6:31 AM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu 
>Subject: [Patch] PcAtChipsetPkg/HpetTimerDxe: Fix race condition in 
>SetTimerPeriod()
>
>https://bugzilla.tianocore.org/show_bug.cgi?id=182
>
>The function TimerDriverSetTimerPeriod() disables the HPET timer
>while the HPET timer HW is reprogrammed with a new timer period.
>However, the MMIO write to disable the HPET timer HW can be
>delayed and an HPET timer interrupt may be processed in the middle
>of reprogramming the HPET timer HW and this may produced unexpected
>results.
>
>The fix is to raise TPL to TPL_HIGH_LEVEL in
>TimerDriverSetTimerPeriod() during the time the HPET timer HW is
>reprogrammed.  This guarantees that no timer interrupts are
>processed during reprogramming.
>
>The TimerDriverGenerateSoftInterrupt() function in this same
>driver also raises TPL to TPL_HIGH_LEVEL, so this fix matches
>the logic that is already used in another function for the same
>reason.
>
>Cc: Ruiyu Ni 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Michael Kinney 
>---
> PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c | 15 +--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
>diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c 
>b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
>index 0ed8743..c62c3a9 100644
>--- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
>+++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
>@@ -492,11 +492,17 @@ TimerDriverSetTimerPeriod (
>   IN UINT64   TimerPeriod
>   )
> {
>+  EFI_TPLTpl;
>   UINT64 MainCounter;
>   UINT64 Delta;
>   UINT64 CurrentComparator;
>   HPET_TIMER_MSI_ROUTE_REGISTER  HpetTimerMsiRoute;
>-
>+
>+  //
>+  // Disable interrupts
>+  //
>+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
>+
>   //
>   // Disable HPET timer when adjusting the timer period
>   //
>@@ -616,7 +622,12 @@ TimerDriverSetTimerPeriod (
>   // is disabled.
>   //
>   HpetEnable (TRUE);
>-
>+
>+  //
>+  // Restore interrupts
>+  //
>+  gBS->RestoreTPL (Tpl);
>+
>   return EFI_SUCCESS;
> }
>
>--
>2.6.3.windows.1

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


Re: [edk2] [PATCH V4 06/15] MdeModulePkg/DxeCapsuleLibFmp: Add DxeCapsuleLibFmp instance.

2016-10-26 Thread Yao, Jiewen
Hi Mike
I think that is misunderstanding.

Chao did test before and the UX capsule from Windows does contain a BMP file. 
He told me that I should use BMP file.
I will let Chao to clarify more.

I also include Sean Brogan to double check the Windows side.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 8:10 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Zeng, Star ; Gao, 
Liming ; Zhang, Chao B 
Subject: RE: [PATCH V4 06/15] MdeModulePkg/DxeCapsuleLibFmp: Add 
DxeCapsuleLibFmp instance.

Jiewen,

I have looked Microsoft UX capsule in the Microsoft
Windows UEFI Firmware Update Platform Specification, and
that specification only define support for an ImageType value
of 0, which is bitmap format based on ACPI 5.0 BGRT.  There
are no defined ImageType values for BMP. We need to remove
BMP graphics file format decoding from all capsule processing.
If a Microsoft UX capsule is present, it is already a raw
bitmap that can be passed to GOP.

Best regards,

Mike


> -Original Message-
> From: Yao, Jiewen
> Sent: Saturday, October 22, 2016 7:21 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Zeng, Star 
> >; Kinney, Michael
> D >; Gao, 
> Liming >; Zhang, Chao B
> >
> Subject: [PATCH V4 06/15] MdeModulePkg/DxeCapsuleLibFmp: Add DxeCapsuleLibFmp 
> instance.
>
> This instance handles Microsoft UX capsule, UEFI defined FMP capsule.
> This instance should not assume any capsule image format.
>
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Michael D Kinney 
> >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> Reviewed-by: Liming Gao >
> ---
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c  | 1363
> 
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf|   80 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.uni|   22 +
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c   |  486 +++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c|  489 +++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c  |  112 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf |   83 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.uni |   22 +
>  8 files changed, 2657 insertions(+)
>
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> new file mode 100644
> index 000..20ef762
> --- /dev/null
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -0,0 +1,1363 @@
> +/** @file
> +  DXE capsule library.
> +
> +  Caution: This module requires additional review when modified.
> +  This module will have external input - capsule image.
> +  This external input must be validated carefully to avoid security issue 
> like
> +  buffer overflow, integer overflow.
> +
> +  SupportCapsuleImage(), ProcessCapsuleImage(), IsValidCapsuleHeader(),
> +  ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
> +  receive untrusted input and do basic validation.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +extern BOOLEANmAreAllImagesProcessed;
> +
> +EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable  = NULL;
> +BOOLEAN   mIsVirtualAddrConverted  = FALSE;
> +BOOLEAN   

Re: [edk2] [PATCH V4 1/8] QuarkPlatformPkg/dec: Add test key file guid.

2016-10-26 Thread Yao, Jiewen
Agree. I will move the 2 PCD to SignedCapsulePkg.

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 9:28 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B 
Subject: RE: [edk2] [PATCH V4 1/8] QuarkPlatformPkg/dec: Add test key file guid.

Jiewen,

Why are these 2 PCDs added to a platform specific DEC file?

The same feedback applies to the Vlv2 platform.

Since we want platform agnostic detection for the use of
test keys, these PCDs should be added to SignedCapsulePkg.

I think the best place to do the check for use of test keys
and set the gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed PCD
is in a module in SignedCapsulePkg that is required to be present
and run every boot before BDS runs when recovery or capsule
support is enabled.

In a previous feedback email I suggested that this test key
check be moved to BdsEntry.c, but that will not work because that
module does not have access to PCDs defined in SignedCapsulePkg.

Best regards,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >
> Subject: [edk2] [PATCH V4 1/8] QuarkPlatformPkg/dec: Add test key file guid.
>
> We will add PKCS7 and RSA2048SHA256 test key file to FDF,
> to check if the platform is using default test key,
> or different production key.
>
> Cc: Michael D Kinney 
> >
> Cc: Kelly Steele >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> ---
>  QuarkPlatformPkg/QuarkPlatformPkg.dec | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/QuarkPlatformPkg/QuarkPlatformPkg.dec
> b/QuarkPlatformPkg/QuarkPlatformPkg.dec
> index f4ab18c..fbd7987 100644
> --- a/QuarkPlatformPkg/QuarkPlatformPkg.dec
> +++ b/QuarkPlatformPkg/QuarkPlatformPkg.dec
> @@ -895,6 +895,9 @@
>
> gQuarkPlatformTokenSpaceGuid.PcdFlashFvRecoveryBase|0xFFEC0400|UINT32|0xA2AB
>
> gQuarkPlatformTokenSpaceGuid.PcdFlashFvRecoverySize|0x0003F000|UINT32|0xA2AC
>
> +  
> gQuarkPlatformTokenSpaceGuid.PcdEdkiiRsa2048Sha256TestPublicKeyFileGuid|{0x04,
>  0xe1,
> 0xfe, 0xc4, 0x57, 0x66, 0x36, 0x49, 0xa6, 0x11, 0x13, 0x8d, 0xbc, 0x2a, 0x76,
> 0xad}|VOID*|0xA0010001
> +  gQuarkPlatformTokenSpaceGuid.PcdEdkiiPkcs7TestPublicKeyFileGuid|{0xba, 
> 0xf5, 0x93,
> 0xf0, 0x37, 0x6f, 0x16, 0x48, 0x9e, 0x52, 0x91, 0xbe, 0xa0, 0xf7, 0xe0,
> 0xb8}|VOID*|0xA0010002
> +
>  [PcdsDynamic, PcdsDynamicEx]
>## Provides the ability to enable the Fast Boot feature of the BIOS.  This
>#  enables the system to boot faster but may only enumerate the hardware
> --
> 2.7.4.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 29/33] SecurityPkg: Fix typos in comments

2016-10-26 Thread Zhang, Chao B
Reviewed-by: Chao Zhang 





Thanks & Best regards
Chao Zhang

-Original Message-
From: Gary Lin [mailto:g...@suse.com] 
Sent: Wednesday, October 19, 2016 3:02 PM
To: edk2-devel@lists.01.org
Cc: Zhang, Chao B
Subject: [PATCH 29/33] SecurityPkg: Fix typos in comments

- intialized -> initialized
- TURE -> TRUE
- successull -> successfully
- hanlder -> handler
- funciton -> function
- Seperator -> Separator
- Sumbit -> Submit

Cc: Chao Zhang 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin 
---
 SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
   | 2 +-
 SecurityPkg/Include/Library/TcgPpVendorLib.h   
   | 4 ++--
 SecurityPkg/Include/Library/TcgStorageOpalLib.h
   | 2 +-
 SecurityPkg/Include/Library/TrEEPpVendorLib.h  
   | 4 ++--
 SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c
   | 6 +++---
 
SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
 | 2 +-
 
SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
 | 2 +-
 SecurityPkg/Library/TcgStorageCoreLib/TcgStorageUtil.c 
   | 2 +-
 SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c 
   | 2 +-
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c  
   | 2 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c  
   | 2 +-
 SecurityPkg/Tcg/TcgDxe/TcgDxe.c
   | 2 +-
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c  
   | 2 +-
 SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c
   | 2 +-
 SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h  
   | 2 +-
 15 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 
b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
index ab34de7..93e3273 100644
--- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
+++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
@@ -64,7 +64,7 @@ BOOLEAN
 
   This function performs Hash digest on a data buffer of the specified size.
   It can be called multiple times to compute the digest of long or 
discontinuous data streams.
-  Hash context should be already correctly intialized by HashInit(), and 
should not be finalized
+  Hash context should be already correctly initialized by HashInit(), and 
should not be finalized
   by HashFinal(). Behavior with invalid context is undefined.
 
   If HashContext is NULL, then return FALSE.
diff --git a/SecurityPkg/Include/Library/TcgPpVendorLib.h 
b/SecurityPkg/Include/Library/TcgPpVendorLib.h
index 08b3690..284aa9e 100644
--- a/SecurityPkg/Include/Library/TcgPpVendorLib.h
+++ b/SecurityPkg/Include/Library/TcgPpVendorLib.h
@@ -42,8 +42,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE 0xFFF1
 
 //
-// The return code for Sumbit TPM Request to Pre-OS Environment
-// and Sumbit TPM Request to Pre-OS Environment 2
+// The return code for Submit TPM Request to Pre-OS Environment
+// and Submit TPM Request to Pre-OS Environment 2
 //
 #define TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS 
 0
 #define TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED 
 1
diff --git a/SecurityPkg/Include/Library/TcgStorageOpalLib.h 
b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
index 108affc..9b64a8e 100644
--- a/SecurityPkg/Include/Library/TcgStorageOpalLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
@@ -290,7 +290,7 @@ OpalGlobalLockingRangeGenKey(
 /**
 
   The function updates the ReadLocked and WriteLocked columns of the Global 
Locking Range.
-  This funciton is required for a user1 authority, since a user1 authority 
shall only have access to ReadLocked and WriteLocked columns
+  This function is required for a user1 authority, since a user1 authority 
shall only have access to ReadLocked and WriteLocked columns
   (not ReadLockEnabled and WriteLockEnabled columns).
 
   @param[in]  LockingSpSessionOPAL_SESSION with OPAL_UID_LOCKING_SP to 
generate key
diff --git a/SecurityPkg/Include/Library/TrEEPpVendorLib.h 
b/SecurityPkg/Include/Library/TrEEPpVendorLib.h
index d3a0767..f0dcfd9 100644
--- a/SecurityPkg/Include/Library/TrEEPpVendorLib.h
+++ b/SecurityPkg/Include/Library/TrEEPpVendorLib.h
@@ -45,8 +45,8 @@ WITHOUT WARRANTIES OR 

[edk2] [Patch 1/3] MdeModulePkg: Update NetLib interface to support classless addressing.

2016-10-26 Thread Fu Siyuan
The classful addressing (IP class A/B/C) has been deprecated according to
RFC4632. This patch updates the NetLib NetGetIpClass() and NetIp4IsUnicast()
accordingly.

NetGetIpClass()
The function is kept for compatibility, while the caller of this function
could only check the returned value against with IP4_ADDR_CLASSD (multicast)
or IP4_ADDR_CLASSE (reserved) now. The function has been updated to note this.

NetIp4IsUnicast()
The NetMask becomes a required parameter to check the unicast address.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan 
Cc: Ye Ting 
Cc: Zhang Lubo 
Cc: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/NetLib.h  | 22 +-
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 26 --
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index 87f393e..4c4f0bf 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -43,9 +43,9 @@ typedef UINT16  TCP_PORTNO;
 //
 // The address classification
 //
-#define  IP4_ADDR_CLASSA   1
-#define  IP4_ADDR_CLASSB   2
-#define  IP4_ADDR_CLASSC   3
+#define  IP4_ADDR_CLASSA   1 // Deprecated
+#define  IP4_ADDR_CLASSB   2 // Deprecated
+#define  IP4_ADDR_CLASSC   3 // Deprecated
 #define  IP4_ADDR_CLASSD   4
 #define  IP4_ADDR_CLASSE   5
 
@@ -379,6 +379,11 @@ NetGetMaskLength (
   Return the class of the IP address, such as class A, B, C.
   Addr is in host byte order.
 
+  [ATTENTION]
+  Classful addressing (IP class A/B/C) has been deprecated according to 
RFC4632.
+  Caller of this function could only check the returned value against
+  IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now.
+
   The address of class A  starts with 0.
   If the address belong to class A, return IP4_ADDR_CLASSA.
   The address of class B  starts with 10.
@@ -404,17 +409,16 @@ NetGetIpClass (
 
 /**
   Check whether the IP is a valid unicast address according to
-  the netmask. If NetMask is zero, use the IP address's class to get the 
default mask.
+  the netmask. 
 
-  If Ip is 0, IP is not a valid unicast address.
-  Class D address is used for multicasting and class E address is reserved for 
future. If Ip
-  belongs to class D or class E, Ip is not a valid unicast address.
-  If all bits of the host address of Ip are 0 or 1, Ip is not a valid unicast 
address.
+  ASSERT if NetMask is zero.
+  
+  If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address.
 
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
-  @return TRUE if Ip is a valid unicast address on the network, otherwise 
FALSE.
+  @return TRUE if IP is a valid unicast address on the network, otherwise 
FALSE.
 
 **/
 BOOLEAN
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 7700f0ff..83a99e5 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -580,6 +580,11 @@ NetGetMaskLength (
   Return the class of the IP address, such as class A, B, C.
   Addr is in host byte order.
 
+  [ATTENTION]
+  Classful addressing (IP class A/B/C) has been deprecated according to 
RFC4632.
+  Caller of this function could only check the returned value against
+  IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now.
+
   The address of class A  starts with 0.
   If the address belong to class A, return IP4_ADDR_CLASSA.
   The address of class B  starts with 10.
@@ -628,11 +633,10 @@ NetGetIpClass (
 
 /**
   Check whether the IP is a valid unicast address according to
-  the netmask. If NetMask is zero, use the IP address's class to get the 
default mask.
+  the netmask. 
 
-  If Ip is 0, IP is not a valid unicast address.
-  Class D address is used for multicasting and class E address is reserved for 
future. If Ip
-  belongs to class D or class E, IP is not a valid unicast address.
+  ASSERT if NetMask is zero.
+  
   If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address.
 
   @param[in]  IpThe IP to check against.
@@ -648,18 +652,12 @@ NetIp4IsUnicast (
   IN IP4_ADDR   NetMask
   )
 {
-  INTN  Class;
-
-  Class = NetGetIpClass (Ip);
-
-  if ((Ip == 0) || (Class >= IP4_ADDR_CLASSD)) {
+  ASSERT (NetMask != 0);
+  
+  if (Ip == 0) {
 return FALSE;
   }
-
-  if (NetMask == 0) {
-NetMask = gIp4AllMasks[Class << 3];
-  }
-
+  
   if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {
 return FALSE;
   }
-- 
2.7.4.windows.1

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

[edk2] [Patch 2/3] MdeModulePkg: Update IP4 stack drivers for classless address unicast check.

2016-10-26 Thread Fu Siyuan
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan 
Cc: Ye Ting 
Cc: Zhang Lubo 
Cc: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/IpIoLib.h |  4 ++-
 MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c   |  9 ++-
 MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c|  7 -
 .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 29 ++---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c  |  6 +
 .../Universal/Network/IScsiDxe/IScsiConfig.c   | 18 ++---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c  | 15 +++
 .../Universal/Network/Ip4Dxe/Ip4Config2Nv.c| 30 --
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  |  7 +
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c   |  9 +--
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c  |  7 ++---
 MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c  |  9 +--
 MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c  |  5 ++--
 .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 27 +--
 14 files changed, 61 insertions(+), 121 deletions(-)

diff --git a/MdeModulePkg/Include/Library/IpIoLib.h 
b/MdeModulePkg/Include/Library/IpIoLib.h
index 37cba07..aab0c68 100644
--- a/MdeModulePkg/Include/Library/IpIoLib.h
+++ b/MdeModulePkg/Include/Library/IpIoLib.h
@@ -2,7 +2,7 @@
   This library is only intended to be used by UEFI network stack modules.
   It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 
protocol.
 
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -261,6 +261,8 @@ typedef struct _IP_IO {
   PKT_RCVD_NOTIFY   PktRcvdNotify;   ///< See 
IP_IO_OPEN_DATA::PktRcvdNotify.
   PKT_SENT_NOTIFY   PktSentNotify;   ///< See 
IP_IO_OPEN_DATA::PktSentNotify.
   UINT8 IpVersion;
+  IP4_ADDR  StationIp;
+  IP4_ADDR  SubnetMask;
 } IP_IO;
 
 ///
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c 
b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index ab4df80..d4e9dc1 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -1029,7 +1029,9 @@ IpIoListenHandlerDpc (
 
   if (IpIo->IpVersion == IP_VERSION_4) {
 if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) &&
-!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) 
RxData)->Header->SourceAddress), 0)) {
+(IpIo->SubnetMask != 0) &&
+IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) 
RxData)->Header->SourceAddress), IpIo->SubnetMask) &&
+!NetIp4IsUnicast (EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) 
RxData)->Header->SourceAddress), IpIo->SubnetMask)) {
   //
   // The source address is not zero and it's not a unicast IP address, 
discard it.
   //
@@ -1300,6 +1302,11 @@ IpIoOpen (
 if (OpenData->IpConfigData.Ip4CfgData.RawData) {
   return EFI_UNSUPPORTED;
 }
+
+if (!OpenData->IpConfigData.Ip4CfgData.UseDefaultAddress) {
+  IpIo->StationIp = EFI_NTOHL 
(OpenData->IpConfigData.Ip4CfgData.StationAddress);
+  IpIo->SubnetMask = EFI_NTOHL 
(OpenData->IpConfigData.Ip4CfgData.SubnetMask);
+}
 
 Status = IpIo->Ip.Ip4->Configure (
  IpIo->Ip.Ip4,
diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c 
b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
index afe4929..d1cebbb 100644
--- a/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
+++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
@@ -942,13 +942,6 @@ ArpConfigureInstance (
 
   if (ConfigData->SwAddressType == IPV4_ETHER_PROTO_TYPE) {
 CopyMem (, ConfigData->StationAddress, sizeof (IP4_ADDR));
-
-if (!NetIp4IsUnicast (NTOHL (Ip), 0)) {
-  //
-  // The station address is not a valid IPv4 unicast address.
-  //
-  return EFI_INVALID_PARAMETER;
-}
   }
 
   //
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 79f7cde..51cb4fd 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -660,11 +660,6 @@ EfiDhcp4Configure (
 }
 
 CopyMem (, >ClientAddress, sizeof (IP4_ADDR));
-
-if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) {
-
-  return EFI_INVALID_PARAMETER;
-}
   }
 
   Instance = DHCP_INSTANCE_FROM_THIS (This);
@@ -1193,8 +1188,6 @@ Dhcp4InstanceConfigUdpIo (
   EFI_UDP4_CONFIG_DATA  UdpConfigData;
   IP4_ADDR

Re: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

2016-10-26 Thread Yao, Jiewen
Good question again.

That is because the platform PEI phase does not report all FV information to 
DXE.

I did use this way in my early version. I give up later, because I realize if 
so we need update all platforms to let it report all FV information. It is a 
burden.
Using PCD is a standalone solution and much simpler. Also, if there is some 
other components need to know the information, they can just use PCD, instead 
of scanning FV/FD.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 9:23 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B ; Wei, David 

Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.


Jiewen,

They why do we need the PCD?

We should be able to find this section in current FLASH image and in new FLASH 
image.  Right?

Mike

From: Yao, Jiewen
Sent: Wednesday, October 26, 2016 6:15 PM
To: Kinney, Michael D 
>; 
edk2-devel@lists.01.org
Cc: Tian, Feng >; Gao, Liming 
>; Zeng, Star 
>; Zhang, Chao B 
>; Wei, David 
>
Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

Mike
That is a good question.

We create a standalone FFS SECTION to hold the descriptor purposely.

The reason is that: the SystemFirmwareUpdate need to know the version of the 
*new image*.

SystemFirmwareUpdate can know the version and lowest supported version of the 
current image by using PCD.
SystemFirmwareUpdate also need to know the version of the new image, so that it 
can compare them. There is not any inform on the new image, because no code 
runs for the new image. The only way is to parse the image binary. The 
SystemFirmwareUpdate will parse the FV and find the FFS Section to get the 
image descriptor. That is why we put a standalone FFS SECTION there.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 8:31 AM
To: Yao, Jiewen >; 
edk2-devel@lists.01.org; Kinney, Michael D 
>
Cc: Tian, Feng >; Gao, Liming 
>; Zeng, Star 
>; Zhang, Chao B 
>; Wei, David 
>
Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

Jiewen,

Why is .aslc file used in this PEIM.  It is not an ACPI table.

You are generating a C structure that is used to set the value of
a PCD.  The C structure could be a global variable in the PEIM
that is initialized the same way the .aslc file does or you
could initialize the fields in the PEIM entry point.  Or some
combination of the two.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:33 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >; Wei, David 
> >
> Subject: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: 
> Add
> Descriptor for capsule update.
>
> Add SystemFirmwareDescriptor for capsule update.
> The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it via 
> PCD.
>
> Cc: David Wei >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Michael D Kinney 
> >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >

Re: [edk2] [PATCH V4 1/8] QuarkPlatformPkg/dec: Add test key file guid.

2016-10-26 Thread Kinney, Michael D
Jiewen,

Why are these 2 PCDs added to a platform specific DEC file?

The same feedback applies to the Vlv2 platform.

Since we want platform agnostic detection for the use of 
test keys, these PCDs should be added to SignedCapsulePkg.

I think the best place to do the check for use of test keys
and set the gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed PCD 
is in a module in SignedCapsulePkg that is required to be present
and run every boot before BDS runs when recovery or capsule 
support is enabled.

In a previous feedback email I suggested that this test key 
check be moved to BdsEntry.c, but that will not work because that
module does not have access to PCDs defined in SignedCapsulePkg.

Best regards,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> 
> Subject: [edk2] [PATCH V4 1/8] QuarkPlatformPkg/dec: Add test key file guid.
> 
> We will add PKCS7 and RSA2048SHA256 test key file to FDF,
> to check if the platform is using default test key,
> or different production key.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> ---
>  QuarkPlatformPkg/QuarkPlatformPkg.dec | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/QuarkPlatformPkg/QuarkPlatformPkg.dec
> b/QuarkPlatformPkg/QuarkPlatformPkg.dec
> index f4ab18c..fbd7987 100644
> --- a/QuarkPlatformPkg/QuarkPlatformPkg.dec
> +++ b/QuarkPlatformPkg/QuarkPlatformPkg.dec
> @@ -895,6 +895,9 @@
>
> gQuarkPlatformTokenSpaceGuid.PcdFlashFvRecoveryBase|0xFFEC0400|UINT32|0xA2AB
>
> gQuarkPlatformTokenSpaceGuid.PcdFlashFvRecoverySize|0x0003F000|UINT32|0xA2AC
> 
> +  
> gQuarkPlatformTokenSpaceGuid.PcdEdkiiRsa2048Sha256TestPublicKeyFileGuid|{0x04,
>  0xe1,
> 0xfe, 0xc4, 0x57, 0x66, 0x36, 0x49, 0xa6, 0x11, 0x13, 0x8d, 0xbc, 0x2a, 0x76,
> 0xad}|VOID*|0xA0010001
> +  gQuarkPlatformTokenSpaceGuid.PcdEdkiiPkcs7TestPublicKeyFileGuid|{0xba, 
> 0xf5, 0x93,
> 0xf0, 0x37, 0x6f, 0x16, 0x48, 0x9e, 0x52, 0x91, 0xbe, 0xa0, 0xf7, 0xe0,
> 0xb8}|VOID*|0xA0010002
> +
>  [PcdsDynamic, PcdsDynamicEx]
>## Provides the ability to enable the Fast Boot feature of the BIOS.  This
>#  enables the system to boot faster but may only enumerate the hardware
> --
> 2.7.4.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 V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

2016-10-26 Thread Kinney, Michael D

Jiewen,

They why do we need the PCD?

We should be able to find this section in current FLASH image and in new FLASH 
image.  Right?

Mike

From: Yao, Jiewen
Sent: Wednesday, October 26, 2016 6:15 PM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B ; Wei, David 

Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

Mike
That is a good question.

We create a standalone FFS SECTION to hold the descriptor purposely.

The reason is that: the SystemFirmwareUpdate need to know the version of the 
*new image*.

SystemFirmwareUpdate can know the version and lowest supported version of the 
current image by using PCD.
SystemFirmwareUpdate also need to know the version of the new image, so that it 
can compare them. There is not any inform on the new image, because no code 
runs for the new image. The only way is to parse the image binary. The 
SystemFirmwareUpdate will parse the FV and find the FFS Section to get the 
image descriptor. That is why we put a standalone FFS SECTION there.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 8:31 AM
To: Yao, Jiewen >; 
edk2-devel@lists.01.org; Kinney, Michael D 
>
Cc: Tian, Feng >; Gao, Liming 
>; Zeng, Star 
>; Zhang, Chao B 
>; Wei, David 
>
Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

Jiewen,

Why is .aslc file used in this PEIM.  It is not an ACPI table.

You are generating a C structure that is used to set the value of
a PCD.  The C structure could be a global variable in the PEIM
that is initialized the same way the .aslc file does or you
could initialize the fields in the PEIM entry point.  Or some
combination of the two.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:33 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >; Wei, David 
> >
> Subject: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: 
> Add
> Descriptor for capsule update.
>
> Add SystemFirmwareDescriptor for capsule update.
> The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it via 
> PCD.
>
> Cc: David Wei >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Michael D Kinney 
> >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> Reviewed-by: David Wei >
> ---
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.asl
> c | 89 
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
> | 46 ++
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.
> c | 66 +++
>  3 files changed, 201 insertions(+)
>
> diff --git
> a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> new file mode 100644
> index 000..4c9b63e
> --- /dev/null
> +++
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> @@ -0,0 +1,89 @@
> +/** @file
> +  System Firmware descriptor.
> +
> +  Copyright (c) 2016, 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 

Re: [edk2] [PATCH 12/47] EdkCompatibilityPkg/FrameworkHiiOnUefiHiiThunk: rebase to ARRAY_SIZE()

2016-10-26 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:04 AM
To: edk2-devel-01 
Cc: Gao, Liming 
Subject: [PATCH 12/47] EdkCompatibilityPkg/FrameworkHiiOnUefiHiiThunk: rebase 
to ARRAY_SIZE()

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c 
| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c 
b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c
index dd07dfcf40cf..a3ddce9b44ec 100644
--- 
a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c
+++ 
b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c
@@ -51,7 +51,7 @@ QuestionOpFwToUefi (
 {
   UINTN   Index;
 
-  for (Index = 0; Index < sizeof (QuestionOpcodeMap) / sizeof 
(QuestionOpcodeMap[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (QuestionOpcodeMap); Index++) {
 if (FwOp == QuestionOpcodeMap[Index].FrameworkIfrOp) {
   *UefiOp = QuestionOpcodeMap[Index].UefiIfrOp;
   return EFI_SUCCESS;
-- 
2.9.2


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


Re: [edk2] [PATCH 13/47] EdkCompatibilityPkg/Sample/Tools: rebase to ARRAY_SIZE()

2016-10-26 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:05 AM
To: edk2-devel-01 
Cc: Gao, Liming 
Subject: [PATCH 13/47] EdkCompatibilityPkg/Sample/Tools: rebase to ARRAY_SIZE()

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c| 4 ++--
 EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c 
b/EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c
index cf8efc86e1b4..f787ae81c2b3 100644
--- a/EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c
+++ b/EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c
@@ -397,8 +397,8 @@ GetCodeTypeStr (
   UINT8 CodeType
   )
 {
-  if (CodeType >= sizeof (mCodeTypeStr) / sizeof (*mCodeTypeStr)) {
-CodeType = sizeof (mCodeTypeStr) / sizeof (*mCodeTypeStr) - 1;
+  if (CodeType >= ARRAY_SIZE (mCodeTypeStr)) {
+CodeType = ARRAY_SIZE (mCodeTypeStr) - 1;
   }
   return mCodeTypeStr[CodeType];
 }
diff --git a/EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c 
b/EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c
index e69af5c25932..e60a2d9eeb30 100644
--- a/EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c
+++ b/EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c
@@ -470,7 +470,7 @@ static const IFR_PARSE_TABLE_ENTRY  mIfrParseTable[] = {
 IfrParse2A
   },
 };
-#define PARSE_TABLE_ENTRIES (sizeof (mIfrParseTable) / sizeof 
(mIfrParseTable[0]))
+#define PARSE_TABLE_ENTRIES (ARRAY_SIZE (mIfrParseTable))
 
 static
 STATUS
-- 
2.9.2


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


Re: [edk2] [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()

2016-10-26 Thread Tian, Feng
MdeModulePkg

reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, October 27, 2016 3:04 AM
To: edk2-devel-01 
Cc: Ard Biesheuvel ; Cecil Sheng 
; Zhang, Chao B ; Bi, Dandan 
; Daryl McDaniel ; Wei, David 
; Dong, Eric ; Tian, Feng 
; Gary Lin ; Carsey, Jaben 
; Fan, Jeff ; Wu, Jiaxin 
; Justen, Jordan L ; Gao, 
Liming ; Kinney, Michael D ; 
Ni, Ruiyu ; Fu, Siyuan ; Zeng, Star 
; Tim He 
Subject: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()

I'm sure most of us have wished at some point that ARRAY_SIZE() had existed in 
a central header file, like it does in many other open source projects. This 
series implements that.

Patches 01-04 round up the modules that #define ARRAY_SIZE() just for 
themselves, and wrap their definitions in #ifndef ARRAY_SIZE.

Patch 05 defines ARRAY_SIZE() in "MdePkg/Include/Base.h". This flips the 
previously modified modules to MdePkg's macro definition.

Patches 06-09 modify the same set of modules as patches 01-04 do; this time the 
(now unused) module-local ARRAY_SIZE() macro definitions are eliminated.

The rest of the patches (10-47) migrate the edk2 tree to ARRAY_SIZE(), covering 
the most obvious open-coded ARRAY_SIZE() expressions. These expressions were 
located and converted with the following shell
pipeline:

  git ls-files \
  | xargs --no-run-if-empty -- \
  sed --regexp-extended --in-place \
--expression='s,sizeof \(([a-zA-Z0-9_]+)\) / sizeof 
\((\*\1|\1\[0\])\),ARRAY_SIZE (\1),g' \
--

This pipeline lists all tracked files with "git". The pathnames are then 
composed with "xargs" into maximal length "sed" command lines, and those "sed" 
commands are run.

Here the "sed" stream editor filters and modifies all the listed files in 
place. The extended regular expression replaces the following two
patterns:

  sizeof (ArrayName) / sizeof (*ArrayName)
  sizeof (ArrayName) / sizeof (ArrayName[0])

with

  ARRAY_SIZE (ArrayName)

The regexp uses a backreference in the match, ensuring that the sizeof operator 
in the dividend and the sizeof operator in the divisor both refer to the same 
ArrayName. If there are multiple occurrences on the same line, the sed command 
replaces all of them.

I collected the changes into patches manually, and I reviewed them all.

I test-built all of the modified packages, repeating the command

  build -a X64 -t GCC48 -b DEBUG -p FooPkg/FooPkg.dsc

as many times as necessary. Two packages were impossible to build like
this: Nt32Pkg and Vlv2TbltDevicePkg, so I couldn't build-test them.

I did some light-weight testing with OVMF: boot with Secure Boot enabled, S3 
suspend/resume with and without SMM. I also booted ArmVirtQemu once.

Repository: https://github.com/lersek/edk2.git
Branch: array_size

Cc: Ard Biesheuvel 
Cc: Cecil Sheng 
Cc: Chao Zhang 
Cc: Dandan Bi 
Cc: Daryl McDaniel 
Cc: David Wei 
Cc: Eric Dong 
Cc: Feng Tian 
Cc: Gary Lin 
Cc: Jaben Carsey 
Cc: Jeff Fan 
Cc: Jiaxin Wu 
Cc: Jordan Justen 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Ruiyu Ni 
Cc: Siyuan Fu 
Cc: Star Zeng 
Cc: Tim He 

Thanks
Laszlo

Laszlo Ersek (47):
  MdeModulePkg/RegularExpressionDxe: guard the definition of ARRAY_SIZE
  NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE
  OvmfPkg/PlatformBootManagerLib: guard the definition of ARRAY_SIZE
  OvmfPkg/XenBusDxe: guard the definition of ARRAY_SIZE
  MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro
  MdeModulePkg/RegularExpressionDxe: remove module-local ARRAY_SIZE
macro
  NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro
  OvmfPkg/PlatformBootManagerLib: remove module-local ARRAY_SIZE macro
  OvmfPkg/XenBusDxe: remove module-local ARRAY_SIZE macro
  ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE()
  DuetPkg/DuetBdsLib: rebase to ARRAY_SIZE()
  EdkCompatibilityPkg/FrameworkHiiOnUefiHiiThunk: rebase to ARRAY_SIZE()
  EdkCompatibilityPkg/Sample/Tools: rebase to ARRAY_SIZE()
  FatPkg/EnhancedFatDxe: rebase to ARRAY_SIZE()
  IntelFrameworkModulePkg/LegacyBootManagerLib: rebase to ARRAY_SIZE()
  

Re: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

2016-10-26 Thread Yao, Jiewen
Mike
That is a good question.

We create a standalone FFS SECTION to hold the descriptor purposely.

The reason is that: the SystemFirmwareUpdate need to know the version of the 
*new image*.

SystemFirmwareUpdate can know the version and lowest supported version of the 
current image by using PCD.
SystemFirmwareUpdate also need to know the version of the new image, so that it 
can compare them. There is not any inform on the new image, because no code 
runs for the new image. The only way is to parse the image binary. The 
SystemFirmwareUpdate will parse the FV and find the FFS Section to get the 
image descriptor. That is why we put a standalone FFS SECTION there.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 8:31 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B ; Wei, David 

Subject: RE: [edk2] [PATCH V4 03/10] 
Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

Jiewen,

Why is .aslc file used in this PEIM.  It is not an ACPI table.

You are generating a C structure that is used to set the value of
a PCD.  The C structure could be a global variable in the PEIM
that is initialized the same way the .aslc file does or you
could initialize the fields in the PEIM entry point.  Or some
combination of the two.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:33 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >; Wei, David 
> >
> Subject: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: 
> Add
> Descriptor for capsule update.
>
> Add SystemFirmwareDescriptor for capsule update.
> The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it via 
> PCD.
>
> Cc: David Wei >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Michael D Kinney 
> >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> Reviewed-by: David Wei >
> ---
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.asl
> c | 89 
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
> | 46 ++
>
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.
> c | 66 +++
>  3 files changed, 201 insertions(+)
>
> diff --git
> a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> new file mode 100644
> index 000..4c9b63e
> --- /dev/null
> +++
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> @@ -0,0 +1,89 @@
> +/** @file
> +  System Firmware descriptor.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +#include 
> +#include 
> +
> +#define PACKAGE_VERSION 0x
> +#define PACKAGE_VERSION_STRING  L"Unknown"
> +
> +#define CURRENT_FIRMWARE_VERSION0x0002
> +#define CURRENT_FIRMWARE_VERSION_STRING L"0x0002"
> +#define LOWEST_SUPPORTED_FIRMWARE_VERSION   0x0001
> +
> +#define IMAGE_IDSIGNATURE_64('V', 'L', 'V', '2', 
> '_', '_',
> 'F', 'd')
> +#define IMAGE_ID_STRING L"Vlv2Fd"
> +
> +// 

Re: [edk2] [PATCH V4 7/8] QuarkPlatformPkg/dsc/fdf: Add capsule/recovery support.

2016-10-26 Thread Yao, Jiewen
Agree and updated.

From: Kinney, Michael D
Sent: Thursday, October 27, 2016 8:41 AM
To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, 
Michael D 
Cc: Tian, Feng ; Gao, Liming ; Zeng, 
Star ; Zhang, Chao B 
Subject: RE: [edk2] [PATCH V4 7/8] QuarkPlatformPkg/dsc/fdf: Add 
capsule/recovery support.

Jiewen,

A couple comments inline below.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng >; Gao, Liming 
> >; Zeng, Star
> >; Kinney, Michael D 
> >; Zhang, Chao B
> >
> Subject: [edk2] [PATCH V4 7/8] QuarkPlatformPkg/dsc/fdf: Add capsule/recovery 
> support.
>
> Add capsule and recovery support module in platform dsc and fdf.
>
> Cc: Michael D Kinney 
> >
> Cc: Kelly Steele >
> Cc: Feng Tian >
> Cc: Star Zeng >
> Cc: Liming Gao >
> Cc: Chao Zhang >
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao >
> ---
>  QuarkPlatformPkg/Quark.dsc|  72 --
>  QuarkPlatformPkg/Quark.fdf| 141 
>  QuarkPlatformPkg/QuarkMin.dsc |   7 +-
>  3 files changed, 205 insertions(+), 15 deletions(-)
>
> diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
> index d5988da..153f6e7 100644
> --- a/QuarkPlatformPkg/Quark.dsc
> +++ b/QuarkPlatformPkg/Quark.dsc
> @@ -39,6 +39,8 @@
>DEFINE SOURCE_DEBUG_ENABLE  = FALSE
>DEFINE PERFORMANCE_ENABLE   = FALSE
>DEFINE LOGGING  = FALSE
> +  DEFINE CAPSULE_ENABLE   = TRUE
> +  DEFINE RECOVERY_ENABLE  = TRUE
>
>#
># Galileo board.  Options are [GEN1, GEN2]
> @@ -160,11 +162,9 @@
>
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
>  !endif
>
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> -!endif
>
>  !if $(SECURE_BOOT_ENABLE)
>
> PlatformSecureLib|QuarkPlatformPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
> @@ -225,6 +225,17 @@
>
> PlatformPcieHelperLib|QuarkPlatformPkg/Library/PlatformPcieHelperLib/PlatformPcieHelper
> Lib.inf
>
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/DxePlatformHelperLib.inf
>
> +!if $(CAPSULE_ENABLE)
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> +!else
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> +!endif
> +
> +
> EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsule
> Lib.inf
> +
> FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLib
> Null.inf
> +  IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
> +
> PlatformFlashAccessLib|QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/
> PlatformFlashAccessLibDxe.inf
> +
>  [LibraryClasses.common.SEC]
>#
># SEC specific phase
> @@ -250,9 +261,7 @@
>
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatformHelperLib.inf
>
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHand
> lerLib.inf
>MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> -!endif
>  !if $(PERFORMANCE_ENABLE)
>PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
>  !endif
> @@ -273,9 +282,7 @@
>PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
>
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandler
> Lib.inf
>SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> -!endif
>  !if $(PERFORMANCE_ENABLE)
>PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf
>  !endif
> @@ -301,6 +308,10 @@
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
>  !endif
>
> +!if 

[edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Andrew Fish
I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
end up in the Guid.xref file. 

It looks to me like this code is only extracting the GUIDs from the Drivers INF 
file and the GUIDs defined in dependent libraries are skipped?  


https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
 


for Arch in ArchList:
PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
for key, item in Module.Protocols.items():
GuidDict[key] = item
for key, item in Module.Guids.items():
GuidDict[key] = item
for key, item in Module.Ppis.items():
GuidDict[key] = item


Does anyone know how to extract the info from the dependent libs? 

I have an lldb type formatter for EFI_GUID that will print out the GUID C name 
so I noticed when some of them went missing. 

Thanks,

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


Re: [edk2] [PATCH 0/3] MdeModulePkg/TerminalDxe: TtyTerm improvements

2016-10-26 Thread Tian, Feng
Sorry for missing this patch.

Reviewed-by: Feng Tian 

I will help push it in.

Thanks
Feng

-Original Message-
From: Brian J. Johnson [mailto:bjohn...@sgi.com] 
Sent: Wednesday, October 26, 2016 11:00 PM
To: Tian, Feng ; Zeng, Star 
Cc: Roy Franz ; Ryan Harkin ; Laszlo 
Ersek ; edk2-devel@lists.01.org ; 
Leif Lindholm 
Subject: Re: [edk2] [PATCH 0/3] MdeModulePkg/TerminalDxe: TtyTerm improvements

On 10/18/2016 10:34 AM, Brian J. Johnson wrote:
> On 10/14/2016 03:37 PM, Laszlo Ersek wrote:
>> On 10/14/16 21:39, Brian J. Johnson wrote:
>>> On 10/12/2016 03:17 AM, Ryan Harkin wrote:
 On 7 October 2016 at 16:59, Leif Lindholm 
 
 wrote:
> Roy can now be found at Roy Franz  (cc:d).
>
> On Fri, Oct 07, 2016 at 05:56:26PM +0200, Laszlo Ersek wrote:
>> Roy, Ryan,
>>
>> On 10/07/16 16:53, Brian J. Johnson wrote:
>>> This patch series implements some improvements to the TtyTerm 
>>> terminal type in the TerminalDxe driver.  It fixes an end case 
>>> with cursor position tracking, and uses that to optimize cursor 
>>> motion escape sequences.  It also adds support for the page up, 
>>> page down, insert, home, and end keys on some additional common 
>>> terminal emulators.
>>>
>>> The result is improved performance, especially at the shell 
>>> prompt, and better compatibility with common terminal emulators.  
>>> In particular, as a side effect of the optimized cursor motion, 
>>> terminal windows which are taller than the current mode setting 
>>> (eg. 25
>>> lines)
>>> work much better than before.
>>>
>>> Most of these fixes have been in production in some form on 
>>> SGI's servers for years.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Brian Johnson 
>>> Cc: Feng Tian 
>>> Cc: Star Zeng 
>>>
>>> Brian J. Johnson (3):
>>>   MdeModulePkg/TerminalDxe: Improve TtyTerm cursor position tracking
>>>   MdeModulePkg/TerminalDxe: Optimize TtyTerm cursor motion
>>>   MdeModulePkg/TerminalDxe: Handle more keys with TtyTerm
>>>
>>>  .../Universal/Console/TerminalDxe/Terminal.h   |  2 +
>>>  .../Universal/Console/TerminalDxe/TerminalConIn.c  | 24 
>>> +++--  .../Universal/Console/TerminalDxe/TerminalConOut.c | 
>>> 61
>>> --
>>>  3 files changed, 79 insertions(+), 8 deletions(-)
>>>
>>
>> can you please provide feedback (testing or otherwise) on this 
>> series?
>>

 Well, they "work" for me and I'd be happy with them being submitted.

 Tested-by: Ryan Harkin 

 The only curious effect I can see is the Print(L"xxx"); lines that 
 expect the \n to be missing will no longer "work".  For example, I 
 carry a patch by Daniil Egranov titled
 "IntelFrameworkModulePkg/BdsDxe: Show boot timeout message" and it 
 no longer displays the countdown on the same line each time, it 
 prints each message on a new line.

 However, I don't see that as a blocking point, Daniil's patch could 
 be changed easily and there are other advantages to this series 
 that make it worthwhile, IMO, eg, Shell commands with lots of 
 output (like "help" or "dir fs0:") no longer create an awful mess 
 on the serial console.

>>>
>>> So, is this just waiting for a maintainer's review?
>>
>> That's my understanding, yes.
>
> Feng or Star, could you please review these changes?

Ping?
-- 

Brian J. Johnson



   My statements are my own, are not authorized by SGI, and do not
   necessarily represent SGI’s positions.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] CorebootPayloadPkg: Make EFI shell the last boot option.

2016-10-26 Thread gdong1
To let it boot to OS automatically, make built in shell
as the last boot option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c   | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a31384a..1546e48 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -201,11 +201,6 @@ PlatformBootManagerBeforeConsole (
   EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 
0, , NULL);
 
   //
-  // Register UEFI Shell
-  //
-  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
-
-  //
   // Install ready to lock.
   // This needs to be done before option rom dispatched.
   //
@@ -237,6 +232,11 @@ PlatformBootManagerAfterConsole (
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
+  //
+  // Register UEFI Shell
+  //
+  PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
+  
   Print (
 L"\n"
 L"F2  to enter Boot Manager Menu.\n"
-- 
2.7.0.windows.1

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


[edk2] [PATCH] CorebootPayloadPkg: Add "Down" key to Boot Manager Menu

2016-10-26 Thread gdong1
Also add Down key to Boot Manager Menu since some serial
terminals don't support F2 key.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c| 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a31384a..c16a6b3 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -181,6 +181,7 @@ PlatformBootManagerBeforeConsole (
 {
   EFI_INPUT_KEYEnter;
   EFI_INPUT_KEYF2;
+  EFI_INPUT_KEYDown;
   EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
 
   PlatformConsoleInit ();
@@ -201,6 +202,14 @@ PlatformBootManagerBeforeConsole (
   EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 
0, , NULL);
 
   //
+  // Also add Down key to Boot Manager Menu since some serial terminals don't 
support F2 key.
+  //
+  Down.ScanCode= SCAN_DOWN;
+  Down.UnicodeChar = CHAR_NULL;
+  EfiBootManagerGetBootManagerMenu ();
+  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 
0, , NULL);
+
+  //
   // Register UEFI Shell
   //
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
@@ -239,8 +248,8 @@ PlatformBootManagerAfterConsole (
 
   Print (
 L"\n"
-L"F2  to enter Boot Manager Menu.\n"
-L"ENTER   to boot directly.\n"
+L"F2 or Down  to enter Boot Manager Menu.\n"
+L"ENTER   to boot directly.\n"
 L"\n"
   );
 
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH V4 7/8] QuarkPlatformPkg/dsc/fdf: Add capsule/recovery support.

2016-10-26 Thread Kinney, Michael D
Jiewen,

A couple comments inline below.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> 
> Subject: [edk2] [PATCH V4 7/8] QuarkPlatformPkg/dsc/fdf: Add capsule/recovery 
> support.
> 
> Add capsule and recovery support module in platform dsc and fdf.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> ---
>  QuarkPlatformPkg/Quark.dsc|  72 --
>  QuarkPlatformPkg/Quark.fdf| 141 
>  QuarkPlatformPkg/QuarkMin.dsc |   7 +-
>  3 files changed, 205 insertions(+), 15 deletions(-)
> 
> diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
> index d5988da..153f6e7 100644
> --- a/QuarkPlatformPkg/Quark.dsc
> +++ b/QuarkPlatformPkg/Quark.dsc
> @@ -39,6 +39,8 @@
>DEFINE SOURCE_DEBUG_ENABLE  = FALSE
>DEFINE PERFORMANCE_ENABLE   = FALSE
>DEFINE LOGGING  = FALSE
> +  DEFINE CAPSULE_ENABLE   = TRUE
> +  DEFINE RECOVERY_ENABLE  = TRUE
> 
>#
># Galileo board.  Options are [GEN1, GEN2]
> @@ -160,11 +162,9 @@
>
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
>  !endif
> 
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> -!endif
> 
>  !if $(SECURE_BOOT_ENABLE)
>
> PlatformSecureLib|QuarkPlatformPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
> @@ -225,6 +225,17 @@
> 
> PlatformPcieHelperLib|QuarkPlatformPkg/Library/PlatformPcieHelperLib/PlatformPcieHelper
> Lib.inf
> 
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/DxePlatformHelperLib.inf
> 
> +!if $(CAPSULE_ENABLE)
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> +!else
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> +!endif
> +
> +
> EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsule
> Lib.inf
> +
> FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLib
> Null.inf
> +  IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
> +
> PlatformFlashAccessLib|QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/
> PlatformFlashAccessLibDxe.inf
> +
>  [LibraryClasses.common.SEC]
>#
># SEC specific phase
> @@ -250,9 +261,7 @@
> 
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatformHelperLib.inf
> 
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHand
> lerLib.inf
>MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> -!endif
>  !if $(PERFORMANCE_ENABLE)
>PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
>  !endif
> @@ -273,9 +282,7 @@
>PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
> 
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandler
> Lib.inf
>SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> -!if $(SECURE_BOOT_ENABLE) || $(MEASURED_BOOT_ENABLE)
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> -!endif
>  !if $(PERFORMANCE_ENABLE)
>PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf
>  !endif
> @@ -301,6 +308,10 @@
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
>  !endif
> 
> +!if $(CAPSULE_ENABLE)
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
> +!endif
> +
>  [LibraryClasses.IA32.UEFI_DRIVER,LibraryClasses.IA32.UEFI_APPLICATION]
>PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> 
> @@ -431,6 +442,10 @@
> 
>gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand|FALSE
> 
> +!if $(RECOVERY_ENABLE)
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName|L"QUARKREC.Cap"
> +!endif
> +
>  [PcdsPatchableInModule]
>gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x803000C7
>gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> @@ -449,6 +464,11 @@
>gQuarkPlatformTokenSpaceGuid.PcdUserIsPhysicallyPresent|FALSE
>gQuarkPlatformTokenSpaceGuid.PcdSpiFlashDeviceSize|0
> 
> +!if $(CAPSULE_ENABLE) || $(RECOVERY_ENABLE)
> +
> 

[edk2] [PATCH] CorebootModulePkgPkg: Expose FindCbTag API from CbParseLib

2016-10-26 Thread gdong1
CbPlatformSupportLib might use FindCbTag() API to parse
platform specific information.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Dong 
Reviewed-by: Maurice Ma 
---
 CorebootModulePkg/Include/Library/CbParseLib.h | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/CorebootModulePkg/Include/Library/CbParseLib.h 
b/CorebootModulePkg/Include/Library/CbParseLib.h
index 064baf3..e1fda7e 100644
--- a/CorebootModulePkg/Include/Library/CbParseLib.h
+++ b/CorebootModulePkg/Include/Library/CbParseLib.h
@@ -2,7 +2,7 @@
   This library will parse the coreboot table in memory and extract those 
required
   information.
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, 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
@@ -18,6 +18,23 @@ typedef RETURN_STATUS \
 (*CB_MEM_INFO_CALLBACK) (UINT64 Base, UINT64 Size, UINT32 Type, VOID 
*Param);
 
 /**
+  Find coreboot record with given Tag from the memory Start in 4096
+  bytes range.
+
+  @param  Start  The start memory to be searched in
+  @param  TagThe tag id to be found
+
+  @retval NULL  The Tag is not found.
+  @retval OthersThe poiter to the record found.
+
+**/
+VOID *
+FindCbTag (
+  IN  VOID *Start,
+  IN  UINT32   Tag
+  );
+
+/**
   Acquire the memory information from the coreboot table in memory.
 
   @param  MemInfoCallback The callback routine
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

2016-10-26 Thread Kinney, Michael D
Jiewen,

Why is .aslc file used in this PEIM.  It is not an ACPI table.

You are generating a C structure that is used to set the value of
a PCD.  The C structure could be a global variable in the PEIM
that is initialized the same way the .aslc file does or you
could initialize the fields in the PEIM entry point.  Or some
combination of the two.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:33 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> ; Wei, David 
> Subject: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: 
> Add
> Descriptor for capsule update.
> 
> Add SystemFirmwareDescriptor for capsule update.
> The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it via 
> PCD.
> 
> Cc: David Wei 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> Reviewed-by: David Wei 
> ---
> 
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.asl
> c | 89 
> 
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
> | 46 ++
> 
> Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.
> c | 66 +++
>  3 files changed, 201 insertions(+)
> 
> diff --git
> a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> new file mode 100644
> index 000..4c9b63e
> --- /dev/null
> +++
> b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.a
> slc
> @@ -0,0 +1,89 @@
> +/** @file
> +  System Firmware descriptor.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +#include 
> +#include 
> +
> +#define PACKAGE_VERSION 0x
> +#define PACKAGE_VERSION_STRING  L"Unknown"
> +
> +#define CURRENT_FIRMWARE_VERSION0x0002
> +#define CURRENT_FIRMWARE_VERSION_STRING L"0x0002"
> +#define LOWEST_SUPPORTED_FIRMWARE_VERSION   0x0001
> +
> +#define IMAGE_IDSIGNATURE_64('V', 'L', 'V', '2', 
> '_', '_',
> 'F', 'd')
> +#define IMAGE_ID_STRING L"Vlv2Fd"
> +
> +// PcdSystemFmpCapsuleImageTypeIdGuid
> +#define IMAGE_TYPE_ID_GUID  { 0x4096267b, 0xda0a, 0x42eb, { 
> 0xb5,
> 0xeb, 0xfe, 0xf3, 0x1d, 0x20, 0x7c, 0xb4 } }
> +
> +typedef struct {
> +  EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR  Descriptor;
> +  // real string data
> +  CHAR16  ImageIdNameStr[16];
> +  CHAR16  VersionNameStr[16];
> +  CHAR16  PackageVersionNameStr[16];
> +} IMAGE_DESCRIPTOR;
> +
> +IMAGE_DESCRIPTOR mImageDescriptor =
> +{
> +  {
> +EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE,
> +sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR),
> +sizeof(IMAGE_DESCRIPTOR),
> +PACKAGE_VERSION,   // PackageVersion
> +OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr),   // 
> PackageVersionName
> +1, // ImageIndex;
> +{0x0}, // Reserved
> +IMAGE_TYPE_ID_GUID,// ImageTypeId;
> +IMAGE_ID,  // ImageId;
> +OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr),  // ImageIdName;
> +CURRENT_FIRMWARE_VERSION,  // Version;
> +OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr),  // VersionName;
> +{0x0}, // Reserved2
> +FixedPcdGet32(PcdFlashAreaSize),   // Size;
> +IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
> +  IMAGE_ATTRIBUTE_RESET_REQUIRED |
> +  

Re: [edk2] [PATCH V4 3/8] QuarkPlatformPkg/SystemFirmwareDescriptor: Add Descriptor for capsule update.

2016-10-26 Thread Kinney, Michael D
Jiewen,

Why is .aslc file used in this PEIM.  It is not an ACPI table.

You are generating a C structure that is used to set the value of
a PCD.  The C structure could be a global variable in the PEIM
that is initialized the same way the .aslc file does or you
could initialize the fields in the PEIM entry point.  Or some
combination of the two.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> 
> Subject: [edk2] [PATCH V4 3/8] QuarkPlatformPkg/SystemFirmwareDescriptor: Add
> Descriptor for capsule update.
> 
> Add SystemFirmwareDescriptor for capsule update.
> The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it via 
> PCD.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> ---
> 
> QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.aslc
> | 89 
>  
> QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf
> | 46 ++
> 
> QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptorPei.c
> | 66 +++
>  3 files changed, 201 insertions(+)
> 
> diff --git
> a/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.as
> lc
> b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.as
> lc
> new file mode 100644
> index 000..693a632
> --- /dev/null
> +++
> b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareDescriptor.as
> lc
> @@ -0,0 +1,89 @@
> +/** @file
> +  System Firmware descriptor.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +#include 
> +#include 
> +
> +#define PACKAGE_VERSION 0x
> +#define PACKAGE_VERSION_STRING  L"Unknown"
> +
> +#define CURRENT_FIRMWARE_VERSION0x0002
> +#define CURRENT_FIRMWARE_VERSION_STRING L"0x0002"
> +#define LOWEST_SUPPORTED_FIRMWARE_VERSION   0x0001
> +
> +#define IMAGE_IDSIGNATURE_64('Q', 'U', 'A', 'R', 
> 'K', '_',
> 'F', 'd')
> +#define IMAGE_ID_STRING L"QuarkPlatformFd"
> +
> +// PcdSystemFmpCapsuleImageTypeIdGuid
> +#define IMAGE_TYPE_ID_GUID  { 0x62af20c0, 0x7016, 0x424a, { 
> 0x9b,
> 0xf8, 0x9c, 0xcc, 0x86, 0x58, 0x40, 0x90 } }
> +
> +typedef struct {
> +  EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR  Descriptor;
> +  // real string data
> +  CHAR16  ImageIdNameStr[16];
> +  CHAR16  VersionNameStr[16];
> +  CHAR16  PackageVersionNameStr[16];
> +} IMAGE_DESCRIPTOR;
> +
> +IMAGE_DESCRIPTOR mImageDescriptor =
> +{
> +  {
> +EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE,
> +sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR),
> +sizeof(IMAGE_DESCRIPTOR),
> +PACKAGE_VERSION,   // PackageVersion
> +OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr),   // 
> PackageVersionName
> +1, // ImageIndex;
> +{0x0}, // Reserved
> +IMAGE_TYPE_ID_GUID,// ImageTypeId;
> +IMAGE_ID,  // ImageId;
> +OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr),  // ImageIdName;
> +CURRENT_FIRMWARE_VERSION,  // Version;
> +OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr),  // VersionName;
> +{0x0}, // Reserved2
> +FixedPcdGet32(PcdFlashAreaSize),   // Size;
> +IMAGE_ATTRIBUTE_IMAGE_UPDATABLE |
> +  IMAGE_ATTRIBUTE_RESET_REQUIRED |
> +  IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED |
> +  IMAGE_ATTRIBUTE_IN_USE,   

Re: [edk2] [PATCH V4 08/15] MdeModulePkg/CapsuleApp: Add CapsuleApp application.

2016-10-26 Thread Kinney, Michael D
Jiewen,

I have looked Microsoft UX capsule in the Microsoft
Windows UEFI Firmware Update Platform Specification, and 
that specification only defines support for an ImageType value
of 0, which is bitmap format based on ACPI 5.0 BGRT.  There
are no defined ImageType values for BMP. 

I recommend you update the capsule app for the unit test
that tests the bitmap capability to require the file to
be the same format as required by the Windows UEFI Firmware 
Update Platform Specification, and the variables and comments
in this patch should not reference the BMP file format at all.

A developer that wants to test this capability must convert
a graphics image to the right format before using it with
this utility.

Thanks,

Mike

> -Original Message-
> From: Yao, Jiewen
> Sent: Saturday, October 22, 2016 7:21 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Zeng, Star ; 
> Kinney, Michael
> D ; Gao, Liming ; Zhang, 
> Chao B
> 
> Subject: [PATCH V4 08/15] MdeModulePkg/CapsuleApp: Add CapsuleApp application.
> 
> This CapsuleApp can help perform capsule update in UEFI shell environment.
> It can also dump capsule information, capsule status variable, ESRT and FMP.
> 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> Reviewed-by: Liming Gao 
> ---
>  MdeModulePkg/Application/CapsuleApp/AppSupport.c| 445 ++
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.c| 853 
> 
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf  |  71 ++
>  MdeModulePkg/Application/CapsuleApp/CapsuleApp.uni  |  22 +
>  MdeModulePkg/Application/CapsuleApp/CapsuleAppExtra.uni |  19 +
>  MdeModulePkg/Application/CapsuleApp/CapsuleDump.c   | 740 
> +
>  6 files changed, 2150 insertions(+)
> 
> diff --git a/MdeModulePkg/Application/CapsuleApp/AppSupport.c
> b/MdeModulePkg/Application/CapsuleApp/AppSupport.c
> new file mode 100644
> index 000..90ca1fd
> --- /dev/null
> +++ b/MdeModulePkg/Application/CapsuleApp/AppSupport.c
> @@ -0,0 +1,445 @@
> +/** @file
> +  A shell application that triggers capsule update process.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define MAX_ARG_NUM 11
> +
> +UINTN  Argc;
> +CHAR16 **Argv;
> +
> +/**
> +
> +  This function parse application ARG.
> +
> +  @return Status
> +**/
> +EFI_STATUS
> +GetArg (
> +  VOID
> +  )
> +{
> +  EFI_STATUSStatus;
> +  EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
> +
> +  Status = gBS->HandleProtocol (
> +  gImageHandle,
> +  ,
> +  (VOID**)
> +  );
> +  if (EFI_ERROR(Status)) {
> +return Status;
> +  }
> +
> +  Argc = ShellParameters->Argc;
> +  Argv = ShellParameters->Argv;
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Return File System Volume containing this shell application.
> +
> +  @return File System Volume containing this shell application.
> +**/
> +EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *
> +GetMyVol (
> +  VOID
> +  )
> +{
> +  EFI_STATUSStatus;
> +  EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
> +  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *Vol;
> +
> +  Status = gBS->HandleProtocol (
> +  gImageHandle,
> +  ,
> +  (VOID **)
> +  );
> +  ASSERT_EFI_ERROR (Status);
> +
> +  Status = gBS->HandleProtocol (
> +  LoadedImage->DeviceHandle,
> +  ,
> +  (VOID **)
> +  );
> +  if (!EFI_ERROR (Status)) {
> +return Vol;
> +  }
> +
> +  return NULL;
> +}
> +
> +/**
> +  Read a file from this volume.
> +
> +  @param Vol File System Volume
> +  @param FileNameThe file to be read.
> +  @param BufferSize  The file buffer size
> +  @param Buffer  The file buffer
> +
> +  @retval EFI_SUCCESSRead file successfully
> +  @retval EFI_NOT_FOUND  File not found
> +**/
> 

Re: [edk2] [PATCH] CorebootModulePkg: Fix memmap issue

2016-10-26 Thread Ma, Maurice
Reviewed-by: Maurice Ma 

-Original Message-
From: Dong, Guo 
Sent: Tuesday, October 18, 2016 12:11 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootModulePkg: Fix memmap issue

Some reserved memory (e.g. CSE reserved memory) might be in the middle of 
usable physical memory. The current memory map caculation could not handle this 
case. This patch fixed this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: gdong1 
---
 CorebootModulePkg/CbSupportPei/CbSupportPei.c | 126 ++
 CorebootModulePkg/CbSupportPei/CbSupportPei.h |   8 +-
 CorebootModulePkg/Include/Library/CbParseLib.h|  13 ++-
 CorebootModulePkg/Library/CbParseLib/CbParseLib.c |  27 +
 4 files changed, 100 insertions(+), 74 deletions(-)

diff --git a/CorebootModulePkg/CbSupportPei/CbSupportPei.c 
b/CorebootModulePkg/CbSupportPei/CbSupportPei.c
index 366682b..004d1e9 100755
--- a/CorebootModulePkg/CbSupportPei/CbSupportPei.c
+++ b/CorebootModulePkg/CbSupportPei/CbSupportPei.c
@@ -141,6 +141,72 @@ CbPeiReportRemainedFvs (  }
 
 /**
+  Based on memory base, size and type, build resource descripter HOB.
+
+  @param  BaseMemory base address.
+  @param  SizeMemory size.
+  @param  TypeMemory type.
+  @param  Param   A pointer to CB_MEM_INFO.
+
+  @retval EFI_SUCCESS if it completed successfully.
+**/
+EFI_STATUS
+CbMemInfoCallback (
+  UINT64  Base,
+  UINT64  Size,
+  UINT32  Type,
+  VOID*Param
+  )
+{
+  CB_MEM_INFO *MemInfo;
+  UINTN   Attribue;
+
+  Attribue = EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_TESTED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
+
+  MemInfo = (CB_MEM_INFO *)Param;
+  if (Base >= 0x10) {
+if (Type == CB_MEM_RAM) {
+  if (Base < 0x1ULL) {
+MemInfo->UsableLowMemTop = (UINT32)(Base + Size);
+  } else {
+Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;
+  }
+  BuildResourceDescriptorHob (
+EFI_RESOURCE_SYSTEM_MEMORY,
+Attribue,
+(EFI_PHYSICAL_ADDRESS)Base,
+Size
+);
+} else if (Type == CB_MEM_TABLE) {
+  BuildResourceDescriptorHob (
+EFI_RESOURCE_MEMORY_RESERVED,
+Attribue,
+(EFI_PHYSICAL_ADDRESS)Base,
+Size
+);
+  MemInfo->SystemLowMemTop = ((UINT32)(Base + Size) + 0x0FFF) & 
0xF000;
+} else if (Type == CB_MEM_RESERVED) {
+  if ((MemInfo->SystemLowMemTop == 0) || (Base < 
MemInfo->SystemLowMemTop)) {
+BuildResourceDescriptorHob (
+  EFI_RESOURCE_MEMORY_RESERVED,
+  Attribue,
+  (EFI_PHYSICAL_ADDRESS)Base,
+  Size
+  ); 
+  }
+}
+  }
+  
+  return EFI_SUCCESS;
+}
+
+/**
   This is the entrypoint of PEIM
 
   @param  FileHandle  Handle of the file being invoked.
@@ -155,9 +221,9 @@ CbPeiEntryPoint (
   IN CONST EFI_PEI_SERVICES **PeiServices
   )
 {
-  EFI_STATUS Status;
-  UINT64 LowMemorySize, HighMemorySize;
-  UINT64 PeiMemSize = SIZE_64MB;   // 64 MB
+  EFI_STATUS   Status;
+  UINT64   LowMemorySize;
+  UINT64   PeiMemSize = SIZE_64MB;   // 64 MB
   EFI_PHYSICAL_ADDRESS PeiMemBase = 0;
   UINT32   RegEax;
   UINT8PhysicalAddressBits;
@@ -173,23 +239,12 @@ CbPeiEntryPoint (
   UINTNPmCtrlRegBase, PmTimerRegBase, ResetRegAddress, 
ResetValue;
   UINTNPmEvtBase;
   UINTNPmGpeEnBase;
-
-  LowMemorySize = 0;
-  HighMemorySize = 0;
-
-  Status = CbParseMemoryInfo (, );
-  if (EFI_ERROR(Status))
-return Status;
-
-  DEBUG((EFI_D_ERROR, "LowMemorySize: 0x%lx.\n", LowMemorySize));
-  DEBUG((EFI_D_ERROR, "HighMemorySize: 0x%lx.\n", HighMemorySize));
-
-  ASSERT (LowMemorySize > 0);
+  CB_MEM_INFO  CbMemInfo;
 
   //
   // Report lower 640KB of RAM. Attribute EFI_RESOURCE_ATTRIBUTE_TESTED
- // is intentionally omitted to prevent erasing of the coreboot header
- // record before it is processed by CbParseMemoryInfo.
+  // is intentionally omitted to prevent erasing of the coreboot header  
+ // record before it is processed by CbParseMemoryInfo.
   //
   BuildResourceDescriptorHob (
 EFI_RESOURCE_SYSTEM_MEMORY,
@@ -221,37 +276,16 @@ CbPeiEntryPoint (
 (UINT64)(0x6)
 );
 
-   BuildResourceDescriptorHob (
-EFI_RESOURCE_SYSTEM_MEMORY,
-(
-   EFI_RESOURCE_ATTRIBUTE_PRESENT |
-   EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-   EFI_RESOURCE_ATTRIBUTE_TESTED |
-   EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
-   EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 

Re: [edk2] [PATCH V4 06/15] MdeModulePkg/DxeCapsuleLibFmp: Add DxeCapsuleLibFmp instance.

2016-10-26 Thread Kinney, Michael D
Jiewen,

I have looked Microsoft UX capsule in the Microsoft
Windows UEFI Firmware Update Platform Specification, and 
that specification only define support for an ImageType value
of 0, which is bitmap format based on ACPI 5.0 BGRT.  There
are no defined ImageType values for BMP. We need to remove 
BMP graphics file format decoding from all capsule processing.
If a Microsoft UX capsule is present, it is already a raw
bitmap that can be passed to GOP.

Best regards,

Mike


> -Original Message-
> From: Yao, Jiewen
> Sent: Saturday, October 22, 2016 7:21 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Zeng, Star ; 
> Kinney, Michael
> D ; Gao, Liming ; Zhang, 
> Chao B
> 
> Subject: [PATCH V4 06/15] MdeModulePkg/DxeCapsuleLibFmp: Add DxeCapsuleLibFmp 
> instance.
> 
> This instance handles Microsoft UX capsule, UEFI defined FMP capsule.
> This instance should not assume any capsule image format.
> 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> Reviewed-by: Liming Gao 
> ---
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c  | 1363
> 
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf|   80 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.uni|   22 +
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c   |  486 +++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c|  489 +++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c  |  112 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf |   83 ++
>  MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.uni |   22 +
>  8 files changed, 2657 insertions(+)
> 
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> new file mode 100644
> index 000..20ef762
> --- /dev/null
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -0,0 +1,1363 @@
> +/** @file
> +  DXE capsule library.
> +
> +  Caution: This module requires additional review when modified.
> +  This module will have external input - capsule image.
> +  This external input must be validated carefully to avoid security issue 
> like
> +  buffer overflow, integer overflow.
> +
> +  SupportCapsuleImage(), ProcessCapsuleImage(), IsValidCapsuleHeader(),
> +  ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
> +  receive untrusted input and do basic validation.
> +
> +  Copyright (c) 2016, Intel Corporation. All rights reserved.
> +  This program and the accompanying materials
> +  are licensed and made available under the terms and conditions of the BSD 
> License
> +  which accompanies this distribution.  The full text of the license may be 
> found at
> +  http://opensource.org/licenses/bsd-license.php
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> +**/
> +
> +#include 
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +extern BOOLEANmAreAllImagesProcessed;
> +
> +EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable  = NULL;
> +BOOLEAN   mIsVirtualAddrConverted  = FALSE;
> +BOOLEAN   mDxeCapsuleLibEndOfDxe   = FALSE;
> +
> +/**
> +  Initialize capsule related variables.
> +**/
> +VOID
> +InitCapsuleVariable(
> +  VOID
> +  );
> +
> +/**
> +  Check if this FMP capsule is processed.
> +
> +  @param CapsuleHeader  The capsule image header
> +  @param PayloadIndex   FMP payload index
> +  @param ImageHeaderFMP image header
> +
> +  @retval TRUE  This FMP capsule is processed.
> +  @retval FALSE This FMP capsule is not processed.
> +**/
> +BOOLEAN
> +IsFmpCapsuleProcessed(
> +  IN EFI_CAPSULE_HEADER   *CapsuleHeader,
> +  IN UINTNPayloadIndex,
> +  IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader
> +  );
> +
> +/**
> +  Record capsule status variable.
> +
> +  @param CapsuleHeader  The capsule image header
> +  @param CapsuleStatus  The capsule process stauts
> +
> +  @retval EFI_SUCCESS  The capsule status variable is recorded.
> +  @retval EFI_OUT_OF_RESOURCES No resource to record the capsule status 
> variable.
> +**/
> +EFI_STATUS
> +RecordCapsuleStatusVariable(
> +  IN 

Re: [edk2] [PATCH V4 06/10] Vlv2TbltDevicePkg/PlatformBootManager: Add capsule/recovery handling.

2016-10-26 Thread Kinney, Michael D
Jiewen,

See feedback for QuarkPlatformPkg/PlatformBootManager.

The same feedback applies.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:33 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> ; Wei, David 
> Subject: [edk2] [PATCH V4 06/10] Vlv2TbltDevicePkg/PlatformBootManager: Add
> capsule/recovery handling.
> 
> 1) Add capsule and recovery boot path handling in platform BDS.
> 2) Add check if the platform is using default test key for recovery or update.
> Produce PcdTestKeyUsed to indicate if there is any
> test key used in current BIOS, such as recovery key,
> or capsule update key.
> Then the generic UI may consume this PCD to show warning information.
> 
> Cc: David Wei 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> Reviewed-by: David Wei 
> ---
>  Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c  | 181 
> ++--
>  Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf |   8 +
>  2 files changed, 134 insertions(+), 55 deletions(-)
> 
> diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
> b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
> index e1f3524..e4169b3 100644
> --- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
> +++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
> @@ -1,15 +1,15 @@
>  /** @file
> 
>Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.
> -
> 
> -  This program and the accompanying materials are licensed and made 
> available under
> 
> -  the terms and conditions of the BSD License that accompanies this 
> distribution.
> 
> -  The full text of the license may be found at
> 
> -  http://opensource.org/licenses/bsd-license.php.
> 
> -
> 
> -  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> 
> -  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> 
> -
> 
> +
> +  This program and the accompanying materials are licensed and made 
> available under
> +  the terms and conditions of the BSD License that accompanies this 
> distribution.
> +  The full text of the license may be found at
> +  http://opensource.org/licenses/bsd-license.php.
> +
> +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +
> 
> 
>  Module Name:
> @@ -45,6 +45,9 @@ Abstract:
>  #include 
>  #include 
> 
> +#include 
> +#include 
> +
>  EFI_GUID *ConnectDriverTable[] = {
>,
>,
> @@ -1585,7 +1588,7 @@ EFIAPI
>  PlatformBdsPolicyBehavior (
>IN OUT LIST_ENTRY  *DriverOptionList,
>IN OUT LIST_ENTRY  *BootOptionList,
> -  IN PROCESS_CAPSULESProcessCapsules,
> +  IN PROCESS_CAPSULESBdsProcessCapsules,
>IN BASEM_MEMORY_TEST   BaseMemoryTest
>)
>  {
> @@ -1594,11 +1597,8 @@ PlatformBdsPolicyBehavior (
>EFI_BOOT_MODE  BootMode;
>BOOLEANDeferredImageExist;
>UINTN  Index;
> -  CHAR16 CapsuleVarName[36];
> -  CHAR16 *TempVarName;
>SYSTEM_CONFIGURATION   SystemConfiguration;
>UINTN  VarSize;
> -  BOOLEANSetVariableFlag;
>PLATFORM_PCI_DEVICE_PATH   *EmmcBootDevPath;
>EFI_GLOBAL_NVS_AREA_PROTOCOL   *GlobalNvsArea;
>EFI_HANDLE FvProtocolHandle;
> @@ -1612,13 +1612,14 @@ PlatformBdsPolicyBehavior (
>BOOLEANIsFirstBoot;
>UINT16 *BootOrder;
>UINTN  BootOrderSize;
> +  ESRT_MANAGEMENT_PROTOCOL   *EsrtManagement;
> 
>Timeout = PcdGet16 (PcdPlatformBootTimeOut);
>if (Timeout > 10 ) {
>  //we think the Timeout variable is corrupted
>  Timeout = 10;
>}
> -
> +
>VarSize = sizeof(SYSTEM_CONFIGURATION);
>Status = gRT->GetVariable(
>NORMAL_SETUP_NAME,
> @@ -1639,7 +1640,7 @@ PlatformBdsPolicyBehavior (
>
>);
>  ASSERT_EFI_ERROR (Status);
> -  }
> +  }
> 
>//
>// Load the driver option as the driver option list
> @@ -1652,37 +1653,6 @@ PlatformBdsPolicyBehavior (
>BootMode = GetBootModeHob();
> 
>  

Re: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add capsule/recovery handling.

2016-10-26 Thread Kinney, Michael D
Jiewen,

Can the code that checks for the use of a test key be moved into a common BDS 
lib or module?
Maybe in MdeModulePkg\Universal\BdsDxe\BdsEntry.c right before the call to 
PlatformBootManagerAfterConsole()?  The logic in BdsEntry.c can do the check 
and set the
PcdTestKeyUsed PCD and can go a DEBUG() message for the use of a test key.

With the current design, you depend on a platform specific BDS library to 
include the test 
key check, and we want to make sure the check for the use of a test key is 
always performed.

Also, the test key check against PcdRsa2048Sha256PublicKeyBuffer is incomplete. 
The DEC file
description of this PCD is as follows:

  ## Provides one or more SHA 256 Hashes of the RSA 2048 public keys used to 
verify Recovery and Capsule Update images
  #  WARNING: The default value is treated as test key. Please do not use 
default value in the production.
  # @Prompt One or more SHA 256 Hashes of RSA 2048 bit public keys used to 
verify Recovery and Capsule Update images
  #
  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer|{0x91, 0x29, 
0xc4, 0xbd, 0xea, 0x6d, 0xda, 0xb3, 0xaa, 0x6f, 0x50, 0x16, 0xfc, 0xdb, 0x4b, 
0x7e, 0x3c, 0xd6, 0xdc, 0xa4, 0x7a, 0x0e, 0xdd, 0xe6, 0x15, 0x8c, 0x73, 0x96, 
0xa2, 0xd4, 0xa6, 0x4d}|VOID*|0x00010013

Since this PCD provides one or more SHA 256 Hashes, the check for the use of a 
test key needs to get the 
Size, determine how many hashes are in this PCD, and compare the test key value 
against each entry in
this array.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiewen 
> Yao
> Sent: Saturday, October 22, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng ; Gao, Liming ; 
> Zeng, Star
> ; Kinney, Michael D ; Zhang, 
> Chao B
> 
> Subject: [edk2] [PATCH V4 6/8] QuarkPlatformPkg/PlatformBootManager: Add
> capsule/recovery handling.
> 
> 1) Add capsule and recovery boot path handling in platform BDS.
> 2) Add check if the platform is using default test key for recovery or update.
> Produce PcdTestKeyUsed to indicate if there is any
> test key used in current BIOS, such as recovery key,
> or capsule update key.
> Then the generic UI may consume this PCD to show warning information.
> 
> Cc: Michael D Kinney 
> Cc: Kelly Steele 
> Cc: Feng Tian 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao 
> ---
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c  | 
> 131
> +++-
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.h  | 
>   9 +-
>  QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 
>  16 ++-
>  3 files changed, 151 insertions(+), 5 deletions(-)
> 
> diff --git 
> a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> index 19ff3d0..f327c89 100644
> --- a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> +++ b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
> @@ -2,7 +2,7 @@
>  This file include all platform action which can be customized
>  by IBV/OEM.
> 
> -Copyright (c) 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2015 - 2016, 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
> @@ -205,6 +205,8 @@ PlatformBootManagerBeforeConsole (
>EFI_INPUT_KEY Enter;
>EFI_INPUT_KEY F2;
>EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;
> +  ESRT_MANAGEMENT_PROTOCOL  *EsrtManagement;
> +  EFI_BOOT_MODE BootMode;
>EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
>EFI_HANDLEHandle;
>EFI_EVENT EndOfDxeEvent;
> @@ -246,6 +248,40 @@ PlatformBootManagerBeforeConsole (
>//
>PlatformRegisterFvBootOption (, L"UEFI Shell",
> LOAD_OPTION_ACTIVE);
> 
> +  Status = gBS->LocateProtocol(, NULL, (VOID
> **));
> +  if (EFI_ERROR(Status)) {
> +EsrtManagement = NULL;
> +  }
> +
> +  BootMode = GetBootModeHob();
> +  switch (BootMode) {
> +  case BOOT_ON_FLASH_UPDATE:
> +DEBUG((EFI_D_INFO, "ProcessCapsules Before EndOfDxe ..\n"));
> +Status = ProcessCapsules ();
> +DEBUG((EFI_D_INFO, "ProcessCapsules %r\n", Status));
> +break;
> +  case BOOT_IN_RECOVERY_MODE:
> +break;
> +  case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
> +  case 

[edk2] [Patch] PcAtChipsetPkg/HpetTimerDxe: Fix race condition in SetTimerPeriod()

2016-10-26 Thread Michael Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=182

The function TimerDriverSetTimerPeriod() disables the HPET timer
while the HPET timer HW is reprogrammed with a new timer period.
However, the MMIO write to disable the HPET timer HW can be
delayed and an HPET timer interrupt may be processed in the middle
of reprogramming the HPET timer HW and this may produced unexpected
results.

The fix is to raise TPL to TPL_HIGH_LEVEL in
TimerDriverSetTimerPeriod() during the time the HPET timer HW is
reprogrammed.  This guarantees that no timer interrupts are
processed during reprogramming.

The TimerDriverGenerateSoftInterrupt() function in this same
driver also raises TPL to TPL_HIGH_LEVEL, so this fix matches
the logic that is already used in another function for the same
reason.

Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c 
b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
index 0ed8743..c62c3a9 100644
--- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
+++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
@@ -492,11 +492,17 @@ TimerDriverSetTimerPeriod (
   IN UINT64   TimerPeriod
   )
 {
+  EFI_TPLTpl;
   UINT64 MainCounter;
   UINT64 Delta;
   UINT64 CurrentComparator;
   HPET_TIMER_MSI_ROUTE_REGISTER  HpetTimerMsiRoute;
-  
+
+  //
+  // Disable interrupts
+  //
+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+
   //
   // Disable HPET timer when adjusting the timer period
   //
@@ -616,7 +622,12 @@ TimerDriverSetTimerPeriod (
   // is disabled.
   //
   HpetEnable (TRUE);
-  
+
+  //
+  // Restore interrupts
+  //
+  gBS->RestoreTPL (Tpl);
+
   return EFI_SUCCESS;
 }
 
-- 
2.6.3.windows.1

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


Re: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro

2016-10-26 Thread Laszlo Ersek
On 10/27/16 00:13, Kinney, Michael D wrote:
> Hi Laszlo,
> 
> One comment inline below.
> 
> Mike
> 
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
>> Laszlo Ersek
>> Sent: Wednesday, October 26, 2016 12:04 PM
>> To: edk2-devel-01 
>> Cc: Ni, Ruiyu ; Tim He ; Tian, Feng
>> ; Kinney, Michael D ; Dong, 
>> Eric
>> ; Cecil Sheng ; Ard Biesheuvel
>> ; Justen, Jordan L ; 
>> Gao, Liming
>> ; Bi, Dandan ; Wu, Jiaxin
>> ; Gary Lin ; Zeng, Star 
>> ;
>> Daryl McDaniel ; Carsey, Jaben 
>> ;
>> Fu, Siyuan ; Fan, Jeff ; Zhang, 
>> Chao B
>> ; Wei, David 
>> Subject: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the 
>> ARRAY_SIZE()
>> function-like macro
>>
>> Several modules use ARRAY_SIZE() already; centralize the definition. (The
>> module-specific macro definitions are guarded by #ifndef directives at
>> this point.)
>>
>> Cc: Ard Biesheuvel 
>> Cc: Cecil Sheng 
>> Cc: Chao Zhang 
>> Cc: Dandan Bi 
>> Cc: Daryl McDaniel 
>> Cc: David Wei 
>> Cc: Eric Dong 
>> Cc: Feng Tian 
>> Cc: Gary Lin 
>> Cc: Jaben Carsey 
>> Cc: Jeff Fan 
>> Cc: Jiaxin Wu 
>> Cc: Jordan Justen 
>> Cc: Liming Gao 
>> Cc: Michael D Kinney 
>> Cc: Ruiyu Ni 
>> Cc: Siyuan Fu 
>> Cc: Star Zeng 
>> Cc: Tim He 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek 
>> ---
>>  MdePkg/Include/Base.h | 13 +
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
>> index c66614846488..8bdb257e37bd 100644
>> --- a/MdePkg/Include/Base.h
>> +++ b/MdePkg/Include/Base.h
>> @@ -1211,5 +1211,18 @@ typedef UINTN RETURN_STATUS;
>>#define RETURN_ADDRESS(L) ((VOID *) 0)
>>  #endif
>>
>> +/**
>> +  Return the number of elements in an array.
>> +
>> +  @param  Array  An object of array type. Array is only used as an argument 
>> to
>> + the sizeof operator, therefore Array is never evaluated. 
>> The
>> + caller is responsible for ensuring that Array's type is not
>> + incomplete; that is, Array must have known constant size.
>> +
>> +  @return The number of elements in Array. The result has type UINTN.
>> +
>> +**/
>> +#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof (Array)[0])
>  
> I think adding one extra set of () makes this clearer:
> 
> #define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))

Sure, will do.

Thanks!
Laszlo

>> +
>>  #endif
>>
>> --
>> 2.9.2
>>
>>
>> ___
>> 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 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro

2016-10-26 Thread Kinney, Michael D
Hi Laszlo,

One comment inline below.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
> Ersek
> Sent: Wednesday, October 26, 2016 12:04 PM
> To: edk2-devel-01 
> Cc: Ni, Ruiyu ; Tim He ; Tian, Feng
> ; Kinney, Michael D ; Dong, 
> Eric
> ; Cecil Sheng ; Ard Biesheuvel
> ; Justen, Jordan L ; 
> Gao, Liming
> ; Bi, Dandan ; Wu, Jiaxin
> ; Gary Lin ; Zeng, Star 
> ;
> Daryl McDaniel ; Carsey, Jaben 
> ;
> Fu, Siyuan ; Fan, Jeff ; Zhang, Chao 
> B
> ; Wei, David 
> Subject: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the 
> ARRAY_SIZE()
> function-like macro
> 
> Several modules use ARRAY_SIZE() already; centralize the definition. (The
> module-specific macro definitions are guarded by #ifndef directives at
> this point.)
> 
> Cc: Ard Biesheuvel 
> Cc: Cecil Sheng 
> Cc: Chao Zhang 
> Cc: Dandan Bi 
> Cc: Daryl McDaniel 
> Cc: David Wei 
> Cc: Eric Dong 
> Cc: Feng Tian 
> Cc: Gary Lin 
> Cc: Jaben Carsey 
> Cc: Jeff Fan 
> Cc: Jiaxin Wu 
> Cc: Jordan Justen 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Ruiyu Ni 
> Cc: Siyuan Fu 
> Cc: Star Zeng 
> Cc: Tim He 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  MdePkg/Include/Base.h | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
> index c66614846488..8bdb257e37bd 100644
> --- a/MdePkg/Include/Base.h
> +++ b/MdePkg/Include/Base.h
> @@ -1211,5 +1211,18 @@ typedef UINTN RETURN_STATUS;
>#define RETURN_ADDRESS(L) ((VOID *) 0)
>  #endif
> 
> +/**
> +  Return the number of elements in an array.
> +
> +  @param  Array  An object of array type. Array is only used as an argument 
> to
> + the sizeof operator, therefore Array is never evaluated. The
> + caller is responsible for ensuring that Array's type is not
> + incomplete; that is, Array must have known constant size.
> +
> +  @return The number of elements in Array. The result has type UINTN.
> +
> +**/
> +#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof (Array)[0])
 
I think adding one extra set of () makes this clearer:

#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))

> +
>  #endif
> 
> --
> 2.9.2
> 
> 
> ___
> 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 00/47] edk2: centralize and adopt ARRAY_SIZE()

2016-10-26 Thread Carsey, Jaben
For 05, 39, 41, 42

Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Wednesday, October 26, 2016 12:04 PM
> To: edk2-devel-01 
> Cc: Ard Biesheuvel ; Cecil Sheng
> ; Zhang, Chao B ; Bi,
> Dandan ; Daryl McDaniel  li...@mc2research.org>; Wei, David ; Dong, Eric
> ; Tian, Feng ; Gary Lin
> ; Carsey, Jaben ; Fan, Jeff
> ; Wu, Jiaxin ; Justen, Jordan L
> ; Gao, Liming ; Kinney,
> Michael D ; Ni, Ruiyu ;
> Fu, Siyuan ; Zeng, Star ; Tim He
> 
> Subject: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE()
> Importance: High
> 
> I'm sure most of us have wished at some point that ARRAY_SIZE()
> had existed in a central header file, like it does in many other
> open source projects. This series implements that.
> 
> Patches 01-04 round up the modules that #define ARRAY_SIZE() just
> for themselves, and wrap their definitions in #ifndef ARRAY_SIZE.
> 
> Patch 05 defines ARRAY_SIZE() in "MdePkg/Include/Base.h". This
> flips the previously modified modules to MdePkg's macro definition.
> 
> Patches 06-09 modify the same set of modules as patches 01-04 do; this
> time the (now unused) module-local ARRAY_SIZE() macro definitions are
> eliminated.
> 
> The rest of the patches (10-47) migrate the edk2 tree to ARRAY_SIZE(),
> covering the most obvious open-coded ARRAY_SIZE() expressions. These
> expressions were located and converted with the following shell
> pipeline:
> 
>   git ls-files \
>   | xargs --no-run-if-empty -- \
>   sed --regexp-extended --in-place \
> --expression='s,sizeof \(([a-zA-Z0-9_]+)\) / sizeof
> \((\*\1|\1\[0\])\),ARRAY_SIZE (\1),g' \
> --
> 
> This pipeline lists all tracked files with "git". The pathnames are then
> composed with "xargs" into maximal length "sed" command lines, and those
> "sed" commands are run.
> 
> Here the "sed" stream editor filters and modifies all the listed files
> in place. The extended regular expression replaces the following two
> patterns:
> 
>   sizeof (ArrayName) / sizeof (*ArrayName)
>   sizeof (ArrayName) / sizeof (ArrayName[0])
> 
> with
> 
>   ARRAY_SIZE (ArrayName)
> 
> The regexp uses a backreference in the match, ensuring that the sizeof
> operator in the dividend and the sizeof operator in the divisor both
> refer to the same ArrayName. If there are multiple occurrences on the
> same line, the sed command replaces all of them.
> 
> I collected the changes into patches manually, and I reviewed them all.
> 
> I test-built all of the modified packages, repeating the command
> 
>   build -a X64 -t GCC48 -b DEBUG -p FooPkg/FooPkg.dsc
> 
> as many times as necessary. Two packages were impossible to build like
> this: Nt32Pkg and Vlv2TbltDevicePkg, so I couldn't build-test them.
> 
> I did some light-weight testing with OVMF: boot with Secure Boot
> enabled, S3 suspend/resume with and without SMM. I also booted
> ArmVirtQemu once.
> 
> Repository: https://github.com/lersek/edk2.git
> Branch: array_size
> 
> Cc: Ard Biesheuvel 
> Cc: Cecil Sheng 
> Cc: Chao Zhang 
> Cc: Dandan Bi 
> Cc: Daryl McDaniel 
> Cc: David Wei 
> Cc: Eric Dong 
> Cc: Feng Tian 
> Cc: Gary Lin 
> Cc: Jaben Carsey 
> Cc: Jeff Fan 
> Cc: Jiaxin Wu 
> Cc: Jordan Justen 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Ruiyu Ni 
> Cc: Siyuan Fu 
> Cc: Star Zeng 
> Cc: Tim He 
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (47):
>   MdeModulePkg/RegularExpressionDxe: guard the definition of ARRAY_SIZE
>   NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE
>   OvmfPkg/PlatformBootManagerLib: guard the definition of ARRAY_SIZE
>   OvmfPkg/XenBusDxe: guard the definition of ARRAY_SIZE
>   MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro
>   MdeModulePkg/RegularExpressionDxe: remove module-local ARRAY_SIZE
> macro
>   NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro
>   OvmfPkg/PlatformBootManagerLib: remove module-local ARRAY_SIZE
> macro
>   OvmfPkg/XenBusDxe: remove module-local ARRAY_SIZE macro
>   ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE()
>   DuetPkg/DuetBdsLib: rebase to ARRAY_SIZE()
>   

[edk2] [Patch] MdePkg/Include: Add enumeration size checks to Base.h

2016-10-26 Thread Michael Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=181

Add size check for 8-bit, 16-bit, and 32-bit enums
to make sure they follow the UEFI Specification 2.3.1
Data Types.



Element of a standard ANSI C enum type declaration.
Type INT32.or UINT32.  ANSI C does not define the
size of sign of an enum so they should never be
used in structures. ANSI C integer promotion rules
make INT32 or UINT32 interchangeable when passed as
an argument to a function.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 MdePkg/Include/Base.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index c666148..725d9c9 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -63,6 +63,22 @@ VERIFY_SIZE_OF (UINT64, 8);
 VERIFY_SIZE_OF (CHAR8, 1);
 VERIFY_SIZE_OF (CHAR16, 2);
 
+typedef enum {
+  __VerifyUint8EnumValue = 0xff
+} __VERIFY_UINT8_ENUM_SIZE;
+
+typedef enum {
+  __VerifyUint16EnumValue = 0x
+} __VERIFY_UINT16_ENUM_SIZE;
+
+typedef enum {
+  __VerifyUint32EnumValue = 0x
+} __VERIFY_UINT32_ENUM_SIZE;
+
+VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4);
+VERIFY_SIZE_OF (__VERIFY_UINT16_ENUM_SIZE, 4);
+VERIFY_SIZE_OF (__VERIFY_UINT32_ENUM_SIZE, 4);
+
 //
 // The Microsoft* C compiler can removed references to unreferenced data items
 //  if the /OPT:REF linker option is used. We defined a macro as this is a
-- 
2.6.3.windows.1

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


[edk2] [PATCH] CorebootPayloadPkg: Add an option to use HPET timer driver

2016-10-26 Thread Maurice Ma
The current CorebootPayloadPkg will use the legacy 8254 timer
driver as the default. However, on some platforms legacy timer
might not exist anymore. This patch adds HPET timer driver as
a build option.

Cc: Prince Agyeman 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma 
---
 CorebootPayloadPkg/CorebootPayloadPkg.fdf|  6 +-
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc| 10 ++
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 12 +++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf 
b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
index d07fd30a103e..6a0b58f35a6b 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
+++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
@@ -88,7 +88,11 @@ INF 
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF UefiCpuPkg/CpuDxe/CpuDxe.inf
 INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 INF MdeModulePkg/Application/UiApp/UiApp.inf
-INF PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+!if $(USE_HPET_TIMER) == TRUE
+INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!else  
+INF PcAtChipsetPkg/8254TimerDxe/8254Timer.inf  
+!endif 
 INF MdeModulePkg/Universal/Metronome/Metronome.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
index 435743329674..2637a255e5d1 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
@@ -78,6 +78,11 @@
   DEFINE PCI_SERIAL_PARAMETERS= {0xff,0xff, 0x00,0x00, 
0x0,0x20,0x1c,0x00, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x00,0x01, 0x0,0x0, 
0x0,0x0, 0x0,0x0, 0xff,0xff}
 
   #
+  # Chipset options
+  #
+  DEFINE USE_HPET_TIMER   = FALSE
+
+  #
   # Shell options: [BUILD_SHELL, FULL_BIN, MIN_BIN, NONE, UEFI]
   #
   DEFINE SHELL_TYPE  = FULL_BIN
@@ -170,6 +175,7 @@
   
SerialPortLib|CorebootModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
   
PlatformHookLib|CorebootPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
   
PlatformBootManagerLib|CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
 
   #
   # Misc
@@ -386,7 +392,11 @@
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
+!if $(USE_HPET_TIMER) == TRUE
+  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!else  
   PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+!endif
   MdeModulePkg/Universal/Metronome/Metronome.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc 
b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
index 3ddc81b457ce..4a5fc89c6f0c 100644
--- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
+++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
@@ -78,6 +78,11 @@
   DEFINE PCI_SERIAL_PARAMETERS= {0xff,0xff, 0x00,0x00, 
0x0,0x20,0x1c,0x00, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x00,0x01, 0x0,0x0, 
0x0,0x0, 0x0,0x0, 0xff,0xff}
 
   #
+  # Chipset options
+  #
+  DEFINE USE_HPET_TIMER   = FALSE
+
+  #
   # Shell options: [BUILD_SHELL, FULL_BIN, MIN_BIN, NONE, UEFI]
   #
   DEFINE SHELL_TYPE  = FULL_BIN
@@ -172,6 +177,7 @@
   
SerialPortLib|CorebootModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
   
PlatformHookLib|CorebootPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
   
PlatformBootManagerLib|CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
 
   #
   # Misc
@@ -389,7 +395,11 @@
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
   }
-  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+!if $(USE_HPET_TIMER) == TRUE
+  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!else  
+  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf  
+!endif
   MdeModulePkg/Universal/Metronome/Metronome.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-- 
1.9.5.msysgit.0

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


[edk2] [Patch] MdePkg/PciSegmentLib: Optimize PCI_SEGMENT_LIB_ADDRESS()

2016-10-26 Thread Michael Kinney
The PCI_SEGMENT_LIB_ADDRESS() macro puts the Segment number
into bits 32..47 of the logical address that is returned.
The portable method to put Segment in this bit range is to
use LShitU64().  For 64-bit CPUs, this is optimized well
by the compiler.  For 32-bit CPUs, a call to LSHiftU64()
is included in the generated binaries.  However, if the
Segment parameter is 0, then no shift is required.  Add
a check for Segment set to 0 and provide an optimized
macro implementation that does not call LShiftU64().

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 MdePkg/Include/Library/PciSegmentLib.h | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/MdePkg/Include/Library/PciSegmentLib.h 
b/MdePkg/Include/Library/PciSegmentLib.h
index 1135010..5175e07 100644
--- a/MdePkg/Include/Library/PciSegmentLib.h
+++ b/MdePkg/Include/Library/PciSegmentLib.h
@@ -23,7 +23,7 @@
   access method.  Modules will typically use the PCI Segment Library for its 
PCI configuration 
   accesses when PCI Segments other than Segment #0 must be accessed.  
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, 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
@@ -56,11 +56,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 **/
 #define PCI_SEGMENT_LIB_ADDRESS(Segment,Bus,Device,Function,Register) \
-  ( ((Register) & 0xfff)  | \
-(((Function) & 0x07) << 12)   | \
-(((Device) & 0x1f) << 15) | \
-(((Bus) & 0xff) << 20)| \
-(LShiftU64((Segment) & 0x, 32)) \
+  ((Segment != 0) ? \
+( ((Register) & 0xfff) | \
+  (((Function) & 0x07) << 12)  | \
+  (((Device) & 0x1f) << 15)| \
+  (((Bus) & 0xff) << 20)   | \
+  (LShiftU64 ((Segment) & 0x, 32))   \
+) :  \
+( ((Register) & 0xfff) | \
+  (((Function) & 0x07) << 12)  | \
+  (((Device) & 0x1f) << 15)| \
+  (((Bus) & 0xff) << 20) \
+)\
   )
 
 /**
-- 
2.6.3.windows.1

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


Re: [edk2] [PATCH] CorebootModulePkg: Add a library to parse platform specific info.

2016-10-26 Thread Ma, Maurice
Hi,  Guo,

Please fix the typos "specif" in commit message. 
Other than this,  it looks good to me.

Reviewed-by: Maurice Ma 

-Original Message-
From: Dong, Guo 
Sent: Monday, October 17, 2016 3:33 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootModulePkg: Add a library to parse platform 
specific info.

Update CbSupportPei to consume the new library, so platform could provide 
platform specific library instance to parse platform specif info.
And add a NULL library instance to pass build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: gdong1 
---
 CorebootModulePkg/CbSupportPei/CbSupportPei.c  |  9 ++
 CorebootModulePkg/CbSupportPei/CbSupportPei.h  |  3 +-
 CorebootModulePkg/CbSupportPei/CbSupportPei.inf|  1 +
 .../Include/Library/CbPlatformSupportLib.h | 34 +
 .../CbPlatformSupportLibNull.c | 35 ++
 .../CbPlatformSupportLibNull.inf   | 35 ++
 .../CbPlatformSupportLibNull.uni   | 19 
 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc  |  1 +
 CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc   |  1 +
 9 files changed, 137 insertions(+), 1 deletion(-)  create mode 100644 
CorebootModulePkg/Include/Library/CbPlatformSupportLib.h
 create mode 100644 
CorebootModulePkg/Library/CbPlatformSupportLibNull/CbPlatformSupportLibNull.c
 create mode 100644 
CorebootModulePkg/Library/CbPlatformSupportLibNull/CbPlatformSupportLibNull.inf
 create mode 100644 
CorebootModulePkg/Library/CbPlatformSupportLibNull/CbPlatformSupportLibNull.uni

diff --git a/CorebootModulePkg/CbSupportPei/CbSupportPei.c 
b/CorebootModulePkg/CbSupportPei/CbSupportPei.c
index 366682b..5688bf2 100755
--- a/CorebootModulePkg/CbSupportPei/CbSupportPei.c
+++ b/CorebootModulePkg/CbSupportPei/CbSupportPei.c
@@ -387,6 +387,15 @@ CbPeiEntryPoint (
   }
 
   //
+  // Parse platform specific information from coreboot. 
+  //
+  Status = CbParsePlatformInfo ();
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "Error when parsing platform info, Status = %r\n", 
Status));
+return Status;
+  }
+
+  //
   // Mask off all legacy 8259 interrupt sources
   //
   IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF); diff --git 
a/CorebootModulePkg/CbSupportPei/CbSupportPei.h 
b/CorebootModulePkg/CbSupportPei/CbSupportPei.h
index 3c9a3fe..f897dc4 100644
--- a/CorebootModulePkg/CbSupportPei/CbSupportPei.h
+++ b/CorebootModulePkg/CbSupportPei/CbSupportPei.h
@@ -1,7 +1,7 @@
 /** @file
   The header file of Coreboot Support PEIM.
 
-Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2014 - 2016, 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 @@ -28,6 +28,7 @@ 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include  diff --git 
a/CorebootModulePkg/CbSupportPei/CbSupportPei.inf 
b/CorebootModulePkg/CbSupportPei/CbSupportPei.inf
index 4905bdb..f7997ff 100644
--- a/CorebootModulePkg/CbSupportPei/CbSupportPei.inf
+++ b/CorebootModulePkg/CbSupportPei/CbSupportPei.inf
@@ -52,6 +52,7 @@
   CbParseLib
   MtrrLib
   IoLib
+  CbPlatformSupportLib
 
 [Guids]
   gEfiSmmPeiSmramMemoryReserveGuid
diff --git a/CorebootModulePkg/Include/Library/CbPlatformSupportLib.h 
b/CorebootModulePkg/Include/Library/CbPlatformSupportLib.h
new file mode 100644
index 000..153d3d8
--- /dev/null
+++ b/CorebootModulePkg/Include/Library/CbPlatformSupportLib.h
@@ -0,0 +1,34 @@
+/** @file
+  Coreboot Platform Support library. Platform can provide an 
+implementation of this
+  library class to provide hooks that may be required for some type of
+  platform features.
+
+Copyright (c) 2016, Intel Corporation. All rights reserved. This 
+program and the accompanying materials are licensed and made available 
+under the terms and conditions of the BSD License that accompanies this 
distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.

+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  
   
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __CB_PLATFORM_SUPPORT_LIB__
+#define __CB_PLATFORM_SUPPORT_LIB__
+
+/**
+  Parse platform specific information from coreboot. 
+
+  @retval RETURN_SUCCESS   The platform specific coreboot support 
succeeded.
+  @retval RETURN_DEVICE_ERROR  The platform specific coreboot support could 
not be completed.
+ 
+**/
+EFI_STATUS
+EFIAPI
+CbParsePlatformInfo (
+  VOID
+  );
+
+#endif // 

Re: [edk2] [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol.

2016-10-26 Thread Ma, Maurice
This patch looks good to me.  

Reviewed-by: Maurice Ma 

-Original Message-
From: Dong, Guo 
Sent: Monday, October 17, 2016 3:39 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install 
ReadyToLock protocol.

Update PlatformBootManagerLib to notify EndOfDxe event and install 
SmmReadyToLock protocol since other modules depend on them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: gdong1 
---
 .../PlatformBootManagerLib/PlatformBootManager.c   | 65 +-
 .../PlatformBootManagerLib/PlatformBootManager.h   |  4 +-
 .../PlatformBootManagerLib.inf |  4 +-
 3 files changed, 69 insertions(+), 4 deletions(-)

diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 200ea95..a31384a 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana
+++ ger.c
@@ -2,7 +2,7 @@
   This file include all platform action which can be customized
   by IBV/OEM.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, 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,6 +16,63 @@ 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "PlatformBootManager.h"
 #include "PlatformConsole.h"
 
+VOID
+EFIAPI
+InternalBdsEmptyCallbackFuntion (
+  IN EFI_EVENTEvent,
+  IN VOID *Context
+  )
+{
+  return;
+}
+
+VOID
+InstallReadyToLock (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+  EFI_HANDLEHandle;
+  EFI_SMM_ACCESS2_PROTOCOL  *SmmAccess;
+  EFI_EVENT EndOfDxeEvent;
+
+  DEBUG((DEBUG_INFO,"InstallReadyToLock  entering..\n"));  //  // 
+ Inform the SMM infrastructure that we're entering BDS and may run 3rd 
+ party code hereafter  // Since PI1.2.1, we need signal EndOfDxe as 
+ ExitPmAuth  //  Status = gBS->CreateEventEx (
+  EVT_NOTIFY_SIGNAL,
+  TPL_CALLBACK,
+  InternalBdsEmptyCallbackFuntion,
+  NULL,
+  ,
+  
+  );
+  ASSERT_EFI_ERROR (Status);
+  gBS->SignalEvent (EndOfDxeEvent);
+  gBS->CloseEvent (EndOfDxeEvent);
+  DEBUG((DEBUG_INFO,"All EndOfDxe callbacks have returned 
+ successfully\n"));
+
+  //
+  // Install DxeSmmReadyToLock protocol in order to lock SMM  //  
+ Status = gBS->LocateProtocol (, NULL, (VOID 
+ **) );  if (!EFI_ERROR (Status)) {
+Handle = NULL;
+Status = gBS->InstallProtocolInterface (
+,
+,
+EFI_NATIVE_INTERFACE,
+NULL
+);
+ASSERT_EFI_ERROR (Status);
+  }
+
+  DEBUG((DEBUG_INFO,"InstallReadyToLock  end\n"));
+  return;
+}
+
 /**
   Return the index of the load option in the load option array.
 
@@ -147,6 +204,12 @@ PlatformBootManagerBeforeConsole (
   // Register UEFI Shell
   //
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
+
+  //
+  // Install ready to lock.
+  // This needs to be done before option rom dispatched.
+  //
+  InstallReadyToLock ();
 }
 
 /**
diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
index 36f53fd..90811ff 100644
--- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
+++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana
+++ ger.h
@@ -1,7 +1,7 @@
 /**@file
Head file for BDS Platform specific code
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, 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 @@ -32,7 +32,7 @@ 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
-
+#include 
 
 typedef struct {
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath; diff --git 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 475c65d..9e8ae9b 100644
--- 
a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ 

[edk2] [PATCH 41/47] ShellPkg/UefiDpLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 ShellPkg/Library/UefiDpLib/DpTrace.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c 
b/ShellPkg/Library/UefiDpLib/DpTrace.c
index f3f781fdb989..eca2ef309bbc 100644
--- a/ShellPkg/Library/UefiDpLib/DpTrace.c
+++ b/ShellPkg/Library/UefiDpLib/DpTrace.c
@@ -220,8 +220,8 @@ DumpAllTrace(
   ++Count;// Count the number of records printed
 
   // If Handle is non-zero, see if we can determine a name for the driver
-  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
(mGaugeString) / sizeof (mGaugeString[0])); // Use Module by default
-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
(mGaugeString)); // Use Module by default
+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
   if (Measurement.Handle != NULL) {
 // See if the Handle is in the HandleBuffer
 for (TIndex = 0; TIndex < HandleCount; TIndex++) {
@@ -595,7 +595,7 @@ ProcessHandles(
 continue;
   }
   mGaugeString[0] = 0;// Empty driver name by default
-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
   // See if the Handle is in the HandleBuffer
   for (Index = 0; Index < HandleCount; Index++) {
 if (Measurement.Handle == HandleBuffer[Index]) {
@@ -776,8 +776,8 @@ ProcessGlobal(
   ,
   )) != 0)
   {
-AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
(mGaugeString) / sizeof (mGaugeString[0]));
-AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
(mGaugeString));
+AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
 mGaugeString[25] = 0;
 mUnicodeToken[31] = 0;
 if ( ! ( IsPhase( )  ||
-- 
2.9.2


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


[edk2] [PATCH 43/47] Vlv2TbltDevicePkg/FirmwareUpdate: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: David Wei 
Cc: Tim He 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c 
b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c
index 16629bf93bf3..8e44224e6779 100644
--- a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c
+++ b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c
@@ -34,7 +34,7 @@ FV_REGION_INFO mRegionInfo[] = {
   {FixedPcdGet32 (PcdBiosRomBase), FixedPcdGet32 (PcdBiosRomSize), TRUE}
 };
 
-UINTN mRegionInfoCount = sizeof (mRegionInfo) / sizeof (mRegionInfo[0]);
+UINTN mRegionInfoCount = ARRAY_SIZE (mRegionInfo);
 
 FV_INPUT_DATA mInputData = {0};
 
-- 
2.9.2


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


[edk2] [PATCH 44/47] Vlv2TbltDevicePkg/PlatformInitPei: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
M: David Wei 
M: Tim He 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c 
b/Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c
index 282faa85ffb6..54ad42bb27a0 100644
--- a/Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c
+++ b/Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c
@@ -72,7 +72,7 @@ static EFI_FLASH_AREA_DATA  mFlashAreaData[]  = {
 
 };
 
-#define NUM_FLASH_AREA_DATA (sizeof (mFlashAreaData) / sizeof 
(mFlashAreaData[0]))
+#define NUM_FLASH_AREA_DATA (ARRAY_SIZE (mFlashAreaData))
 
 /**
   Build GUID HOBs for platform specific flash map.
-- 
2.9.2


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


[edk2] [PATCH 42/47] ShellPkg/UefiShellLevel2CommandsLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c 
b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
index 3ebc72a0afa8..5383cffe879c 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
@@ -942,7 +942,7 @@ ShellCommandRunTimeZone (
 //
 if (ShellCommandLineGetFlag (Package, L"-f")) {
   for ( LoopVar = 0
-  ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0])
+  ; LoopVar < ARRAY_SIZE (TimeZoneList)
   ; LoopVar++
  ){
 if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
-- 
2.9.2


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


[edk2] [PATCH 37/47] OvmfPkg/QemuBootOrderLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c 
b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index 8cbbdb0568fa..567f6f92f452 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -707,7 +707,7 @@ TranslatePciOfwNodes (
   // Parse the OFW nodes starting with the first non-bridge node.
   //
   PciDevFun[1] = 0;
-  NumEntries = sizeof (PciDevFun) / sizeof (PciDevFun[0]);
+  NumEntries = ARRAY_SIZE (PciDevFun);
   if (ParseUnitAddressHexList (
 OfwNode[FirstNonBridge].UnitAddress,
 PciDevFun,
@@ -910,7 +910,7 @@ TranslatePciOfwNodes (
 UINT64 TargetLun[2];
 
 TargetLun[1] = 0;
-NumEntries = sizeof (TargetLun) / sizeof (TargetLun[0]);
+NumEntries = ARRAY_SIZE (TargetLun);
 if (ParseUnitAddressHexList (
   OfwNode[FirstNonBridge + 2].UnitAddress,
   TargetLun,
@@ -958,7 +958,7 @@ TranslatePciOfwNodes (
 UINTN  RequiredEntries;
 UINT8  *Eui64;
 
-RequiredEntries = sizeof (Namespace) / sizeof (Namespace[0]);
+RequiredEntries = ARRAY_SIZE (Namespace);
 NumEntries = RequiredEntries;
 if (ParseUnitAddressHexList (
   OfwNode[FirstNonBridge + 1].UnitAddress,
@@ -1145,7 +1145,7 @@ TranslateMmioOfwNodes (
 UINT64 TargetLun[2];
 
 TargetLun[1] = 0;
-NumEntries = sizeof (TargetLun) / sizeof (TargetLun[0]);
+NumEntries = ARRAY_SIZE (TargetLun);
 if (ParseUnitAddressHexList (
   OfwNode[2].UnitAddress,
   TargetLun,
@@ -1803,7 +1803,7 @@ SetBootOrderFromQemu (
   //
   // translate each OpenFirmware path
   //
-  TranslatedSize = sizeof (Translated) / sizeof (Translated[0]);
+  TranslatedSize = ARRAY_SIZE (Translated);
   Status = TranslateOfwPath (, ExtraPciRoots, Translated,
  );
   while (Status == RETURN_SUCCESS ||
@@ -1835,7 +1835,7 @@ SetBootOrderFromQemu (
   } // scanned all active boot options
 }   // translation successful
 
-TranslatedSize = sizeof (Translated) / sizeof (Translated[0]);
+TranslatedSize = ARRAY_SIZE (Translated);
 Status = TranslateOfwPath (, ExtraPciRoots, Translated,
);
   } // scanning of OpenFirmware paths done
-- 
2.9.2


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


[edk2] [PATCH 47/47] Vlv2TbltDevicePkg/SmBiosMiscDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: David Wei 
Cc: Tim He 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c 
b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c
index 898fc7cf0db3..657d19a6e757 100644
--- a/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c
+++ b/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c
@@ -691,7 +691,7 @@ UpdatePlatformInformation (
 );
 
  Data8 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_RID_CC);
- count = sizeof (SBRevisionTable) / sizeof (SBRevisionTable[0]);
+ count = ARRAY_SIZE (SBRevisionTable);
  for (Index = 0; Index < count; Index++) {
if(Data8 == SBRevisionTable[Index].RevId) {
   UnicodeSPrint (Buffer, sizeof (Buffer), L"%02x %a", Data8, 
SBRevisionTable[Index].String);
-- 
2.9.2

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


[edk2] [PATCH 46/47] Vlv2TbltDevicePkg/PlatformSetupDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: David Wei 
Cc: Tim He 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c 
b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
index 3cdb0132cd04..b0e29f02d067 100644
--- a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
+++ b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
@@ -1371,7 +1371,7 @@ UpdatePlatformInformation (
 );
 
  Data8 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_RID_CC);
- count = sizeof (SBRevisionTable) / sizeof (SBRevisionTable[0]);
+ count = ARRAY_SIZE (SBRevisionTable);
  for (Index = 0; Index < count; Index++) {
if(Data8 == SBRevisionTable[Index].RevId) {
   UnicodeSPrint (Buffer, sizeof (Buffer), L"%02x %a", Data8, 
SBRevisionTable[Index].String);
-- 
2.9.2


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


[edk2] [PATCH 39/47] PerformancePkg/Dp_App: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Daryl McDaniel 
Cc: Jaben Carsey 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 PerformancePkg/Dp_App/Dp.c  |  2 +-
 PerformancePkg/Dp_App/DpTrace.c | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
index 6890a99c2937..26a3ebcd1d07 100644
--- a/PerformancePkg/Dp_App/Dp.c
+++ b/PerformancePkg/Dp_App/Dp.c
@@ -114,7 +114,7 @@ InitialShellParamList( void )
   //
   // Allocate one more for the end tag.
   //
-  ListLength = sizeof (ParamList) / sizeof (ParamList[0]) + 1;  
+  ListLength = ARRAY_SIZE (ParamList) + 1;  
   DpParamList = AllocatePool (sizeof (SHELL_PARAM_ITEM) * ListLength);
   ASSERT (DpParamList != NULL);
   
diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c
index 256f7462838c..6a62bba7efe0 100644
--- a/PerformancePkg/Dp_App/DpTrace.c
+++ b/PerformancePkg/Dp_App/DpTrace.c
@@ -220,8 +220,8 @@ DumpAllTrace(
   ++Count;// Count the number of records printed
 
   // If Handle is non-zero, see if we can determine a name for the driver
-  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
(mGaugeString) / sizeof (mGaugeString[0])); // Use Module by default
-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+  AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
(mGaugeString)); // Use Module by default
+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
   if (Measurement.Handle != NULL) {
 // See if the Handle is in the HandleBuffer
 for (TIndex = 0; TIndex < HandleCount; TIndex++) {
@@ -594,7 +594,7 @@ ProcessHandles(
 continue;
   }
   mGaugeString[0] = 0;// Empty driver name by default
-  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+  AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
   // See if the Handle is in the HandleBuffer
   for (Index = 0; Index < HandleCount; Index++) {
 if (Measurement.Handle == HandleBuffer[Index]) {
@@ -777,8 +777,8 @@ ProcessGlobal(
   ,
   )) != 0)
   {
-AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof 
(mGaugeString) / sizeof (mGaugeString[0]));
-AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof 
(mUnicodeToken) / sizeof (mUnicodeToken[0]));
+AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE 
(mGaugeString));
+AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE 
(mUnicodeToken));
 mGaugeString[25] = 0;
 mUnicodeToken[31] = 0;
 if ( ! ( IsPhase( )  ||
-- 
2.9.2


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


[edk2] [PATCH 40/47] SecurityPkg/AuthVariableLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Chao Zhang 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
index c4fbb649f1fd..792a1232aed9 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c
@@ -421,7 +421,7 @@ AuthVariableLibInitialize (
   AuthVarLibContextOut->StructVersion = 
AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION;
   AuthVarLibContextOut->StructSize = sizeof (AUTH_VAR_LIB_CONTEXT_OUT);
   AuthVarLibContextOut->AuthVarEntry = mAuthVarEntry;
-  AuthVarLibContextOut->AuthVarEntryCount = sizeof (mAuthVarEntry) / sizeof 
(mAuthVarEntry[0]);
+  AuthVarLibContextOut->AuthVarEntryCount = ARRAY_SIZE (mAuthVarEntry);
   mAuthVarAddressPointer[0] = (VOID **) 
   mAuthVarAddressPointer[1] = (VOID **) 
   mAuthVarAddressPointer[2] = (VOID **) 
@@ -433,7 +433,7 @@ AuthVariableLibInitialize (
   mAuthVarAddressPointer[8] = (VOID **) 
&(mAuthVarLibContextIn->CheckRemainingSpaceForConsistency),
   mAuthVarAddressPointer[9] = (VOID **) &(mAuthVarLibContextIn->AtRuntime),
   AuthVarLibContextOut->AddressPointer = mAuthVarAddressPointer;
-  AuthVarLibContextOut->AddressPointerCount = sizeof (mAuthVarAddressPointer) 
/ sizeof (mAuthVarAddressPointer[0]);
+  AuthVarLibContextOut->AddressPointerCount = ARRAY_SIZE 
(mAuthVarAddressPointer);
 
   return Status;
 }
-- 
2.9.2


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


[edk2] [PATCH 45/47] Vlv2TbltDevicePkg/PlatformPei: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: David Wei 
Cc: Tim He 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Vlv2TbltDevicePkg/PlatformPei/BootMode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPei/BootMode.c 
b/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
index 4d933a09db0e..95be1c0f2851 100644
--- a/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
+++ b/Vlv2TbltDevicePkg/PlatformPei/BootMode.c
@@ -372,13 +372,13 @@ PrioritizeBootMode (
   // Find the position of the current boot mode in our priority array
   //
   for ( CurrentIndex = 0;
-CurrentIndex < sizeof (mBootModePriority) / sizeof 
(mBootModePriority[0]);
+CurrentIndex < ARRAY_SIZE (mBootModePriority);
 CurrentIndex++) {
 if (mBootModePriority[CurrentIndex] == *CurrentBootMode) {
   break;
 }
   }
-  if (CurrentIndex >= sizeof (mBootModePriority) / sizeof 
(mBootModePriority[0])) {
+  if (CurrentIndex >= ARRAY_SIZE (mBootModePriority)) {
 return EFI_NOT_FOUND;
   }
 
@@ -386,7 +386,7 @@ PrioritizeBootMode (
   // Find the position of the new boot mode in our priority array
   //
   for ( NewIndex = 0;
-NewIndex < sizeof (mBootModePriority) / sizeof (mBootModePriority[0]);
+NewIndex < ARRAY_SIZE (mBootModePriority);
 NewIndex++) {
 if (mBootModePriority[NewIndex] == NewBootMode) {
   //
-- 
2.9.2


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


[edk2] [PATCH 35/47] Nt32Pkg/WinNtSerialIoDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c 
b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
index 0dc031393e71..23d3329d9db1 100644
--- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
+++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
@@ -984,7 +984,7 @@ Returns:
   //The lower baud rate supported by the serial device will be selected 
without exceeding the unsupported BaudRate parameter
   // 
   
-  for (Index = 1; Index < (sizeof (mBaudRateCurrentSupport) / sizeof 
(mBaudRateCurrentSupport[0])); Index++) {
+  for (Index = 1; Index < (ARRAY_SIZE (mBaudRateCurrentSupport)); Index++) {
 if (BaudRate < mBaudRateCurrentSupport[Index]) {
   BaudRate = mBaudRateCurrentSupport[Index-1];
   break;
-- 
2.9.2


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


[edk2] [PATCH 36/47] OptionRomPkg/AtapiPassThruDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Ruiyu Ni 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c 
b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
index 3578a1e4459c..e2654e5c2566 100644
--- a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
+++ b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
@@ -1752,7 +1752,7 @@ Returns:
   UINT8 ArrayLen;
 
   OpCode = (UINT8 *) (Packet->Cdb);
-  ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof 
(gSupportedATAPICommands[0]));
+  ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands));
 
   for (Index = 0; (Index < ArrayLen) && (CompareMem 
([Index], , sizeof (SCSI_COMMAND_SET)) != 0); 
Index++) {
 
@@ -1995,7 +1995,7 @@ Returns:
   UINT8 ArrayLen;
 
   OpCode = (UINT8 *) (Packet->Cdb);
-  ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof 
(gSupportedATAPICommands[0]));
+  ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands));
 
   for (Index = 0; (Index < ArrayLen) && (CompareMem 
([Index], , sizeof (SCSI_COMMAND_SET)) != 0); 
Index++) {
 
-- 
2.9.2


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


[edk2] [PATCH 38/47] OvmfPkg/QemuVideoDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Jordan Justen 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/QemuVideoDxe/Initialize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c 
b/OvmfPkg/QemuVideoDxe/Initialize.c
index 98ca4f8488fe..d5d8cfef9661 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -155,7 +155,7 @@ QEMU_VIDEO_CIRRUS_MODES  QemuVideoCirrusModes[] = {
 };
 
 #define QEMU_VIDEO_CIRRUS_MODE_COUNT \
-  (sizeof (QemuVideoCirrusModes) / sizeof (QemuVideoCirrusModes[0]))
+  (ARRAY_SIZE (QemuVideoCirrusModes))
 
 /**
   Construct the valid video modes for QemuVideo.
@@ -247,7 +247,7 @@ QEMU_VIDEO_BOCHS_MODES  QemuVideoBochsModes[] = {
 };
 
 #define QEMU_VIDEO_BOCHS_MODE_COUNT \
-  (sizeof (QemuVideoBochsModes) / sizeof (QemuVideoBochsModes[0]))
+  (ARRAY_SIZE (QemuVideoBochsModes))
 
 EFI_STATUS
 QemuVideoBochsModeSetup (
-- 
2.9.2


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


[edk2] [PATCH 32/47] MdeModulePkg/Variable/RuntimeDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 8a9f4482b5aa..f5b6a5f93ea6 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -4017,7 +4017,7 @@ VariableWriteServiceInitialize (
   }
 
   if (!EFI_ERROR (Status)) {
-for (Index = 0; Index < sizeof (mVariableEntryProperty) / sizeof 
(mVariableEntryProperty[0]); Index++) {
+for (Index = 0; Index < ARRAY_SIZE (mVariableEntryProperty); Index++) {
   VariableEntry = [Index];
   Status = VarCheckLibVariablePropertySet (VariableEntry->Name, 
VariableEntry->Guid, >VariableProperty);
   ASSERT_EFI_ERROR (Status);
-- 
2.9.2


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


[edk2] [PATCH 34/47] NetworkPkg/TcpDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 NetworkPkg/TcpDxe/TcpOutput.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c
index 91e56d369a71..a46cb6099ea8 100644
--- a/NetworkPkg/TcpDxe/TcpOutput.c
+++ b/NetworkPkg/TcpDxe/TcpOutput.c
@@ -797,7 +797,7 @@ TcpToSendData (
 Len   = TcpDataToSend (Tcb, Force);
 Seq   = Tcb->SndNxt;
 
-ASSERT ((Tcb->State) < (sizeof (mTcpOutFlag) / sizeof (mTcpOutFlag[0])));
+ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag)));
 Flag  = mTcpOutFlag[Tcb->State];
 
 if ((Flag & TCP_FLG_SYN) != 0) {
-- 
2.9.2


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


[edk2] [PATCH 33/47] NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 4 ++--
 NetworkPkg/IScsiDxe/IScsiDriver.c | 2 +-
 NetworkPkg/IScsiDxe/IScsiMisc.c   | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 3631e72e3455..16a90a6206aa 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -,7 +,7 @@ IScsiConfigUpdateAttempt (
   NET_LIST_FOR_EACH (Entry, >AttemptConfigs) {
 AttemptConfigData = NET_LIST_USER_STRUCT (Entry, 
ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
 
-AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName, sizeof 
(AttemptName) / sizeof (AttemptName[0]));
+AsciiStrToUnicodeStrS (AttemptConfigData->AttemptName, AttemptName, 
ARRAY_SIZE (AttemptName));
 UnicodeSPrint (mPrivate->PortString, (UINTN) 128, L"Attempt %s", 
AttemptName);
 AttemptConfigData->AttemptTitleToken = HiiSetString (
  mCallbackInfo->RegisteredHandle,
@@ -1240,7 +1240,7 @@ IScsiConfigDeleteAttempts (
   mPrivate->SinglePathCount--;
 }
 
-AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof 
(MacString) / sizeof (MacString[0]));
+AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, ARRAY_SIZE 
(MacString));
 
 UnicodeSPrint (
   mPrivate->PortString,
diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c 
b/NetworkPkg/IScsiDxe/IScsiDriver.c
index 279f1c049679..ac10fa26d1b9 100644
--- a/NetworkPkg/IScsiDxe/IScsiDriver.c
+++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
@@ -673,7 +673,7 @@ IScsiStart (
 Session->ConfigData = AttemptConfigData;
 Session->AuthType   = AttemptConfigData->AuthenticationType;
 
-AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof 
(MacString) / sizeof (MacString[0]));
+AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, ARRAY_SIZE 
(MacString));
 UnicodeSPrint (
   mPrivate->PortString,
   (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index 64bb2ade7b0a..11a80f2e10e4 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1109,7 +1109,7 @@ IScsiGetConfigData (
   //
   // Refresh the state of this attempt to NVR.
   //
-  AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof 
(MacString) / sizeof (MacString[0]));
+  AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, ARRAY_SIZE 
(MacString));
   UnicodeSPrint (
 mPrivate->PortString,
 (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
@@ -1148,7 +1148,7 @@ IScsiGetConfigData (
 //
 // Refresh the state of this attempt to NVR.
 //
-AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, sizeof 
(MacString) / sizeof (MacString[0]));
+AsciiStrToUnicodeStrS (AttemptTmp->MacString, MacString, ARRAY_SIZE 
(MacString));
 UnicodeSPrint (
   mPrivate->PortString,
   (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
@@ -1239,7 +1239,7 @@ IScsiGetConfigData (
   //
   // Refresh the state of this attempt to NVR.
   //
-  AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, sizeof 
(MacString) / sizeof (MacString[0]));
+  AsciiStrToUnicodeStrS (AttemptConfigData->MacString, MacString, 
ARRAY_SIZE (MacString));
   UnicodeSPrint (
 mPrivate->PortString,
 (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
-- 
2.9.2


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


[edk2] [PATCH 31/47] MdeModulePkg/Tcp4Dxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
index b984ac069ee2..0eec8f07b922 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
@@ -754,7 +754,7 @@ SEND_AGAIN:
   Len   = TcpDataToSend (Tcb, Force);
   Seq   = Tcb->SndNxt;
 
-  ASSERT ((Tcb->State) < (sizeof (mTcpOutFlag) / sizeof (mTcpOutFlag[0])));
+  ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag)));
   Flag  = mTcpOutFlag[Tcb->State];
 
   if ((Flag & TCP_FLG_SYN) != 0) {
-- 
2.9.2


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


[edk2] [PATCH 30/47] MdeModulePkg/EbcDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Universal/EbcDxe/EbcExecute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c 
b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
index 433eea250f7f..d9c17f48a038 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
@@ -4216,7 +4216,7 @@ ExecuteDataManip (
   //
   DataManipDispatchTableIndex = (Opcode & OPCODE_M_OPCODE) - OPCODE_NOT;
   if ((DataManipDispatchTableIndex < 0) ||
-  (DataManipDispatchTableIndex >= sizeof (mDataManipDispatchTable) / 
sizeof (mDataManipDispatchTable[0]))) {
+  (DataManipDispatchTableIndex >= ARRAY_SIZE (mDataManipDispatchTable))) {
 EbcDebugSignalException (
   EXCEPT_EBC_INVALID_OPCODE,
   EXCEPTION_FLAG_ERROR,
-- 
2.9.2


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


[edk2] [PATCH 29/47] MdeModulePkg/DisplayEngineDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Feng Tian 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c  | 4 ++--
 MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 8531d0ee06c6..b37c1cc2e4aa 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -49,7 +49,7 @@ SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
   }
 };
 
-UINTN mScanCodeNumber = sizeof (gScanCodeToOperation) / sizeof 
(gScanCodeToOperation[0]);
+UINTN mScanCodeNumber = ARRAY_SIZE (gScanCodeToOperation);
 
 SCREEN_OPERATION_T0_CONTROL_FLAG  gScreenOperationToControlFlag[] = {
   {
@@ -3248,7 +3248,7 @@ UiDisplayMenu (
   }
 
   for (Index = 0;
-   Index < sizeof (gScreenOperationToControlFlag) / sizeof 
(gScreenOperationToControlFlag[0]);
+   Index < ARRAY_SIZE (gScreenOperationToControlFlag);
Index++
   ) {
 if (ScreenOperation == 
gScreenOperationToControlFlag[Index].ScreenOperation) {
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c 
b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index 8e7b735c7063..400b93427caa 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -1070,14 +1070,14 @@ EnterCarriageReturn:
 
   if (ValidateFail) {
 UpdateStatusBar (INPUT_ERROR, TRUE);
-ASSERT (Count < sizeof (PreviousNumber) / sizeof 
(PreviousNumber[0]));
+ASSERT (Count < ARRAY_SIZE (PreviousNumber));
 EditValue = PreviousNumber[Count];
 break;
   }
 } else {
   if (EditValue > Maximum) {
 UpdateStatusBar (INPUT_ERROR, TRUE);
-ASSERT (Count < sizeof (PreviousNumber) / sizeof 
(PreviousNumber[0]));
+ASSERT (Count < ARRAY_SIZE (PreviousNumber));
 EditValue = PreviousNumber[Count];
 break;
   }
@@ -1086,7 +1086,7 @@ EnterCarriageReturn:
 UpdateStatusBar (INPUT_ERROR, FALSE);
 
 Count++;
-ASSERT (Count < (sizeof (PreviousNumber) / sizeof 
(PreviousNumber[0])));
+ASSERT (Count < (ARRAY_SIZE (PreviousNumber)));
 PreviousNumber[Count] = EditValue;
 
 gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
-- 
2.9.2


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


[edk2] [PATCH 27/47] MdeModulePkg/Logo: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Logo/Logo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Logo/Logo.c b/MdeModulePkg/Logo/Logo.c
index f0792addd3a9..313dd4a7937d 100644
--- a/MdeModulePkg/Logo/Logo.c
+++ b/MdeModulePkg/Logo/Logo.c
@@ -69,7 +69,7 @@ GetImage (
   }
 
   Current = *Instance;
-  if (Current >= sizeof (mLogos) / sizeof (mLogos[0])) {
+  if (Current >= ARRAY_SIZE (mLogos)) {
 return EFI_NOT_FOUND;
   }
 
-- 
2.9.2


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


[edk2] [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c  | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
index f086764f24da..050647d8f186 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
@@ -632,7 +632,7 @@ BmGetBootDescription (
   // Firstly get the default boot description
   //
   DefaultDescription = NULL;
-  for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof 
(mBmBootDescriptionHandlers[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
 DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
 if (DefaultDescription != NULL) {
   //
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
index a13917bd0844..43895e10f85b 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
@@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable (
   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
   EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;
 
-  if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) {
+  if (ConsoleType >= ARRAY_SIZE (mConVarName)) {
 return EFI_INVALID_PARAMETER;
   }
 
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
index 55df7e9a5f31..35131a94f61d 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
@@ -680,7 +680,7 @@ BmProcessKeyOption (
 
   KeyShiftStateCount = 0;
   BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, 
KeyShiftStates, );
-  ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof 
(KeyShiftStates[0]));
+  ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates));
 
   EfiAcquireLock ();
 
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 9af98de0afaf..e638e5fc67e6 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
 return FALSE;
   }
 
-  for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof 
(mBmLoadOptionName[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) {
 if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) &&
 (StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 4) 
== 0)
 ) {
@@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
 }
   }
 
-  if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) {
+  if (Index == ARRAY_SIZE (mBmLoadOptionName)) {
 return FALSE;
   }
 
-- 
2.9.2


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


[edk2] [PATCH 28/47] MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index c86cd7a576ad..aacc4a64794d 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -654,7 +654,7 @@ BdsEntry (
   Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
   DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", 
Status));
   if (!EFI_ERROR (Status)) {
-for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof 
(mReadOnlyVariables[0]); Index++) {
+for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
   Status = VariableLock->RequestToLock (VariableLock, 
mReadOnlyVariables[Index], );
   ASSERT_EFI_ERROR (Status);
 }
-- 
2.9.2


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


[edk2] [PATCH 24/47] MdeModulePkg/BootManagerUiLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Feng Tian 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Library/BootManagerUiLib/BootManager.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c 
b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
index cab38ca28087..bf872f867e08 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
@@ -343,7 +343,7 @@ GroupMultipleLegacyBootOption4SameType (
   // Legacy Boot Option
   //
   DEBUG ((EFI_D_ERROR, "[BootManagerDxe]  Find Legacy Boot Option  
0x%x!  \n", Index));
-  ASSERT BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 
0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]));
+  ASSERT BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 
0xF) < ARRAY_SIZE (DeviceTypeIndex));
   NextIndex = [((BBS_BBS_DEVICE_PATH *) 
BootOption.FilePath)->DeviceType & 0xF];
 
   if (*NextIndex == (UINTN) -1) {
@@ -362,7 +362,7 @@ GroupMultipleLegacyBootOption4SameType (
 //
 // Update the DeviceTypeIndex array to reflect the right shift 
operation
 //
-for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof 
(DeviceTypeIndex[0]); DeviceIndex++) {
+for (DeviceIndex = 0; DeviceIndex < ARRAY_SIZE (DeviceTypeIndex); 
DeviceIndex++) {
   if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && 
DeviceTypeIndex[DeviceIndex] >= *NextIndex) {
 DeviceTypeIndex[DeviceIndex]++;
   }
@@ -526,7 +526,7 @@ UpdateBootManager (
  HiiHandle,
  0,
  mDeviceTypeStr[
-   MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof 
(mDeviceTypeStr[0]) - 1)
+   MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1)
],
  NULL
  );
-- 
2.9.2


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


  1   2   >