]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
4 years agoMaintainers.txt: update email address for Leif Lindholm
Leif Lindholm [Tue, 14 Jan 2020 15:50:18 +0000 (15:50 +0000)]
Maintainers.txt: update email address for Leif Lindholm

Leif now works at NUVIA Inc, update email address accordingly.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: fix 2M->4K page splitting regression for PDEs
Laszlo Ersek [Thu, 9 Jan 2020 21:00:39 +0000 (22:00 +0100)]
UefiCpuPkg/PiSmmCpuDxeSmm: fix 2M->4K page splitting regression for PDEs

In commit 4eee0cc7cc0d ("UefiCpuPkg/PiSmmCpu: Enable 5 level paging when
CPU supports", 2019-07-12), the Page Directory Entry setting was regressed
(corrupted) when splitting a 2MB page to 512 4KB pages, in the
InitPaging() function.

Consider the following hunk, displayed with

$ git show --function-context --ignore-space-change 4eee0cc7cc0db

>            //
>            // If it is 2M page, check IsAddressSplit()
>            //
>            if (((*Pd & IA32_PG_PS) != 0) && IsAddressSplit (Address)) {
>              //
>              // Based on current page table, create 4KB page table for split area.
>              //
>              ASSERT (Address == (*Pd & PHYSICAL_ADDRESS_MASK));
>
>              Pt = AllocatePageTableMemory (1);
>              ASSERT (Pt != NULL);
>
> +            *Pd = (UINTN) Pt | IA32_PG_RW | IA32_PG_P;
> +
>              // Split it
> -          for (PtIndex = 0; PtIndex < SIZE_4KB / sizeof(*Pt); PtIndex++) {
> -            Pt[PtIndex] = Address + ((PtIndex << 12) | mAddressEncMask | PAGE_ATTRIBUTE_BITS);
> +            for (PtIndex = 0; PtIndex < SIZE_4KB / sizeof(*Pt); PtIndex++, Pt++) {
> +              *Pt = Address + ((PtIndex << 12) | mAddressEncMask | PAGE_ATTRIBUTE_BITS);
>              } // end for PT
>              *Pd = (UINT64)(UINTN)Pt | mAddressEncMask | PAGE_ATTRIBUTE_BITS;
>            } // end if IsAddressSplit
>          } // end for PD

First, the new assignment to the Page Directory Entry (*Pd) is
superfluous. That's because (a) we set (*Pd) after the Page Table Entry
loop anyway, and (b) here we do not attempt to access the memory starting
at "Address" (which is mapped by the original value of the Page Directory
Entry).

Second, appending "Pt++" to the incrementing expression of the PTE loop is
a bug. It causes "Pt" to point *right past* the just-allocated Page Table,
once we finish the loop. But the PDE assignment that immediately follows
the loop assumes that "Pt" still points to the *start* of the new Page
Table.

The result is that the originally mapped 2MB page disappears from the
processor's view. The PDE now points to a "Page Table" that is filled with
garbage. The random entries in that "Page Table" will cause some virtual
addresses in the original 2MB area to fault. Other virtual addresses in
the same range will no longer have a 1:1 physical mapping, but be
scattered over random physical page frames.

The second phase of the InitPaging() function ("Go through page table and
set several page table entries to absent or execute-disable") already
manipulates entries in wrong Page Tables, for such PDEs that got split in
the first phase.

This issue has been caught as follows:

- OVMF is started with 2001 MB of guest RAM.

- This places the main SMRAM window at 0x7C10_1000.

- The SMRAM management in the SMM Core links this SMRAM window into
  "mSmmMemoryMap", with a FREE_PAGE_LIST record placed at the start of the
  area.

- At "SMM Ready To Lock" time, PiSmmCpuDxeSmm calls InitPaging(). The
  first phase (quoted above) decides to split the 2MB page at 0x7C00_0000
  into 512 4KB pages, and corrupts the PDE. The new Page Table is
  allocated at 0x7CE0_D000, but the PDE is set to 0x7CE0_E000 (plus
  attributes 0x67).

- Due to the corrupted PDE, the second phase of InitPaging() already looks
  up the PTE for Address=0x7C10_1000 in the wrong place. The second phase
  goes on to mark bogus PTEs as "NX".

- PiSmmCpuDxeSmm calls SetMemMapAttributes(). Address 0x7C10_1000 is at
  the base of the SMRAM window, therefore it happens to be listed in the
  SMRAM map as an EfiConventionalMemory region. SetMemMapAttributes()
  calls SmmSetMemoryAttributes() to mark the region as XP. However,
  GetPageTableEntry() in ConvertMemoryPageAttributes() fails -- address
  0x7C10_1000 is no longer mapped by anything! -- and so the attribute
  setting fails with RETURN_UNSUPPORTED. This error goes unnoticed, as
  SetMemMapAttributes() ignores the return value of
  SmmSetMemoryAttributes().

- When SetMemMapAttributes() reaches another entry in the SMRAM map,
  ConvertMemoryPageAttributes() decides it needs to split a 2MB page, and
  calls SplitPage().

- SplitPage() calls AllocatePageTableMemory() for the new Page Table,
  which takes us to InternalAllocMaxAddress() in the SMM Core.

- The SMM core attempts to read the FREE_PAGE_LIST record at 0x7C10_1000.
  Because this virtual address is no longer mapped, the firmware crashes
  in InternalAllocMaxAddress(), when accessing (Pages->NumberOfPages).

Remove the useless assignment to (*Pd) from before the loop. Revert the
loop incrementing and the PTE assignment to the known good version.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1789335
Fixes: 4eee0cc7cc0db74489b99c19eba056b53eda6358
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdeModulePkg/Variable: Fix VarErrorFlag RT cache offset calculation
Michael Kubacki [Mon, 13 Jan 2020 22:44:50 +0000 (14:44 -0800)]
MdeModulePkg/Variable: Fix VarErrorFlag RT cache offset calculation

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

This commit fixes an offset calculation that is used to write the
VarErrorFlag UEFI variable to the UEFI variable runtime cache.

Currently a physical address is used instead of an offset. This
commit changes the offset to zero with a length of the entire
non-volatile variable store so the entire non-volatile variable
store buffer in SMRAM (with the variable update modification) is
copied to the runtime variable cache. This follows the same pattern
used in other SynchronizeRuntimeVariableCache () calls for
consistency.

* Observable symptom: An exception in SMM will most likely occur
  due to the invalid memory reference when the VarErrorFlag variable
  is written. The variable is most commonly written when the UEFI
  variable store is full.

* The issue only occurs when the variable runtime cache is enabled
  by the following PCD being set to TRUE:
  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache

Fixes: aab3b9b9a1e5e1f3fa966fb1667fc3e6c47e7706
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Turner <michael.turner@microsoft.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdePkg Base.h: Use correct style to check the defined macro
Liming Gao [Thu, 16 Jan 2020 03:48:05 +0000 (11:48 +0800)]
MdePkg Base.h: Use correct style to check the defined macro

#if MACRO is not good style. It should be changed to
#ifdef MACRO style or #if defined (MACRO) style.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoShellPkg: acpiview: Update SRAT parser to ACPI 6.3
Krzysztof Koch [Wed, 8 Jan 2020 17:11:44 +0000 (01:11 +0800)]
ShellPkg: acpiview: Update SRAT parser to ACPI 6.3

Add support for revision 3 of System Resource Affinity Table (SRAT).

Decode and dump the new Generic Initiator Affinity Structure.

Validate the Device Handle Type field inside the Generic Initiator
Affinity Structure.

Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Tested-by: Sudipto Paul <sudipto.paul@arm.com>
Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
4 years agoBaseTools/Capsule: Add capsule dependency support
Li, Aaron [Fri, 10 Jan 2020 01:57:35 +0000 (09:57 +0800)]
BaseTools/Capsule: Add capsule dependency support

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

Capsule generate tool support encode capsule dependencies through '-j'
command with a JSON file. To enable dependency feature, "Dependencies"
field for each payload in JSON file is required.
The value of "Dependencies" field is C style infix notation expression.
For example:
  "Dependencies":"72E2945A-00DA-448E-9AA7-075AD840F9D4 > 0x00000001"

The relation of Dependency Expression Opcode in UEFI2.8 chap 23.2 and
infix notation expression value is as follows:
+-----------------------------+--------------------------+
| OPCODE                      | INFIX EXPRESSION VALUE   |
+-----------------------------+--------------------------+
| 0x00 (PUSH_GUID)            | {GUID}                   |
| 0x01 (PUSH_VERSION)         | {UINT32}                 |
| 0x02 (DECLEAR_VERSION_NAME} | DECLEAR "{VERSION_NAME}" |
| 0x03 (AND)                  | &&                       |
| 0x04 (OR)                   | ||                       |
| 0x05 (NOT)                  | ~                        |
| 0x06 (TRUE)                 | TRUE                     |
| 0x07 (FALSE)                | FALSE                    |
| 0x08 (EQ)                   | ==                       |
| 0x09 (GT)                   | >                        |
| 0x0A (GTE)                  | >=                       |
| 0x0B (LT)                   | <                        |
| 0x0C (LTE)                  | <=                       |
+-----------------------------+--------------------------+

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Aaron Li <aaron.li@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoMdeModulePkg/Setup: Update opcode number variable type to UINTN
Brian R Haug [Tue, 14 Jan 2020 08:56:47 +0000 (16:56 +0800)]
MdeModulePkg/Setup: Update opcode number variable type to UINTN

Update data type of variables which save the opcode numbers
to UINTN, in case some configuration module has lots of
configuration items.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoArmPlatformPkg/PrePeiCore: enable VFP at startup
Ard Biesheuvel [Mon, 6 Jan 2020 11:38:29 +0000 (12:38 +0100)]
ArmPlatformPkg/PrePeiCore: enable VFP at startup

While the alternative PEI-less SEC implementation in PrePi already
takes the EnableVFP PCD into account, the PrePeiCore code does not,
and so we may end up triggering synchronous exception when code
attempts to use FP or SIMD registers, which is permitted on AARCH64
by the spec.

So enable the VFP as early as feasible if the associated PCD is set.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoArmPkg/ArmSmcPsciResetSystemLib: remove EnterS3WithImmediateWake ()
Ard Biesheuvel [Mon, 6 Jan 2020 17:16:14 +0000 (18:16 +0100)]
ArmPkg/ArmSmcPsciResetSystemLib: remove EnterS3WithImmediateWake ()

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib. Note that this means the hack to support warm
reboot by jumping to the SEC entry point with the MMU and caches off
is also no longer used, and can be removed as well, along with the PCD
PcdArmReenterPeiForCapsuleWarmReboot that was introduced for this
purpose.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoNetworkPkg/HttpDxe: fix 32-bit truncation in HTTPS download
Laszlo Ersek [Wed, 8 Jan 2020 22:24:02 +0000 (23:24 +0100)]
NetworkPkg/HttpDxe: fix 32-bit truncation in HTTPS download

When downloading over TLS, each TLS message ("APP packet") is returned as
a (decrypted) fragment table by EFI_TLS_PROTOCOL.ProcessPacket().

The TlsProcessMessage() function in "NetworkPkg/HttpDxe/HttpsSupport.c"
linearizes the fragment table into a single contiguous data block. The
resultant flat data block contains both TLS headers and data.

The HttpsReceive() function parses the actual application data -- in this
case: decrypted HTTP data -- out of the flattened TLS data block, peeling
off the TLS headers.

The HttpResponseWorker() function in "NetworkPkg/HttpDxe/HttpImpl.c"
propagates this HTTP data outwards, implementing the
EFI_HTTP_PROTOCOL.Response() function.

Now consider the following documentation for EFI_HTTP_PROTOCOL.Response(),
quoted from "MdePkg/Include/Protocol/Http.h":

> It is the responsibility of the caller to allocate a buffer for Body and
> specify the size in BodyLength. If the remote host provides a response
> that contains a content body, up to BodyLength bytes will be copied from
> the receive buffer into Body and BodyLength will be updated with the
> amount of bytes received and copied to Body. This allows the client to
> download a large file in chunks instead of into one contiguous block of
> memory.

Note that, if the caller-allocated buffer is larger than the
server-provided chunk, then the transfer length is limited by the latter.
This is in fact the dominant case when downloading a huge file (for which
UefiBootManagerLib allocated a huge contiguous RAM Disk buffer) in small
TLS messages.

For adjusting BodyLength as described above -- i.e., to the application
data chunk that has been extracted from the TLS message --, the
HttpResponseWorker() function employs the following assignment:

    HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) HttpMsg->BodyLength);

