]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
6 years agoNetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
Zhang, Lubo [Fri, 28 Apr 2017 06:40:22 +0000 (14:40 +0800)]
NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.

if the server name expressed as a site local address begain with FEC0
when retrieving from dhcpv6 option 59 boot file url, it incorrectly process it
as a dns name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoNetworkPkg: Fix issue the iSCSI client can not send reset packet.
Zhang Lubo [Fri, 28 Apr 2017 06:41:33 +0000 (14:41 +0800)]
NetworkPkg: Fix issue the iSCSI client can not send reset packet.

if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoMdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.
Zhang, Lubo [Fri, 28 Apr 2017 06:40:49 +0000 (14:40 +0800)]
MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.

if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoCryptoPkg/SmmCryptLib: Enable HMAC-SHA256 support for SMM.
Long Qin [Wed, 26 Apr 2017 07:50:23 +0000 (15:50 +0800)]
CryptoPkg/SmmCryptLib: Enable HMAC-SHA256 support for SMM.

Enable HMAC-SHA256 cipher support in SmmCryptLib instance.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
6 years agoStdLib: GCC 6 build fixes
Leif Lindholm [Wed, 26 Apr 2017 21:49:16 +0000 (22:49 +0100)]
StdLib: GCC 6 build fixes

Resolve mainly 'misleading indentation', but also one 'defined but not used'
warning when building with GCC 6 (using GCC5 profile).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoBaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:53:50 +0000 (17:53 +0800)]
BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space

Update Rsa2048Sha256GenerateKeys Tool to support the case that
OPENSSL_PATH has space characters.

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>
6 years agoBaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:52:58 +0000 (17:52 +0800)]
BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space

Update Rsa2048Sha256Sign Tool to support the case that OPENSSL_PATH has
space characters.

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>
6 years agoBaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
Yonghong Zhu [Wed, 19 Apr 2017 09:51:45 +0000 (17:51 +0800)]
BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space

Update Pkcs7Sign Tool to support the case that OPENSSL_PATH has space
characters.

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>
6 years agoBaseTools/VolInfo: Update OPENSSL_PATH to support space characters
Yonghong Zhu [Wed, 19 Apr 2017 09:50:00 +0000 (17:50 +0800)]
BaseTools/VolInfo: Update OPENSSL_PATH to support space characters

Update OPENSSL_PATH handling to support space characters in the Path.

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>
6 years agoBaseTools: fix the typo in function name LanuchPostbuild
Nikolai SAOUKH [Wed, 26 Apr 2017 08:53:58 +0000 (16:53 +0800)]
BaseTools: fix the typo in function name LanuchPostbuild

The patch fix function name typo LanuchPostbuild ==> LaunchPostbuild.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoBaseTools: Fix a bug for BOOLEAN type value in Asbuilt inf
Yonghong Zhu [Wed, 26 Apr 2017 10:19:20 +0000 (18:19 +0800)]
BaseTools: Fix a bug for BOOLEAN type value in Asbuilt inf

When the PCD value is set to TRUE or FALSE, while it is not exchanged to
its int value, it cause error in the function int(Pcd.DefaultValue, 0).

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>
6 years agoShellPkg/Shell: eliminate double-free in RunSplitCommand()
Laszlo Ersek [Tue, 25 Apr 2017 12:44:36 +0000 (14:44 +0200)]
ShellPkg/Shell: eliminate double-free in RunSplitCommand()

Commit bd3fc8133b2b ("ShellPkg/App: Fix memory leak and save resources.",
2016-05-20) added a FreePool() call for Split->SplitStdIn, near end of the
RunSplitCommand(), right after the same shell file was closed with
CloseFile(). The argument was:

> 1) RunSplitCommand() allocates the initial SplitStdOut via
>    CreateFileInterfaceMem(). Free SplitStdIn after the swap to fix
>    the memory leak.

There is no memory leak actually, and the FreePool() call in question
constitutes a double-free:

(a) This is how the handle is established:

    ConvertEfiFileProtocolToShellHandle (
      CreateFileInterfaceMem (Unicode),
      NULL
      );

    CreateFileInterfaceMem() allocates an EFI_FILE_PROTOCOL_MEM object and
    populates it fully. ConvertEfiFileProtocolToShellHandle() allocates
    some administrative structures and links the EFI_FILE_PROTOCOL_MEM
    object into "mFileHandleList".

(b) EFI_SHELL_PROTOCOL.CloseFile() is required to close the
    SHELL_FILE_HANDLE and to release all associated data. Accordingly,
    near the end of RunSplitCommand(), we have:

    EfiShellClose()
      ShellFileHandleRemove()
        //
        // undoes the effects of ConvertEfiFileProtocolToShellHandle()
        //
      ConvertShellHandleToEfiFileProtocol()
        //
        // note that this does not adjust the pointer value; it's a pure
        // type cast
        //
      FileHandleClose()
        FileInterfaceMemClose()
          //
          // tears down EFI_FILE_PROTOCOL_MEM completely, undoing the
          // effects of CreateFileInterfaceMem ()
          //

The FreePool() call added by bd3fc8133b2b conflicts with

  SHELL_FREE_NON_NULL(This);

in FileInterfaceMemClose(), so remove it.

This error can be reproduced for example with:

> Shell> map | more
> 'more' is not recognized as an internal or external command, operable
> program, or script file.

which triggers:

> ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(624): CR has Bad Signature

with the following stack dump:

