2020-04-05 15:46:38 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-11-29 14:23:03 +01:00
|
|
|
|
|
|
|
#include <bootstate.h>
|
|
|
|
#include <console/console.h>
|
|
|
|
#include <intelblocks/pcr.h>
|
|
|
|
#include <soc/pci_devs.h>
|
|
|
|
#include <soc/pnpconfig.h>
|
|
|
|
#include "chip.h"
|
|
|
|
|
|
|
|
static const struct pnpconfig perf[] = {
|
|
|
|
VALUEFORPERF_MSG_VALUES_PLATFORM_DEFAULT,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct pnpconfig power[] = {
|
|
|
|
VALUEFORPOWER_MSG_VALUES_PLATFORM_DEFAULT,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct pnpconfig power_perf[] = {
|
|
|
|
VALUEFORPWRPERF_MSG_VALUES_PLATFORM_DEFAULT,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void pnp_settings(void *unused)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
size_t arrsize;
|
|
|
|
const struct pnpconfig *pnpconfigarr;
|
2019-07-12 12:10:19 +02:00
|
|
|
struct soc_intel_apollolake_config *config;
|
|
|
|
|
2019-09-27 23:20:27 +02:00
|
|
|
config = config_of_soc();
|
2019-07-12 12:10:19 +02:00
|
|
|
|
2017-11-29 14:23:03 +01:00
|
|
|
switch (config->pnp_settings) {
|
|
|
|
case PNP_PERF:
|
|
|
|
pnpconfigarr = perf;
|
|
|
|
arrsize = ARRAY_SIZE(perf);
|
|
|
|
break;
|
|
|
|
case PNP_POWER:
|
|
|
|
pnpconfigarr = power;
|
|
|
|
arrsize = ARRAY_SIZE(power);
|
|
|
|
break;
|
|
|
|
case PNP_PERF_POWER:
|
|
|
|
pnpconfigarr = power_perf;
|
|
|
|
arrsize = ARRAY_SIZE(power_perf);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk(BIOS_NOTICE, "Invalid PNP settings selected");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (index = 0; index < arrsize; index++)
|
|
|
|
pcr_rmw32(pnpconfigarr[index].msgport,
|
|
|
|
pnpconfigarr[index].msgregaddr,
|
|
|
|
pnpconfigarr[index].mask,
|
|
|
|
pnpconfigarr[index].value);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, pnp_settings, NULL);
|