Commit Graph

125 Commits

Author SHA1 Message Date
Richard Hughes
faa7871b08 Remove duplicate ->probe() calls to speed up startup by 150ms
Now incorporate is fixed to copy across the properties we need in the
superclass, we don't need to do the subclass ->probe().

Note, we still need to do the subclassed ->probe() when using
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT or when looking at properties
on the parent device.

This also removes the spurious 'already set GType to FuVliUsbhubDevice,
ignoring FuVliUsbhubDevice' messages when running the daemon.
2022-06-14 21:01:57 +01:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
067d7d8088 Split out the path helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
ed1b13da28 Split out the memory helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
0d1ba6667f trivial: Remove a few ctags headers that snuck in 2022-06-14 17:57:38 +01:00
Richard Hughes
e6b487e762 Add FuProgress to ->startup() and ->coldplug()
This allows us to profile the daemon startup so we can find any plugins
taking an inordinate amount of time to start.
2022-06-04 20:21:50 +01:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
2870426958 trivial: Fix a critical warning when no flashrom devices are found 2022-05-10 10:39:04 +01:00
Richard Hughes
9f584a234a flashrom: Allow dumping firmware using fwupdtool 2022-05-04 14:10:18 +01:00
Richard Hughes
c0bdb8dd7a flashrom: Only set the BIOS size if not already quirked 2022-05-04 11:11:23 +01:00
Richard Hughes
5ac8594d92 flashrom: Use more ideomatic GLib style 2022-05-04 11:11:23 +01:00
Sergii Dmytruk
e9f765dc47 plugins/flashrom/fu-flashrom-device.c: create layout on open
This avoids possible reading IFD multiple times and fixes a memory leak
of layout on errors and an unconditional leak in
fu_flashrom_device_prepare(), which didn't call
flashrom_layout_release().