> #0  0x000000007f6dc094 in CpuDeadLoop () at
>     MdePkg/Library/BaseLib/CpuDeadLoop.c:37
> #1  0x000000007f6dd1b4 in DebugAssert (FileName=0x7f6ed9f0
>     "MdeModulePkg/Core/Dxe/Mem/Pool.c", LineNumber=624,
>     Description=0x7f6ed9d8 "CR has Bad Signature") at
>     OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c:153
> #2  0x000000007f6d075d in CoreFreePoolI (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:624
> #3  0x000000007f6d060e in CoreInternalFreePool (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:529
> #4  0x000000007f6d0648 in CoreFreePool (Buffer=0x7e232c98) at
>     MdeModulePkg/Core/Dxe/Mem/Pool.c:552
> #5  0x000000007d49fbf8 in FreePool (Buffer=0x7e232c98) at
>     MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c:818
> #6  0x000000007d4875c3 in RunSplitCommand (CmdLine=0x7d898398,
>     StdIn=0x0, StdOut=0x0) at ShellPkg/Application/Shell/Shell.c:1813
> #7  0x000000007d487d59 in ProcessNewSplitCommandLine
>     (CmdLine=0x7d898398) at ShellPkg/Application/Shell/Shell.c:2121
> #8  0x000000007d488937 in RunShellCommand (CmdLine=0x7e233018,
>     CommandStatus=0x0) at ShellPkg/Application/Shell/Shell.c:2670
> #9  0x000000007d488b0b in RunCommand (CmdLine=0x7e233018) at
>     ShellPkg/Application/Shell/Shell.c:2732
> #10 0x000000007d4867c8 in DoShellPrompt () at
>     ShellPkg/Application/Shell/Shell.c:1349
> #11 0x000000007d48524d in UefiMain (ImageHandle=0x7e24c898,
>     SystemTable=0x7f5b6018) at ShellPkg/Application/Shell/Shell.c:631

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Fixes: bd3fc8133b2b17ad2e0427d1bf6b44b08cf2f3b2
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Marvin Häuser <Marvin.Haeuser@outlook.com>
6 years agoShellPkg/Shell: clean up bogus member types in SPLIT_LIST
Laszlo Ersek [Tue, 25 Apr 2017 12:03:32 +0000 (14:03 +0200)]
ShellPkg/Shell: clean up bogus member types in SPLIT_LIST

The "SPLIT_LIST.SplitStdOut" and "SPLIT_LIST.SplitStdIn" members currently
have type (SHELL_FILE_HANDLE *). This is wrong; SHELL_FILE_HANDLE is
already a pointer, there's no need to store a pointer to a pointer.

The error is obvious if we check where and how these members are used:

- In the RunSplitCommand() function, these members are used (populated)
  extensively; this function has to be updated in sync.

  ConvertEfiFileProtocolToShellHandle() already returns the temporary
  memory file created with CreateFileInterfaceMem() as SHELL_FILE_HANDLE,
  not as (SHELL_FILE_HANDLE *).

- In particular, the ConvertShellHandleToEfiFileProtocol() calls need to
  be dropped as well in RunSplitCommand(), since
  EFI_SHELL_PROTOCOL.SetFilePosition() and EFI_SHELL_PROTOCOL.CloseFile()
  take SHELL_FILE_HANDLE parameters, not (EFI_FILE_PROTOCOL *).

  Given that ConvertShellHandleToEfiFileProtocol() only performs a
  type-cast (it does not adjust any pointer values), *and*
  SHELL_FILE_HANDLE -- taken by EFI_SHELL_PROTOCOL member functions -- is
  actually a typedef to (VOID *) -- see more on this later --, this
  conversion error hasn't been caught by compilers.

- In the ProcessNewSplitCommandLine() function, RunSplitCommand() is
  called either initially (passing in NULL / NULL; no update needed), or
  recursively (passing in Split->SplitStdIn / Split->SplitStdOut; again no
  update is necessary beyond the RunSplitCommand() modification above).

- In the UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  functions, said structure members are compared and assigned to
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdIn" and
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdOut", both of which have type
  SHELL_FILE_HANDLE, *not* (SHELL_FILE_HANDLE *).

  The compiler hasn't caught this error because of the fatally flawed type
  definition of SHELL_FILE_HANDLE, namely

    typedef VOID *SHELL_FILE_HANDLE;

  Pointer-to-void silently converts to and from most other pointer types;
  among them, pointer-to-pointer-to-void. That is also why no update is
  necessary for UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  in this fix.

(

Generally speaking, using (VOID *) typedefs for opaque handles is a tragic
mistake in all of the UEFI-related specifications; this practice defeats
any type checking that compilers might help programmers with. The right
way to define an opaque handle is as follows:

  //
  // Introduce the incomplete structure type, and the derived pointer
  // type, in both the specification and the public edk2 headers. Note
  // that the derived pointer type itself is a complete type, and it can
  // be used freely by client code.
  //
  typedef struct SHELL_FILE *SHELL_FILE_HANDLE;

  //
  // Complete the structure type in the edk2 internal C source files.
  //
  struct SHELL_FILE {
    //
    // list fields
    //
  };

This way the structure size and members remain hidden from client code,
but the C compiler can nonetheless catch any invalid conversions between
incompatible XXX_HANDLE types.

)

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
6 years agoMdeModulePKg/BDS: Build meaningful description for Wi-Fi boot option
Ruiyu Ni [Thu, 20 Apr 2017 03:22:35 +0000 (11:22 +0800)]
MdeModulePKg/BDS: Build meaningful description for Wi-Fi boot option

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
6 years agoMdePkg/dsc: add SmmIoLib
Jiewen Yao [Wed, 15 Mar 2017 09:23:46 +0000 (17:23 +0800)]
MdePkg/dsc: add SmmIoLib

Cc: Jeff Fan <jeff.fan@intel.com>
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoMdePkg/dec: Add SmmIoLib.
Jiewen Yao [Wed, 15 Mar 2017 09:24:31 +0000 (17:24 +0800)]
MdePkg/dec: Add SmmIoLib.

Cc: Jeff Fan <jeff.fan@intel.com>
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoMdePkg/SmmIoLib: Add sample instance.
Jiewen Yao [Wed, 15 Mar 2017 09:23:20 +0000 (17:23 +0800)]
MdePkg/SmmIoLib: Add sample instance.

The sample instance check if IO resource is valid
one defined in GCD.
A platform may choose add more check to exclude some
other IO resource.

Cc: Jeff Fan <jeff.fan@intel.com>
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoMdePkg/SmmIoLib: Add header file.
Jiewen Yao [Wed, 15 Mar 2017 09:23:01 +0000 (17:23 +0800)]
MdePkg/SmmIoLib: Add header file.

This SmmIoLib is used to check if an IO resource
is valid in SMM.

Cc: Jeff Fan <jeff.fan@intel.com>
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
6 years agoPeCoffGetEntryPointLib: Fix spelling issue
Jeff Fan [Mon, 24 Apr 2017 02:06:31 +0000 (10:06 +0800)]
PeCoffGetEntryPointLib: Fix spelling issue

*Serach* should be *Search*

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
6 years agoUefiCpuPkg/MpLib.c: Set AP state after X2APIC mode enabled
Jeff Fan [Tue, 25 Apr 2017 03:22:00 +0000 (11:22 +0800)]
UefiCpuPkg/MpLib.c: Set AP state after X2APIC mode enabled

