Commit Graph

1843 Commits

Author SHA1 Message Date
Richard Hughes
7d1267fd84 Clarify various parts of the HSI specification
Firsly, that HSI isn't expected for embedded devices and then secondary how we
require SecureBoot to be available for HSI:1

At the moment we get a runtime failure if it is disabled. Making SB a part of
`HSI:1` makes this requiremnt explicit and prevents us getting `HSI:2!` if it
is not available.
2020-10-02 09:13:56 +01:00
Richard Hughes
5e0729ecf8 ata: Demote two debug lines to require the plugin verbose flag 2020-10-01 16:39:10 +01:00
Richard Hughes
e9ada9ed72 uefi-dbx: Remove three unhelpful lines of debugging 2020-10-01 16:39:10 +01:00
Richard Hughes
66ff7c45a9 vli: Remove invalid quirk entry
The 721C is a VL103, which isn't a FuVliUsbhubDevice at all. Fixes the:

    already set GType to FuVliPdDevice, ignoring FuVliUsbhubDevice

...message when the Mini dock / powered hub is inserted.
2020-10-01 16:39:10 +01:00
Richard Hughes
538fa633e8 vli: Remove useless debugging line
We know the flash_id as it's one of the InstanceIDs.
2020-10-01 16:39:10 +01:00
Richard Hughes
69f7a8c459 vli: Remove 32 lines of debugging at startup
I'll admit it's not normal to have *two* docks connected to one machine...
2020-10-01 16:39:10 +01:00
Richard Hughes
d852480f12 tpm-eventlog: Remove 8 lines of debugging at startup 2020-10-01 16:39:10 +01:00
Richard Hughes
deabfc5012 uefi-dbx: Do not upload a failure report for a failed dbx check
Use one of the errors mapping to FWUPD_UPDATE_STATE_FAILED_TRANSIENT to avoid
uploading a failure report for something the user has to fix, i.e. update the
distro shim package.
2020-09-29 13:15:50 +01:00
Sean-StarLabs
177470e9eb Update superio.quirk
Added Lite Mk III
2020-09-29 11:40:55 +01:00
Mario Limonciello
67a8b89453 trivial: clean up some debugging statements 2020-09-28 15:58:53 -05:00
Mario Limonciello
5d902778e4 trivial: uefi: remove extra flag for secure boot (shown in device flags) 2020-09-28 15:58:53 -05:00
Mario Limonciello
10ef83c96f trivial: thunderbolt: drop unnecessary verbose statements 2020-09-28 15:58:53 -05:00
boger.wang
4986e0f020 Add plugin for goodix fingerprint sensors
Support updating firmware for Goodix MOC fingerprint sensors.
2020-09-28 12:43:49 +01:00
Richard Hughes
44ae2a75e4 trivial: Add CRC8 as well 2020-09-25 18:00:21 +01:00
Richard Hughes
6f5e35a3ea Add common CRC routines
We have quite a few versions of CRC in-tree, and are about to get two more...
2020-09-25 17:52:43 +01:00
Richard Hughes
95187939ca platform-integrity: Use the post-review BIOS write protection attrs 2020-09-25 09:43:56 +01:00
Richard Hughes
fbd8b5d325 Add fu_device_dump_firmware()
Conceptually we were trying to stuff subtly different actions into one vfunc:

 * Read firmware from the device to update the verification checksums

 * Read a firmware blob from the device for debugging

For the first action we might want to mask out the sections of the flash with
serial numbers (so the verification hashes match the ones published on the LVFS)
and for the second we want just a raw ROM file from the hardware with no
pre-processing that we can compare against an external SPI dumper.

Split out ->dump_firmware to get the raw blob, and allow plugins to also
implement ->read_firmware() if they have to mask out specific offsets or remove
specific images from the FuFirmware container.

