Commit Graph

34 Commits

Author SHA1 Message Date
Laszlo Ersek 4a9fab7d72 OvmfPkg: PlatformPei: reuse PublishPeiMemory() in MemDetect()
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-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@15023 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-26 20:44:29 +00:00
Laszlo Ersek 9ab36385be OvmfPkg: PlatformPei: simplify memory range expressions in MemDetect()
Exploit that (MemoryBase + MemorySize) always equals LowerMemorySize.

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@15022 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-26 20:44:20 +00:00
Wei Liu 447d264115 OvmfPkg: enable Xen specific path
This patch sets PcdPciDisableBusEnumeration to true then makes use of
PublishPeiMemory and XenMemMapInitialization to construct memory map for
Xen guest.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14946 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-08 01:36:25 +00:00
Wei Liu bb6a9a9305 OvmfPkg: introduce XenMemMapInitialization
This function parses E820 map provided by Xen and arrange memory maps
accordingly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: XenGetE820Map: VS2010 compat; add assert]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14945 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-08 01:36:15 +00:00
Wei Liu 36658fff45 OvmfPkg: introduce PublishPeiMemory
MemDetect actully does too many things, the underlying platform might
want to have more control over memory layout.

Extract the functionality of publishing PEI memory to a dedicated
function.

Also fixed wrong comment while I was there.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14944 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-08 01:36:07 +00:00
Wei Liu c7ea55b92b OvmfPkg: detect Xen earlier
This is useful for initializing memory map.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14943 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-08 01:36:00 +00:00
Wei Liu 4c3966e9ff OvmfPkg: define EFI_XEN_OVMF_INFO
EFI_XEN_OVMF_INFO is defined to accept configurations from hvmloader. It
must match the definition on Xen side.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14942 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-08 01:35:52 +00:00
Laszlo Ersek 9edb2933ab OvmfPkg/PlatformPei: emulated NV storage must be EfiRuntimeServicesData
SVN r14770 ("OvmfPkg/PlatformPei: correctly align emulated NV storage")
made sure the emulated NV storage was allocated with correct alignment.

However, the AllocateRuntimePool() -> AllocateAlignedPages() change
flipped the memory type from EfiRuntimeServicesData to
EfiBootServicesData. This causes variable services to access freed storage
at runtime. It crashes Windows 2008 R2 early at boot, for example.

Keep the alignment, but restore the memory type to EfiRuntimeServicesData,
by calling AllocateAlignedRuntimePages().

