Commit Graph

1843 Commits

Author SHA1 Message Date
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
Benson Leung
852c6685ff cros-ec: Set protocol for cros-ec-usb-device
Specify "com.google.usb.crosec" to indicate support for Google's
USB endpoint updater protocol.
2020-07-09 07:44:19 +01:00
Benson Leung
8ed9f5f0a1 cros-ec: Write firmware to usb target
Write the firmware to the usb device, first finding which section to
write to, then breaking into blocks (based on maximum pdu size),
and then into chunks, which are transferred to the device using bulk transfers.
2020-07-09 07:44:19 +01:00
Benson Leung
4ed2400cab cros-ec: Store image_idx in section
Makes it a bit easier to retrieve the image later.
2020-07-09 07:44:19 +01:00
Benson Leung
9326e19118 cros-ec: Give cros-ec-firmware a get_sections
Add a getter for the sections.
2020-07-09 07:44:19 +01:00
Benson Leung
d0cd862acf cros-ec: Add fu_cros_ec_firmware_pick_sections
Add this to allow the usb-device to mark which section of the firmware
image is writeable by setting the section's ustatus to FU_CROS_EC_FW_NEEDED.
2020-07-09 07:44:19 +01:00
Benson Leung
befd9a420e cros-ec: Convert cros-ec-firmware's sections to GPtrArray 2020-07-09 07:44:19 +01:00
Benson Leung
6472742bea cros-ec: Add prepare firmware
Prepare firmware by parsing it, which will be of fu_cros_ec_firmware type.
2020-07-09 07:44:19 +01:00
Benson Leung
a989975812 cros-ec: Update documentation to reflect fmap
The file format was added last time around, so update cros-ec's
documentation to reflect that fwupd now supports fmap format
blobs.
2020-07-09 07:44:19 +01:00
Ryan Lee
ef7b7b0efd ccgx: modify installation time for hp g2 dock 2020-07-07 13:00:02 +01:00
Mario Limonciello
c90eca4787 thunderbolt: add support for retimers 2020-07-03 12:56:44 -05:00
Richard Hughes
a852254d92 trivial: Hide the UEFI DBX parsing by default 2020-07-03 12:32:06 +01:00
Ryan Lee
62618bedb6 ccgx: add extra 45% removal time for worst case 2020-07-03 10:18:57 +01:00
Richard Hughes
6269a839eb Add a security attribute for BootGuard
This information is obtained from the MEI configuration space.
2020-07-02 20:25:48 +01:00
Richard Hughes
81a12a1b17 pci-mei: Split out the HFSTS registers
The register specifications have been taken as a superset of the coreboot
documentation as different flags were documented in more detail on various
different platforms.

Having this new data allows us to add future tests and make the current tests
much easier to understand.
2020-07-02 20:25:48 +01:00
Reto Kromer
2b0a329cf1 fix alignment (in the code) 2020-07-01 21:11:17 +01:00
Richard Hughes
1de98dcd72 mei: Add extra metadata to the security attributes 2020-07-01 20:10:39 +01:00
Richard Hughes
2adeb7688a mei: Store the family in the plugin data 2020-07-01 20:10:39 +01:00
Mario Limonciello
b1cf96abe1 trivial: acpi-dmar: lower missing DMAR table to debug
If the system is missing a DMAR table, users can find out from
`fwupdtool/fwupdmgr security`.  No need to actually warn in the logs
every single time.
2020-07-01 13:42:28 -05:00
Richard Hughes
d09cf101c3 Change all instances of master/slave to initiator/target
This makes perfect sense, because the 'initiator' starts the transaction and
the 'target' is the addressee of the transaction. Even the I²C spec defines the
'master' as 'initiating' the transaction.

This is the same nomenclature now used by the Glasgow project too.
2020-07-01 15:44:30 +01:00
Ryan Lee
7ebcd06ae4 ccgx: remove verify flag in plugin 2020-07-01 14:14:10 +01:00
Mario Limonciello
6a6029f132 uefi: disable plugin if efivar is not supported
Don't even try to coldplug the device.

