Migrate to libfdt

Replace our custom FDT parser implementation with libfdt while retaining
the original API as a thin wrapper around libfdt. This minimizes the
changes to the rest of our code base and hides differences in coding
styles.

As a byproduct, this fixes an issue with unaligned memory accesses while
parsing as libfdt handles these correctly.

Bug: 150587116
Change-Id: I8d305d7094b1be04608048009d73d7c448a578a0
diff --git a/src/boot_flow/common.c b/src/boot_flow/common.c
index dace9af..0f263a9 100644
--- a/src/boot_flow/common.c
+++ b/src/boot_flow/common.c
@@ -22,8 +22,7 @@
 /**
  * Extract the boot parameters from the FDT and the boot-flow driver.
  */
-bool boot_flow_get_params(struct boot_params *p,
-			  const struct fdt_node *fdt_root)
+bool boot_flow_get_params(struct boot_params *p, const struct fdt *fdt)
 {
 	struct string memory = STRING_INIT("memory");
 	struct string device_memory = STRING_INIT("device-memory");
@@ -31,14 +30,14 @@
 	p->mem_ranges_count = 0;
 	p->kernel_arg = plat_boot_flow_get_kernel_arg();
 
-	return plat_boot_flow_get_initrd_range(fdt_root, &p->initrd_begin,
+	return plat_boot_flow_get_initrd_range(fdt, &p->initrd_begin,
 					       &p->initrd_end) &&
-	       fdt_find_cpus(fdt_root, p->cpu_ids, &p->cpu_count) &&
-	       fdt_find_memory_ranges(fdt_root, &memory, p->mem_ranges,
+	       fdt_find_cpus(fdt, p->cpu_ids, &p->cpu_count) &&
+	       fdt_find_memory_ranges(fdt, &memory, p->mem_ranges,
 				      &p->mem_ranges_count, MAX_MEM_RANGES) &&
-	       fdt_find_memory_ranges(
-		       fdt_root, &device_memory, p->device_mem_ranges,
-		       &p->device_mem_ranges_count, MAX_DEVICE_MEM_RANGES);
+	       fdt_find_memory_ranges(fdt, &device_memory, p->device_mem_ranges,
+				      &p->device_mem_ranges_count,
+				      MAX_DEVICE_MEM_RANGES);
 }
 
 /**