1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *      CMN650 Context structure Interface
9  */
10 
11 #ifndef INTERNAL_CMN650_CTX_H
12 #define INTERNAL_CMN650_CTX_H
13 
14 #include <cmn650.h>
15 
16 #include <mod_cmn650.h>
17 
18 #include <stdbool.h>
19 #include <stdint.h>
20 
21 struct cmn650_device_ctx {
22     const struct mod_cmn650_config *config;
23 
24     struct cmn650_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     uint64_t *sn_nodeid_group;
34 
35     /*
36      * External RN-SAMs. The driver keeps a list of tuples (node identifier and
37      * node pointers). The configuration of these nodes is via the SAM API.
38      */
39     unsigned int external_rnsam_count;
40     struct external_rnsam_tuple *external_rnsam_table;
41 
42     /*
43      * Internal RN-SAMs. The driver keeps a list of RN-SAM pointers to
44      * configure them once the system has been fully discovered and all
45      * parameters are known
46      */
47     unsigned int internal_rnsam_count;
48     struct cmn650_rnsam_reg **internal_rnsam_table;
49 
50     /* Count of RN Nodes for the use in CCIX programming */
51     unsigned int rnd_count;
52     unsigned int rnf_count;
53     unsigned int rni_count;
54 
55     /* CCIX specific members */
56 
57     /* Node count of CXG_RA, CXG_HA, CXLA nodes each. */
58     size_t ccix_node_count;
59 
60     /*
61      * CXG_RA register and node_id pairs. The driver keeps a list of tuples of
62      * pointers to the CXG_RA registers.
63      */
64     struct cxg_ra_reg_tuple *cxg_ra_reg_table;
65 
66     /*
67      * CXG_HA register and node_id pairs. The driver keeps a list of tuples of
68      * pointers to the CXG_HA registers.
69      */
70     struct cxg_ha_reg_tuple *cxg_ha_reg_table;
71 
72     /*
73      * CXLA register and node_id pairs. The driver keeps a list of tuples of
74      * pointers to the CXLA registers.
75      */
76     struct cxla_reg_tuple *cxla_reg_table;
77 
78     /*
79      * remote_rnf_ldid_value keeps track of the ldid of the remote RNF agents
80      * which are to be programmed on the HNF's RN_PHYS_ID registers.
81      */
82     unsigned int remote_rnf_ldid_value;
83 
84     /* Timer module API */
85     struct mod_timer_api *timer_api;
86 
87     bool initialized;
88 };
89 
90 #endif /* INTERNAL_CMN650_CTX_H */
91