1 // SPDX-License-Identifier: GPL-2.0+
3 * Bootmethod for EFI boot manager
5 * Copyright 2021 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
9 #define LOG_CATEGORY UCLASS_BOOTSTD
18 static int efi_mgr_check(struct udevice *dev, struct bootflow_iter *iter)
22 /* Must be an bootstd device */
23 ret = bootflow_iter_uses_system(iter);
25 return log_msg_ret("net", ret);
30 static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow)
33 * Just assume there is something to boot since we don't have any way
34 * of knowing in advance
36 bflow->state = BOOTFLOWST_READY;
41 static int efi_mgr_read_file(struct udevice *dev, struct bootflow *bflow,
42 const char *file_path, ulong addr, ulong *sizep)
44 /* Files are loaded by the 'bootefi bootmgr' command */
49 static int efi_mgr_boot(struct udevice *dev, struct bootflow *bflow)
53 /* Booting is handled by the 'bootefi bootmgr' command */
54 ret = run_command("bootefi bootmgr", 0);
59 static int bootmeth_efi_mgr_bind(struct udevice *dev)
61 struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev);
63 plat->desc = "EFI bootmgr flow";
68 static struct bootmeth_ops efi_mgr_bootmeth_ops = {
69 .check = efi_mgr_check,
70 .read_bootflow = efi_mgr_read_bootflow,
71 .read_file = efi_mgr_read_file,
75 static const struct udevice_id efi_mgr_bootmeth_ids[] = {
76 { .compatible = "u-boot,efi-bootmgr" },
80 U_BOOT_DRIVER(bootmeth_zefi_mgr) = {
81 .name = "bootmeth_efi_mgr",
82 .id = UCLASS_BOOTMETH,
83 .of_match = efi_mgr_bootmeth_ids,
84 .ops = &efi_mgr_bootmeth_ops,
85 .bind = bootmeth_efi_mgr_bind,