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 <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/87828 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
ae68ef3684
commit
7766228798
1 changed files with 1 additions and 42 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <assert.h>
|
||||
#include <commonlib/bsd/clamp.h>
|
||||
#include <console/console.h>
|
||||
#include <cpu/intel/haswell/haswell.h>
|
||||
#include <delay.h>
|
||||
#include <lib.h>
|
||||
#include <northbridge/intel/haswell/haswell.h>
|
||||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue