]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
7 years agoIntelFrameworkModulePkg FwVolDxe: Return correct AuthStatus for FvReadFile
Star Zeng [Fri, 26 Aug 2016 08:27:06 +0000 (16:27 +0800)]
IntelFrameworkModulePkg FwVolDxe: Return correct AuthStatus for FvReadFile

Inherit the authentication status from FV.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed by: Chao Zhang <chao.b.zhang@intel.com>

7 years agoMdeModulePkg DxeCore: Return correct AuthStatus for FvReadFile
Star Zeng [Fri, 12 Aug 2016 08:21:17 +0000 (16:21 +0800)]
MdeModulePkg DxeCore: Return correct AuthStatus for FvReadFile

Inherit the authentication status from FV.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed by: Chao Zhang <chao.b.zhang@intel.com>

7 years agoArmVirtPkg: enable EBC interpreter for AArch64
Leif Lindholm [Fri, 29 Jul 2016 15:06:52 +0000 (16:06 +0100)]
ArmVirtPkg: enable EBC interpreter for AArch64

Since we now have EBC support for AArch64, enable it by default
on both QEMU and Xen platforms.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoMdeModulePkg/EbcDxe: Add AARCH64 EBC VM support
Jeff Brasen [Wed, 17 Feb 2016 19:13:48 +0000 (12:13 -0700)]
MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

Adds support for the EBC VM for AARCH64 platforms

Submitted on behalf of a third-party: The Linux Foundation
This contribution is licensed under the BSD license as found at
http://opensource.org/licenses/bsd-license.php