The (UINT32) cast is motivated by the MIN() requirement -- in
"MdePkg/Include/Base.h" -- that both arguments be of the same type.

"Fragment.Len" (NET_FRAGMENT.Len) has type UINT32, and
"HttpMsg->BodyLength" (EFI_HTTP_MESSAGE.BodyLength) has type UINTN.
Therefore a cast is indeed necessary.

Unfortunately, the cast is done in the wrong direction. Consider the
following circumstances:

- "Fragment.Len" happens to be consistently 16KiB, dictated by the HTTPS
  Server's TLS stack,

- the size of the file to download is 4GiB + N*16KiB, where N is a
  positive integer.

As the download progresses, each received 16KiB application data chunk
brings the *next* input value of BodyLength closer down to 4GiB. The cast
in MIN() always masks off the high-order bits from the input value of
BodyLength, but this is no problem because the low-order bits are nonzero,
therefore the MIN() always permits progress.

However, once BodyLength reaches 4GiB exactly on input, the MIN()
invocation produces a zero value. HttpResponseWorker() adjusts the output
value of BodyLength to zero, and then passes it to HttpParseMessageBody().

HttpParseMessageBody() (in "NetworkPkg/Library/DxeHttpLib/DxeHttpLib.c")
rejects the zero BodyLength with EFI_INVALID_PARAMETER, which is fully
propagated outwards, and aborts the HTTPS download. HttpBootDxe writes the
message "Error: Unexpected network error" to the UEFI console.

