blob: 9a8e33182fe5d0d6e7ea34b7f54b7c359c8aeded [file] [log] [blame]
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _MEMREGIONS_H_
#define _MEMREGIONS_H_
#include <libcflat.h>
#include <bitops.h>
#define NR_INITIAL_MEM_REGIONS 8
#define MR_F_IO BIT(0)
#define MR_F_CODE BIT(1)
#define MR_F_RESERVED BIT(2)
#define MR_F_UNKNOWN BIT(31)
struct mem_region {
phys_addr_t start;
phys_addr_t end;
uint32_t flags;
};
extern struct mem_region *mem_regions;
void memregions_init(struct mem_region regions[], size_t nr);
struct mem_region *memregions_add(struct mem_region *r);
struct mem_region *memregions_find(phys_addr_t paddr);
uint32_t memregions_get_flags(phys_addr_t paddr);
void memregions_split(phys_addr_t addr, struct mem_region **r1, struct mem_region **r2);
void memregions_add_dt_regions(size_t max_nr);
#endif /* _MEMREGIONS_H_ */