flashrom: Only set the BIOS size if not already quirked

This commit is contained in:
Richard Hughes 2022-05-04 10:45:18 +01:00
parent 5ac8594d92
commit c0bdb8dd7a

View File

@ -113,7 +113,6 @@ fu_plugin_flashrom_device_set_bios_info(FuPlugin *plugin, FuDevice *device)
const guint8 *buf;
gsize bufsz;
guint32 bios_char = 0x0;
guint8 bios_sz = 0x0;
g_autoptr(GBytes) bios_table = NULL;
/* get SMBIOS info */
@ -121,11 +120,14 @@ fu_plugin_flashrom_device_set_bios_info(FuPlugin *plugin, FuDevice *device)
if (bios_table == NULL)
return;
/* ROM size */
/* ROM size if not already been quirked */
buf = g_bytes_get_data(bios_table, &bufsz);
if (fu_common_read_uint8_safe(buf, bufsz, 0x9, &bios_sz, NULL)) {
guint64 firmware_size = (bios_sz + 1) * 64 * 1024;
fu_device_set_firmware_size_max(device, firmware_size);
if (fu_device_get_firmware_size_max(device) == 0) {
guint8 bios_sz = 0x0;
if (fu_common_read_uint8_safe(buf, bufsz, 0x9, &bios_sz, NULL)) {
guint64 firmware_size = (bios_sz + 1) * 64 * 1024;
fu_device_set_firmware_size_max(device, firmware_size);
}
}
/* BIOS characteristics */