Re: [edk2] DXE phase halt at initialising PCD when PEI is empty

2013-12-24 Thread Scott Duplichan
Zeng, Star wrote: ]Hi Sava, ] ]Yes, it is a real problem. I agree "a more careful handling of this ]case is a good idea". ]We will fix this case. ]Thanks very much. ]Star This problem was first reported on 11/24/2013, along with a slightly simpler fix than that proposed by A. Sava:

Re: [edk2] DXE phase halt at initialising PCD when PEI is empty

2013-12-24 Thread Zeng, Star
Hi Sava, Yes, it is a real problem. I agree "a more careful handling of this case is a good idea". We will fix this case. Thanks very much. Star From: A. Sava [mailto:asava@gmail.com] Sent: Wednesday, December 25, 2013 5:25 AM To: edk2-devel@lists.sourceforge.net Subject: [edk2] DXE phase h

[edk2] DXE phase halt at initialising PCD when PEI is empty

2013-12-24 Thread A. Sava
There is a problem starting in edk2 r14587 - DXE phase may halt at initialising PCD when PEI is empty. The problem is at MdeModulePkg/Universal/PCD/Dxe/Service.c @ BuildPcdDxeDataBase (): GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid); if (GuidHob != NULL) { // // If no PEIMs use d

[edk2] [PATCH v2 30/32] OvmfPkg: AcpiS3SaveDxe: depend on SmmLockBox explicitly

2013-12-24 Thread Laszlo Ersek
AcpiS3SaveDxe has a runtime dependency (enforced via ASSERT ()) on SmmLockBox (which in turn depends on the SMRAM we emulate as part of the NVRAM). Make the dependency explicit in the Depex section of the driver, similarly to what BootScriptExecutorDxe does. When the SMRAM is not available, not loa

[edk2] [PATCH v2 13/32] OvmfPkg: S3 Suspend: pull in SmmLockBox driver

2013-12-24 Thread Laszlo Ersek
"MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf" produces gEfiSmmLockBoxCommunicationGuid, implementing LockBox services in SMRAM for the SmmLockBoxLib library (used in the following patches). gEfiSmmLockBoxCommunicationGuid EFI_SMM_ACCESS2_PROTOCOL [EmuSmmDxe] gEfiSmmSwDispatc

[edk2] [PATCH v2 05/32] OvmfPkg: PlatformPei: reuse PublishPeiMemory() in MemDetect()

2013-12-24 Thread Laszlo Ersek
Although SVN r14944 ("OvmfPkg: introduce PublishPeiMemory") copied a big chunk of code from MemDetect(), calling the new PublishPeiMemory() function in MemDetect() could not have replaced the original code in the latter. However, with the help of the previous patch, we can do it now. Contributed-u

[edk2] [PATCH v2 17/32] OvmfPkg: S3 Suspend: enable creation/saving of an S3 Boot Script

2013-12-24 Thread Laszlo Ersek
"MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf" produces the EFI_S3_SAVE_STATE_PROTOCOL which allows creation and saving of an S3 Boot Script, to be replayed in PEI during S3 Resume. The script contains opcodes and opcode arguments to configure CPU, PCI and IO resources. S3SaveStat

[edk2] [PATCH v2 32/32] OvmfPkg: PlatformPei: don't reserve early-use ranges with S3 disabled

2013-12-24 Thread Laszlo Ersek
In addition to the NVRAM emulation made dependent on S3 support in the previous patch, if the host admin turns off S3 for the guest, there is also no need to reserve the following ranges from the OS, as AcpiNVS type memory (see "OvmfPkg/PlatformPei/MemoryMap.txt"): - [0x007, 0x007]: early

[edk2] [PATCH v2 27/32] OvmfPkg: QemuFwCfgLib: extract stateful implementation

2013-12-24 Thread Laszlo Ersek
The current implementation of QemuFwCfgLib is: - stateful - implicitly initialized in the library constructor. OVMF's SEC runs from read-only memory/flash. When the library is linked into a SEC binary (which currently never happens), the "mQemuFwCfgSupported" global variable becomes read-only, mak

[edk2] [PATCH v2 28/32] OvmfPkg: QemuFwCfgLib: implement for SEC

2013-12-24 Thread Laszlo Ersek
The QemuFwCfgSecLib library instance - is stateless, - has no library constructor, - is available to SEC client code, - must be queried with QemuFwCfgIsAvailable() before use, - is restricted to SEC in order to limit the explicit querying requirement. (There is no current user.) Contributed-unde

[edk2] [PATCH v2 19/32] OvmfPkg: S3 Suspend: introduce DiscloseSmstSmm driver

2013-12-24 Thread Laszlo Ersek
This is a rogue SMM driver. It runs in SMM mode and has access to confidential SMM data. It saves the address of the SMST for the next patch, at a known location in the emulated NVRAM. v3: - rebased to EmuNvramLib Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek

[edk2] [PATCH v2 23/32] OvmfPkg: PlatformPei: detect S3 Resume in CMOS and set boot mode accordingly

2013-12-24 Thread Laszlo Ersek
Data is transferred between S3 Suspend and S3 Resume as follows: S3 Suspend (DXE): (1) BdsLibBootViaBootOption() EFI_ACPI_S3_SAVE_PROTOCOL [AcpiS3SaveDxe] - saves ACPI S3 Context to SMRAM LockBox ---+ (including FACS address -- FACS ACPI table |

[edk2] [PATCH v2 04/32] OvmfPkg: PlatformPei: simplify memory range expressions in MemDetect()

2013-12-24 Thread Laszlo Ersek
Exploit that (MemoryBase + MemorySize) always equals LowerMemorySize. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/MemDetect.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c

[edk2] [PATCH v2 02/32] OvmfPkg: introduce EmuNvramLib

2013-12-24 Thread Laszlo Ersek
In the following patches we'll need three kinds of storage that are reserved from the OS and survive S3 suspend. (Non-volatility across cold reboot is not needed.) This trivial library ensures that all parties will have the same notion about where in guest RAM the various sections of the NVRAM are

[edk2] [PATCH v2 21/32] OvmfPkg: S3 Resume: pull in BootScriptExecutorDxe

2013-12-24 Thread Laszlo Ersek
This driver (from "MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf") is first loaded normally during DXE. When the EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL is installed by any DXE driver (purely as a form of notification), the driver reloads itself to reserved memory. During

[edk2] [PATCH v2 20/32] OvmfPkg: S3 Resume: introduce EmuSmmPei for exposing SMRAM in PEI

2013-12-24 Thread Laszlo Ersek
"MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf" is the library instance that implements the LockBoxLib library class with SMRAM access for the PEI phase. Introduce a PEIM that produces the EFI_PEI_SMM_COMMUNICATION_PPI and PEI_SMM_ACCESS_PPI interfaces, enabling SmmLockBoxPeiLib to work.

[edk2] [PATCH v2 09/32] OvmfPkg: PlatformPei: reserve initial (pre-migr.) SEC/PEI stack and PEI heap

2013-12-24 Thread Laszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/Fv.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c index a119172..e309ddf 100644 --- a/OvmfPkg/PlatformPei/Fv.c +++ b/

[edk2] [PATCH v2 26/32] OvmfPkg: QemuFwCfgLib: introduce InternalQemuFwCfgIsAvailable()

2013-12-24 Thread Laszlo Ersek
This internal function allows separation of library-internal and for-clients external availability of fw_cfg. The interface contract of QemuFwCfgIsAvailable() is changed so that now it may modify fw_cfg state. All current users are compliant with the new contract. Contributed-under: TianoCore Con

[edk2] [PATCH v2 24/32] OvmfPkg: QemuFwCfgLib: drop bogus dependency on UefiBootServicesTableLib

2013-12-24 Thread Laszlo Ersek
This in turn requires resolving MemoryAllocationLib for DXE_SMM_DRIVERs. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf | 1 - OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc

[edk2] [PATCH v2 03/32] OvmfPkg: Sec: forbid overlap between decompressed fw image and EmuNvram

2013-12-24 Thread Laszlo Ersek
DecompressGuidedFv() should check if the highest address used during decompression errs into the emulated NVRAM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/Sec/SecMain.inf | 1 + OvmfPkg/Sec/SecMain.c | 6 ++ 2 files changed, 7 insertion

[edk2] [PATCH v2 15/32] OvmfPkg: S3 Suspend: import specialized copy of AcpiS3SaveDxe

2013-12-24 Thread Laszlo Ersek
"IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf" currently specifies a DepEx on gEfiMpServiceProtocolGuid (MP Services). The justification is the following code sequence: InstallAcpiS3Save() if PcdFrameworkCompatibilitySupport is set: InstallAcpiS3SaveThunk()

[edk2] [PATCH v2 11/32] OvmfPkg: S3 Suspend: introduce EmuSmmDxe for exposing SMRAM

2013-12-24 Thread Laszlo Ersek
This mostly no-op runtime DXE driver produces the EFI_SMM_ACCESS2_PROTOCOL and EFI_SMM_CONTROL2_PROTOCOL protocols, enabling the SMM core to be loaded in the next patch. v3: - rebased to EmuNvramLib Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/

[edk2] [PATCH v2 01/32] OvmfPkg: PlatformPei: document ranges to be reserved manually

2013-12-24 Thread Laszlo Ersek
Adding the documentation early on should help understand and review the coming up patches. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/MemoryMap.txt | 120 ++ 1 file changed, 120 insertions(+) cr

[edk2] [PATCH v2 31/32] OvmfPkg: turn off NVRAM emulation when S3 is explicitly disabled

2013-12-24 Thread Laszlo Ersek
NVRAM emulation has no other purpose than implementing S3 support. With S3 turned off in the VM configuration, this patch saves over 33 MB of guest RAM: the 0x0140..0x03501000 range is not reserved any longer; see "OvmfPkg/PlatformPei/MemoryMap.txt". The absence of SMRAM (which is part of the

[edk2] [PATCH v2 06/32] OvmfPkg: PlatformPei: reserve / install PEI core memory dependent on S3

2013-12-24 Thread Laszlo Ersek
In chronological order (see InitializePlatform()): normal boot pathS3 Resume boot path -- -- value of "S3Resume" FALSE TRUE PublishPeiMemoryNO,

[edk2] [PATCH v2 18/32] OvmfPkg: S3 Suspend: save boot script after ACPI context

2013-12-24 Thread Laszlo Ersek
The trigger to actually save the boot script is the installation of EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL, to be performed by any DXE driver. Installation of the protocol also locks down SMM (as its name indicates) and prevents further LockBox access. We cannot install this protocol before BdsLibBoot

[edk2] [PATCH v2 10/32] OvmfPkg: PlatformPei: reserve early page tables on X64

2013-12-24 Thread Laszlo Ersek
On X64, the reset vector code in "OvmfPkg/ResetVector/Ia32/PageTables64.asm" identity maps the first 4GB of RAM for PEI, consuming six frames starting at 512KB. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/Fv.c | 12 1 f

[edk2] [PATCH v2 16/32] OvmfPkg: S3 Suspend: save ACPI context

2013-12-24 Thread Laszlo Ersek
"OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf" (originally: "IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf") produces the EFI_ACPI_S3_SAVE_PROTOCOL. When found, this protocol is automatically invoked by BdsLibBootViaBootOption(), in file "IntelFrameworkModulePkg/Library/Generic

[edk2] [PATCH v2 00/32] S3 suspend/resume for OVMF

2013-12-24 Thread Laszlo Ersek
v1 posting: - http://thread.gmane.org/gmane.comp.bios.tianocore.devel/5461 additional v1 test results: - http://thread.gmane.org/gmane.comp.bios.tianocore.devel/5461/focus=5495 - http://thread.gmane.org/gmane.comp.bios.tianocore.devel/5461/focus=5501 - http://thread.gmane.org/gmane.comp.bios.tiano

[edk2] [PATCH v2 25/32] OvmfPkg: QemuFwCfgLib: determine if S3 support is explicitly disabled

2013-12-24 Thread Laszlo Ersek
Such a packaged query function will come in handy in the following patches. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/Include/Library/QemuFwCfgLib.h | 14 ++ OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 28 ++

[edk2] [PATCH v2 22/32] OvmfPkg: S3 Resume: pull in PEIM orchestrating S3 Resume

2013-12-24 Thread Laszlo Ersek
"UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf" produces the EFI_PEI_S3_RESUME2 PEIM-to-PEIM Interface. When the platform-specific initialization code (in PEI) sets the Boot Mode to BOOT_ON_S3_RESUME, the DXE IPL (which is the last step in PEI) skips the DXE phase entirely, and executes

[edk2] [PATCH v2 29/32] OvmfPkg: PlatformPei: "S3 Resume Boot Path" implies "S3 was Enabled"

2013-12-24 Thread Laszlo Ersek
In the following patches we'll make memory reservations dependent on S3 support (as configured by the host admin for the guest). We must not enter the S3 boot path without having reserved memory. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/Plat

[edk2] [PATCH v2 08/32] OvmfPkg: PlatformPei: reserve fw decompression scratch space from the OS

2013-12-24 Thread Laszlo Ersek
This area is also overwritten by SEC when it decompresses the main firmware -- tell the OS to stay away. +--+ 8M (PcdOvmfMemFvBase) ^ | | final decompr. | +--+ 9M (OutputBuffer) targe

[edk2] [PATCH v2 14/32] OvmfPkg: S3 Suspend: use SMM instances for LockBoxLib library class

2013-12-24 Thread Laszlo Ersek
LockBoxLib has two sets of implementations. The Null implementation (which is the OVMF default) is not useful for us any longer; we need the library instances that back the LockBox structure with SMRAM -- the SmmLockBoxLib variants. These variants (library instances) are for: - DXE_DRIVER, DXE_RUN

[edk2] [PATCH v2 12/32] OvmfPkg: S3 Suspend: pull in DXE driver for EFI_SMM_COMMUNICATION_PROTOCOL

2013-12-24 Thread Laszlo Ersek
The low-level data transfer between S3 Suspend and S3 Resume happens thru SMRAM. SMRAM is theoretically accessible to SMM drivers only; other ("untrusted") drivers can only talk to the former via EFI_SMM_COMMUNICATION_PROTOCOL. "MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf" implements the SMM Initial

[edk2] [PATCH v2 07/32] OvmfPkg: PlatformPei: reserve decompressed firmware area from the OS

2013-12-24 Thread Laszlo Ersek
This area is overwritten after resume / reboot. Make sure the OS steers clear of it so that we don't destroy OS data after resume. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/Fv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deleti

Re: [edk2] OptionROM [MdeModulePkg\Bus\PCI\Mydriver]

2013-12-24 Thread Neeraj Ladkani
One main reason could be your polling functions as UEFI doesn't have interrupts. On Tue, Dec 24, 2013 at 5:56 PM, boot devel wrote: > Hi, > > My legacy optionrom driver downloads windows boot image over PXE in few > seconds but uefi optionrom is taking several minutes, what could be the > r

[edk2] OptionROM [MdeModulePkg\Bus\PCI\Mydriver]

2013-12-24 Thread boot devel
Hi, My legacy optionrom driver downloads windows boot image over PXE in few seconds but uefi optionrom is taking several minutes, what could be the reason and any configuration to speed up boot image download? Driver code is compiled in MdeModulePkg/Bus/Pci/Mydriver INF file Module_type = DXE_RU