1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *      CMN700 Context structure Interface
9  */
10 
11 #ifndef INTERNAL_CMN700_CTX_H
12 #define INTERNAL_CMN700_CTX_H
13 
14 #include <cmn700.h>
15 
16 #include <mod_cmn700.h>
17 
18 #include <stdbool.h>
19 #include <stdint.h>
20 
21 struct cmn700_device_ctx {
22     const struct mod_cmn700_config *config;
23 
24     struct cmn700_cfgm_reg *root;
25 
26     /* Number of HN-F (system cache) nodes in the system */
27     unsigned int hnf_count;
28 
29     /* Pointer to list of HN-F nodes for use in CCIX programming */
30     uintptr_t *hnf_node;
31 
32     uint64_t *hnf_cache_group;
33 
34     /*
35      * External RN-SAMs. The driver keeps a list of tuples (node identifier and
36      * node pointers). The configuration of these nodes is via the SAM API.
37      */
38     unsigned int external_rnsam_count;
39     struct external_rnsam_tuple *external_rnsam_table;
40 
41     /*
42      * Internal RN-SAMs. The driver keeps a list of RN-SAM pointers to
43      * configure them once the system has been fully discovered and all
44      * parameters are known
45      */
46     unsigned int internal_rnsam_count;
47     struct cmn700_rnsam_reg **internal_rnsam_table;
48 
49     /* Count of RN Nodes for the use in CCIX programming */
50     unsigned int rnd_count;
51     unsigned int rnf_count;
52     unsigned int rni_count;
53 
54     /* CCG specific members */
55 
56     /* Node count of CCG_RA, CCG_HA, CCLA nodes each. */
57     size_t ccg_node_count;
58 
59     /*
60      * CCG_RA register and node_id pairs. The driver keeps a list of tuples of
61      * pointers to the CCG_RA registers.
62      */
63     struct ccg_ra_reg_tuple *ccg_ra_reg_table;
64 
65     /*
66      * CCG_HA register and node_id pairs. The driver keeps a list of tuples of
67      * pointers to the CCG_HA registers.
68      */
69     struct ccg_ha_reg_tuple *ccg_ha_reg_table;
70 
71     /*
72      * CCLA register and node_id pairs. The driver keeps a list of tuples of
73      * pointers to the CXLA registers.
74      */
75     struct ccla_reg_tuple *ccla_reg_table;
76 
77     /*
78      * remote_rnf_ldid_value keeps track of the ldid of the remote RNF agents
79      * which are to be programmed on the HNF's RN_PHYS_ID registers.
80      */
81     unsigned int remote_rnf_ldid_value;
82 
83     /* Timer module API */
84     struct mod_timer_api *timer_api;
85 
86     bool initialized;
87 };
88 
89 #endif /* INTERNAL_CMN700_CTX_H */
90