Revision: 19123
http://sourceforge.net/p/edk2/code/19123
Author: lersek
Date: 2015-12-04 16:17:12 +0000 (Fri, 04 Dec 2015)
Log Message:
-----------
ArmVirtPkg: ArmVirtPlatformLib: find the lowest memory node
While QEMU NUMA support on ARM will introduce more than one /memory node
in the device tree, it needs to find the lowest one and set
PcdSystemMemorySize with the actual size of this memory node.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shannon Zhao <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c
Modified: trunk/edk2/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c
===================================================================
--- trunk/edk2/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c 2015-12-04
08:00:53 UTC (rev 19122)
+++ trunk/edk2/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c 2015-12-04
16:17:12 UTC (rev 19123)
@@ -72,8 +72,8 @@
{
VOID *DeviceTreeBase;
INT32 Node, Prev;
- UINT64 NewBase;
- UINT64 NewSize;
+ UINT64 NewBase, CurBase;
+ UINT64 NewSize, CurSize;
CONST CHAR8 *Type;
INT32 Len;
CONST UINT64 *RegProp;
@@ -90,7 +90,7 @@
ASSERT (fdt_check_header (DeviceTreeBase) == 0);
//
- // Look for a memory node
+ // Look for the lowest memory node
//
for (Prev = 0;; Prev = Node) {
Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
@@ -110,26 +110,30 @@
RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
- NewBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
- NewSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+ CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
+ CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
- //
- // Make sure the start of DRAM matches our expectation
- //
- ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
- PcdSet64 (PcdSystemMemorySize, NewSize);
+ DEBUG ((EFI_D_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
+ __FUNCTION__, CurBase, CurBase + CurSize - 1));
- DEBUG ((EFI_D_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
- __FUNCTION__, NewBase, NewBase + NewSize - 1));
+ if (NewBase > CurBase || NewBase == 0) {
+ NewBase = CurBase;
+ NewSize = CurSize;
+ }
} else {
DEBUG ((EFI_D_ERROR, "%a: Failed to parse FDT memory node\n",
__FUNCTION__));
}
- break;
}
}
//
+ // Make sure the start of DRAM matches our expectation
+ //
+ ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
+ PcdSet64 (PcdSystemMemorySize, NewSize);
+
+ //
// We need to make sure that the machine we are running on has at least
// 128 MB of memory configured, and is currently executing this binary from
// NOR flash. This prevents a device tree image in DRAM from getting
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits