History

ACPI: Introduce Platform Firmware Runtime Update device driver

Introduce the pfr_update driver which can be used for Platform Firmware Runtime code injection and driver update [1]. The user is expected to provide the EFI capsule, and pass it to the driver by writing the capsule to a device special file. The capsule is transferred by the driver to the platform firmware with the help of an ACPI _DSM method under the special ACPI Platform Firmware Runtime Update device (INTC1080), and the actual firmware update is carried out by the low-level Management Mode code in the platform firmware. This change allows certain pieces of the platform firmware to be updated on the fly while the system is running (runtime) without the need to restart it, which is key in the cases when the system needs to be available 100% of the time and it cannot afford the downtime related to restarting it, or when the work carried out by the system is particularly important, so it cannot be interrupted, and it is not practical to wait until it is complete.

Chen Yu committed 4 years ago

Commit 0db89fa1 parent 1882de75 files · +769 −0Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/pfrut.h+174−0
@@ -0,0 +1,174 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Platform Firmware Runtime Update header
4 *
5 * Copyright(c) 2021 Intel Corporation. All rights reserved.
6 */
7#ifndef __PFRUT_H__
8#define __PFRUT_H__
9
10#include <linux/ioctl.h>
11#include <linux/types.h>
12
13#define PFRUT_IOCTL_MAGIC 0xEE
14
15/**
16 * PFRU_IOC_SET_REV - _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int)
17 *
18 * Return:
19 * * 0 - success
20 * * -EFAULT - fail to read the revision id
21 * * -EINVAL - user provides an invalid revision id
22 *
23 * Set the Revision ID for Platform Firmware Runtime Update.
24 */
25#define PFRU_IOC_SET_REV _IOW(PFRUT_IOCTL_MAGIC, 0x01, unsigned int)
26
27/**
28 * PFRU_IOC_STAGE - _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int)
29 *
30 * Return:
31 * * 0 - success
32 * * -EINVAL - stage phase returns invalid result
33 *
34 * Stage a capsule image from communication buffer and perform authentication.
35 */
36#define PFRU_IOC_STAGE _IOW(PFRUT_IOCTL_MAGIC, 0x02, unsigned int)
37
38/**
39 * PFRU_IOC_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int)
40 *
41 * Return:
42 * * 0 - success
43 * * -EINVAL - activate phase returns invalid result
44 *
45 * Activate a previously staged capsule image.
46 */
47#define PFRU_IOC_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x03, unsigned int)
48
49/**
50 * PFRU_IOC_STAGE_ACTIVATE - _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int)
51 *
52 * Return:
53 * * 0 - success
54 * * -EINVAL - stage/activate phase returns invalid result.
55 *
56 * Perform both stage and activation action.
57 */
58#define PFRU_IOC_STAGE_ACTIVATE _IOW(PFRUT_IOCTL_MAGIC, 0x04, unsigned int)
59
60/**
61 * PFRU_IOC_QUERY_CAP - _IOR(PFRUT_IOCTL_MAGIC, 0x05,
62 * struct pfru_update_cap_info)
63 *
64 * Return:
65 * * 0 - success
66 * * -EINVAL - query phase returns invalid result
67 * * -EFAULT - the result fails to be copied to userspace
68 *
69 * Retrieve information on the Platform Firmware Runtime Update capability.
70 * The information is a struct pfru_update_cap_info.
71 */
72#define PFRU_IOC_QUERY_CAP _IOR(PFRUT_IOCTL_MAGIC, 0x05, struct pfru_update_cap_info)
73
74/**
75 * struct pfru_payload_hdr - Capsule file payload header.
76 *
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.
84 */
85struct pfru_payload_hdr {
86 __u32 sig;
87 __u32 hdr_version;
88 __u32 hdr_size;
89 __u32 hw_ver;
90 __u32 rt_ver;
91 __u8 platform_id[16];
92};
93
94enum pfru_dsm_status {
95 DSM_SUCCEED = 0,
96 DSM_FUNC_NOT_SUPPORT = 1,
97 DSM_INVAL_INPUT = 2,
98 DSM_HARDWARE_ERR = 3,
99 DSM_RETRY_SUGGESTED = 4,
100 DSM_UNKNOWN = 5,
101 DSM_FUNC_SPEC_ERR = 6,
102};
103
104/**
105 * struct pfru_update_cap_info - Runtime update capability information.
106 *
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.
118 */
119struct pfru_update_cap_info {
120 __u32 status;
121 __u32 update_cap;
122
123 __u8 code_type[16];
124 __u32 fw_version;
125 __u32 code_rt_version;
126
127 __u8 drv_type[16];
128 __u32 drv_rt_version;
129 __u32 drv_svn;
130
131 __u8 platform_id[16];
132 __u8 oem_id[16];
133
134 __u32 oem_info_len;
135};
136
137/**
138 * struct pfru_com_buf_info - Communication buffer information.
139 *
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.
147 */
148struct pfru_com_buf_info {
149 __u32 status;
150 __u32 ext_status;
151 __u64 addr_lo;
152 __u64 addr_hi;
153 __u32 buf_size;
154};
155
156/**
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.
164 */
165struct pfru_updated_result {
166 __u32 status;
167 __u32 ext_status;
168 __u64 low_auth_time;
169 __u64 high_auth_time;
170 __u64 low_exec_time;
171 __u64 high_exec_time;
172};
173
174#endif /* __PFRUT_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t