[Taken from https://source.codeaurora.org/external/server/edk2-blue/]
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
7 years agoUefiCpuPkg/MpInitLib: Don't allocate reset vector in Exit Boot Service
Jeff Fan [Wed, 24 Aug 2016 14:42:32 +0000 (22:42 +0800)]
UefiCpuPkg/MpInitLib: Don't allocate reset vector in Exit Boot Service

In Exit Boot Services callback function, we cannot use allocate memory services
because it may change the memory map that has been gotten by OS.

This fix is not to allocate reset vector buffer after SaveRestoreFlag is set to
TRUE in MpInitExitBootServicesCallback(). Instead AllocateResetVector() will use
the previous allocated buffer address and save the contents before copying reset
vector code. At the same time, FreeResetVector() will restore original contents
after if SaveRestoreFlag is TRUE.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Move two functions location
Jeff Fan [Wed, 24 Aug 2016 14:41:40 +0000 (22:41 +0800)]
UefiCpuPkg/MpInitLib: Move two functions location

Just move BackupAndPrepareWakeupBuffer() and RestoreWakeupBuffer() from
PeiMpLib.c to MpLib.c.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Fix function header comments typo
Jeff Fan [Wed, 24 Aug 2016 14:12:52 +0000 (22:12 +0800)]
UefiCpuPkg/MpInitLib: Fix function header comments typo

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Rename EndOfPeiFlag to SaveRestoreFlag
Jeff Fan [Wed, 24 Aug 2016 14:02:48 +0000 (22:02 +0800)]
UefiCpuPkg/MpInitLib: Rename EndOfPeiFlag to SaveRestoreFlag

It will be used by DxePeiLib also.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Move allocating reserved memory for AP loop code
Jeff Fan [Wed, 24 Aug 2016 13:58:04 +0000 (21:58 +0800)]
UefiCpuPkg/MpInitLib: Move allocating reserved memory for AP loop code

In Exit Boot Services callback function, we cannot use allocate memory services
because it may change the memory map that has been gotten by OS.

This fix is to move allocating reserved memory for AP loop code to
InitMpGlobalData() and save the memory address in one global variable.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoUefiCpuPkg/MpInitLib: Move timeout delay to WakupAp()
Jeff Fan [Wed, 24 Aug 2016 13:37:14 +0000 (21:37 +0800)]
UefiCpuPkg/MpInitLib: Move timeout delay to WakupAp()

After sending the 1st broadcast INIT-SIPI-SIPI, BSP will collect APs count after
one specified timeout delay. However, WakupAp() will restore reset vector
immediately after sending 1st broadcast INIT-SIPI-SIPI. Some processors may not
complete executing reset vector code.

This fix is to move MicroSecondDelay() from CollectProcessorCount() to the place
that is after sending 1st broadcast INIT-SIPI-SIPI and before FreeResetVector()
in WakupAp().

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoRevert "ShellPkg: Move FindFirstCharacter/GetNextParameter to ShellCommandLib"
Ruiyu Ni [Tue, 23 Aug 2016 02:40:55 +0000 (10:40 +0800)]
Revert "ShellPkg: Move FindFirstCharacter/GetNextParameter to ShellCommandLib"

This reverts commit c0bcd3433f33876c519bf5567e0ab69261b57fe9.
The above commit causes several regression of "echo" command:
1. Double quotes are not being stripped from the final text. UEFI Shell 2.2 section 3.4.5 chops out the quotes.
2. Output redirection is not working as expected. Text is being redirected, but the ‘> …’ text should not be.
3. Inconsistent special character handling.  For example, comments with # seem to be parsed out correctly, but handing of ^ is incorrect.
In summary, ‘echo “You are ^#1” > t.txt’ results in the below content in t.txt:
 “You are ^#1” > t.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoRevert "ShellPkg: Add Shell[Get|Set]RawCmdLine to ShellCommandLib"
Ruiyu Ni [Tue, 23 Aug 2016 02:40:42 +0000 (10:40 +0800)]
Revert "ShellPkg: Add Shell[Get|Set]RawCmdLine to ShellCommandLib"

This reverts commit 0fcf8d4df85d861b6e721bd1d8abb449f05e15ed.
The above commit causes several regression of "echo" command:
1. Double quotes are not being stripped from the final text. UEFI Shell 2.2 section 3.4.5 chops out the quotes.
2. Output redirection is not working as expected. Text is being redirected, but the ‘> …’ text should not be.
3. Inconsistent special character handling.  For example, comments with # seem to be parsed out correctly, but handing of ^ is incorrect.
In summary, ‘echo “You are ^#1” > t.txt’ results in the below content in t.txt:
 “You are ^#1” > t.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoRevert "ShellPkg: Fix echo to support displaying special characters"
Ruiyu Ni [Tue, 23 Aug 2016 02:40:02 +0000 (10:40 +0800)]
Revert "ShellPkg: Fix echo to support displaying special characters"

This reverts commit 95fc5a877502a6e6324300eed0136243d359fa96.
The above commit causes several regression of "echo" command:
1. Double quotes are not being stripped from the final text. UEFI Shell 2.2 section 3.4.5 chops out the quotes.
2. Output redirection is not working as expected. Text is being redirected, but the ‘> …’ text should not be.
3. Inconsistent special character handling.  For example, comments with # seem to be parsed out correctly, but handing of ^ is incorrect.
In summary, ‘echo “You are ^#1” > t.txt’ results in the below content in t.txt:
 “You are ^#1” > t.txt

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
7 years agoMdeModulePkg:Fix bug in function AsciiStrToIp4.
Zhang Lubo [Fri, 19 Aug 2016 07:38:20 +0000 (15:38 +0800)]
MdeModulePkg:Fix bug in function AsciiStrToIp4.

If a FQDN contains 3 dots '.' like "a.b.c.com", the AsciiStrToIp4
will return success as the HostName has a valid IP address. So we
need to check if it is a decimal character before using AsciiStrDecimalToUintn.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
7 years agoBaseTools/GenFw: ignore dynamic RELA sections
Ard Biesheuvel [Mon, 22 Aug 2016 10:00:08 +0000 (12:00 +0200)]
BaseTools/GenFw: ignore dynamic RELA sections

When building PIE (ET_DYN) executables, an additional RELA section is
emitted (in addition to the per-section .rela.text and .rela.data sections)
that is intended to be resolved at runtime by a ET_DYN compatible loader.

At the moment, due to the fact that we don't support GOT based relocations,
this dynamic RELA section only contains relocations that are redundant,
i.e., each R_xxx_RELATIVE relocation it contains duplicates a R_xxx_xx64
relocation appearing in .rela.text or .rela.data, and so we can simply
ignore this section (and we already ignore it in practice due to the fact
that it points to the NULL section, which has the SHF_ALLOC bit cleared).

For example,

  Section Headers:
    [Nr] Name              Type             Address           Offset
         Size              EntSize          Flags  Link  Info  Align
    [ 0]                   NULL             0000000000000000  00000000
         0000000000000000  0000000000000000           0     0     0
    [ 1] .text             PROGBITS         0000000000000240  000000c0
         000000000000427c  0000000000000008  AX       0     0     64
    [ 2] .rela.text        RELA             0000000000000000  00009310
         0000000000001bf0  0000000000000018   I       7     1     8
    [ 3] .data             PROGBITS         00000000000044c0  00004340
         00000000000046d0  0000000000000000  WA       0     0     64
    [ 4] .rela.data        RELA             0000000000000000  0000af00
         0000000000000600  0000000000000018   I       7     3     8
    [ 5] .rela             RELA             0000000000008bc0  00008a10
         0000000000000600  0000000000000018           0     0     8
    [ 6] .shstrtab         STRTAB           0000000000000000  0000b500
         0000000000000037  0000000000000000           0     0     1
    [ 7] .symtab           SYMTAB           0000000000000000  00009010
         0000000000000210  0000000000000018           8    17     8
    [ 8] .strtab           STRTAB           0000000000000000  00009220
         00000000000000eb  0000000000000000           0     0     1

  Relocation section '.rela.data' at offset 0xaf00 contains 64 entries:
    Offset          Info           Type           Sym. Value    Sym. Name + Addend
  000000004800  000100000001 R_X86_64_64       0000000000000240 .text + 3f5b
  000000004808  000100000001 R_X86_64_64       0000000000000240 .text + 3f63
  000000004810  000100000001 R_X86_64_64       0000000000000240 .text + 3f79
  000000004818  000100000001 R_X86_64_64       0000000000000240 .text + 3f90
  000000004820  000100000001 R_X86_64_64       0000000000000240 .text + 3fa6
  ...

  Relocation section '.rela' at offset 0x8a10 contains 64 entries:
    Offset          Info           Type           Sym. Value    Sym. Name + Addend
  000000004800  000000000008 R_X86_64_RELATIVE                    419b
  000000004808  000000000008 R_X86_64_RELATIVE                    41a3
  000000004810  000000000008 R_X86_64_RELATIVE                    41b9
  000000004818  000000000008 R_X86_64_RELATIVE                    41d0
  000000004820  000000000008 R_X86_64_RELATIVE                    41e6
  000000004828  000000000008 R_X86_64_RELATIVE                    41ff
  ...

Note that GOT based relocations result in entries that *only* appear in the
dynamic .rela section and not in .rela.text or .rela.data. This means two
things if we intend to add support for GOT based relocations:
- we must check that a dynamic RELA section exists;
- we must filter out duplicates between .rela and .rela.xxx, to prevent
  emitting duplicate fixups into the PE/COFF .reloc section.

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 agoMdeModulePkg/Browser: Fix conflicting policy in getting default of checkbox
Liming Gao [Thu, 18 Aug 2016 11:51:21 +0000 (19:51 +0800)]
MdeModulePkg/Browser: Fix conflicting policy in getting default of checkbox

We have added a new policy to get default value for question:
get default from other default id if current default is not specified.
But when getting default value for checkbox, if the default
flag is not set, it will set the default value to FALSE for checkbox.
This behavior in checkbox conflicts with the new added policy,
so now we move this behavior to the end of getting default form other
default id.

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: Liming Gao <liming.gao@intel.com>
7 years agoIntelSiliconPkg: Fixed VBT size bug, typos and updated comments
Mudusuru, Giri P [Mon, 22 Aug 2016 05:19:00 +0000 (13:19 +0800)]
IntelSiliconPkg: Fixed VBT size bug, typos and updated comments

1) Fixed the VBT size from 0x1C00(7KB) to 0x1800(6KB) and typos, indentation
2) Updated offsets in hex values and offset from start of OPREGION

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>
7 years agoBaseTools GnuMakefile: Update GCC Flags to the specific one with BUILD_ prefix
Liming Gao [Mon, 22 Aug 2016 06:32:23 +0000 (14:32 +0800)]
BaseTools GnuMakefile: Update GCC Flags to the specific one with BUILD_ prefix

