nehalem_raminit_timeout_for_neutralized_me.diff.txt

Ani Chang, 04/01/2017 11:03 AM

Download (1.56 KB)

 
1
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c
2
index 122b8ac..f95a291 100644
3
--- a/src/northbridge/intel/nehalem/raminit.c
4
+++ b/src/northbridge/intel/nehalem/raminit.c
5
@@ -1753,24 +1753,45 @@ static const struct ram_training *get_cached_training(void)
6
 }
7
 #endif
8
 
9
-/* FIXME: add timeout.  */
10
+/* FIXME: timeout added to workaround the lack of ME in the case it has been removed with me_cleaner. Testing needed. */
11
 static void wait_heci_ready(void)
12
 {
13
-	while (!(read32(DEFAULT_HECIBAR + 0xc) & 8));	// = 0x8000000c
14
+	int timeout;
15
+
16
+	timeout = 0x7ff;
17
+	while (!(read32(DEFAULT_HECIBAR + 0xc) & 8) && --timeout) { // = 0x8000000c
18
+		udelay(10);
19
+		if ((timeout & 0xff) == 0)
20
+			printk(BIOS_SPEW, ".");
21
+	}
22
+	if (!timeout) {
23
+		printk(BIOS_DEBUG, "Timeout while waiting for ME init!\n");
24
+		// return -1;
25
+	}
26
 	write32((DEFAULT_HECIBAR + 0x4),
27
 		(read32(DEFAULT_HECIBAR + 0x4) & ~0x10) | 0xc);
28
 }
29
 
30
-/* FIXME: add timeout.  */
31
+/* FIXME: timeout added to workaround the lack of ME in the case it has been removed with me_cleaner. Testing needed. */
32
 static void wait_heci_cb_avail(int len)
33
 {
34
+	int timeout;
35
+
36
 	union {
37
 		struct mei_csr csr;
38
 		u32 raw;
39
 	} csr;
40
 
41
-	while (!(read32(DEFAULT_HECIBAR + 0xc) & 8));
42
-
43
+	timeout = 0x7ff;
44
+	while (!(read32(DEFAULT_HECIBAR + 0xc) & 8) && --timeout)  {
45
+		udelay(10);
46
+		if ((timeout & 0xff) == 0)
47
+			printk(BIOS_SPEW, ".");
48
+	};
49
+	if (!timeout) {
50
+		printk(BIOS_DEBUG, "Timeout while waiting for ME init!\n");
51
+		// return -1;
52
+	}
53
 	do
54
 		csr.raw = read32(DEFAULT_HECIBAR + 0x4);
55
 	while (len >