coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pnpconfig.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
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 "chip.h"
9 
10 static const struct pnpconfig perf[] = {
12 };
13 
14 static const struct pnpconfig power[] = {
16 };
17 
18 static const struct pnpconfig power_perf[] = {
20 };
21 
22 static void pnp_settings(void *unused)
23 {
24  int index;
25  size_t arrsize;
26  const struct pnpconfig *pnpconfigarr;
28 
30 
31  switch (config->pnp_settings) {
32  case PNP_PERF:
33  pnpconfigarr = perf;
34  arrsize = ARRAY_SIZE(perf);
35  break;
36  case PNP_POWER:
37  pnpconfigarr = power;
38  arrsize = ARRAY_SIZE(power);
39  break;
40  case PNP_PERF_POWER:
41  pnpconfigarr = power_perf;
42  arrsize = ARRAY_SIZE(power_perf);
43  break;
44  default:
45  printk(BIOS_NOTICE, "Invalid PNP settings selected");
46  return;
47  }
48 
49  for (index = 0; index < arrsize; index++)
50  pcr_rmw32(pnpconfigarr[index].msgport,
51  pnpconfigarr[index].msgregaddr,
52  pnpconfigarr[index].mask,
53  pnpconfigarr[index].value);
54 }
55 
pte_t value
Definition: mmu.c:91
@ BS_DEV_INIT
Definition: bootstate.h:83
@ BS_ON_EXIT
Definition: bootstate.h:96
#define ARRAY_SIZE(a)
Definition: helpers.h:12
void pcr_rmw32(uint8_t pid, uint16_t offset, uint32_t anddata, uint32_t ordata)
Definition: pcr.c:154
#define printk(level,...)
Definition: stdlib.h:16
#define config_of_soc()
Definition: device.h:394
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
Definition: loglevel.h:100
enum board_config config
Definition: memory.c:448
static const struct pnpconfig power[]
Definition: pnpconfig.c:14
static void pnp_settings(void *unused)
Definition: pnpconfig.c:22
static const struct pnpconfig perf[]
Definition: pnpconfig.c:10
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, pnp_settings, NULL)
static const struct pnpconfig power_perf[]
Definition: pnpconfig.c:18
#define VALUEFORPOWER_MSG_VALUES_PLATFORM_DEFAULT
Definition: pnpconfig.h:753
#define VALUEFORPWRPERF_MSG_VALUES_PLATFORM_DEFAULT
Definition: pnpconfig.h:748
#define VALUEFORPERF_MSG_VALUES_PLATFORM_DEFAULT
Definition: pnpconfig.h:758
pnp_settings
Definition: chip.h:22
@ PNP_PERF
Definition: chip.h:23
@ PNP_PERF_POWER
Definition: chip.h:25
@ PNP_POWER
Definition: chip.h:24
static const int mask[4]
Definition: gpio.c:308
#define NULL
Definition: stddef.h:19