To avoid the conflict with the default GCC flag name, BUILD_ prefix is added.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoBaseTools GNU Makefile: Add the missing rules for cpp source file
Liming Gao [Mon, 22 Aug 2016 06:28:50 +0000 (14:28 +0800)]
BaseTools GNU Makefile: Add the missing rules for cpp source file

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoIntelFsp2Pkg: Add function to get FspInfoHeader before stack is ready
Yarlagadda, Satya P [Thu, 18 Aug 2016 05:20:31 +0000 (13:20 +0800)]
IntelFsp2Pkg: Add function to get FspInfoHeader before stack is ready

we need to locate the FSP Info Header before the stack is initialized to
access the cfg region for any UPD. Hence adding the
AsmGetFspInfoHeaderNoStack function to support it.

Note: This function is there in IntelFspPkg but got removed in IntelFsp2Pkg

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: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
7 years agoBaseTools: update BinaryFiles.txt file to add Pkcs7Sign Tool
Yonghong Zhu [Mon, 22 Aug 2016 23:44:20 +0000 (07:44 +0800)]
BaseTools: update BinaryFiles.txt file to add Pkcs7Sign Tool

add Pkcs7Sign.exe and related pem file into BinaryFiles.txt for build
server to automatically build the binary win32 files.

Cc: Liming Gao <liming.gao@intel.com>
CC: Erik Bjorge <erik.c.bjorge@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
7 years agoBaseTools: add capsule image header for auth FMP capsule file
Yonghong Zhu [Mon, 22 Aug 2016 07:08:24 +0000 (15:08 +0800)]
BaseTools: add capsule image header for auth FMP capsule file