For example, a file with size (4GiB + 197MiB) terminates after downloading
just 197MiB.

Invert the direction of the cast: widen "Fragment.Len" to UINTN.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
4 years agoMdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
Laszlo Ersek [Wed, 8 Jan 2020 20:19:35 +0000 (21:19 +0100)]
MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure

The LoadFile protocol can report such a large buffer size that we cannot
allocate enough reserved pages for. This particularly affects HTTP(S)
Boot, if the remote file is very large (for example, an ISO image).

While the TianoCore wiki mentions this at
<https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot#ram-disk-image-size>:

> The maximum RAM disk image size depends on how much continuous reserved
> memory block the platform could provide.

it's hard to remember; so log a DEBUG_ERROR message when the allocation
fails.

This patch produces error messages such as:

> UiApp:BmExpandLoadFile: failed to allocate reserved pages:
> BufferSize=4501536768
> LoadFile="PciRoot(0x0)/Pci(0x3,0x0)/MAC(5254001B103E,0x1)/
>      IPv4(0.0.0.0,TCP,DHCP,192.168.124.106,192.168.124.1,255.255.255.0)/
>      Dns(192.168.124.1)/
>      Uri(https://ipv4-server/RHEL-7.7-20190723.1-Server-x86_64-dvd1.iso)"
> FilePath=""

(Manually rewrapped here for keeping PatchCheck.py happy.)

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoBaseTools/Scripts/PatchCheck: Address false error conditions
Michael D Kinney [Thu, 9 Jan 2020 22:31:28 +0000 (14:31 -0800)]
BaseTools/Scripts/PatchCheck: Address false error conditions

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

* Always print subject line after the git commit id to make
  it easier to know the context of warnings or errors.
* Allow UTF-8 characters in subject line
* Error if subject line length > 75 without CVE-xxx-xxxxx present
* Error if subject line length > 92 with CVE-xxxx-xxxxx present
* If body line length is > 75, then print warning instead of error.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools:Fix GenFds issue for BuildOption replace GenFdsOption
Fan, ZhijuX [Fri, 10 Jan 2020 08:29:45 +0000 (16:29 +0800)]
BaseTools:Fix GenFds issue for BuildOption replace GenFdsOption

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2455

BuildOption is used by TargetTxtClassObj.py
GenFdsOption is used by GenFds.py
When the GenFds tool is used alone (e.g. python3 -m GenFds.GenFds -h)
With the OptionParser function, the first detected function
prints the help message

import TargetTxtClassObj to GenFds,
The BuildOption will be executed and replace GenFdsOption

We removed all objects associated with this problem that
were created directly during the import process
(e.g. BuildOption, BuildTarget = MyOptionParser(),
 TargetTxt = TargetTxtDict())

The Patch is going to fix this issue

Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoBaseTools:Change the case rules for ECC check pointer names
Fan, ZhijuX [Fri, 10 Jan 2020 08:37:46 +0000 (16:37 +0800)]
BaseTools:Change the case rules for ECC check pointer names

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2087

In CryptHkdf.c  line 42

  EVP_PKEY_CTX *pHkdfCtx;

Variable pHkdfCtx begins with lower case 'p',
which should be acceptable because it it is a pointer.
(Refer to CCS_2_1_Draft, 4.3.3.3)

So ECC tool should be improved to handle issues like this.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Fix unknown doxygen tag error
Albecki, Mateusz [Fri, 10 Jan 2020 10:26:11 +0000 (18:26 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Fix unknown doxygen tag error

Changed @rtval to @retval in SdMmcHcStartSdClock
function description.

Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoArmVirtPkg: remove EnterS3WithImmediateWake () from ResetSystemLib
Ard Biesheuvel [Mon, 6 Jan 2020 15:04:36 +0000 (16:04 +0100)]
ArmVirtPkg: remove EnterS3WithImmediateWake () from ResetSystemLib

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg: remove EnterS3WithImmediateWake () from ResetSystemLib
Ard Biesheuvel [Mon, 6 Jan 2020 15:03:33 +0000 (16:03 +0100)]
OvmfPkg: remove EnterS3WithImmediateWake () from ResetSystemLib

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoUefiPayloadPkg: remove EnterS3WithImmediateWake () from ResetSystemLib
Ard Biesheuvel [Mon, 6 Jan 2020 15:03:01 +0000 (16:03 +0100)]
UefiPayloadPkg: remove EnterS3WithImmediateWake () from ResetSystemLib

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Guo Dong <guo.dong@intel.com>
4 years agoPcAtChipsetPkg: remove EnterS3WithImmediateWake () from ResetSystemLib
Ard Biesheuvel [Mon, 6 Jan 2020 15:02:26 +0000 (16:02 +0100)]
PcAtChipsetPkg: remove EnterS3WithImmediateWake () from ResetSystemLib

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdeModulePkg: remove EnterS3WithImmediateWake () from ResetSystemLib
Ard Biesheuvel [Mon, 6 Jan 2020 15:01:20 +0000 (16:01 +0100)]
MdeModulePkg: remove EnterS3WithImmediateWake () from ResetSystemLib

EnterS3WithImmediateWake () no longer has any callers, so remove it
from ResetSystemLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg: Shadow microcode patch according to FIT microcode entry.
Siyuan Fu [Wed, 8 Jan 2020 03:22:30 +0000 (11:22 +0800)]
UefiCpuPkg: Shadow microcode patch according to FIT microcode entry.

The existing MpInitLib will shadow the microcode update patches from
flash to memory and this is done by searching microcode region specified
by PCD PcdCpuMicrocodePatchAddress and PcdCpuMicrocodePatchRegionSize.
This brings a limition to platform FW that all the microcode patches must
be placed in one continuous flash space.

This patch shadows microcode update according to FIT microcode entries if
it's present, otherwise it will fallback to original logic (by PCD).

A new featured PCD gUefiCpuPkgTokenSpaceGuid.PcdCpuShadowMicrocodeByFit
is added for enabling/disabling this support.

TEST: Tested on FIT enabled platform.
BZ: https://tianocore.acgmultimedia.com/show_bug.cgi?id=2449

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdePkg: Add header file for Firmware Interface Table specification.
Siyuan Fu [Wed, 8 Jan 2020 03:14:38 +0000 (11:14 +0800)]
MdePkg: Add header file for Firmware Interface Table specification.

This patch add FirmwareInterfaceTable.h for the Firmware Interface Table
BIOS specification.

This is to remove future edk2 dependency on edk2-platforms repo. The file
content comes from
 edk2-platforms\Silicon\Intel\IntelSiliconPkg\Include\IndustryStandard

link: https://tianocore.acgmultimedia.com/show_bug.cgi?id=2449
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools/PatchCheck.py: Check the patch author email address
Philippe Mathieu-Daude [Thu, 9 Jan 2020 10:55:45 +0000 (18:55 +0800)]
BaseTools/PatchCheck.py: Check the patch author email address

To avoid patches committed with incorrect email address,
use the EmailAddressCheck class on the author email too.

Example:

  $ python BaseTools/Scripts/PatchCheck.py 1a04951309f
  Checking git commit: 1a04951309f
  The 'Author' email address is not valid:
  * The email address cannot contain a space: /o=Intel/ou=External \
    (FYDIBOHF25SPDLT)/cn=Recipients/cn=fe425ca7e5f4401abed22b904fe5d964

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked
Philippe Mathieu-Daude [Thu, 9 Jan 2020 10:55:44 +0000 (18:55 +0800)]
BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked

We are checking different emails from the signature list. We are
going to check more. To be able to differency, add a description
field, so the error reported is clearer.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools/PatchCheck.py: Check the committer email address
Philippe Mathieu-Daude [Thu, 9 Jan 2020 10:55:46 +0000 (18:55 +0800)]
BaseTools/PatchCheck.py: Check the committer email address

To avoid patches committed with incorrect email address,
use the EmailAddressCheck class on the committer email too.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoBaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck
Philippe Mathieu-Daude [Thu, 9 Jan 2020 10:55:43 +0000 (18:55 +0800)]
BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck

As we are going to reuse this code out of the CommitMessageCheck
class, extract it in a new class: EmailAddressCheck.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoUefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
Jason Voelz [Mon, 23 Dec 2019 06:55:37 +0000 (14:55 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set

Add code to set SMXE in CR4 in the SmxInitialize flow when SMX is enabled.

Signed-off-by: Jason Voelz <jason.voelz@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields
Jason Voelz [Mon, 23 Dec 2019 06:55:36 +0000 (14:55 +0800)]
MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields

Based on Intel Software Develeper's Manual, add all fields in IA32_CR4.

Signed-off-by: Jason Voelz <jason.voelz@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoMdePkg: Do not use CreateEventEx unless required
Vitaly Cheptsov via Groups.Io [Tue, 7 Jan 2020 10:50:32 +0000 (18:50 +0800)]
MdePkg: Do not use CreateEventEx unless required

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

There are many firmwares in the wild not supporting CreateEventEx,
including devices less than 5 years old.

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add missed comments for parameter.
Eric Dong [Thu, 9 Jan 2020 05:21:36 +0000 (13:21 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add missed comments for parameter.

This issue caused by below change:
  SHA-1: b948a496150f4ae4f656c0f0ab672608723c80e6
  * UefiCpuPkg/PiSmmCpuDxeSmm: Pre-allocate PROCEDURE_TOKEN buffer
  REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2388

Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoOvmfPkg: use HII type PCDs for TPM2 config related variables
Ard Biesheuvel [Wed, 8 Jan 2020 14:38:43 +0000 (15:38 +0100)]
OvmfPkg: use HII type PCDs for TPM2 config related variables

The HII pages that are part of Tcg2ConfigDxe expect the following PCDs
to be of dynamic HII type, so declare them as such.

  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer
  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev

Currently, the TPM2 ACPI table is not produced, since we do not
incorporate the Tcg2Smm module, which implements the SMI based
physical presence interface exposed to the OS.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg: reorganize TPM2 support in DSC/FDF files
Ard Biesheuvel [Wed, 8 Jan 2020 14:38:42 +0000 (15:38 +0100)]
OvmfPkg: reorganize TPM2 support in DSC/FDF files

Put the TPM2 related DXE modules together in the DSC, and add a
TPM2 support header comment while at it.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoBaseTools/PatchCheck.py: Ignore CR and LF characters in subject length
Philippe Mathieu-Daud? [Thu, 2 Jan 2020 12:16:56 +0000 (20:16 +0800)]
BaseTools/PatchCheck.py: Ignore CR and LF characters in subject length

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

Strip the trailing characters before checking the subject line is
less than 72 characters.

Fixes: e61406708c83f
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
4 years agoMdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Ashish Singhal [Tue, 24 Dec 2019 02:57:47 +0000 (10:57 +0800)]
MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Add edk2 platform boot manager protocol which would have platform
specific refreshes to the auto enumerated as well as NV boot options
for the platform.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoCryptoPkg: Support for SHA384 & SHA512 RSA signing schemes
Pavana.K [Thu, 2 Jan 2020 20:30:27 +0000 (20:30 +0000)]
CryptoPkg: Support for SHA384 & SHA512 RSA signing schemes

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2389

Currently RSA signing scheme support is available for MD5, SHA-1 or
SHA-256 algorithms.The fix is to extend this support for SHA384 and
SHA512.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Pavana.K <pavana.k@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoUefiCpuPkg: Always load microcode patch on AP processor.
Siyuan, Fu [Fri, 3 Jan 2020 06:59:27 +0000 (14:59 +0800)]
UefiCpuPkg: Always load microcode patch on AP processor.

This patch updates the microcode loader to always perform a microcode
detect and load on both BSP and AP processor. This is to fix a potential
microcode revision mismatch issue in below situation:
1. Assume there are two microcode co-exists in flash: one production
   version and one debug version microcode.
2. FIT loads production microcode to BSP and all AP.
3. UefiCpuPkg loader loads debug microcode to BSP, and skip the loading
   on AP.
As a result, different microcode patches are loaded to BSP and AP, and
trigger microcode mismatch error during OS boot.

link: https://bugzilla.tianocore.org/show_bug.cgi?id=2431
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg: Remove alignment check when calculate microcode size.
Siyuan Fu [Fri, 3 Jan 2020 07:11:51 +0000 (15:11 +0800)]
UefiCpuPkg: Remove alignment check when calculate microcode size.

This patch removes the unnecessary alignment check on microcode patch
TotalSize introduced by commit d786a172. The TotalSize has already been
checked with 1K alignment and MAX_ADDRESS in previous code as below:

    if ( (UINTN)MicrocodeEntryPoint > (MAX_ADDRESS - TotalSize) ||
         ((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd ||
         (DataSize & 0x3) != 0 ||
         (TotalSize & (SIZE_1KB - 1)) != 0 ||
         TotalSize < DataSize
       ) {

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style
Eric Dong [Tue, 7 Jan 2020 00:48:17 +0000 (08:48 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style

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

Current code use below loops to enumerate the CPUs:
  for (Index = mMaxNumberOfCpus; Index-- > 0;) {
it has no issue but not easy for the developers to read the code.

Update above code to below style,
  for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
It make the developers easy to read and consistent with other
similar cases in this driver.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoRevert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue."
Eric Dong [Tue, 7 Jan 2020 00:38:22 +0000 (08:38 +0800)]
Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue."

This reverts commit 123b720eeb371e0a31eb727bcf59255b584e355f.

The commit message for commit 123b720eeb37 is not correct.

Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoedksetup.bat: Simplify the step to use CLANGPDB
Liu, Zhiguang [Fri, 20 Dec 2019 08:32:26 +0000 (16:32 +0800)]
edksetup.bat: Simplify the step to use CLANGPDB

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

Set the below two environment variables in edksetup.bat:
  set CLANG_HOST_BIN=n
  set CLANG_BIN=C:\Program Files\LLVM\bin\
In Windows, set CLANG_HOST_BIN=n to use nmake command
The CLANG_BIN is only be set if it is not defined.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
4 years ago.mailmap: Add an entry for Yu-Chen Lin
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:15 +0000 (12:54 +0100)]
.mailmap: Add an entry for Yu-Chen Lin

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Yu-Chen Lin to have his/her name and email
address displayed properly in the git history.

Cc: Yu-Chen Lin <yuchenlin@synology.com>
Reviewed-by: Yu-Chen Lin <yuchenlin@synology.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-33-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Yonghong Zhu
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:14 +0000 (12:54 +0100)]
.mailmap: Add an entry for Yonghong Zhu

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Yonghong Zhu to have his/her name and email
address displayed properly in the git history.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-32-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Vladimir Olovyannikov
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:13 +0000 (12:54 +0100)]
.mailmap: Add an entry for Vladimir Olovyannikov

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Vladimir Olovyannikov to have his/her name and
email address displayed properly in the git history.

Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-31-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Vitaly Cheptsov
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:12 +0000 (12:54 +0100)]
.mailmap: Add an entry for Vitaly Cheptsov

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Vitaly Cheptsov to have his/her name and email
address displayed properly in the git history.

Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-30-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Star Zeng
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:11 +0000 (12:54 +0100)]
.mailmap: Add an entry for Star Zeng

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Star Zeng to have his/her name and email address
displayed properly in the git history.

Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-29-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Shenglei Zhang
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:10 +0000 (12:54 +0100)]
.mailmap: Add an entry for Shenglei Zhang

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Shenglei Zhang to have his/her name and email
address displayed properly in the git history.

Cc: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-28-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Samer El-Haj-Mahmoud
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:09 +0000 (12:54 +0100)]
.mailmap: Add an entry for Samer El-Haj-Mahmoud

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Samer El-Haj-Mahmoud to have his/her name and
email address displayed properly in the git history.

Cc: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Cc: Samer El-Haj-Mahmoud <samer@elhajmahmoud.com>
Reviewed-by: Samer El-Haj-Mahmoud <samer@elhajmahmoud.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-27-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Ray Ni
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:08 +0000 (12:54 +0100)]
.mailmap: Add an entry for Ray Ni

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Ray Ni to have his/her name and email address
displayed properly in the git history.

Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-26-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Philippe Mathieu-Daude
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:07 +0000 (12:54 +0100)]
.mailmap: Add an entry for Philippe Mathieu-Daude

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Philippe Mathieu-Daudé to have his/her name and
email address displayed properly in the git history.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-25-philmd@redhat.com>
[lersek@redhat.com: translit subject to ASCII to suppress PatchCheck.py]

4 years ago.mailmap: Add an entry for Nikolai Saoukh
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:06 +0000 (12:54 +0100)]
.mailmap: Add an entry for Nikolai Saoukh

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Nikolai Saoukh to have his/her name and email
address displayed properly in the git history.

Cc: Nikolai Saoukh <nms@otdel-1.org>
Reviewed-by: Nikolai Saoukh <nms@otdel-1.org>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-24-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Ming Tan
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:05 +0000 (12:54 +0100)]
.mailmap: Add an entry for Ming Tan

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Ming Tan to have his/her name and email address
displayed properly in the git history.

Cc: Ming Tan <ming.tan@intel.com>
Reviewed-by: Ming Tan <ming.tan@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-23-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Michael Kubacki
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:04 +0000 (12:54 +0100)]
.mailmap: Add an entry for Michael Kubacki

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Michael Kubacki to have his/her name and email
address displayed properly in the git history.

Cc: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-22-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Maurice Ma
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:03 +0000 (12:54 +0100)]
.mailmap: Add an entry for Maurice Ma

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Maurice Ma to have his/her name and email
address displayed properly in the git history.

