Skip to content

Commit

Permalink
ACPI: tools: Introduce utility for firmware updates/telemetry
Browse files Browse the repository at this point in the history
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 <hongyu.ning@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Chen Yu authored and Rafael J. Wysocki committed Dec 27, 2021
1 parent b0013e0 commit 53e8558
Show file tree
Hide file tree
Showing 6 changed files with 594 additions and 9 deletions.
1 change: 1 addition & 0 deletions tools/power/acpi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/acpidbg
/acpidump
/ec
/pfrut
/include/
16 changes: 8 additions & 8 deletions tools/power/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ include ../../scripts/Makefile.include

.NOTPARALLEL:

all: acpidbg acpidump ec
clean: acpidbg_clean acpidump_clean ec_clean
install: acpidbg_install acpidump_install ec_install
uninstall: acpidbg_uninstall acpidump_uninstall ec_uninstall
all: acpidbg acpidump ec pfrut
clean: acpidbg_clean acpidump_clean ec_clean pfrut_clean
install: acpidbg_install acpidump_install ec_install pfrut_install
uninstall: acpidbg_uninstall acpidump_uninstall ec_uninstall pfrut_uninstall

acpidbg acpidump ec: FORCE
acpidbg acpidump ec pfrut: FORCE
$(call descend,tools/$@,all)
acpidbg_clean acpidump_clean ec_clean:
acpidbg_clean acpidump_clean ec_clean pfrut_clean:
$(call descend,tools/$(@:_clean=),clean)
acpidbg_install acpidump_install ec_install:
acpidbg_install acpidump_install ec_install pfrut_install:
$(call descend,tools/$(@:_install=),install)
acpidbg_uninstall acpidump_uninstall ec_uninstall:
acpidbg_uninstall acpidump_uninstall ec_uninstall pfrut_uninstall:
$(call descend,tools/$(@:_uninstall=),uninstall)

.PHONY: FORCE
2 changes: 1 addition & 1 deletion tools/power/acpi/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ objdir := $(OUTPUT)tools/$(TOOL)/
toolobjs := $(addprefix $(objdir),$(TOOL_OBJS))
$(OUTPUT)$(TOOL): $(toolobjs) FORCE
$(ECHO) " LD " $(subst $(OUTPUT),,$@)
$(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(toolobjs) -L$(OUTPUT) -o $@
$(QUIET) $(LD) $(CFLAGS) $(toolobjs) $(LDFLAGS) -L$(OUTPUT) -o $@
$(ECHO) " STRIP " $(subst $(OUTPUT),,$@)
$(QUIET) $(STRIPCMD) $@

Expand Down
137 changes: 137 additions & 0 deletions tools/power/acpi/man/pfrut.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
.TH "PFRUT" "8" "October 2021" "pfrut 1.0" ""
.hy
.SH Name
.PP
pfrut \- Platform Firmware Runtime Update and Telemetry tool
.SH SYNOPSIS
.PP
\f[B]pfrut\f[R] [\f[I]Options\f[R]]
.SH DESCRIPTION
.PP
The PFRUT(Platform Firmware Runtime Update and Telemetry) kernel interface is designed
to
.PD 0
.P
.PD
interact with the platform firmware interface defined in the
.PD 0
.P
.PD
Management Mode Firmware Runtime
Update (https://uefi.org/sites/default/files/resources/Intel_MM_OS_Interface_Spec_Rev100.pdf)
.PD 0
.P
.PD
\f[B]pfrut\f[R] is the tool to interact with the kernel interface.
.PD 0
.P
.PD
.SH OPTIONS
.TP
.B \f[B]\-h\f[R], \f[B]\-\-help\f[R]
Display helper information.
.TP
.B \f[B]\-l\f[R], \f[B]\-\-load\f[R]
Load the capsule file into the system.
To be more specific, the capsule file will be copied to the
communication buffer.
.TP
.B \f[B]\-s\f[R], \f[B]\-\-stage\f[R]
Stage the capsule image from communication buffer into Management Mode
and perform authentication.
.TP
.B \f[B]\-a\f[R], \f[B]\-\-activate\f[R]
Activate a previous staged capsule image.
.TP
.B \f[B]\-u\f[R], \f[B]\-\-update\f[R]
Perform both stage and activation actions.
.TP
.B \f[B]\-q\f[R], \f[B]\-\-query\f[R]
Query the update capability.
.TP
.B \f[B]\-d\f[R], \f[B]\-\-setrev\f[R]
Set the revision ID of code injection/driver update.
.TP
.B \f[B]\-D\f[R], \f[B]\-\-setrevlog\f[R]
Set the revision ID of telemetry.
.TP
.B \f[B]\-G\f[R], \f[B]\-\-getloginfo\f[R]
Get telemetry log information and print it out.
.TP
.B \f[B]\-T\f[R], \f[B]\-\-type\f[R]
Set the telemetry log data type.
.TP
.B \f[B]\-L\f[R], \f[B]\-\-level\f[R]
Set the telemetry log level.
.TP
.B \f[B]\-R\f[R], \f[B]\-\-read\f[R]
Read all the telemetry data and print it out.
.SH EXAMPLES
.PP
\f[B]pfrut \-G\f[R]
.PP
log_level:4
.PD 0
.P
.PD
log_type:0
.PD 0
.P
.PD
log_revid:2
.PD 0
.P
.PD
max_data_size:65536
.PD 0
.P
.PD
chunk1_size:0
.PD 0
.P
.PD
chunk2_size:1401
.PD 0
.P
.PD
rollover_cnt:0
.PD 0
.P
.PD
reset_cnt:4
.PP
\f[B]pfru \-q\f[R]
.PP
code injection image type:794bf8b2\-6e7b\-454e\-885f\-3fb9bb185402
.PD 0
.P
.PD
fw_version:0
.PD 0
.P
.PD
code_rt_version:1
.PD 0
.P
.PD
driver update image type:0e5f0b14\-f849\-7945\-ad81\-bc7b6d2bb245
.PD 0
.P
.PD
drv_rt_version:0
.PD 0
.P
.PD
drv_svn:0
.PD 0
.P
.PD
platform id:39214663\-b1a8\-4eaa\-9024\-f2bb53ea4723
.PD 0
.P
.PD
oem id:a36db54f\-ea2a\-e14e\-b7c4\-b5780e51ba3d
.PP
\f[B]pfrut \-l yours.cap \-u \-T 1 \-L 4\f[R]
.SH AUTHORS
Chen Yu.
23 changes: 23 additions & 0 deletions tools/power/acpi/tools/pfrut/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-2.0+

include ../../Makefile.config

TOOL = pfrut
EXTRA_INSTALL = install-man
EXTRA_UNINSTALL = uninstall-man

CFLAGS += -Wall -O2
CFLAGS += -DPFRUT_HEADER='"../../../../../include/uapi/linux/pfrut.h"'
LDFLAGS += -luuid

TOOL_OBJS = \
pfrut.o

include ../../Makefile.rules

install-man: $(srctree)/man/pfrut.8
$(ECHO) " INST " pfrut.8
$(QUIET) $(INSTALL_DATA) -D $< $(DESTDIR)$(mandir)/man8/pfrut.8
uninstall-man:
$(ECHO) " UNINST " pfrut.8
$(QUIET) rm -f $(DESTDIR)$(mandir)/man8/pfrut.8
Loading

0 comments on commit 53e8558

Please sign in to comment.