1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Platform Firmware Runtime Update header
5 * Copyright(c) 2021 Intel Corporation. All rights reserved.
10 #include <linux/ioctl.h>
11 #include <linux/types.h>
13 #define PFRUT_IOCTL_MAGIC 0xEE
16 * PFRU_IOC_SET_REV - _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int)
20 * * -EFAULT - fail to read the revision id
21 * * -EINVAL - user provides an invalid revision id
23 * Set the Revision ID for Platform Firmware Runtime Update.
25 #define PFRU_IOC_SET_REV _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int)
28 * PFRU_IOC_STAGE - _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int)
32 * * -EINVAL - stage phase returns invalid result
34 * Stage a capsule image from communication buffer and perform authentication.
36 #define PFRU_IOC_STAGE _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int)
39 * PFRU_IOC_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int)
43 * * -EINVAL - activate phase returns invalid result
45 * Activate a previously staged capsule image.
47 #define PFRU_IOC_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int)
50 * PFRU_IOC_STAGE_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int)
54 * * -EINVAL - stage/activate phase returns invalid result.
56 * Perform both stage and activation action.
58 #define PFRU_IOC_STAGE_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int)
61 * PFRU_IOC_QUERY_CAP - _IOR(PFRUT_IOCTL_MAGIC, 0x05,
62 * struct pfru_update_cap_info)
66 * * -EINVAL - query phase returns invalid result
67 * * -EFAULT - the result fails to be copied to userspace
69 * Retrieve information on the Platform Firmware Runtime Update capability.
70 * The information is a struct pfru_update_cap_info.
72 #define PFRU_IOC_QUERY_CAP _IOR(PFRUT_IOCTL_MAGIC, 0x05, struct pfru_update_cap_info)
75 * struct pfru_payload_hdr - Capsule file payload header.
77 * @sig: Signature of this capsule file.
78 * @hdr_version: Revision of this header structure.
79 * @hdr_size: Size of this header, including the OemHeader bytes.
80 * @hw_ver: The supported firmware version.
81 * @rt_ver: Version of the code injection image.
82 * @platform_id: A platform specific GUID to specify the platform what
83 * this capsule image support.
85 struct pfru_payload_hdr
{
94 enum pfru_dsm_status
{
96 DSM_FUNC_NOT_SUPPORT
= 1,
99 DSM_RETRY_SUGGESTED
= 4,
101 DSM_FUNC_SPEC_ERR
= 6,
105 * struct pfru_update_cap_info - Runtime update capability information.
107 * @status: Indicator of whether this query succeed.
108 * @update_cap: Bitmap to indicate whether the feature is supported.
109 * @code_type: A buffer containing an image type GUID.
110 * @fw_version: Platform firmware version.
111 * @code_rt_version: Code injection runtime version for anti-rollback.
112 * @drv_type: A buffer containing an image type GUID.
113 * @drv_rt_version: The version of the driver update runtime code.
114 * @drv_svn: The secure version number(SVN) of the driver update runtime code.
115 * @platform_id: A buffer containing a platform ID GUID.
116 * @oem_id: A buffer containing an OEM ID GUID.
117 * @oem_info_len: Length of the buffer containing the vendor specific information.
119 struct pfru_update_cap_info
{
125 __u32 code_rt_version
;
128 __u32 drv_rt_version
;
131 __u8 platform_id
[16];
138 * struct pfru_com_buf_info - Communication buffer information.
140 * @status: Indicator of whether this query succeed.
141 * @ext_status: Implementation specific query result.
142 * @addr_lo: Low 32bit physical address of the communication buffer to hold
143 * a runtime update package.
144 * @addr_hi: High 32bit physical address of the communication buffer to hold
145 * a runtime update package.
146 * @buf_size: Maximum size in bytes of the communication buffer.
148 struct pfru_com_buf_info
{
157 * struct pfru_updated_result - Platform firmware runtime update result information.
158 * @status: Indicator of whether this update succeed.
159 * @ext_status: Implementation specific update result.
160 * @low_auth_time: Low 32bit value of image authentication time in nanosecond.
161 * @high_auth_time: High 32bit value of image authentication time in nanosecond.
162 * @low_exec_time: Low 32bit value of image execution time in nanosecond.
163 * @high_exec_time: High 32bit value of image execution time in nanosecond.
165 struct pfru_updated_result
{
169 __u64 high_auth_time
;
171 __u64 high_exec_time
;
175 * struct pfrt_log_data_info - Log Data from telemetry service.
176 * @status: Indicator of whether this update succeed.
177 * @ext_status: Implementation specific update result.
178 * @chunk1_addr_lo: Low 32bit physical address of the telemetry data chunk1
180 * @chunk1_addr_hi: High 32bit physical address of the telemetry data chunk1
182 * @chunk2_addr_lo: Low 32bit physical address of the telemetry data chunk2
184 * @chunk2_addr_hi: High 32bit physical address of the telemetry data chunk2
186 * @max_data_size: Maximum supported size of data of all data chunks combined.
187 * @chunk1_size: Data size in bytes of the telemetry data chunk1 buffer.
188 * @chunk2_size: Data size in bytes of the telemetry data chunk2 buffer.
189 * @rollover_cnt: Number of times telemetry data buffer is overwritten
190 * since telemetry buffer reset.
191 * @reset_cnt: Number of times telemetry services resets that results in
192 * rollover count and data chunk buffers are reset.
194 struct pfrt_log_data_info
{
197 __u64 chunk1_addr_lo
;
198 __u64 chunk1_addr_hi
;
199 __u64 chunk2_addr_lo
;
200 __u64 chunk2_addr_hi
;
209 * struct pfrt_log_info - Telemetry log information.
210 * @log_level: The telemetry log level.
211 * @log_type: The telemetry log type(history and execution).
212 * @log_revid: The telemetry log revision id.
214 struct pfrt_log_info
{
221 * PFRT_LOG_IOC_SET_INFO - _IOW(PFRUT_IOCTL_MAGIC, 0x06,
222 * struct pfrt_log_info)
226 * * -EFAULT - fail to get the setting parameter
227 * * -EINVAL - fail to set the log level
229 * Set the PFRT log level and log type. The input information is
230 * a struct pfrt_log_info.
232 #define PFRT_LOG_IOC_SET_INFO _IOW(PFRUT_IOCTL_MAGIC, 0x06, struct pfrt_log_info)
235 * PFRT_LOG_IOC_GET_INFO - _IOR(PFRUT_IOCTL_MAGIC, 0x07,
236 * struct pfrt_log_info)
240 * * -EINVAL - fail to get the log level
241 * * -EFAULT - fail to copy the result back to userspace
243 * Retrieve log level and log type of the telemetry. The information is
244 * a struct pfrt_log_info.
246 #define PFRT_LOG_IOC_GET_INFO _IOR(PFRUT_IOCTL_MAGIC, 0x07, struct pfrt_log_info)
249 * PFRT_LOG_IOC_GET_DATA_INFO - _IOR(PFRUT_IOCTL_MAGIC, 0x08,
250 * struct pfrt_log_data_info)
254 * * -EINVAL - fail to get the log buffer information
255 * * -EFAULT - fail to copy the log buffer information to userspace
257 * Retrieve data information about the telemetry. The information
258 * is a struct pfrt_log_data_info.
260 #define PFRT_LOG_IOC_GET_DATA_INFO _IOR(PFRUT_IOCTL_MAGIC, 0x08, struct pfrt_log_data_info)
262 #endif /* __PFRUT_H__ */