Lines Matching refs:exp

8 #define __exp2index(exp) (exp - 12)  argument
14 #define buddy_block_vaddr(vaddr, exp) (vaddr ^ (1UL << exp)) argument
55 static __always_inline void __buddy_split(struct __mmio_buddy_addr_region *region, int exp) in __buddy_split() argument
58 …dy_addr_region *new_region = __mmio_buddy_create_region(buddy_block_vaddr(region->vaddr, exp - 1)); in __buddy_split()
59 __buddy_add_region_obj(__exp2index(exp - 1), region); in __buddy_split()
60 __buddy_add_region_obj(__exp2index(exp - 1), new_region); in __buddy_split()
72 int exp) in __buddy_merge_blocks() argument
75 if (unlikely(x->vaddr != buddy_block_vaddr(y->vaddr, exp))) // 不是一对伙伴 in __buddy_merge_blocks()
84 __buddy_add_region_obj(__exp2index(exp + 1), x); in __buddy_merge_blocks()
95 static __always_inline struct __mmio_buddy_addr_region *__buddy_pop_region(int exp) in __buddy_pop_region() argument
97 if (unlikely(list_empty(&__mmio_pool.free_regions[__exp2index(exp)].list_head))) in __buddy_pop_region()
99 …ddy_addr_region *r = container_of(list_next(&__mmio_pool.free_regions[__exp2index(exp)].list_head), in __buddy_pop_region()
103 --__mmio_pool.free_regions[__exp2index(exp)].num_free; in __buddy_pop_region()
114 …s_inline struct __mmio_buddy_addr_region *__find_buddy(struct __mmio_buddy_addr_region *x, int exp) in __find_buddy() argument
117 if (unlikely(list_empty(&__mmio_pool.free_regions[__exp2index(exp)].list_head))) in __find_buddy()
120 uint64_t buddy_vaddr = buddy_block_vaddr(x->vaddr, exp); in __find_buddy()
121 struct List *list = &__mmio_pool.free_regions[__exp2index(exp)].list_head; in __find_buddy()
129 } while (list_next(list) != &__mmio_pool.free_regions[__exp2index(exp)].list_head); in __find_buddy()
138 static void __buddy_merge(int exp) in __buddy_merge() argument
140 struct __mmio_free_region_list *free_list = &__mmio_pool.free_regions[__exp2index(exp)]; in __buddy_merge()
151 struct __mmio_buddy_addr_region *bd = __find_buddy(ptr, exp); in __buddy_merge()
161 __buddy_merge_blocks(ptr, bd, exp); in __buddy_merge()
173 struct __mmio_buddy_addr_region *mmio_buddy_query_addr_region(int exp) in mmio_buddy_query_addr_region() argument
175 if (unlikely(exp > MMIO_BUDDY_MAX_EXP || exp < MMIO_BUDDY_MIN_EXP)) in mmio_buddy_query_addr_region()
181 if (!list_empty(&__mmio_pool.free_regions[__exp2index(exp)].list_head)) in mmio_buddy_query_addr_region()
185 for (int cur_exp = exp; cur_exp <= MMIO_BUDDY_MAX_EXP; ++cur_exp) in mmio_buddy_query_addr_region()
192 for (int down_exp = cur_exp; down_exp > exp; --down_exp) in mmio_buddy_query_addr_region()
201 if (!list_empty(&__mmio_pool.free_regions[__exp2index(exp)].list_head)) in mmio_buddy_query_addr_region()
205 for (int cur_exp = MMIO_BUDDY_MIN_EXP; cur_exp < exp; ++cur_exp) in mmio_buddy_query_addr_region()
208 if (!list_empty(&__mmio_pool.free_regions[__exp2index(exp)].list_head)) in mmio_buddy_query_addr_region()
215 return __buddy_pop_region(exp); in mmio_buddy_query_addr_region()
225 int __mmio_buddy_give_back(uint64_t vaddr, int exp) in __mmio_buddy_give_back() argument
228 if (vaddr & ((1UL << exp) - 1)) in __mmio_buddy_give_back()
233 __buddy_add_region_obj(__exp2index(exp), region); in __mmio_buddy_give_back()