1 /*
2 * Copyright (c) 2024, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7 
8 #ifndef __HOST_SYSTEM_H__
9 #define __HOST_SYSTEM_H__
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include <stdbool.h>
16 #include <stdint.h>
17 
18 /* Struct containing fixed data about the host system */
19 struct host_system_info_t {
20     /* chip ID of system */
21     uint32_t chip_id;
22     /* base address of the ap region on this chip */
23     uint64_t chip_ap_phys_base;
24 };
25 
26 /* Struct containing data about the current status of the host system */
27 struct host_system_status_t {
28     /* Whether the SCP has finished setting up the SYSTOP power domain */
29     volatile bool scp_systop_ready;
30 };
31 
32 /* Struct containing all data about the host system */
33 struct host_system_t {
34     /* Struct containing fixed data about the host system */
35     struct host_system_info_t info;
36     /* Struct containing data about the current status of the host system */
37     struct host_system_status_t status;
38     /* Whether or not this struct has been initialized */
39     bool initialized;
40 };
41 
42 /* Initialize host system by collecting fixed data about the host system */
43 int host_system_init(void);
44 
45 /* Get info struct containing fixed data about the host system */
46 int host_system_get_info(struct host_system_info_t **info);
47 
48 int host_system_prepare_ap_access(void);
49 
50 /* Prepares MSCP access for host system */
51 int host_system_prepare_mscp_access(void);
52 
53 void host_system_scp_signal_ap_ready(void);
54 
55 /* Finishes host system preparations */
56 int host_system_finish(void);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 #endif /* __HOST_SYSTEM_H__ */
62