Not close gEfiEndOfDxeEventGroupGuid event in ReadyToLock event notify because PI spec doesn't say gEfiEndOfDxeEventGroupGuid must be notified before ReadyToLock event.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14150 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: bump commonly used ACPI table revision numbers

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14151 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: fold macros of unsupported PM1b register blocks into Facp.aslc

Soon we're going to specify Extended Addresses of register blocks in
Generic Address Structure format. The GAS is easy to fill if we want to
posit either "unsupported" (all zero) or a given address in a specific
address space. However deriving "unsupported" just from a macro expanding
to zero is unwieldy, so let's avoid the need.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14152 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: fold macros of unsupported PM2 control reg. block into Facp.aslc

Soon we're going to specify Extended Addresses of register blocks in
Generic Address Structure format. The GAS is easy to fill if we want to
posit either "unsupported" (all zero) or a given address in a specific
address space. However deriving "unsupported" just from a macro expanding
to zero is unwieldy, so let's avoid the need.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14153 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: fold macros of unsupported GPE1 register block into Facp.aslc

In the next patch we're going to specify Extended Addresses of register
blocks in Generic Address Structure format. The GAS is easy to fill if we
want to posit either "unsupported" (all zero) or a given address in a
specific address space. However deriving "unsupported" just from a macro
expanding to zero is unwieldy, so let's avoid the need.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14154 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: upgrade the FADT to ACPI 2.0 without functional changes

This conversion cannot be split very well into smaller patches. Comparing
version 1 and version 2 (modulo the header fields):

> --- EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE
> +++ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE
> @@ -1,14 +1,14 @@
>    EFI_ACPI_DESCRIPTION_HEADER             Header;
>    UINT32                                  FirmwareCtrl;
>    UINT32                                  Dsdt;
> -  UINT8                                   IntModel;
> -  UINT8                                   Reserved1;
> +  UINT8                                   Reserved0;
> +  UINT8                                   PreferredPmProfile;

The INT_MODEL field was present in ACPI 1.0, but eliminated in 2.0.
According to the spec, "platforms should set this field to zero but field
values of one are also allowed to maintain compatibility with ACPI 1.0".
We're setting it to zero.

About Preferred_PM_Profile (taking the place of an 1.0 reserved field),
the specification says:

  This field is set by the OEM to convey the preferred power management
  profile to OSPM. OSPM can use this field to set default power management
  policy parameters during OS installation.

>From <MdePkg/Include/IndustryStandard/Acpi20.h>:

  #define EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED         0
  #define EFI_ACPI_2_0_PM_PROFILE_DESKTOP             1
  #define EFI_ACPI_2_0_PM_PROFILE_MOBILE              2
  #define EFI_ACPI_2_0_PM_PROFILE_WORKSTATION         3
  #define EFI_ACPI_2_0_PM_PROFILE_ENTERPRISE_SERVER   4
  #define EFI_ACPI_2_0_PM_PROFILE_SOHO_SERVER         5
  #define EFI_ACPI_2_0_PM_PROFILE_APPLIANCE_PC        6

For a virtual machine, "unspecified" is the best choice.

>    UINT16                                  SciInt;
>    UINT32                                  SmiCmd;
>    UINT8                                   AcpiEnable;
>    UINT8                                   AcpiDisable;
>    UINT8                                   S4BiosReq;
> -  UINT8                                   Reserved2;
> +  UINT8                                   PstateCnt;

We've been already treating this field as PSTATE_CNT. No change in value.

>    UINT32                                  Pm1aEvtBlk;
>    UINT32                                  Pm1bEvtBlk;
>    UINT32                                  Pm1aCntBlk;
> @@ -20,11 +20,11 @@
>    UINT8                                   Pm1EvtLen;
>    UINT8                                   Pm1CntLen;
>    UINT8                                   Pm2CntLen;
> -  UINT8                                   PmTmLen;
> +  UINT8                                   PmTmrLen;

(Field renaming artifact.)

>    UINT8                                   Gpe0BlkLen;
>    UINT8                                   Gpe1BlkLen;
>    UINT8                                   Gpe1Base;
> -  UINT8                                   Reserved3;
> +  UINT8                                   CstCnt;

We've been already treating this field as CST_CNT. No change in value.

>    UINT16                                  PLvl2Lat;
>    UINT16                                  PLvl3Lat;
>    UINT16                                  FlushSize;
> @@ -34,7 +34,19 @@
>    UINT8                                   DayAlrm;
>    UINT8                                   MonAlrm;
>    UINT8                                   Century;
> -  UINT8                                   Reserved4;
> -  UINT8                                   Reserved5;
> -  UINT8                                   Reserved6;
> +  UINT16                                  IaPcBootArch;
> +  UINT8                                   Reserved1;

The first two octets are now merged into a 16-bit short; otherwise we've
been treating those as boot architecture flags already (see SVN rev
13615). No change in value.