in last commit 91ae29, it missed to add the
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER for the auth FMP capsule.

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 agoBaseTools/UserManuals: update with new report bug mail address
Yonghong Zhu [Tue, 9 Aug 2016 02:41:42 +0000 (10:41 +0800)]
BaseTools/UserManuals: update with new report bug mail address

The .rtf files in BaseTools/UserManuals still tell users to Report bugs
to sourceforge mail address. Since we no longer use the sourceforge
mailing lists we should update it.

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 agoSecurityPkg Tcg2: Remove use of module internal API InternalIsZeroBuffer()
Hao Wu [Wed, 17 Aug 2016 13:28:39 +0000 (21:28 +0800)]
SecurityPkg Tcg2: Remove use of module internal API InternalIsZeroBuffer()

This commit removes the internal implementation of the function
InternalIsZeroBuffer(). Instead, it will use the API IsZeroBuffer() from
BaseMemoryLib in MdePkg.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@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: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg BaseMemoryLibSse2: Add SSE2 implementation of API IsZeroBuffer()
Hao Wu [Wed, 17 Aug 2016 06:27:49 +0000 (14:27 +0800)]
MdePkg BaseMemoryLibSse2: Add SSE2 implementation of API IsZeroBuffer()

Add the implementation of API IsZeroBuffer() via assembly in
BaseMemoryLibSse2.

The assembly codes use SSE2 XMM registers and related instructions.

Cc: Michael D 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: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg BaseMemoryLib: Add assembly implementation of API IsZeroBuffer()
Hao Wu [Wed, 17 Aug 2016 06:26:25 +0000 (14:26 +0800)]
MdePkg BaseMemoryLib: Add assembly implementation of API IsZeroBuffer()

Add the implementation of API IsZeroBuffer() via assembly for the
following library instances:
BaseMemoryLibMmx
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
BaseMemoryLibRepStr

Cc: Michael D 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: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg BaseMemoryLib: Add C implementation of API IsZeroBuffer()
Hao Wu [Wed, 17 Aug 2016 06:24:04 +0000 (14:24 +0800)]
MdePkg BaseMemoryLib: Add C implementation of API IsZeroBuffer()

Add the implementation of API IsZeroBuffer() via C language for the
following library instances:
BaseMemoryLib
PeiMemoryLib
UefiMemoryLib

Cc: Michael D 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: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoSecurityPkg Tcg2: Rename internal API IsZeroBuffer to InternalIsZeroBuffer
Hao Wu [Wed, 17 Aug 2016 13:12:57 +0000 (21:12 +0800)]
SecurityPkg Tcg2: Rename internal API IsZeroBuffer to InternalIsZeroBuffer

Before adding API IsZeroBuffer() in BaseMemoryLib at MdePkg, rename the
internal implementations of IsZeroBuffer() within SecurityPkg/Tcg modules
to avoid breaking bisection.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@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: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoMdePkg BaseMemoryLib: Add implementation of API IsZeroGuid()
Hao Wu [Wed, 3 Aug 2016 07:29:50 +0000 (15:29 +0800)]
MdePkg BaseMemoryLib: Add implementation of API IsZeroGuid()

Cc: Michael D 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: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools/GccBase.lds: don't copy RELA section to PE/COFF
Ard Biesheuvel [Wed, 10 Aug 2016 08:55:30 +0000 (10:55 +0200)]
BaseTools/GccBase.lds: don't copy RELA section to PE/COFF

The CLANG38 toolchain creates a PIE binary at link time. This is
necessary since the LTO code generation may otherwise result in
code that cannot execute correctly when loaded above 2 GB.

PIE executables contain a RELA section consisting of dynamic
relocation entries that are intended for consumption by the loader
at runtime. For this reason, it has the SHF_ALLOC attribute set by
default, and will be identified by GenFw as a section that needs to
be copied into the PE/COFF binary, resulting in waste of space since
the PE/COFF loader does not use this data at all.

So mark the RELA section as informational: this will prevent the
linker from setting the SHF_ALLOC attribute, causing GenFw to
ignore it.