Cc: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-21-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Marvin Haeuser
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:02 +0000 (12:54 +0100)]
.mailmap: Add an entry for Marvin Haeuser

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Marvin Häuser to have his/her name and email
address displayed properly in the git history (in particular,
commit 62ec4a5e).

Cc: Marvin Häuser <Marvin.Haeuser@outlook.de>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Marvin Häuser <mhaeuser@outlook.de>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-20-philmd@redhat.com>
[lersek@redhat.com: translit subject to ASCII to suppress PatchCheck.py]

4 years ago.mailmap: Add an entry for Marc-Andre Lureau
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:01 +0000 (12:54 +0100)]
.mailmap: Add an entry for Marc-Andre Lureau

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Marc-André Lureau to have his/her name and email
address displayed properly in the git history.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-19-philmd@redhat.com>
[lersek@redhat.com: translit subject to ASCII to suppress PatchCheck.py]

4 years ago.mailmap: Add an entry for Maciej Rabeda
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:54:00 +0000 (12:54 +0100)]
.mailmap: Add an entry for Maciej Rabeda

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Maciej Rabeda to have his/her name and email
address displayed properly in the git history.

Cc: Maciej Rabeda <maciej.rabeda@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-18-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Liming Gao
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:59 +0000 (12:53 +0100)]
.mailmap: Add an entry for Liming Gao

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Liming Gao to have his/her name and email
address displayed properly in the git history.

Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-17-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Laszlo Ersek
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:58 +0000 (12:53 +0100)]
.mailmap: Add an entry for Laszlo Ersek

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Laszlo Ersek to have his/her name and email
address displayed properly in the git history.