>    UINT32                                  Flags;

The fixed feature flags are not modified, only the macro names (expanding
to identical values) are updated to ACPI 2.0.

The following fields are all new in ACPI 2.0:

> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  ResetReg;
> +  UINT8                                   ResetValue;

We don't claim support for the reset register yet.

> +  UINT8                                   Reserved2[3];
> +  UINT64                                  XFirmwareCtrl;
> +  UINT64                                  XDsdt;

The 64-bit physical addresses for the FACS and the DSDT are automatically
filled at installation time, see AddTableToList() and DeleteTable() in
"MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c".

> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPm1aEvtBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPm1bEvtBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPm1aCntBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPm1bCntBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPm2CntBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XPmTmrBlk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XGpe0Blk;
> +  EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE  XGpe1Blk;

We specify the extended addresses for the required and supported PM1a
Event & Control, PM Timer, and GPE0 Register Blocks, and zero the rest, in
accordance with the ACPI 1.0 fields.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14155 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: report support for the PIIX3 reset register in the FADT

The value to be written corresponds to hard reset, which is what the ACPI
spec prescribes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14156 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: attempt to trigger cold reset through PIIX3 reset control register

The reset requested via the keyboard controller (port 0x64) is actually a
soft reset, but qemu has supported it since forever (plus qemu has not
distinguished between hard reset and soft reset, although this is changing
now). Therefore leave the current IoWrite() in place for compatibility.

On qemu versions with commit 1ec4ba74 ("PIIX3: reset the VM when the Reset
Control Register's RCPU bit gets set"), use the PIIX3 RCR as first choice.
In the future qemu will act differently on soft vs. hard reset requests,
and we should honor that in ResetCold().

  Writing to ioport 0xCF9 on qemu builds prior to commit 1ec4ba74 should
  have no effect. Access to the PCI host config register went through
  several implementations in qemu. Commit 9f6f0423 ("pci_host: rewrite
  using rwhandler") seems safe, both before and after.

  Commit d0ed8076 ("pci_host: convert conf index and data ports to memory
  API") inadvertently dropped the alignment/size check, causing a boot
  regression on NetBSD. It was fixed about six months later in commit
  cdde6ffc, which is current. Translating that to qemu releases, the bug
  was visible from v1.0 to v1.1.0.

On physical hardware cycling between reset methods is sometimes necessary
<http://mjg59.dreamwidth.org/3561.html>. On qemu the port access should
trap immediately.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14157 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg: make sure ResetCold() and ResetWarm() never return

Also, add a small delay after the 0xCF9 hard reset request -- on qemu/kvm the
port access is translated to the qemu-internal system reset request by the CPU
thread, and it might progress some more before the IO thread acts upon the
system reset request.

MicroSecondDelay() is implemented by OvmfPkg's own AcpiTimerLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14158 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg: Add ShellPrintHelp function to ShellLib.

This function allows for easier access to printing standard command help.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Matt Stanbro <Matthew.A.Stanbro@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14159 6f19259b-4bc3-4df7-8a09-765794883524
ShellPkg: Add "dp" command library to ShellPkg.

This command is only included in the build with command line option "-D INCLUDE_DP".  The user must also update the DSC with appropriate library instances that match the platform for the build to succeed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14160 6f19259b-4bc3-4df7-8a09-765794883524
Enhance the ConPlatform driver to take care of the optional Controller device path node when comparing the GOP device path.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Kinney Michael D <michael.d.kinney@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14161 6f19259b-4bc3-4df7-8a09-765794883524
Follow UEFI spec, set TimeOut and HwErrRecSupport variable by EFI variable service instead of PcdSet().

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14162 6f19259b-4bc3-4df7-8a09-765794883524
ArmPkg/DebugPeCoffExtraActionLib: Checked the ImageContext->PdbPointer is not null

This check prevents to get an assertion in case of null PdbPointer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14163 6f19259b-4bc3-4df7-8a09-765794883524
ArmPkg: Move ArmSmcLib from ArmPlatformLib to ArmPkg

A ArmSmcLib Null implementation has also been added for CPU without the ARM Security
Extension (Trustzone support).

Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14164 6f19259b-4bc3-4df7-8a09-765794883524
Fix a bug that IsSignatureFoundInDatabase() incorrectly computes CertCount.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14165 6f19259b-4bc3-4df7-8a09-765794883524
Update code to follow coding style.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14166 6f19259b-4bc3-4df7-8a09-765794883524
Fix a bug in IP4 driver that the broadcast/multicast mac address is overrided by the gateway’s mac address.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14167 6f19259b-4bc3-4df7-8a09-765794883524
Initialize DefaultInfo before using it.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14168 6f19259b-4bc3-4df7-8a09-765794883524
Update DHCP6 driver to handle EFI_DHCP6_CALLBACK return status correctly.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14169 6f19259b-4bc3-4df7-8a09-765794883524