DxeCore.efi before:

    Detected 'X64' type PE/COFF image consisting of 3 sections
    Section alignment:      0x40
    File alignment:         0x40
    Section '.text' @ 0x00000240
    File offset:            0x240
    Virtual size:           0x21000
    Raw size:               0x21000
    Section '.data' @ 0x00021240
    File offset:            0x21240
    Virtual size:           0x3640
    Raw size:               0x3640
    Section '.reloc' @ 0x00024880
    File offset:            0x24880
    Virtual size:           0x280
    Raw size:               0x280

DxeCore.efi after:

    Detected 'X64' type PE/COFF image consisting of 3 sections
    Section alignment:      0x40
    File alignment:         0x40
    Section '.text' @ 0x00000240
    File offset:            0x240
    Virtual size:           0x1f440
    Raw size:               0x1f440
    Section '.data' @ 0x0001f680
    File offset:            0x1f680
    Virtual size:           0x3640
    Raw size:               0x3640
    Section '.reloc' @ 0x00022cc0
    File offset:            0x22cc0
    Virtual size:           0x280
    Raw size:               0x280

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: Fix build breakage of ArmVirtXen platform
Vikas C Sajjan [Mon, 22 Aug 2016 10:04:35 +0000 (15:34 +0530)]
ArmVirtPkg: Fix build breakage of ArmVirtXen platform

Added missing dependency of FileExplorerLib, which was causing
build error for ArmVirtXen, due to inclusion of ramdisk support.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Vikas C Sajjan <vikas.cha.sajjan@hpe.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoBaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE image
Liming Gao [Mon, 22 Aug 2016 03:09:01 +0000 (11:09 +0800)]
BaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE image

If PE image has no relocation section, and has not set RELOCS_STRIPPED,
after it is converted to TE image, GenFw will set its relocation section
VirtualAddress to non-zero address, and keep Size value as Zero. MdePkg
BasePeCoffLib applied this rule to get RelocationsStripped attribute. But,
it is missing in BaseTools BasePeCoffLib.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7 years agoArmVirtPkg: Add Ramdisk support to ArmVirtPkg platforms
Vikas C Sajjan [Fri, 19 Aug 2016 06:55:55 +0000 (12:25 +0530)]
ArmVirtPkg: Add Ramdisk support to ArmVirtPkg platforms

Adds the RAMDisk support to ArmVirtPkg platforms.
This patch actually ports OvmfPkg commit 259d87146b07 to
ArmVirtPkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Vikas C Sajjan <vikas.cha.sajjan@hpe.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoArmVirtPkg: Move inclusion of AcpiTableDxe.inf to ArmVirt.dsc.inc
Vikas C Sajjan [Fri, 19 Aug 2016 06:55:54 +0000 (12:25 +0530)]
ArmVirtPkg: Move inclusion of AcpiTableDxe.inf to ArmVirt.dsc.inc

Since ArmVirt.dsc.inc is included in all the ArmVirt dsc files,
move inclusion of AcpiTableDxe.inf to ArmVirt.dsc.inc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Vikas C Sajjan <vikas.cha.sajjan@hpe.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoBaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section
Yonghong Zhu [Wed, 17 Aug 2016 10:52:51 +0000 (18:52 +0800)]
BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section

Current BaseTools query the BuildOptions not cover the case that use
'COMMON' as CodeBase, while DSC spec allow this usage. This Patch add
support for such 'common.DXE_RUNTIME_DRIVER' as the Scope2 in the query
Condition.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Kurt Kennett <Kurt.Kennett@microsoft.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 agoBaseTools: FMP capsule add the support to generate auth info
Yonghong Zhu [Mon, 15 Aug 2016 05:52:12 +0000 (13:52 +0800)]
BaseTools: FMP capsule add the support to generate auth info

Current BaseTools cannot generate EFI_FIRMWARE_IMAGE_AUTHENTICATION
for FMP capsule. this patch fix it by FDF spec's update to add the
definition for CERTIFICATE_GUID and  MONOTONIC_COUNT. BaseTools call
the tool by CERTIFICATE_GUID to generate the certdata and fill the header
info.

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 agoBaseTools: Rsa2048Sha256Sign add new option to support Monotonic count
Yonghong Zhu [Mon, 15 Aug 2016 05:39:32 +0000 (13:39 +0800)]
BaseTools: Rsa2048Sha256Sign add new option to support Monotonic count

the EFI_FIRMWARE_IMAGE_AUTHENTICATION struct require the AuthInfo which
is a signature across the image data and the Monotonic Count value, so we
add the new option to support Monotonic count.

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 agoBaseTools: Add the PKCS7 tool
Yonghong Zhu [Mon, 15 Aug 2016 09:12:12 +0000 (17:12 +0800)]
BaseTools: Add the PKCS7 tool

