cmd: qfw: add API to iterate firmware list
This patch is part of the refactor work of qfw. It adds 3 APIs to qfw
core to iterate firmware list.
Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/include/qemu_fw_cfg.h b/include/qemu_fw_cfg.h
index e21f150..19d0ba0 100644
--- a/include/qemu_fw_cfg.h
+++ b/include/qemu_fw_cfg.h
@@ -87,6 +87,10 @@
struct list_head list; /* list node to link to fw_list */
};
+struct fw_cfg_file_iter {
+ struct list_head *entry; /* structure to iterate file list */
+};
+
struct fw_cfg_dma_access {
__be32 control;
__be32 length;
@@ -159,4 +163,9 @@
*/
int qemu_fwcfg_online_cpus(void);
+/* helper functions to iterate firmware file list */
+struct fw_file *qemu_fwcfg_file_iter_init(struct fw_cfg_file_iter *iter);
+struct fw_file *qemu_fwcfg_file_iter_next(struct fw_cfg_file_iter *iter);
+bool qemu_fwcfg_file_iter_end(struct fw_cfg_file_iter *iter);
+
#endif