]> Git Repo - qemu.git/commitdiff
hw: register: Run post_write hook on reset
authorAlistair Francis <[email protected]>
Thu, 1 Mar 2018 11:05:43 +0000 (11:05 +0000)
committerPeter Maydell <[email protected]>
Thu, 1 Mar 2018 11:05:43 +0000 (11:05 +0000)
Ensure that the post write hook is called during reset. This allows us
to rely on the post write functions instead of having to call them from
the reset() function.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: d131e24b911653a945e46ca2d8f90f572469e1dd.1517856214[email protected]
Signed-off-by: Peter Maydell <[email protected]>
hw/core/register.c
include/hw/register.h

index 900294b9c435112b458680caba40bfd4a82348ba..0741a1af32aed100a223e09f8a255f074ee2ea86 100644 (file)
@@ -159,13 +159,21 @@ uint64_t register_read(RegisterInfo *reg, uint64_t re, const char* prefix,
 
 void register_reset(RegisterInfo *reg)
 {
+    const RegisterAccessInfo *ac;
+
     g_assert(reg);
 
     if (!reg->data || !reg->access) {
         return;
     }
 
+    ac = reg->access;
+
     register_write_val(reg, reg->access->reset);
+
+    if (ac->post_write) {
+        ac->post_write(reg, reg->access->reset);
+    }
 }
 
 void register_init(RegisterInfo *reg)
index de2414e6b482057b1dcef3fc9eb60b67a66f9e6b..5796584588b859ebccd8bb0ce278d62e5f82fbae 100644 (file)
@@ -34,7 +34,7 @@ typedef struct RegisterInfoArray RegisterInfoArray;
  * immediately before the actual write. The returned value is what is written,
  * giving the handler a chance to modify the written value.
  * @post_write: Post write callback. Passed the written value. Most write side
- * effects should be implemented here.
+ * effects should be implemented here. This is called during device reset.
  *
  * @post_read: Post read callback. Passes the value that is about to be returned
  * for a read. The return value from this function is what is ultimately read,
@@ -135,8 +135,8 @@ uint64_t register_read(RegisterInfo *reg, uint64_t re, const char* prefix,
                        bool debug);
 
 /**
- * reset a register
- * @reg: register to reset
+ * Resets a register. This will also call the post_write hook if it exists.
+ * @reg: The register to reset.
  */
 
 void register_reset(RegisterInfo *reg);
This page took 0.029524 seconds and 4 git commands to generate.