diff options
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/cannonlake/fsp_params.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/soc/intel/cannonlake/fsp_params.c b/src/soc/intel/cannonlake/fsp_params.c index e3a2310d5c..77d82d64f8 100644 --- a/src/soc/intel/cannonlake/fsp_params.c +++ b/src/soc/intel/cannonlake/fsp_params.c @@ -40,22 +40,28 @@ static const int serial_io_dev[] = { PCH_DEVFN_UART2 }; +/* + * Given an enum for PCH_SERIAL_IO_MODE, 1 needs to be subtracted to get the FSP + * UPD expected value for Serial IO since valid enum index starts from 1. + */ +#define PCH_SERIAL_IO_INDEX(x) ((x) - 1) + static uint8_t get_param_value(const config_t *config, uint32_t dev_offset) { struct device *dev; dev = dev_find_slot(0, serial_io_dev[dev_offset]); if (!dev || !dev->enabled) - return PchSerialIoDisabled; + return PCH_SERIAL_IO_INDEX(PchSerialIoDisabled); if ((config->SerialIoDevMode[dev_offset] >= PchSerialIoMax) || (config->SerialIoDevMode[dev_offset] == PchSerialIoNotInitialized)) - return PchSerialIoPci; + return PCH_SERIAL_IO_INDEX(PchSerialIoPci); /* * Correct Enum index starts from 1, so subtract 1 while returning value */ - return config->SerialIoDevMode[dev_offset] - 1; + return PCH_SERIAL_IO_INDEX(config->SerialIoDevMode[dev_offset]); } #if IS_ENABLED(CONFIG_SOC_INTEL_COMETLAKE) |