Commit Graph

28 Commits

Author SHA1 Message Date
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
a5a978b3f6 Rename some confusing API
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.

The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
2021-08-06 19:49:53 +01:00
Richard Hughes
6c2535a71f uefi-capsule: Disable all UX capsules for Lenovo hardware
Applying updates to my new P1G3:

 * schedule the update in fwupd
 * boot into the BootNext
 * apply the capsule with RT->UpdateCapsule
 * reboot with RT->ResetSystem

Except the firmware updater EFI binary then wasn't running. The ESRT
last_attempt_status comes back as Success on the reboot.

Disabling the UX capsule made the update apply correctly each and every
time. Until we can work out what models are affected, use a per-vendor
quirk to avoid delaying the release.
2021-08-02 14:26:45 +01:00
Mario Limonciello
b87c6dab95 uefi-capsule: Add support for installing UEFI updates from GRUB
Shim has had a hard time with loading updates from arguments in the
most recent release and this isn't the first time that happened.

Give distros and users an escape hatch that will allow using GRUB
instead.
2021-07-28 17:11:39 +01:00
Richard Hughes
3747e245e5 uefi-capsule: Add support for CapsuleOnDisk
Based on a patch by Ilias Apalodimas <ilias.apalodimas@linaro.org>,
many thanks.

Fixes https://github.com/fwupd/fwupd/issues/2900
2021-07-28 17:11:39 +01:00
Richard Hughes
9f808bdbc0 uefi-capsule: Convert two metadata booleans to private flags 2021-07-22 12:47:54 +01:00
Richard Hughes
305e69f73b uefi-capsule: Rename the plugin flag to match the device flag 2021-07-22 12:47:54 +01:00
Richard Hughes
7b40c111c7 uefi-capsule: Move the results capsule to the FuDevice subclass
This allows us to create subclasses of FuUefiDevice that use different
ways to report update success.
2021-07-22 12:47:54 +01:00
Richard Hughes
aaa77c6f51 Allow adding and removing custom flags on devices
The CustomFlags feature is a bit of a hack where we just join the flags
and store in the device metadata section as a string. This makes it
inefficient to check if just one flag exists as we have to split the
string to a temporary array each time.

Rather than adding to the hack by splitting, appending (if not exists)
then joining again, store the flags in the plugin privdata directly.

This allows us to support negating custom properties (e.g. ~hint) and
also allows quirks to append custom values without duplicating them on
each GUID match, e.g.

[USB\VID_17EF&PID_307F]
Plugin = customflag1
[USB\VID_17EF&PID_307F&HUB_0002]
Flags = customflag2

...would result in customflag1,customflag2 which is the same as you'd
get from an enumerated device flag doing the same thing.
2021-06-23 07:59:15 +01:00
Mario Limonciello
73cdf067ed trivial: fixup includes for a variety of plugins 2021-06-14 10:12:45 +01:00
Richard Hughes
694e774c2a uefi-capsule: Make less Linux-specific
Based on patches by Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-07 19:54:12 +01:00
Sergii Dmytruk
4558e5f317 Fix two off-by-one errors in uefi-capsule plugin
Data is accessed at offset 0x13, so the code must abort if size is
0x13 when you can access only offsets 0x00 through 0x12.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2021-06-07 11:18:57 +01:00
Richard Hughes
6c07675558 uefi-capsule: Split out the Linux specific ESRT enumeration
This allows us to add the same functionality for FreeBSD and Windows.
2021-05-25 17:17:45 +01:00
Richard Hughes
769cbbf8af Add support for the PHAT table
On Alterlake and newer hardware the Platform Health Assessment Record
data can be used by the IHV to debug why a specific capsule update
failed. Any custom firmware loaded by the OEM can be identified and
used to further debug the root cause.
2021-05-12 12:02:33 +01:00
Richard Hughes
b333e0045c Split out a shared system context
There is a lot of code in fwupd that just assigns a shared object type to
a FuPlugin, and then for each device on that plugin assigns that same shared
object to each FuDevice.

Rather than proxy several kinds of information stores over two different levels
of abstraction create a 'context' which contains the shared *system* state
between the daemon, the plugins and the daemon.

This will allow us to hold other per-machine state in the future, for instance
the system battery level or AC state.
2021-04-01 21:11:29 +01:00
Richard Hughes
b9ac0bc029 Add fu_device_inhibit() to mark the device as non-updatable
We already have two things managing the UPDATABLE_HIDDEN->UPDATABLE transition,
and we're about to add a third.

Add a 'stackable' inhibit-style API so we do not accidentally mark a device as
updatable when it should remain hidden.
2021-03-31 19:19:46 +01:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00
Richard Hughes
05217338b3 uefi: Do not use fu_plugin_has_custom_flag() in _init()
This means we can defer loading the quirks until all the plugins have loaded.
2021-03-02 06:33:46 +00:00
Richard Hughes
ed0af24406 trivial: Use fwupd_device_remove_flag() to remove a single flag 2021-02-22 22:48:56 +00:00
Richard Hughes
8887b9128b uefi-capsule: Use an integer for EfivarNvramUsed
This is much easier to parse on the LVFS.

Fixes https://github.com/fwupd/fwupd/issues/2834
2021-02-06 14:23:09 +00:00
Richard Hughes
5d7fb6ad88 uefi-capsule: Check if the fwupd BootXXXX entry exists on failure
Some systems remove the BootXXXX entry we add (so we can run fwupdx64.efi) and
thus the firmware update does not run. Most commonly this failure is seen with
Lenovo systems that call the helpful option 'Boot Order Lock'.

Hopefully when we depend on the new kernel bios interface sysfs API in we can
check in ->prepare(), not after reboot, but until that we can mark the update
failure as transient as the user can actually fix the problem themselves.

Fixes https://github.com/fwupd/fwupd/issues/2801
2021-01-27 14:49:57 +00:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
11603b3e06 Install the UX data into a single .tar.xz file
This allows much better compression (-60%) than gziping them individually and
also allows us to build the capsule UX images as part of the build stage.

Also add more popular screen resolutions for laptops you can buy in 2021.
2021-01-20 11:03:20 +00:00
Richard Hughes
a512d91d43 Report the lockdown status from UEFI and SuperIO plugins
I was asked the other day how many machines would support a /dev/mem mmap'd
update mechanism, and I had to say that I didn't know. We use direct port IO in
the SuperIO plugin too, and it would be good to know how quickly we need to
port this to something else.
2021-01-19 14:57:10 +00:00
Richard Hughes
a676a5ec70 Do not allow Lenovo hardware to install multiple capsules
Once a device has been scheduled for update mark the others from the same plugin
as updatable-hidden rather than updatable so that fwupdmgr or gnome-software
does not try to offer updates for them.
This is preferable to quitting with an error in FuDevice->prepare as we don't
want to waste bandwidth downloading the next update and then show the user an
error they can't possibly understand.

Exclude the currently scheduled device to allow the user to change the scheduled
release and so the pending device does not disappear from UI tools.
2021-01-15 21:43:45 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
cf100293b5 Do not export useless device attributes to the client
That giant uint64_t isn't looking so big now, and we'll want to add even more
to it in the future. Split out some private flags that are never useful to the
client, although the #defines will have to remain until we break API again.
2021-01-06 14:36:23 +00:00
Richard Hughes
ee2e2c3674 uefi: Rename to uefi-capsule
Rename the plugin to make it clearer of the scope.

Based on a patch from Mario Limonciello <mario.limonciello@dell.com>
2021-01-05 15:31:22 +00:00