coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
acpi_tables.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <acpi/acpi.h>
5 #include <acpi/acpigen.h>
6 #include <device/device.h>
7 #include "i82371eb.h"
8 
10 {
11  struct device *cpu;
12  int count = 0;
13  for (cpu = all_devices; cpu; cpu = cpu->next) {
14  if ((cpu->path.type != DEVICE_PATH_APIC) ||
15  (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
16  continue;
17  }
18  if (!cpu->enabled) {
19  continue;
20  }
21  count++;
22  }
23  return count;
24 }
25 
26 void generate_cpu_entries(const struct device *device)
27 {
28  int cpu, pcontrol_blk=DEFAULT_PMBASE+PCNTRL, plen=6;
29  int numcpus = determine_total_number_of_cores();
30  printk(BIOS_DEBUG, "Found %d CPU(s).\n", numcpus);
31 
32  /* without the outer scope, further ssdt addition will end up
33  * within the processor statement */
34  acpigen_write_scope("\\_SB");
35  for (cpu=0; cpu < numcpus; cpu++) {
36  acpigen_write_processor(cpu, pcontrol_blk, plen);
38  }
40 }
void acpigen_pop_len(void)
Definition: acpigen.c:37
void acpigen_write_scope(const char *name)
Definition: acpigen.c:326
void acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len)
Definition: acpigen.c:391
#define printk(level,...)
Definition: stdlib.h:16
DEVTREE_CONST struct device *DEVTREE_CONST all_devices
Linked list of ALL devices.
Definition: device_const.c:13
#define PCNTRL
Definition: i82371eb.h:60
#define DEFAULT_PMBASE
Definition: iomap.h:14
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
@ DEVICE_PATH_CPU_CLUSTER
Definition: path.h:14
@ DEVICE_PATH_APIC
Definition: path.h:12
void generate_cpu_entries(const struct device *device)
Generate ACPI entries for Speedstep for each cpu.
Definition: acpi_tables.c:26
static int determine_total_number_of_cores(void)
Definition: acpi_tables.c:9
DEVTREE_CONST struct device * dev
Definition: device.h:78
enum device_path_type type
Definition: path.h:114
Definition: device.h:107
struct device_path path
Definition: device.h:115
DEVTREE_CONST struct bus * bus
Definition: device.h:108
DEVTREE_CONST struct device * next
Definition: device.h:113
unsigned int enabled
Definition: device.h:122
#define count