In the common case when masking is not required, fall back to using a 'binary'
FuFirmware automatically to make most plugins simpler.
2020-09-24 10:54:27 -05:00
Richard Hughes
6f4f1caca4 trivial: Fix some typos spotted by codespell 2020-09-24 10:48:26 +01:00
Richard Hughes
da17ff4888 trivial: Add another Toshiba OUI quirk
Fixes https://github.com/fwupd/fwupd/issues/2413
2020-09-24 08:07:31 +01:00
Richard Hughes
41400a8cc6 Allow contructing a firmware with multiple images
At the moment there are commands to convert one file format to another, but not
to 'merge' or alter them. Some firmware files are containers which can store
multiple images, each with optional id, idx and addresses.

This would allow us to, for instance, create a DfuSe file with two different
raw files that are flashed to different addresses on the SPI flash. It would
also allow us to create very small complicated container formats for fuzzing.

This can be used by writing a `firmware.builder.xml` file like:

   <?xml version="1.0" encoding="UTF-8"?>
   <firmware gtype="FuBcm57xxFirmware">
     <version>1.2.3</version>
     <image>
       <version>4.5.6</version>
       <id>header</id>
       <idx>456</idx>
       <addr>0x456</addr>
       <filename>header.bin</filename>
     </image>
     <image>
       <version>7.8.9</version>
       <id>payload</id>
       <idx>789</idx>
       <addr>0x789</addr>
       <data>aGVsbG8=</data>
     </image>
   </firmware>

...and then using something like:

   # fwupdtool firmware-convert firmware.builder.xml firmware.dfu builder dfu
2020-09-21 18:11:13 +01:00
Richard Hughes
9a1e8e44e0 uefi: Fix critical warning regression with 'fwupdate -a'
Set the ESP when creating the device with a known GUID.

