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