]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
7 years agoIntelFsp2Pkg: Only include required header files in FspEas.h
Maurice Ma [Fri, 5 Aug 2016 03:56:57 +0000 (20:56 -0700)]
IntelFsp2Pkg: Only include required header files in FspEas.h

Current FspEas.h file includes Uefi.h which also refers to lots of other
UEFI header files not used by FSP consumer. It caused many unnecessary
header file overhead for a bootloader that consumes FSP, such as coreboot.
This change reduces the required header file number down to 3.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed by: Giri P Mudusuru <giri.p.mudusuru@intel.com>

7 years agoBaseTools GCC/ARM: add -fno-builtin to CC flags
Ard Biesheuvel [Thu, 4 Aug 2016 14:39:59 +0000 (16:39 +0200)]
BaseTools GCC/ARM: add -fno-builtin to CC flags

Avoid build errors when including OpensslLib, which may throw
undefined reference errors for builtin functions if -fno-builtin
is not specified (and it is already set for IA32, X64 and AARCH64)
So set it for ARM as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmPkg/CompilerIntrinsicsLib: make the default memset() weak
Ard Biesheuvel [Thu, 4 Aug 2016 14:37:13 +0000 (16:37 +0200)]
ArmPkg/CompilerIntrinsicsLib: make the default memset() weak

The ARM compiler intrinsics library defines __aeabi_memset() and
memset() in the same object, which means that both will be pulled
in if either is referenced.

The IntrinsicLib in CryptoPkg defines its own, preferred memset(),
which may clash with our memset(). So make our version weak.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPkg/ArmSoftFloatLib: disable LTO build for GCC
Ard Biesheuvel [Thu, 4 Aug 2016 14:32:16 +0000 (16:32 +0200)]
ArmPkg/ArmSoftFloatLib: disable LTO build for GCC

Building ArmSoftFloatLib with LTO results in errors like

  .../bin/ld: softfloat.obj: plugin needed to handle lto object
  .../bin/ld: __aeabi_dcmpge.obj: plugin needed to handle lto object
  .../bin/ld: __aeabi_dcmplt.obj: plugin needed to handle lto object
  .../bin/ld: internal error ../../ld/ldlang.c 6299

This library is only linked by OpensslLib at the moment, and only
marginally used at runtime, so just disable LTO for it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPlatformPkg: change PcdBdsLinuxSupport default value
Daniil Egranov [Wed, 3 Aug 2016 23:10:48 +0000 (18:10 -0500)]
ArmPlatformPkg: change PcdBdsLinuxSupport default value

The built-in Linux Loader is obsolete and not included in most builds.
The patch sets the PcdBdsLinuxSupport default value to FALSE and prevents
ArmBds from looking for built-in Linux Loader by default and ASSERTing
when it cannot be found. Platforms which still using built-in loader have
to set this PCD in their platform description file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoCorebootModulePkg/SecCore: Adding NASM files in SecCore module
Ma, Maurice [Tue, 2 Aug 2016 19:56:56 +0000 (12:56 -0700)]
CorebootModulePkg/SecCore: Adding NASM files in SecCore module

Ported MASM/GAS assembly files into NASM files and updated the inf
file to refer to NASM files.

This change has been tested with GCC 4.8 and VS2013 build.

Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Lee Leahy <leroy.p.leahy@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Prince Agyeman <prince.agyeman@intel.com>
7 years agoBaseTools GCC: add the compiler flags to the linker command line
Ard Biesheuvel [Tue, 2 Aug 2016 14:31:26 +0000 (16:31 +0200)]
BaseTools GCC: add the compiler flags to the linker command line

Now that we invoke GCC as the linker for the GCC toolchain family,
we can pass the CC flags to the linker as well. This is only
required for LTO (which may involve code generation during the link
stage), but does not interfere with non-LTO builds.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools GCC5: disable warnings-as-errors for now
Ard Biesheuvel [Tue, 2 Aug 2016 14:15:31 +0000 (16:15 +0200)]
BaseTools GCC5: disable warnings-as-errors for now

GCC5 runs in LTO mode, which means it may generate code from an
intermediate representation during the link stage, at which time
additional diagnostics are run that may emit warnings.

Some of these warnings seem to be spurious, e.g., the following
warning which is emitted when building OVMF for IA32 or ArmVirtQemu
for ARM (but not for X64 resp. AARCH64)

  .../MdeModulePkg/Library/UefiHiiLib/HiiLib.c:
                 In function 'HiiCreateGuidOpCode.constprop':
  .../MdeModulePkg/Library/UefiHiiLib/HiiLib.c:3228:10:
                 error: function may return address of local variable
                                            [-Werror=return-local-addr]
     return (UINT8 *)OpCodePointer;
            ^
  .../MdeModulePkg/Library/UefiHiiLib/HiiLib.c:3208:17: note: declared here
     EFI_IFR_GUID  OpCode;
                   ^
  lto1: all warnings being treated as errors
  lto-wrapper: fatal error: gcc returned 1 exit status

So before adding the contents of CC_FLAGS to the linker command line,
defuse the default '-Werror' by adding '-Wno-error' to DLINK2_FLAGS
for GCC5.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools GCC: move -c compiler flag to build rules
Ard Biesheuvel [Tue, 2 Aug 2016 13:38:58 +0000 (15:38 +0200)]
BaseTools GCC: move -c compiler flag to build rules

In order to be able to share the compiler flags with the linker (which
is required for LTO since it involves the linker doing code generation
based on the LTO bytecode), move the -c GCC argument to the build rules,
and drop it from the GCC CC_FLAGS definitions in tools_def.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmVirtPkg ARM: make relocatable PrePi users build with CLANG35
Ard Biesheuvel [Wed, 3 Aug 2016 08:11:29 +0000 (10:11 +0200)]
ArmVirtPkg ARM: make relocatable PrePi users build with CLANG35

