]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
7 years agoUefiCpuPkg/CpuMpPei: Remove unused files and codes
Jeff Fan [Fri, 22 Jul 2016 02:28:14 +0000 (10:28 +0800)]
UefiCpuPkg/CpuMpPei: Remove unused files and codes

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/CpuMpPei: Consume MpInitLib to produce CPU MP PPI services
Jeff Fan [Fri, 22 Jul 2016 02:12:51 +0000 (10:12 +0800)]
UefiCpuPkg/CpuMpPei: Consume MpInitLib to produce CPU MP PPI services

Consume MP initialize library to produce CPU MP PPI, it could simply the code.

Add STATIC for some internal functions to avoid build issue with the same
functions name in PeiMpInit instance. They will be removed by the next patch.

v4:
  1. Update BistData type from UINT32 to EFI_HEALTH_FLAGS.

v3:
  1. Rename MpInitLibSwitchBSP to MpInitLibSwitchBSP
  2. Add PeiMpInitLib.inf in DSC file

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoQuarkPlatformPkg: Add MpInitLib reference in DSC files.
Jeff Fan [Thu, 21 Jul 2016 14:57:12 +0000 (22:57 +0800)]
QuarkPlatformPkg: Add MpInitLib reference in DSC files.

This update is for CpuDxe consuming MP Initialize library.

v5:
  1. Update Quark DSC files to add PeiMpInitLib.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoOvmfPkg: Add MpInitLib reference in DSC files.
Jeff Fan [Thu, 21 Jul 2016 07:10:40 +0000 (15:10 +0800)]
OvmfPkg: Add MpInitLib reference in DSC files.

This update is for CpuMpPei&CpuDxe consuming MP Initialize library.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
7 years agoUefiCpuPkg/MpInitLib: Place APs in safe loop before hand-off to OS
Jeff Fan [Sun, 24 Jul 2016 15:03:12 +0000 (23:03 +0800)]
UefiCpuPkg/MpInitLib: Place APs in safe loop before hand-off to OS

Register Exit Boot Service callback function MpInitExitBootServicesCallback() to
place AP one safe loop before hand-off to OS.

Allocated one reserved memory and copy the AsmRellocateApLoop() code into it. It
could avoid the CPU Dxe driver (located in Boot Service data range) crashed
after Exit Boot Service event.
Place AP into the target Cx-State (specified by PcdCpuApTargetCstate) could save
power if Monitor-mwait feature supported.
In long mode, switch AP into protected mode could let AP not require page table
when executing this safe loop. Page Table (located in Boot Service data range)
may crashed after Exit Boot Service event.

