summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-12-23 14:58:42 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 15:10:44 +0800
commita6c728b92c778b62d3805f4901afc6d2182ef29d (patch)
tree922be30e3f08e5d4a1c59cf41e0eecc3ef5c97ca /src
parent7fed3657f18236bbfaf7fd59ab4f41b4a7a3069c (diff)
downloadcoreboot-a6c728b92c778b62d3805f4901afc6d2182ef29d.tar.xz
test_memory
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/intel/haswell/mrc_frag_init_memory.c16
-rw-r--r--src/northbridge/intel/haswell/mrc_init_memory.asm28
2 files changed, 20 insertions, 24 deletions
diff --git a/src/northbridge/intel/haswell/mrc_frag_init_memory.c b/src/northbridge/intel/haswell/mrc_frag_init_memory.c
index ea1916ca0b..4182b4991d 100644
--- a/src/northbridge/intel/haswell/mrc_frag_init_memory.c
+++ b/src/northbridge/intel/haswell/mrc_frag_init_memory.c
@@ -96,3 +96,19 @@ void set_cpuid(struct cpu_model_id *mycpu)
}
}
}
+
+int test_memory(void);
+int test_memory(void)
+{
+ for (size_t i = 0; i < 0x1000; i++) {
+ *(uint8_t*)i = (uint8_t)i;
+ }
+
+ for (int j = 0; j < 20; j++) {
+ for (size_t i = 0; i < 0x1000; i++) {
+ if (*(uint8_t*)i != (uint8_t)i)
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/src/northbridge/intel/haswell/mrc_init_memory.asm b/src/northbridge/intel/haswell/mrc_init_memory.asm
index f03ed18434..43416e8f11 100644
--- a/src/northbridge/intel/haswell/mrc_init_memory.asm
+++ b/src/northbridge/intel/haswell/mrc_init_memory.asm
@@ -76,6 +76,7 @@ extern frag_fffc1fc3
extern create_raminit_hob
extern frag_fffc1cd2
extern set_cpuid
+extern test_memory
initialize_txt:
mov edx, cr4
@@ -578,31 +579,10 @@ or dl, bl
jne short loc_fffc22ea ; jne 0xfffc22ea
jmp short loc_fffc2311 ; jmp 0xfffc2311
-loc_fffc22e7:
-mov byte [eax], al
-inc eax
-
loc_fffc22ea:
-cmp eax, 0x1000
-jne short loc_fffc22e7 ; jne 0xfffc22e7
-mov edx, 0x14
-jmp short loc_fffc230d ; jmp 0xfffc230d
-
-loc_fffc22f8:
-cmp byte [eax], cl
-jne loc_fffc238d ; jne 0xfffc238d
-inc eax
-
-loc_fffc2301:
-cmp eax, 0x1000
-mov cl, al
-jne short loc_fffc22f8 ; jne 0xfffc22f8
-dec edx
-je short loc_fffc2311 ; je 0xfffc2311
-
-loc_fffc230d:
-xor eax, eax
-jmp short loc_fffc2301 ; jmp 0xfffc2301
+call test_memory
+or eax, eax
+jne loc_fffc238d
loc_fffc2311:
mov ecx, dword [ebp - 0x50bc]