/* Check if the capsule binary supported */
ret = efi_capsule_supported(cap_info->header.guid,
cap_info->header.flags,
cap_info->header.imagesize,
&cap_info->reset_type); if (ret) {
pr_err("capsule not supported\n"); return ret;
}
/** *efi_capsule_setup_info-obtaintheeficapsuleheaderinthebinaryand *setupcapsule_infostructure *@cap_info:pointertocurrentinstanceofcapsule_infostructure *@kbuff:amappedfirstpagebufferpointer *@hdr_bytes:thetotalreceivednumberofbytesforefiheader * *Platformswithnon-standardcapsuleupdatemechanismscanoverride *this__weakfunctionsotheycanperformanyrequiredcapsule *imagemunging.Seequark_quirk_function()foranexample.
**/ int __weak efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
size_t hdr_bytes)
{ /* Only process data block that is larger than efi header size */ if (hdr_bytes < sizeof(efi_capsule_header_t)) return0;
/* Return error while NO_FURTHER_WRITE_ACTION is flagged */ if (cap_info->index < 0) return -EIO;
/* Only alloc a new page when previous page is full */ if (!cap_info->page_bytes_remain) {
page = alloc_page(GFP_KERNEL); if (!page) {
ret = -ENOMEM; goto failed;
}
/* Copy capsule binary data from user space to kernel space buffer */
write_byte = min_t(size_t, count, cap_info->page_bytes_remain); if (copy_from_user(kbuff, buff, write_byte)) {
ret = -EFAULT; goto fail_unmap;
}
cap_info->page_bytes_remain -= write_byte;
/* Setup capsule binary info structure */ if (cap_info->header.headersize == 0) {
ret = efi_capsule_setup_info(cap_info, kbuff - cap_info->count,
cap_info->count + write_byte); if (ret) goto fail_unmap;
}
cap_info->count += write_byte;
kunmap(page);
/* Submit the full binary to efi_capsule_update() API */ if (cap_info->header.headersize > 0 &&
cap_info->count >= cap_info->total_size) { if (cap_info->count > cap_info->total_size) {
pr_err("capsule upload size exceeded header defined size\n");
ret = -EINVAL; goto failed;
}
ret = efi_capsule_submit_update(cap_info); if (ret) goto failed;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.