v3:
  1. Rename *RellocateAp* to *RelocateAp*

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupAllAPs()
Jeff Fan [Thu, 21 Jul 2016 13:33:11 +0000 (21:33 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupAllAPs()

v4:
  1. Simply the internal function StartupAllAPsWorker()'s function
     header due to it is duplicated with MpInitLibStartupAllAPs().
v3:
  1. Use CamelCase for mStopCheckAllApsStatus and
     CheckAndUpdateApsStatus()

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupThisAP()
Jeff Fan [Thu, 21 Jul 2016 13:31:47 +0000 (21:31 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupThisAP()

v4:
  1. Simply the internal function StartupThisAPWorker()'s comment
     header due to it is duplicated with MpInitLibStartupThisAP().

v3:
  1. Use CamelCase for mStopCheckAllApsStatus and
     CheckAndUpdateApsStatus().

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Check APs Status and update APs status
Jeff Fan [Thu, 21 Jul 2016 13:28:16 +0000 (21:28 +0800)]
UefiCpuPkg/MpInitLib: Check APs Status and update APs status

v3:
  1. Use CamelCase for CheckAndUpdateApsStatus().

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibEnableDisableAP()
Jeff Fan [Thu, 21 Jul 2016 13:23:05 +0000 (21:23 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibEnableDisableAP()

v4:
  1. Simply the internal function MpInitLibEnableDisableAP()'s function
     header due to it is duplicated with MpInitLibEnableDisableAP().
v3:
  1. Use CamelCase for mCheckAllAPsEvent, mStopCheckAllApsStatus.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP()
Jeff Fan [Thu, 21 Jul 2016 13:20:18 +0000 (21:20 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP()

v4:
  1. Simply the internal function SwitchBSPWorker()'s comment header
     due to it is duplicated with MpInitLibSwitchBSP().

v3:
  1. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibWhoAmI()
Jeff Fan [Thu, 21 Jul 2016 13:14:00 +0000 (21:14 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibWhoAmI()

v5:
  1. Move checking ProcessNumber before calling GetCpuMpData.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibGetProcessorInfo()
Jeff Fan [Thu, 21 Jul 2016 13:12:46 +0000 (21:12 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetProcessorInfo()

v5:
  1. Remove (-1) and use the clean code to calculate the Location->Thread
     and Location->Core.

v4:
  1. Update HealthData type from UINT32 to EFI_HEALTH_FLAGS

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Implementation of MpInitLibGetNumberOfProcessors()
Jeff Fan [Wed, 20 Jul 2016 16:34:19 +0000 (00:34 +0800)]
UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetNumberOfProcessors()

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Skip collect processor count if GUIDed HOB exist
Jeff Fan [Wed, 20 Jul 2016 16:32:53 +0000 (00:32 +0800)]
UefiCpuPkg/MpInitLib: Skip collect processor count if GUIDed HOB exist

If GUIDed HOB mCpuInitMpLibHobGuid exists, we could get the processor count and
processor APICID and Initial APICID from CPU_INFO_IN_HOB. We needn't to delay
for broadcast INIT-SIPI-SIPI results and could improve performance.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Sort processor by ascending order of APIC ID
Jeff Fan [Wed, 20 Jul 2016 16:31:36 +0000 (00:31 +0800)]
UefiCpuPkg/MpInitLib: Sort processor by ascending order of APIC ID

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Enable x2APIC mode on BSP/APs
Jeff Fan [Wed, 20 Jul 2016 16:29:49 +0000 (00:29 +0800)]
UefiCpuPkg/MpInitLib: Enable x2APIC mode on BSP/APs

If x2APIC flag is set, enable x2APIC mode on all APs and BSP. Before we wakeup
APs to enable x2APIC mode, we should wait all APs have finished initialization.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Send INIT-SIPI-SIPI to get processor count
Jeff Fan [Wed, 20 Jul 2016 16:28:45 +0000 (00:28 +0800)]
UefiCpuPkg/MpInitLib: Send INIT-SIPI-SIPI to get processor count

CollectProcessorCount() will send the 1st INIT-SIPI-SIPI to get processor count
in system.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add WakeUpAP()
Jeff Fan [Wed, 20 Jul 2016 16:23:52 +0000 (00:23 +0800)]
UefiCpuPkg/MpInitLib: Add WakeUpAP()

WakeUpAP() is used to wakeup APs per current ApLoopMode and make sure APs wake
up successfully.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Fill MP_CPU_EXCHANGE_INFO fields
Jeff Fan [Wed, 20 Jul 2016 16:22:21 +0000 (00:22 +0800)]
UefiCpuPkg/MpInitLib: Fill MP_CPU_EXCHANGE_INFO fields

FillExchangeInfoData() is used to fill MP_CPU_EXCHANGE_INFO date exchanged
between C code and assembly code of AP reset vector.

v5:
  1. Reference ApWakeupFunction instead of ApCFunction.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add ApWakeupFunction() executed by assembly code
Jeff Fan [Wed, 20 Jul 2016 16:20:26 +0000 (00:20 +0800)]
UefiCpuPkg/MpInitLib: Add ApWakeupFunction() executed by assembly code

ApWakeupFunction() is the first C function executed from AP reset vector. When
APs waken up at the first time, it will sync BSP's MTRR setting and load
microcode on APs and collect APs' BIST information.

When AP tasked finished, it will place APs it one loop specified by ApLoopMode.

v5:
  1. Rename ApCFunction to ApWakeupFunction to meet naming convention.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Allocate AP reset vector buffer under 1MB
Jeff Fan [Sun, 24 Jul 2016 14:19:09 +0000 (22:19 +0800)]
UefiCpuPkg/MpInitLib: Allocate AP reset vector buffer under 1MB

In PeiMpInitLib, searching unallocated memory under in
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR hobs to find the memory under 1MB for AP reset
vector. After End of PEI event triggered, we need to restore original the buffer
contents to avoid crash the OS on S3 boot.
In DxeMpInitLib, allocate the memory under 1MB for AP reset vector.

Add helper functions AllocateResetVector()/FreeResetVector() used by WakeupAp().

v3:
  1. Move SetTimer() from Patch #17 to Patch 16.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Register one period event to check APs status
Jeff Fan [Thu, 21 Jul 2016 08:56:51 +0000 (16:56 +0800)]
UefiCpuPkg/MpInitLib: Register one period event to check APs status

In DxeMpInitLib, register one period event callback function CheckAPsStatus()
used to check AP Status.

v5:
  1. Introduce AP_CHECK_INTERVAL for adjust AP check timer interval potential.

v3:
  1. Use CamelCase for mCheckAllAPsEvent, mStopCheckAllApsStatus and
     CheckAndUpdateApsStatus().
  2. Move SetTimer() from Patch #17 to Patch 16.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Register one End of PEI callback function
Jeff Fan [Thu, 21 Jul 2016 08:33:11 +0000 (16:33 +0800)]
UefiCpuPkg/MpInitLib: Register one End of PEI callback function

In PeiMpInitLib, register End of PEI callback function CpuMpEndOfPeiCallback().

v5:
  1. Add comment block for mMpInitLibNotifyList.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Save CPU MP Data pointer
Jeff Fan [Thu, 21 Jul 2016 08:08:12 +0000 (16:08 +0800)]
UefiCpuPkg/MpInitLib: Save CPU MP Data pointer

In PeiMpInitLib, save CPU MP Data pointer into one local Guided HOB.
In DxeMpInitLib, save CPU MP Data pointer into one global variable.

Add helper functions GetCpuMpData()/SaveCpuMpData().

v5:
  1. Move CPU_INIT_MP_LIB_HOB_GUID from MpLib.c to MpLib.h to make
     all C files visible.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add MicrocodeDetect() and load microcode on BSP
Jeff Fan [Wed, 20 Jul 2016 15:49:35 +0000 (23:49 +0800)]
UefiCpuPkg/MpInitLib: Add MicrocodeDetect() and load microcode on BSP

v4:
  1. ProcessorSignature is updated to CPU_MICROCODE_PROCESSOR_SIGNATURE
     instead of UINT32.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add CPU_VOLATILE_REGISTERS & worker functions
Jeff Fan [Wed, 20 Jul 2016 15:47:59 +0000 (23:47 +0800)]
UefiCpuPkg/MpInitLib: Add CPU_VOLATILE_REGISTERS & worker functions

Add CPU_VOLATILE_REGISTERS definitions for CRx and DRx required to be restored
after APs received INIT IPI.

Add worker functions SaveVolatileRegisters()/RestoreVolatileRegisters() used to
save/restore CRx and DRx. It also check if Debugging Extensions supported or
not.

v5:
  1. Add comment block for structure CPU_VOLATILE_REGISTERS.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Initialize CPU_AP_DATA for CPU APs
Jeff Fan [Wed, 20 Jul 2016 15:43:29 +0000 (23:43 +0800)]
UefiCpuPkg/MpInitLib: Initialize CPU_AP_DATA for CPU APs

Initialize CPU_AP_DATA for CPU APs and add GetApState()/SetApState() helper
functions to get/set AP state.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Allocate and initialize memory of MP Data buffer
Jeff Fan [Wed, 20 Jul 2016 15:33:25 +0000 (23:33 +0800)]
UefiCpuPkg/MpInitLib: Allocate and initialize memory of MP Data buffer

v5:
  1. Add comment block for enum AP_INIT_STATE and structure CPU_AP_DATA.
  2. Add more comment for structure CPU_INFO_IN_HOB.
  3. Add more clarification in structure _CPU_MP_DATA for those fields
     pass from PEI to DXE.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size
Jeff Fan [Wed, 20 Jul 2016 15:32:17 +0000 (23:32 +0800)]
UefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size

Firstly, get ApLoopMode from PcdCpuApLoopMode. If MonitorMwait feature is not
supported, update ApLoopMode to ApHltLoop. If MonitorMwait feature is supported,
get MointorFilter size by CPUID.[EAX=05H]:EBX.BIT0-15.

v5:
  1. Add comment block for enum AP_LOOP_MODE.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP
Jeff Fan [Wed, 20 Jul 2016 14:56:09 +0000 (22:56 +0800)]
UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP

In MpInitLibInitialize(), invoke AsmGetAddress() to get get assembly functions'
entry addresses and the sizes from returned MP_ASSEMBLY_ADDRESS_MAP structure.

v5:
  1. Add more detailed comments for structure MP_ASSEMBLY_ADDRESS_MAP.

v4:
  1. Add AsmRelocateApLoop information return in AsmGetAddress().

v3:
  1. Rename AsmRellocateApLoop to AsmRelocateApLoop.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add AsmRelocateApLoop() assembly code
Jeff Fan [Wed, 20 Jul 2016 14:47:47 +0000 (22:47 +0800)]
UefiCpuPkg/MpInitLib: Add AsmRelocateApLoop() assembly code

AsmRelocateApLoop() is used to place APs into MWAIT-loop if MonitorMwait
feature is supported before hand-off to OS, or place APs into HLT-loop if
MonitorMwait feature is not supported.

If the current mode is long mode, we will switch APs to protected mode
before placing APs in MWAIT-loop or HLT-loop. Thus, once APs wakeup from
loop, APs needn't the page table that may be crashed by OS.

v3:
  1. Rename AsmRellocateApLoop to AsmRelocateApLoop.
  2. Fix typo Proteced to Protected.
  3. Fix typo segement to segment
  4. Use word MONITOR instead of mwait-monitor.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add EnableExecuteDisable in MP_CPU_EXCHANGE_INFO
Jeff Fan [Fri, 29 Jul 2016 13:13:34 +0000 (21:13 +0800)]
UefiCpuPkg/MpInitLib: Add EnableExecuteDisable in MP_CPU_EXCHANGE_INFO

EnableExecuteDisable in MP_CPU_EXCHANGE_INFO is used to tell AP reset vector if
enable execute disable feature on APs. This feature should be enabled before CR3
is written.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Fix typo and clean up the code
Jeff Fan [Fri, 29 Jul 2016 13:08:01 +0000 (21:08 +0800)]
UefiCpuPkg/MpInitLib: Fix typo and clean up the code

1. Rename NumApsExecutingLoction to NumApsExecutingLocation
2. Update some comments in NASM files.
3. Remove PeiCpuMpData from MP_CPU_EXCHANGE_INFO.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO
Jeff Fan [Wed, 20 Jul 2016 14:44:39 +0000 (22:44 +0800)]
UefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO

Add assembly code for AP reset vector and the definition of MP_CPU_EXCHANGE_INFO
that are used to exchange the data between C code and assembly code when AP wake
up.

v4:
  1. Copy MP_CPU_EXCHANGE_INFO from UefiCpuPkg/CpuMpPei/CpuMpPei.h
  2. Copy MpEqu.inc and MpFuncs.nasm from UefiCpuPkg/CpuMpPei.

v3:
  1. Rename NumApsExecutingLoction to NumApsExecutingLocation
  2. Add whitespace after ; in .nasm file

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib
Jeff Fan [Wed, 20 Jul 2016 13:56:58 +0000 (21:56 +0800)]
UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib

Add two MP Initialize Library instances PeiMpInitLib.inf and DxeMpInitLib.inf
with NULL implementation.

One PeiMpInitLib.inf is consumed by PEI MP driver. Another DxeMpInitLib.inf is
consumed by DXE MP driver.

Place MpInitLibStartupAllAPs()/MpInitLibStartupThisAp()/MpInitLibSwitchBSP()/
MpInitLibEnableDisableAP() into PeiMpLib.c and DxeMpLib.c, because they have
the different implementations and will be updated in latter patches.

v5:
  1. Add back PeiExceptionHandlerLib.inf in UefiCpuPkg.dsc. It is removed
     incorrectly.

v4:
  1. Return EFI_UNSUPPORTED instead of EFI_SUCCESS for NULL implementation of
     all Functions.
  2. Sync MpInitLibxxx functions header updating described in v4 part of Patch
     #4.

v3:
  1. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP to match PI spec

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add MP Initialize library class definition
Jeff Fan [Tue, 19 Jul 2016 01:39:45 +0000 (09:39 +0800)]
UefiCpuPkg/MpInitLib: Add MP Initialize library class definition

MP Initialize library provides basic functionalities to do APs initialization,
to manage MP information and to wakeup APs to execute AP task.

It could be consumed by CPU MP PEI or DXE drivers to provide CPU MP PPI/Protocol
services.

v4:
  1. MpInitLibGetProcessorInfo():
     Update HealthData type from UINT32 to EFI_HEALTH_FLAGS.
     Add #include <Ppi/SecPlatformInformation.h>
  2. MpInitLibSwitchBSP():
     Return EFI_DEVICE_ERROR instead of EFI_SUCCESS if the calling processor is
     an AP.
  3. MpInitLibStartupThisAP():
     Fix several incorrect references to "APs" to match PI spec.
  4. MpInitLibSwitchBSP() and MpInitLibEnableDisableAP():
     Fix incorrect description on ProcessorNumber.
  5. Trim whitespace at end of line.

v3:
  1. Add whitespace after MpInitLibInitialize
  2. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP to match PI spec

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe()
Jeff Fan [Wed, 20 Jul 2016 14:18:32 +0000 (22:18 +0800)]
UefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe()

Currently, we will allocate StartupVector buffer under 1MB at entry point
function. But some modules may allocate some hard code address under 1MB.
For example, LegacyBiosDxe driver tries to manage some legacy range under
640KB.

To avoid the conflicts, we move StartupVector buffer allocation to End Of
DXE event callback function.

v4:
  Update the Context parameter is used as a pointer to AcpiCpuDataEx, then
  we needn't to add the global variable.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM
Jeff Fan [Tue, 19 Jul 2016 01:49:35 +0000 (09:49 +0800)]
UefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM

Add microcode definitions defined in Intel(R) 64 and IA-32 Architectures
Software Developer's Manual Volume 3A, Section 9.11.

v4:
  1. ProcessorSignature type changed to CPU_MICROCODE_PROCESSOR_SIGNATURE
  2. Add pack(1) for structure CPU_MICROCODE_HEADER and
     CPU_MICROCODE_EXTENDED_TABLE.
v3:
  1. Update SDM date to June, 2016
  2. Mention BCD format in CPU_MICROCODE_DATE
  3. Rename ProcessorChecksum to Checksum to match SDM.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions
Jeff Fan [Wed, 20 Jul 2016 14:11:47 +0000 (22:11 +0800)]
UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions

#define MSR_IA32_APIC_BASE_ADDRESS is duplicated with #define MSR_IA32_APIC_BASE
defined in UefiCpuPkg/Include/Register/ArchitecturalMsr.h, so we could remove it
and update the modules to use MSR_IA32_APIC_BASE from ArchitecturalMsr.h.

Structure MSR_IA32_APIC_BASE conflicts with #define MSR_IA32_APIC_BASE defined
in UefiCpuPkg/Include/Register/ArchitecturalMsr.h, so we could remove it and
update the modules to use structure MSR_IA32_APIC_BASE_REGISTER from
ArchitecturalMsr.h.

v5:
  1. Update SourceLevelDebugPkg to use APIC Base MSR from ArchitecturalMsr.h.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoVlv2TbltDevicePkg: Add RAW file type to Rule.Common.SEC.BINARY
Wei, David [Fri, 12 Aug 2016 07:00:12 +0000 (15:00 +0800)]
Vlv2TbltDevicePkg: Add RAW file type to Rule.Common.SEC.BINARY

Reviewed-by: David Wei <david.wei@intel.com>
Thanks,
David  Wei

-----Original Message-----
From: Gary Lin [mailto:glin@suse.com]
Sent: Thursday, August 11, 2016 4:38 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>
Subject: [PATCH 4/4] Vlv2TbltDevicePkg: Add RAW file type to Rule.Common.SEC.BINARY

For GCC, it's using the reset vector in
IntelFspWrapperPkg/FspWrapperSecCore/Vtf0/Bin/ResetVec.ia32.raw.
Add the RAW file type to Rule.Common.SEC.BINARY in PlatformPkgGcc.fdf,
so that GenFds can handle the raw file.

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/PlatformFspLib: Fix the include path
Wei, David [Fri, 12 Aug 2016 06:55:11 +0000 (14:55 +0800)]
Vlv2TbltDevicePkg/PlatformFspLib: Fix the include path

Reviewed-by: David Wei <david.wei@intel.com>
Thanks,
David  Wei

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gary Lin
Sent: Thursday, August 11, 2016 4:38 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>
Subject: [edk2] [PATCH 3/4] Vlv2TbltDevicePkg/PlatformFspLib: Fix the include path

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/FspSupport: Fix GCC build errors
Wei, David [Fri, 12 Aug 2016 06:59:35 +0000 (14:59 +0800)]
Vlv2TbltDevicePkg/FspSupport: Fix GCC build errors

Reviewed-by: David Wei <david.wei@intel.com>
Thanks,
David  Wei

-----Original Message-----
From: Gary Lin [mailto:glin@suse.com]
Sent: Thursday, August 11, 2016 4:38 PM
To: edk2-devel@lists.01.org
Cc: Wei, David <david.wei@intel.com>
Subject: [PATCH 1/4] Vlv2TbltDevicePkg/FspSupport: Fix GCC build errors

Fix the errors from GCC:

Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.c: In function 'GetMemorySizeInMemoryTypeInformation':
Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.c:59:40: error: passing argument 1 of '(*PeiServices)->GetHobList' from incompatible pointer type [-Werror=incompatible-pointer-types]
Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.c:52:31: error: variable 'Status' set but not used [-Werror=unused-but-set-variable]

Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.c: In function 'FspHobProcessForOtherData':
Vlv2TbltDevicePkg/FspSupport/Library/PeiFspHobProcessLibVlv2/FspHobProcessLibVlv2.c:401:29: error: passing argument 1 of 'PlatformHobCreateFromFsp' from incompatible pointer type [-Werror=incompatible-pointer-types]

Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/PlatformInit.c:18:30: fatal error: Library\DebugLib.h: No such file or directory
Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/PlatformInit.c:19:35: fatal error: Library\SerialPortLib.h: No such file or directory

Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/UartInit.c:18:27: fatal error: Library\IoLib.h: No such file or directory
Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/UartInit.c:19:35: fatal error: Library\SerialPortLib.h: No such file or directory

Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/UartInit.c: In function 'EnableInternalUart':
Vlv2TbltDevicePkg/FspSupport/Library/SecFspPlatformSecLibVlv2/UartInit.c:195:20: error: pointer targets in passing argument 1 of 'SerialPortWrite' differ in signedness [-Werror=pointer-sign]

Cc: David Wei <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
7 years agoUefiCpuPkg: MTRR_PHYSMASK.Valid should be one bit instead of 8 bits
Ruiyu Ni [Mon, 15 Aug 2016 08:40:16 +0000 (16:40 +0800)]
UefiCpuPkg: MTRR_PHYSMASK.Valid should be one bit instead of 8 bits

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoShellPkg/Ls: Handle the case when SearchString is NULL
Ruiyu Ni [Tue, 16 Aug 2016 07:32:18 +0000 (15:32 +0800)]
ShellPkg/Ls: Handle the case when SearchString is NULL

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
7 years agoSecurityPkg: AuthVariableLib: Fix inconsistent CertDB case
Zhang, Chao B [Tue, 16 Aug 2016 02:21:42 +0000 (10:21 +0800)]
SecurityPkg: AuthVariableLib: Fix inconsistent CertDB case

  2 steps are used to create/delete a time based variable.
  For create
     step 1: Insert Signer Cert to CertDB.
     Step 2: Insert Payload to Variable.
  For delete
     step 1: Delete Variable.
     Step 2: Delete Cert from CertDB.
  System may breaks between step 1 & step 2, so CertDB may contains useless
Cert in the next reboot. AuthVariableLib choose to sync consistent state
between CertDB & Time Auth Variable on initialization. However, it doesn't
apply Time Auth attribute check. Now add it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Zeng Star <star.zeng@intel.com>
7 years agoMdePkg: Fix guid conflict.
Dong, Eric [Fri, 12 Aug 2016 02:09:48 +0000 (10:09 +0800)]
MdePkg: Fix guid conflict.

Update Image Decoder Protocol GUID value to fix GUID
conflict with EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/PeiCore: Fix ConverSinglePpiPointer () typo.
Marvin Haeuser [Sat, 13 Aug 2016 01:54:27 +0000 (09:54 +0800)]
MdeModulePkg/PeiCore: Fix ConverSinglePpiPointer () typo.

Rename ConverSinglePpiPointer () to ConvertSinglePpiPointer ().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoBaseTools/GenFv: Account for rebase of FV section containing VTF file
Leo Duran [Wed, 10 Aug 2016 21:13:26 +0000 (16:13 -0500)]
BaseTools/GenFv: Account for rebase of FV section containing VTF file

Account for rebase of FV section containing VTF file on IA32/IA64.
This supports cases where the reset vector may not be set at 0xFFFFFFF0.

For example, FV section defined as:
[FV.FvSecPei]
  FvBaseAddress = $(FV_BOOT_BASE)
  FvForceRebase = TRUE

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leo Duran <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoPcAtChipsetPkg AcpiTimerLib: Get more accurate TSC Frequency
Star Zeng [Mon, 8 Aug 2016 03:39:25 +0000 (11:39 +0800)]
PcAtChipsetPkg AcpiTimerLib: Get more accurate TSC Frequency

Minimize the code overhead between the two TSC reads by adding
new internal API to calculate TSC Frequency instead of reusing
MicroSecondDelay ().

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Paul A Lohr <paul.a.lohr@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
7 years agoMdePkg RVCT: add definition of UNREACHABLE
Ard Biesheuvel [Thu, 11 Aug 2016 18:13:31 +0000 (20:13 +0200)]
MdePkg RVCT: add definition of UNREACHABLE

The RVCT compiler in --gnu mode appears to simply strip of the __builtin
prefix when it encounters calls to __builtin_xxx() functions, and so
the __builtin_unreachable() we emit for GCC results in linker errors
regarding undefined references against 'unreachable()'.

So define UNREACHABLE() to a NOP instead.

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 RVCT: ignore various RVC diagnostics
Ard Biesheuvel [Thu, 11 Aug 2016 18:11:30 +0000 (20:11 +0200)]
BaseTools RVCT: ignore various RVC diagnostics

This updates the RVCT CC flags so various diagnostics that trigger
warnings-as-errors are silenced. In particular, RVCT complains about
missing newlines at the end of source files, mixing of enums and int
values and return statements followed by a break, all of which occur
in the Tianocore codebase, but none of which are actual errors in the
code. So just silence them.

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 ARM AARCH64: drop redundant compiler arguments
Ard Biesheuvel [Thu, 11 Aug 2016 11:11:23 +0000 (13:11 +0200)]
BaseTools ARM AARCH64: drop redundant compiler arguments

The ARM and AARCH64 CC_FLAGS definitions include both GCC_ALL_CC_FLAGS
and GCC44_ALL_CC_FLAGS, resulting in many of the compiler arguments
being passed twice. Since the CLANG35 definitions do not refer to
GCC44_ALL_CC_FLAGS, drop the reference for GCCx 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 agoBaseTools ARM AARCH64: pass CC flags to linker for XIP modules as well
Ard Biesheuvel [Thu, 11 Aug 2016 10:57:53 +0000 (12:57 +0200)]
BaseTools ARM AARCH64: pass CC flags to linker for XIP modules as well

Commit 478f50990a ("BaseTools GCC: add the compiler flags to the linker
command line") added the compiler flags to the linker command line,
which is required for LTO to function correctly, since it involves code
generation at link time.

This patch failed to update the build rules for XIP modules on AARCH64,
which not only requires the ordinary CC flags but also the XIP CC flags
to prevent the LTO backend to, e.g., emit code that does not adhere to
the strict alignment rules we impose for code that may execute with the
MMU off.

So update the XIP link rules as well. Since AARCH64 and ARM are not
supported by any toolchains in the GCCLD build rule family, drop the
reference to GCCLD while we're at 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>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/Browser: Enhance the logic when getting value from AltResp
Dandan Bi [Thu, 4 Aug 2016 08:58:14 +0000 (16:58 +0800)]
MdeModulePkg/Browser: Enhance the logic when getting value from AltResp

This patch is to enhance SetupBrowser to handle following two cases:
1. When searching BlockName in AltResp, the hex digits of related BlockName
   in AltResp may be in uppercase.
2. When converting the Value in AltResp to HiiValue, the length of value
   string is bigger than the length of StorageWidth of the question.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTool/VfrCompile: Remove reset button opcode in CheckQuestionOpCode
Dandan Bi [Wed, 10 Aug 2016 08:53:57 +0000 (16:53 +0800)]
BaseTool/VfrCompile: Remove reset button opcode in CheckQuestionOpCode

"EFI_IFR_RESET_BUTTON_OP" is a statement, not a question,
so remove it from function CheckQuestionOpCode.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoArmPlatformPkg/ArmPlatformStackLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:55:23 +0000 (16:55 +0200)]
ArmPlatformPkg/ArmPlatformStackLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg(),
and remove the workaround that was added to allow conditional branches
to functions with external linkage.

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/ArmPlatformLibNull: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:54:12 +0000 (16:54 +0200)]
ArmPlatformPkg/ArmPlatformLibNull: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg()

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/ArmVExpressPkg: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:51:11 +0000 (16:51 +0200)]
ArmPlatformPkg/ArmVExpressPkg: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg()

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/PrePeiCore: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:24:24 +0000 (16:24 +0200)]
ArmPlatformPkg/PrePeiCore: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg()

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/PrePi: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:04:27 +0000 (16:04 +0200)]
ArmPlatformPkg/PrePi: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg()

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/ArmJunoLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 14:03:42 +0000 (16:03 +0200)]
ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg()

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 agoBeagleBoardPkg: add missing ArmMmuLib resolution
Ard Biesheuvel [Wed, 10 Aug 2016 13:49:24 +0000 (15:49 +0200)]
BeagleBoardPkg: add missing ArmMmuLib resolution

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/SemihostLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:39:26 +0000 (14:39 +0200)]
ArmPkg/SemihostLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:38:08 +0000 (14:38 +0200)]
ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections. Note that in some cases, various entry points
refer to different parts of the same routine, so in those cases,
the files have been left untouched.

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/BaseMemoryLibVstm: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:37:28 +0000 (14:37 +0200)]
ArmPkg/BaseMemoryLibVstm: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/BaseMemoryLibSm: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:37:10 +0000 (14:37 +0200)]
ArmPkg/BaseMemoryLibSm: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmSmcLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:36:47 +0000 (14:36 +0200)]
ArmPkg/ArmSmcLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmMmuLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:35:38 +0000 (14:35 +0200)]
ArmPkg/ArmMmuLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:35:01 +0000 (14:35 +0200)]
ArmPkg/ArmLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmHvcLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:34:17 +0000 (14:34 +0200)]
ArmPkg/ArmHvcLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmGicV3: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:33:49 +0000 (14:33 +0200)]
ArmPkg/ArmGicV3: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmCpuLib: switch to ASM_FUNC() asm macro
Ard Biesheuvel [Wed, 10 Aug 2016 12:33:09 +0000 (14:33 +0200)]
ArmPkg/ArmCpuLib: switch to ASM_FUNC() asm macro

Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

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/ArmSmcLibNull: move to generic C implementation
Ard Biesheuvel [Wed, 10 Aug 2016 12:09:56 +0000 (14:09 +0200)]
ArmPkg/ArmSmcLibNull: move to generic C implementation

