}
}
+struct fw_file *qemu_fwcfg_file_iter_init(struct fw_cfg_file_iter *iter)
+{
+ iter->entry = fw_list.next;
+ return list_entry(iter->entry, struct fw_file, list);
+}
+
+struct fw_file *qemu_fwcfg_file_iter_next(struct fw_cfg_file_iter *iter)
+{
+ iter->entry = iter->entry->next;
+ return list_entry(iter->entry, struct fw_file, list);
+}
+
+bool qemu_fwcfg_file_iter_end(struct fw_cfg_file_iter *iter)
+{
+ return iter->entry == &fw_list;
+}
+
static int qemu_fwcfg_list_firmware(void)
{
int ret;
- struct list_head *entry;
+ struct fw_cfg_file_iter iter;
struct fw_file *file;
/* make sure fw_list is loaded */
if (ret)
return ret;
- list_for_each(entry, &fw_list) {
- file = list_entry(entry, struct fw_file, list);
+
+ for (file = qemu_fwcfg_file_iter_init(&iter);
+ !qemu_fwcfg_file_iter_end(&iter);
+ file = qemu_fwcfg_file_iter_next(&iter)) {
printf("%-56s\n", file->cfg.name);
}
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;
*/
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