From: Ben Warren ben@skyportsystems.com
When resuming from S3, only fw_cfg file keys are known.
Signed-off-by: Ben Warren ben@skyportsystems.com --- src/fw/paravirt.c | 23 +++++++++++++++++++++++ src/fw/paravirt.h | 2 ++ 2 files changed, 25 insertions(+)
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 4618647..e513dd5 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -352,6 +352,17 @@ qemu_cfg_write_file(void *src, struct romfile_s *file, u32 offset, u32 len) return len; }
+// Bare-bones function for writing a file knowing only its unique +// identifying key (select) +int +qemu_cfg_write_file_simple(void *src, u16 key, u32 offset, u32 len) +{ + qemu_cfg_select(key); + qemu_cfg_skip(offset); + qemu_cfg_write(src, len); + return len; +} + static void qemu_romfile_add(char *name, int select, int skip, int size) { @@ -370,6 +381,18 @@ qemu_romfile_add(char *name, int select, int skip, int size) }
u16 +qemu_get_romfile_key(struct romfile_s *file) +{ + struct qemu_romfile_s *qfile; + qfile = container_of(file, struct qemu_romfile_s, file); + if (!qfile) { + warn_internalerror(); + return 0; + } + return qfile->select; +} + +u16 qemu_get_present_cpus_count(void) { u16 smp_count = 0; diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h index fb220d8..16f3d9a 100644 --- a/src/fw/paravirt.h +++ b/src/fw/paravirt.h @@ -56,5 +56,7 @@ void qemu_cfg_init(void);
u16 qemu_get_present_cpus_count(void); int qemu_cfg_write_file(void *src, struct romfile_s *file, u32 offset, u32 len); +int qemu_cfg_write_file_simple(void *src, u16 key, u32 offset, u32 len); +u16 qemu_get_romfile_key(struct romfile_s *file);
#endif