The clang developers have made a backward incompatible change to the
command line arguments, and have replaced '-mllvm -arm-use-movt=0'
with '-mno-movt'. This does not matter for most ARM platforms, and
therefore it has been removed from the default CLANG35/ARM CC flags
in patch 1c63516075b3 ("BaseTools CLANG35: drop problematic use-movt
and save-temps options"), but as it turns out, the relocatable PrePi
implementation used by ArmVirtQemuKernel and ArmVirtXen will fail to
build if it contains MOVT/MOVW pairs, due to the fact that these are
not runtime relocatable under ELF.

Since they are runtime relocatable under PE/COFF, and GenFw does the
right thing when encountering them, selectively controlling their
use is more appropriate than disabling them altogether. Therefore,
this patch adds the -mno-movt argument only for the platforms that
use the relocatable PrePi, and only for the module types that may
be pulled into its build.

In addition, switch to the SEC type version of ArmLib, so that
the relocatable PrePi only depends on BASE and SEC type libraries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoEmbeddedPkg: make PrePiMemoryAllocationLib a SEC type library
Ard Biesheuvel [Wed, 3 Aug 2016 08:10:17 +0000 (10:10 +0200)]
EmbeddedPkg: make PrePiMemoryAllocationLib a SEC type library

This library is only used by the various PrePi implementations, all of
which are of type SEC. So make this library SEC as well. This may affect
the build options used by the platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoVlv2TbltDevicePkg/FvbRuntimeDxe: Remove unused variables
Gary Lin [Fri, 22 Jul 2016 09:47:12 +0000 (17:47 +0800)]
Vlv2TbltDevicePkg/FvbRuntimeDxe: Remove unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c: In function ‘FvbWriteBlock’:
Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c:368:44: error: variable ‘FwhInstance’ set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c: In function ‘FvbEraseBlock’:
Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c:448:44: error: variable ‘FwhInstance’ set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c: In function ‘FvbInitialize’:
Vlv2TbltDevicePkg/FvbRuntimeDxe/FvbService.c:1028:41: error: variable ‘FvHeaderValid’ set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoMdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
Liming Gao [Tue, 2 Aug 2016 05:37:55 +0000 (13:37 +0800)]
MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access

Check NULL pointer before access it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg LoadFileOnFv2: Correct copy right format
Liming Gao [Tue, 2 Aug 2016 02:33:53 +0000 (10:33 +0800)]
MdeModulePkg LoadFileOnFv2: Correct copy right format

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg UefiBootManagerLib: Fix VS2012 build failure
Liming Gao [Tue, 2 Aug 2016 02:26:50 +0000 (10:26 +0800)]
MdeModulePkg UefiBootManagerLib: Fix VS2012 build failure

Initialize local variable Description as NULL first.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoVlv2TbltDevicePkg/PpmPolicy: Remove the unused variable
Gary Lin [Fri, 29 Jul 2016 03:25:38 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PpmPolicy: Remove the unused variable

Fix the following error from gcc:

Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c: In function ?PpmPolicyEntry?:
Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c:50:29: error: variable ?MaxRatio? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/PpmPolicy: Remove the usage of global variables
Gary Lin [Fri, 29 Jul 2016 03:25:37 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PpmPolicy: Remove the usage of global variables

gcc issued the error of "multiple deifintion" since gBS was also defined
in MdePkg/Library/UefiBootServicesTableLib. Actually those global variables,
gBS, pBS, and pRS, in PpmPolicy.h were only used in one function. Besides,
gBS and pRS were not really used. Remove gBS and pRS and declare pBS in
PpmPolicyEntry() to satisfy gcc.

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/SmBiosMiscDxe: Remove unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:36 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/SmBiosMiscDxe: Remove unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c: In function ?JudgeHandleIsPCIDevice?:
Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c:164:22: error: variable ?DevicePath? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c: In function ?AddSmbiosT0x90Callback?:
Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c:292:28: error: variable ?ForType90InputData? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c: In function ?MiscProcessorInformationFunction?:
Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c:191:37: error: variable ?SrcDataSize? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c: In function ?MiscProcessorCacheFunction?:
Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c:78:34: error: variable ?SrcDataSize? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/Wpce791: Remove the unused variable
Gary Lin [Fri, 29 Jul 2016 03:25:35 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/Wpce791: Remove the unused variable

Fix the following error from gcc:

Vlv2TbltDevicePkg/Wpce791/LpcDriver.c: In function ?LpcDriverStart?:
Vlv2TbltDevicePkg/Wpce791/LpcDriver.c:239:27: error: variable ?LpcDev? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2TbltDevicePkg/PlatformDxe: Remove the unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:34 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformDxe: Remove the unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/PlatformDxe/Platform.c: In function ?InitPciDevPME?:
Vlv2TbltDevicePkg/PlatformDxe/Platform.c:516:26: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformDxe/Platform.c: In function ?InitThermalZone?:
Vlv2TbltDevicePkg/PlatformDxe/Platform.c:575:26: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformDxe/IchRegTable.c: In function ?InitializeSubsystemIds?:
Vlv2TbltDevicePkg/PlatformDxe/IchRegTable.c:111:10: error: variable ?SubsystemAudioVidDid? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformDxe/PciDevice.c: In function ?InitBadBars?:
Vlv2TbltDevicePkg/PlatformDxe/PciDevice.c:115:40: error: variable ?PciIoDevice? set but not used [-Werror=unused-but-set-variable]
Vlv2TbltDevicePkg/PlatformDxe/PciDevice.c:114:39: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformDxe/PciDevice.c: In function ?ProgramPciLatency?:
Vlv2TbltDevicePkg/PlatformDxe/PciDevice.c:320:39: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/VlvPlatformInitDxe: Remove unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:33 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/VlvPlatformInitDxe: Remove unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c: In function ?GetIntegratedIntelVbtPtr?:
Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c:145:33: error: variable ?VbtSize? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c: In function ?JudgeHandleIsPCIDevice?:
Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c:418:22: error: variable ?DevicePath? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/PlatformSetupDxe: Remove the unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:32 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformSetupDxe: Remove the unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c: In function ?PrepareSetupInformation?:
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:540:31: error: variable ?EeState? set but not used [-Werror=unused-but-set-variable]
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:532:31: error: variable ?SrcDataSize? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c: In function ?UpdateAdditionalInformation?:
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:818:35: error: variable ?Size? set but not used [-Werror=unused-but-set-variable]
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:817:36: error: variable ?SystemManufacturer? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c: In function ?JudgeHandleIsPCIDevice?:
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:1094:22: error: variable ?DevicePath? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c: In function ?GetChipsetSataPortSpeed?:
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:1470:31: error: variable ?DwordReg? set but not used [-Werror=unused-but-set-variable]
Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c:1469:31: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2DeviceRefCodePkg/ValleyView2Soc: Remove the unused code
Gary Lin [Fri, 29 Jul 2016 03:25:30 +0000 (11:25 +0800)]
Vlv2DeviceRefCodePkg/ValleyView2Soc: Remove the unused code

The code in _S3SUPPORT_ in PchAccess.h wasn't used in anywhere. Also,
The declaration of MCRX and MCR made gcc generate the error of
"multiple definition". Just remove the unused code to avoid any
potential issue.

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2TbltDevicePkg/PlatformGopPolicy: include UefiBootServicesTableLib.h
Gary Lin [Fri, 29 Jul 2016 03:25:29 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformGopPolicy: include UefiBootServicesTableLib.h

gBS is already defined in
MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c

Remove the declaration of gBS and include the proper header file to
access the variable.

Suggested-by: David Wei <david.wei@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2TbltDevicePkg/AcpiPlatform: Amend the declaration of mGlobalNvsArea
Gary Lin [Fri, 29 Jul 2016 03:25:28 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/AcpiPlatform: Amend the declaration of mGlobalNvsArea

mGlobalNvsArea wasn't declared as extern in AcpiPlatform.h and the header
was included in AcpiPlatform.c and AcpiPlatformHooks.c. Although it's
declared as extern in AcpiPlatformHooks.c, gcc still created an instance
of mGlobalNvsArea in AcpiPlatformHooks.c since the header was expanded
first and then the linker complained "multiple definition". This commit
rearrange the delaration of mGlobalNvsArea to satisfy gcc.

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/AcpiPlatform: Remove unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:27 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/AcpiPlatform: Remove unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c: In function 'PlatformUpdateTables':
Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c:236:63: warning: variable 'LocalApicCounter' set but not used [-Wunused-but-set-variable]
Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c:214:64: warning: variable 'ProcessorLocalApicEntry' set but not used [-Wunused-but-set-variable]
Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c:213:63: warning: variable 'BufferSize' set but not used [-Wunused-but-set-variable]

Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c: In function 'AcpiPlatformEntryPoint':
Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c:797:33: warning: variable 'Data32' set but not used [-Wunused-but-set-variable]

Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatformHooks.c: In function ?PatchGv3SsdtTable?:
Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatformHooks.c:243:31: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/PlatformInitPei: Suppress the gcc error message
Gary Lin [Fri, 29 Jul 2016 03:25:26 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformInitPei: Suppress the gcc error message

Fix the following error from gcc:

Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c: In function 'GetWakeupEventAndSaveToHob':
Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c:147:11: error: variable 'WakeEventData' set but not used [-Werror=unused-but-set-variable]

Although the function name is "GetWakeupEventAndSaveToHob",
WakeEventData was never really used or passed to any other function.
Given the fact that the function is served as an example, it'd better to
keep the code related to WakeEventData. Just add a debug statement to
suppress the error message.

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/PlatformInitPei: Remove the unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:25 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformInitPei: Remove the unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c: In function 'IchRcrbInit':
Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c:513:36: error: variable 'PlatformCpuInfo' set but not used [-Werror=unused-but-set-variable]
Vlv2TbltDevicePkg/PlatformInitPei/PchInitPeim.c:512:35: error: variable 'LpcRevisionID' set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/PlatformInitPei/MemoryCallback.c: In function 'EndOfPeiPpiNotifyCallback':
Vlv2TbltDevicePkg/PlatformInitPei/MemoryCallback.c:64:31: error: variable 'MemoryTop' set but not used [-Werror=unused-but-set-variable]

v2:
  Also remove the variable, Hob, in PchInitPeim.c:IchRcrbInit() since
  no one really uses it.

Cc: David Wei <david.wei@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2TbltDevicePkg/PlatformBdsLib: Remove the unused variable
Gary Lin [Fri, 29 Jul 2016 03:25:24 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformBdsLib: Remove the unused variable

Fix the following error from gcc:

Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c: In function ?BdsLockFv?:
Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c:2170:31: error: variable ?Data? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/PlatformPei: Remove the unused variable
Gary Lin [Fri, 29 Jul 2016 03:25:23 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/PlatformPei: Remove the unused variable

Fix the following error from gcc:

Vlv2TbltDevicePkg/PlatformPei/MemoryCallback.c: In function ?MemoryDiscoveredPpiNotifyCallback?:
Vlv2TbltDevicePkg/PlatformPei/MemoryCallback.c:115:20: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg/MultiPlatformLib: Remove the unused variables
Gary Lin [Fri, 29 Jul 2016 03:25:22 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg/MultiPlatformLib: Remove the unused variables

Fix the following errors from gcc:

Vlv2TbltDevicePkg/Library/MultiPlatformLib/MultiPlatformLib.c: In function ?MultiPlatformInfoInit?:
Vlv2TbltDevicePkg/Library/MultiPlatformLib/MultiPlatformLib.c:47:14: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/Library/MultiPlatformLib/BoardClkGens/BoardClkGens.c: In function ?ReadClockGeneratorID?:
Vlv2TbltDevicePkg/Library/MultiPlatformLib/BoardClkGens/BoardClkGens.c:222:33: error: variable ?Status? set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/Library/MultiPlatformLib/BoardClkGens/BoardClkGens.c: In function ?ConfigurePlatformClocks?:
Vlv2TbltDevicePkg/Library/MultiPlatformLib/BoardClkGens/BoardClkGens.c:283:33: error: variable ?ClockGenID? set but not used [-Werror=unused-but-set-variable]

Also fix the coding style of MultiPlatformInfoInit()

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg: Only define MDEPKG_NDEBUG for gcc release build
Gary Lin [Fri, 29 Jul 2016 03:25:21 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg: Only define MDEPKG_NDEBUG for gcc release build

We only enable "-Wno-unused-but-set-variable" for the release build
and gcc would complain that the varible passed to ASSERT_EFI_ERROR
wasn't used in the debug build. Just don't define MDEPKG_NDEBUG for
the debug build to make gcc happy with ASSERT_EFI_ERROR.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Cc: David Wei <david.wei@intel.com>
CC: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoVlv2TbltDevicePkg: Amend the build script
Gary Lin [Fri, 29 Jul 2016 03:25:20 +0000 (11:25 +0800)]
Vlv2TbltDevicePkg: Amend the build script

Take the gcc version detection from OvmfPkg/build.sh instead of the
hardcoded GCC46.

Cc: David Wei <david.wei@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Cc: "Lu, ShifeiX A" <shifeix.a.lu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoBaseTool/Upt: Avoid UNI file name conflict
Hess Chen [Fri, 29 Jul 2016 06:09:00 +0000 (14:09 +0800)]
BaseTool/Upt: Avoid UNI file name conflict

When creating a UNI file if there is a name conflict, add an index
from 0 to the file name

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTool/UPT: Not expand macro for UserExtension
Hess Chen [Mon, 1 Aug 2016 15:25:34 +0000 (23:25 +0800)]
BaseTool/UPT: Not expand macro for UserExtension

All MACRO values defined by the DEFINE statements
n any section (except [Userextensions] sections
other than TianoCore."ExtraFiles) of the INF or
DEC file must be expanded before processing of the file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTool/Upt: Add support for Private
Hess Chen [Fri, 29 Jul 2016 02:30:56 +0000 (10:30 +0800)]
BaseTool/Upt: Add support for Private

Support new syntax in package DEC file as below:
[Includes.Common.Private]
[Ppis.Common.Private]
[Guids.Common.Private]
[Protocols.Common.Private]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTool/UPT: Add Test Install
Hess Chen [Fri, 29 Jul 2016 07:58:23 +0000 (15:58 +0800)]
BaseTool/UPT: Add Test Install

Add a new function to test if a DIST file list
one by one to see if they can meet the requirement
of Dependency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoMdeModulePkg/UsbMass: Not retry if usb bot transfer execution fail
Feng Tian [Tue, 19 Jul 2016 05:56:03 +0000 (13:56 +0800)]
MdeModulePkg/UsbMass: Not retry if usb bot transfer execution fail

The retry mechanism will bring issue if the usb device is unplugged
from XHCI HC but s/w is trying to access it through BlockIo. The
current cmd will get device error return status, but the sequential
cmds will be timeout. This behavior will cause system unresponsive
for a long while and bring bad user experience.

So we break the retry loop if found device error.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg: add generic SataController driver.
Feng Tian [Tue, 19 Jul 2016 05:57:49 +0000 (13:57 +0800)]
MdeModulePkg: add generic SataController driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Amy Chan <amy.chan@intel.com>
7 years agoMdeModulePkg/FvSimpleFileSystem: fix assertions when FV is empty
Feng Tian [Tue, 2 Aug 2016 08:07:23 +0000 (16:07 +0800)]
MdeModulePkg/FvSimpleFileSystem: fix assertions when FV is empty

The original code will assert when dealing with those empty FVs.
The fix is used to solve this bug.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
7 years agoMdePkg: Add DmaRemappingReportingTable.h
Giri P Mudusuru [Mon, 1 Aug 2016 23:16:30 +0000 (16:16 -0700)]
MdePkg: Add DmaRemappingReportingTable.h

DMA Remapping Reporting (DMAR) ACPI table definitions from Intel(R)
Virtualization Technology for Directed I/O (VT-D) Architecture
Specification v2.4 dated June 2016.

This replaces the DMARemappingReportingTable.h from
EdkCompatibilityPkg\Foundation\Include\IndustryStandard

Patch V2: added below defines and re-arranged the file.
  EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL
  EFI_ACPI_DMAR_ATSR_FLAGS_ALL_PORTS

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoSecurityPkg OpalPasswordDxe: Fix buffer overflow issue.
Dong, Eric [Tue, 2 Aug 2016 11:32:30 +0000 (19:32 +0800)]
SecurityPkg OpalPasswordDxe: Fix buffer overflow issue.

In current code, PSID is processed as string and the length is 0x20.
Current code only reserved 0x20 length buffer for it, no extra buffer
for the '\0'. When driver call UnicodeStrToAsciiStrS to convert PSID,
it search the '\0' for the end. So extra dirty data saved in PSID
info which caused PSID revert action failed. This patch reserved
extra 1 byte data for the '\0'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoOvmfPkg: use StatusCode Router and Handler from MdeModulePkg
Cinnamon Shia [Tue, 2 Aug 2016 17:25:10 +0000 (01:25 +0800)]
OvmfPkg: use StatusCode Router and Handler from MdeModulePkg

In the Platform Init v1.4a spec,
- Volume 1 "4.7 Status Code Service" defines the
  EFI_PEI_SERVICES.ReportStatusCode() service,
- Volume 1 "6.3.5 Status Code PPI (Optional)" defines the
  EFI_PEI_PROGRESS_CODE_PPI (equivalent to the above),
- Volume 2 "14.2 Status Code Runtime Protocol" defines the
  EFI_STATUS_CODE_PROTOCOL.

These allow PEIMs and DXE (and later) modules to report status codes.

Currently OvmfPkg uses modules from under
"IntelFrameworkModulePkg/Universal/StatusCode/", which produce the above
abstractions (PPI and PROTOCOL) directly, and write the status codes, as
they are reported, to the serial port or to a memory buffer. This is
called "handling" the status codes.

In the Platform Init v1.4a spec,
- Volume 3 "7.2.2 Report Status Code Handler PPI" defines
  EFI_PEI_RSC_HANDLER_PPI,
- Volume 3 "7.2.1 Report Status Code Handler Protocol" defines
  EFI_RSC_HANDLER_PROTOCOL.

These allow several PEIMs and runtime DXE drivers to register callbacks
for status code handling.

MdeModulePkg offers a PEIM under
"MdeModulePkg/Universal/ReportStatusCodeRouter/Pei" that produces both
EFI_PEI_PROGRESS_CODE_PPI and EFI_PEI_RSC_HANDLER_PPI, and a runtime DXE
driver under "MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe"
that produces both EFI_STATUS_CODE_PROTOCOL and EFI_RSC_HANDLER_PROTOCOL.

MdeModulePkg also offers status code handler modules under
MdeModulePkg/Universal/StatusCodeHandler/ that depend on
EFI_PEI_RSC_HANDLER_PPI and EFI_RSC_HANDLER_PROTOCOL, respectively.

The StatusCodeHandler modules register themselves with
ReportStatusCodeRouter through EFI_PEI_RSC_HANDLER_PPI /
EFI_RSC_HANDLER_PROTOCOL. When another module reports a status code
through EFI_PEI_PROGRESS_CODE_PPI / EFI_STATUS_CODE_PROTOCOL, it reaches
the phase-matching ReportStatusCodeRouter module first, which in turn
passes the status code to the pre-registered, phase-matching
StatusCodeHandler module.

The status code handling in the StatusCodeHandler modules is identical to
the one currently provided by the IntelFrameworkModulePkg modules. Replace
the IntelFrameworkModulePkg modules with the MdeModulePkg ones, so we can
decrease our dependency on IntelFrameworkModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Suggested-by: Liming Gao <liming.gao@intel.com>
Fixes: https://tianocore.acgmultimedia.com/show_bug.cgi?id=63
[jordan.l.justen@intel.com: point out IntelFareworkModulePkg typos]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[lersek@redhat.com: rewrap to 74 cols; fix IntelFareworkModulePkg typos]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoIntelFsp2Pkg: Locate FSP Info Header dynamically
Yarlagadda, Satya P [Mon, 1 Aug 2016 11:41:34 +0000 (19:41 +0800)]
IntelFsp2Pkg: Locate FSP Info Header dynamically

we need to locate the FSP Info Header by calculating offset dynamically to
handle the scenario of FSP component is being rebased to different location.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Satya Yarlagadda <satya.p.yarlagadda@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: deal with relaxed XIP alignment
Ard Biesheuvel [Tue, 2 Aug 2016 10:08:03 +0000 (12:08 +0200)]
ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: deal with relaxed XIP alignment

Commit b89919ee8f8c ("BaseTools AARCH64: override XIP module linker
alignment to 32 bytes") updated the various AARCH64 toolchain definitions
to allow SEC, PEI_CORE and PEIM modules to be built with minimal alignment
requirements even when using the AArch64 small code model which normally
requires 4 KB section alignment.

This involves conversion of ADRP instructions into ADR instructions, which
can only be done reliably if the ELF and the PE/COFF sections appear at
the same offset modulo 4 KB.

The ArmVirtPrePiUniCoreRelocatable linker script did not yet take this
into account, so update it by starting the .text section at the next
appropriately aligned offset PECOFF_HEADER_SIZE bytes into the image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
7 years agoBaseTools: Keep the Pcd order in the Asbuilt Inf is same with Source
Yonghong Zhu [Tue, 26 Jul 2016 07:17:15 +0000 (15:17 +0800)]
BaseTools: Keep the Pcd order in the Asbuilt Inf is same with Source

The original behavior is that in the Asbuilt inf Pcd's order is base on
the Pcd's offset. Now we change the order to keep it is same with the Pcd
order in the source inf file.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoShellBinPkg Arm/AArch64 Shell binary update
Ard Biesheuvel [Tue, 2 Aug 2016 09:16:44 +0000 (11:16 +0200)]
ShellBinPkg Arm/AArch64 Shell binary update

The binaries of ShellBinPkg are generated with ShellPkg from b89919ee8f8c
("BaseTools AARCH64: override XIP module linker alignment to 32 bytes")

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org> # AArch64
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # ARM
7 years agoBaseTools AARCH64: override XIP module linker alignment to 32 bytes
Ard Biesheuvel [Wed, 27 Jul 2016 10:08:20 +0000 (12:08 +0200)]
BaseTools AARCH64: override XIP module linker alignment to 32 bytes

Now that GenFw converts small code model ADRP instructions to ADR on
the fly, we can reduce the alignment for XIP modules, where large
alignment values may cause considerable waste of flash space due to
excessive padding. This limits the module size to 1 MB, but this is
not a concern in practice.

So set the XIP section alignment to 0x20 for DEBUG_GCC49, DEBUG_GCC5
and *_CLANG35, all of which use the small code model.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoBaseTools/GenFw AARCH64: convert ADRP to ADR instructions if binary size allows it
Ard Biesheuvel [Tue, 26 Jul 2016 14:37:37 +0000 (16:37 +0200)]
BaseTools/GenFw AARCH64: convert ADRP to ADR instructions if binary size allows it

The ADRP instruction in the AArch64 ISA requires the link time and load time
offsets of a binary to be equal modulo 4 KB. The reason is that this instruction
always produces a multiple of 4 KB, and relies on a subsequent ADD or LDR
instruction to set the offset into the page. The resulting symbol reference
only produces the correct value if the symbol in question resides at that
exact offset into the page, and so loading the binary at arbitrary offsets
is not possible.

Due to the various levels of padding when packing FVs into FVs into FDs, this
alignment is very costly for XIP code, and so we would like to relax this
alignment requirement if possible.

Given that symbols that are sufficiently close (within 1 MB) of the reference
can also be reached using an ADR instruction which does not suffer from this
alignment issue, let's replace ADRP instructions with ADR after linking if
the offset can be encoded in this instruction's immediate field. Note that
this only makes sense if the section alignment is < 4 KB. Otherwise,
replacing the ADRP has no benefit, considering that the subsequent ADD or
LDR instruction is retained, and that micro-architectures are more likely
to be optimized for ADRP/ADD pairs (i.e., via micro op fusing) than for
ADR/ADD pairs, which are non-typical.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoBaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode
Ard Biesheuvel [Sun, 17 Jul 2016 21:20:10 +0000 (23:20 +0200)]
BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode

This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and
AARCH64. Due to the fact that the GCC project switched to a new
numbering scheme where the first digit is now incremented for every
major release, the new toolchain is simply called 'GCC5', and is
intended to support all GCC v5.x releases.

Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG
and RELEASE builds, LTO support is equally enabled for both targets.
On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO
optimizations are only enabled for RELEASE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools GCC: drop GNU notes section from EFI image
Ard Biesheuvel [Wed, 27 Jul 2016 09:13:58 +0000 (11:13 +0200)]
BaseTools GCC: drop GNU notes section from EFI image

Recent versions of GNU ld automatically emit a .notes section into
the ELF binary containing a build id. Since this is an allocatable
section by default, it will be identified by GenFw as a section
that requires PE/COFF conversion, which may cause sections to be
moved around unexpectedly.

So retain the section, but tag it as INFO, which tells the linker
that it should not be accounted for in the binary's memory layout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmPkg: add prebuilt glue binaries for GCC5 LTO support
Ard Biesheuvel [Mon, 18 Jul 2016 10:19:34 +0000 (12:19 +0200)]
ArmPkg: add prebuilt glue binaries for GCC5 LTO support

GCC in LTO mode interoperates poorly with non-standard libraries that
provide implementations of compiler intrinsics such as memcpy/memset
or the stack protector entry points. Such libraries need to be built
in non-LTO mode, and then referenced explicitly on the linker command
line using a -plugin-opt=-pass-through=-lxxx linker option.

However, if these intrinsics are also referenced directly, the LTO
version of the code will be pulled in, and will happily satisfy all
other references to the same symbol.

So add a pair of glue libraries, for ARM and AARCH64, that reference
the known intrinsics. Since the binaries live under ArmPkg directly,
we can reference them in tools_def.txt. Under LD garbage collection,
the object itself will be pruned, and so will the intrinsics that end
up unused by the module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoBaseTools GCC: use 'gcc' as the linker command for GCC44 and later
Ard Biesheuvel [Sat, 23 Jul 2016 08:19:46 +0000 (10:19 +0200)]
BaseTools GCC: use 'gcc' as the linker command for GCC44 and later

To accommodate upcoming GCCx toolchain versions that require 'gcc' to
be used as the linker in order to support LTO, switch GCC44 and later
(including CLANG35) to a new DLINK build rule that invokes 'gcc' as the
linker instead of 'ld'. Since gcc expects its command line arguments in
a different format, and expects arguments that it needs to pass to the
linker to be prefixed with '-Wl,', this involves changes to most of the
DLINK_FLAGS definitions in tools_def.template, as well as some changes to
module .INF files that set their own linker options.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD
Ard Biesheuvel [Sat, 23 Jul 2016 06:18:31 +0000 (08:18 +0200)]
BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD

Before we can make non-backward compatible changes to the GCC build rules
regarding the use of the 'gcc' binary as the linker, clone the existing
GCC build rules into a 'GCCLD' build rule family, and move the legacy
toolchains UNIXGCC, CYGGCC, CYGGCCxASL and ELFGCC over to it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections
Ard Biesheuvel [Sat, 23 Jul 2016 08:14:11 +0000 (10:14 +0200)]
ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections

Newer versions of ld automatically emit .gnu.hash and .note.gnu.build-id
sections, which are not listed in the linker script, and will end up
breaking the build with an allocation conflict, e.g.,

  /usr/bin/aarch64-linux-gnu-ld: section .note.gnu.build-id loaded at
    [0000000000000000,0000000000000023] overlaps section .text loaded at
    [0000000000000000,0000000000017dbf]

Since we don't require or care about these sections, update the linker
script so that they are discarded. Note that this involves emitting the
.note.gnu.build-id section into a non-allocatable segment to prevent the
linker from noticing that it is being discarded (and subsequently
complaining about it)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoBaseTools CLANG35: drop problematic use-movt and save-temps options
Ard Biesheuvel [Sat, 23 Jul 2016 07:38:14 +0000 (09:38 +0200)]
BaseTools CLANG35: drop problematic use-movt and save-temps options

Some versions of Clang fail on every input file when using the
-save-temps options, and produces the following heplful error message:

  <unknown>:0: error: Undefined temporary symbol

Simply dropping the option for CLANG35 is the simplest way around this,
since the value of storing .i and .s files is dubious anyway.

Also, drop the arm-use-movt option, which does not appear to be
supported anymore by recent versions of clang.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoMdePkg: move to 'hidden' visibility for all symbols under GCC/X64
Ard Biesheuvel [Mon, 1 Aug 2016 06:48:02 +0000 (08:48 +0200)]
MdePkg: move to 'hidden' visibility for all symbols under GCC/X64

When using GCC to build for X64, we switched to the position independent
small code model, which is much more efficient in terms of code generation
and runtime relocation footprint, and produces binaries that can execute
correctly from any offset.

However, the PIC routines are by default geared towards hosted binaries
containing symbol references that may resolve to definitions in other
dynamic objects, and for this reason, most symbol references are indirected
via a GOT entry (which also results in a .reloc fixup entry) unless we
annotate them.

For this reason, we introduced the 'protected' visibility annotation for
all symbol definitions and references, by setting the GCC visibility
pragma. However, as it turns out, this is not sufficient for all versions
of GCC, and in some cases (GCC 5.x using the GCC49 toolchain tag), may
still result in GOT based relocations.

So switch to 'hidden' visibility instead, which is slightly stronger, and
fixes this issue for the versions of GCC that exhibit the problem.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoArmPkg/Library: Add ArmReadSctlr for AArch64
Supreeth Venkatesh [Fri, 29 Jul 2016 23:06:32 +0000 (18:06 -0500)]
ArmPkg/Library: Add ArmReadSctlr for AArch64

ArmLib defines a prototype for the ArmReadSctlr() function, but the
AArch64 implementation is missing. So add it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: John Powell <john.powell@arm.com>
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
[ardb: update commit log]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoNt32Pkg: Make Shell as the first boot option
Liming Gao [Mon, 25 Jul 2016 14:00:28 +0000 (22:00 +0800)]
Nt32Pkg: Make Shell as the first boot option

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoNt32Pkg: Add LoadFileOnFv2 driver in DSC/FDF
Liming Gao [Mon, 25 Jul 2016 14:00:27 +0000 (22:00 +0800)]
Nt32Pkg: Add LoadFileOnFv2 driver in DSC/FDF

After add LoadFileOnFv2, PlatformBootManagerLib doesn't need to find Shell
application from FV.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg: Add new LoadFileOnFv2 in Package DSC for Build
Liming Gao [Mon, 25 Jul 2016 14:00:26 +0000 (22:00 +0800)]
MdeModulePkg: Add new LoadFileOnFv2 in Package DSC for Build

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg LoadFileOnFv2: Add new LoadFileOnFv2 driver
Liming Gao [Mon, 25 Jul 2016 14:00:25 +0000 (22:00 +0800)]
MdeModulePkg LoadFileOnFv2: Add new LoadFileOnFv2 driver

This driver searches APPLICATION in FV and installs LoadFile protocol
for every found one. Then, BDS will add BootOption for LoadFile protocol.

It provides the generic way to expose boot option for the internal
application, such as Shell. With this driver, PlatformBds doesn?t need
to specially handle Shell application.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg UefiBootManagerLib: Update LoadFile boot description
Liming Gao [Mon, 25 Jul 2016 14:00:23 +0000 (22:00 +0800)]
MdeModulePkg UefiBootManagerLib: Update LoadFile boot description

Update boot description to support LoadFile protocol based on FV file.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg UefiBootManagerLib: Support LoadFile Protocol based on FV
Liming Gao [Mon, 25 Jul 2016 14:00:22 +0000 (22:00 +0800)]
MdeModulePkg UefiBootManagerLib: Support LoadFile Protocol based on FV

New LoadFileOnFv2 driver will install LoadFile protocol based on FV file.
Update UefiBootManagerLib to find BootMenuApp with LoadFile protocol.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg UefiBootManagerLib: Add BmIsBootMenuAppFilePath internal API
Liming Gao [Mon, 25 Jul 2016 14:00:21 +0000 (22:00 +0800)]
MdeModulePkg UefiBootManagerLib: Add BmIsBootMenuAppFilePath internal API

This function abstracts the common logic to find BootMenuApp file.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoEdkCompatibilityPkg: Fix GCC build failure
Liming Gao [Thu, 28 Jul 2016 07:35:27 +0000 (15:35 +0800)]
EdkCompatibilityPkg: Fix GCC build failure

Edk2 enables Os option and ms_va_list in GCC tool chain.
This change makes VA_LIST is not pointer, and cause GCC failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
7 years agoNetworkPkg: Add missed character in copyright.
Fu Siyuan [Mon, 1 Aug 2016 02:14:27 +0000 (10:14 +0800)]
NetworkPkg: Add missed character in copyright.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoMdeModulePkg: Add missed character in copyright.
Fu Siyuan [Mon, 1 Aug 2016 02:13:57 +0000 (10:13 +0800)]
MdeModulePkg: Add missed character in copyright.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoVlv2DeviceRefCodePkg&Vlv2DevicePkg:Add sample WSMT table.
Lu, ShifeiX A [Thu, 28 Jul 2016 08:21:28 +0000 (16:21 +0800)]
Vlv2DeviceRefCodePkg&Vlv2DevicePkg:Add sample WSMT table.

This is an sample WSMT table, which we only
update BIT0 and BIT1 of Protections flags fields.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lushifex <shifeix.a.lu@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
7 years agoVlv2TbltDevicePkg:Signal EndOfDxe Event.
lushifex [Fri, 29 Jul 2016 09:31:52 +0000 (17:31 +0800)]
Vlv2TbltDevicePkg:Signal EndOfDxe Event.

According to PI spec,EndOfDxe Event should be signaled
before DxeSmmReadyToLock protocol installation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lushifex <shifeix.a.lu@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoVlv2TbltDevicePkg:Change RESET_VALUE of FADT
Wei, David [Sat, 30 Jul 2016 07:47:29 +0000 (15:47 +0800)]
Vlv2TbltDevicePkg:Change RESET_VALUE of FADT

Change RESET_VALUE of  ACPI FADT to 0x0E, which could trigger full reset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Wei <david.wei@intel.com>
7 years agoBaseTools/Ecc: GUID checkpoint
Hess Chen [Wed, 27 Jul 2016 06:14:50 +0000 (14:14 +0800)]
BaseTools/Ecc: GUID checkpoint

Fix a bug of checking duplicate GUID

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTools: Add build info for binary modules that only list in FDF file
Yonghong Zhu [Wed, 27 Jul 2016 08:29:38 +0000 (16:29 +0800)]
BaseTools: Add build info for binary modules that only list in FDF file

If the binary module is list in the FDF file but not list in the DSC
file, current build report would not include these binary module's info
in the report "Module section". The patch fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoShellBinPkg: Ia32/X64 Shell binary update.
Ruiyu Ni [Fri, 29 Jul 2016 02:33:26 +0000 (10:33 +0800)]
ShellBinPkg: Ia32/X64 Shell binary update.

The binaries of ShellBinPkg are generated with ShellPkg project 031403460c9782a2563a81a6065ded99046960c2.
The binaries are built with no debug information by building with "RELEASE" target.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg SmbiosDxe: Use definition in IndustryStandard/Smbios.h
Star Zeng [Thu, 28 Jul 2016 02:49:50 +0000 (10:49 +0800)]
MdeModulePkg SmbiosDxe: Use definition in IndustryStandard/Smbios.h

Cc: Feng Tian <feng.tian@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Amy Chan <amy.chan@intel.com>
7 years agoMdeModulePkg UiApp: Use definition in IndustryStandard/Smbios.h
Star Zeng [Fri, 15 Jul 2016 10:56:52 +0000 (18:56 +0800)]
MdeModulePkg UiApp: Use definition in IndustryStandard/Smbios.h

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Amy Chan <amy.chan@intel.com>
7 years agoIntelFrameworkModulePkg BdsDxe: Use definition in IndustryStandard/Smbios.h
Star Zeng [Fri, 15 Jul 2016 10:56:30 +0000 (18:56 +0800)]
IntelFrameworkModulePkg BdsDxe: Use definition in IndustryStandard/Smbios.h

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Amy Chan <amy.chan@intel.com>
7 years agoShellPkg: Unregister hotkey callback when exiting Shell
Ruiyu Ni [Thu, 28 Jul 2016 04:46:25 +0000 (12:46 +0800)]
ShellPkg: Unregister hotkey callback when exiting Shell

Commit 9168df3dea65f707d1e9c32eba5e18ef6b84e5cd
"ShellPkg/ShellProtocol.c: Handle memory allocation failure"
only keeps the protocol clean up in CleanUpShellProtocol() and
creates a new function CleanUpShellEnvironment() which calls
CleanUpShellProtocol(), then unregisters the hotkey callback.

But the commit forgot to change the Shell.c to call
CleanUpShellEnvironment() which causes the hotkey callback is
not unregistered while the callback function doesn't exist
when Shell exits.

This causes system hang when pressing CTRL+C after exiting shell.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoShellPkg: Correct files with CRLF line ending
Liming Gao [Thu, 28 Jul 2016 08:31:57 +0000 (16:31 +0800)]
ShellPkg: Correct files with CRLF line ending

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoMdePkg PeiDxePostCodeLibReportStatusCode: Correct files with CRLF line ending
Liming Gao [Thu, 28 Jul 2016 08:30:52 +0000 (16:30 +0800)]
MdePkg PeiDxePostCodeLibReportStatusCode: Correct files with CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
7 years agoBaseTools: Correct ReadMe.txt file with CRLF line ending
Liming Gao [Thu, 28 Jul 2016 08:06:52 +0000 (16:06 +0800)]
BaseTools: Correct ReadMe.txt file with CRLF line ending

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
7 years agoArmPlatformPkg: Convert ArmJunoDxe to use common juno revision code
Jeremy Linton [Wed, 27 Jul 2016 19:24:36 +0000 (14:24 -0500)]
ArmPlatformPkg: Convert ArmJunoDxe to use common juno revision code

Now that the code to detect the Juno revision is in
the header go ahead and covert the ArmJunoDxe to use it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPlatformPkg: break out juno revision detection
Jeremy Linton [Wed, 27 Jul 2016 19:24:35 +0000 (14:24 -0500)]
ArmPlatformPkg: break out juno revision detection

The code to detect what juno revision we are running on
is fairly small put it in a common header where it may be
used in a couple places.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPkg: Add Cortex-A72 CPU type
Jeremy Linton [Wed, 27 Jul 2016 19:24:34 +0000 (14:24 -0500)]
ArmPkg: Add Cortex-A72 CPU type

Add the Cortex-A72 CPU type which is used in JunoR2.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoOvmfPkg/Sec: Support SECTION2 DXEFV types
Thomas Palmer [Wed, 27 Jul 2016 06:48:15 +0000 (01:48 -0500)]
OvmfPkg/Sec: Support SECTION2 DXEFV types

Support down-stream projects that require large DXEFV sizes greater
than 16MB by handling SECTION2 common headers. These are already
created by the build tools when necessary.

Use IS_SECTION2 and SECTION2_SIZE macros to calculate accurate image
sizes when appropriate.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: fix NB->MB typo in commit message]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
7 years agoOvmfPkg/Sec: Use EFI_COMMON_SECTION_HEADER to avoid casts
Thomas Palmer [Wed, 27 Jul 2016 06:48:14 +0000 (01:48 -0500)]
OvmfPkg/Sec: Use EFI_COMMON_SECTION_HEADER to avoid casts

Drop superfluous casts. There is no change in behavior because
EFI_FIRMWARE_VOLUME_IMAGE_SECTION is just a typedef of
EFI_COMMON_SECTION_HEADER.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoPcAtChipsetPkg/PcRtc: Fix a NULL pointer deference issue
Ruiyu Ni [Tue, 26 Jul 2016 13:07:19 +0000 (21:07 +0800)]
PcAtChipsetPkg/PcRtc: Fix a NULL pointer deference issue

When a platform which doesn't support ACPI 1.0 (no XSDT) and FADT
is not produced at the first time when ACPI table is published,
GetCenturyRtcAddress() unconditionally deference Rsdp->RsdtAddress
but Rsdp->RsdtAddress is 0 in this case.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoPcAtChipsetPkg/PcRtc: Fix a stack corruption issue
Ruiyu Ni [Tue, 26 Jul 2016 10:20:05 +0000 (18:20 +0800)]
PcAtChipsetPkg/PcRtc: Fix a stack corruption issue

In 32bit environment, ScanTableInSDT() incorrectly copies 8 bytes
of data to 4-byte pointer Table, which causes the stack corruption.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoBaseTools: report error if source module INF is only list in FDF file
Yonghong Zhu [Wed, 20 Jul 2016 05:58:03 +0000 (13:58 +0800)]
BaseTools: report error if source module INF is only list in FDF file

If source module INF is not listed in DSC, it will not be built. And it
is listed in FDF, GenFds will fail to find its build output. To reminder
user this issue early, build tool should report failure to user in early
phase.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoIntelFsp2Pkg: Skip loading Microcode if MicrocodeCodeSize is zero
Yarlagadda, Satya P [Tue, 26 Jul 2016 01:14:17 +0000 (09:14 +0800)]
IntelFsp2Pkg: Skip loading Microcode if MicrocodeCodeSize is zero

During asm to Nasm conversion, we missed the code to skip loading the
microcode and return success if the size is zero. Added additional check to
report error if the microcode size is not zero but less than 2 kB.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Satya Yarlagadda <satya.p.yarlagadda@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoBaseTools/toolsetup.bat: Fix bug caused by 'CONF_PATH' not defined
Hao Wu [Tue, 26 Jul 2016 05:31:20 +0000 (13:31 +0800)]
BaseTools/toolsetup.bat: Fix bug caused by 'CONF_PATH' not defined

In batch script files, setting a variable in an 'if' block will only take
effect after the 'if' block.

This commit fixes the issue of using the variable 'CONF_PATH' right after
it is being set in an 'if' block.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoNetworkPkg UefiPxeBcDxe: Fix build error for lastest VS2015 compiler
Hao Wu [Thu, 21 Jul 2016 03:20:26 +0000 (11:20 +0800)]
NetworkPkg UefiPxeBcDxe: Fix build error for lastest VS2015 compiler

The UefiPxeBcDxe module encounters a build error for IA32 arch using the
latest version of VS2015:

UefiPxeBcDxe.lib(PxeBcBoot.obj) : error LNK2001: unresolved external
symbol __allmul

The cause is line 148 in file NetworkPkg\UefiPxeBcDxe\PxeBcBoot.c. The
third parameter for gBS->SetTimer() function is of type UINT64, so the
multiplication should use the MultU64x32() function now.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoNetworkPkg IScsiDxe: Fix build error for lastest VS2015 compiler
Hao Wu [Thu, 21 Jul 2016 03:15:19 +0000 (11:15 +0800)]
NetworkPkg IScsiDxe: Fix build error for lastest VS2015 compiler

The IScsiDxe module encounters a build error for IA32 arch using the
latest version of VS2015:

IScsiDxe.lib(IScsiProto.obj) : error LNK2001: unresolved external symbol
__allmul

The cause is line 141 in file NetworkPkg\IScsiDxe\IScsiProto.c. The third
parameter for gBS->SetTimer() function is of type UINT64, so the
multiplication should use the MultU64x32() function now.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoIntelFspWrapperPkg: Add missing License.txt.
Jiewen Yao [Sat, 23 Jul 2016 01:24:31 +0000 (09:24 +0800)]
IntelFspWrapperPkg: Add missing License.txt.

Add missing License.txt.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoIntelFspPkg: Add missing License.txt.
Jiewen Yao [Sat, 23 Jul 2016 01:24:11 +0000 (09:24 +0800)]
IntelFspPkg: Add missing License.txt.

Add missing License.txt.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoIntelFsp2WrapperPkg: Add missing License.txt.
Jiewen Yao [Sat, 23 Jul 2016 01:23:52 +0000 (09:23 +0800)]
IntelFsp2WrapperPkg: Add missing License.txt.

Add missing License.txt.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoIntelFsp2Pkg: Add missing License.txt.
Jiewen Yao [Sat, 23 Jul 2016 01:23:29 +0000 (09:23 +0800)]
IntelFsp2Pkg: Add missing License.txt.

Add missing License.txt.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoBaseTools/toolsetup: Do not set CONF_PATH when already set.
Marvin Haeuser [Wed, 20 Jul 2016 15:02:27 +0000 (23:02 +0800)]
BaseTools/toolsetup: Do not set CONF_PATH when already set.

When CONF_PATH is already set, toolsetup.bat overwrites its value.
This is not the case on Linux platforms (BuildEnv) and
contra-productive when using the same Workspace across multiple
Operating Systems.
With this patch, a check is performed prior to setting the variable.
Furthermore, it will not be scanned for Conf directories in
PACKAGES_PATH directories to respect the user's choice.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoPreserve hii section in GCC binaries
Thomas Palmer [Fri, 22 Jul 2016 02:56:49 +0000 (10:56 +0800)]
Preserve hii section in GCC binaries

According to UEFI spec:
Once an image is loaded, LoadImage() installs
EFI_HII_PACKAGE_LIST_PROTOCOL on the handle if the image contains a
custom PE/COFF resource with the type 'HII'. The protocol's
interface pointer points to the HII package list which is contained
in the resource's data.

This is controlled by the UEFI_HII_RESOURCE_SECTION define in the INF
file.  When present the HII resource is linked with the module
binary.

Unfortunately GCC-built binaries have been stripping the .hii section
entirely.  See  "[edk2] HII gEfiHiiPackageListProtocolGuid problem
with  GCC48(VS2012x86 works)"
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/13438
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/14899

This patch tells the linker to preserve the .hii sections

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Bruce Cran <bruce.cran@gmail.com>
Reviewed-by: Bruce Cran <bruce.cran@gmail.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoUpdate edksetup.bat to check NASM system environment variable
Yonghong Zhu [Fri, 15 Jul 2016 09:41:17 +0000 (17:41 +0800)]
Update edksetup.bat to check NASM system environment variable

If the NASM_PREFIX variable is not set, it would report warning message.
If there exist the C:\nasm\nasm.exe file, it would set the NASM_PREFIX
variable to C:\nasm\.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>