Cc: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-16-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Jim Dailey
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:57 +0000 (12:53 +0100)]
.mailmap: Add an entry for Jim Dailey

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Jim Dailey to have his/her name and email
address displayed properly in the git history.

Cc: Jim Dailey <Jim.Dailey@Dell.com>
Reviewed-by: Jim Dailey <Jim.Dailey@Dell.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-15-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Jiewen Yao
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:56 +0000 (12:53 +0100)]
.mailmap: Add an entry for Jiewen Yao

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Jiewen Yao to have his/her name and email
address displayed properly in the git history.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-14-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Hot Tian
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:55 +0000 (12:53 +0100)]
.mailmap: Add an entry for Hot Tian

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Hot Tian to have his/her name and email address
displayed properly in the git history.

Cc: Hot Tian <hot.tian@intel.com>
Reviewed-by: Hot Tian <hot.tian@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-13-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Hao Wu
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:54 +0000 (12:53 +0100)]
.mailmap: Add an entry for Hao Wu

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Hao Wu to have his/her name and email address
displayed properly in the git history.

Cc: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-12-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Erik Bjorge
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:53 +0000 (12:53 +0100)]
.mailmap: Add an entry for Erik Bjorge

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Erik Bjorge to have his/her name and email
address displayed properly in the git history.

Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-11-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Eric Dong
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:52 +0000 (12:53 +0100)]
.mailmap: Add an entry for Eric Dong

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Eric Dong to have his/her name and email
address displayed properly in the git history.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-10-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Christopher J Zurcher
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:51 +0000 (12:53 +0100)]
.mailmap: Add an entry for Christopher J Zurcher

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Christopher J Zurcher to have his/her name and
email address displayed properly in the git history.

