summaryrefslogtreecommitdiffstats
path: root/resources/libreboot/patch/coreboot/369b561315ca68d0cdedc38208105a513c7139b5/grub/kcma-d8/0042-cpu-amd-fam10h-15h-Set-PowerStepUp-PowerStepDown-on-.patch
blob: e95630f2a296666f264b62dd42d638800d73bbd1 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From ed0e74f934203d11e90c227f6a2bcabd62262952 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Tue, 24 Nov 2015 14:12:07 -0600
Subject: [PATCH 42/45] cpu/amd/fam10h-15h: Set PowerStepUp/PowerStepDown on
 Fam15h

Multilink Family 15h processors were being configured with an
incorrect PowerStepUp/PowerStepDown value.  Set the value
according to the BKDG, and clean up the terrible formatting
of the power_up_down() function that led to the incorrect
values being overlooked until now.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 src/cpu/amd/family_10h-family_15h/fidvid.c | 96 ++++++++++++++++--------------
 1 file changed, 50 insertions(+), 46 deletions(-)

diff --git a/src/cpu/amd/family_10h-family_15h/fidvid.c b/src/cpu/amd/family_10h-family_15h/fidvid.c
index 2edb75e..5bef7d3 100644
--- a/src/cpu/amd/family_10h-family_15h/fidvid.c
+++ b/src/cpu/amd/family_10h-family_15h/fidvid.c
@@ -390,56 +390,60 @@ static u32 nb_clk_did(uint8_t node, uint64_t cpuRev, uint8_t procPkg) {
 
 
 static u32 power_up_down(int node, u8 procPkg) {
-       u32 dword=0;
-        /* from CPU rev guide #41322 rev 3.74 June 2010 Table 26 */
-        u8 singleLinkFlag = ((procPkg == AMD_PKGTYPE_AM3_2r2)
-                             || (procPkg == AMD_PKGTYPE_S1gX)
-                             || (procPkg == AMD_PKGTYPE_ASB2));
-
-        if (singleLinkFlag) {
-	  /*
-           * PowerStepUp=01000b - 50nS
-	   * PowerStepDown=01000b - 50ns
-	   */
-	  dword |= PW_STP_UP50 | PW_STP_DN50;
-	} else {
-          u32 dispRefModeEn = (pci_read_config32(NODE_PCI(node,0),0x68) >> 24) & 1;
-          u32 isocEn = 0;
-          int j;
-	  for(j=0 ; (j<4) && (!isocEn) ; j++ ) {
-	    u8 offset;
-	    if (AMD_CpuFindCapability(node, j, &offset)) {
-	      isocEn = (pci_read_config32(NODE_PCI(node,0),offset+4) >>12) & 1;
-	    }
-          }
-
-          if (dispRefModeEn || isocEn) {
-        	dword |= PW_STP_UP50 | PW_STP_DN50 ;
-          } else {
-		/* get number of cores for PowerStepUp & PowerStepDown in server
-		   1 core - 400nS  - 0000b
-		   2 cores - 200nS - 0010b
-		   3 cores - 133nS -> 100nS - 0011b
-		   4 cores - 100nS - 0011b
+	uint32_t dword=0;
+	/* from CPU rev guide #41322 rev 3.74 June 2010 Table 26 */
+	u8 singleLinkFlag = ((procPkg == AMD_PKGTYPE_AM3_2r2)
+			|| (procPkg == AMD_PKGTYPE_S1gX)
+			|| (procPkg == AMD_PKGTYPE_ASB2));
+
+	if (singleLinkFlag) {
+		/*
+		 * PowerStepUp=01000b - 50nS
+		 * PowerStepDown=01000b - 50ns
 		 */
-		switch (get_core_num_in_bsp(node)) {
-		case 0:
-			dword |= PW_STP_UP400 | PW_STP_DN400;
-			break;
-		case 1:
-		case 2:
-			dword |= PW_STP_UP200 | PW_STP_DN200;
-			break;
-		case 3:
-			dword |= PW_STP_UP100 | PW_STP_DN100;
-			break;
-		default:
+		dword |= PW_STP_UP50 | PW_STP_DN50;
+	} else {
+		uint32_t dispRefModeEn = (pci_read_config32(NODE_PCI(node,0),0x68) >> 24) & 1;
+		uint32_t isocEn = 0;
+		int j;
+		for (j=0 ; (j<4) && (!isocEn) ; j++ ) {
+			u8 offset;
+			if (AMD_CpuFindCapability(node, j, &offset)) {
+				isocEn = (pci_read_config32(NODE_PCI(node,0),offset+4) >>12) & 1;
+			}
+		}
+
+		if (is_fam15h()) {
+			/* Family 15h always uses 100ns for multilink processors */
 			dword |= PW_STP_UP100 | PW_STP_DN100;
-			break;
+		} else if (dispRefModeEn || isocEn) {
+			dword |= PW_STP_UP50 | PW_STP_DN50 ;
+		} else {
+			/* get number of cores for PowerStepUp & PowerStepDown in server
+			 * 1 core - 400nS  - 0000b
+			 * 2 cores - 200nS - 0010b
+			 * 3 cores - 133nS -> 100nS - 0011b
+			 * 4 cores - 100nS - 0011b
+			 */
+			switch (get_core_num_in_bsp(node)) {
+			case 0:
+				dword |= PW_STP_UP400 | PW_STP_DN400;
+				break;
+			case 1:
+			case 2:
+				dword |= PW_STP_UP200 | PW_STP_DN200;
+				break;
+			case 3:
+				dword |= PW_STP_UP100 | PW_STP_DN100;
+				break;
+			default:
+				dword |= PW_STP_UP100 | PW_STP_DN100;
+				break;
+			}
 		}
-	  }
 	}
-        return dword;
+
+	return dword;
 }
 
 static void config_clk_power_ctrl_reg0(uint8_t node, uint64_t cpuRev, uint8_t procPkg) {
-- 
2.1.4