Provide the PKCS7 Tool to support the CertType - EFI_CERT_TYPE_PKCS7_GUID,
then user can use this tool to add EFI_FIRMWARE_IMAGE_AUTHENTICATION
for a binary.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Revert 7503cd70fb86
Jeff Fan [Fri, 19 Aug 2016 02:28:28 +0000 (10:28 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Revert 7503cd70fb86

Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Add gEfiVariableArchProtocolGuid dependency"

This reverts commit 7503cd70fb864a5663edb121c9b2488b4c69e7f5.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
7 years agoUefiCpuPkg/MpInitLib: MicrocodeData used but maybe uninitialized
Jeff Fan [Fri, 19 Aug 2016 02:32:30 +0000 (10:32 +0800)]
UefiCpuPkg/MpInitLib: MicrocodeData used but maybe uninitialized

Cc: Feng Tian <feng.tian@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoDuetPkg: Add DxeMpInitLib instance reference
Jeff Fan [Fri, 19 Aug 2016 02:36:37 +0000 (10:36 +0800)]
DuetPkg: Add DxeMpInitLib instance reference

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
7 years agoBaseTools-CLANG38: Add -O3 in DLINK2 flag
Shi, Steven [Fri, 19 Aug 2016 02:46:20 +0000 (10:46 +0800)]
BaseTools-CLANG38: Add -O3 in DLINK2 flag

CLANG38 build fail after CC_FLAG is added in the link rule.
This failure is because the CLANG38 enable the LTO through LLVMgold.so
linker plugin, but the LLVMgold.so plugin cannot accept the clang -Oz
CC flag as build option. After CC_FLAG is added in the link rule,
the LLVMgold.so plugin reports linking error. LLVMgold.so only accept
-O0 ~ -O3, and you can see it in the LLVM gold plugin source code
in below:

http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_380/final/tools/gold/
gold-plugin.cpp line173:

if (opt[1] < '0' || opt[1] > '3')
   message(LDPL_FATAL, "Optimization level must be between 0 and 3");

Add -O3 in the *_CLANG38_*_DLINK2_FLAGS to override the -Oz flag in
*_CLANG38_*_CC_FLAGS to pass LLVMgold.so linking.

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: check CONF_PATH env to get the configure files
Yonghong Zhu [Thu, 18 Aug 2016 02:07:36 +0000 (10:07 +0800)]
BaseTools: check CONF_PATH env to get the configure files

Add CONF_PATH env check. First priority is user set the conf dir by
--conf option, then the CONF_PATH env, the last one is the standard
WORKSPACE(PACKAGE_PATH)/Conf.
Also print the conf path directory in the build log.

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 agoNetworkPkg/IpSecDxe: Fix wrong IKE header "FLAG" update
Jiaxin Wu [Mon, 15 Aug 2016 03:49:56 +0000 (11:49 +0800)]
NetworkPkg/IpSecDxe: Fix wrong IKE header "FLAG" update

*v2: update the commit log and refine the code comments.

There are three kinds of IKE Exchange process:
#1. Initial Exchange
#2. CREATE_CHILD_SA_Exchange
#3. Information Exchange

The IKE header "FLAG" update is incorrect in #2 and #3 exchange,
which may cause the continue session failure. This patch is used
to correct the updates of IKE header "FLAG" according the RFC4306
section 3.1.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoNetworkPkg/IpSecDxe: Fix UEFI IKE Initial Exchange failure
Jiaxin Wu [Mon, 15 Aug 2016 03:27:59 +0000 (11:27 +0800)]
NetworkPkg/IpSecDxe: Fix UEFI IKE Initial Exchange failure

*v2: update the commit log.

IKE Initial Exchange message should cover below process:
           Initiator                    Responder
Message1 HDR,SAil,KEi,Ni  ------>
Message2                  <------   HDR,SArl,KEr,Nr,[CERTREQ]
Message3 HDR,SK{}         ------>
Message4                  <------   HDR,SK{}

If Initial Exchange message is initiated by Linux IKE, it works well.
But the failure will happen if it's initiated by UEFI IKE. This issue
is caused by the no status check of NotifyCookiePayload.

While parsing the IKEv2 packet for IKE_SA_INIT exchange, if the packet
doesn't contain COOKIE Notify payload, EFI_INVALID_PARAMETER will be
returned from Ikev2ParserNotifyCookiePayload(). Current implementation
return this error status directly, then the session will be broken. The
correct behavior should check this status. If no COOKIE Notify payload,
initiator don't need to retry the IKE_SA_INIT.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoCorebootPayloadPkg: fixed GCC49 and GCC5 hang in PeiCore
Prince Agyeman [Wed, 17 Aug 2016 17:55:22 +0000 (10:55 -0700)]
CorebootPayloadPkg: fixed GCC49 and GCC5 hang in PeiCore

Section alignment of .data in GCC49 and GCC5 are 0x40
rather than 0x20 in GCC48 and below.
This causes a hang in PeiCore.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
Reviewed by: Maurice Ma <maurice.ma@intel.com>

7 years agoCorebootPayloadPkg : Added MpInitLib to CorebootPayloadPkg.dsc
Prince Agyeman [Wed, 17 Aug 2016 16:32:12 +0000 (09:32 -0700)]
CorebootPayloadPkg : Added MpInitLib to CorebootPayloadPkg.dsc

MpInitLib is consumed by CpuDxe

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
Reviewed by: Maurice Ma <maurice.ma@intel.com>

7 years agoMdeModulePkg: Fix potential failure if UseDefaultAddress configured
Jiaxin Wu [Mon, 15 Aug 2016 02:34:49 +0000 (10:34 +0800)]
MdeModulePkg: Fix potential failure if UseDefaultAddress configured

IpSb->Reconfig should not be set to TRUE to focal the reconfiguration
during the policy changes from Static to DHCP. It's redundancy because
the default router table and default addresses have been freed ahead (
Detailed see Ip4Config2OnPolicyChanged() function). Otherwise, the
potential failure will appear if UseDefaultAddress configured. Reproduce
steps see below:

#1. Set policy to DHCP.
#2. If DHCP process is not complete yet, then run one APP to invoke UDP4
Configure with "UseDefaultAddress = TRUE" (loop to call UDP4 Configure
until Ip4Mode.IsConfigured changes to TRUE).
#3. Even DHCP succeed but Ip4Mode.IsConfigured flag never set to TRUE

Concrete analysis is as follows:
In #1, the policy will be set to DHCP, and then Ip4Config2OnPolicyChanged()
will be called. In this function, if "IpSb->Reconfig" flag is set to TRUE,
the original "IpSb->DefaultInterface" will be abandoned/freed once the
DHCP process finished.

In #2, UDP4 Configure with "UseDefaultAddress = TRUE" is called, that means
the default interface (IpSb->DefaultInterface) will be selected as current
instance's interface.

In #3, when DHCP process finished, the original DefaultInterface will be
abandoned/freed because "IpSb->Reconfig" flag is true. Meanwhile, one new
interface is assigned to "IpSb->DefaultInterface". This new interface is
different to the original one assigned to the UDP4 Configured instance. So,
even DHCP process succeed, the up caller will never have the chance to get
it's truly status.

Cc: Cohen Eugene <eugene@hp.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Tested-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoNetworkPkg: Fix assert issue in iSCSI driver
Zhang Lubo [Mon, 1 Aug 2016 08:33:26 +0000 (16:33 +0800)]
NetworkPkg: Fix assert issue in iSCSI driver

The bug is caused by using already freed memory.
If there is already an attempt and execute
'reconnect -r' command, all the AttemptConfig structure
will be freed, but the mCallbackInfo->Current is not
configured as null and this pointer will be used again in
IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
7 years agoNetworkPkg: Refine codes of iSCSI driver
Zhang Lubo [Thu, 11 Aug 2016 02:14:55 +0000 (10:14 +0800)]
NetworkPkg: Refine codes of iSCSI driver

The RSDT is only used when the bios need to support ACPI 1.0
version. When change PcdAcpiExposedTableVersions to 0x3C, it
will not support ACPI 1.0. The default is 0x3E.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoMdeModulePkg: Refine codes of iSCSI driver
Zhang Lubo [Thu, 11 Aug 2016 02:24:10 +0000 (10:24 +0800)]
MdeModulePkg: Refine codes of iSCSI driver

The RSDT is only used when the bios need to support ACPI 1.0
version. When change PcdAcpiExposedTableVersions to 0x3C, it
will not support ACPI 1.0. The default is 0x3E.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoPcAtChipsetPkg AcpiTimerLib: Wait 363 ACPI timer counts to get TSC Freq
Star Zeng [Wed, 17 Aug 2016 02:08:31 +0000 (10:08 +0800)]
PcAtChipsetPkg AcpiTimerLib: Wait 363 ACPI timer counts to get TSC Freq

Compute the number of ticks to wait to measure TSC frequency.
Instead of (ACPI_TIMER_FREQUENCY / 10000) = 357 and 357 * 10000 = 3570000,
use 363 * 9861 = 3579543 Hz which is within 2 Hz of ACPI_TIMER_FREQUENCY.
363 counts is a calibration time of 101.4 uS.

The idea comes from Michael and Paolo.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.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: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add gEfiVariableArchProtocolGuid dependency
Jeff Fan [Tue, 2 Aug 2016 05:52:28 +0000 (13:52 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add gEfiVariableArchProtocolGuid dependency

PiSmmCpuDxeSmm driver's entry point will get some PCDs supported dynamic type.
In case those PCDs are set as DynamicHii type in platform DSC File, it implies
that EFI Variable Arch protocol is required.

This fix is to add gEfiVariableArchProtocolGuid dependency on PiSmmCpuDxeSmm
driver to make sure those DynamicHii PCDs could be read correctly.

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: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/CpuDxe: Fixed typo in function header to match PI spec
Jeff Fan [Fri, 29 Jul 2016 17:43:17 +0000 (01:43 +0800)]
UefiCpuPkg/CpuDxe: Fixed typo in function header to match PI spec

Cc: Liming Gao <liming.gao@intel.com>
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: Michael Kinney <michael.d.kinney@intel.com>
7 years agoMdePkg/MpService.h: Trim whitespace at end of line
Jeff Fan [Fri, 29 Jul 2016 17:38:26 +0000 (01:38 +0800)]
MdePkg/MpService.h: Trim whitespace at end of line

Cc: Liming Gao <liming.gao@intel.com>
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: Michael Kinney <michael.d.kinney@intel.com>
7 years agoMdePkg/MpService.h: Fixed typo in function header to match PI spec
Jeff Fan [Fri, 29 Jul 2016 01:10:27 +0000 (09:10 +0800)]
MdePkg/MpService.h: Fixed typo in function header to match PI spec

Cc: Liming Gao <liming.gao@intel.com>
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: Michael Kinney <michael.d.kinney@intel.com>
7 years agoUefiCpuPkg/CpuDxe: Remove PcdCpuMaxLogicalProcessorNumber consuming
Jeff Fan [Tue, 2 Aug 2016 07:04:28 +0000 (15:04 +0800)]
UefiCpuPkg/CpuDxe: Remove PcdCpuMaxLogicalProcessorNumber consuming

v5:
  If PcdCpuMaxLogicalProcessorNumber is set to 1 on UP system,
  MpInitLibInitialize() will be invoked. This is one bug, we need to
  call MpInitLibInitialize() always and get the BSP information.
  Just to remove PcdCpuMaxLogicalProcessorNumber() consuming from this
  driver.

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/CpuDxe: Remove unused codes and files
Jeff Fan [Fri, 29 Jul 2016 17:32:25 +0000 (01:32 +0800)]
UefiCpuPkg/CpuDxe: Remove unused codes and files

v5:
  1. Remove unused PcdCpuApStackSize and PcdCpuApInitTimeOutInMicroSeconds.

v4:
  1. Keep GDT table setup to fix IA32 S3 boot issue.

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/CpuDxe: Move SetMtrrsFromBuffer() location.
Jeff Fan [Fri, 29 Jul 2016 17:23:52 +0000 (01:23 +0800)]
UefiCpuPkg/CpuDxe: Move SetMtrrsFromBuffer() location.

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/CpuDxe: Consume MpInitLib to produce CPU MP Protocol services
Jeff Fan [Fri, 22 Jul 2016 02:42:47 +0000 (10:42 +0800)]
UefiCpuPkg/CpuDxe: Consume MpInitLib to produce CPU MP Protocol services

Consume MP Initialize library to produce CPU MP Protocol services to simply the
code.

v4:
  1. Update CpuDxe.c file header to mention it produces CPU Arch protocol.
  2. Update BistData type from UINT32 to EFI_HEALTH_FLAG.
  3. Move some header location from CpuMp.h to CpuDxe.h.

v3:
  1. Move the code Consume MpInitLib APIs to produce CPU MP Protocol from patch
     #40 to this patch.
  2. Add DxeMpInitLib.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 agoUefiCpuPkg/CpuMpPei: Delete PeiMpServices.c and PeiMpServices.h
Jeff Fan [Fri, 22 Jul 2016 02:31:12 +0000 (10:31 +0800)]
UefiCpuPkg/CpuMpPei: Delete PeiMpServices.c and PeiMpServices.h

Move the code in PeiMpServices.c & PeiMpServices.h to CpuMpPei.c & CpuMpPei.h.

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 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>