These helper functions are implemeted and documented in
"MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c".

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@14806 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-29 06:02:46 +00:00
Wei Liu cce992aca2 OvmfPkg/PlatformPei: correctly align emulated NV storage
Per 2c4b18e ("MdeModulePkg: Add the alignment check for FTW spare area
address and length, and add the check for PcdFlashNvStorageVariableSize
<= PcdFlashNvStorageFtwSpareSize."), FTWDxe refuses to initialize if
spare space base address or size is not aligned to block size.

Depending on configuration, memory for FTWDxe might be dynamically
allocated in PlatformPei. This patch makes sure that the allocated
memory region is aligned.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14770 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-14 16:24:37 +00:00
jljusten 0e20a1864f OvmfPkg: key PMBA setup in Platform PEI off of PMREGMISC/PMIOSE, not Xen
This matches the logic in AcpiTimerLib.

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

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13723 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-12 07:19:28 +00:00
jljusten 931a0c74ed OvmfPkg: enable PIIX4 IO space in the PEI phase
I. There are at least three locations in OvmfPkg that manipulate the PMBA
and related PIIX4 registers.

1. MiscInitialization() [OvmfPkg/PlatformPei/Platform.c]
   module type: PEIM -- Pre-EFI Initialization Module
   (a) currently sets the PMBA only: 00.01.3 / 0x40 bits [15:6]

2. AcpiTimerLibConstructor() [OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c]
   module type: BASE -- probably callable anywhere after PEI
   (a) sets the PMBA if needed:      00.01.3 / 0x40 bits [15:6]
   (b) sets PCICMD/IOSE if needed:   00.01.3 / 0x04 bit  0
   (c) sets PMREGMISC/PMIOSE:        00.01.3 / 0x80 bit  0

3. AcpiInitialization() [OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
   module type: DXE_DRIVER -- Driver eXecution Environment
   (a) sets SCI_EN, which depends on correct PMBA setting from earlier

(
  The relative order of #1 and #3 is dictated minimally by their module
  types. Said relative order can be verified with the boot log:

       27 Loading PEIM at 0x00000822320 EntryPoint=0x00000822580
          PlatformPei.efi
       28 Platform PEIM Loaded
     1259 PlatformBdsInit
     1270 PlatformBdsPolicyBehavior

  Line 28 is printed by InitializePlatform()
  [OvmfPkg/PlatformPei/Platform.c] which is the entry point of that
  module. The other two lines are printed by the corresponding functions
  in "OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c".
)

Currently #2 (AcpiTimerLibConstructor()) is called in a random spot
(whenever it gets loaded from the firmware image) and masks the
insufficient setup in #1. We shouldn't depend on that, PEI should finish
with IO space being fully accessibe. In addition, PEI should program the
same PMBA value as AcpiTimerLib.

II. The PEI change notwithstanding, AcpiTimerLib should stay defensive and
ensure proper PM configuration for itself (either by confirming or by
doing).

III. Considering a possible cleanup/unification of #2 and #3: timer
functions relying on AcpiTimerLibConstructor(),

- MicroSecondDelay()
- NanoSecondDelay()
- GetPerformanceCounter()
- GetPerformanceCounterProperties()
- GetTimeInNanoSecond()

may be called before #3 is reached (in Boot Device Selection phase), so we
should not move the initialization from #2 to #3. (Again, AcpiTimerLib
should contain its own setup.)

We should also not move #3 to an earlier phase -- SCI_EN is premature
unless we're about to boot real soon ("enable generation of SCI upon
assertion of PWRBTN_STS, LID_STS, THRM_STS, or GPI_STS bits").

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

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13722 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-12 07:19:16 +00:00
jljusten a1eff44b5e OvmfPkg: fix the mask for accessing the PIIX4 PMBA [15:6] bitfield
The Index Register Base Address bitfield is selected by the binary mask
00000000 00000000 11111111 11000000, 0xFFC0; fix the typo.

Reported-by: Gleb Natapov <gleb@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://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13720 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-12 07:18:50 +00:00
jljusten 67fe5bed94 OvmfPkg/PlatformPei: Shrink memory range for PCI MMIO allocation
Including the range of [0xFC000000, 0xFD000000) for PCI MMIO
allocation created a conflict for Xen's HVM loader.

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

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13682 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-27 23:28:15 +00:00
jljusten cb678aa85e OvmfPkg: clean up memory map
Fix IO-APIC range size.
Add HPET.
Take LAPIC base from PCD and fix range size.

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

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13572 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-31 18:17:37 +00:00
jljusten 27d7e63f45 OvmfPkg/PlatformPei: Remove MtrrLib ASSERTs
QEMU doesn't support MTRR emulation in some cases,
and therefore the MtrrLib calls may return an error.
In that case, we should silently ignore the error.

Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12618 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-31 15:58:18 +00:00
jljusten a473e4163b OvmfPkg: Remove variables that are set, but not used
GCC 4.6 generates a warning when a variable is set,
but never used.

Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12615 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-31 15:57:12 +00:00
vanjeff e8e5cd4a5e Set MTRR registers.
Signed-off-by: vanjeff
Reviewed-by: rsun3


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12589 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-28 06:04:01 +00:00
gikidy 670a64e7b7 Fix build crash while using MSFT to build OVMF, also fix some build warning report for PCD type issues.
Signed-off-by: gikidy
Reviewed-by: jcarsey

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12202 6f19259b-4bc3-4df7-8a09-765794883524
2011-08-25 03:19:57 +00:00
jljusten eec7d42017 OvmfPkg/PlatformPei: Add Xen support
* Make PlatformPei aware of Xen
* Fix assigned PIO and MMIO ranges to be compatible with Xen
* Reserve Xen HVM address range
* Publish XenInfo HOB
* Don't program PIIX4 PMBA for Xen

Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Reviewed-by: gavinguan
Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12091 6f19259b-4bc3-4df7-8a09-765794883524
2011-08-05 15:43:05 +00:00
jljusten 667bf1e48f OvmfPkg/PlatformPei: Fix issue with 'RELEASE' tag build
When building in release mode on OVMF, the ASSERT_EFI_ERROR
macro is empty.  So, to set the BootMode, in a release build,
it must be outside of ASSERT_EFI_ERROR.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11413 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-22 04:54:18 +00:00
jljusten 9ed65b1005 OvmfPkg/PlatformPei: Set BootMode, install MasterBootMode PPI
MdeModulePkg/Core/DxeIplPeim is now dependent on
gEfiPeiMasterBootModePpiGuid in order to run.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11412 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-22 01:55:08 +00:00
jljusten c0e1097656 OvmfPkg: Add support for memory above 4GB
When QEMU has more than 3.5GB of RAM, it will map the
additional memory above 4GB.  This change will make that
RAM accessible to OVMF.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11266 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-21 16:51:00 +00:00
jljusten 3ca15914df OvmfPkg: Add DEBUG messages to dump the contents of CMOS
The contents of CMOS on boot can describe some aspects of
the system configuration.  For example, the size of memory
available to qemu/kvm.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11264 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-21 16:50:31 +00:00
jljusten c756b2ab80 OvmfPkg/PlatformPei: Set PM base address OVMF
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11250 6f19259b-4bc3-4df7-8a09-765794883524
2011-01-13 05:46:24 +00:00
jljusten 55cdb67acb OVMF: Support greater than 2GB of memory
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10928 6f19259b-4bc3-4df7-8a09-765794883524
2010-10-13 07:07:29 +00:00
mdkinney 991d956362 Update OVMF Platform PEI to declare IO and MMIO resources.
Update default memory type information to reduce EFI Memory Map fragmentation.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10657 6f19259b-4bc3-4df7-8a09-765794883524
2010-07-16 19:04:41 +00:00
hhtian 56d7640a53 Update the copyright notice format
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10439 6f19259b-4bc3-4df7-8a09-765794883524
2010-04-28 12:43:04 +00:00
lgao4 7b202cb0f9 1. Correct File header to ## @file
2. Remove unnecessary .common] postfix on section.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10051 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-23 23:58:38 +00:00
mdkinney 29a3f13989 Remove unnecessary use of FixedPcdxxx() functions and [FixedPcd] INF sections. These should only be used for PCDs that are used to pre-init global variables, pre-init global structures, or size arrays.
Do some minor clean ups to INF files
 


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9870 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-30 00:10:44 +00:00
jljusten c1c2669c6b OVMF: Update OVMF FD/FV build to minimize ROM size
* Only SEC is uncompressed now
* The MAIN FV with PEI & DXE can easily shrink and grow as needed
* The final output will now be OVMF.Fv rather than OVMF.fd
* The final output size will be a multiple of 64kb

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9672 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-04 16:17:59 +00:00
jljusten 27f58ea1b2 OVMF: Convert from EmuVariableRuntimeDxe to VariableRuntimeDxe.
OVMF utilizes EmuVariableFvbRuntimeDxe to provide an emulated
variable firmware volume block device for non-volatile variables.
This allows the VariableRuntimeDxe and FaultTolerantWriteDxe
to function without a real non-volatile backing store.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9317 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-26 07:15:51 +00:00
jljusten 77ba993c88 OVMF: Add support for more persistent NV variables which can survive a system reboot.
Make use of EMU Variable driver's PcdEmuVariableNvStoreReserved to allow
NV variables to persist a VM system reset.  The contents of the NV variables
will still be lost when the VM is shut down, but they appear to persist
when the efi shell reset command is run.  (Tested with QEMU 0.10.0.)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9241 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-07 20:18:17 +00:00
jljusten a4437ffd58 Make 0xa0000 - 0xb0000 I/O memory.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8630 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-23 18:30:43 +00:00
jljusten 49ba9447c9 Add initial version of Open Virtual Machine Firmware (OVMF) platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8398 6f19259b-4bc3-4df7-8a09-765794883524
2009-05-27 21:10:18 +00:00