summaryrefslogtreecommitdiff
path: root/src/soc/intel/jasperlake/fsp_params.c
diff options
context:
space:
mode:
authorLean Sheng Tan <lean.sheng.tan@intel.com>2021-06-16 00:18:19 -0700
committerWerner Zeh <werner.zeh@siemens.com>2021-06-18 06:03:39 +0000
commit0e7c519546f1545f35102c9cf61fcbae88cf5e8c (patch)
tree00a21fe542be0a59ae8090943f1ac8f0f49a18ea /src/soc/intel/jasperlake/fsp_params.c
parent8bbff1f55494db50b92306a5f65c634c87e9c9d7 (diff)
soc/intel/jasperlake: Make use of FSP_ARRAY_LOAD macro
Add FSP_ARRAY_LOAD macro for checking and loading array type configs into array type UPDs to increase readability. Signed-off-by: Lean Sheng Tan <lean.sheng.tan@intel.com> Change-Id: Ia20cabcaf9724882c68633eb9b510230e993768c Reviewed-on: https://review.coreboot.org/c/coreboot/+/55560 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/soc/intel/jasperlake/fsp_params.c')
-rw-r--r--src/soc/intel/jasperlake/fsp_params.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/soc/intel/jasperlake/fsp_params.c b/src/soc/intel/jasperlake/fsp_params.c
index 4f2b936c4b..9056943efd 100644
--- a/src/soc/intel/jasperlake/fsp_params.c
+++ b/src/soc/intel/jasperlake/fsp_params.c
@@ -35,32 +35,15 @@ static void parse_devicetree(FSP_S_CONFIG *params)
/* LPSS controllers configuration */
/* I2C */
- _Static_assert(ARRAY_SIZE(params->SerialIoI2cMode) >=
- ARRAY_SIZE(config->SerialIoI2cMode), "copy buffer overflow!");
- memcpy(params->SerialIoI2cMode, config->SerialIoI2cMode,
- sizeof(config->SerialIoI2cMode));
+ FSP_ARRAY_LOAD(params->SerialIoI2cMode, config->SerialIoI2cMode);
/* GSPI */
- _Static_assert(ARRAY_SIZE(params->SerialIoSpiMode) >=
- ARRAY_SIZE(config->SerialIoGSpiMode), "copy buffer overflow!");
- memcpy(params->SerialIoSpiMode, config->SerialIoGSpiMode,
- sizeof(config->SerialIoGSpiMode));
-
- _Static_assert(ARRAY_SIZE(params->SerialIoSpiCsMode) >=
- ARRAY_SIZE(config->SerialIoGSpiCsMode), "copy buffer overflow!");
- memcpy(params->SerialIoSpiCsMode, config->SerialIoGSpiCsMode,
- sizeof(config->SerialIoGSpiCsMode));
-
- _Static_assert(ARRAY_SIZE(params->SerialIoSpiCsState) >=
- ARRAY_SIZE(config->SerialIoGSpiCsState), "copy buffer overflow!");
- memcpy(params->SerialIoSpiCsState, config->SerialIoGSpiCsState,
- sizeof(config->SerialIoGSpiCsState));
+ FSP_ARRAY_LOAD(params->SerialIoSpiMode, config->SerialIoGSpiMode);
+ FSP_ARRAY_LOAD(params->SerialIoSpiCsMode, config->SerialIoGSpiCsMode);
+ FSP_ARRAY_LOAD(params->SerialIoSpiCsState, config->SerialIoGSpiCsState);
/* UART */
- _Static_assert(ARRAY_SIZE(params->SerialIoUartMode) >=
- ARRAY_SIZE(config->SerialIoUartMode), "copy buffer overflow!");
- memcpy(params->SerialIoUartMode, config->SerialIoUartMode,
- sizeof(config->SerialIoUartMode));
+ FSP_ARRAY_LOAD(params->SerialIoUartMode, config->SerialIoUartMode);
}
/* UPD parameters to be initialized before SiliconInit */
@@ -151,15 +134,8 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->SataMode = config->SataMode;
params->SataSalpSupport = config->SataSalpSupport;
- _Static_assert(ARRAY_SIZE(params->SataPortsEnable) >=
- ARRAY_SIZE(config->SataPortsEnable), "copy buffer overflow!");
- memcpy(params->SataPortsEnable, config->SataPortsEnable,
- sizeof(params->SataPortsEnable));
-
- _Static_assert(ARRAY_SIZE(params->SataPortsDevSlp) >=
- ARRAY_SIZE(config->SataPortsDevSlp), "copy buffer overflow!");
- memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
- sizeof(params->SataPortsDevSlp));
+ FSP_ARRAY_LOAD(params->SataPortsEnable, config->SataPortsEnable);
+ FSP_ARRAY_LOAD(params->SataPortsDevSlp, config->SataPortsDevSlp);
}
/* VR Configuration */