broadwell: Compute channel disable masks at runtime
Introduce the `SPD_MEMORY_DOWN` macro to indicate that a slot is used with memory-down. This enables computing the channel disable masks as the bits for slots where the SPD address is zero. To preserve current behavior, zero the SPD addresses for memory-down slots afterwards. Change-Id: I75b7be7c72062d1a26cfc7b09b79de62de0a9cea Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55807 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -26,6 +26,8 @@ static inline void pei_data_usb3_port(struct pei_data *pei_data, int port,
|
||||
pei_data->usb3_ports[port].fixed_eq = fixed_eq;
|
||||
}
|
||||
|
||||
#define SPD_MEMORY_DOWN 0xff
|
||||
|
||||
void broadwell_fill_pei_data(struct pei_data *pei_data);
|
||||
void mainboard_fill_pei_data(struct pei_data *pei_data);
|
||||
void mainboard_fill_spd_data(struct pei_data *pei_data);
|
||||
|
@@ -177,6 +177,17 @@ static void setup_sdram_meminfo(struct pei_data *pei_data)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 0 = leave channel enabled
|
||||
* 1 = disable dimm 0 on channel
|
||||
* 2 = disable dimm 1 on channel
|
||||
* 3 = disable dimm 0+1 on channel
|
||||
*/
|
||||
static int make_channel_disabled_mask(const struct pei_data *pd, int ch)
|
||||
{
|
||||
return (!pd->spd_addresses[ch + ch] << 0) | (!pd->spd_addresses[ch + ch + 1] << 1);
|
||||
}
|
||||
|
||||
void perform_raminit(const struct chipset_power_state *const power_state)
|
||||
{
|
||||
const int s3resume = power_state->prev_sleep_state == ACPI_S3;
|
||||
@@ -186,6 +197,15 @@ void perform_raminit(const struct chipset_power_state *const power_state)
|
||||
mainboard_fill_pei_data(&pei_data);
|
||||
mainboard_fill_spd_data(&pei_data);
|
||||
|
||||
/* Calculate unimplemented DIMM slots for each channel */
|
||||
pei_data.dimm_channel0_disabled = make_channel_disabled_mask(&pei_data, 0);
|
||||
pei_data.dimm_channel1_disabled = make_channel_disabled_mask(&pei_data, 1);
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(pei_data.spd_addresses); i++) {
|
||||
const uint8_t addr = pei_data.spd_addresses[i];
|
||||
pei_data.spd_addresses[i] = addr == SPD_MEMORY_DOWN ? 0 : addr;
|
||||
}
|
||||
|
||||
post_code(0x32);
|
||||
|
||||
timestamp_add_now(TS_INITRAM_START);
|
||||
|
Reference in New Issue
Block a user