After X2APIC mode is enabled, APs need to be set tp IDLE state, otherwise APs
cannot be waken up by MP PPI services.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@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>
6 years agoUefiCpuPkg: Move ProgramVirtualWireMode() to MpInitLib
Jeff Fan [Fri, 21 Apr 2017 03:21:00 +0000 (11:21 +0800)]
UefiCpuPkg: Move ProgramVirtualWireMode() to MpInitLib

In PEI phase, BSP did not program vitural wired mode while APs did.

Move program virtual wired mode from CpuDxe to MpInitLib, thus it could benefit
on both CpuDxe and CpuMpPei.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@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>
6 years agoUefiCpuPkg/MpInitLib: needn't to allocate AP reset vector
Jeff Fan [Fri, 21 Apr 2017 03:00:59 +0000 (11:00 +0800)]
UefiCpuPkg/MpInitLib: needn't to allocate AP reset vector

Because we will always borrow the AP reset vector space for AP waking up. We
needn't allocate such range to prevent other module to use it. It could simply
the code.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@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>
6 years agoUefiCpuPkg/MpInitLib: save/restore original contents
Jeff Fan [Wed, 19 Apr 2017 03:16:55 +0000 (11:16 +0800)]
UefiCpuPkg/MpInitLib: save/restore original contents

If APs is in HLT-LOOP mode, we need AP reset vector for waking up APs. This
updating is to save/restore original contents of AP reset vector around waking
up APs always.

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

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@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>
6 years agoMdeModulePkg/Ip4Dxe: Refine the IPv4 configuration help info
Jiaxin Wu [Fri, 21 Apr 2017 04:56:05 +0000 (12:56 +0800)]
MdeModulePkg/Ip4Dxe: Refine the IPv4 configuration help info

Below value indicate whether network address configured successfully
or not:
Network Device List->MAC->IPv4 Network Configuration->Configured.

This patch is to refine its help info.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoMdeModulePkg: Update PiSmmCore to set correct ImageAddress into LoadedImage
Liming Gao [Mon, 24 Apr 2017 06:39:10 +0000 (14:39 +0800)]
MdeModulePkg: Update PiSmmCore to set correct ImageAddress into LoadedImage

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg PiSmmIpl: Fix the issue in LMFA feature
Liming Gao [Wed, 12 Apr 2017 08:34:13 +0000 (16:34 +0800)]
MdeModulePkg PiSmmIpl: Fix the issue in LMFA feature

SmramBase should be got from mLMFAConfigurationTable.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
Hao Wu [Mon, 24 Apr 2017 05:32:04 +0000 (13:32 +0800)]
MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart

In function UfsHcDriverBindingStart(), the return value 'Status' may be
overridden during the original PCI attributes restore process.

This commit refines the logic to avoid such override.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct
Hao Wu [Mon, 24 Apr 2017 05:22:29 +0000 (13:22 +0800)]
MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct

The commit removes the unused field 'EFI_HANDLE  Handle' in Ufs host
controller private data structure 'UFS_HOST_CONTROLLER_PRIVATE_DATA'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoShellPkg SmbiosView: Display Type 0 BIOS segment in hexadecimal
Jeff Westfahl [Fri, 21 Apr 2017 21:25:07 +0000 (05:25 +0800)]
ShellPkg SmbiosView: Display Type 0 BIOS segment in hexadecimal

The SMBIOS Type 0 BIOS segment field is currently displayed in decimal.
Since this field is likely to have a value like 0xE800 or 0xF000, using
hexadecimal seems like a better choice.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg: Discard received broadcast message in DxeIpIoLib.
Fu Siyuan [Fri, 21 Apr 2017 01:48:09 +0000 (09:48 +0800)]
MdeModulePkg: Discard received broadcast message in DxeIpIoLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoOptionRomPkg: Fix calling convention issue for UndiRuntiumeDxe driver.
Fu Siyuan [Fri, 21 Apr 2017 01:31:14 +0000 (09:31 +0800)]
OptionRomPkg: Fix calling convention issue for UndiRuntiumeDxe driver.

Add "EFIAPI" to UNDI command entry point function according to UEFI calling
convention.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
6 years agoMdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db
Suman Prakash [Thu, 20 Apr 2017 10:01:42 +0000 (18:01 +0800)]
MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db

In case of an async command if updating the submission queue tail
doorbell fails then the command will not be picked up by device and
no completion response will be created. This scenario has to be handled.
Also if we create an AsyncRequest element and insert in the async queue,
it will never receive a completion so in the timer routine this element
won't be freed, resulting in memory leak. Also in case of blocking calls
we should capture the status of updating completion queue head doorbell
register and return it to caller of PassThru.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Suman Prakash <suman.p@samsung.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
6 years agoMdeModulePkg/PiSmmCore: Remove redundant PoolTail pointer assignment
Hao Wu [Fri, 21 Apr 2017 02:38:57 +0000 (10:38 +0800)]
MdeModulePkg/PiSmmCore: Remove redundant PoolTail pointer assignment

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
6 years agoMdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
Jiaxin Wu [Mon, 17 Apr 2017 08:06:04 +0000 (16:06 +0800)]
MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue

v3:
* Add NULL string check.

v2:
* Define new STR_FORM_NETWORK_DEVICE_TITLE_HEAD for L" Network Device "
instead of hard code in the code.

Network device tile (STR_FORM_NETWORK_DEVICE_TITLE) is dynamic adjusted
according the different MAC value. So, the string value shouldn't be treated
as a constant string (Network Device). Otherwise, the display will be
incorrect.

Reproduce: Device Manager->Network Device List, select to enter MAC, then to
press ESC back to previous page, then re-enter, found each enter/ESC operation,
the MAC address display +1.

Cc: Eric Dong <eric.dong@intel.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: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
6 years agoMdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration
Jiaxin Wu [Fri, 21 Apr 2017 02:15:27 +0000 (10:15 +0800)]
MdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
6 years agoNetworkPkg/TlsAuthConfigDxe: Close and free the file related resource
Jiaxin Wu [Mon, 10 Apr 2017 02:30:38 +0000 (10:30 +0800)]
NetworkPkg/TlsAuthConfigDxe: Close and free the file related resource

v2:
* Define one new internal function to clean the file content.

TlsAuthConfigDxe open file by FileExplorerLib. It need to close
file handler and free file related resource in some cases.
* User enrolls Cert by escape the Config page.
* The Cert is not X509 type.
* User chooses another file after he selected a file.