The C language is powerful enough to implement a function that does
absolutely nothing, so there is no need to resort to implementations
in assembler for various toolchains/architectures.

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 agoArmVirtPkg: clean up assembly source files
Ard Biesheuvel [Wed, 10 Aug 2016 11:08:57 +0000 (13:08 +0200)]
ArmVirtPkg: clean up assembly source files

This updates all assembly source files under ArmVirtPkg to mark
exported functions as ASM_FUNC(), which puts them in a separate
section, allowing the linker to prune code that is left unused.

At the same time, clean up the code to get rid of LoadConstantToReg()
instances involving symbol references, each of which emits an absolute
literal, and hence and entry in the PE/COFF .reloc table.

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 agoArmVirt/PrePi: make jump to CEntryPoint relative
Ard Biesheuvel [Fri, 5 Aug 2016 12:02:50 +0000 (14:02 +0200)]
ArmVirt/PrePi: make jump to CEntryPoint relative

The ArmVirtPkg platforms that use PrePi have no notion of boot remapped
aliases, so we can simply jump to CEntryPoint() directly rather than
via an absolute reference.

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: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macros
Ard Biesheuvel [Wed, 10 Aug 2016 09:43:50 +0000 (11:43 +0200)]
ArmPkg: introduce ASM_FUNC, MOV32/MOV64 and ADRL/LDRL macros

