8#include <Include/libfdt.h>
12 IN VOID *DeviceTreeBlob,
13 OUT UINT64 *SystemMemoryBase,
14 OUT UINT64 *SystemMemorySize
23 if (fdt_check_header (DeviceTreeBlob) != 0) {
30 MemoryNode = fdt_path_offset (DeviceTreeBlob,
"/memory");
31 if (MemoryNode <= 0) {
42 Prop = fdt_getprop (DeviceTreeBlob, 0,
"#address-cells", &Length);
44 AddressCells = fdt32_to_cpu (*Prop);
47 Prop = fdt_getprop (DeviceTreeBlob, 0,
"#size-cells", &Length);
49 SizeCells = fdt32_to_cpu (*Prop);
56 Prop = fdt_getprop (DeviceTreeBlob, MemoryNode,
"reg", &Length);
58 if (Length < (AddressCells + SizeCells) *
sizeof (INT32)) {
62 *SystemMemoryBase = fdt32_to_cpu (Prop[0]);
63 if (AddressCells > 1) {
64 *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);
69 *SystemMemorySize = fdt32_to_cpu (Prop[0]);
71 *SystemMemorySize = (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1]);
84 CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)