Fixes: #2237
2020-06-30 13:55:33 -05:00
Richard Hughes
85226fd9d1 Remove potentially problematic language
Red Hat wants to drive an initiative in correcting problematic and potentially
divisive language in open source projects. These naming conventions and
descriptive phrases are hurtful and offensive to many of our colleagues across
the open source universe.

See https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-language
2020-06-30 17:31:17 +01:00
Richard Hughes
d9f3bec6d0 trivial: Fix GtkDoc issue with FuFmapFirmware 2020-06-29 15:49:14 +01:00
Ryan Lee
609d0c570f ccgx: Add more hybrid dock support
Also add HPI command retry.
2020-06-25 18:30:30 +01:00
Mario Limonciello
28d51c036b trivial: tpm-eventlog: stop showing messages about secure boot
This was an overloaded use of UpdateMessage that didn't make sense.
It doesn't affect the functionality of updating, just the security.

Hints about why the TPM PCR0 reconstruction failed should go
to the wiki page not the device.
2020-06-25 11:17:47 -05:00
Mario Limonciello
b563840753 Move PCR0 reconstruction error into security command
Now that this infrastructure is built, it's a more useful location
to put the security output.
2020-06-25 11:17:47 -05:00
Mario Limonciello
4669dd590a trivial: uefi: drop secure boot check at coldplug
We'll instead check this when the user tries to run an update.  This
allows them to sign a bootloader after the daemon starts (or remove
a signed bootloader after starting)

Fixes: #2219
2020-06-24 08:18:48 -05:00
Mario Limonciello
58d6d329e8 trivial: thunderbolt: don't set update error for missing nvmem
Trying to explain why ICL thunderbolt isn't updatable doesn't help
people.  It just causes fwupdmgr and fwupdtool to show the device
front and center with a confusing message.

Instead don't populate the message and by the default device filter
it will be hidden.

See #2212 for background.
2020-06-24 06:31:58 +01:00
Mario Limonciello
bdc589884a modem-manager: add support for compiling libqmi-glib 1.26.0 and later 2020-06-23 15:21:09 -05:00
Mario Limonciello
bfd57c6ee1 trivial: modem-manager: chomp vendor string
Reading the sysfs file seemed to have also eaten the `\n` as mentioned
on a bug.

```
├DW5821e Snapdragon X20 LTE:
│     Device ID:           fa707b9af86ff44bc17316b6c3e5ea82aab3ce86
│     Summary:             Mobile broadband device
│     Current version:     T77W968.F1.0.0.4.2.GC.010
│     Vendor:              Dell Inc. (USB:0x413c
│     )
│     GUIDs:               64da2d58-8d1b-5e5b-b793-f88ba5a25a8f
│                          761d6124-0002-5185-b767-9adf67bf1a5e
│                          795e079d-093b-5503-aa59-35b832480e95
│     Device Flags:        • Updatable
```
2020-06-23 14:12:08 -05:00
Mario Limonciello
f7d83a2f45 trivial: modem-manager: fix a logic error 2020-06-23 08:44:21 -05:00
Mario Limonciello
752dc715ea Revert "trivial: add Vendor ID into Modem manager devices"
This reverts commit 5521e47511.
2020-06-23 07:57:22 +01:00
Mario Limonciello
50638657cc modem-manager: read the vendor ID directly from sysfs attribute
Fixes: #2209
2020-06-23 07:57:22 +01:00
Mario Limonciello
e2a77fc10b trivial: modem-manager: add a protocol for updating the devices 2020-06-23 07:57:22 +01:00
Mario Limonciello
834b28009d Add support for a delayed activation flow for Thunderbolt
This allows delaying the activation of Thunderbolt firmware until
shutdown/reboot or when the dock is unplugged.

This functionality requires features in the kernel:
https://lore.kernel.org/linux-usb/20200622143035.25327-1-mario.limonciello@dell.com/T/#t

Matrix of cases to support:

