• Home
  • Raw
  • Download

Lines Matching refs:mem

23 static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size)  in pci_epc_mem_get_order()  argument
26 unsigned int page_shift = ilog2(mem->window.page_size); in pci_epc_mem_get_order()
51 struct pci_epc_mem *mem = NULL; in pci_epc_multi_mem_init() local
77 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in pci_epc_multi_mem_init()
78 if (!mem) { in pci_epc_multi_mem_init()
87 kfree(mem); in pci_epc_multi_mem_init()
92 mem->window.phys_base = windows[i].phys_base; in pci_epc_multi_mem_init()
93 mem->window.size = windows[i].size; in pci_epc_multi_mem_init()
94 mem->window.page_size = page_size; in pci_epc_multi_mem_init()
95 mem->bitmap = bitmap; in pci_epc_multi_mem_init()
96 mem->pages = pages; in pci_epc_multi_mem_init()
97 mutex_init(&mem->lock); in pci_epc_multi_mem_init()
98 epc->windows[i] = mem; in pci_epc_multi_mem_init()
101 epc->mem = epc->windows[0]; in pci_epc_multi_mem_init()
108 mem = epc->windows[i]; in pci_epc_multi_mem_init()
109 kfree(mem->bitmap); in pci_epc_multi_mem_init()
110 kfree(mem); in pci_epc_multi_mem_init()
140 struct pci_epc_mem *mem; in pci_epc_mem_exit() local
147 mem = epc->windows[i]; in pci_epc_mem_exit()
148 kfree(mem->bitmap); in pci_epc_mem_exit()
149 kfree(mem); in pci_epc_mem_exit()
154 epc->mem = NULL; in pci_epc_mem_exit()
172 struct pci_epc_mem *mem; in pci_epc_mem_alloc_addr() local
180 mem = epc->windows[i]; in pci_epc_mem_alloc_addr()
181 mutex_lock(&mem->lock); in pci_epc_mem_alloc_addr()
182 align_size = ALIGN(size, mem->window.page_size); in pci_epc_mem_alloc_addr()
183 order = pci_epc_mem_get_order(mem, align_size); in pci_epc_mem_alloc_addr()
185 pageno = bitmap_find_free_region(mem->bitmap, mem->pages, in pci_epc_mem_alloc_addr()
188 page_shift = ilog2(mem->window.page_size); in pci_epc_mem_alloc_addr()
189 *phys_addr = mem->window.phys_base + in pci_epc_mem_alloc_addr()
193 bitmap_release_region(mem->bitmap, in pci_epc_mem_alloc_addr()
195 mutex_unlock(&mem->lock); in pci_epc_mem_alloc_addr()
198 mutex_unlock(&mem->lock); in pci_epc_mem_alloc_addr()
201 mutex_unlock(&mem->lock); in pci_epc_mem_alloc_addr()
211 struct pci_epc_mem *mem; in pci_epc_get_matching_window() local
215 mem = epc->windows[i]; in pci_epc_get_matching_window()
217 if (phys_addr >= mem->window.phys_base && in pci_epc_get_matching_window()
218 phys_addr < (mem->window.phys_base + mem->window.size)) in pci_epc_get_matching_window()
219 return mem; in pci_epc_get_matching_window()
237 struct pci_epc_mem *mem; in pci_epc_mem_free_addr() local
243 mem = pci_epc_get_matching_window(epc, phys_addr); in pci_epc_mem_free_addr()
244 if (!mem) { in pci_epc_mem_free_addr()
249 page_size = mem->window.page_size; in pci_epc_mem_free_addr()
252 pageno = (phys_addr - mem->window.phys_base) >> page_shift; in pci_epc_mem_free_addr()
254 order = pci_epc_mem_get_order(mem, size); in pci_epc_mem_free_addr()
255 mutex_lock(&mem->lock); in pci_epc_mem_free_addr()
256 bitmap_release_region(mem->bitmap, pageno, order); in pci_epc_mem_free_addr()
257 mutex_unlock(&mem->lock); in pci_epc_mem_free_addr()