Cc: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Reviewed-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-9-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Chasel Chiu
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:50 +0000 (12:53 +0100)]
.mailmap: Add an entry for Chasel Chiu

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Chasel Chiu to have his/her name and email
address displayed properly in the git history.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-8-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Baraneedharan Anbazhagan
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:49 +0000 (12:53 +0100)]
.mailmap: Add an entry for Baraneedharan Anbazhagan

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Baraneedharan Anbazhagan to have his/her name
and email address displayed properly in the git history.

Cc: Baraneedharan Anbazhagan <anbazhagan@hp.com>
Reviewed-by: Baraneedharan Anbazhagan <anbazhagan@hp.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-7-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Ashley DeSimone
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:48 +0000 (12:53 +0100)]
.mailmap: Add an entry for Ashley DeSimone

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Ashley DeSimone to have his/her name and email
address displayed properly in the git history.

Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-6-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Ard Biesheuvel
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:47 +0000 (12:53 +0100)]
.mailmap: Add an entry for Ard Biesheuvel

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Ard Biesheuvel to have his/her name and email
address displayed properly in the git history.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-5-philmd@redhat.com>

4 years ago.mailmap: Add an entry for Antoine Coeur
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:46 +0000 (12:53 +0100)]
.mailmap: Add an entry for Antoine Coeur

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Antoine CÅ“ur to have his/her name and email
address displayed properly in the git history.

Cc: Antoine CÅ“ur <coeur@gmx.fr>
Reviewed-by: Antoine CÅ“ur <coeur@gmx.fr>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-4-philmd@redhat.com>
[lersek@redhat.com: fix up valid PatchCheck.py error in Reviewed-by]
[lersek@redhat.com: translit subject to ASCII to suppress PatchCheck.py]

4 years ago.mailmap: Add an entry for Aaron Li
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:45 +0000 (12:53 +0100)]
.mailmap: Add an entry for Aaron Li

We use .mailmap to display contributors email addresses in an
uniform format.

Add an entry for Aaron Li to have his/her name and email address
displayed properly in the git history.

Cc: Aaron Li <aaron.li@intel.com>
Cc: Songpeng Li <songpeng.li@intel.com>
Reviewed-by: Aaron Li <aaron.li@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-3-philmd@redhat.com>

4 years ago.mailmap: Add a stub with documentation
Philippe Mathieu-Daude [Mon, 6 Jan 2020 11:53:44 +0000 (12:53 +0100)]
.mailmap: Add a stub with documentation

The .mailmap git feature helps fixing commit mistakes (in name/email).

The easiest way to use it is with the --use-mailmap flag:

  $ git log --use-mailmap

See:
* https://git-scm.com/docs/git-shortlog#_mapping_authors
* https://git-scm.com/docs/git-check-mailmap#_mapping_authors

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20200106115415.11624-2-philmd@redhat.com>

4 years agoMdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection
MrChromebox [Mon, 6 Jan 2020 04:12:07 +0000 (12:12 +0800)]
MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection

The endpoint selected by the driver needs to not
only be an interrupt type, but have direction IN
as required to set up an asynchronous interrupt transfer.

Currently, the driver assumes that the first INT endpoint
will be of type IN, but that is not true of all devices,
and will silently fail on devices which have the OUT endpoint
before the IN. Adjust the endpoint selection loop to explictly
check for direction IN.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/Usb/UsbMouse: Fix endpoint selection
MrChromebox [Mon, 6 Jan 2020 04:12:06 +0000 (12:12 +0800)]
MdeModulePkg/Usb/UsbMouse: Fix endpoint selection

The endpoint selected by the driver needs to not
only be an interrupt type, but have direction IN
as required to set up an asynchronous interrupt transfer.

Currently, the driver assumes that the first INT endpoint
will be of type IN, but that is not true of all devices,
and will silently fail on devices which have the OUT endpoint
before the IN. Adjust the endpoint selection loop to explictly
check for direction IN.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: GuoMinJ <newexplorerj@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/Usb/EfiKey: Fix endpoint selection
MrChromebox [Mon, 6 Jan 2020 04:12:05 +0000 (12:12 +0800)]
MdeModulePkg/Usb/EfiKey: Fix endpoint selection

The endpoint selected by the driver needs to not
only be an interrupt type, but have direction IN
as required to set up an asynchronous interrupt transfer.

Currently, the driver assumes that the first INT endpoint
will be of type IN, but that is not true of all devices,
and will silently fail on devices which have the OUT endpoint
before the IN. Adjust the endpoint selection loop to explictly
check for direction IN.

Test: detachable keyboard on Google Pixel Slate now works.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: GuoMinJ <newexplorerj@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoSecurityPkg/Tcg2Pei: Add TCG PFP 105 support.
Jiewen Yao [Tue, 31 Dec 2019 02:37:30 +0000 (10:37 +0800)]
SecurityPkg/Tcg2Pei: Add TCG PFP 105 support.

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

