Lines Matching refs:cap_info
30 static void efi_free_all_buff_pages(struct capsule_info *cap_info) in efi_free_all_buff_pages() argument
32 while (cap_info->index > 0) in efi_free_all_buff_pages()
33 __free_page(cap_info->pages[--cap_info->index]); in efi_free_all_buff_pages()
35 cap_info->index = NO_FURTHER_WRITE_ACTION; in efi_free_all_buff_pages()
38 int __efi_capsule_setup_info(struct capsule_info *cap_info) in __efi_capsule_setup_info() argument
44 pages_needed = ALIGN(cap_info->total_size, PAGE_SIZE) / PAGE_SIZE; in __efi_capsule_setup_info()
52 ret = efi_capsule_supported(cap_info->header.guid, in __efi_capsule_setup_info()
53 cap_info->header.flags, in __efi_capsule_setup_info()
54 cap_info->header.imagesize, in __efi_capsule_setup_info()
55 &cap_info->reset_type); in __efi_capsule_setup_info()
61 temp_page = krealloc(cap_info->pages, in __efi_capsule_setup_info()
67 cap_info->pages = temp_page; in __efi_capsule_setup_info()
69 temp_page = krealloc(cap_info->phys, in __efi_capsule_setup_info()
75 cap_info->phys = temp_page; in __efi_capsule_setup_info()
91 int __weak efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff, in efi_capsule_setup_info() argument
98 memcpy(&cap_info->header, kbuff, sizeof(cap_info->header)); in efi_capsule_setup_info()
99 cap_info->total_size = cap_info->header.imagesize; in efi_capsule_setup_info()
101 return __efi_capsule_setup_info(cap_info); in efi_capsule_setup_info()
109 static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info) in efi_capsule_submit_update() argument
118 if (!cap_info->capsule) { in efi_capsule_submit_update()
119 cap_info->capsule = vmap(cap_info->pages, cap_info->index, in efi_capsule_submit_update()
121 if (!cap_info->capsule) in efi_capsule_submit_update()
126 ret = efi_capsule_update(cap_info->capsule, cap_info->phys); in efi_capsule_submit_update()
128 vunmap(cap_info->capsule); in efi_capsule_submit_update()
135 cap_info->index = NO_FURTHER_WRITE_ACTION; in efi_capsule_submit_update()
137 if (cap_info->header.flags & EFI_CAPSULE_PERSIST_ACROSS_RESET) { in efi_capsule_submit_update()
139 !cap_info->reset_type ? "RESET_COLD" : in efi_capsule_submit_update()
140 cap_info->reset_type == 1 ? "RESET_WARM" : in efi_capsule_submit_update()
172 struct capsule_info *cap_info = file->private_data; in efi_capsule_write() local
181 if (cap_info->index < 0) in efi_capsule_write()
185 if (!cap_info->page_bytes_remain) { in efi_capsule_write()
192 cap_info->pages[cap_info->index] = page; in efi_capsule_write()
193 cap_info->phys[cap_info->index] = page_to_phys(page); in efi_capsule_write()
194 cap_info->page_bytes_remain = PAGE_SIZE; in efi_capsule_write()
195 cap_info->index++; in efi_capsule_write()
197 page = cap_info->pages[cap_info->index - 1]; in efi_capsule_write()
201 kbuff += PAGE_SIZE - cap_info->page_bytes_remain; in efi_capsule_write()
204 write_byte = min_t(size_t, count, cap_info->page_bytes_remain); in efi_capsule_write()
209 cap_info->page_bytes_remain -= write_byte; in efi_capsule_write()
212 if (cap_info->header.headersize == 0) { in efi_capsule_write()
213 ret = efi_capsule_setup_info(cap_info, kbuff - cap_info->count, in efi_capsule_write()
214 cap_info->count + write_byte); in efi_capsule_write()
219 cap_info->count += write_byte; in efi_capsule_write()
223 if (cap_info->header.headersize > 0 && in efi_capsule_write()
224 cap_info->count >= cap_info->total_size) { in efi_capsule_write()
225 if (cap_info->count > cap_info->total_size) { in efi_capsule_write()
231 ret = efi_capsule_submit_update(cap_info); in efi_capsule_write()
241 efi_free_all_buff_pages(cap_info); in efi_capsule_write()
257 struct capsule_info *cap_info = file->private_data; in efi_capsule_flush() local
259 if (cap_info->index > 0) { in efi_capsule_flush()
261 efi_free_all_buff_pages(cap_info); in efi_capsule_flush()
278 struct capsule_info *cap_info = file->private_data; in efi_capsule_release() local
280 kfree(cap_info->pages); in efi_capsule_release()
281 kfree(cap_info->phys); in efi_capsule_release()
299 struct capsule_info *cap_info; in efi_capsule_open() local
301 cap_info = kzalloc(sizeof(*cap_info), GFP_KERNEL); in efi_capsule_open()
302 if (!cap_info) in efi_capsule_open()
305 cap_info->pages = kzalloc(sizeof(void *), GFP_KERNEL); in efi_capsule_open()
306 if (!cap_info->pages) { in efi_capsule_open()
307 kfree(cap_info); in efi_capsule_open()
311 cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL); in efi_capsule_open()
312 if (!cap_info->phys) { in efi_capsule_open()
313 kfree(cap_info->pages); in efi_capsule_open()
314 kfree(cap_info); in efi_capsule_open()
318 file->private_data = cap_info; in efi_capsule_open()