bootstd: Add support for bootflows

Add support for bootflows, including maintaining a list of them and
iterating to find them.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2022-04-24 23:31:09 -06:00 committed by Tom Rini
parent a950d31abe
commit a8f5be178d
6 changed files with 475 additions and 3 deletions

View file

@ -10,6 +10,7 @@
#include <dm.h>
#include <bootdev.h>
#include <bootflow.h>
#include <bootmeth.h>
#include <bootstd.h>
#include <env.h>
#include <fs.h>
@ -130,6 +131,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
bflow->part = iter->part;
ret = bootmeth_check(bflow->method, iter);
if (ret)
return log_msg_ret("check", ret);
/*
* partition numbers start at 0 so this cannot succeed, but it can tell
* us whether there is valid media there
@ -171,6 +176,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
bflow->state = BOOTFLOWST_FS;
}
ret = bootmeth_read_bootflow(bflow->method, bflow);
if (ret)
return log_msg_ret("method", ret);
return 0;
}
@ -445,7 +454,7 @@ void bootdev_clear_bootflows(struct udevice *dev)
bflow = list_first_entry(&ucp->bootflow_head, struct bootflow,
bm_node);
/* later bootflow_remove(bflow); */
bootflow_remove(bflow);
}
}