]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
8 years agoUefiCpuPkg/CpuMpPei: Sync BSP's CRx to APs when initialization
Jeff Fan [Wed, 2 Dec 2015 00:43:19 +0000 (00:43 +0000)]
UefiCpuPkg/CpuMpPei: Sync BSP's CRx to APs when initialization

Save BSP's volatile register and sync CRx register to APs when AP 1st wake up.

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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19088 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/CpuMpPei: Set AP state to CpuStateIdle after initialization
Jeff Fan [Wed, 2 Dec 2015 00:42:59 +0000 (00:42 +0000)]
UefiCpuPkg/CpuMpPei: Set AP state to CpuStateIdle after initialization

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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19087 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/CpuMpPei: Add CPU_VOLATILE_REGISTERS & worker functions
Jeff Fan [Wed, 2 Dec 2015 00:42:40 +0000 (00:42 +0000)]
UefiCpuPkg/CpuMpPei: Add CPU_VOLATILE_REGISTERS & worker functions

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

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

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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19086 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/CpuMpPei: Exchange whole CPU data in SortApicId()
Jeff Fan [Wed, 2 Dec 2015 00:42:09 +0000 (00:42 +0000)]
UefiCpuPkg/CpuMpPei: Exchange whole CPU data in SortApicId()

Current implementation only exchanges the APIC ID and BIST, this updating is to
exchange all CPU data.

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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19085 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg: Convert whole-cache InvalidateInstructionCache to just ASSERT
Eugene Cohen [Tue, 1 Dec 2015 18:39:29 +0000 (18:39 +0000)]
ArmPkg: Convert whole-cache InvalidateInstructionCache to just ASSERT

In SVN 18756 ("disallow whole D-cache maintenance operations")
InvalidateInstructionCache was modified to remove the full data cache
clean but left the full instruction cache invalidate. The change was
made to address issues in the set/way clean methodology but the
resulting code could lead someone to a painful debug. If a component
called this function, the proper code would not be flushed to the PoU,
since the intent of this function is not only to invalidate the I-cache
but to provide coherency after code loading / modification. This change
simply places an ASSERT(FALSE) in this function to avoid this hazard.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19084 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg/BootLogoLib: Fix INF comments to follow coding standards
Ruiyu Ni [Tue, 1 Dec 2015 06:56:36 +0000 (06:56 +0000)]
MdeModulePkg/BootLogoLib: Fix INF comments to follow coding standards

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19083 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg/BmpImageDecoderLib: Fix function header comments
Ruiyu Ni [Tue, 1 Dec 2015 06:52:44 +0000 (06:52 +0000)]
MdeModulePkg/BmpImageDecoderLib: Fix function header comments

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19082 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBaseTools: Clean some coding style issues
Yonghong Zhu [Tue, 1 Dec 2015 04:22:16 +0000 (04:22 +0000)]
BaseTools: Clean some coding style issues

This patch clean some coding style issues, majorly for space character.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19080 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg/NvmExpressDxe: Fix wrong logic in GetControllerName()
Anbazhagan, Baraneedharan [Tue, 1 Dec 2015 00:40:37 +0000 (00:40 +0000)]
MdeModulePkg/NvmExpressDxe: Fix wrong logic in GetControllerName()

NvmExpressComponentNameGetControllerName returns EFI_UNSUPPORTED if
child handle is passed. gEfiNvmExpressPassThruProtocolGuid needs to
be passed to EfiTestChildHandle instead of gEfiPciIoProtocolGuid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Anbazhagan, Baraneedharan" <anbazhagan@hp.com>
Reviewed-by: "Tian, Feng" <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19071 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: replace README fine print about X64 SMM S3 with PlatformPei check
Laszlo Ersek [Mon, 30 Nov 2015 23:36:31 +0000 (23:36 +0000)]
OvmfPkg: replace README fine print about X64 SMM S3 with PlatformPei check

At the moment, the "UefiCpuPkg/Universal/Acpi/S3Resume2Pei" module doesn't
support S3 resume if the platform has SMM enabled and the PEI phase is
built for X64. We document this in the README, but it is not conspicuous
enough.

Replace the "fine print" in the README with a runtime check in
PlatformPei.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
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://svn.code.sf.net/p/edk2/code/trunk/edk2@19070 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoCorebootPayloadPkg PlatformHookLib: Fix GCC build failure
Star Zeng [Mon, 30 Nov 2015 21:11:29 +0000 (21:11 +0000)]
CorebootPayloadPkg PlatformHookLib: Fix GCC build failure

Add return status check to fix GCC build failure below.

error: right-hand operand of comma expression has no effect
[-Werror=unused-value]
((_gPcd_BinaryPatch_PcdSerialUseMmio = (Value)), RETURN_SUCCESS)

error: right-hand operand of comma expression has no effect
[-Werror=unused-value]
((_gPcd_BinaryPatch_PcdSerialRegisterBase = (Value)), RETURN_SUCCESS)

http://article.gmane.org/gmane.comp.bios.edk2.devel/4949

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19069 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/PiSmmCpu: Always set WP in CR0
Yao, Jiewen [Mon, 30 Nov 2015 19:57:45 +0000 (19:57 +0000)]
UefiCpuPkg/PiSmmCpu: Always set WP in CR0

So that we can use write-protection for code later.

It is REPOST.
It includes suggestion from Michael Kinney <michael.d.kinney@intel.com>:
- "For IA32 assembly, can we combine into a single OR instruction that
  sets both page enable and WP?"
- "For X64, does it make sense to use single OR instruction instead of 2
  BTS instructions as well?"

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Suggested-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19068 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/PiSmmCpu: Always set RW+P bit for page table by default
Yao, Jiewen [Mon, 30 Nov 2015 19:57:40 +0000 (19:57 +0000)]
UefiCpuPkg/PiSmmCpu: Always set RW+P bit for page table by default

So that we can use write-protection for code later.

This is REPOST.
It includes the bug fix from "Paolo Bonzini" <pbonzini@redhat.com>:

  Title: fix generation of 32-bit PAE page tables

  "Bits 1 and 2 are reserved in 32-bit PAE Page Directory Pointer Table
  Entries (PDPTEs); see Table 4-8 in the SDM.  With VMX extended page
  tables, the processor notices and fails the VM entry as soon as CR0.PG
  is set to 1."

And thanks "Laszlo Ersek" <lersek@redhat.com> to validate the fix.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Signed-off-by: "Paolo Bonzini" <pbonzini@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19067 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: README: document SMM status
Laszlo Ersek [Mon, 30 Nov 2015 18:49:07 +0000 (18:49 +0000)]
OvmfPkg: README: document SMM status

Cc: Paolo Bonzini <pbonzini@redhat.com>
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://svn.code.sf.net/p/edk2/code/trunk/edk2@19066 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: pull in SMM-based variable driver stack
Laszlo Ersek [Mon, 30 Nov 2015 18:49:03 +0000 (18:49 +0000)]
OvmfPkg: pull in SMM-based variable driver stack

When -D SMM_REQUIRE is given, replace both
- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf and
- OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
with
- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf.

The outermost (= runtime DXE driver) VariableSmmRuntimeDxe enters SMM, and
the rest:
- the privileged half of the variable driver, VariableSmm,
- the fault tolerant write driver, FaultTolerantWriteSmm,
- and the FVB driver, FvbServicesSmm,
work in SMM purely.

We also resolve the BaseCryptLib class for DXE_SMM_DRIVER modules, for the
authenticated VariableSmm driver's sake.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19065 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: consolidate variable driver stack in DSC and FDF files
Laszlo Ersek [Mon, 30 Nov 2015 18:48:59 +0000 (18:48 +0000)]
OvmfPkg: consolidate variable driver stack in DSC and FDF files

