mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-16 12:20:05 +00:00
genesys: scaler: Fix checking for CFI size
This commit is contained in:
parent
81f40da143
commit
ace3f343fc
@ -1639,6 +1639,8 @@ static gboolean
|
|||||||
fu_genesys_scaler_device_setup(FuDevice *device, GError **error)
|
fu_genesys_scaler_device_setup(FuDevice *device, GError **error)
|
||||||
{
|
{
|
||||||
FuGenesysScalerDevice *self = FU_GENESYS_SCALER_DEVICE(device);
|
FuGenesysScalerDevice *self = FU_GENESYS_SCALER_DEVICE(device);
|
||||||
|
guint64 size_min = fu_device_get_firmware_size_max(device);
|
||||||
|
guint64 size;
|
||||||
guint32 sector_size;
|
guint32 sector_size;
|
||||||
guint32 page_size;
|
guint32 page_size;
|
||||||
|
|
||||||
@ -1653,16 +1655,18 @@ fu_genesys_scaler_device_setup(FuDevice *device, GError **error)
|
|||||||
if (page_size != 0)
|
if (page_size != 0)
|
||||||
self->page_size = page_size;
|
self->page_size = page_size;
|
||||||
|
|
||||||
if (fu_device_get_firmware_size_max(device) == 0) {
|
if (fu_device_has_flag(device, FWUPD_DEVICE_FLAG_DUAL_IMAGE))
|
||||||
guint64 size_max = fu_device_get_firmware_size_max(FU_DEVICE(self->cfi_device));
|
size_min *= 2;
|
||||||
|
|
||||||
if (size_max == 0)
|
size = fu_device_get_firmware_size_max(FU_DEVICE(self->cfi_device));
|
||||||
size_max = 0x400000;
|
if (size != 0 && size < size_min) {
|
||||||
|
g_set_error(error,
|
||||||
if (fu_device_has_flag(device, FWUPD_DEVICE_FLAG_DUAL_IMAGE))
|
FWUPD_ERROR,
|
||||||
size_max /= 2;
|
FWUPD_ERROR_INTERNAL,
|
||||||
|
"CFI device too small, got 0x%x, expected >= 0x%x",
|
||||||
fu_device_set_firmware_size_max(FU_DEVICE(self), size_max);
|
(guint)size,
|
||||||
|
(guint)size_min);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
@ -1968,9 +1972,10 @@ fu_genesys_scaler_device_init(FuGenesysScalerDevice *self)
|
|||||||
fu_device_register_private_flag(FU_DEVICE(self), FU_SCALER_FLAG_USE_I2C_CH0, "use-i2c-ch0");
|
fu_device_register_private_flag(FU_DEVICE(self), FU_SCALER_FLAG_USE_I2C_CH0, "use-i2c-ch0");
|
||||||
fu_device_set_install_duration(FU_DEVICE(self), 730); /* 12 min 10 s */
|
fu_device_set_install_duration(FU_DEVICE(self), 730); /* 12 min 10 s */
|
||||||
|
|
||||||
self->sector_size = 0x1000; /* 4KB */
|
self->sector_size = 0x1000; /* 4KB */
|
||||||
self->page_size = 0x100; /* 256B */
|
self->page_size = 0x100; /* 256B */
|
||||||
self->transfer_size = 0x40; /* 64B */
|
self->transfer_size = 0x40; /* 64B */
|
||||||
|
fu_device_set_firmware_size(FU_DEVICE(self), GENESYS_SCALER_BANK_SIZE); /* 2MB */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
#include "fu-genesys-scaler-firmware.h"
|
#include "fu-genesys-scaler-firmware.h"
|
||||||
|
|
||||||
#define GENESYS_SCALER_BANK_SIZE 0x200000U
|
|
||||||
|
|
||||||
struct _FuGenesysScalerFirmware {
|
struct _FuGenesysScalerFirmware {
|
||||||
FuFirmwareClass parent_instance;
|
FuFirmwareClass parent_instance;
|
||||||
FuGenesysMtkFooter footer;
|
FuGenesysMtkFooter footer;
|
||||||
|
@ -17,6 +17,8 @@ G_DECLARE_FINAL_TYPE(FuGenesysScalerFirmware,
|
|||||||
GENESYS_SCALER_FIRMWARE,
|
GENESYS_SCALER_FIRMWARE,
|
||||||
FuFirmware)
|
FuFirmware)
|
||||||
|
|
||||||
|
#define GENESYS_SCALER_BANK_SIZE 0x200000U
|
||||||
|
|
||||||
#define MTK_RSA_HEADER "MTK_RSA_HEADER"
|
#define MTK_RSA_HEADER "MTK_RSA_HEADER"
|
||||||
|
|
||||||
typedef struct __attribute__((packed)) {
|
typedef struct __attribute__((packed)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user