Notice that flashrom_layout_set() call does NOT transfer ownership.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
e1d708a4ff plugins/flashrom: manage flashrom context at plugin level
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
ddf4e10d7b plugins/flashrom: enable for 2 Tuxedo laptops
Their ME region in flash can be unlocked manually, give user
instructions on how to do it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
e65cb98cc8 plugins/flashrom: add flashrom-specific GUIDs
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
2bac03eee1 plugins/flashrom: create separate device for ME region
Created only if intel_spi plugin indicates that the region exists by
creating its own device for it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-21 15:39:47 +01:00
Sergii Dmytruk
523ed0d7b4 plugins/flashrom: make region we're flashing a property
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2022-04-19 10:47:41 +01:00
Richard Hughes
2d5186622c Add FuProgress to ->prepare and ->cleanup
Some plugins were creating local versions (which were not attached to
the daemon progress in any way) as a workaround as they needed to do
actions that took a long time to complete.
2022-04-15 16:50:06 +01:00
Richard Hughes
18301f92cf flashrom: Fix a harmless warning when adding an instance ID 2022-04-05 11:38:30 +01:00
Richard Hughes
3390d7f9a5 flashrom: Allow quirking the flashrom flash size
We were using an 'undocumented' local copy of the flash size, when
FuDevice was setting the [ignored] standard device property.
2022-04-05 11:38:30 +01:00
Michał Kopeć
d3ce827f96 plugins/flashrom/flashrom.quirk: update NovaCustom GUIDs
Add NS5x GUID and missing NV4x guids for devices running older firmware versions.

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2022-04-01 12:43:18 +01:00
Sean Rhodes
0ac171c452
plugins/flashrom: Move MaxSize quirk to GUID (#4468)
Move the quirk from HwID to GUID to the apply correctly.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-31 20:38:38 +01:00
Sean Rhodes
d8b6f5f0b3
plugin/flashrom: Change the default format from triplet to pair (#4395)
Flashrom is primarily used with coreboot, which has a pair version number
currently 4.16. As such, chance the default to pair so that fewer quirks
are required.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-17 07:58:25 +00:00
Sean Rhodes
57862d844e
plugin/flashrom: Add GUIDs for StarLite's (#4392)
* HwId for StarLite Mk IV
* coreboot GUID for StarLite Mk IV
* HwId for StarLite Mk II (under coreboot)
* coreboot GUID for StarLite Mk II

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-16 10:18:20 +00:00
Richard Hughes
8b62bf6b64 Set the context in the right place more often 2022-03-16 09:18:29 +00:00
Richard Hughes
6fdae41ae0 flashrom: Simplify the plugin to remove the indirection
For a while we flirted with the idea of updating non-internal
libflashrom-derived devices but the impedance mismatch was just too
great.

We removed the extra unused subclasses of FuFlashromDevice, but never
removed the indirection we added for the writing.
Remove the unused code now that we agree on the longer term plan.
2022-03-09 08:13:13 +00:00
Sean Rhodes
f98acc89b3
plugin/flashrom: Add MaxSize quirk for Lite II and III (#4362)
Add FirmwareSizeMax = 0x800000 for StarLite Mk II and Mk III to allow
switching from AMI to coreboot firmware.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-03-07 14:26:36 +00:00
Mario Limonciello
661990ed98 Convert build system to use meson tristate features
tristate features will automatically disable if dependencies marked
as required are missing.

Packagers can manually override using `auto_features`.

Link: https://mesonbuild.com/Build-options.html#features
2022-02-28 08:34:48 -06:00
Richard Hughes
f3a13f89dd Allow specifing the DeviceIntegrity flag from metadata 2022-02-22 19:12:06 +00:00
Sean Rhodes
f1f938dfd8 plugins/flashrom: Add Star Lite Mk III coreboot GUID
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-02-15 21:46:48 -06:00
Michał Kopeć
ab06e034c3 plugins/flashrom: add quirk for NovaCustom NV4x
Add a quirk for NovaCustom NV4x devices.
These laptops are running coreboot and are updatable using flashrom.

The HwId GUID matches to both previous Insyde firmware and the current
Dasharo firmware. The Dasharo GUID matches to the devices running
Dasharo firmware. This way the device can be switched from Insyde
to Dasharo using `fwupdmgr switch-branch`.

Homepage: https://configurelaptop.eu/nv40-series/

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2022-02-01 14:15:45 +00:00
Richard Hughes
ca43733a8c Show why devices are not marked as updatable
At the moment a lot of the failures are only visible when running the
daemon in verbose mode, and the inhibit functionalit provides us a way
to unset FWUPD_DEVICE_FLAG_UPDATABLE from multiple places, as well as
setting the update error for the user to see why.
2022-01-13 12:40:56 +00:00
Sean Rhodes
19c7ee2423 plugins/flashrom: Change StarLabs devices from number to plain
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-12-17 16:44:16 +00:00
Richard Hughes
58d36dcbe5 Check the value range when parsing the quirk keys
At the moment there isn't an error if you enter something like

    CfiDeviceCmdReadId = 0×12
2021-12-09 13:09:43 +00:00
Richard Hughes
e87fc05ab9 Speed up the daemon startup by ~2% by doing dlsym much less
We were calling g_module_symbol() 2703 times, which is actually more
expensive than you'd think.

It also means the plugins are actually what we tell people they are:
A set of vfuncs that get run. The reality before that they were dlsym'd
functions that get called at pretty random times.
2021-11-09 12:02:07 +00:00
Richard Hughes
bc43adf020 Fix build error when sys/io.h is not available 2021-10-06 20:38:43 +01:00
Sean Rhodes
2bd8e80d03
plugins/flashrom: Always shutdown after flashing (#3831)
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-05 08:57:20 +01:00
Sean Rhodes
71b52abb66
plugins/flashrom: Reset CMOS aftering writing region (#3814)
Resetting the CMOS before a write when switching branch will cause a lock on\
reboot which requires hard power off.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-01 14:32:19 +01:00
Sean Rhodes
49c08f436f
plugins/uefi-capsule: Disable ux-capsule for all StarLabs laptops (#3815)
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-09-30 08:52:02 +01:00
Richard Hughes
a3cd497bd1 flashrom: Ensure internal devices get an assigned context
This makes the quirks work correctly. Fixes a warning seen in the logs.
2021-09-27 11:06:13 +01:00
Sean Rhodes
2694abeb71 plugins/flashrom: Update StarBook GUID
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-09-27 08:24:26 +01:00
Richard Hughes
40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00
Sean Rhodes
f959b198d2 plugins/flashrom: Fix logic in reset cmos
ioperm returns -1 for an error and 0 for success
2021-09-13 12:09:37 +01:00
Sean Rhodes
8cc158bda4 plugins/flashrom: Add reset-cmos flag to Star Labs laptops 2021-09-11 07:47:14 -05:00
Sean Rhodes
af9d9b3ffd plugins/flashrom: Add private flag to reset CMOS
Reset the CMOS based on a private flag. Tested on coreboot using an
offset of 123. Required when a CMOS layout or default option has
changed as the resulting flash will have 0's for the modified option.
2021-09-10 16:25:32 +01:00
Sean Rhodes
bcf6253134 plguins/flashrom: Add GUID for StarBook coreboot 2021-09-09 22:31:56 +01:00
Sean Rhodes
33e850dea5 plugins/{superio,flashrom}: Add GUIDs for StarBook Mk V 2021-09-09 14:26:36 -05:00
Sean Rhodes
2e856d21e0 plugins/flashrom: Only backup BIOS region
As we are only writing to the BIOS region, we only need to backup the BIOS
region. The will avoid the error "failed to back up original firmware" if
regions such as the ME can't be read.
2021-09-03 12:04:20 +01:00