blob: 0a5e3416edb95a32c0387d948a8aaf754a345a0e [file] [log] [blame]
Andrew Scull18834872018-10-12 11:48:09 +01001/*
Andrew Walbran692b3252019-03-07 15:51:31 +00002 * Copyright 2018 The Hafnium Authors.
Andrew Scull18834872018-10-12 11:48:09 +01003 *
Andrew Walbrane959ec12020-06-17 15:01:09 +01004 * 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.
Andrew Scull18834872018-10-12 11:48:09 +01007 */
8
Andrew Scullfbc938a2018-08-20 14:09:28 +01009#pragma once
Wedson Almeida Filhofdf4afc2018-07-19 15:45:21 +010010
Andrew Scull18c78fc2018-08-20 12:57:41 +010011#include "hf/boot_params.h"
12#include "hf/fdt.h"
13#include "hf/mm.h"
Wedson Almeida Filho22d5eaa2018-12-16 00:38:49 +000014#include "hf/mpool.h"
Andrew Scull6c9a4ab2020-01-27 17:09:12 +000015#include "hf/string.h"
Wedson Almeida Filhofdf4afc2018-07-19 15:45:21 +010016
David Brazdilb856be62020-03-25 10:14:55 +000017#define FDT_PROP_INITRD_START "linux,initrd-start"
18#define FDT_PROP_INITRD_END "linux,initrd-end"
19
Fuad Tabba50469e02020-06-30 15:14:28 +010020bool fdt_struct_from_ptr(const void *fdt_ptr, struct fdt *fdt);
David Brazdilb856be62020-03-25 10:14:55 +000021bool fdt_map(struct fdt *fdt, struct mm_stage1_locked stage1_locked,
22 paddr_t fdt_addr, struct mpool *ppool);
23bool fdt_unmap(struct fdt *fdt, struct mm_stage1_locked stage1_locked,
Andrew Scull3c0a90a2019-07-01 11:55:53 +010024 struct mpool *ppool);
David Brazdilb856be62020-03-25 10:14:55 +000025bool fdt_find_cpus(const struct fdt *fdt, cpu_id_t *cpu_ids, size_t *cpu_count);
Fuad Tabba50469e02020-06-30 15:14:28 +010026bool fdt_find_memory_ranges(const struct fdt *fdt,
27 const struct string *device_type,
Andrew Scull6c9a4ab2020-01-27 17:09:12 +000028 struct mem_range *mem_ranges,
29 size_t *mem_ranges_count, size_t mem_range_limit);
David Brazdilb856be62020-03-25 10:14:55 +000030bool fdt_find_initrd(const struct fdt *fdt, paddr_t *begin, paddr_t *end);
Fuad Tabba50469e02020-06-30 15:14:28 +010031bool fdt_get_memory_size(const struct fdt *fdt, size_t *size);