Skip to content

Commit 53e8558

Browse files
yu-chen-surfrafaeljw
authored andcommitted
ACPI: tools: Introduce utility for firmware updates/telemetry
Introduce a user space tool to make use of the interface exposed by Platform Firmware Runtime Update and Telemetry drivers. It can be used for firmware code injection, driver updates and to retrieve platform firmware telemetry data. Tested-by: Hongyu Ning <[email protected]> Signed-off-by: Chen Yu <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent b0013e0 commit 53e8558

File tree

6 files changed

+594
-9
lines changed

6 files changed

+594
-9
lines changed

tools/power/acpi/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/acpidbg
33
/acpidump
44
/ec
5+
/pfrut
56
/include/

tools/power/acpi/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ include ../../scripts/Makefile.include
99

1010
.NOTPARALLEL:
1111

12-
all: acpidbg acpidump ec
13-
clean: acpidbg_clean acpidump_clean ec_clean
14-
install: acpidbg_install acpidump_install ec_install
15-
uninstall: acpidbg_uninstall acpidump_uninstall ec_uninstall
12+
all: acpidbg acpidump ec pfrut
13+
clean: acpidbg_clean acpidump_clean ec_clean pfrut_clean
14+
install: acpidbg_install acpidump_install ec_install pfrut_install
15+
uninstall: acpidbg_uninstall acpidump_uninstall ec_uninstall pfrut_uninstall
1616

17-
acpidbg acpidump ec: FORCE
17+
acpidbg acpidump ec pfrut: FORCE
1818
$(call descend,tools/$@,all)
19-
acpidbg_clean acpidump_clean ec_clean:
19+
acpidbg_clean acpidump_clean ec_clean pfrut_clean:
2020
$(call descend,tools/$(@:_clean=),clean)
21-
acpidbg_install acpidump_install ec_install:
21+
acpidbg_install acpidump_install ec_install pfrut_install:
2222
$(call descend,tools/$(@:_install=),install)
23-
acpidbg_uninstall acpidump_uninstall ec_uninstall:
23+
acpidbg_uninstall acpidump_uninstall ec_uninstall pfrut_uninstall:
2424
$(call descend,tools/$(@:_uninstall=),uninstall)
2525

2626
.PHONY: FORCE

