soc/intel/alderlake: Restore mem_init_override_channel_mask()

Commit 87c9bb3994 ("soc/intel/adl: Fill in SPD data on both channels
of DDR5 memory") accidentally deleted the function
mem_init_override_channel_mask().

Additionally, skip checking for channel 0 while consuming the channel
disable mask.

BUG=none
TEST=CQ

Change-Id: I6217b2801e88b8ab98b2a3acaa0cb9580b05bb64
Signed-off-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88697
Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Kapil Porwal 2025-08-06 09:31:53 +05:30 committed by Subrata Banik
commit 1da2f46db8

View file

@ -230,6 +230,40 @@ static void mem_init_dqs_upds(FSP_M_CONFIG *mem_cfg, const struct mem_channel_da
mem_init_dq_dqs_upds(dqs_upds, mb_cfg->dqs_map, upd_size, data, auto_detect);
}
/*
* A memory channel will be disabled if corresponding bit in
* ch_disable_mask is set.
*/
static void mem_init_override_channel_mask(FSP_M_CONFIG *mem_cfg)
{
uint8_t *disable_channel_upds[MRC_CHANNELS] = {
&mem_cfg->DisableMc0Ch0,
&mem_cfg->DisableMc0Ch1,
&mem_cfg->DisableMc0Ch2,
&mem_cfg->DisableMc0Ch3,
&mem_cfg->DisableMc1Ch0,
&mem_cfg->DisableMc1Ch1,
&mem_cfg->DisableMc1Ch2,
&mem_cfg->DisableMc1Ch3,
};
uint8_t ch_disable_mask = mb_get_channel_disable_mask();
if (ch_disable_mask == 0)
return;
/* Mc0Ch0 cannot be disabled */
if (ch_disable_mask & BIT(0)) {
printk(BIOS_ERR, "Cannot disable the first memory channel (Mc0Ch0).\n");
return;
}
for (size_t ch = 1; ch < MRC_CHANNELS; ch++) {
if (ch_disable_mask & BIT(ch))
*disable_channel_upds[ch] = 1;
}
}
void memcfg_init(FSPM_UPD *memupd, const struct mb_cfg *mb_cfg,
const struct mem_spd *spd_info, bool half_populated)
{
@ -274,6 +308,7 @@ void memcfg_init(FSPM_UPD *memupd, const struct mb_cfg *mb_cfg,
mem_populate_channel_data(memupd, &soc_mem_cfg[mb_cfg->type], spd_info, half_populated,
&data);
mem_init_spd_upds(mem_cfg, &data, expand_channels);
mem_init_override_channel_mask(mem_cfg);
mem_init_dq_upds(mem_cfg, &data, mb_cfg, dq_dqs_auto_detect);
mem_init_dqs_upds(mem_cfg, &data, mb_cfg, dq_dqs_auto_detect);
}