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 8 #ifndef MOD_SYSTEM_INFO_H 9 #define MOD_SYSTEM_INFO_H 10 11 #include <fwk_id.h> 12 13 #include <stdbool.h> 14 #include <stdint.h> 15 16 /*! 17 * \addtogroup GroupModules Modules 18 * \{ 19 */ 20 21 /*! 22 * \defgroup GroupModuleSystemInfo System Information Abstraction Module 23 * 24 * \brief HAL Module used to get System Information. 25 * 26 * \details This module provides an abstraction layer to the modules which 27 * need System Information. This module binds to the register interface 28 * driver module to obtain a pointer to the system information data. Module 29 * which requires system information data then can use the api provided 30 * by this module to get the generic system information. 31 * \{ 32 */ 33 34 /*! 35 * \brief Generic System Information 36 * 37 * \details This structure holds the generic information about the current 38 * system. The register interface module should define this structure 39 * and provide a pointer to this module. 40 */ 41 struct mod_system_info { 42 /*! Product identification number of the system */ 43 uint32_t product_id; 44 45 /*! Configuration number of the system */ 46 uint32_t config_id; 47 48 /*! Multi-chip mode tie-off value - enabled or disabled */ 49 bool multi_chip_mode; 50 51 /*! 52 * Chip id indicating unique identifier of the chip in a multi socket system 53 */ 54 uint8_t chip_id; 55 56 /*! Name of the system */ 57 const char *name; 58 }; 59 60 /*! 61 * \brief System Information configuration data 62 */ 63 struct mod_system_info_config { 64 /*! 65 * Module ID of the register interface driver module which provides a 66 * pointer to system information data. If the product does not support any 67 * driver, this can be set to FWK_ID_NONE. 68 */ 69 fwk_id_t system_info_driver_module_id; 70 71 /*! API ID for getting the system information data from the driver module */ 72 fwk_id_t system_info_driver_data_api_id; 73 }; 74 75 /*! 76 * \brief API structure to be defined by the driver module. 77 */ 78 struct mod_system_info_get_driver_data_api { 79 /*! 80 * \brief Get the system information data populated by the driver module. 81 * 82 * \details API to be implemented by the driver module which provides a 83 * pointer to the system information data. 84 * 85 * \retval NULL if the driver data is not initialized yet. 86 * \return Pointer to the system information driver data. 87 */ 88 struct mod_system_info *(*get_driver_data)(void); 89 }; 90 91 /*! 92 * \brief API structure used by the modules requesting for the system 93 * information data. 94 */ 95 struct mod_system_info_get_info_api { 96 /*! 97 * \brief Get system information data. 98 * 99 * \details API to be used by the module requesting for the system 100 * information data. 101 * 102 * \param[out] sys_info Pointer to the system information data. 103 * 104 * \retval ::FWK_SUCCESS if the sys_info pointer has been successfully set. 105 * \retval ::FWK_E_SUPPORT if the system information is not supported by the 106 * product. 107 */ 108 int (*get_system_info)(const struct mod_system_info **sys_info); 109 }; 110 111 /*! 112 * \brief Module API indicies. 113 */ 114 enum mod_system_info_api_idx { 115 MOD_SYSTEM_INFO_GET_API_IDX, 116 MOD_SYSTEM_INFO_API_COUNT 117 }; 118 119 /*! 120 * \} 121 */ 122 123 /*! 124 * \} 125 */ 126 127 #endif /* MOD_SYSTEM_INFO_H */ 128