1#ifndef _LINUX_LMB_H
2#define _LINUX_LMB_H
3#ifdef __KERNEL__
4
5#include <asm/types.h>
6
7
8
9
10
11
12
13
14#define MAX_LMB_REGIONS 8
15
16struct lmb_property {
17 phys_addr_t base;
18 phys_size_t size;
19};
20
21struct lmb_region {
22 unsigned long cnt;
23 phys_size_t size;
24 struct lmb_property region[MAX_LMB_REGIONS+1];
25};
26
27struct lmb {
28 struct lmb_region memory;
29 struct lmb_region reserved;
30};
31
32extern struct lmb lmb;
33
34extern void lmb_init(struct lmb *lmb);
35extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
36extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
37extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
38extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
39 phys_addr_t max_addr);
40extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
41 phys_addr_t max_addr);
42extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
43extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
44
45extern void lmb_dump_all(struct lmb *lmb);
46
47static inline phys_size_t
48lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
49{
50 return type->region[region_nr].size;
51}
52
53void board_lmb_reserve(struct lmb *lmb);
54void arch_lmb_reserve(struct lmb *lmb);
55
56#endif
57
58#endif
59