Use EV_EFI_PLATFORM_FIRMWARE_BLOB2 if the TCG PFP revision is >= 105.
Use FvName as the description for the FV.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg/Smbios: Add TCG PFP rev 105 support.
Jiewen Yao [Tue, 31 Dec 2019 01:47:11 +0000 (09:47 +0800)]
MdeModulePkg/Smbios: Add TCG PFP rev 105 support.

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

Report EV_EFI_HANDOFF_TABLES2 if the platform chooses PFP >= 105.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg/dec: add PcdTcgPfpMeasurementRevision PCD
Jiewen Yao [Tue, 31 Dec 2019 01:45:27 +0000 (09:45 +0800)]
MdeModulePkg/dec: add PcdTcgPfpMeasurementRevision PCD

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

This PCD is to control the TCG PFP spec revision.

The PFP 105 added new event type to support NIST SP800-155,
and deprecated old event type.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg/Smbios: Done measure Smbios multiple times.
Jiewen Yao [Tue, 31 Dec 2019 01:02:52 +0000 (09:02 +0800)]
MdeModulePkg/Smbios: Done measure Smbios multiple times.

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

In current implementation, the SMBIOS table is measured multiple
time in every readytoboot event.

This causes Smbios Table record appears multiple time in the TCG event log
and confuses people.

This issue makes it hard to implement 800-155 reference measurement.

This patch closes the event to make sure Smbios is measured only once.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoSecurityPkg/Tcg2Dxe: Add Tcg2Dxe to support 800-155 event.
Jiewen Yao [Mon, 30 Dec 2019 08:38:38 +0000 (16:38 +0800)]
SecurityPkg/Tcg2Dxe: Add Tcg2Dxe to support 800-155 event.

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

The TCG2 DXE supports to parse the 800-155 event GUID from PEI
and puts to the beginning of the TCG2 event.

The TCG2 DXE also supports a DXE driver produces 800-155 event
and let TCG2 DXE driver record.

The 800-155 is a NO-ACTION event which does not need extend
anything to TPM2. The TCG2 DXE also supports that.

Multiple 800-155 events are supported. All of them will be put
to the beginning of the TCG2 event, just after the SpecId event.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoSecurityPkg/Guid: Add TCG 800-155 event GUID definition.
Jiewen Yao [Mon, 30 Dec 2019 08:36:02 +0000 (16:36 +0800)]
SecurityPkg/Guid: Add TCG 800-155 event GUID definition.

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

