summaryrefslogtreecommitdiffstats
path: root/resources/libreboot/patch/coreboot/369b561315ca68d0cdedc38208105a513c7139b5/grub/kcma-d8/0017-cpu-amd-fam10h-fam15h-Correctly-create-APIC-ID-on-si.patch
blob: 987f0411bc32f093607e0ddc2d8600c789227a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From eb9dc9e1f48f8f6bdb7e97a2d0ec4b5db93db0e0 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Tue, 24 Nov 2015 14:11:53 -0600
Subject: [PATCH 17/45] cpu/amd/fam10h-fam15h: Correctly create APIC ID on
 single node systems

The existing code generated an incorrect boot APIC ID from node and
core number for single node packages, leading to a boot failure when
the second node was installed.

Properly generate the boot APIC ID from node and core number.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 src/cpu/amd/family_10h-family_15h/init_cpus.c | 6 +++++-
 src/northbridge/amd/amdfam10/northbridge.c    | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/cpu/amd/family_10h-family_15h/init_cpus.c b/src/cpu/amd/family_10h-family_15h/init_cpus.c
index 1794072..5a67601 100644
--- a/src/cpu/amd/family_10h-family_15h/init_cpus.c
+++ b/src/cpu/amd/family_10h-family_15h/init_cpus.c
@@ -127,13 +127,17 @@ uint32_t get_boot_apic_id(uint8_t node, uint32_t core) {
 		}
 	} else {
 		if (fam15h) {
-			ap_apicid = (node * (siblings + 1)) + core;
+			ap_apicid = 0;
+			ap_apicid |= (node & 0x7) << 4;	/* Node ID */
+			ap_apicid |= core & 0xf;	/* Core ID */
 		} else {
 			ap_apicid = node * (nb_cfg_54 ? (siblings + 1) : 1) +
 					core * (nb_cfg_54 ? 1 : 64);
 		}
 	}
 
+	printk(BIOS_DEBUG, "%s: using %d as APIC ID for node %d, core %d\n", __func__, ap_apicid, node, core);
+
 	return ap_apicid;
 }
 
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index b376171..35d0925 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -1636,7 +1636,9 @@ static void cpu_bus_scan(device_t dev)
 				}
 			} else {
 				if (fam15h) {
-					apic_id = (i * (siblings + 1)) + j;
+					apic_id = 0;
+					apic_id |= (i & 0x7) << 4;	/* Node ID */
+					apic_id |= j & 0xf;		/* Core ID */
 				} else {
 					apic_id = i * (nb_cfg_54?(siblings+1):1) + j * (nb_cfg_54?1:64); // ?
 				}
-- 
2.1.4