The following modules constitute the variable driver stack:

- QemuFlashFvbServicesRuntimeDxe and EmuVariableFvbRuntimeDxe, runtime
  alternatives for providing the Firmware Volume Block(2) Protocol,
  dependent on qemu pflash presence,

- FaultTolerantWriteDxe, providing the Fault Tolerant Write Protocol,

- MdeModulePkg/Universal/Variable/RuntimeDxe, independently of
  -D SECURE_BOOT_ENABLE, providing the Variable and Variable Write
  Architectural Protocols.

Let's move these drivers closer to each other in the DSC and FDF files, so
that we can switch the variable driver stack to SMM with more local
changes.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19064 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: QemuFlashFvbServicesRuntimeDxe: adhere to -D SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:48:54 +0000 (18:48 +0000)]
OvmfPkg: QemuFlashFvbServicesRuntimeDxe: adhere to -D SMM_REQUIRE

When the user requires "security" by passing -D SMM_REQUIRE, and
consequently by setting PcdSmmSmramRequire, enforce flash-based variables.

Furthermore, add two ASSERT()s to catch if the wrong module were pulled
into the build.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19063 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: QemuFlashFvbServicesRuntimeDxe: add DXE_SMM_DRIVER build
Laszlo Ersek [Mon, 30 Nov 2015 18:48:50 +0000 (18:48 +0000)]
OvmfPkg: QemuFlashFvbServicesRuntimeDxe: add DXE_SMM_DRIVER build

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19062 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: build PiSmmCpuDxeSmm for -D SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:48:46 +0000 (18:48 +0000)]
OvmfPkg: build PiSmmCpuDxeSmm for -D SMM_REQUIRE

At this point we can enable building PiSmmCpuDxeSmm.

CPU specific features, like SMRR detection, and functions that are used to
initialize SMM and process SMIs, are abstracted through the
SmmCpuFeaturesLib class for the PiSmmCpuDxeSmm module. Resolve it to our
own implementation under OvmfPkg -- it allows PiSmmCpuDxeSmm to work with
QEMU's and KVM's 64-bit state save map format, which follows the
definition from AMD's programmer manual.

SmmCpuPlatformHookLib provides platform specific functions that are used
to initialize SMM and process SMIs. Resolve it to the one Null instance
provided by UefiCpuPkg, which is expected to work for most platforms.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[pbonzini@redhat.com: resolve the SmmCpuFeaturesLib class to OVMF's own
 instance]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19061 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: build CpuS3DataDxe for -D SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:46:55 +0000 (18:46 +0000)]
OvmfPkg: build CpuS3DataDxe for -D SMM_REQUIRE

The PiSmmCpuDxeSmm driver from UefiCpuPkg depends on the ACPI_CPU_DATA
structure -- created by a platform- and CPU-specific driver -- in order to
support ACPI S3. The address of this structure is communicated through the
dynamic PCD PcdCpuS3DataAddress.

The "UefiCpuPkg/Include/AcpiCpuData.h" header file documents the fields of
this structure in detail.

The simple/generic "UefiCpuPkg/CpuS3DataDxe" driver creates and populates
the structure in a conformant way, and it co-operates well with
PiSmmCpuDxeSmm, for OVMF's purposes.

         PlatformBdsLib  CpuS3DataDxe     PiSmmCpuDxeSmm    S3Resume2Pei
         (DXE_DRIVER)    (DXE_DRIVER)     (DXE_SMM_DRIVER)  (PEIM)
         --------------  ---------------  ----------------  --------------
normal                   collects data
boot                     except MTRR
                         settings into
                         ACPI_CPU_DATA

                         sets
                         PcdCpuS3Da...

         signals
         End-of-Dxe
            |
            +----------> collects MTRR
                         settings into
                         ACPI_CPU_DATA

         installs
         [Dxe]Smm
         ReadyToLock
            |
            +---------------------------> fetches
                                          PcdCpuS3Dat...

                                          copies
                                          ACPI_CPU_DATA
                                          into SMRAM

runtime

S3
suspend

S3                                                          transfers
resume                                                      control to
                                                            PiSmmCpuDxe...
                                                                |
                                          uses             <----+
                                          ACPI_CPU_DATA
                                          from SMRAM

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19060 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: any AP in SMM should not wait for the BSP for more than 100 ms
Laszlo Ersek [Mon, 30 Nov 2015 18:46:50 +0000 (18:46 +0000)]
OvmfPkg: any AP in SMM should not wait for the BSP for more than 100 ms