Cc: Zhang Chao B <chao.b.zhang@intel.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: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Chao Zhang<chao.b.zhang@intel.com>
6 years agoNetworkPkg: Correct the proxy DHCP offer handing
Jiaxin Wu [Mon, 17 Apr 2017 03:26:34 +0000 (11:26 +0800)]
NetworkPkg: Correct the proxy DHCP offer handing

When PXE10/WFM11a offer received, we should only cache
the first PXE10/WFM11a offer, and discard the others. But
Current we discard all PXE10/WFM11a offer. This patch is
to fix this issue.

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: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
6 years agoMdeModulePkg/Ip4Dxe: Fix the incorrect RemoveEntryList
Jiaxin Wu [Fri, 14 Apr 2017 01:44:50 +0000 (09:44 +0800)]
MdeModulePkg/Ip4Dxe:  Fix the incorrect RemoveEntryList

Cc: Subramanian Sriram <sriram-s@hpe.com>
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: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
6 years agoNetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
Jiaxin Wu [Wed, 12 Apr 2017 08:36:11 +0000 (16:36 +0800)]
NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure

UINT32 integer overflow will happen once the download OS image over
4G size. This patch is to fix this issue.

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: Wu Jiaxin <jiaxin.wu@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>
6 years agoMdeModulePkg/FirmwarePerformanceDxe: Error Level is not used correctly
Jeff Fan [Thu, 20 Apr 2017 06:08:53 +0000 (14:08 +0800)]
MdeModulePkg/FirmwarePerformanceDxe: Error Level is not used correctly

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoMdePkg/IndustryStandard: add definitions for ACPI 6.0 IORT
Ard Biesheuvel [Wed, 19 Apr 2017 07:10:43 +0000 (08:10 +0100)]
MdePkg/IndustryStandard: add definitions for ACPI 6.0 IORT

This adds #defines and struct typedefs for the various node types in
the ACPI 6.0 IO Remapping Table (IORT).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jiewen Yao <yiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
7 years agoMdeModulePkg/UefiBootManagerLib: Avoid buggy USB short-form expanding
Ruiyu Ni [Wed, 19 Apr 2017 09:16:27 +0000 (17:16 +0800)]
MdeModulePkg/UefiBootManagerLib: Avoid buggy USB short-form expanding

When a load option points to a physical UsbIo controller, whose
device path contains UsbClass or UsbWwid node, old logic
unconditionally treats it as a short-form device path and expands
it. But the expanding gets the exactly same device path, and the
device path is passed to BmGetNextLoadOptionDevicePath() which
then passes this device path to BmExpandUsbDevicePath() again.
This causes a infinite recursion.

The patch avoids the USB short-form expanding when the device path
points to a physical UsbIo controller.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
7 years agoNetworkPkg: Fix bug related DAD issue in IP6 driver.
Zhang, Lubo [Thu, 6 Apr 2017 08:58:09 +0000 (16:58 +0800)]
NetworkPkg: Fix bug related DAD issue in IP6 driver.

If we set PXEv6 as the first boot option and reboot immediately
after the first successful boot, it will assert. the root cause is
when we set the policy from manual to automatic in PXE driver,
the ip6 Configure item size is already set to zero and other
structures are also released, So it is not needed to perform DAD call
back function which is invoked by Ip6ConfigSetMaunualAddress.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
7 years agoNetworkPkg: Add check logic for iSCSI driver.
Zhang, Lubo [Thu, 6 Apr 2017 08:57:41 +0000 (16:57 +0800)]
NetworkPkg: Add check logic for iSCSI driver.

Need to check variable of mPrivate whether is
null before used and redefine the array length
of target address for keyword.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoMdeModulePkg PiSmmCore: Enhance SMM FreePool to catch buffer overflow
Star Zeng [Wed, 19 Apr 2017 03:12:18 +0000 (11:12 +0800)]
MdeModulePkg PiSmmCore: Enhance SMM FreePool to catch buffer overflow

This solution is equivalent to DXE core.

AllocatePool() allocates POOL_TAIL after the buffer.
This POOL_TAIL is checked at FreePool().
If the there is buffer overflow, the issue can be caught at FreePool().

This patch could also handle the eight-byte aligned allocation
requirement. The discussion related to the eight-byte aligned
allocation requirement is at
https://lists.01.org/pipermail/edk2-devel/2017-April/009995.html.

According to the PI spec (Vol 4, Section 3.2 SmmAllocatePool()):
The SmmAllocatePool() function ... All allocations are eight-byte aligned.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Hao Wu <hao.a.wu@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: Hao Wu <hao.a.wu@intel.com>
7 years agoMdeModulePkg/Ufs: Wait fDeviceInit be cleared by devices during init
Hao Wu [Tue, 21 Mar 2017 05:22:36 +0000 (13:22 +0800)]
MdeModulePkg/Ufs: Wait fDeviceInit be cleared by devices during init

In the origin codes, the host sets the fDeviceInit flag to initiate device
initialization, but does not check whether the device resets this flag
to indicate the device initialization is completed.

Details can be referred at UFS 2.0 Spec Section 14.2 - Flags.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/UfsPassThruDxe: Replace 'EFI_D_XXX' with 'DEBUG_XXX'
Hao Wu [Tue, 21 Mar 2017 05:33:04 +0000 (13:33 +0800)]
MdeModulePkg/UfsPassThruDxe: Replace 'EFI_D_XXX' with 'DEBUG_XXX'

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoShellPkg/pci: Fix VS2012 build failure
Ruiyu Ni [Thu, 20 Apr 2017 02:17:16 +0000 (10:17 +0800)]
ShellPkg/pci: Fix VS2012 build failure

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
7 years agoShellPkg/comp: Fix file tag name.
Ruiyu Ni [Thu, 20 Apr 2017 02:16:12 +0000 (10:16 +0800)]
ShellPkg/comp: Fix file tag name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
7 years agoMdeModulePkg/TerminalDxe: Avoid always append device path to *Dev
Ruiyu Ni [Wed, 19 Apr 2017 02:42:01 +0000 (10:42 +0800)]
MdeModulePkg/TerminalDxe: Avoid always append device path to *Dev

When TerminalDxe Start() is called multiple times, the old logic
unconditionally appended the terminal device path candidates to
*Dev (ConInDev/ConOutDev/ErrOutDev), resulting the volatile storage
is full.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoEmbeddedPkg: import Lan91x Ethernet controller driver
Leif Lindholm [Wed, 19 Apr 2017 11:01:55 +0000 (12:01 +0100)]
EmbeddedPkg: import Lan91x Ethernet controller driver

