Lines Matching refs:kbuf
243 * for the buffer. If found, sets kbuf->mem.
244 * @kbuf: Buffer contents and memory parameters.
250 static int __locate_mem_hole_top_down(struct kexec_buf *kbuf,
278 start = ALIGN(start, kbuf->buf_align);
279 if (start < end && (end - start + 1) >= kbuf->memsz) {
280 /* Suitable memory range found. Set kbuf->mem */
281 kbuf->mem = ALIGN_DOWN(end - kbuf->memsz + 1,
282 kbuf->buf_align);
294 * @kbuf: Buffer contents and memory parameters.
301 static int locate_mem_hole_top_down_ppc64(struct kexec_buf *kbuf,
318 ret = __locate_mem_hole_top_down(kbuf, tmin, tmax);
334 ret = __locate_mem_hole_top_down(kbuf, tmin, tmax);
342 * for the buffer. If found, sets kbuf->mem.
343 * @kbuf: Buffer contents and memory parameters.
349 static int __locate_mem_hole_bottom_up(struct kexec_buf *kbuf,
377 start = ALIGN(start, kbuf->buf_align);
378 if (start < end && (end - start + 1) >= kbuf->memsz) {
379 /* Suitable memory range found. Set kbuf->mem */
380 kbuf->mem = start;
392 * @kbuf: Buffer contents and memory parameters.
399 static int locate_mem_hole_bottom_up_ppc64(struct kexec_buf *kbuf,
416 ret = __locate_mem_hole_bottom_up(kbuf, tmin, tmax);
432 ret = __locate_mem_hole_bottom_up(kbuf, tmin, tmax);
722 * @kbuf: Buffer contents and memory parameters.
726 static int load_backup_segment(struct kimage *image, struct kexec_buf *kbuf)
743 kbuf->buffer = buf;
744 kbuf->mem = KEXEC_BUF_MEM_UNKNOWN;
745 kbuf->bufsz = kbuf->memsz = BACKUP_SRC_SIZE;
746 kbuf->top_down = false;
748 ret = kexec_add_buffer(kbuf);
755 image->arch.backup_start = kbuf->mem;
790 * @kbuf: Buffer contents and memory parameters.
794 static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf)
815 kbuf->buffer = headers;
816 kbuf->mem = KEXEC_BUF_MEM_UNKNOWN;
817 kbuf->bufsz = kbuf->memsz = headers_sz;
818 kbuf->top_down = false;
820 ret = kexec_add_buffer(kbuf);
826 image->elf_load_addr = kbuf->mem;
838 * @kbuf: Buffer contents and memory parameters.
843 struct kexec_buf *kbuf)
848 ret = load_backup_segment(image, kbuf);
853 pr_debug("Loaded the backup region at 0x%lx\n", kbuf->mem);
856 ret = load_elfcorehdr_segment(image, kbuf);
862 image->elf_load_addr, kbuf->bufsz, kbuf->memsz);
1253 * segment buffer. Sets kbuf->mem when a suitable
1255 * @kbuf: Buffer contents and memory parameters.
1257 * Assumes minimum of PAGE_SIZE alignment for kbuf->memsz & kbuf->buf_align.
1261 int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
1268 emem = &(kbuf->image->arch.exclude_ranges);
1271 return kexec_locate_mem_hole(kbuf);
1274 buf_min = kbuf->buf_min;
1275 buf_max = kbuf->buf_max;
1277 if (kbuf->image->type == KEXEC_TYPE_CRASH) {
1289 if (kbuf->top_down)
1290 ret = locate_mem_hole_top_down_ppc64(kbuf, buf_min, buf_max,
1293 ret = locate_mem_hole_bottom_up_ppc64(kbuf, buf_min, buf_max,
1298 add_mem_range(emem, kbuf->mem, kbuf->memsz);
1302 kbuf->memsz);