Fixes https://github.com/fwupd/fwupd/issues/2406
2020-09-21 17:00:12 +01:00
Richard Hughes
7ef2dea271 optionrom: Test if the PCI device has ROM in probe
This means we make things a simpler by not relying on udev to stat the file.
It also reduces the number of added *unused* GUIDs by one per device too.
2020-09-20 19:11:44 +01:00
Richard Hughes
0d37a9a93a bios: Only warn about CSM when using i?86 or x86_64
We're telling people on PPC64 to switch to UEFI mode...
2020-09-18 13:57:36 +01:00
Mario Limonciello
88f0d422ec uefi: correct a logic error in TPM PCR reading (Fixes: #2382)
069449e tried to avoid issues with all zero TPM PCR's, but caused
a problem with any byte was zero.
2020-09-15 14:38:52 -05:00
Mario Limonciello
7fc7da3999 thunderbolt: set install parent first flag for WD19TB
This is only applicable for kernel 5.9 or kernels that backported
the authenticate on disconnect patches.

For installation time this isn't very important since no device will
restart.  This also isn't relevant for the authenticate on disconnect
scenario.
However the manual activation scenario, it's important to activate the
WD19TB device first, followed by Thunderbolt.
2020-09-14 11:28:55 -05:00
Mario Limonciello
0f057d227b thunderbolt: if calling activate always use nvm_authenticate (#2374)
This will force the update to complete on logout or shutdown
2020-09-14 11:28:55 -05:00
Richard Hughes
32173430d4 elantp: Only match the I2C adaptor on the correct laptop model
I2C doesn't have any specification for what is a probe and what is a more
destructive action. Sending tx_buf out on the i2c bus to a generic address
might not be safe in all cases.

To prevent this, use a HWID to check the machine DMI value during device
creation before ->probe() or ->setup() is called on the device.
2020-09-14 16:19:45 +01:00
Richard Hughes
ad32b0c17e elaptp: Allow recovery when the HID firmware fails to load 2020-09-14 16:19:45 +01:00
Richard Hughes
13bae744be platform-integrity: Use the BCR values provided by the kernel class
This requires the new kernel driver by Daniel Gutson.
2020-09-14 16:18:12 +01:00
Mario Limonciello
6a1a49eaef dell-dock: mirror updatable flag into thunderbolt
This makes sure that if an update is pending (as stored in the EC), Thunderbolt
won't show in a needing update state again.

Fixes: #2374
2020-09-11 14:08:32 -05:00
Mario Limonciello
76cc23c736 thunderbolt: make sure that authorized to add updatable flag
If the device is not authorized, it may cause a composite update that it's part
of to not behave properly.

If device is authorized at runtime, add updatable flag at runtime as well
See #2374 for more details
2020-09-11 13:15:51 -05:00
Mario Limonciello
c756405529 trivial: thunderbolt: fixup retimer setting physical ID twice
Only needs to be set once in probe.
2020-09-11 13:15:51 -05:00
Mario Limonciello
6d0c4897e1 fu-udev-device: call rescan on the device for change events
This allows calling the correct method, and instead doesn't have
all the plugins try to process the event when they're missing
vfuncs
2020-09-11 13:15:51 -05:00
Mario Limonciello
4550cf51f8 trivial: stop creating sysfs-path metadata
This isn't needed anymore, it was only for legacy thunderbolt3 controllers
that didn't support native enumeration.
2020-09-10 12:42:14 -05:00
Mario Limonciello
64f3857751 thunderbolt: ignore non-updatable host controller (Fixes: #2373)
nvm_version will not export in Intel USB4 host controller running in
SW CM, there is no point in fwupd displaying a device for it.
2020-09-10 12:42:14 -05:00
Richard Hughes
8541a874f0 synaptics-cxaudio: Fix the topology of the audio device on the TR dock
This ensures we perform the updates in this order:

* cxaudio
* vli
* thunderbolt

As any other order causes enumeration failures.

Fixes some of https://github.com/fwupd/fwupd/issues/2377
2020-09-10 17:14:08 +01:00
Daniel Campello
0b74e2c91a thunderbolt: Call fu_device_set_physical_id() during probe for retimer
Error will show up if (priv->physical_id == NULL) on
fu_device_ensure_id(). This method is called after probe but before
setup on fu_device_open.

Call fu_device_set_physical_id() on fu_thunderbolt_device_probe()
for the retimer case.

Fixes https://github.com/fwupd/fwupd/issues/2371

Change-Id: I0e462fff5e8abf6073318f6424b6736afc8259b8
2020-09-09 17:33:18 -05:00
Richard Hughes
8c200a9e41 cpu: Correct the BCR address for Atom Bay Trail 2020-09-09 20:18:32 +01:00
Richard Hughes
db344d5a40 trivial: Fix several small memory leaks discovered with valgrind 2020-09-09 14:16:49 -05:00
Richard Hughes
49b911f094 nvme: Do not dedupe NVMe devices
Fixes https://github.com/fwupd/fwupd/issues/2366
2020-09-09 16:27:16 +01:00
Richard Hughes
af53a4fc22 vli: Do not dedupe USB hub PD devices
This object derives from FuDevice rather than FuVliDevice and so does not
inherit the NO_GUID_MATCHING flag like other devices.

Fixes https://github.com/fwupd/fwupd/issues/2364
2020-09-09 16:27:16 +01:00
Mario Limonciello
110eb286bc Make TPM more optional (Fixes: #2360)
- Rename the `plugin_tpm` option to `tpm` and when it's disabled
remove TPM support from all plugins
- If enabled then require the TSS to be installed
2020-09-08 15:16:58 -05:00
Richard Hughes
d19aff3df1 mei: Do not attempt to parse HFSTS6 when using TXT
It seems the MEI parameters are not set for platforms such as Apollo Lake.
The only bit set was FPF_SOC_LOCK, with the others all cleared to zero.

Fixes https://github.com/fwupd/fwupd/issues/2335 for a peculiar definition of 'fix'.
2020-09-08 17:05:02 +01:00
Richard Hughes
45fbc50f8d mei: Document some more of HFSTS6 2020-09-08 17:05:02 +01:00
Richard Hughes
9b688d0b73 trivial: Set FWUPD_STATUS_DECOMPRESSING when preparing firmware
This avoids the plugins forgetting to do it themselves.
2020-09-08 14:18:46 +01:00
Richard Hughes
fbe3304420 trivial: Remove the anti-pattern where plugins check the firmware size
This is already done in fu_device_prepare_firmware() and so is completely
redundant.
2020-09-08 14:18:46 +01:00
Richard Hughes
581aa3c0be elantp: Support more hardware types
Read the pattern from the hardware rather than hardcoding and support bigger
page sizes for later hardware versions.
2020-09-07 20:46:52 +01:00
Jerry Zhang
ae7563d7d7 dfu: Allow device to attach to normal without a bus reset
As described in DFU protocol (7. Manifestation Phase), after the
firmware reprogramming is done, if bitWillDetach = 1, it doesn't
require the host to issue a USB bus reset, but the device can
generate a detach-attach sequence itself to go back to normal.

Add a quirk flag "no-bus-reset-attach" to skip the bus reset in
dfu_device_attach(), and increase the "RemoveDelay" as well.
2020-09-04 17:52:00 +01:00
Richard Hughes
9a07407401 Use the FuUdevDevice ->to_string() output
Print the sysfs path for devices deriving from FuUdevDevice, which also allows
us to use FU_UDEV_DEVICE_DEBUG without monkey-patching the plugins that also
define a device_class->to_string() vfunc.
2020-09-03 16:50:41 +01:00
Jerry Zhang
9f31bc22df dfu: Specify "RemoveDelay" for Poly USB Cameras in dfu.quirk
For some Poly USB Cameras, it takes a longer time than the
default (FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE) for being detached
to DFU or attached to normal mode. Need to specify the timeout in
"RemoveDelay" quirk key.

Also replace the hard-coded timeout with fu_device_get_remove_delay()
in dfu-tool.c.
2020-09-02 12:01:46 -05:00
Richard Hughes
0b6f58394b Cancel the file monitor before disposal to avoid a potential deadlock
Fixes https://github.com/fwupd/fwupd/issues/2350
2020-09-01 20:59:56 +01:00
Jerry Zhang
409a2c958c dfu: Support polling the status from device in dfuManifest state
Some devices may accumulate the firmware image and perform the
entire reprogramming operation at one time. In this case, the
device enters dfuMANIFEST-SYNC or dfuMANIFEST state after
dfuDNLOAD-IDLE.

The fwupd shall be able to poll the status from the device via
DFU_GETSTATUS until the device completes the reprogramming or
reports an error.

For details, please refer to Section 7. Manifestation Phase and
A.1 Interface State Transition Diagram in the USB DFU protocol.
https://www.usb.org/sites/default/files/DFU_1.1.pdf

For not affecting the other DFU capable devices, introduce a quirk
"manifest-poll" to limit the logic.
2020-09-01 19:43:55 +01:00
Richard Hughes
840e84bcf2 elantp: Add a plugin to update Elan Touchpads using HID 2020-09-01 12:17:44 +01:00
Jerry Zhang
783bc5c8a8 dfu: Support download of large DFU firmware
The nr_chunks is defined as an unsigned short, the max value is
65536. Assume the transfer_size reported by device is 4096, the
maximum size of DFU firmware supported is 65536 * 4096 = 256MB.

To support larger DFU firmware, we can change the guint16 to
guint32.
2020-08-29 09:32:03 +01:00
Benson Leung
72aea1f8ed cros-ec: Save new firmware version on successful write 2020-08-28 10:48:03 -07:00
Benson Leung
a5487d4848 cros-ec: Do RO write as ANOTHER WRITE using custom flags
This implements the following simple state machine:
1. Reboot to RO, Update RW first, set ANOTHER_WRITE_REQUIRED
2. Second time around, don't reboot into RO. Stay in RW.
3. Update RO.
4. Done.
2020-08-28 10:48:03 -07:00
Benson Leung
24f0570e1b cros-ec: Set FWUPD_DEVICE_FLAG_DUAL_IMAGE 2020-08-28 10:48:03 -07:00
Benson Leung
7f3095d9ff cros-ec: Use iConfiguration to determine RO versus RW versions
This requires an API upgrade. libgusb 0.3.5 is required for iConfiguration.
2020-08-28 10:48:03 -07:00
Benson Leung
9832b4138c cros-ec: Restart to RO on detach and to RW on attach
Add external command support and functions to reset to RO and RW.
This will now jump to the RO no matter what, and update the RW, then
jump to RW.
2020-08-28 10:48:03 -07:00
Benson Leung
879b8149c7 cros-ec: Set FWUPD_DEVICE_FLAG_UPDATABLE 2020-08-28 10:48:03 -07:00
Richard Hughes
024b37fcee trivial: Fix segfault when xmlb cache cannot be written 2020-08-28 17:41:28 +01:00
Mario Limonciello
5de5dd3582 Install the installed tests
Move binaries out of fwupd tree to https://github.com/fwupd/fwupd-test-firmware

Fixes some of https://github.com/fwupd/fwupd/issues/1956
2020-08-28 10:10:43 -05:00
Mario Limonciello
e89ce1a935 trivial: dell-dock: check for valid dock type on open
Only add instance ID if it actually probes properly.

Otherwise this makes an invalid assumption that the device is a WD19
EC just because it had the correct hub in front.

Instead check the first time it's opened that the correct device
is identified (`EXPECTED_DOCK_TYPE`)
2020-08-28 09:53:54 -05:00
Richard Hughes
8307bd603e cpu: Directly probe the CPUID data to improve startup speed
This is much more efficient than parsing hundreds of lines of /proc/cpuinfo
and also causes hundreds of thousands less allocations at startup. For systems
with dozens of virtual CPUs the deduplication of device objects was increasing
start up time considerably.

Use the msr plugin to read the microcode version as this is not obtained using
CPUID, as it is instead being provided in an MSR.
2020-08-24 16:37:27 +01:00
Richard Hughes
f779a0cfaa msr: Use the new fu_common_cpuid() functionality 2020-08-24 16:37:27 +01:00
Richard Hughes
3a095cdadf cpu: Use the extended IDs where required 2020-08-24 16:37:27 +01:00
Richard Hughes
8667c7e816 cpu: Use the proper vendor name rather than the signature 2020-08-24 16:37:27 +01:00
Richard Hughes
bd1dc2a1e2 pcb-bcr: Use the correct BCR register for Bay Trail CPUs
Fixes https://github.com/fwupd/fwupd/issues/2328
2020-08-20 22:07:05 +01:00
Mario Limonciello
82c3e3471d Remove support for UEFI dbx security attribute
This is no longer relevant as fwupd is providing dbxtool now.
2020-08-19 07:38:51 +01:00
Richard Hughes
58ba785915 Install the new dbx utility as fwupdbxtool 2020-08-18 17:34:26 +01:00
Richard Hughes
fd0ee5153e Add some of the HSI specification to the generated documentation 2020-08-17 20:23:49 +01:00
Richard Hughes
13b3343aaf vli: Add support for the Realtek RTD21XX I²C protocol 2020-08-17 20:23:09 +01:00
Richard Hughes
1abb32c623 uefi-dbx: Validate the dbx update is safe to apply
To do this mount all ESP partitions and check all the binaries there to see if
they match any entries in the new dbx. If we applied the update when a hash
matched, we would unintentially 'brick' the users machine, as the grub and shim
binaries *have* to be updated first.

This functionality does reimplement the PE hashing functionality found in
sbsigntools and pesign. This was done for 4 main reasons:

 * There were some memory safety issues found when fuzzing random binaries
 * Executing the tools hundreds of times was a lot of overhead
 * Operating from a blob of immutable mmap'd memory is much faster
 * We only need a very small amount of functionality from both tools
2020-08-17 15:59:02 +01:00
Richard Hughes
0e7102c4f8 uefi-dbx: Fix some NULL/FALSE confusion 2020-08-17 14:47:58 +01:00
Richard Hughes
1411b8056b acpi-facp: Fix some NULL/FALSE confusion 2020-08-17 14:47:42 +01:00
Richard Hughes
7bca1b27b4 acpi-dmar: Fix some NULL/FALSE confusion 2020-08-17 14:47:30 +01:00
Darkovian
4e2768057b Update ata.quirk
Added OUI\030302 to ata.quirk
2020-08-14 15:05:00 -05:00
Richard Hughes
01d5779597 uefi-dbx: Allow updating the dbx using the LVFS
The GUID is built using the SHA256 of the certificates in the KEK.
2020-08-14 13:22:53 +01:00
Richard Hughes
edc3432338 dbxtool: List the checksums correctly for multiple EFI_SIGNATURE_LISTs
Fixes https://github.com/fwupd/fwupd/issues/2319
2020-08-13 21:19:10 +01:00
Richard Hughes
361114784b Add a compatible re-implementation of the rhboot dbxtool 2020-08-13 19:09:40 +01:00
Richard Hughes
12f21b89ec trivial: Fix CI -Werror=null-dereference false positive 2020-08-13 13:41:43 +01:00
Richard Hughes
d3f60abe6d uefi: Port the plugin to use FuVolume 2020-08-12 18:35:15 +01:00
Richard Hughes
99dda53cc2 trivial: Define one more EFI GUID 2020-08-12 15:13:09 +01:00
Vincent Huang
334a4d9f30 synaptics-prometheus: generate new guid with configid and add pids to
quirk file
2020-08-12 09:47:46 +01:00
Mario Limonciello
0ebddc9fcf trivial: fix some unused variables found by clang-10 2020-08-10 10:33:31 -05:00
Mario Limonciello
2c55382944 trivial: cpu: add noreturn attribute 2020-08-10 10:33:31 -05:00
Richard Hughes
4a0d14b097 trivial: Fix the quirk entry for the Star LabTop Mk IV 2020-07-30 15:13:00 +01:00
Sean Rhodes
c7edf611c3 Added quirk for LabTop Mk IV 2020-07-29 12:58:02 +01:00
Ryan Lee
0b5ed33b23 ccgx: Modify readme to remove customer info 2020-07-29 12:01:31 +01:00
Emily Miller
b700783bf6 vli: Add dual-image feature for VL103 backup firmware 2020-07-29 10:57:02 +01:00
mendel5
db2906d49c fu-plugin-synaptics-mst.c: replace github.com/hughsie with github.com/fwupd 2020-07-28 14:28:15 -05:00
Richard Hughes
cad96542e2 Check if CET is actually being used on the runtime system
With thanks to H.J. Lu <hjl.tools@gmail.com> for the initial code.
2020-07-27 15:53:38 +01:00
Richard Hughes
cb1e6075c5 thelio-io: Define the protocol on the runtime device
This allows us to use 'protocol' in the device test JSON and also prevents a
daemon warning at startup.
2020-07-25 09:09:24 +01:00
Richard Hughes
587ca9793f nitrokey: Define the protocol on the runtime device
This prevents a daemon warning.
2020-07-25 09:09:24 +01:00
Richard Hughes
4f617e2eb6 thelio-io: Set the runtime version to 0.0.0 for pre-1.0.0 firmware 2020-07-23 14:12:31 +01:00
Richard Hughes
8fe710135b thelio-io: Add the DFU instance ID as a counterpart only
This means we do not add possibly unwanted bootloader-specific quirks to the
runtime device.
2020-07-23 14:12:31 +01:00
Richard Hughes
4e13a790df vli: Rename FuVliUsbhubI2cDevice to FuVliUsbhubMsp430Device
The I²C proxy specification is not always shared with all other devices as
I originally hoped, instead there are other legacy devices that use different
sets of I²C commands.

Un-share various bits of code to allow for additional I²C devices to be added.

No logic changes.
2020-07-22 20:04:20 +01:00
Richard Hughes
30f7ffbdbd pci-mei: Split up the bootguard HSI checks into multiple entries
Additionally, demote the error policy to HSI-3 and do not show the other
failures if BootGuard is disabled.

Fixes https://github.com/fwupd/fwupd/issues/2265
2020-07-20 22:50:31 +01:00
Richard Hughes
9a04ce8f29 msr: Add a new plugin to detect the Intel DCI state 2020-07-16 20:13:06 +01:00
Mario Limonciello
ec9eb9061f trivial: add oui quirk for samsung (Fixes: #2070) 2020-07-10 13:42:31 -05:00