aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/amd/agesa/family14
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2012-07-06 19:02:56 +0300
committerAlexandru Gagniuc <mr.nuke.me@gmail.com>2012-08-27 15:35:34 +0200
commitcd9fc1aa5f483818385c4a6c98afee4c8f49ad8e (patch)
treef667f21df51ab25c76e065128247d65c50552262 /src/northbridge/amd/agesa/family14
parent8c0279088266beccdc8953ecf2dd340fa27ed768 (diff)
AMD northbridges: rewrite CPU allocation
Use of alloc_find_dev() prevents creation of a device duplicates for device_path and is SMP safe. Reduce scope of variables to make the code more readable and in preparation for refactoring the allocation out of northbridge.c. Change-Id: I153dc1a5cab4f2eae4ab3a57af02841cb1a261c0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/1186 Tested-by: build bot (Jenkins) Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Diffstat (limited to 'src/northbridge/amd/agesa/family14')
-rw-r--r--src/northbridge/amd/agesa/family14/northbridge.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c
index 875dbbb744..2d0a85f7b4 100644
--- a/src/northbridge/amd/agesa/family14/northbridge.c
+++ b/src/northbridge/amd/agesa/family14/northbridge.c
@@ -832,7 +832,6 @@ static void cpu_bus_set_resources(device_t dev) {
static u32 cpu_bus_scan(device_t dev, u32 max)
{
device_t cpu;
- struct device_path cpu_path;
int apic_id, cores_found;
/* There is only one node for fam14, but there may be multiple cores. */
@@ -845,18 +844,18 @@ static u32 cpu_bus_scan(device_t dev, u32 max)
for (apic_id = 0; apic_id <= cores_found; apic_id++) {
+ struct device_path cpu_path;
+
cpu_path.type = DEVICE_PATH_APIC;
cpu_path.apic.apic_id = apic_id;
cpu = alloc_find_dev(dev->link_list, &cpu_path);
- if (cpu) {
- cpu->enabled = 1;
- cpu->path.apic.node_id = 0;
- cpu->path.apic.core_id = apic_id;
- printk(BIOS_DEBUG, "CPU: %s %s\n",
- dev_path(cpu), cpu->enabled?"enabled":"disabled");
- } else {
- cpu->enabled = 0;
- }
+ if (!cpu)
+ continue;
+ cpu->enabled = 1;
+ cpu->path.apic.node_id = 0;
+ cpu->path.apic.core_id = apic_id;
+ printk(BIOS_DEBUG, "CPU: %s %s\n",
+ dev_path(cpu), cpu->enabled?"enabled":"disabled");
}
return max;
}