1 /*
2  * Copyright 2018 The Hafnium Authors.
3  *
4  * Use of this source code is governed by a BSD-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/BSD-3-Clause.
7  */
8 
9 #pragma once
10 
11 #include "hf/boot_params.h"
12 #include "hf/fdt.h"
13 #include "hf/mm.h"
14 #include "hf/mpool.h"
15 #include "hf/string.h"
16 
17 #define FDT_PROP_INITRD_START "linux,initrd-start"
18 #define FDT_PROP_INITRD_END "linux,initrd-end"
19 
20 bool fdt_struct_from_ptr(const void *fdt_ptr, struct fdt *fdt);
21 bool fdt_map(struct fdt *fdt, struct mm_stage1_locked stage1_locked,
22 	     paddr_t fdt_addr, struct mpool *ppool);
23 bool fdt_unmap(struct fdt *fdt, struct mm_stage1_locked stage1_locked,
24 	       struct mpool *ppool);
25 bool fdt_find_cpus(const struct fdt *fdt, cpu_id_t *cpu_ids, size_t *cpu_count);
26 bool fdt_find_memory_ranges(const struct fdt *fdt,
27 			    const struct string *device_type,
28 			    struct mem_range *mem_ranges,
29 			    size_t *mem_ranges_count, size_t mem_range_limit);
30 bool fdt_find_initrd(const struct fdt *fdt, paddr_t *begin, paddr_t *end);
31 bool fdt_get_memory_size(const struct fdt *fdt, size_t *size);
32