This introduces the ASM_FUNC() macro to annotate function entry points
in assembler files. This allows us to add additional metadata that
marks a function entry point as a function, and allows us to emit
a .section directive for each function, which makes it possible for
the linker to drop unreferenced code.

In addition, introduce a couple of utility macros that we can use to
clean up the code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoArmPlatformPkg RVCT: drop dependency on GCC macro library
Ard Biesheuvel [Wed, 10 Aug 2016 13:50:25 +0000 (15:50 +0200)]
ArmPlatformPkg RVCT: drop dependency on GCC macro library

The RVCT .asm files include AsmMacroIoLib.h only for the definition of
LoadConstantToReg (), which makes it tedious to make change to that file
without the risk of making the RVCT assembler unhappy. So simply replace
LoadConstantToReg() with mov32, which does the right thing in all cases.

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/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros
Ard Biesheuvel [Wed, 10 Aug 2016 09:58:51 +0000 (11:58 +0200)]
ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros

This removes the various Mmio ASM macros that are not used anywhere in
the code, and removes some variants of LoadConstant... () that are not
used anywhere either.

Note that these MmioXxx() implementations are unrelated to the C versions
defined in MdePkg. These are strictly intended for use in assembler, and
no such uses remain.

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: add missing ArmMmuLib resolution to ArmPkg.dsc
Ard Biesheuvel [Wed, 10 Aug 2016 12:08:50 +0000 (14:08 +0200)]
ArmPkg: add missing ArmMmuLib resolution to ArmPkg.dsc

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 agoArmLib: remove ArmReplaceLiveTranslationEntry() implementation
Ard Biesheuvel [Wed, 10 Aug 2016 11:43:17 +0000 (13:43 +0200)]
ArmLib: remove ArmReplaceLiveTranslationEntry() implementation

