1 /* SPDX-License-Identifier: GPL-2.0+ */
8 * Logical memory blocks.
10 * Copyright (C) 2001 Peter Bergner, IBM Corp.
13 #define MAX_LMB_REGIONS 8
23 struct lmb_property region[MAX_LMB_REGIONS+1];
27 struct lmb_region memory;
28 struct lmb_region reserved;
31 extern struct lmb lmb;
33 extern void lmb_init(struct lmb *lmb);
34 extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
35 extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
36 extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
37 extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
38 phys_addr_t max_addr);
39 extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
40 phys_addr_t max_addr);
41 extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
42 extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
44 extern void lmb_dump_all(struct lmb *lmb);
46 static inline phys_size_t
47 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
49 return type->region[region_nr].size;
52 void board_lmb_reserve(struct lmb *lmb);
53 void arch_lmb_reserve(struct lmb *lmb);
55 #endif /* __KERNEL__ */
57 #endif /* _LINUX_LMB_H */