1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef MOD_SID_H
9 #define MOD_SID_H
10 
11 #include <mod_pcid.h>
12 
13 #include <fwk_id.h>
14 #include <fwk_module_idx.h>
15 
16 #include <stdbool.h>
17 #include <stdint.h>
18 
19 /*!
20  * \addtogroup GroupModules Modules
21  * \{
22  */
23 
24 /*!
25  * \defgroup GroupModuleSID System Identification (SID)
26  *
27  * \brief Module used to interface with the SID register set.
28  *
29  * \details This module uses the SID register set to get information about the
30  *     subsystem that the firmware is running on. \{
31  */
32 
33 /*!
34  * \brief System information
35  */
36 struct mod_sid_info {
37     /*! Major revision number of the subsystem */
38     unsigned int system_major_revision;
39 
40     /*! Minor revision number of the subsystem */
41     unsigned int system_minor_revision;
42 
43     /*! Designer ID of the subsystem */
44     unsigned int system_designer_id;
45 
46     /*! Part number of the subsystem */
47     unsigned int system_part_number;
48 
49     /*! Major revision number of the SoC */
50     unsigned int soc_major_revision;
51 
52     /*! Minor revision number of the SoC */
53     unsigned int soc_minor_revision;
54 
55     /*! Designer ID of the SoC */
56     unsigned int soc_designer_id;
57 
58     /*! Part number of the SoC */
59     unsigned int soc_part_number;
60 
61     /*! Multi-chip mode tie-off value - enabled or disabled */
62     bool multi_chip_mode;
63 
64     /*! Node number indicating the chip id in multi socket system */
65     uint8_t node_number;
66 
67     /*! Configuration number of the subsystem */
68     unsigned int config_number;
69 
70     /*! Name of the subsystem */
71     const char *name;
72 
73     /*! Element index of the subsystem */
74     unsigned int system_idx;
75 };
76 
77 /*!
78  * \brief Module configuration.
79  */
80 struct mod_sid_config {
81     /*! Base address of the SID registers. */
82     uintptr_t sid_base;
83 
84     /*! Expected values of the PID and CID registers */
85     struct mod_pcid_registers pcid_expected;
86 };
87 
88 /*!
89  * \brief Subsystem configuration.
90  */
91 struct mod_sid_subsystem_config {
92     unsigned int part_number; /*!< Part number of the subsystem */
93 };
94 
95 /*!
96  * \brief Module interface.
97  */
98 
99 /*!
100  * \brief Get a pointer to the structure holding the system information.
101  *
102  * \param[out] system_info Pointer to the system information data.
103  *
104  * \retval ::FWK_SUCCESS The pointer was returned successfully.
105  * \retval ::FWK_E_INIT The system information is not initialized.
106  */
107 int mod_sid_get_system_info(const struct mod_sid_info **system_info);
108 
109 /*!
110  * \brief Module API indices.
111  */
112 enum mod_sid_api_idx {
113     MOD_SID_SYSTEM_INFO_DRIVER_DATA_API_IDX,
114     MOD_SID_API_COUNT
115 };
116 
117 /*!
118  * \}
119  */
120 
121 /*!
122  * \}
123  */
124 
125 #endif /* MOD_SID_H */
126