The function ArmReplaceLiveTranslationEntry() has been moved to
ArmMmuLib, so remove the old implementation from ArmLib.

Note that the new implementation was not exported from the object file,
and so references to it were satisfied by the old version residing in
ArmLib. Since we are removing that one, we need to export the new one
at the same time to prevent the linker from bailing with undefined
reference errors.

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 agoMdeModulePkg/DriverSample: Skip the character "&" before "OFFSET="
Dandan Bi [Tue, 9 Aug 2016 01:52:18 +0000 (09:52 +0800)]
MdeModulePkg/DriverSample: Skip the character "&" before "OFFSET="

When comparing the L"OFFSET=" with the ConfigResp string to find
all the "OFFSET=" in ConfigResp, should skip the character "&"
before "OFFSET=" in ConfigResp string.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg/HiiImageEx: Fix incorrect parameter type in GetImageInfo()
Dandan Bi [Fri, 15 Jul 2016 07:31:36 +0000 (15:31 +0800)]
MdePkg/HiiImageEx: Fix incorrect parameter type in GetImageInfo()

In latest UEFI2.6 spec, the type of the fourth parameter in function
GetImageInfo() is "EFI_IMAGE_OUTPUT", but in the header file, it is
"EFI_IMAGE_INPUT". Now correct it to follow the spec.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Cecil Sheng <cecil.sheng@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/Browser: Share default if some default value are not specified
Dandan Bi [Wed, 10 Aug 2016 11:54:21 +0000 (19:54 +0800)]
MdeModulePkg/Browser: Share default if some default value are not specified

