device/hypertransport.c: Remove dead assignment
[coreboot.git] / src / device / cpu_device.c
blobf59cce3573c9e4b180d043d72840e14520d190d1
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 * Copyright (C) 2012 Kyösti Mälkki <kyosti.malkki@gmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <device/device.h>
18 #include <console/console.h>
20 struct device *add_cpu_device(struct bus *cpu_bus, unsigned int apic_id,
21 int enabled)
23 struct device_path cpu_path;
24 struct device *cpu;
26 /* Build the CPU device path */
27 cpu_path.type = DEVICE_PATH_APIC;
28 cpu_path.apic.apic_id = apic_id;
30 /* Update CPU in devicetree. */
31 if (enabled)
32 cpu = alloc_find_dev(cpu_bus, &cpu_path);
33 else
34 cpu = find_dev_path(cpu_bus, &cpu_path);
35 if (!cpu)
36 return NULL;
38 cpu->enabled = enabled;
39 printk(BIOS_DEBUG, "CPU: %s %s\n",
40 dev_path(cpu), cpu->enabled?"enabled":"disabled");
42 return cpu;
45 void set_cpu_topology(struct device *cpu, unsigned int node,
46 unsigned int package, unsigned int core,
47 unsigned int thread)
49 cpu->path.apic.node_id = node;
50 cpu->path.apic.package_id = package;
51 cpu->path.apic.core_id = core;
52 cpu->path.apic.thread_id = thread;