summaryrefslogtreecommitdiffstats
path: root/hw/nvram/fw_cfg.c
diff options
context:
space:
mode:
authorGabriel L. Somlo2015-06-08 20:10:44 +0200
committerGerd Hoffmann2015-06-10 08:00:37 +0200
commit1edd34b638f73d39a175fbc4f9ad5c97800d7470 (patch)
tree31c3020e05fadd3e3583b190c53da962d130467d /hw/nvram/fw_cfg.c
parentQemuOpts: increase number of vm_config_groups (diff)
downloadqemu-1edd34b638f73d39a175fbc4f9ad5c97800d7470.tar.gz
qemu-1edd34b638f73d39a175fbc4f9ad5c97800d7470.tar.xz
qemu-1edd34b638f73d39a175fbc4f9ad5c97800d7470.zip
fw_cfg: add fw_cfg_modify_i16 (update) method
Allow the ability to modify the value of an existing 16-bit integer fw_cfg item. Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/nvram/fw_cfg.c')
-rw-r--r--hw/nvram/fw_cfg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 68eff77983..08b5cc3ecc 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -484,6 +484,16 @@ void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value)
fw_cfg_add_bytes(s, key, copy, sizeof(value));
}
+void fw_cfg_modify_i16(FWCfgState *s, uint16_t key, uint16_t value)
+{
+ uint16_t *copy, *old;
+
+ copy = g_malloc(sizeof(value));
+ *copy = cpu_to_le16(value);
+ old = fw_cfg_modify_bytes_read(s, key, copy, sizeof(value));
+ g_free(old);
+}
+
void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value)
{
uint32_t *copy;