Add a new implementation policy of getting default value in SetupBrowser.
The new policy is only for the situation that a question has default
value but doesn't have default value for all supported default type.
In this case, we will choose the smallest default id from the existing
defaults, and share its value to other default id which has no
default value.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdeModulePkg/HiiDB: Share default if some default value are not specified
Dandan Bi [Thu, 28 Jul 2016 06:19:39 +0000 (14:19 +0800)]
MdeModulePkg/HiiDB: Share default if some default value are not specified

Add a new implementation policy of getting default value in HiiDatabase.
The new policy is only for the situation that a question has default
value but doesn't have default value for all supported default type.
In this case, we will choose the smallest default id from the existing
defaults, and share its value to other default id which has no
default value.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoCryptoPkg: Fix "responsiblity" typos
Thomas Huth [Fri, 5 Aug 2016 21:00:25 +0000 (05:00 +0800)]
CryptoPkg: Fix "responsiblity" typos

It's "responsibility", not "responsiblity".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoCryptoPkg: Fix capitalization of path name in Patch-HOWTO.txt
Thomas Huth [Fri, 5 Aug 2016 20:50:50 +0000 (04:50 +0800)]
CryptoPkg: Fix capitalization of path name in Patch-HOWTO.txt

It's "OpensslLib", not "OpenSslLib" - not a big issue, but the
typo is annoying when trying to copy-n-paste the path name to
use it on the command line on Linux.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoCryptoPkg IntrinsicLib: Add the missing nasm source file
Liming Gao [Wed, 10 Aug 2016 12:22:58 +0000 (20:22 +0800)]
CryptoPkg IntrinsicLib: Add the missing nasm source file

