1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include <tc2_mock_psu.h>
9 #include <tc2_psu.h>
10 
11 #include <mod_mock_psu.h>
12 #include <mod_psu.h>
13 
14 #include <fwk_element.h>
15 #include <fwk_module.h>
16 #include <fwk_module_idx.h>
17 
18 static const struct fwk_element element_table[PSU_ELEMENT_IDX_COUNT + 1] = {
19     [PSU_ELEMENT_IDX_HAYES] = {
20         .name = "PSU_GROUP_HAYES",
21         .data =
22             &(const struct mod_psu_element_cfg){
23                 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_PSU,
24                     MOCK_PSU_ELEMENT_IDX_HAYES),
25                 .driver_api_id = FWK_ID_API_INIT(
26                     FWK_MODULE_IDX_MOCK_PSU,
27                     MOD_MOCK_PSU_API_IDX_DRIVER) },
28     },
29     [PSU_ELEMENT_IDX_HUNTER] = {
30         .name = "PSU_GROUP_HUNTER",
31         .data =
32             &(const struct mod_psu_element_cfg){
33                 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_PSU,
34                     MOCK_PSU_ELEMENT_IDX_HUNTER),
35                 .driver_api_id = FWK_ID_API_INIT(
36                     FWK_MODULE_IDX_MOCK_PSU,
37                     MOD_MOCK_PSU_API_IDX_DRIVER) },
38     },
39     [PSU_ELEMENT_IDX_HUNTER_ELP] = {
40         .name = "PSU_GROUP_HUNTER_ELP",
41         .data =
42             &(const struct mod_psu_element_cfg){
43                 .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_MOCK_PSU,
44                     MOCK_PSU_ELEMENT_IDX_HUNTER_ELP),
45                 .driver_api_id = FWK_ID_API_INIT(
46                     FWK_MODULE_IDX_MOCK_PSU,
47                     MOD_MOCK_PSU_API_IDX_DRIVER) },
48     },
49     { 0 }
50 };
51 
psu_get_element_table(fwk_id_t module_id)52 static const struct fwk_element *psu_get_element_table(fwk_id_t module_id)
53 {
54     return element_table;
55 }
56 
57 const struct fwk_module_config config_psu = {
58     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(psu_get_element_table),
59 };
60