1 /* SPDX-License-Identifier: GPL-2.0+ */
7 #include <asm/u-boot.h>
10 * Logical memory blocks.
12 * Copyright (C) 2001 Peter Bergner, IBM Corp.
15 #define MAX_LMB_REGIONS 8
25 struct lmb_property region[MAX_LMB_REGIONS+1];
29 struct lmb_region memory;
30 struct lmb_region reserved;
33 extern void lmb_init(struct lmb *lmb);
34 extern void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd,
36 extern void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base,
37 phys_size_t size, void *fdt_blob);
38 extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
39 extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
40 extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
41 extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
42 phys_addr_t max_addr);
43 extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
44 phys_addr_t max_addr);
45 extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base,
47 extern phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr);
48 extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
49 extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
51 extern void lmb_dump_all(struct lmb *lmb);
53 static inline phys_size_t
54 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
56 return type->region[region_nr].size;
59 void board_lmb_reserve(struct lmb *lmb);
60 void arch_lmb_reserve(struct lmb *lmb);
62 #endif /* __KERNEL__ */
64 #endif /* _LINUX_LMB_H */