Add two name files IntrinsicLib Ia32 MathLShiftS64.nasm and MathRShiftU64.nasm

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
7 years agoArmVirtPkg/PrePi: use correct callee saved regs
Ard Biesheuvel [Fri, 5 Aug 2016 14:41:32 +0000 (16:41 +0200)]
ArmVirtPkg/PrePi: use correct callee saved regs

Both the ARM and the AARCH64 versions of the PrePi code (shared between
ArmVirtQemuKernel and ArmVirtXen) 'preserve' values across a function
call using registers that are not in fact callee saved. So fix that.

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 agoShellPkg-UefiShellCommandLib: Add EFIAPI in VA_List library function
Shi, Steven [Wed, 3 Aug 2016 09:43:06 +0000 (17:43 +0800)]
ShellPkg-UefiShellCommandLib: Add EFIAPI in VA_List library function

Add EFIAPI in CatPrint library function. Every function which uses
variable list need explicit use EFIAPI to force use MS ABI. This change
is needed to pass CLANG38 build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoShellPkg-UefiShellTftpCommandLib: Replace compiler builtin
Shi, Steven [Wed, 3 Aug 2016 09:43:05 +0000 (17:43 +0800)]
ShellPkg-UefiShellTftpCommandLib: Replace compiler builtin

Use explicit CopyMem to replace compiler builtin to do the structure
values assignment. This change is needed to pass CLANG38 build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoBaseTools-Conf:Introduce CLANG38 new toolchain for x86
Shi, Steven [Wed, 3 Aug 2016 09:43:04 +0000 (17:43 +0800)]
BaseTools-Conf:Introduce CLANG38 new toolchain for x86

This adds support for LLVM 3.8.x in LTO mode for IA32 and X64.
CLANG38 enable LLVM Link Time Optimization (LTO) and code size
optimization flag (-Oz) by default for aggressive code size
improvement. CLANG38 X64 code is small code model + PIE.

CLANG LTO needs PIE in link flags to generate PIE code correctly,
otherwise the PIE is not really enabled. (e.g. OvmfPkgX64 will
hang in 64bits SEC at high address because of small model code
displacement overflow).

Test pass platforms: OVMF (OvmfPkgIa32.dsc, OvmfPkgX64.dsc and
OvmfPkgIa32X64.dsc).
Test compiler and linker version: LLVM 3.8, GNU ld 2.26.