This patch complements the previous one, "OvmfPkg: use relaxed AP SMM
synchronization mode". While that patch focuses on the case when the SMI
is raised synchronously by the BSP, on the BSP:

  BSPHandler()             [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
    SmmWaitForApArrival()  [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
      IsSyncTimerTimeout() [UefiCpuPkg/PiSmmCpuDxeSmm/SyncTimer.c]

this patch concerns itself with the case when it is one of the APs that
raises (and sees delivered) the synchronous SMI:

  APHandler()            [UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c]
    IsSyncTimerTimeout() [UefiCpuPkg/PiSmmCpuDxeSmm/SyncTimer.c]

Namely, in APHandler() the AP waits for the BSP to enter SMM regardless of
PcdCpuSmmSyncMode, for PcdCpuSmmApSyncTimeout microseconds (the default
value is 1 second). If the BSP doesn't show up in SMM within that
interval, then the AP brings it in with a directed SMI, and waits for the
BSP again for PcdCpuSmmApSyncTimeout microseconds.

Although during boot services, SmmControl2DxeTrigger() is only called by
the BSP, at runtime the OS can invoke runtime services from an AP (it can
even be forced with "taskset -c 1 efibootmgr"). Because on QEMU
SmmControl2DxeTrigger() only raises the SMI for the calling processor (BSP
and AP alike), the first interval above times out invariably in such cases
-- the BSP never shows up before the AP calls it in.

In order to mitigate the performance penalty, decrease
PcdCpuSmmApSyncTimeout to one tenth of its default value: 100 ms. (For
comparison, Vlv2TbltDevicePkg sets 1 ms.)

NOTE: once QEMU becomes capable of synchronous broadcast SMIs, this patch
and the previous one ("OvmfPkg: use relaxed AP SMM synchronization mode")
should be reverted, and SmmControl2DxeTrigger() should be adjusted
instead.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19059 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: use relaxed AP SMM synchronization mode
Paolo Bonzini [Mon, 30 Nov 2015 18:46:46 +0000 (18:46 +0000)]
OvmfPkg: use relaxed AP SMM synchronization mode

Port 0xb2 on QEMU only sends an SMI to the currently executing processor.
The SMI handler, however, and in particular SmmWaitForApArrival, currently
expects that SmmControl2DxeTrigger triggers an SMI IPI on all processors
rather than just the BSP.  Thus all SMM invocations loop for a second (the
default value of PcdCpuSmmApSyncTimeout) before SmmWaitForApArrival sends
another SMI IPI to the APs.

With the default SmmCpuFeaturesLib, 32-bit machines must broadcast SMIs
because 32-bit machines must reset the MTRRs on each entry to system
management modes (they have no SMRRs).  However, our virtual platform
does not have problems with cacheability of SMRAM, so we can use "directed"
SMIs instead.  To do this, just set gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode
to 1 (aka SmmCpuSyncModeRelaxedAp).  This fixes SMM on multiprocessor virtual
machines.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19058 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: SmmCpuFeaturesLib: customize state save map format
Paolo Bonzini [Mon, 30 Nov 2015 18:46:42 +0000 (18:46 +0000)]
OvmfPkg: SmmCpuFeaturesLib: customize state save map format

This adjusts the previously introduced state save map access functions, to
account for QEMU and KVM's 64-bit state save map following the AMD spec
rather than the Intel one.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[lersek@redhat.com: reflow commit message, convert patch to CRLF]

Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19057 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: SmmCpuFeaturesLib: implement SMRAM state save map access
Paolo Bonzini [Mon, 30 Nov 2015 18:46:37 +0000 (18:46 +0000)]
OvmfPkg: SmmCpuFeaturesLib: implement SMRAM state save map access

This implementation copies SMRAM state save map access from the
PiSmmCpuDxeSmm module.

The most notable change is:

- dropping support for EFI_SMM_SAVE_STATE_REGISTER_IO

- changing the implementation of EFI_SMM_SAVE_STATE_REGISTER_LMA to use
  the SMM revision id instead of a local variable (which
  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c initializes from CPUID's LM
  bit).  This accounts for QEMU's implementation of x86_64, which always
  uses revision 0x20064 even if the LM bit is zero.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[lersek@redhat.com: reflow commit message & fix typo, convert patch to
 CRLF]

Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19056 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: SmmCpuFeaturesLib: remove unnecessary bits
Paolo Bonzini [Mon, 30 Nov 2015 18:46:32 +0000 (18:46 +0000)]
OvmfPkg: SmmCpuFeaturesLib: remove unnecessary bits

SMRR, MTRR, and SMM Feature Control support is not needed on a virtual
platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: insert space between ASSERT and (), convert to CRLF,
 refresh against SVN r18958]

Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19055 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: import SmmCpuFeaturesLib from UefiCpuPkg
Paolo Bonzini [Mon, 30 Nov 2015 18:46:27 +0000 (18:46 +0000)]
OvmfPkg: import SmmCpuFeaturesLib from UefiCpuPkg

The next patches will customize the implementation, but let's start from
the common version to better show the changes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[lersek@redhat.com: drop UNI file, keep whitespace intact, generate new
 FILE_GUID, split off DSC changes, reflow commit message, refresh against
 SVN r18958]

Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19054 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: set gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection to FALSE
Laszlo Ersek [Mon, 30 Nov 2015 18:42:35 +0000 (18:42 +0000)]
OvmfPkg: set gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection to FALSE

Explanation from Michael Kinney:

  This PCD allows a platform to provide PlatformSmmBspElection() in a
  platform specific SmmCpuPlatformHookLib instance to decide which CPU
  gets elected to be the BSP in each SMI.

  The SmmCpuPlatformHookLibNull [instance] always returns EFI_NOT_READY
  for that function, which makes the module behave the same as the PCD
  being set to FALSE.

  The default is TRUE, so the platform lib is always called, so a platform
  developer can implement the hook function and does not have to also
  change a PCD setting for the hook function to be active.

  A platform that wants to eliminate the call to the hook function
  [altogether] can set the PCD to FALSE.

  So for OVMF, I think it makes sense to set this PCD to FALSE in the DSC
  file.

Suggested-by: Michael Kinney <michael.d.kinney@intel.com>
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://svn.code.sf.net/p/edk2/code/trunk/edk2@19053 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: select LocalApicLib instance with x2apic support
Laszlo Ersek [Mon, 30 Nov 2015 18:42:31 +0000 (18:42 +0000)]
OvmfPkg: select LocalApicLib instance with x2apic support

Although neither LocalApicLib instance is suitable for runtime DXE drivers
(because they access the APIC at the physical address retrieved from
either MSR_IA32_APIC_BASE_ADDRESS or PcdCpuLocalApicBaseAddress), they are
suitable for SMM drivers -- SMM drivers are not influenced by the runtime
OS's virtual address map.

PiSmmCpuDxeSmm links against LocalApicLib. 64-bit Linux guests tend to
enable x2apic mode even in simple VCPU configurations (e.g., 4 sockets, 1
core/socket, 1 thread/core):

  [    0.028173] x2apic enabled

If PiSmmCpuDxeSmm was linked with the BaseXApicLib instance (i.e., with no
x2apic support), then the next runtime service call that is backed by an
SMM driver triggers the following ASSERT in BaseXApicLib (because the
latter notices that x2apic has been enabled, which it doesn't support):

  ASSERT .../UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c(263):
  ApicBaseMsr.Bits.Extd == 0

It is reasonable to give all LocalApicLib client modules in OVMF the same
level of x2apic support, hence resolve LocalApicLib globally to
BaseXApicX2ApicLib. This will not be conditional on -D SMM_REQUIRE,
because BaseXApicX2ApicLib is compatible with BaseXApicLib in any
environment where the latter can be used.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19052 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: resolve DebugAgentLib for DXE_SMM_DRIVER modules
Michael Kinney [Mon, 30 Nov 2015 18:42:27 +0000 (18:42 +0000)]
OvmfPkg: resolve DebugAgentLib for DXE_SMM_DRIVER modules

Add mappings to DebugAgentLib for SMM modules to prevent build breaks when
SMM_REQUIRE and SOURCE_DEBUG_ENABLE are both set.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
[lersek@redhat.com: cover the X64 dsc, update commit msg, kudos Jordan]
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
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://svn.code.sf.net/p/edk2/code/trunk/edk2@19051 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: resolve CpuExceptionHandlerLib for DXE_SMM_DRIVER modules
Laszlo Ersek [Mon, 30 Nov 2015 18:42:23 +0000 (18:42 +0000)]
OvmfPkg: resolve CpuExceptionHandlerLib for DXE_SMM_DRIVER modules

UefiCpuPkg/PiSmmCpuDxeSmm depends on this library (the
RegisterCpuInterruptHandler() function specifically) to set up its
specialized page fault handler (SmiPFHandler() -> DumpModuleInfoByIp()).
It doesn't hurt to resolve this library class for all DXE_SMM_DRIVER
modules.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19050 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: resolve ReportStatusCodeLib for DXE_SMM_DRIVER modules
Laszlo Ersek [Mon, 30 Nov 2015 18:42:19 +0000 (18:42 +0000)]
OvmfPkg: resolve ReportStatusCodeLib for DXE_SMM_DRIVER modules

PiSmmCpuDxeSmm depends on this library class, and it's okay to resolve it
generally for all DXE_SMM_DRIVER modules.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19049 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: LockBox: use SMM stack with -D SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:42:15 +0000 (18:42 +0000)]
OvmfPkg: LockBox: use SMM stack with -D SMM_REQUIRE

During DXE, drivers save data in the LockBox. A save operation is layered
as follows:

- The unprivileged driver wishing to store data in the LockBox links
  against the "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf"
  library instance.

  The library allows the unprivileged driver to format requests for the
  privileged SMM LockBox driver (see below), and to parse responses.

  We apply this resolution for DXE_DRIVER modules.

- The privileged SMM LockBox driver is built from
  "MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf". This driver
  has module type DXE_SMM_DRIVER and can access SMRAM.

  The driver delegates command parsing and response formatting to
  "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf".

  Therefore we include this DXE_SMM_DRIVER in the build, and apply said
  resolution specifically to it.

  (Including the driver requires us to resolve a few of other library
  classes for DXE_SMM_DRIVER modules.)

- In PEI, the S3 Resume PEIM (UefiCpuPkg/Universal/Acpi/S3Resume2Pei)
  retrieves data from the LockBox. It is capable of searching SMRAM
  itself.

  We resolve LockBoxLib to
  "MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" specifically
  for this one PEIM.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19048 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: PlatformPei: don't allocate fake lockbox if SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:42:10 +0000 (18:42 +0000)]
OvmfPkg: PlatformPei: don't allocate fake lockbox if SMM_REQUIRE

Since our fake LockBox must not be selected with -D SMM_REQUIRE (see the
previous patch), it makes sense to set aside memory for it only if -D
SMM_REQUIRE is absent. Modify InitializeRamRegions() accordingly.

This patch completes the -D SMM_REQUIRE-related tweaking of the special
OVMF memory areas.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19047 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: LockBoxLib: -D SMM_REQUIRE excludes our fake lockbox
Laszlo Ersek [Mon, 30 Nov 2015 18:42:05 +0000 (18:42 +0000)]
OvmfPkg: LockBoxLib: -D SMM_REQUIRE excludes our fake lockbox

When the user builds OVMF with -D SMM_REQUIRE, our LockBox implementation
must not be used, since it doesn't actually protect data in the LockBox
from the runtime guest OS. Add an according assert to
LockBoxLibInitialize().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19046 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: AcpiS3SaveDxe: don't fake LockBox protocol if SMM_REQUIRE
Laszlo Ersek [Mon, 30 Nov 2015 18:42:01 +0000 (18:42 +0000)]
OvmfPkg: AcpiS3SaveDxe: don't fake LockBox protocol if SMM_REQUIRE

In SVN r15306 (git commit d4ba06df), "OvmfPkg: S3 Resume: fake LockBox
protocol for BootScriptExecutorDxe", we installed a fake LockBox protocol
in OVMF's AcpiS3SaveDxe clone. While our other AcpiS3SaveDxe
customizations remain valid (or harmless), said change is invalid when
OVMF is built with -D SMM_REQUIRE and includes the real protocol provider,
"MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19045 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: pull in CpuIo2Smm driver
Laszlo Ersek [Mon, 30 Nov 2015 18:41:56 +0000 (18:41 +0000)]
OvmfPkg: pull in CpuIo2Smm driver

This driver provides EFI_SMM_CPU_IO2_PROTOCOL, which the SMM core depends
on in its gEfiDxeSmmReadyToLockProtocolGuid callback
(SmmReadyToLockHandler(), "MdeModulePkg/Core/PiSmmCore/PiSmmCore.c").

Approached on a higher level, this driver provides the SmmIo member of the
EFI_SMM_SYSTEM_TABLE2 (SMST).

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19044 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: pull in the SMM IPL and SMM core
Laszlo Ersek [Mon, 30 Nov 2015 18:41:52 +0000 (18:41 +0000)]
OvmfPkg: pull in the SMM IPL and SMM core

"MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf" (a DXE_RUNTIME_DRIVER)
implements the SMM Initial Program Loader. It produces
EFI_SMM_BASE2_PROTOCOL and EFI_SMM_COMMUNICATION_PROTOCOL, relying on:
- EFI_SMM_ACCESS2_PROTOCOL
  (provided by OvmfPkg/SmmAccess/SmmAccess2Dxe.inf),
- EFI_SMM_CONTROL2_PROTOCOL
  (provided by OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf).

(The SMM IPL also depends on EFI_SMM_CONFIGURATION_PROTOCOL_GUID, but this
dependency is not enforced in the entry point. A protocol notify callback
is registered instead, hence we can delay providing that protocol via the
PiSmmCpuDxeSmm driver that is (to be) imported from UefiCpuPkg/.)

The SMM IPL loads the SMM core into SMRAM and executes it from there.
Therefore we add the SMM core to the build as well.

For the SMM core, a number of library classes need to be resolved.
Furthermore, each FDF file must provide the GenFds.py BaseTools utility
with a build rule for SMM_CORE; we copy the DXE_CORE's rule.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19043 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: implement EFI_SMM_CONTROL2_PROTOCOL with a DXE_RUNTIME_DRIVER
Laszlo Ersek [Mon, 30 Nov 2015 18:41:48 +0000 (18:41 +0000)]
OvmfPkg: implement EFI_SMM_CONTROL2_PROTOCOL with a DXE_RUNTIME_DRIVER

The EFI_SMM_COMMUNICATION_PROTOCOL implementation that is provided by the
SMM core depends on EFI_SMM_CONTROL2_PROTOCOL; see the
mSmmControl2->Trigger() call in the SmmCommunicationCommunicate() function
[MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c].

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19042 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: add DXE_DRIVER for providing TSEG-as-SMRAM during boot-time DXE
Laszlo Ersek [Mon, 30 Nov 2015 18:41:43 +0000 (18:41 +0000)]
OvmfPkg: add DXE_DRIVER for providing TSEG-as-SMRAM during boot-time DXE

The SMM core depends on EFI_SMM_ACCESS2_PROTOCOL. This small driver (which
is a thin wrapper around "OvmfPkg/SmmAccess/SmramInternal.c" that was
added in the previous patch) provides that protocol.

Notably, EFI_SMM_ACCESS2_PROTOCOL is for boot time only, therefore
our MODULE_TYPE is not DXE_RUNTIME_DRIVER.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19041 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: add PEIM for providing TSEG-as-SMRAM during PEI
Laszlo Ersek [Mon, 30 Nov 2015 18:41:38 +0000 (18:41 +0000)]
OvmfPkg: add PEIM for providing TSEG-as-SMRAM during PEI

"MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" is the
LockBoxLib instance with SMRAM access for the PEI phase.

Said library instance must, and can, access the LockBox data in SMRAM
directly if it is invoked before SMBASE relocation / SMI handler
installation. In that case, it only needs PEI_SMM_ACCESS_PPI from the
platform, and it doesn't depend on EFI_PEI_SMM_COMMUNICATION_PPI.

OVMF satisfies the description in SVN r18823 ("MdeModulePkg:
SmmLockBoxPeiLib: work without EFI_PEI_SMM_COMMUNICATION_PPI"): in OVMF,
only S3Resume2Pei links against SmmLockBoxPeiLib.

Therefore, introduce a PEIM that produces the PEI_SMM_ACCESS_PPI
interface, enabling SmmLockBoxPeiLib to work; we can omit including
"UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf".

The load / installation order of S3Resume2Pei and SmmAccessPei is
indifferent. SmmAccessPei produces the gEfiAcpiVariableGuid HOB during its
installation (which happens during PEI), but S3Resume2Pei accesses the HOB
only when the DXE IPL calls its S3RestoreConfig2 PPI member, as last act
of PEI.

MCH_SMRAM_D_LCK and MCH_ESMRAMC_T_EN are masked out the way they are, in
SmmAccessPeiEntryPoint() and SmramAccessOpen() respectively, in order to
prevent VS20xx from warning about the (otherwise fully intentional)
truncation in the UINT8 casts. (Warnings reported by Michael Kinney.)

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19040 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: PlatformPei: account for TSEG size with PcdSmmSmramRequire set
Laszlo Ersek [Mon, 30 Nov 2015 18:41:33 +0000 (18:41 +0000)]
OvmfPkg: PlatformPei: account for TSEG size with PcdSmmSmramRequire set

PlatformPei calls GetSystemMemorySizeBelow4gb() in three locations:

- PublishPeiMemory(): on normal boot, the permanent PEI RAM is installed
  so that it ends with the RAM below 4GB,

- QemuInitializeRam(): on normal boot, memory resource descriptor HOBs are
  created for the RAM below 4GB; plus MTRR attributes are set
  (independently of S3 vs. normal boot)

- MemMapInitialization(): an MMIO resource descriptor HOB is created for
  PCI resource allocation, on normal boot, starting at max(RAM below 4GB,
  2GB).

The first two of these is adjusted for the configured TSEG size, if
PcdSmmSmramRequire is set:

- In PublishPeiMemory(), the permanent PEI RAM is kept under TSEG.

- In QemuInitializeRam(), we must keep the DXE out of TSEG.

  One idea would be to simply trim the [1MB .. LowerMemorySize] memory
  resource descriptor HOB, leaving a hole for TSEG in the memory space
  map.

  The SMM IPL will however want to massage the caching attributes of the
  SMRAM range that it loads the SMM core into, with
  gDS->SetMemorySpaceAttributes(), and that won't work on a hole. So,
  instead of trimming this range, split the TSEG area off, and report it
  as a cacheable reserved memory resource.

  Finally, since reserved memory can be allocated too, pre-allocate TSEG
  in InitializeRamRegions(), after QemuInitializeRam() returns. (Note that
  this step alone does not suffice without the resource descriptor HOB
  trickery: if we omit that, then the DXE IPL PEIM fails to load and start
  the DXE core.)

- In MemMapInitialization(), the start of the PCI MMIO range is not
  affected.

We choose the largest option (8MB) for the default TSEG size. Michael
Kinney pointed out that the SMBASE relocation in PiSmmCpuDxeSmm consumes
SMRAM proportionally to the number of CPUs. From the three options
available, he reported that 8MB was both necessary and sufficient for the
SMBASE relocation to succeed with 255 CPUs:

- http://thread.gmane.org/gmane.comp.bios.edk2.devel/3020/focus=3137
- http://thread.gmane.org/gmane.comp.bios.edk2.devel/3020/focus=3177

Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19039 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: PlatformPei: allow caching in AddReservedMemoryBaseSizeHob()
Laszlo Ersek [Mon, 30 Nov 2015 18:41:29 +0000 (18:41 +0000)]
OvmfPkg: PlatformPei: allow caching in AddReservedMemoryBaseSizeHob()

AddReservedMemoryBaseSizeHob() should be able to set the same resource
attributes for reserved memory as AddMemoryBaseSizeHob() sets for system
memory. Add a new parameter called "Cacheable" to
AddReservedMemoryBaseSizeHob(), and set it to FALSE in the only caller we
have at the moment.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19038 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: decompress FVs on S3 resume if SMM_REQUIRE is set
Laszlo Ersek [Mon, 30 Nov 2015 18:41:24 +0000 (18:41 +0000)]
OvmfPkg: decompress FVs on S3 resume if SMM_REQUIRE is set

If OVMF was built with -D SMM_REQUIRE, that implies that the runtime OS is
not trusted and we should defend against it tampering with the firmware's
data.

One such datum is the PEI firmware volume (PEIFV). Normally PEIFV is
decompressed on the first boot by SEC, then the OS preserves it across S3
suspend-resume cycles; at S3 resume SEC just reuses the originally
decompressed PEIFV.

However, if we don't trust the OS, then SEC must decompress PEIFV from the
pristine flash every time, lest we execute OS-injected code or work with
OS-injected data.

Due to how FVMAIN_COMPACT is organized, we can't decompress just PEIFV;
the decompression brings DXEFV with itself, plus it uses a temporary
output buffer and a scratch buffer too, which even reach above the end of
the finally installed DXEFV. For this reason we must keep away a
non-malicious OS from DXEFV too, plus the memory up to
PcdOvmfDecomprScratchEnd.

The delay introduced by the LZMA decompression on S3 resume is negligible.

If -D SMM_REQUIRE is not specified, then PcdSmmSmramRequire remains FALSE
(from the DEC file), and then this patch has no effect (not counting some
changed debug messages).

If QEMU doesn't support S3 (or the user disabled it on the QEMU command
line), then this patch has no effect also.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19037 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: Sec: assert the build-time calculated end of the scratch buffer
Laszlo Ersek [Mon, 30 Nov 2015 18:41:20 +0000 (18:41 +0000)]
OvmfPkg: Sec: assert the build-time calculated end of the scratch buffer

The DecompressMemFvs() function in "OvmfPkg/Sec/SecMain.c" uses more
memory, temporarily, than what PEIFV and DXEFV will ultimately need.
First, it uses an output buffer for decompression, second, the
decompression itself needs a scratch buffer (and this scratch buffer is
the highest area that SEC uses).

DecompressMemFvs() used to be called on normal boots only (ie. not on S3
resume), which is why the decompression output buffer and the scratch
buffer were allowed to scribble over RAM. However, we'll soon start to
worry during S3 resume that the runtime OS might tamper with the
pre-decompressed PEIFV, and we'll decompress the firmware volumes on S3
resume too, from pristine flash. For this we'll need to know the end of
the scratch buffer in advance, so we can prepare a non-malicious OS for
it.

Calculate the end of the scratch buffer statically in the FDF files, and
assert in DecompressMemFvs() that the runtime decompression will match it.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19036 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: Sec: force reinit of BaseExtractGuidedSectionLib handler table
Laszlo Ersek [Mon, 30 Nov 2015 18:41:14 +0000 (18:41 +0000)]
OvmfPkg: Sec: force reinit of BaseExtractGuidedSectionLib handler table

BaseExtractGuidedSectionLib uses a table at the static physical address
PcdGuidedExtractHandlerTableAddress, and modules that are linked against
BaseExtractGuidedSectionLib are expected to work together on that table.
Namely, some modules can register handlers for GUIDed sections, some other
modules can decode such sections with the pre-registered handlers. The
table carries persistent information between these modules.

BaseExtractGuidedSectionLib checks a table signature whenever it is used
(by whichever module that is linked against it), and at the first use
(identified by a signature mismatch) it initializes the table.

One of the module types that BaseExtractGuidedSectionLib can be used with
is SEC, if the SEC module in question runs with the platform's RAM already
available.

In such cases the question emerges whether the initial contents of the RAM
(ie. contents that predate the very first signature check) can be trusted.
Normally RAM starts out with all zeroes (leading to a signature mismatch
on the first check); however a malicious runtime OS can populate the area
with some payload, then force a warm platform reset or an S3
suspend-and-resume. In such cases the signature check in the SEC module
might not fire, and ExtractGuidedSectionDecode() might run code injected
by the runtime OS, as part of SEC (ie. with high privileges).

Therefore we clear the handler table in SEC.

See also git commit ad43bc6b2e (SVN rev 15433) -- this patch secures the
(d) and (e) code paths examined in that commit. Furthermore, a
non-malicious runtime OS will observe no change in behavior; see case (c)
in said commit.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[michael.d.kinney@intel.com: prevent VS20xx loop intrinsic with volatile]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19035 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg: introduce -D SMM_REQUIRE and PcdSmmSmramRequire
Laszlo Ersek [Mon, 30 Nov 2015 18:41:10 +0000 (18:41 +0000)]
OvmfPkg: introduce -D SMM_REQUIRE and PcdSmmSmramRequire

This build time flag and corresponding Feature PCD will control whether
OVMF supports (and, equivalently, requires) SMM/SMRAM support from QEMU.

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://svn.code.sf.net/p/edk2/code/trunk/edk2@19034 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoCryptoPkg/OpensslLib: add softfloat dependency for ARM
Ard Biesheuvel [Mon, 30 Nov 2015 08:57:26 +0000 (08:57 +0000)]
CryptoPkg/OpensslLib: add softfloat dependency for ARM

UEFI on 32-bit ARM does not allow the use of hardware floating point,
so in order to be able to run OpenSslLib, we need to fulfil its
floating point arithmetic dependencies using a software library.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Qin Long <qin.long@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19033 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmVirtPkg: add secure boot support to 32-bit ARM targets
Ard Biesheuvel [Mon, 30 Nov 2015 08:57:12 +0000 (08:57 +0000)]
ArmVirtPkg: add secure boot support to 32-bit ARM targets

Building the 32-bit ARM targets with secure boot enabled requires
a library resolution for the ArmSoftfloatLib dependency of
OpenSslLib. So provide one.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19032 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg/ArmSoftFloatLib: add support for RVCT
Ard Biesheuvel [Mon, 30 Nov 2015 08:57:03 +0000 (08:57 +0000)]
ArmPkg/ArmSoftFloatLib: add support for RVCT

The ARM softfloat library in ArmSoftfloatLib currently does not build
under RVCT, simply because the code includes system header files that
RVCT does not provide. However, nothing exported by those include files
is actually used by the library when built in SOFTFLOAT_FOR_GCC mode,
so we can just drop all of them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19031 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg: factor out softfloat support from StdLib/LibC/SoftFloat
Ard Biesheuvel [Mon, 30 Nov 2015 08:56:52 +0000 (08:56 +0000)]
ArmPkg: factor out softfloat support from StdLib/LibC/SoftFloat

In order to support software floating point in the context of
DXE drivers etc, this factors out the core ARM softfloat support
into a separate library.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19030 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg:Replace unsafe string function with safe one.
Dandan Bi [Mon, 30 Nov 2015 07:26:07 +0000 (07:26 +0000)]
MdeModulePkg:Replace unsafe string function with safe one.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19029 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBaseTools/toolsetup.bat: fixed the error when the path contains space
Yonghong Zhu [Mon, 30 Nov 2015 03:43:25 +0000 (03:43 +0000)]
BaseTools/toolsetup.bat: fixed the error when the path contains space

We have a new simple and effective method to resolve the original issue
that the PATH env's update error when the path contains space, so this
patch remove the last check in and use the new method to fix the original
issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19028 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBaseTools: Add build error detection for Dynamic PCD name conflict
Yonghong Zhu [Mon, 30 Nov 2015 03:40:37 +0000 (03:40 +0000)]
BaseTools: Add build error detection for Dynamic PCD name conflict

when multiple Dynamic PCD have different token space guid but same PCD
name, it is difficult for user to check why the generated autogen.c and
autogen.h are not consistent. so we add a check before generating
autogen.c and report error directly that user can know what happened
immediately.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19027 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBaseTools: Add a VPD report subsection of FLASH to the Report
Yonghong Zhu [Mon, 30 Nov 2015 03:36:50 +0000 (03:36 +0000)]
BaseTools: Add a VPD report subsection of FLASH to the Report

Build Spec already added a VPD report subsection of FLASH to the Report
chapter, it provide a simple way for user to determine where the VPD
region and VPD PCDs are located in the fd file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19026 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg/BDS: Do not pass unnecessary option to boot option
Ruiyu Ni [Mon, 30 Nov 2015 03:08:49 +0000 (03:08 +0000)]
MdeModulePkg/BDS: Do not pass unnecessary option to boot option

BDS puts a special GUID in boot option optional data for
auto-discovered boot option. But when launching that boot
option, the BDS core unconditionally pass the special GUID
to the executable.

A good written application/OS loader can ignore the unexpected
parameters, but BDS core should still avoid passing the
unnecessary GUID.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19007 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoNetworkPkg: Fix a bug in HttpBootDriverBindingStop() when destroying child.
Zhang Lubo [Mon, 30 Nov 2015 01:41:50 +0000 (01:41 +0000)]
NetworkPkg: Fix a bug in HttpBootDriverBindingStop() when destroying child.

If Http Driver is being unloaded or DisconnectController() without
invoke HttpBootStart(), this will cause an unexpected ASSERT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19005 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg: remove SetPrimaryStack and InitializePrimaryStack macros
Ard Biesheuvel [Fri, 27 Nov 2015 17:11:03 +0000 (17:11 +0000)]
ArmPkg: remove SetPrimaryStack and InitializePrimaryStack macros

The SetPrimaryStack and InitializePrimaryStack macros are no longer
used now that we removed support for ArmPlatformGlobalVariableLib.
So remove the various versions of them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19004 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: remove ArmGlobalVariable PCD, GUID and PPI definitions
Ard Biesheuvel [Fri, 27 Nov 2015 17:10:28 +0000 (17:10 +0000)]
ArmPlatformPkg: remove ArmGlobalVariable PCD, GUID and PPI definitions

Now that we removed all references to the ArmGlobalVariable definitions
in the various lowlevel PrePi and PrePeiCore init routines, and removed
the PPI and HOB references from PlatformPeim, it is time to say goodbye
to ArmGlobalVariable. So remove the includes and the .DEC declarations.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19003 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PlatformIntelBdsLib: drop bogus gArmGlobalVariableGuid dep
Ard Biesheuvel [Fri, 27 Nov 2015 17:09:17 +0000 (17:09 +0000)]
ArmPlatformPkg/PlatformIntelBdsLib: drop bogus gArmGlobalVariableGuid dep

PlatformIntelBdsLib does not use gArmGlobalVariableGuid so drop
the declaration from the .inf.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19002 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/EblCmdLib: drop bogus ArmGlobalVariableHob.h include
Ard Biesheuvel [Fri, 27 Nov 2015 17:09:06 +0000 (17:09 +0000)]
ArmPlatformPkg/EblCmdLib: drop bogus ArmGlobalVariableHob.h include

EblCmdLib does not use anything that is declared by ArmGlobalVariableHob.h,
so remove the include.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19001 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/ArmVExpressFastBootDxe: drop bogus gArmGlobalVariableGuid dep
Ard Biesheuvel [Fri, 27 Nov 2015 17:08:56 +0000 (17:08 +0000)]
ArmPlatformPkg/ArmVExpressFastBootDxe: drop bogus gArmGlobalVariableGuid dep

ArmVExpressFastBootDxe does not use gArmGlobalVariableGuid so drop
the declaration from the .inf.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19000 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/ArmJunoDxe: drop bogus gArmGlobalVariableGuid dependency
Ard Biesheuvel [Fri, 27 Nov 2015 17:08:42 +0000 (17:08 +0000)]
ArmPlatformPkg/ArmJunoDxe: drop bogus gArmGlobalVariableGuid dependency

ArmJunoDxe does not use gArmGlobalVariableGuid so drop the declaration
from the .inf.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18999 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/Bds: drop bogus ArmGlobalVariable dependencies
Ard Biesheuvel [Fri, 27 Nov 2015 17:08:22 +0000 (17:08 +0000)]
ArmPlatformPkg/Bds: drop bogus ArmGlobalVariable dependencies

Remove the GUID references to gArmGlobalVariableGuid and includes
of ArmGlobalVariableHob.h since they are not used by the ARM BDS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18998 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg/BdsLib: drop bogus gArmGlobalVariableGuid dependency
Ard Biesheuvel [Fri, 27 Nov 2015 17:08:08 +0000 (17:08 +0000)]
ArmPkg/BdsLib: drop bogus gArmGlobalVariableGuid dependency

The BdsLib implementation under ArmPkg never references
gArmGlobalVariableGuid so it should not list it as a 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18997 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoEmbeddedPkg/AndroidFastboot: drop bogus ArmGlobalVariable dependencies
Ard Biesheuvel [Fri, 27 Nov 2015 17:07:54 +0000 (17:07 +0000)]
EmbeddedPkg/AndroidFastboot: drop bogus ArmGlobalVariable dependencies

Remove the GUID references to gArmGlobalVariableGuid and includes
of ArmGlobalVariableHob.h since they are not used by the fastboot
app.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18996 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/Sec: remove global variable allocation from lowlevel init
Ard Biesheuvel [Fri, 27 Nov 2015 17:07:43 +0000 (17:07 +0000)]
ArmPlatformPkg/Sec: remove global variable allocation from lowlevel init

Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to allocate and clear out the global
variable region in the Sec init code. So 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18995 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PrePeiCore: remove global variable allocation from lowlevel init
Ard Biesheuvel [Fri, 27 Nov 2015 17:07:31 +0000 (17:07 +0000)]
ArmPlatformPkg/PrePeiCore: remove global variable allocation from lowlevel init

Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to allocate and clear out the global
variable region in the PrePeiCore init code. So 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18994 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PlatformPeim: remove ArmGlobalVariable lowlevel init
Ard Biesheuvel [Fri, 27 Nov 2015 17:07:17 +0000 (17:07 +0000)]
ArmPlatformPkg/PlatformPeim: remove ArmGlobalVariable lowlevel init

Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to query the ArmGlobalVariable PPI and install
the ArmGlobalVariable HOB. So 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18993 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PrePi: remove global variable allocation from lowlevel init
Ard Biesheuvel [Fri, 27 Nov 2015 17:07:06 +0000 (17:07 +0000)]
ArmPlatformPkg/PrePi: remove global variable allocation from lowlevel init

Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to allocate and clear out the global
variable region in the PrePi init code. So 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18992 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmVirtPkg/PrePi: remove global variable allocation from lowlevel init
Ard Biesheuvel [Fri, 27 Nov 2015 17:06:48 +0000 (17:06 +0000)]
ArmVirtPkg/PrePi: remove global variable allocation from lowlevel init

Now that we dropped all ArmPlatformGlobalVariableLib dependencies,
there is no longer a need to allocate and clear out the global
variable region in the PrePi init code. So remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18991 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: remove all ArmPlatformGlobalVariableLib implementations
Ard Biesheuvel [Fri, 27 Nov 2015 17:06:37 +0000 (17:06 +0000)]
ArmPlatformPkg: remove all ArmPlatformGlobalVariableLib implementations

This removes the SEC, PEI and DXE variants of ArmPlatformGlobalVariableLib,
which is no longer used, and should not be used since it violates the PI
spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18990 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: remove PeiServicesTablePointerLib implementation
Ard Biesheuvel [Fri, 27 Nov 2015 17:06:24 +0000 (17:06 +0000)]
ArmPlatformPkg: remove PeiServicesTablePointerLib implementation

This removes the PeiServicesTablePointerLib implementation under
ArmPlatformPkg that violates the PI spec, and hence should not be
used. Instead, the implementation that resides under ArmPkg should
be used.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18989 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: drop ArmPlatformGlobalVariableLib resolutions
Ard Biesheuvel [Fri, 27 Nov 2015 17:06:11 +0000 (17:06 +0000)]
ArmPlatformPkg: drop ArmPlatformGlobalVariableLib resolutions

We can remove all mention of ArmPlatformGlobalVariableLib now that
there are no remaining [transitive] dependencies on 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18988 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: move to ArmPkg version of PeiServicesTablePointerLib
Ard Biesheuvel [Fri, 27 Nov 2015 17:05:59 +0000 (17:05 +0000)]
ArmPlatformPkg: move to ArmPkg version of PeiServicesTablePointerLib

As pointed out by Eugene, the ArmPlatformPkg implementation of
PeiServicesTablePointerLib violates the PI sec, since it uses
ArmPlatformGlobalVariableLib to store the PEI services table pointer
rather than the thread ID cpu registers as the spec requires.

So instead, move to the ArmPkg version of this library, which does
adhere to the PI spec.

Reported-by: Eugene Cohen <eugene@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18987 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmVirtPkg: drop ArmPlatformGlobalVariableLib dependency
Ard Biesheuvel [Fri, 27 Nov 2015 17:05:47 +0000 (17:05 +0000)]
ArmVirtPkg: drop ArmPlatformGlobalVariableLib dependency

Now that all PeiServicesTablePointerLib and PrePiHobListPointerLib
library dependencies in both ArmVirtQemu and ArmVirtXen are satisfied
by implementations that do not depend on ArmPlatformGlobalVariableLib,
we can remove all mention of it from the various .dsc files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18986 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmVirtPkg/ArmVirtQemu: move to ArmPkg version of PeiServicesTablePointerLib
Ard Biesheuvel [Fri, 27 Nov 2015 17:05:36 +0000 (17:05 +0000)]
ArmVirtPkg/ArmVirtQemu: move to ArmPkg version of PeiServicesTablePointerLib

As pointed out by Eugene, the ArmPlatformPkg implementation of
PeiServicesTablePointerLib violates the PI sec, since it uses
ArmPlatformGlobalVariableLib to store the PEI services table pointer
rather than the thread ID cpu registers as the spec requires.

So instead, move to the ArmPkg version of this library, which does
adhere to the PI spec.

Reported-by: Eugene Cohen <eugene@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18985 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBeagleBoardPkg: remove ArmPlatformGlobalVariableLib resolution
Ard Biesheuvel [Fri, 27 Nov 2015 17:05:24 +0000 (17:05 +0000)]
BeagleBoardPkg: remove ArmPlatformGlobalVariableLib resolution

Remove the ArmPlatformGlobalVariableLib library class resolution now
that BeagleBoardPkg no longer has a transitive dependency on 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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18984 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPkg: remove ArmPlatformGlobalVariableLib resolution from ArmPkg.dsc
Ard Biesheuvel [Fri, 27 Nov 2015 17:05:13 +0000 (17:05 +0000)]
ArmPkg: remove ArmPlatformGlobalVariableLib resolution from ArmPkg.dsc

ArmPkg does not depend on ArmPlatformGlobalVariableLib, and this library
is about to be removed, so remove all mention of it from ArmPkg.dsc.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18983 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PrePiHobListPointerLib: use thread ID register
Ard Biesheuvel [Fri, 27 Nov 2015 17:04:59 +0000 (17:04 +0000)]
ArmPlatformPkg/PrePiHobListPointerLib: use thread ID register

This updates the PrePiHobListPointerLib implementation in ArmPlatformPkg
to move away from ArmPlatformGlobalVariableLib and instead use the thread
ID CPU registers (TPIDRURW and TPIDR_EL0 for v7 and v8, respectively)
for storing the HobList pointer.

Since PrePiHobListPointerLib is specific to PrePi (where PEI core is skipped)
we can share these registers with the PEI services table pointer. By the
same reasoning, the PEI services table pointer and the HobList pointer
already shared the same offset in the ArmPlatformGlobalVariable array.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18982 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/PiSmmCpu: Update function call for 2 new APIs.
Yao, Jiewen [Fri, 27 Nov 2015 13:48:12 +0000 (13:48 +0000)]
UefiCpuPkg/PiSmmCpu: Update function call for 2 new APIs.

All page table allocation will use AllocatePageTableMemory().
Add SmmCpuFeaturesCompleteSmmReadyToLock() to PerformRemainingTasks()
and PerformPreTasks().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18981 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/PiSmmCpu: Add NULL func for 2 new APIs in SmmCpuFeaturesLib.
Yao, Jiewen [Fri, 27 Nov 2015 13:48:08 +0000 (13:48 +0000)]
UefiCpuPkg/PiSmmCpu: Add NULL func for 2 new APIs in SmmCpuFeaturesLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18980 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoUefiCpuPkg/PiSmmCpu: Add 2 APIs in SmmCpuFeaturesLib.
Yao, Jiewen [Fri, 27 Nov 2015 13:48:03 +0000 (13:48 +0000)]
UefiCpuPkg/PiSmmCpu: Add 2 APIs in SmmCpuFeaturesLib.

SmmCpuFeaturesCompleteSmmReadyToLock() is a hook point to
allow CPU specific code to do more registers setting after
the gEfiSmmReadyToLockProtocolGuid notification is completely
processed.

SmmCpuFeaturesAllocatePageTableMemory() is an API to allow
CPU to allocate a specific region for storing page tables.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18979 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoRevert "Add 2 APIs in SmmCpuFeaturesLib."
Laszlo Ersek [Fri, 27 Nov 2015 12:00:32 +0000 (12:00 +0000)]
Revert "Add 2 APIs in SmmCpuFeaturesLib."

This reverts SVN r18958 / git commit
9daa916dd1efe6443f9a66dfa882f3185d33ad28.

The patch series had been fully reviewed on edk2-devel, but it got
committed as a single squashed patch. Revert it for now.

Link: http://thread.gmane.org/gmane.comp.bios.edk2.devel/4951
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18978 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoRevert "Always set WP in CR0."
Laszlo Ersek [Fri, 27 Nov 2015 12:00:26 +0000 (12:00 +0000)]
Revert "Always set WP in CR0."

This reverts SVN r18960 / git commit
8e496a7abcb78c36b0af47ed473096ef7f171606.

The patch series had been fully reviewed on edk2-devel, but it got
committed as a single squashed patch. Revert it for now.

Link: http://thread.gmane.org/gmane.comp.bios.edk2.devel/4951
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18977 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg/PrePeiCore: add missing entries to AArch64 vector table
Ard Biesheuvel [Fri, 27 Nov 2015 09:24:27 +0000 (09:24 +0000)]
ArmPlatformPkg/PrePeiCore: add missing entries to AArch64 vector table

The PrePeiCore vector table for AArch64 mode is only half populated.
However unlikely, if exceptions from lower exception levels are ever
taken, they should be reported correctly, rather than causing a
recursive undefined instruction fault on the zero padding that was
introduced by commit SVN r18904 ("ArmPkg/ArmPlatformPkg: position
vectors relative to base"). So add the missing entries, and wire
them up to the default handler.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18976 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg:Refine the comments in INF files
Dandan Bi [Thu, 26 Nov 2015 10:00:12 +0000 (10:00 +0000)]
MdeModulePkg:Refine the comments in INF files

Add comments in INF file in BootMaintenanceManagerLib.inf.
Refine the comments in INF file in FileExplorerLib.inf

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18975 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoEmbeddedPkg: Remove SerialDxe and SerialPortExtLib libraries
Star Zeng [Thu, 26 Nov 2015 08:52:58 +0000 (08:52 +0000)]
EmbeddedPkg: Remove SerialDxe and SerialPortExtLib libraries

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18974 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
Star Zeng [Thu, 26 Nov 2015 08:52:12 +0000 (08:52 +0000)]
ArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg

Beyond just changing the directly related lines in the FDF and DSC files,
we have to adapt the EarlyFdtPL011SerialPortLib and FdtPL011SerialPortLib
instances as well, in the same patch. This is because the EmbeddedPkg
driver expects the SerialPortSetAttributes(),
SerialPortSetControl() and SerialPortGetControl() functions from
SerialPortExtLib, while the MdeModulePkg driver expects them from
SerialPortLib itself.

We cannot implement these functions in ArmVirtPkg's SerialPortLib
instances *before* flipping the driver, because it would cause double
function definitions in the EmbeddedPkg driver. We also can't implement
the functions *after* flipping the driver, because it would cause
unresolved function references in the MdeModulePkg driver. Therefore
we have to implement the functions simultaneously with the driver
replacement.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18973 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOvmfPkg XenConsoleSerialPortLib: Implement Get(Set)Control/SetAttributes
Star Zeng [Thu, 26 Nov 2015 08:51:34 +0000 (08:51 +0000)]
OvmfPkg XenConsoleSerialPortLib: Implement Get(Set)Control/SetAttributes

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18972 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoArmPlatformPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
Star Zeng [Thu, 26 Nov 2015 08:51:05 +0000 (08:51 +0000)]
ArmPlatformPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg

It is also to integrate PL011SerialPortExtLib to PL011SerialPortLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18971 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoBeagleBoardPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
Star Zeng [Thu, 26 Nov 2015 08:50:16 +0000 (08:50 +0000)]
BeagleBoardPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg

It is also to remove the reference to TemplateSerialPortExtLib in
EmbeddedPkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18970 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoOmap35xxPkg SerialPortLib: Implement Get(Set)Control/SetAttributes
Star Zeng [Thu, 26 Nov 2015 08:49:53 +0000 (08:49 +0000)]
Omap35xxPkg SerialPortLib: Implement Get(Set)Control/SetAttributes

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18969 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoCorebootPayloadPkg: Use SerialDxe in MdeModulePkg
Star Zeng [Thu, 26 Nov 2015 08:49:26 +0000 (08:49 +0000)]
CorebootPayloadPkg: Use SerialDxe in MdeModulePkg

1. Update fdf and dsc to use SerialDxe in MdeModulePkg.
2. Separate the code that gets SerialRegBase and SerialRegAccessType
   by CbParseLib from CorebootPayloadPkg/Library/SerialPortLib to
   PlatformHookLib, and then leverage BaseSerialPortLib16550 in
   MdeModulePkg.
3. Remove CorebootPayloadPkg/SerialDxe and
   CorebootPayloadPkg/Library/SerialPortLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18968 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoEmulatorPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg
Star Zeng [Thu, 26 Nov 2015 08:48:38 +0000 (08:48 +0000)]
EmulatorPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg

It is also to add GetControl/SetControl/SetAttributes implementation
for DxeEmuSerialPortLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18967 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg: Upstream SerialDxe from EmbeddedPkg
Star Zeng [Thu, 26 Nov 2015 08:48:10 +0000 (08:48 +0000)]
MdeModulePkg: Upstream SerialDxe from EmbeddedPkg

This Serial driver layers on top of a Serial Port Library instance
to produce serial IO protocol.

There is also another SerialDxe implementation in CorebootPayloadPkg,
but SerialDxe from EmbeddedPkg should be better that also consumes
the extended interfaces GetControl/SetControl/SetAttributes in
EmbeddedPkg/Include/Library/SerialPortExtLib.h for serial IO protocol.
And the extended interfaces GetControl/SetControl/SetAttributes in
EmbeddedPkg/Include/Library/SerialPortExtLib.h has been upstream to
MdePkg/Include/Library/SerialPortLib.h.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@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: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18966 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg BaseSerialPortLib16550:Implement Get(Set)Control/SetAttributes
Star Zeng [Thu, 26 Nov 2015 08:47:44 +0000 (08:47 +0000)]
MdeModulePkg BaseSerialPortLib16550:Implement Get(Set)Control/SetAttributes

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@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: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18965 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoPcAtChipsetPkg SerialIoLib: Implement Get(Set)Control/SetAttributes
Star Zeng [Thu, 26 Nov 2015 08:47:15 +0000 (08:47 +0000)]
PcAtChipsetPkg SerialIoLib: Implement Get(Set)Control/SetAttributes

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18964 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdePkg SerialPortLib: Upstream Get(Set)Control/SetAttributes interfaces
Star Zeng [Thu, 26 Nov 2015 08:46:52 +0000 (08:46 +0000)]
MdePkg SerialPortLib: Upstream Get(Set)Control/SetAttributes interfaces

The extended interfaces GetControl/SetControl/SetAttributes are from
EmbeddedPkg/Include/Library/SerialPortExtLib.h.

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: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18963 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoMdeModulePkg: TerminalDxe: avoid checking uninitialized variable
Star Zeng [Thu, 26 Nov 2015 08:46:20 +0000 (08:46 +0000)]
MdeModulePkg: TerminalDxe: avoid checking uninitialized variable

The SerialIo->GetControl() function is not required to set the
Control output parameter on error. Make sure we apply the
EFI_SERIAL_INPUT_BUFFER_EMPTY optimization in
TerminalConInTimerHandler() only if the SerialIo->GetControl()
function call set that bit in the Control variable.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18962 6f19259b-4bc3-4df7-8a09-765794883524

8 years agoNetworkPkg:Fix NULL pointer dereference issues.
Zhang Lubo [Thu, 26 Nov 2015 08:17:46 +0000 (08:17 +0000)]
NetworkPkg:Fix NULL pointer dereference issues.

Revise some errors that some Null pointers may be dereferenced.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18961 6f19259b-4bc3-4df7-8a09-765794883524