OpenPlatformPkg (https://git.linaro.org/uefi/OpenPlatformPkg.git) holds a
driver for the SMSC LAN91x, used (among other places) in several ARM Ltd.
software system models.

Import it to EDK2 EmbeddedPkg in preparation for migrating those model
platforms to edk2-platforms.

On the way, update the files to pass PatchCheck.py without warnings
(EFI_D_ -> DEBUG_ and purging tab characters).
Also update .inf file to current version (and sort entries within
sections).
And update copyright dates to reflect this.

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 agoEmbeddedPkg/AndroidFastbootApp: remove dependency on deprecated BdsLib
Ard Biesheuvel [Mon, 10 Apr 2017 16:55:34 +0000 (17:55 +0100)]
EmbeddedPkg/AndroidFastbootApp: remove dependency on deprecated BdsLib

One of the last remaining modules with a dependency on the deprecated
BdsLib implementation from ArmPkg is the Android fastboot application.

Its only dependency on BdsLib is BdsStartEfiApplication(), which is
used in the most peculiar way: the fastboot app loads the kernel image
into memory, and creates a MemoryMapped() device path for it. It then
proceeds and calls BdsStartEfiApplication(), which explicitly loads the
contents of the devicepath into memory, creating a second in-memory copy
of the kernel image, after which it invokes gBS->LoadImage() with a
buffer address and size (while it is perfectly capable of loading from
a devicepath directly)

Since we know the device path is fully qualified and connected, and does
not require any of the additional processing that BdsStartEfiApplication()
does when dereferencing a device path, we should be able to pass this
devicepath into LoadImage() directly.

So create a simplified local clone of BdsStartEfiApplication(), and drop
the dependency on BdsLib.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Lock should be acquired
Jeff Fan [Tue, 18 Apr 2017 02:14:08 +0000 (10:14 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Lock should be acquired

SMM BSP's *busy* state should be acquired. We could use AcquireSpinLock()
instead of AcquireSpinLockOrFail().

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
7 years agoShellPkg/Pci: Always dump the extended config space for PCIE
Ruiyu Ni [Mon, 17 Apr 2017 03:03:54 +0000 (11:03 +0800)]
ShellPkg/Pci: Always dump the extended config space for PCIE

It is to align to the original behavior before "-ec" option was
added.

The patch also refines the code to make it more readable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jim Dailey <Jim.Dailey@dell.com>
7 years agoMdeModulePkg/HiiDB: Avoid incorrect results of multiplication
Dandan Bi [Wed, 12 Apr 2017 03:21:52 +0000 (11:21 +0800)]
MdeModulePkg/HiiDB: Avoid incorrect results of multiplication

An example:
The codes in function Output8bitPixel in Image.c:
OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos);

Both Image->Width and Ypos are of type UINT16. They will be promoted to
int (signed) first, and then perform the multiplication defined by macro
BITMAP_LEN_8_BIT. If the result of multiplication between Image->Width and
Ypos exceeds the range of type int, a potential incorrect results
will be assigned to OffsetY.

This commit adds explicit UINT32 type cast for 'Image->Width' to avoid
possible overflow in the int range. And also fix similar issues in
HiiDatabase.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
7 years agoMdeModulePkg/BMMUiLib: Update codes of initializing ConsoleXXXCheck array
Dandan Bi [Mon, 17 Apr 2017 08:12:48 +0000 (16:12 +0800)]
MdeModulePkg/BMMUiLib: Update codes of initializing ConsoleXXXCheck array

When initializing ConsoleOutCheck/ConsoleInCheck/ConsoleErrCheck array in
BMM_FAKE_NV_DATA structure, also need to consider whether the terminal
device is ConOut/ConIn/ConErr or not.

Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
7 years agoBaseTools: Update the Conf directory to use the absolute path
Yonghong Zhu [Mon, 17 Apr 2017 09:12:06 +0000 (17:12 +0800)]
BaseTools: Update the Conf directory to use the absolute path

Update the Conf directory to use the absolute path for build_rule.txt
and tools_def.txt.

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 agoUefiCpuPkg/MtrrLib: Avoid running unnecessary code
Ruiyu Ni [Mon, 17 Apr 2017 03:20:47 +0000 (11:20 +0800)]
UefiCpuPkg/MtrrLib: Avoid running unnecessary code

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
7 years agoShellPkg/ConsistMapping: Remove unneeded memory reallocation
Ruiyu Ni [Mon, 17 Apr 2017 06:20:40 +0000 (14:20 +0800)]
ShellPkg/ConsistMapping: Remove unneeded memory reallocation

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoMdeModulePkg/BootManagerMenu: Add assertion to indicate no DIV by 0
Ruiyu Ni [Tue, 11 Apr 2017 02:07:43 +0000 (10:07 +0800)]
MdeModulePkg/BootManagerMenu: Add assertion to indicate no DIV by 0

BootMenuSelectItem() contains code to DIV BootMenuData->ItemCount.
When BootMenuData->ItemCount can be 0, the DIV operation may
trigger CPU exception.
But in logic, this case won't happen. So add assertion to indicate
it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
7 years agoCryptoPkg: Correct some minor issues in function comments
Long Qin [Fri, 14 Apr 2017 08:31:51 +0000 (16:31 +0800)]
CryptoPkg: Correct some minor issues in function comments

Correct some minor comment issues in BaseCryptLib.h and
CryptPkcs7Verify.c, including:
  - missed "out" in parameter property for ARC4 interfaces;
  - Wrong Comment tail in Pkcs7GetAttachedContent function

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
7 years agoMdeModulePkg CapsuleApp: Add directory support
Star Zeng [Tue, 11 Apr 2017 01:55:51 +0000 (09:55 +0800)]
MdeModulePkg CapsuleApp: Add directory support

Current CapsuleApp only supports input/output file from rootdirectory.
If the CapsuleApp and related file are put into subdirectory,
below message will be shown when running the CapsuleApp in shell.

"CapsuleApp: capsule image (Capsule image file name) is not found."

This patch is to add directory support for CapsuleApp
by using shell protocol.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@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>
7 years agoIntelFrameworkPkg/UefiLib: Avoid mis-calculate of graphic console size
Hao Wu [Thu, 23 Mar 2017 02:45:44 +0000 (10:45 +0800)]
IntelFrameworkPkg/UefiLib: Avoid mis-calculate of graphic console size

The commit adds check in function InternalPrintGraphic() to ensure that
the expression:

Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

will not overflow in the UINTN range.

The commit also adds an explicit UINT32 type cast for 'Blt->Width' to
avoid possible overflow in the int range for:

Blt->Width * Blt->Height

Since both Blt->Width and Blt->Height are of type UINT16. They will be
promoted to int (signed) first, and then perform the multiplication
operation. If the result of multiplication between Blt->Width and
Blt->Height exceeds the range of type int, a potential incorrect size will
be passed into function AllocateZeroPool().

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/UefiLib: Avoid mis-calculate of graphic console size
Hao Wu [Thu, 23 Mar 2017 02:16:23 +0000 (10:16 +0800)]
MdePkg/UefiLib: Avoid mis-calculate of graphic console size

The commit adds check in function InternalPrintGraphic() to ensure that
the expression:

Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

will not overflow in the UINTN range.

The commit also adds an explicit UINT32 type cast for 'Blt->Width' to
avoid possible overflow in the int range for:

Blt->Width * Blt->Height

Since both Blt->Width and Blt->Height are of type UINT16. They will be
promoted to int (signed) first, and then perform the multiplication
operation. If the result of multiplication between Blt->Width and
Blt->Height exceeds the range of type int, a potential incorrect size will
be passed into function AllocateZeroPool().

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 agoMdeModulePkg/DxeCore: Add ASSERT to ensure no subtract underflow
Hao Wu [Wed, 22 Mar 2017 02:08:55 +0000 (10:08 +0800)]
MdeModulePkg/DxeCore: Add ASSERT to ensure no subtract underflow

For function SplitRecord() in file PropertiesTable.c, there is a
potential subtract underflow case for line:

  return TotalNewRecordCount - 1;

However, such case will not happen since the logic in function
SplitTable() ensure that when calling SplitRecord(), the variable
'TotalNewRecordCount' will not be zero when performing the subtraction.
It will be handled in the previous if statement:

  if (MaxSplitRecordCount == 0) {
    CopyMem (NewRecord, OldRecord, DescriptorSize);
    return 0;
  }

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoMdeModulePkg/PiSmmCore: Fix potentially uninitialized local variable
Hao Wu [Mon, 20 Mar 2017 07:07:27 +0000 (15:07 +0800)]
MdeModulePkg/PiSmmCore: Fix potentially uninitialized local variable

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoMdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
Liming Gao [Thu, 13 Apr 2017 07:08:07 +0000 (15:08 +0800)]
MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer

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

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoMdeModulePkg BrotliLib: Fix the regression logic issue in loop
Liming Gao [Thu, 13 Apr 2017 16:13:06 +0000 (00:13 +0800)]
MdeModulePkg BrotliLib: Fix the regression logic issue in loop

In V2, change logic to avoid use mtf[-1] style to get value.

Roll back to previous logic, and use point + offset to get byte value.

Cc: Bell Song <binx.song@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bell Song <binx.song@intel.com>
7 years agoArmPkg: copy/paste fixes in ARM ArmHvcLib/ArmSmcLib
Leif Lindholm [Wed, 12 Apr 2017 14:17:00 +0000 (15:17 +0100)]
ArmPkg: copy/paste fixes in ARM ArmHvcLib/ArmSmcLib

ARM ArmHvcLib looks like it was created from copy of ArmSmcLib which
looks like it was created from a copy of the AArch64 version.

Both of these files include AsmMacroIoLibV8.h instead of
AsmMacroIoLib.h, although since they only use macros that are identical
between the two, there was no functional issue caused by this.

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 agoArmVirtPkg/ArmVirtXen: remove ARM BdsLib library class resolution
Ard Biesheuvel [Tue, 11 Apr 2017 20:07:54 +0000 (21:07 +0100)]
ArmVirtPkg/ArmVirtXen: remove ARM BdsLib library class resolution

Remove the library class resolution for ARM's BdsLib: no included
module actually depends on it, and it will be removed shortly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoMdePkg: BaseIoLibIntrinsic (IoLib class) library
Leo Duran [Wed, 12 Apr 2017 14:55:23 +0000 (22:55 +0800)]
MdePkg: BaseIoLibIntrinsic (IoLib class) library

This patch adds an SEV-specific .INF and corresponding assembly
files, to unroll REP INSx/OUTSx on IoRead/WriteFifo#() routines
when the SEV feature is enabled under a hypervisor environment.

The new .INF only supports the IA32 and X64 architectures.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Leo Duran <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools/ECC: Add a new checkpoint
Hess Chen [Tue, 11 Apr 2017 08:17:19 +0000 (16:17 +0800)]
BaseTools/ECC: Add a new checkpoint

Add a new checkpoint to check if the SMM communication parameter has
a correct buffer type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTools: Fix re-build issue after tools_def/build_rule updated.
Derek Lin [Tue, 11 Apr 2017 05:20:08 +0000 (13:20 +0800)]
BaseTools: Fix re-build issue after tools_def/build_rule updated.

Add tools_def.txt and build_rule.txt to workspace autogen timestamp file.
Now it will not skip autogen if this two file is updated.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoBaseTools: Fix build fail after clean or cleanall target.
Derek Lin [Tue, 11 Apr 2017 02:47:53 +0000 (10:47 +0800)]
BaseTools: Fix build fail after clean or cleanall target.

Remove module AutoGenTimeStamp file during clean or cleanall.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoIntelFrameworkModulePkg/IdeBusDxe: Fix undefined behavior in signed left shift
Hao Wu [Wed, 12 Apr 2017 00:43:10 +0000 (08:43 +0800)]
IntelFrameworkModulePkg/IdeBusDxe: Fix undefined behavior in signed left shift

In function AtapiReadCapacity(), the following expression:
IdeDev->BlkIo.Media->LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, and
IdeDev->BlkIo.Media->LastBlock is of type UINT64. Therefore,
Data.LastLbaX will be promoted to int (32 bits, signed) first,
and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
will lead to a potential of setting the high 32 bits of
IdeDev->BlkIo.Media->LastBlock to 1 during the cast from type int to type
UINT64.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
resolve this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/UsbBotPei: Fix undefined behavior in signed left shift
Hao Wu [Wed, 12 Apr 2017 01:06:36 +0000 (09:06 +0800)]
MdeModulePkg/UsbBotPei: Fix undefined behavior in signed left shift

In function PeiUsbReadCapacity(), the following expression:
LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in function PeiUsbReadFormattedCapacity().)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, they will be promoted to int (32
bits, signed) first, and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
might incur potential issues.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
refine the codes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/UfsBlkIoPei: Fix undefined behavior in signed left shift
Hao Wu [Wed, 12 Apr 2017 01:00:18 +0000 (09:00 +0800)]
MdeModulePkg/UfsBlkIoPei: Fix undefined behavior in signed left shift

In function UfsBlockIoPeimGetMediaInfo(), the following expression:
Private->Media[DeviceIndex].LastBlock  = (Capacity16.LastLba3 << 24) |
  (Capacity16.LastLba2 << 16) |
  (Capacity16.LastLba1 << 8) |
  Capacity16.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Capacity16.LastLbaX is of type UINT8, and
Private->Media[DeviceIndex].LastBlock is of type UINT64. Therefore,
Capacity16.LastLbaX will be promoted to int (32 bits, signed) first, and
then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Capacity16.LastLba3 is 1, (Capacity16.LastLba3 << 24) will
be out of the range within int type. The undefined behavior of the signed
left shift will lead to a potential of setting the high 32 bits of
Private->Media[DeviceIndex].LastBlock to 1 during the cast from type int
to type UINT64.

This commit will add an explicit UINT32 type cast for Capacity16.LastLba3
to resolve this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/IdeBusPei: Fix undefined behavior in signed left shift
Hao Wu [Wed, 12 Apr 2017 00:52:51 +0000 (08:52 +0800)]
MdeModulePkg/IdeBusPei: Fix undefined behavior in signed left shift

In function ReadCapacity(), the following expression:
MediaInfo->LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, and MediaInfo->LastBlock is of type
UINTN. Therefore, Data.LastLbaX will be promoted to int (32 bits, signed)
first, and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
will lead to a potential of setting the high 32 bits of
MediaInfo->LastBlock to 1 during the cast from type int to type UINT64
for X64 builds.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
resolve this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
7 years agoMdeModulePkg/ScsiDiskDxe: Fix undefined behavior in signed left shift
Hao Wu [Mon, 20 Mar 2017 07:17:36 +0000 (15:17 +0800)]
MdeModulePkg/ScsiDiskDxe: Fix undefined behavior in signed left shift

In function GetMediaInfo(), the following expression:
ScsiDiskDevice->BlkIo.Media->LastBlock =  (Capacity10->LastLba3 << 24) |
                                          (Capacity10->LastLba2 << 16) |
                                          (Capacity10->LastLba1 << 8)  |
                                           Capacity10->LastLba0;
will involve undefined behavior in signed left shift operations.

Since Capacity10->LastLbaX is of type UINT8, and
ScsiDiskDevice->BlkIo.Media->LastBlock is of type UINT64. Therefore,
Capacity10->LastLbaX will be promoted to int (32 bits, signed) first,
and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Capacity10->LastLba3 is 1, (Capacity10->LastLba3 << 24)
will be out of the range within int type. The undefined behavior of the
signed left shift will lead to a potential of setting the high 32 bits
of ScsiDiskDevice->BlkIo.Media->LastBlock to 1 during the cast from type
int to type UINT64.

This commit will add an explicit UINT32 type cast for
Capacity10->LastLba3 to resolve this issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
7 years agoMdeModulePkg/Dxe/Image: Restore mCurrentImage on all paths
Hao Wu [Mon, 20 Mar 2017 08:24:09 +0000 (16:24 +0800)]
MdeModulePkg/Dxe/Image: Restore mCurrentImage on all paths

This commit makes sure that in function CoreStartImage(), module
variable 'mCurrentImage' is restored to the current start image context
on all code paths.

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 agoMdeModulePkg: Fix BrotliCustomDecompressLib potential issue
Song, BinX [Fri, 7 Apr 2017 06:52:15 +0000 (14:52 +0800)]
MdeModulePkg: Fix BrotliCustomDecompressLib potential issue

- Fix BrotliCustomDecompressLib potential issue

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
7 years agoSecurityPkg/SecurityPkg.dec: Update PcdPkcs7CertBuffer PCD.
Long Qin [Tue, 11 Apr 2017 07:54:28 +0000 (15:54 +0800)]
SecurityPkg/SecurityPkg.dec: Update PcdPkcs7CertBuffer PCD.

This patch updates the PcdPkcs7CertBuffer PCD to use the new
generated test certificate data for PKCS7 verification. This
was used as sample trusted certificate in the verification of
Signed Capsule Update.
(The updated value is still only for test purpose.)

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
7 years agoBaseTools/Pkcs7Sign: Update the test certificates & Readme.md
Long Qin [Tue, 11 Apr 2017 07:36:54 +0000 (15:36 +0800)]
BaseTools/Pkcs7Sign: Update the test certificates & Readme.md

The old TestRoot certificate used for Pkcs7Sign is not compliant to
Root CA certificate requirement with incorrect basic constraints and
key usage setting.
When OpenSSL in CryptoPkg was updated from 1.0.2xx to the latest
1.1.0xx, the CA certificate checking was enforced for more extension
validations, which will raise the verification failure when stilling
using the old sample certificates.

This patch re-generated one set of test certificates used in
Pkcs7Sign demo, and updated the corresponding Readme.md to describe
how to set the options in openssl configuration file.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoUefiCpuPkg: Error Level is not used correctly
Jeff Fan [Mon, 10 Apr 2017 06:03:28 +0000 (14:03 +0800)]
UefiCpuPkg: Error Level is not used correctly

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@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 agoSecurityPkg: Error Level is not used correctly
Jeff Fan [Mon, 10 Apr 2017 06:01:47 +0000 (14:01 +0800)]
SecurityPkg: Error Level is not used correctly

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
7 years agoMdeModulePkg: Error Level is not used correctly
Jeff Fan [Mon, 10 Apr 2017 06:00:03 +0000 (14:00 +0800)]
MdeModulePkg: Error Level is not used correctly

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 agoArmPlatformPkg/ArmVExpressDxe: remove FDT handling from ArmFvpDxe
Ard Biesheuvel [Wed, 29 Mar 2017 12:58:42 +0000 (13:58 +0100)]
ArmPlatformPkg/ArmVExpressDxe: remove FDT handling from ArmFvpDxe

Replace the elaborate but awkward handling of FDT images using device
paths and string PCDs initialized to 128 spaces with a simple scheme
involving a set of builtin DTBs and a bit of runtime logic to select
between them.

This is sufficient for ordinary use, which makes it more suitable as
reference code. Note that overriding the DTB presented to the OS can
easily be done with a UEFI application that simply installs a new DTB
image under the existing FDT configuration table GUID.

For this module, this simply involves removing all code that is involved
in deciding which platform we are running on, and for reasoning about
FDT device paths.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
7 years agoArmPlatformPkg/ArmVExpressDxe: remove unused cruft from ArmHwDxe
Ard Biesheuvel [Wed, 29 Mar 2017 12:15:57 +0000 (13:15 +0100)]
ArmPlatformPkg/ArmVExpressDxe: remove unused cruft from ArmHwDxe

Remove unused cruft from ArmHwDxe -- the only thing that remains is
installation of the 'runaxf' shell command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
7 years agoArmPlatformPkg/ArmVExpressDxe: remove ARM support
Ard Biesheuvel [Wed, 29 Mar 2017 10:58:43 +0000 (11:58 +0100)]
ArmPlatformPkg/ArmVExpressDxe: remove ARM support

The 32-bit ARM support in this driver is unused, and thus untested.
So let's just remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
7 years agoArmPlatformPkg/EblCmdLib: remove dependency on deprecated ARM BdsLib
Ard Biesheuvel [Tue, 11 Apr 2017 09:12:50 +0000 (10:12 +0100)]
ArmPlatformPkg/EblCmdLib: remove dependency on deprecated ARM BdsLib

The EBL alternative shell depends indirectly on the deprecated ARM
BdsLib via EblCmdLib, which only uses a single helper function that
can easily be cloned. So clone it, and remove the dependency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
7 years agoBaseTools/ECC: Change check rule for Ifndef statement
Hess Chen [Mon, 10 Apr 2017 02:57:18 +0000 (10:57 +0800)]
BaseTools/ECC: Change check rule for Ifndef statement

Remove the check of Ifndef statement on .c files, only check on .h
files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
7 years agoBaseTools: Add option in CLANG38 to disable warning unknown-warning-option
Liming Gao [Tue, 11 Apr 2017 06:21:34 +0000 (14:21 +0800)]
BaseTools: Add option in CLANG38 to disable warning unknown-warning-option

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

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>
7 years agoAppPkg/Applications/Python/PyMod-2.7.2: Replace non-ascii characters
Hao Wu [Fri, 7 Apr 2017 02:11:49 +0000 (10:11 +0800)]
AppPkg/Applications/Python/PyMod-2.7.2: Replace non-ascii characters

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

Contributed-under: TianoCore Contribution Agreement 1.0
Contributed-by: gray.wang <wt180250@126.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
7 years agoOvmfPkg/QemuVideoDxe: VMWare SVGA device support
Phil Dennis-Jordan [Fri, 7 Apr 2017 06:25:58 +0000 (18:25 +1200)]
OvmfPkg/QemuVideoDxe: VMWare SVGA device support

In addition to the QXL, Cirrus, etc. VGA adapters, Qemu also implements
a basic version of VMWare's SVGA display device. Drivers for this
device exist for some guest OSes which do not support Qemu's other
display adapters, so supporting it in OVMF is useful in conjunction
with those OSes.

This change adds support for the SVGA device's framebuffer to
QemuVideoDxe's graphics output protocol implementation, based on
VMWare's documentation. The most basic initialisation, framebuffer
layout query, and mode setting operations are implemented.

The device relies on port-based 32-bit I/O, unfortunately on misaligned
addresses. This limits the driver's support to the x86 family of
platforms.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O.
Phil Dennis-Jordan [Fri, 7 Apr 2017 06:25:57 +0000 (18:25 +1200)]
OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O.

The VMWare SVGA display device implemented by Qemu (-vga vmware) uses
an I/O-type BAR which is laid out such that some register offsets are
not aligned to the read/write width with which they are expected to be
accessed. (The register value port has an offset of 1 and requires
32 bit wide read/write access.)

The EFI_PCI_IO_PROTOCOL's Io.Read/Io.Write functions do not support
such unaligned I/O.

Before a driver for this device can be added to QemuVideoDxe, helper
functions for unaligned I/O are therefore required. This adds the
functions UnalignedIoWrite32 and UnalignedIoRead32, based on IoLib's
IoWrite32 and IoRead32, for the Ia32 and X64 architectures. Port I/O
requires inline assembly, so implementations are provided for the GCC,
ICC, and Microsoft compiler families. Such I/O is not possible on other
architectures, a dummy (ASSERT()ing) implementation is therefore
provided to satisfy the linker.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoOvmfPkg: VMWare SVGA display device register definitions
Phil Dennis-Jordan [Fri, 7 Apr 2017 06:25:56 +0000 (18:25 +1200)]
OvmfPkg: VMWare SVGA display device register definitions

This adds a header file defining symbolic constants for the VMWare SVGA
virtual display device in preparation for supporting it in
QemuVideoDxe.

It is mostly an extract of the file lib/vmware/svga_reg.h from commit
329dd537456f93a806841ec8a8213aed11395def of VMWare's vmware-svga
repository at git://git.code.sf.net/p/vmware-svga/git (See also
http://vmware-svga.sourceforge.net/ )

Only the bare essentials necessary for initialisation, modesetting and
framebuffer access have been kept from the original file; macro names
have been prefixed with VMWARE_SVGA_ instead of SVGA2_, and the enum
definition has been adapted to comply with EDK2 naming conventions.

The original file was released by VMWare under the MIT license, this
has been retained.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoBaseTools: Convert BrotliCompress.bat to DOS format
Liming Gao [Fri, 7 Apr 2017 07:07:49 +0000 (15:07 +0800)]
BaseTools: Convert BrotliCompress.bat to DOS format

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>
7 years agoCryptoPkg IntrinsicLib: Remove GCC -fno-builtin option
Liming Gao [Thu, 6 Apr 2017 08:16:25 +0000 (16:16 +0800)]
CryptoPkg IntrinsicLib: Remove GCC -fno-builtin option

GCC -fno-builtin option is added into tools_def.template at
90defe7198a42b3157ae5d9b93714f891cf06e57.
So, there is no need to set it in module INF file.

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
7 years agoMdeModulePkg RegularExpressionDxe: Remove GCC -fno-builtin option
Liming Gao [Thu, 6 Apr 2017 08:15:09 +0000 (16:15 +0800)]
MdeModulePkg RegularExpressionDxe: Remove GCC -fno-builtin option

GCC -fno-builtin option is added into tools_def.template at
90defe7198a42b3157ae5d9b93714f891cf06e57.
So, there is no need to set it in module INF file.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
7 years agoShellPkg/SetVar: Fix typo in comments
Dandan Bi [Thu, 6 Apr 2017 13:55:04 +0000 (21:55 +0800)]
ShellPkg/SetVar: Fix typo in comments

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>