coreboot-kgpe-d16/src/soc/intel/apollolake/pnpconfig.c
Angel Pons 6bc1374e2d soc/intel/apollolake: Use SPDX for GPL-2.0-only files
Done with sed and God Lines. Only done for C-like code for now.

Change-Id: I3c6daa484a4aa133ff2ad79eb2b8efa159da3523
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40208
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2020-04-06 19:12:26 +00:00

57 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */
#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;
struct soc_intel_apollolake_config *config;
config = config_of_soc();
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);