1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/device.h>
4 #include <console/console.h>
6 struct device
*add_cpu_device(struct bus
*cpu_bus
, unsigned int apic_id
,
9 struct device_path cpu_path
;
12 /* Build the CPU device path */
13 cpu_path
.type
= DEVICE_PATH_APIC
;
14 cpu_path
.apic
.apic_id
= apic_id
;
16 /* Update CPU in devicetree. */
18 cpu
= alloc_find_dev(cpu_bus
, &cpu_path
);
20 cpu
= find_dev_path(cpu_bus
, &cpu_path
);
24 cpu
->enabled
= enabled
;
25 printk(BIOS_DEBUG
, "CPU: %s %s\n",
26 dev_path(cpu
), cpu
->enabled
?"enabled":"disabled");
31 void set_cpu_topology(struct device
*cpu
, unsigned int node
,
32 unsigned int package
, unsigned int core
,
35 cpu
->path
.apic
.node_id
= node
;
36 cpu
->path
.apic
.package_id
= package
;
37 cpu
->path
.apic
.core_id
= core
;
38 cpu
->path
.apic
.thread_id
= thread
;