tools/power/acpi/Makefile.rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ objdir := $(OUTPUT)tools/$(TOOL)/
99
toolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
1010
$(OUTPUT)$(TOOL): $(toolobjs) FORCE
1111
$(ECHO) " LD " $(subst $(OUTPUT),,$@)
12-
$(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(toolobjs) -L$(OUTPUT) -o $@
12+
$(QUIET) $(LD) $(CFLAGS) $(toolobjs) $(LDFLAGS) -L$(OUTPUT) -o $@
1313
$(ECHO) " STRIP " $(subst $(OUTPUT),,$@)
1414
$(QUIET) $(STRIPCMD) $@
1515

tools/power/acpi/man/pfrut.8

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
.TH "PFRUT" "8" "October 2021" "pfrut 1.0" ""
2+
.hy
3+
.SH Name
4+
.PP
5+
pfrut \- Platform Firmware Runtime Update and Telemetry tool
6+
.SH SYNOPSIS
7+
.PP
8+
\f[B]pfrut\f[R] [\f[I]Options\f[R]]
9+
.SH DESCRIPTION
10+
.PP
11+
The PFRUT(Platform Firmware Runtime Update and Telemetry) kernel interface is designed
12+
to
13+
.PD 0
14+
.P
15+
.PD
16+
interact with the platform firmware interface defined in the
17+
.PD 0
18+
.P
19+
.PD
20+
Management Mode Firmware Runtime
21+
Update (https://uefi.org/sites/default/files/resources/Intel_MM_OS_Interface_Spec_Rev100.pdf)
22+
.PD 0
23+
.P
24+
.PD
25+
\f[B]pfrut\f[R] is the tool to interact with the kernel interface.
26+
.PD 0
27+
.P
28+
.PD
29+
.SH OPTIONS
30+
.TP
31+
.B \f[B]\-h\f[R], \f[B]\-\-help\f[R]
32+
Display helper information.
33+
.TP
34+
.B \f[B]\-l\f[R], \f[B]\-\-load\f[R]
35+
Load the capsule file into the system.
36+
To be more specific, the capsule file will be copied to the
37+
communication buffer.
38+
.TP
39+
.B \f[B]\-s\f[R], \f[B]\-\-stage\f[R]
40+
Stage the capsule image from communication buffer into Management Mode
41+
and perform authentication.
42+
.TP
43+
.B \f[B]\-a\f[R], \f[B]\-\-activate\f[R]
44+
Activate a previous staged capsule image.
45+
.TP
46+
.B \f[B]\-u\f[R], \f[B]\-\-update\f[R]
47+
Perform both stage and activation actions.
48+
.TP
49+
.B \f[B]\-q\f[R], \f[B]\-\-query\f[R]
50+
Query the update capability.
51+
.TP
52+
.B \f[B]\-d\f[R], \f[B]\-\-setrev\f[R]
53+
Set the revision ID of code injection/driver update.
54+
.TP
55+
.B \f[B]\-D\f[R], \f[B]\-\-setrevlog\f[R]
56+
Set the revision ID of telemetry.
57+
.TP
58+
.B \f[B]\-G\f[R], \f[B]\-\-getloginfo\f[R]
59+
Get telemetry log information and print it out.
60+
.TP
61+
.B \f[B]\-T\f[R], \f[B]\-\-type\f[R]
62+
Set the telemetry log data type.
63+
.TP
64+
.B \f[B]\-L\f[R], \f[B]\-\-level\f[R]
65+
Set the telemetry log level.
66+
.TP
67+
.B \f[B]\-R\f[R], \f[B]\-\-read\f[R]
68+
Read all the telemetry data and print it out.
69+
.SH EXAMPLES
70+
.PP
71+
\f[B]pfrut \-G\f[R]
72+
.PP
73+
log_level:4
74+
.PD 0
75+
.P
76+
.PD
77+
log_type:0
78+
.PD 0
79+
.P
80+
.PD
81+
log_revid:2
82+
.PD 0
83+
.P
84+
.PD
85+
max_data_size:65536
86+
.PD 0
87+
.P
88+
.PD
89+
chunk1_size:0
90+
.PD 0
91+
.P
92+
.PD
93+
chunk2_size:1401
94+
.PD 0
95+
.P
96+
.PD
97+
rollover_cnt:0
98+
.PD 0
99+
.P
100+
.PD
101+
reset_cnt:4
102+
.PP
103+
\f[B]pfru \-q\f[R]
104+
.PP
105+
code injection image type:794bf8b2\-6e7b\-454e\-885f\-3fb9bb185402
106+
.PD 0
107+
.P
108+
.PD
109+
fw_version:0
110+
.PD 0
111+
.P
112+
.PD
113+
code_rt_version:1
114+
.PD 0
115+
.P
116+
.PD
117+
driver update image type:0e5f0b14\-f849\-7945\-ad81\-bc7b6d2bb245
118+
.PD 0
119+
.P
120+
.PD
121+
drv_rt_version:0
122+
.PD 0
123+
.P
124+
.PD
125+
drv_svn:0
126+
.PD 0
127+
.P
128+
.PD
129+
platform id:39214663\-b1a8\-4eaa\-9024\-f2bb53ea4723
130+
.PD 0
131+
.P
132+
.PD
133+
oem id:a36db54f\-ea2a\-e14e\-b7c4\-b5780e51ba3d
134+
.PP
135+
\f[B]pfrut \-l yours.cap \-u \-T 1 \-L 4\f[R]
136+
.SH AUTHORS
137+
Chen Yu.

tools/power/acpi/tools/pfrut/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: GPL-2.0+
2+
3+
include ../../Makefile.config
4+
5+
TOOL = pfrut
6+
EXTRA_INSTALL = install-man
7+
EXTRA_UNINSTALL = uninstall-man
8+
9+
CFLAGS += -Wall -O2
10+
CFLAGS += -DPFRUT_HEADER='"../../../../../include/uapi/linux/pfrut.h"'
11+
LDFLAGS += -luuid
12+
13+
TOOL_OBJS = \
14+
pfrut.o
15+
16+
include ../../Makefile.rules
17+
18+
install-man: $(srctree)/man/pfrut.8
19+
$(ECHO) " INST " pfrut.8
20+
$(QUIET) $(INSTALL_DATA) -D $< $(DESTDIR)$(mandir)/man8/pfrut.8
21+
uninstall-man:
22+
$(ECHO) " UNINST " pfrut.8
23+
$(QUIET) rm -f $(DESTDIR)$(mandir)/man8/pfrut.8

0 commit comments

Comments
 (0)