After software has authenticated a dynamic boost control request, it can fetch and set supported parameters using a selection of messages. Add support for these messages and export the ability to do this to userspace.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -45,6 +45,23 @@ struct dbc_user_setuid { · 44 unmodified lines | ||
| 45 | 45 | __u8 signature[DBC_SIG_SIZE]; |
| 46 | 46 | } __packed; |
| 47 | 47 | |
| 48 | +/** | |
| 49 | + * struct dbc_user_param - Parameter exchange structure (input/output). | |
| 50 | + * @msg_index: Message indicating what parameter to set or get (input) | |
| 51 | + * @param: 4 byte parameter, units are message specific. (input/output) | |
| 52 | + * @signature: 32 byte signature. | |
| 53 | + * - When sending a message this is to be created by software | |
| 54 | + * using a previous nonce (input) | |
| 55 | + * - For interpreting results, this signature is updated by the | |
| 56 | + * PSP to allow software to validate the authenticity of the | |
| 57 | + * results. | |
| 58 | + */ | |
| 59 | +struct dbc_user_param { | |
| 60 | + __u32 msg_index; | |
| 61 | + __u32 param; | |
| 62 | + __u8 signature[DBC_SIG_SIZE]; | |
| 63 | +} __packed; | |
| 64 | + | |
| 48 | 65 | /** |
| 49 | 66 | * Dynamic Boost Control (DBC) IOC |
| 50 | 67 | * |
| @@ -84,4 +101,47 @@ struct dbc_user_setuid { · 33 unmodified lines | ||
| 84 | 101 | */ |
| 85 | 102 | #define DBCIOCUID _IOW(DBC_IOC_TYPE, 0x2, struct dbc_user_setuid) |
| 86 | 103 | |
| 104 | +/** | |
| 105 | + * DBCIOCPARAM - Set or get a parameter from the PSP. | |
| 106 | + * This request will only work after DBCIOCUID has successfully | |
| 107 | + * set the UID of the calling process. | |
| 108 | + * Whether the parameter is set or get is controlled by the | |
| 109 | + * message ID in the request. | |
| 110 | + * This command must be sent using a 32 byte signature built | |
| 111 | + * using the nonce fetched from DBCIOCNONCE. | |
| 112 | + * When the command succeeds, the 32 byte signature will be | |
| 113 | + * updated by the PSP for software to authenticate the results. | |
| 114 | + */ | |
| 115 | +#define DBCIOCPARAM _IOWR(DBC_IOC_TYPE, 0x3, struct dbc_user_param) | |
| 116 | + | |
| 117 | +/** | |
| 118 | + * enum dbc_cmd_msg - Messages utilized by DBCIOCPARAM | |
| 119 | + * @PARAM_GET_FMAX_CAP: Get frequency cap (MHz) | |
| 120 | + * @PARAM_SET_FMAX_CAP: Set frequency cap (MHz) | |
| 121 | + * @PARAM_GET_PWR_CAP: Get socket power cap (mW) | |
| 122 | + * @PARAM_SET_PWR_CAP: Set socket power cap (mW) | |
| 123 | + * @PARAM_GET_GFX_MODE: Get graphics mode (0/1) | |
| 124 | + * @PARAM_SET_GFX_MODE: Set graphics mode (0/1) | |
| 125 | + * @PARAM_GET_CURR_TEMP: Get current temperature (degrees C) | |
| 126 | + * @PARAM_GET_FMAX_MAX: Get maximum allowed value for frequency (MHz) | |
| 127 | + * @PARAM_GET_FMAX_MIN: Get minimum allowed value for frequency (MHz) | |
| 128 | + * @PARAM_GET_SOC_PWR_MAX: Get maximum allowed value for SoC power (mw) | |
| 129 | + * @PARAM_GET_SOC_PWR_MIN: Get minimum allowed value for SoC power (mw) | |
| 130 | + * @PARAM_GET_SOC_PWR_CUR: Get current value for SoC Power (mW) | |
| 131 | + */ | |
| 132 | +enum dbc_cmd_msg { | |
| 133 | + PARAM_GET_FMAX_CAP = 0x3, | |
| 134 | + PARAM_SET_FMAX_CAP = 0x4, | |
| 135 | + PARAM_GET_PWR_CAP = 0x5, | |
| 136 | + PARAM_SET_PWR_CAP = 0x6, | |
| 137 | + PARAM_GET_GFX_MODE = 0x7, | |
| 138 | + PARAM_SET_GFX_MODE = 0x8, | |
| 139 | + PARAM_GET_CURR_TEMP = 0x9, | |
| 140 | + PARAM_GET_FMAX_MAX = 0xA, | |
| 141 | + PARAM_GET_FMAX_MIN = 0xB, | |
| 142 | + PARAM_GET_SOC_PWR_MAX = 0xC, | |
| 143 | + PARAM_GET_SOC_PWR_MIN = 0xD, | |
| 144 | + PARAM_GET_SOC_PWR_CUR = 0xE, | |
| 145 | +}; | |
| 146 | + | |
| 87 | 147 | #endif /* __PSP_DBC_USER_H__ */ |