The PEIM can produce the 800-155 event and the event
will be recorded to TCG event log by the TCG2 DXE.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Add function to start SD clock
Albecki, Mateusz [Fri, 20 Dec 2019 17:13:12 +0000 (01:13 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Add function to start SD clock

In SD card voltage switch flow we used to redo the
entire internal clock setup after voltage switch.
Since internal clock has already been setup this
is wasting time on polling the internal clock stable.
This commit changes it to only start the SD clock.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdeModulePkg/SdMmcPciHcDxe: Hook SwitchClockFreq after SD clock start
Albecki, Mateusz [Fri, 20 Dec 2019 17:13:11 +0000 (01:13 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Hook SwitchClockFreq after SD clock start

For eMMC modules we used to notify the platform about frequency
change only after sending CMD13 which meant that platform
might not get a chance to apply required post frequency
change fixes to get the clock stable. To fix this
notification has been moved to SdMmcHcClockSupply function
just after we start the SD clock. During first time setup
the notification won't be sent to avoid changing old behavior.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Tested-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Pre-allocate PROCEDURE_TOKEN buffer
Eric Dong [Fri, 27 Dec 2019 07:30:27 +0000 (15:30 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Pre-allocate PROCEDURE_TOKEN buffer

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

Token is new introduced by MM MP Protocol. Current logic allocate Token
every time when need to use it. The logic caused SMI latency raised to
very high. Update logic to allocate Token buffer at driver's entry point.
Later use the token from the allocated token buffer. Only when all the
buffer have been used, then need to allocate new buffer.

Former change (9caaa79dd7e078ebb4012dde3b3d3a5d451df609) missed
PROCEDURE_TOKEN part, this change covers it.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiPayloadPkg/BootManager: Add PS2 keyboard support
Dong, Guo [Wed, 18 Dec 2019 00:12:17 +0000 (08:12 +0800)]
UefiPayloadPkg/BootManager: Add PS2 keyboard support

Add PS2 keyboard support.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2316

This patch adds PS2 keyboard support in boot manager, and
add a build flag PS2_KEYBOARD_ENABLE for PS2 keyboard to
build PS2 keyboard driver and SIO driver. Be default the
build flag is not enabled since PS2 keyboard is not common
used. could use -DPS2_KEYBOARD_ENABLE to enable build it
if need this feature.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Remove redundant microcode fields in CPU_MP_DATA
Hao A Wu [Tue, 24 Dec 2019 07:02:23 +0000 (15:02 +0800)]
UefiCpuPkg/MpInitLib: Remove redundant microcode fields in CPU_MP_DATA

Previous commits have introduced below fields in structure CPU_AP_DATA:

  UINT32                         ProcessorSignature;
  UINT8                          PlatformId;
  UINT64                         MicrocodeEntryAddr;

which store the information of:

A. CPUID
B. Platform ID
C. Detected microcode patch entry address (including the microcode patch
   header)

for each processor within system.

Therefore, the below fields in structure CPU_MP_DATA:

  UINT32                         ProcessorSignature;
  UINT32                         ProcessorFlags;
  UINT64                         MicrocodeDataAddress;
  UINT32                         MicrocodeRevision;

which store the BSP's information of:

A. CPUID
B. Platform ID
C. The address and revision of detected microcode patch

are redundant and can be removed.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Relocate microcode patch fields in CPU_MP_DATA
Hao A Wu [Wed, 25 Dec 2019 02:50:19 +0000 (10:50 +0800)]
UefiCpuPkg/MpInitLib: Relocate microcode patch fields in CPU_MP_DATA

The below 2 microcode patch related fields in structure CPU_MP_DATA:

  UINT64                         MicrocodePatchAddress;
  UINT64                         MicrocodePatchRegionSize;

They will be passed from PEI phase and be reused DXE phase.

Previously, these 2 fields were placed after some fields with type
'UINTN', this will lead to different field offset in different
architecture for them.

This commit will move them before the fields with different size in
different architecture to ensure they can be properly used in DXE phase.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Produce EDKII microcode patch HOB
Hao A Wu [Mon, 23 Dec 2019 06:32:49 +0000 (14:32 +0800)]
UefiCpuPkg/MpInitLib: Produce EDKII microcode patch HOB

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

This commit will update the MpInitLib to:

A. Collect the base address and size information after microcode patches
   being loaded into memory;
B. Collect the detected microcode patch for each processor within system;
C. Based on the collected information, produce the EDKII microcode patch
   HOB.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg: Add definitions for EDKII microcode patch HOB
Hao A Wu [Mon, 23 Dec 2019 02:52:14 +0000 (10:52 +0800)]
UefiCpuPkg: Add definitions for EDKII microcode patch HOB

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

This commit will add the definitions for EDKII microcode patch HOB.

The intention of adding this HOB is to provide a scheme to store the below
information:

A. The base address and size of the microcode patches that are being
   loaded (from flash) into memory;
B. The information of detected microcode patch for each processor within
   the system.

The producer of the HOB will be the UefiCpuPkg/MpInitLib (where the load,
detect and apply of the microcode happen). The consumer of the HOB can be
modules that want to detect/apply the microcode patch by themselves again
later during the boot flow.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Reduce the size when loading microcode patches
Hao A Wu [Thu, 19 Dec 2019 06:33:44 +0000 (14:33 +0800)]
UefiCpuPkg/MpInitLib: Reduce the size when loading microcode patches

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

This commit will attempt to reduce the copy size when loading the
microcode patches data from flash into memory.

Such optimization is done by a pre-process of the microcode patch headers
(on flash). A microcode patch will be loaded into memory only when the
below 3 criteria are met:

A. With a microcode patch header (which means the data is not padding data
   between microcode patches);
B. The 'ProcessorSignature' & 'ProcessorFlags' fields in the header match
   at least one processor within system;
C. If the Extended Signature Table exists in a microcode patch, the
   'ProcessorSignature' & 'ProcessorFlag' fields in the table entries
   match at least one processor within system.

Criterion B and C will require all the processors to be woken up once to
collect their CPUID and Platform ID information. Hence, this commit will
move the copy, detect and apply of microcode patch on BSP and APs after
all the processors have been woken up.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoUefiCpuPkg/MpInitLib: Collect processors' CPUID & Platform ID info
Hao A Wu [Thu, 19 Dec 2019 05:36:24 +0000 (13:36 +0800)]
UefiCpuPkg/MpInitLib: Collect processors' CPUID & Platform ID info

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

This commit will collect the CPUID and Platform ID information for each
processor within system. They will be stored in the CPU_AP_DATA structure.

These information will be used in the next commit to decide whether a
microcode patch will be loaded into memory.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoBaseTools/Scripts: Add sendemail.transferEncoding to SetupGit.py
Desimone, Nathaniel L [Fri, 6 Dec 2019 18:15:22 +0000 (02:15 +0800)]
BaseTools/Scripts: Add sendemail.transferEncoding to SetupGit.py

If git finds a '\r' character in the message, then it
converts the entire message content into Quoted-Printable
encoding. It appears that when groups.io converts the QP
encoding back to text format, the '\r' characters somehow
become '\n'. To workaround this, the SetupGit.py script
will now explicitly set the sendemail.transferEncoding git
config option to '8bit'

Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue.
Eric Dong [Mon, 23 Dec 2019 06:37:28 +0000 (14:37 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue.

The size for the array of mSmmMpSyncData->CpuData[] is 0 ~
mMaxNumberOfCpus -1. But current code may use
mSmmMpSyncData->CpuData[mMaxNumberOfCpus].

This patch fixed this issue.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove dependence between APs
Eric Dong [Mon, 23 Dec 2019 06:15:04 +0000 (14:15 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove dependence between APs

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

In current implementation, when check whether APs called by StartUpAllAPs
or StartUpThisAp, it checks the Tokens value used by other APs. Also the AP
will update the Token value for itself if its task finished. In this
case, the potential race condition  issues happens for the tokens.
Because of this, system may trig ASSERT during cycling test.

This change enhance the code logic, add new attributes for the token to
remove the reference for the tokens belongs to other APs.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
4 years agoedksetup.bat stuck on unicode locale Windows
Park, Aiden [Fri, 20 Dec 2019 18:24:37 +0000 (02:24 +0800)]
edksetup.bat stuck on unicode locale Windows

This issue happens under two conditions.
  1. Unicode language environment in Windows
  2. Python2 (Not reproducible with Python3)

Step to reproduce
  C:\edk2>edksetup.bat forcerebuild
The edksetup.bat stuck at 'nmake cleanall'.

Signed-off-by: Aiden Park <aiden.park@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
4 years agoMdePkg/Tcg: Add new definition in TCG PFP spec.
Jiewen Yao [Wed, 18 Dec 2019 07:13:07 +0000 (15:13 +0800)]
MdePkg/Tcg: Add new definition in TCG PFP spec.

The latest TCG PFP specification (TCG PC Client Platform Firmware Profile
Specification, Revision 1.05) added new data structure. For example,
the SPDM device measurement. This patch adds the new content.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg: Use __builtin_offset with CLANGPDB toolchain
Alex James [Thu, 28 Nov 2019 05:56:45 +0000 (13:56 +0800)]
MdePkg: Use __builtin_offset with CLANGPDB toolchain

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2393

CLANGPDB does not define __GNUC__, but it does define __clang__. Check
for the __clang__ preprocessor definition to use __builtin_offsetof to
implement the OFFSET_OF macro.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Alex James <theracermaster@gmail.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg PciExpress21: PCI_REG_PCIE_DEVICE_CONTROL2 struct has 17 bits
Daniel Pawel Banaszek [Tue, 17 Dec 2019 13:39:25 +0000 (14:39 +0100)]
MdePkg PciExpress21: PCI_REG_PCIE_DEVICE_CONTROL2 struct has 17 bits

Device Control 2 Structure have an issue.
 LtrMechanism - there is 2 bits instead of 1.

Signed-off-by: Daniel Pawel Banaszek <daniel.pawel.banaszek@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
4 years agoShellPkg/ShellProtocol: Return error code while fail parsing cmd-line
Zhichao Gao [Fri, 29 Nov 2019 08:51:45 +0000 (16:51 +0800)]
ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line

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

Errors happened in the arguments parsing is not a critical error.
And it would miss the error status code in the release version of shell.
So replace the ASSERT with returning error status code while fail
parsing command-line in UpdateArgcArgv.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Linson Augustine <linson.augustine@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
4 years agoMdePkg/Spdm: fix Nonce structure error.
Jiewen Yao [Wed, 18 Dec 2019 02:56:28 +0000 (10:56 +0800)]
MdePkg/Spdm: fix Nonce structure error.

Align to SPDM 1.0.0 specification.
Fix Nonce data structure error.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>