* Distro Old Linux kernel (doesn't support authenticate on disconnect)

  - WD19TB: Should have `skips-restart` flag set
    No flush or activate features called in `thunderbolt` plugin.
    `dell_dock` plugin will activate at end of composite update

  - All other devices: Shouldn't have flags set
    Should authenticate in Thunderbolt plugin.
    `1 > nvm_authenticate`

* Distro New Linux kernel (supports authenticate on disconnect)

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure TBT device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Shouldn't have flags set
    Should authenticate in `thunderbolt` plugin.
    `1 > nvm_authenticate`

* ChromeOS (supports authenticate on disconnect)

  - `thunerbolt.conf` will have `DelayedActivation=true`.

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Should have both `usable-during-update` and `skips-restart` set
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate`
    Will activate upon logout/shutdown/reboot
    `1 > nvm_authenticate`
2020-06-22 16:09:10 -05:00
Mario Limonciello
5521e47511 trivial: add Vendor ID into Modem manager devices
Fixes: #2200
2020-06-22 15:57:10 -05:00
Richard Hughes
b1ae0dcbbc logind: Fix trivial memory leak at startup
The g_dbus_proxy_get_name_owner() function is (return full).
2020-06-22 15:55:02 +01:00
Richard Hughes
b0426f8a24 tpm-eventlog: Fix memory leak when reading file
The file contents were literally just read four lines above.
2020-06-22 15:55:02 +01:00
Ryan Lee
4c177ad540 ccgx: add new protocol for dmc dock 2020-06-22 12:57:43 +01:00
Mario Limonciello
91e27e145a Add a new plugin for legacy BIOS
This plugin is only enabled when coreboot isn't detected.
It intentionally does not check for EFI to be disabled at startup
since it can also notify the user that UEFI capsule updates are
disabled on the system even if running in UEFI mode.
2020-06-22 11:22:18 +01:00
Richard Hughes
5a831fa7ab vli: Set the i2c instance IDs in probe()
They do not need to query the device, so ->setup() is not required.
2020-06-22 10:42:05 +01:00
Benson Leung
53fad4cd6c trivial: cros-ec: Use fu-memcpy-safe 2020-06-20 07:24:32 +01:00
Benson Leung
3a02ad5129 cros-ec: Add cros-ec-firmware
cros-ec firmware are in fmap layout, and have two sections
that this plugin will look for, the EC_RO, and EC_RW sections.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuCrosEcFirmware:
Version:                 2.4.17
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    FR_MAIN
  Index:                 0x2
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    RO_FRID
  Index:                 0x3
  Address:               0xc4
  Data:                  0x20
  FuFirmwareImage:
  ID:                    FMAP
  Index:                 0x4
  Address:               0x9a40
  Version:               1.0
  Data:                  0x15e
  FuFirmwareImage:
  ID:                    WP_RO
  Index:                 0x5
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    EC_RW
  Index:                 0x6
  Address:               0x10000
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00
Richard Hughes
0164141f9b trivial: Fix incorrect comment text 2020-06-19 10:59:16 +01:00
Richard Hughes
e5a4d52ea1 trivial: Spelling fixes from codespell 2020-06-18 20:49:12 +01:00
Mario Limonciello
7d5f6b0232 dell-dock: Add more module types to the enum
Unfortunately module type has more than I previously realized.
The meanings that previously were applied fortunately worked for
the most important case (130-180W TBT) but didn't for single C, dual
C or small power (45W) cases.

Since composite_prepare was trying to read and interpret these, it
causes failures when these other ones are encountered.

I reproduced this on a 130W adapter plugged into a single C (type 0x4).
This meant the update wouldn't install since NULL was returned for the
type.

In case a new module ID is added later, also return an "unknown" for
the metadata.
2020-06-17 17:10:05 -05:00
Mario Limonciello
f412227415 trivial: don't show reconstruction errors if uefi device is missing
The system must support UEFI capsule updates in order to measure
this. (Fixes: #2181)
2020-06-17 15:01:34 -05:00
Mario Limonciello
28bcecc028 trivial: fwupdtpmevlog: make clearer which algorithm is used 2020-06-17 15:01:34 -05:00
Mario Limonciello
9122999bfb tpm-eventlog: verify all algorithms, not just one of them
This will help to suss out any problems that are specific to sha1
or sha256 eventlog calculation.
2020-06-17 15:01:34 -05:00
Mario Limonciello
fe862a1d1b tpm-eventlog: Always look at all supported algorithms
This will effectively mean that both sha1 and sha256 results are
sent back to uefi plugin for analysis.
2020-06-17 15:01:34 -05:00
Richard Hughes
87143298cd pci-mei: Set the security attr result for a passed version 2020-06-17 18:37:27 +01:00
Mario Limonciello
8012fb3c8d trivial: dell-dock: clarify the pending update message (#2185)
To a user it's not obvious if being unplugged means host or AC adapter.
Unplugging from AC adapter will prevent the dock from completing an
update.
2020-06-17 11:49:33 -05:00
Richard Hughes
33b0f48b6f vli: Wait for the root device to be replugged when updating the MSP430
The MSP device is a virtual child of the USB hub.
2020-06-17 17:29:34 +01:00
Richard Hughes
a8610c3027 vli: Do not use GUID matching for the MSP device
Not strictly required, but it makes the FuDeviceList operation much simpler.
2020-06-17 17:29:34 +01:00
Richard Hughes
b114661a25 Collect per-device report metadata for the history database
Add two new vfuncs that can be used to collect report metadata from devices
both before and after the update has run. This means we can remove the hacks
where we set add 'global' metadata entries and just hope that there is only one
device from the same plugin that is updated.

This also allows us to collect debugging metadata from devices after an offline
update has been run.
2020-06-16 15:49:28 +01:00
Mario Limonciello
5b63015c19 tpm-eventlog: fix PCR0 calculation
One of the core problems is that systems with both sha1 and sha256
were miscalculating.

Fixes: #2181
2020-06-15 16:17:29 -05:00
Mario Limonciello
2caea54202 uefi: check for free space after cleaning up ESP
In a very small ESP situation it's possible that the amount of free
space is insufficient until it's actually been cleaned.

Fixes: #2179
2020-06-15 10:21:18 -05:00
Richard Hughes
4fd61e4756 vli: Use the GPIOB reset for the MiniDock VL103 2020-06-11 07:03:23 +01:00
Richard Hughes
6cd6e2adb6 vli: Set FuQuirks on the shared SPI object 2020-06-11 07:03:23 +01:00
Richard Hughes
92072b4239 vli: Add the project ID shared SPI PD controllers
The Mini-Dock and Travel-Hub accidentally share the same VID:PID and this is the
only way to tell them apart.
2020-06-11 07:03:23 +01:00
Richard Hughes
83a21cb7cd vli: Allow chained usb hub devices where the parent needs GPIOB reset
As both hub devices share a FuVliUsbhubDeviceClass instance we cannot 'hijack'
the vfuncs depending on object type. This allows the downstream hub to proxy to
the upstream hub where a GPIOB reset can be performed.
2020-06-09 11:56:30 +01:00
Richard Hughes
09950a13ce vli: Do not modify the class vfuncs depending on device type
We can have multiple FuVliPdDevice objects registered with the daemon, but they
will all share the FuVliPdDeviceClass instance. If one device requries a
silicon workaround, do not 'hijack' the vfunc for all devices of this type.

This means we do the right thing when updating both the one that requires the
workaround, and the 'normal' one.
2020-06-09 11:30:49 +01:00
Ryan Lee
59bb497a3e ccgx: modify install duration for dmc device 2020-06-09 10:37:26 +01:00
Ryan Lee
0942dcc413 ccgx: Add support for HP DMC dock devices 2020-06-05 13:35:54 +01:00
Mario Limonciello
c0a2798fb5 trivial: logitech_hidpp: set the protocol properly when bootloader unknown
This appears to be a regression from c6ae0d998b
where the case of bootloader version 0 didn't get protocol set.

Fixes: #2156
2020-06-02 10:27:13 -05:00
Richard Hughes
0f6d754d5a Detect if the MEI device has known security issues
If it has, fail HSI-1.
2020-06-01 22:49:39 +01:00
Richard Hughes
bb228cbe53 pci-mei: Check the HFS register for the override strap 2020-05-29 17:34:18 +01:00
Mario Limonciello
d5d496b62a trivial: uefi: fix dell TPM updates
Adding an extra header makes the firmware reject the GUID in the real
header.
2020-05-29 07:31:15 -05:00
Benson Leung
a22310374e cros-ec: Provide device metadata as a part of to_string
Provide the following metadata:

"Dirty firmware" bit
Protocol version
Header type
Maximum PDU Size
Flash protection status
Raw version string
Key Version
Minimum rollback
2020-05-29 06:55:40 +01:00
Benson Leung
092f87ae0c cros-ec: Add board name as a instance id and hash as metadata
These couple of extra things in the CrOS EC version string
were split off of the triplet, so give them a home.
2020-05-29 06:55:40 +01:00
Benson Leung
086d0c0eb6 cros-ec: Parse version number into triplet
Add fu_cros_ec_parse_version to common, as this will be used to
parse the firmware bundle's version string too.
2020-05-29 06:55:40 +01:00
Benson Leung
00bb3341d2 cros-ec: Add enough infrastructure for setup connection
This should do the bulk transfers using protocol 6.

The output here is now equivalent to the output of
usb_updater2 -d 18d1:501a -f

fwupdtool --plugin-whitelist cros_ec get-devices --verbose
Servo Micro
  DeviceId:             84d0e3f2a0f8b2328f7995767b23ebb40494723f
  Guid:                 8e2f7625-a164-55d7-8f09-f193c8ec33f1 <- USB\VID_18D1&PID_501A&REV_0100
  Guid:                 13564257-c649-586d-b4e4-4f048d480f36 <- USB\VID_18D1&PID_501A
  Serial:               CMO653-00166-040491U00771
  Summary:              Servo Micro (aka "uServo") Debug Board
  Plugin:               cros_ec_usb
  Flags:                registered
  Vendor:               Google Inc.
  VendorId:             USB:0x18D1
  Version:              servo_micro_v2.4.17-df61092c3
  VersionFormat:        plain
  Created:              2020-05-20
  PhysicalId:            usb:03:00:02
2020-05-29 06:55:40 +01:00
Benson Leung
7aa00f6ee8 cros-ec: Add usb_findit functionality
Find the interface and endpoint used for firmware updates.
Note: this change now requires libgusb 0.3.3 or later.
2020-05-29 06:55:40 +01:00
Benson Leung
b483044a8d cros-ec: Initial skeleton
Set it up as a USB device plugin, with the initial device in quirks
being Servo Micro debug board.
2020-05-29 06:55:40 +01:00
Mario Limonciello
838ae163e3 dell-dock: prevent updates to occur via synaptics-mst plugin
Although they normally work, some failures have been reported in the field
related to the MST hub not responding in the MST plugin.

When these failures have occurred the dell_dock plugin also fails to
enumerate.

So rather than allow some people who don't have dell_dock compiled to
update their MST hub using synaptics_mst, perform ALL updates for
mst hub via dell_dock.

```
18:06:24:0324 FuPluginSynapticsMST no device found on drm_dp_aux1: VMM5331 inside Dell dock is only supported by dell_dock
```
2020-05-28 08:59:07 -05:00
Richard Hughes
862ec5c65b Skip module unloading only if we are actually running under valgrind
See also: https://github.com/fwupd/fwupd/issues/2119
Reported-by: Anton Farygin <rider@altlinux.org>

Based on a patch by Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2020-05-28 06:56:45 -05:00
Mario Limonciello
d39bcee29d trivial: detect cpuid.h and also look for host architecture
Fixes cross compilation for arm with clang which provides cpuid.h
but helpfully has this error:
```
 #if !(__x86_64__ || __i386__)
 #error this header is for x86 only
 #endif
```

Fixes: #2131
2020-05-26 15:06:08 -05:00
Mario Limonciello
a42daefb9e dell-dock: Capture the dock SKU in metadata
Should be helpful in reproducing failure reports.
2020-05-26 10:22:58 -05:00
Richard Hughes
4b16642dc5 ccgx: Fix a potential division by zero
Spotted by Coverity.
2020-05-22 15:34:16 +01:00
Richard Hughes
e3091c394b trivial: Move the SecureBoot attr to a runtime issue 2020-05-22 15:15:09 +01:00
Mario Limonciello
bb6b1a8693 Revert "amt: Add a security attestation for provisioning"
This reverts commit f160e6b7fc.
2020-05-22 15:13:19 +01:00
Richard Hughes
c821923668 Add an HSI attribute for Intel SMAP
See https://en.wikipedia.org/wiki/Supervisor_Mode_Access_Prevention for details.
2020-05-22 07:26:47 +01:00
Richard Hughes
0abba6cbb0 ata: A OUI quirk for Kingston
Fixes https://github.com/fwupd/fwupd/issues/2121
2020-05-21 11:16:08 +01:00
Vincent Huang
0a11350396 synaptics-prometheus: Force the minor version from 0x02 to 0x01 to make
sure the devices can be updated back to 0x01.
2020-05-19 15:12:10 +01:00
Mario Limonciello
7c8e9cf316 trivial: pci-mei: use driver to detect which plugin to use instead of a list
Let the kernel keep track of all the supported devices instead.
2020-05-19 09:05:52 -05:00
Richard Hughes
f6b48edebf pci-bcr: Read the ISA bridge BCR from the PCI device class
The SPI controllers are always identified with one of two device classes.
2020-05-18 21:16:59 -05:00
Richard Hughes
de8d40d602 tpm-eventlog: Do not return a security attr if there is no TPM device
There is literally no point in showing two TPM failures.
2020-05-18 15:43:23 -05:00
Richard Hughes
2157468709 pcr-bpc: Don't show the 'Not found' message for BLE and SMM_BWP
If we did not find the device for BIOSWP it is completely useless.
2020-05-18 15:43:23 -05:00
Richard Hughes
b246bcaecb Allow client tools to translate the HSI attributes and results
To do this, rely on the AppStream ID to map to a translated string (providing a
fallback for clients that do not care) and switch the free-form result string
into a set of enumerated values that can be translated.

This fixes some of the problems where some things have to be enabled to "pass"
and other attributes have to be some other state. For cases where we want the
user to "do" something, provide a URL to a wiki page that we update out-of-band
of fwupd releases.
2020-05-18 17:03:49 +01:00
Mario Limonciello
d67a77cb9d trivial: fix TME support
On a CPU that does support it the security check was still failing.
2020-05-16 06:16:57 +01:00
Richard Hughes
63fa4effd3 pci-mei: Check the ME device is not in manufacturing mode 2020-05-15 21:28:27 -05:00
Mario Limonciello
8b5bcbb9e3 Add a new plugin for IOMMU support 2020-05-15 11:32:51 -05:00
Mario Limonciello
6ecf511d52 trivial: pci-bcr: request pci udev subsystem
If another plugin didn't do this, the pci-bcr plugin doesn't work.
It's noticable by --plugin-whitelist=pci_bcr
2020-05-15 11:32:51 -05:00
Mario Limonciello
921c22725a trivial: acpi-dmar: Correct platform-opt in flag 2020-05-15 11:32:51 -05:00
Richard Hughes
8a71bd128f vli: Add no-guid-matching for all VLI devices
We need to detect different USB 3.x hubs on the ThinkPad Basic, Pro and Ultra
docking stations.
2020-05-15 16:38:18 +01:00
Richard Hughes
71d6fe5ffa vli: Remove a copy-and-paste mistake
This is not a PD device, it's a USB hub.
2020-05-15 16:38:18 +01:00
Richard Hughes
cae111d1de Save the plugin that created the FwupdSecurityAttr
This is really useful for debugging.
2020-05-15 16:17:27 +01:00
Richard Hughes
43451d458b pci-bcr: Fail HSI:1 if the BCR register cannot be loaded
Add obsoletes to attributes added by linux-spi-lpc if we're using the kernel
support for hidden PCI devices.
2020-05-15 09:17:33 -05:00
Mario Limonciello
983263bc8d cpu: Add support for a security attribute related to Intel TME
This only checks that it was available from the CPU.
To be complete an additional check should be made to show that it
was actually enabled from the firmware.

This will require a kernel modification though because MSR access
will be forbidden from userland while in kernel lockdown.
2020-05-15 07:16:17 -05:00
Richard Hughes
730e2bd6e3 linux-spi-lpc: Disable by default
The kernel patches are a log way from being upstreamed, so disable this until
there is even a chance the user might be running it.

This removes the obsoletes line from *every* system running 'fwupdmgr security'.
2020-05-15 10:21:07 +01:00