xref: /openbmc/qemu/include/hw/core/resetcontainer.h (revision 839a88e8)
1 /*
2  * Reset container
3  *
4  * Copyright (c) 2024 Linaro, Ltd
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7  * See the COPYING file in the top-level directory.
8  */
9 
10 #ifndef HW_RESETCONTAINER_H
11 #define HW_RESETCONTAINER_H
12 
13 /*
14  * The "reset container" is an object which implements the Resettable
15  * interface. It contains a list of arbitrary other objects which also
16  * implement Resettable. Resetting the reset container resets all the
17  * objects in it.
18  */
19 
20 #include "qom/object.h"
21 
22 #define TYPE_RESETTABLE_CONTAINER "resettable-container"
23 OBJECT_DECLARE_TYPE(ResettableContainer, ResettableContainerClass, RESETTABLE_CONTAINER)
24 
25 /**
26  * resettable_container_add: Add a resettable object to the container
27  * @rc: container
28  * @obj: object to add to the container
29  *
30  * Add @obj to the ResettableContainer @rc. @obj must implement the
31  * Resettable interface.
32  *
33  * When @rc is reset, it will reset every object that has been added
34  * to it, in the order they were added.
35  */
36 void resettable_container_add(ResettableContainer *rc, Object *obj);
37 
38 /**
39  * resettable_container_remove: Remove an object from the container
40  * @rc: container
41  * @obj: object to remove from the container
42  *
43  * Remove @obj from the ResettableContainer @rc. @obj must have been
44  * previously added to this container.
45  */
46 void resettable_container_remove(ResettableContainer *rc, Object *obj);
47 
48 #endif
49