1 // SPDX-License-Identifier: GPL-2.0+
3 * Bootdevice for system, used for bootmeths not tied to any partition device
5 * Copyright 2021 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
9 #define LOG_CATEGORY UCLASS_BOOTSTD
21 static int system_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
22 struct bootflow *bflow)
26 /* Must be an bootstd device */
27 ret = bootflow_iter_uses_system(iter);
29 return log_msg_ret("net", ret);
31 ret = bootmeth_check(bflow->method, iter);
33 return log_msg_ret("check", ret);
35 ret = bootmeth_read_bootflow(bflow->method, bflow);
37 return log_msg_ret("method", ret);
42 static int system_bootdev_bind(struct udevice *dev)
44 struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
46 ucp->prio = BOOTDEVP_6_SYSTEM;
51 struct bootdev_ops system_bootdev_ops = {
52 .get_bootflow = system_get_bootflow,
55 static const struct udevice_id system_bootdev_ids[] = {
56 { .compatible = "u-boot,bootdev-system" },
60 U_BOOT_DRIVER(system_bootdev) = {
61 .name = "system_bootdev",
63 .ops = &system_bootdev_ops,
64 .bind = system_bootdev_bind,
65 .of_match = system_bootdev_ids,