Example steps to use the CLANG38 tool chain to build OVMF platform:
1. Download and extract the llvm 3.8.0 Pre-Built Binaries from
http://www.llvm.org/releases/ (e.g. http://www.llvm.org/releases/
3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz and
extract it as ~/clang38).
2. Copy LLVMgold.so from https://github.com/shijunjing/edk2/blob/
llvm/BaseTools/Bin/LLVMgold.so to above clang lib folder (e.g.
~/clang38/lib/LLVMgold.so)
3. Install new version linker with plugin support (e.g. ld 2.26 in
GNU Binutils 2.26 or Ubuntu16.04)
$ cd edk2
$ git checkout llvm
$ export CLANG38_BIN=path/to/your/clang38/
(e.g. export CLANG38_BIN=~/clang38/bin/)
$ source edksetup.sh
$ make -C BaseTools/Source/C
$ build -t CLANG38 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -b DEBUG
-DDEBUG_ON_SERIAL_PORT
$ cd edk2/Build/OvmfX64/DEBUG_CLANG38/FV
$ qemu-system-x86_64.exe -bios OVMF.fd -serial file:serial.log -m 4096
 -hda fat:.

If you want, you can build and install GNU Binutils 2.26 as below steps
in Ubuntu:
Download binutils-2.26 source code from http://ftp.gnu.org/gnu/binutils/
 and extract it to ~/binutils-2.26
$sudo apt-get install bison
$sudo apt-get install flex
Install other necessary binutils build tools if missing
$ mkdir build
$ cd build
$ ../binutils-2.26/configure --enable-gold --enable-plugins
--disable-werror --prefix=/usr
$ make -j 5
$ sudo make install

If you want, you can build LLVMgold.so as below steps
Download llvm-3.8.0 source code from http://www.llvm.org/releases/
3.8.0/llvm-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src
Download clang3.8.0 source code from http://www.llvm.org/releases/
3.8.0/cfe-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src/tools/clang
Refer http://clang.llvm.org/get_started.html to Install other necessary
clang build tools if missing
$ mkdir llvm38build
$ cd llvm38build
If your GNU Binutils 2.26 is in /home/jshi19/binutils-2.26,
$ cmake ../llvm-3.8.0.src -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"
-DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_C_COMPILER="/usr/bin/gcc"
-DLLVM_BINUTILS_INCDIR=/home/jshi19/binutils-2.26/include
$ make -j 5 LLVMgold The LLVMgold.so is in ~/llvm38build/lib/LLVMgold.so

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools-Conf:Remove short dash in ar flag for LLVM
Shi, Steven [Wed, 3 Aug 2016 09:43:03 +0000 (17:43 +0800)]
BaseTools-Conf:Remove short dash in ar flag for LLVM

Both binutils ar and LLVM ar support "cr", but LLVM ar doens't
support add "-" in the flags, and llvm-ar cannot accept "-cr".
So remove the short dash "-" to make llvm archives work.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoShellPkg/ls: Display the correct directory path
Ruiyu Ni [Mon, 8 Aug 2016 10:21:32 +0000 (18:21 +0800)]
ShellPkg/ls: Display the correct directory path

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoShellPkg/ls: Fix to support "ls fs0:File.txt"
Ruiyu Ni [Mon, 8 Aug 2016 07:02:44 +0000 (15:02 +0800)]
ShellPkg/ls: Fix to support "ls fs0:File.txt"

“ls fs0:\File.txt" can list the file correctly but
when the backslash is removed from colon, the file cannot
be listed.
The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoMdePkg: Enhance PathRemoveLastItem() to support "FS0:File.txt"
Ruiyu Ni [Mon, 8 Aug 2016 06:55:10 +0000 (14:55 +0800)]
MdePkg: Enhance PathRemoveLastItem() to support "FS0:File.txt"

The original implementation only looks for very last backslash
and removes the string after that.
But when the path is like "FS0:File.txt" which doesn't contain
backslash, the function cannot work well.
The patch enhances the code to look for very last backslash or
colon to support the path which doesn't contain backslash.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoShellPkg: Fix FindFiles() to handle "fsx:EFI\BOOT" path
Ruiyu Ni [Fri, 5 Aug 2016 05:12:56 +0000 (13:12 +0800)]
ShellPkg: Fix FindFiles() to handle "fsx:EFI\BOOT" path

When the FilePattern is similar to "fsx:EFI\BOOT", FindFiles()
cannot handle it correctly because it always assumes there is
"\\" after "fsx:".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoShellPkg: TAB logic incorrectly shows files in CWD when typing \<TAB>
Ruiyu Ni [Fri, 5 Aug 2016 05:10:11 +0000 (13:10 +0800)]
ShellPkg: TAB logic incorrectly shows files in CWD when typing \<TAB>

It should shows files in root directory of current map.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoShellPkg: TAB logic incorrectly chops out fs0: when typing fs0:<TAB>
Ruiyu Ni [Fri, 5 Aug 2016 02:24:48 +0000 (10:24 +0800)]
ShellPkg: TAB logic incorrectly chops out fs0: when typing fs0:<TAB>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoStdLib/LibC ARM AARCH64: do not redefine compiler intrinsics
Ard Biesheuvel [Mon, 8 Aug 2016 11:03:46 +0000 (13:03 +0200)]
StdLib/LibC ARM AARCH64: do not redefine compiler intrinsics

The memset() function is a compiler intrinsic on AARCH64 and ARM, and
so is memmove() on ARM. Usually, redefining them as LibC currently does
is not a problem since only one version will be selected at link time
from the various static libraries that provide implementations. However,
under LTO, this is slightly different, since explicit references (in the
C code) and implicit references (emitted by the compiler backend) may
resolve to different versions (LTO vs non-LTO), causing conflicts.

So simply omit them for ARM/AARCH64 resp. ARM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoStdLib/LibC: avoid LTO code for compiler intrinsics
Ard Biesheuvel [Mon, 8 Aug 2016 10:46:50 +0000 (12:46 +0200)]
StdLib/LibC: avoid LTO code for compiler intrinsics

The softfloat routines and some other routines supplied by LibC
will satisfy references to compiler intrinsics that are emitted
by the compiler backend, which under LTO means that the link-time
code generation may emit references to symbols that have been
optimized away already.

Work around this by building the ARM and AARCH64 versions of LibC
and the softfloat library without LTO.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>