diff options
Diffstat (limited to 'boot/bootmeth_efi_mgr.c')
-rw-r--r-- | boot/bootmeth_efi_mgr.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c index 08d9328af4e..2f327c1f8ce 100644 --- a/boot/bootmeth_efi_mgr.c +++ b/boot/bootmeth_efi_mgr.c @@ -15,6 +15,22 @@ #include <command.h> #include <dm.h> +/** + * struct efi_mgr_priv - private info for the efi-mgr driver + * + * @fake_bootflow: Fake a valid bootflow for testing + */ +struct efi_mgr_priv { + bool fake_dev; +}; + +void sandbox_set_fake_efi_mgr_dev(struct udevice *dev, bool fake_dev) +{ + struct efi_mgr_priv *priv = dev_get_priv(dev); + + priv->fake_dev = fake_dev; +} + static int efi_mgr_check(struct udevice *dev, struct bootflow_iter *iter) { int ret; @@ -29,13 +45,16 @@ static int efi_mgr_check(struct udevice *dev, struct bootflow_iter *iter) static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow) { - /* - * Just assume there is something to boot since we don't have any way - * of knowing in advance - */ - bflow->state = BOOTFLOWST_READY; + struct efi_mgr_priv *priv = dev_get_priv(dev); - return 0; + if (priv->fake_dev) { + bflow->state = BOOTFLOWST_READY; + return 0; + } + + /* To be implemented */ + + return -EINVAL; } static int efi_mgr_read_file(struct udevice *dev, struct bootflow *bflow, @@ -84,4 +103,5 @@ U_BOOT_DRIVER(bootmeth_efi_mgr) = { .of_match = efi_mgr_bootmeth_ids, .ops = &efi_mgr_bootmeth_ops, .bind = bootmeth_efi_mgr_bind, + .priv_auto = sizeof(struct efi_mgr_priv), }; |