1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     Power domain notification handling.
9  */
10 
11 #ifndef POWER_DOMAIN_NOTIFICATIONS_H
12 #define POWER_DOMAIN_NOTIFICATIONS_H
13 
14 #include <internal/power_domain.h>
15 
16 #include <mod_power_domain.h>
17 
18 #include <fwk_core.h>
19 #include <fwk_event.h>
20 #include <fwk_id.h>
21 
22 /*
23  * Process a notification recieved by the module.
24  *
25  * \param event Event to process.
26  * \param resp Response event.
27  *
28  * \returns One of the standard response codes.
29  */
30 int pd_process_notification(
31     const struct fwk_event *event,
32     struct fwk_event *resp);
33 
34 /*
35  * Process a response to the pre-shutdown notification.
36  *
37  * \returns One of the standard response codes.
38  */
39 int process_pre_shutdown_notification_response(void);
40 
41 /*
42  * Process a response to the pre-transition notification.
43  *
44  * \param pd Power domain description.
45  * \param params Pre-transition notification parameters.
46  *
47  * \returns One of the standard response codes.
48  */
49 int process_power_state_pre_transition_notification_response(
50     struct pd_ctx *pd,
51     struct mod_pd_power_state_pre_transition_notification_resp_params *params);
52 
53 /*
54  * Process a response to the state transition notification.
55  *
56  * \param pd Power domain description.
57  *
58  * \returns One of the standard response codes.
59  */
60 int process_power_state_transition_notification_response(struct pd_ctx *pd);
61 
62 /*
63  * Initiate a power state pre-transition notification if necessary.
64  *
65  * \param pd Description of the power domain to initiate the notification
66  *      for.
67  *
68  * \retval true Waiting for notification responses.
69  * \retval false Not waiting for any notification response.
70  */
71 bool initiate_power_state_pre_transition_notification(struct pd_ctx *pd);
72 
73 /*
74  * Send pre-shutdown notification.
75  *
76  * \param system_shutdown Type of shutdown being initiated.
77  *
78  * \retval true At least one notification sent.
79  * \retval false No notifications sent.
80  */
81 bool check_and_notify_system_shutdown(
82     enum mod_pd_system_shutdown system_shutdown);
83 
84 /*
85  * Send a warm reset notification.
86  *
87  * \return One of the standard return codes.
88  */
89 int notify_warm_reset(void);
90 
91 #endif /* POWER_DOMAIN_NOTIFICATIONS_H */
92