1 /*
2  * Copyright : (C) 2023 Phytium Information Technology, Inc.
3  * All Rights Reserved.
4  *
5  * This program is OPEN SOURCE software: you can redistribute it and/or modify it
6  * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
7  * either version 1.0 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the Phytium Public License for more details.
12  *
13  *
14  * FilePath: fpsci.h
15  * Created Date: 2023-06-21 16:13:14
16  * Last Modified: 2023-06-27 15:33:23
17  * Description:  This file is for
18  *
19  * Modify History:
20  *  Ver      Who        Date               Changes
21  * -----  ----------  --------  ---------------------------------
22  *  1.0     huanghe   2023-06-21        first release
23  */
24 
25 #ifndef FPSCI_H
26 #define FPSCI_H
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 #include "ftypes.h"
33 
34 /* 版本掩码 */
35 
36 #define FPSCI_VERSION_MASK 0x0000FFFF
37 #define FPSCI_MAJOR_VERSION(x) ((x) >> 16)
38 #define FPSCI_MINOR_VERSION(x) ((x) & 0xFFFF)
39 
40 /* Power State 参数 */
41 
42 #define FPSCI_POWER_STATE_ID_MASK            0xFFFF
43 #define FPSCI_POWER_STATE_ID_SHIFT           0
44 #define FPSCI_POWER_STATE_TYPE_SHIFT         16
45 #define FPSCI_POWER_STATE_AFFL_SHIFT         24
46 
47 /* stateid encoding */
48 #define FPSCI_STATEID_CORE_RETENTION    0x2
49 #define FPSCI_STATEID_CORE_POWERDOWN    0x8
50 
51 
52 /* 版本掩码 */
53 
54 #define FPSCI_VERSION_MASK 0x0000FFFF
55 
56 
57 /* 定义复位模式 */
58 
59 #define FPSCI_SYSTEM_RESET_TYPE_COLD  0
60 #define FPSCI_SYSTEM_RESET_TYPE_WARM  1
61 
62 /* 定义PSCI 错误码 */
63 
64 #define FPSCI_SUCCESS           0
65 #define FPSCI_NOT_SUPPORTED         -1
66 #define FPSCI_INVALID_PARAMS            -2
67 #define FPSCI_DENIED                -3
68 #define FPSCI_ALREADY_ON            -4
69 #define FPSCI_ON_PENDING            -5
70 #define FPSCI_INTERNAL_FAILURE      -6
71 #define FPSCI_NOT_PRESENT           -7
72 #define FPSCI_DISABLED          -8
73 #define FPSCI_INVALID_ADDRESS       -9
74 
75 int FPsciInit(void) ;
76 int FPsciVersion(void) ;
77 int FPsciCpuSuspend(u32 power_state, unsigned long entry_point_address, unsigned long context_id) ;
78 int FPsciCpuOn(unsigned long target_cpu, unsigned long entry_point_address, unsigned long context_id) ;
79 int FPsciAffinityInfo(unsigned long target_affinity, u32 lowest_affinity_level) ;
80 void FPsciSystemReset(u32 reset_type) ;
81 int FPsciFeatures(u32 psci_fid) ;
82 int FPsciCpuOff(void) ;
83 int FPsciCpuMaskOn(s32 cpu_id_mask, uintptr bootaddr) ;
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* __ASM_ARM_MACRO_H__ */
89 
90