| 1 |
|
| 2 |
|
| 3 |
#include <bootstate.h> |
| 4 |
#include <console/console.h> |
| 5 |
#include <intelblocks/pcr.h> |
| 6 |
#include <soc/pci_devs.h> |
| 7 |
#include <soc/pnpconfig.h> |
| 8 |
#include <static.h> |
| 9 |
#include "chip.h" |
| 10 |
|
| 11 |
static const struct pnpconfig perf[] = { |
| 12 |
VALUEFORPERF_MSG_VALUES_PLATFORM_DEFAULT, |
| 13 |
}; |
| 14 |
|
| 15 |
static const struct pnpconfig power[] = { |
| 16 |
VALUEFORPOWER_MSG_VALUES_PLATFORM_DEFAULT, |
| 17 |
}; |
| 18 |
|
| 19 |
static const struct pnpconfig power_perf[] = { |
| 20 |
VALUEFORPWRPERF_MSG_VALUES_PLATFORM_DEFAULT, |
| 21 |
}; |
| 22 |
|
| 23 |
static void pnp_settings(void *unused) |
| 24 |
{ |
| 25 |
int index; |
| 26 |
size_t arrsize; |
| 27 |
const struct pnpconfig *pnpconfigarr; |
| 28 |
struct soc_intel_apollolake_config *config; |
| 29 |
|
| 30 |
config = config_of_soc(); |
| 31 |
|
| 32 |
switch (config->pnp_settings) { |
| 33 |
case PNP_PERF: |
| 34 |
pnpconfigarr = perf; |
| 35 |
arrsize = ARRAY_SIZE(perf); |
| 36 |
break; |
| 37 |
case PNP_POWER: |
| 38 |
pnpconfigarr = power; |
| 39 |
arrsize = ARRAY_SIZE(power); |
| 40 |
break; |
| 41 |
case PNP_PERF_POWER: |
| 42 |
pnpconfigarr = power_perf; |
| 43 |
arrsize = ARRAY_SIZE(power_perf); |
| 44 |
break; |
| 45 |
default: |
| 46 |
printk(BIOS_NOTICE, "Invalid PNP settings selected"); |
| 47 |
return; |
| 48 |
} |
| 49 |
|
| 50 |
for (index = 0; index < arrsize; index++) |
| 51 |
pcr_rmw32(pnpconfigarr[index].msgport, |
| 52 |
pnpconfigarr[index].msgregaddr, |
| 53 |
pnpconfigarr[index].mask, |
| 54 |
pnpconfigarr[index].value); |
| 55 |
} |
| 56 |
|
| 57 |
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, pnp_settings, NULL); |