Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812111/?format=api
{ "id": 812111, "url": "http://patchwork.ozlabs.org/api/patches/812111/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170910112149.21358-20-robdclark@gmail.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170910112149.21358-20-robdclark@gmail.com>", "list_archive_url": null, "date": "2017-09-10T11:21:36", "name": "[U-Boot,v2,10/21] efi_loader: refactor boot device and loaded_image handling", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fe7df45ae3d1526bea155684eb12f95f34116e8b", "submitter": { "id": 18760, "url": "http://patchwork.ozlabs.org/api/people/18760/?format=api", "name": "Rob Clark", "email": "robdclark@gmail.com" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170910112149.21358-20-robdclark@gmail.com/mbox/", "series": [ { "id": 2383, "url": "http://patchwork.ozlabs.org/api/series/2383/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2383", "date": "2017-09-10T11:21:17", "name": "efi_loader: enough UEFI for standard distro boot", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/2383/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812111/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812111/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UHYDqa4X\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xqprj0Zjbz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 21:35:17 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid D742CC21F5B; Sun, 10 Sep 2017 11:30:57 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 402A7C21F3C;\n\tSun, 10 Sep 2017 11:27:41 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 6ECC7C21F01; Sun, 10 Sep 2017 11:23:40 +0000 (UTC)", "from mail-qt0-f196.google.com (mail-qt0-f196.google.com\n\t[209.85.216.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 160F9C21E0F\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 11:23:33 +0000 (UTC)", "by mail-qt0-f196.google.com with SMTP id q8so4090410qtb.1\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 04:23:33 -0700 (PDT)", "from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tf20sm4477342qta.86.2017.09.10.04.23.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 10 Sep 2017 04:23:30 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=GKVPX3C6Z1ZPcvHI1fm+8gyMoefAOck5Gls/3FNNXDk=;\n\tb=UHYDqa4Xf4uq/MoXDYCfBKrsGnAPRHPLM0SVQE/YkTBJsk34xps4irqAt9XXavF+g5\n\t5qYJ8z6swj1SZh2jFAbAWIXSnVqoxdgF1EB2eA2qFq2PEKzvwbWREtS1Cjipoba6TfDv\n\tB5BlOjTTpuky2+km8dKSaNwBt8behqCcm8L3bQLiDcnBXgK9KtH+Ltpct7AtobEY3Rl3\n\tJ4RrGt34+YCwnBdnPeppxlqt79uGlGD8RjgiFYQvIrbQ427iTB7rLk0q5ktPgctzlk0U\n\twv3vt5hrxo9bpFxgGKFhgI3gfanUJlqnY8Z0LcdhbglI9QaUImaI0WC2nMyXztwVv4J3\n\tHZCg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=GKVPX3C6Z1ZPcvHI1fm+8gyMoefAOck5Gls/3FNNXDk=;\n\tb=fu7K8sG5ks/bGMoKELwuQ3HpiyEQfot41G//RPN476l6qWtn30Oq0/VhBoCSJSEbzY\n\tDyOYeGNVzymLeRExaJ/ENVm1tvy4XK7FtvkPiiuG3nrm42kgGbrdFQ2d98V3dskEG/il\n\tHVNQEaW1pxfjQNBtwvqtxjEmy/sL/Jl4vVooI1nMQ/HFHlLSeolyBJuO0ERt3h+bAgf9\n\tjtY9RRbUhoJ2aD6midRsHZnQfDcaZMGAeqMpAxqq4OMEE27us3LCN82H/MM48SpWjfQJ\n\tAOr/UnSPr+plDy9QEEMaiUjIl4d+Spn01vxpmoR07osvP1ip8aPctop/qbNQpsSRv3Av\n\tuPtA==", "X-Gm-Message-State": "AHPjjUjzYhkmpTp0Q9w8+79Sa9qKBRFzck4aGDKulj5QmYBDHxAyqopJ\n\tlFCdry7aeBCZwS49aKo=", "X-Google-Smtp-Source": "AOwi7QBQf4XoswbBELHY4e8CRrOJw2H5Zc+S4nbg8Wrg5RYmk8Ph3HVs8LYRx0NTaUzebf+9vCKzbg==", "X-Received": "by 10.237.36.205 with SMTP id u13mr12544966qtc.75.1505042611660; \n\tSun, 10 Sep 2017 04:23:31 -0700 (PDT)", "From": "Rob Clark <robdclark@gmail.com>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Sun, 10 Sep 2017 07:21:36 -0400", "Message-Id": "<20170910112149.21358-20-robdclark@gmail.com>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170910112149.21358-1-robdclark@gmail.com>", "References": "<20170910112149.21358-1-robdclark@gmail.com>", "Cc": "Heinrich Schuchardt <xypron.glpk@gmx.de>", "Subject": "[U-Boot] [PATCH v2 10/21] efi_loader: refactor boot device and\n\tloaded_image handling", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Get rid of the hacky fake boot-device and duplicate device-path\nconstructing (which needs to match what efi_disk and efi_net do).\nInstead convert over to use efi_device_path helpers to construct\ndevice-paths, and use that to look up the actual boot device.\n\nAlso, extract out a helper to plug things in properly to the\nloaded_image. In a following patch we'll want to re-use this in\nefi_load_image() to handle the case of loading an image from a\nfile_path.\n\nSigned-off-by: Rob Clark <robdclark@gmail.com>\n---\n cmd/bootefi.c | 201 +++++++++++++-----------------------------\n include/efi_loader.h | 5 +-\n lib/efi_loader/efi_boottime.c | 36 ++++++++\n lib/efi_loader/efi_net.c | 5 +-\n 4 files changed, 100 insertions(+), 147 deletions(-)", "diff": "diff --git a/cmd/bootefi.c b/cmd/bootefi.c\nindex 3196d86040..0980088668 100644\n--- a/cmd/bootefi.c\n+++ b/cmd/bootefi.c\n@@ -22,97 +22,14 @@ DECLARE_GLOBAL_DATA_PTR;\n \n static uint8_t efi_obj_list_initalized;\n \n-/*\n- * When booting using the \"bootefi\" command, we don't know which\n- * physical device the file came from. So we create a pseudo-device\n- * called \"bootefi\" with the device path /bootefi.\n- *\n- * In addition to the originating device we also declare the file path\n- * of \"bootefi\" based loads to be /bootefi.\n- */\n-static struct efi_device_path_file_path bootefi_image_path[] = {\n-\t{\n-\t\t.dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,\n-\t\t.dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,\n-\t\t.dp.length = sizeof(bootefi_image_path[0]),\n-\t\t.str = { 'b','o','o','t','e','f','i' },\n-\t}, {\n-\t\t.dp.type = DEVICE_PATH_TYPE_END,\n-\t\t.dp.sub_type = DEVICE_PATH_SUB_TYPE_END,\n-\t\t.dp.length = sizeof(bootefi_image_path[0]),\n-\t}\n-};\n-\n-static struct efi_device_path_file_path bootefi_device_path[] = {\n-\t{\n-\t\t.dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,\n-\t\t.dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,\n-\t\t.dp.length = sizeof(bootefi_image_path[0]),\n-\t\t.str = { 'b','o','o','t','e','f','i' },\n-\t}, {\n-\t\t.dp.type = DEVICE_PATH_TYPE_END,\n-\t\t.dp.sub_type = DEVICE_PATH_SUB_TYPE_END,\n-\t\t.dp.length = sizeof(bootefi_image_path[0]),\n-\t}\n-};\n-\n-/* The EFI loaded_image interface for the image executed via \"bootefi\" */\n-static struct efi_loaded_image loaded_image_info = {\n-\t.device_handle = bootefi_device_path,\n-\t.file_path = bootefi_image_path,\n-};\n-\n-/* The EFI object struct for the image executed via \"bootefi\" */\n-static struct efi_object loaded_image_info_obj = {\n-\t.handle = &loaded_image_info,\n-\t.protocols = {\n-\t\t{\n-\t\t\t/*\n-\t\t\t * When asking for the loaded_image interface, just\n-\t\t\t * return handle which points to loaded_image_info\n-\t\t\t */\n-\t\t\t.guid = &efi_guid_loaded_image,\n-\t\t\t.protocol_interface = &loaded_image_info,\n-\t\t},\n-\t\t{\n-\t\t\t/*\n-\t\t\t * When asking for the device path interface, return\n-\t\t\t * bootefi_device_path\n-\t\t\t */\n-\t\t\t.guid = &efi_guid_device_path,\n-\t\t\t.protocol_interface = bootefi_device_path,\n-\t\t},\n-\t\t{\n-\t\t\t.guid = &efi_guid_console_control,\n-\t\t\t.protocol_interface = (void *) &efi_console_control\n-\t\t},\n-\t\t{\n-\t\t\t.guid = &efi_guid_device_path_to_text_protocol,\n-\t\t\t.protocol_interface = (void *) &efi_device_path_to_text\n-\t\t},\n-\t},\n-};\n-\n-/* The EFI object struct for the device the \"bootefi\" image was loaded from */\n-static struct efi_object bootefi_device_obj = {\n-\t.handle = bootefi_device_path,\n-\t.protocols = {\n-\t\t{\n-\t\t\t/* When asking for the device path interface, return\n-\t\t\t * bootefi_device_path */\n-\t\t\t.guid = &efi_guid_device_path,\n-\t\t\t.protocol_interface = bootefi_device_path\n-\t\t}\n-\t},\n-};\n+static struct efi_device_path *bootefi_image_path;\n+static struct efi_device_path *bootefi_device_path;\n \n /* Initialize and populate EFI object list */\n static void efi_init_obj_list(void)\n {\n \tefi_obj_list_initalized = 1;\n \n-\tlist_add_tail(&loaded_image_info_obj.link, &efi_obj_list);\n-\tlist_add_tail(&bootefi_device_obj.link, &efi_obj_list);\n \tefi_console_register();\n #ifdef CONFIG_PARTITIONS\n \tefi_disk_register();\n@@ -121,13 +38,7 @@ static void efi_init_obj_list(void)\n \tefi_gop_register();\n #endif\n #ifdef CONFIG_NET\n-\tvoid *nethandle = loaded_image_info.device_handle;\n-\tefi_net_register(&nethandle);\n-\n-\tif (!memcmp(bootefi_device_path[0].str, \"N\\0e\\0t\", 6))\n-\t\tloaded_image_info.device_handle = nethandle;\n-\telse\n-\t\tloaded_image_info.device_handle = bootefi_device_path;\n+\tefi_net_register();\n #endif\n #ifdef CONFIG_GENERATE_SMBIOS_TABLE\n \tefi_smbios_register();\n@@ -210,14 +121,27 @@ static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)(\n * Load an EFI payload into a newly allocated piece of memory, register all\n * EFI objects it would want to access and jump to it.\n */\n-static unsigned long do_bootefi_exec(void *efi, void *fdt)\n+static unsigned long do_bootefi_exec(void *efi, void *fdt,\n+\t\t\t\t struct efi_device_path *device_path,\n+\t\t\t\t struct efi_device_path *image_path)\n {\n+\tstruct efi_loaded_image loaded_image_info = {};\n+\tstruct efi_object loaded_image_info_obj = {};\n+\tulong ret;\n+\n \tulong (*entry)(void *image_handle, struct efi_system_table *st)\n \t\tasmlinkage;\n \tulong fdt_pages, fdt_size, fdt_start, fdt_end;\n \tconst efi_guid_t fdt_guid = EFI_FDT_GUID;\n \tbootm_headers_t img = { 0 };\n \n+\t/* Initialize and populate EFI object list */\n+\tif (!efi_obj_list_initalized)\n+\t\tefi_init_obj_list();\n+\n+\tefi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj,\n+\t\t\t device_path, image_path);\n+\n \t/*\n \t * gd lives in a fixed register which may get clobbered while we execute\n \t * the payload. So save it here and restore it on every callback entry\n@@ -252,18 +176,18 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)\n \n \t/* Load the EFI payload */\n \tentry = efi_load_pe(efi, &loaded_image_info);\n-\tif (!entry)\n-\t\treturn -ENOENT;\n-\n-\t/* Initialize and populate EFI object list */\n-\tif (!efi_obj_list_initalized)\n-\t\tefi_init_obj_list();\n+\tif (!entry) {\n+\t\tret = -ENOENT;\n+\t\tgoto exit;\n+\t}\n \n \t/* Call our payload! */\n \tdebug(\"%s:%d Jumping to 0x%lx\\n\", __func__, __LINE__, (long)entry);\n \n \tif (setjmp(&loaded_image_info.exit_jmp)) {\n-\t\treturn loaded_image_info.exit_status;\n+\t\tret = loaded_image_info.exit_status;\n+\t\tEFI_EXIT(ret);\n+\t\tgoto exit;\n \t}\n \n #ifdef CONFIG_ARM64\n@@ -282,7 +206,13 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)\n \t}\n #endif\n \n-\treturn efi_do_enter(&loaded_image_info, &systab, entry);\n+\tret = efi_do_enter(&loaded_image_info, &systab, entry);\n+\n+exit:\n+\t/* image has returned, loaded-image obj goes *poof*: */\n+\tlist_del(&loaded_image_info_obj.link);\n+\n+\treturn ret;\n }\n \n \n@@ -315,7 +245,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n \t}\n \n \tprintf(\"## Starting EFI application at %08lx ...\\n\", addr);\n-\tr = do_bootefi_exec((void *)addr, (void*)fdt_addr);\n+\tr = do_bootefi_exec((void *)addr, (void *)fdt_addr,\n+\t\t\t bootefi_device_path, bootefi_image_path);\n \tprintf(\"## Application terminated, r = %lu\\n\",\n \t r & ~EFI_ERROR_MASK);\n \n@@ -344,58 +275,44 @@ U_BOOT_CMD(\n \tbootefi_help_text\n );\n \n-void efi_set_bootdev(const char *dev, const char *devnr, const char *path)\n+static int parse_partnum(const char *devnr)\n {\n-\t__maybe_unused struct blk_desc *desc;\n-\tchar devname[32] = { 0 }; /* dp->str is u16[32] long */\n-\tchar *colon, *s;\n-\n-#if defined(CONFIG_BLK) || CONFIG_IS_ENABLED(ISO_PARTITION)\n-\tdesc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));\n-#endif\n-\n-#ifdef CONFIG_BLK\n-\tif (desc) {\n-\t\tsnprintf(devname, sizeof(devname), \"%s\", desc->bdev->name);\n-\t} else\n-#endif\n-\n-\t{\n-\t\t/* Assemble the condensed device name we use in efi_disk.c */\n-\t\tsnprintf(devname, sizeof(devname), \"%s%s\", dev, devnr);\n+\tconst char *str = strchr(devnr, ':');\n+\tif (str) {\n+\t\tstr++;\n+\t\treturn simple_strtoul(str, NULL, 16);\n \t}\n+\treturn 0;\n+}\n \n-\tcolon = strchr(devname, ':');\n-\n-#if CONFIG_IS_ENABLED(ISO_PARTITION)\n-\t/* For ISOs we create partition block devices */\n-\tif (desc && (desc->type != DEV_TYPE_UNKNOWN) &&\n-\t (desc->part_type == PART_TYPE_ISO)) {\n-\t\tif (!colon)\n-\t\t\tsnprintf(devname, sizeof(devname), \"%s:1\", devname);\n+void efi_set_bootdev(const char *dev, const char *devnr, const char *path)\n+{\n+\tchar filename[32] = { 0 }; /* dp->str is u16[32] long */\n+\tchar *s;\n \n-\t\tcolon = NULL;\n-\t}\n-#endif\n+\tif (strcmp(dev, \"Net\")) {\n+\t\tstruct blk_desc *desc;\n+\t\tint part;\n \n-\tif (colon)\n-\t\t*colon = '\\0';\n+\t\tdesc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));\n+\t\tpart = parse_partnum(devnr);\n \n-\t/* Patch bootefi_device_path to the target device */\n-\tmemset(bootefi_device_path[0].str, 0, sizeof(bootefi_device_path[0].str));\n-\tascii2unicode(bootefi_device_path[0].str, devname);\n+\t\tbootefi_device_path = efi_dp_from_part(desc, part);\n+\t} else {\n+#ifdef CONFIG_NET\n+\t\tbootefi_device_path = efi_dp_from_eth();\n+#endif\n+\t}\n \n-\t/* Patch bootefi_image_path to the target file path */\n-\tmemset(bootefi_image_path[0].str, 0, sizeof(bootefi_image_path[0].str));\n \tif (strcmp(dev, \"Net\")) {\n \t\t/* Add leading / to fs paths, because they're absolute */\n-\t\tsnprintf(devname, sizeof(devname), \"/%s\", path);\n+\t\tsnprintf(filename, sizeof(filename), \"/%s\", path);\n \t} else {\n-\t\tsnprintf(devname, sizeof(devname), \"%s\", path);\n+\t\tsnprintf(filename, sizeof(filename), \"%s\", path);\n \t}\n \t/* DOS style file path: */\n-\ts = devname;\n+\ts = filename;\n \twhile ((s = strchr(s, '/')))\n \t\t*s++ = '\\\\';\n-\tascii2unicode(bootefi_image_path[0].str, devname);\n+\tbootefi_image_path = efi_dp_from_file(NULL, 0, filename);\n }\ndiff --git a/include/efi_loader.h b/include/efi_loader.h\nindex f39c2ee6da..ec8803f588 100644\n--- a/include/efi_loader.h\n+++ b/include/efi_loader.h\n@@ -136,7 +136,7 @@ int efi_disk_register(void);\n /* Called by bootefi to make GOP (graphical) interface available */\n int efi_gop_register(void);\n /* Called by bootefi to make the network interface available */\n-int efi_net_register(void **handle);\n+int efi_net_register(void);\n /* Called by bootefi to make SMBIOS tables available */\n void efi_smbios_register(void);\n \n@@ -193,6 +193,9 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,\n int efi_memory_init(void);\n /* Adds new or overrides configuration table entry to the system table */\n efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);\n+void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *obj,\n+\t\t\t struct efi_device_path *device_path,\n+\t\t\t struct efi_device_path *file_path);\n \n #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER\n extern void *efi_bounce_buffer;\ndiff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c\nindex b962b62a97..837e61d8fe 100644\n--- a/lib/efi_loader/efi_boottime.c\n+++ b/lib/efi_loader/efi_boottime.c\n@@ -726,6 +726,42 @@ static efi_status_t EFIAPI efi_install_configuration_table_ext(efi_guid_t *guid,\n \treturn EFI_EXIT(efi_install_configuration_table(guid, table));\n }\n \n+/* Initialize a loaded_image_info + loaded_image_info object with correct\n+ * protocols, boot-device, etc.\n+ */\n+void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *obj,\n+\t\t\t struct efi_device_path *device_path,\n+\t\t\t struct efi_device_path *file_path)\n+{\n+\tobj->handle = info;\n+\n+\t/*\n+\t * When asking for the device path interface, return\n+\t * bootefi_device_path\n+\t */\n+\tobj->protocols[0].guid = &efi_guid_device_path;\n+\tobj->protocols[0].protocol_interface = device_path;\n+\n+\t/*\n+\t * When asking for the loaded_image interface, just\n+\t * return handle which points to loaded_image_info\n+\t */\n+\tobj->protocols[1].guid = &efi_guid_loaded_image;\n+\tobj->protocols[1].protocol_interface = info;\n+\n+\tobj->protocols[2].guid = &efi_guid_console_control;\n+\tobj->protocols[2].protocol_interface = (void *)&efi_console_control;\n+\n+\tobj->protocols[3].guid = &efi_guid_device_path_to_text_protocol;\n+\tobj->protocols[3].protocol_interface =\n+\t\t(void *)&efi_device_path_to_text;\n+\n+\tinfo->file_path = file_path;\n+\tinfo->device_handle = efi_dp_find_obj(device_path, NULL);\n+\n+\tlist_add_tail(&obj->link, &efi_obj_list);\n+}\n+\n static efi_status_t EFIAPI efi_load_image(bool boot_policy,\n \t\t\t\t\t efi_handle_t parent_image,\n \t\t\t\t\t struct efi_device_path *file_path,\ndiff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c\nindex aa0618fd3a..91f1e4a69e 100644\n--- a/lib/efi_loader/efi_net.c\n+++ b/lib/efi_loader/efi_net.c\n@@ -207,7 +207,7 @@ void efi_net_set_dhcp_ack(void *pkt, int len)\n }\n \n /* This gets called from do_bootefi_exec(). */\n-int efi_net_register(void **handle)\n+int efi_net_register(void)\n {\n \tstruct efi_net_obj *netobj;\n \n@@ -253,8 +253,5 @@ int efi_net_register(void **handle)\n \t/* Hook net up to the device list */\n \tlist_add_tail(&netobj->parent.link, &efi_obj_list);\n \n-\tif (handle)\n-\t\t*handle = &netobj->net;\n-\n \treturn 0;\n }\n", "prefixes": [ "U-Boot", "v2", "10/21" ] }