soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / device / cpu_device.c
blobf406e23f89f4bd6975a9129c404c8c3ce8292e2b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/device.h>
4 #include <console/console.h>
5 #include <stddef.h>
7 struct device *add_cpu_device(struct bus *cpu_bus, unsigned int apic_id,
8 int enabled)
10 struct device_path cpu_path = {};
11 struct device *cpu;
13 /* Build the CPU device path */
14 cpu_path.type = DEVICE_PATH_APIC;
15 cpu_path.apic.apic_id = apic_id;
17 /* Update CPU in devicetree. */
18 if (enabled)
19 cpu = alloc_find_dev(cpu_bus, &cpu_path);
20 else
21 cpu = find_dev_path(cpu_bus, &cpu_path);
22 if (!cpu)
23 return NULL;
25 cpu->enabled = enabled;
26 printk(BIOS_DEBUG, "CPU: %s %s\n",
27 dev_path(cpu), cpu->enabled?"enabled":"disabled");
29 return cpu;
32 void set_cpu_topology(struct device *cpu, unsigned int node,
33 unsigned int package, unsigned int core,
34 unsigned int thread)
36 cpu->path.apic.node_id = node;
37 cpu->path.apic.package_id = package;
38 cpu->path.apic.core_id = core;
39 cpu->path.apic.thread_id = thread;