From 776622879878ef22baed3d3ce1b07dbd1ed4542a Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sun, 25 May 2025 11:41:04 +0200 Subject: [PATCH] Haswell NRI: Deduplicate PCODE mailbox functions Now that the CPU code exports these PCODE mailbox functions, there is no reason to retain a copy of them in NRI. Change-Id: Ic9853cfd6793ecdadf8d2bd15b268f9cf95ba32d Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/87828 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- .../haswell/native_raminit/configure_mc.c | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/northbridge/intel/haswell/native_raminit/configure_mc.c b/src/northbridge/intel/haswell/native_raminit/configure_mc.c index 5562dbdf2e..8ff81727ec 100644 --- a/src/northbridge/intel/haswell/native_raminit/configure_mc.c +++ b/src/northbridge/intel/haswell/native_raminit/configure_mc.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -583,48 +584,6 @@ static void program_ls_comp(struct sysinfo *ctrl) mchbar_write32(DDR_COMP_CTL_0, ctrl->comp_ctl_0.raw); } -/** TODO: Deduplicate PCODE stuff, it's already implemented in CPU code **/ -static bool pcode_ready(void) -{ - const unsigned int delay_step = 10; - for (unsigned int i = 0; i < 1000; i += delay_step) { - if (!(mchbar_read32(BIOS_MAILBOX_INTERFACE) & MAILBOX_RUN_BUSY)) - return true; - - udelay(delay_step); - }; - return false; -} - -static uint32_t pcode_mailbox_read(const uint32_t command) -{ - if (!pcode_ready()) { - printk(BIOS_ERR, "PCODE: mailbox timeout on wait ready\n"); - return 0; - } - mchbar_write32(BIOS_MAILBOX_INTERFACE, command | MAILBOX_RUN_BUSY); - if (!pcode_ready()) { - printk(BIOS_ERR, "PCODE: mailbox timeout on completion\n"); - return 0; - } - return mchbar_read32(BIOS_MAILBOX_DATA); -} - -static int pcode_mailbox_write(const uint32_t command, const uint32_t data) -{ - if (!pcode_ready()) { - printk(BIOS_ERR, "PCODE: mailbox timeout on wait ready\n"); - return -1; - } - mchbar_write32(BIOS_MAILBOX_DATA, data); - mchbar_write32(BIOS_MAILBOX_INTERFACE, command | MAILBOX_RUN_BUSY); - if (!pcode_ready()) { - printk(BIOS_ERR, "PCODE: mailbox timeout on completion\n"); - return -1; - } - return 0; -} - static void enable_2x_refresh(struct sysinfo *ctrl) { if (!CONFIG(ENABLE_DDR_2X_REFRESH)) {