summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-12-12 16:57:40 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 15:10:42 +0800
commit1579431855bb8a1b838ba16cb5e3d6c42dcb4cf8 (patch)
tree1226065e036ddbf15d5150f5958a4ecf0cd1e570 /src
parent4b82a3f9fcb6e7a79d984c1ba54f1af5fd465d8c (diff)
downloadcoreboot-1579431855bb8a1b838ba16cb5e3d6c42dcb4cf8.tar.xz
mrc main
Change-Id: Id2626410e23d153ac11b796115c5a63bc6f21711 Signed-off-by: Iru Cai <mytbk920423@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/intel/haswell/Makefile.inc1
-rw-r--r--src/northbridge/intel/haswell/mrc.asm121
-rw-r--r--src/northbridge/intel/haswell/mrc_main.c56
3 files changed, 67 insertions, 111 deletions
diff --git a/src/northbridge/intel/haswell/Makefile.inc b/src/northbridge/intel/haswell/Makefile.inc
index adc678701c..6ed1ef2e42 100644
--- a/src/northbridge/intel/haswell/Makefile.inc
+++ b/src/northbridge/intel/haswell/Makefile.inc
@@ -36,6 +36,7 @@ $(obj)/mrc.o: $(src)/northbridge/intel/haswell/mrc.asm
nasm -f elf32 -o $@ $<
romstage-y += mrc_utils.c
+romstage-y += mrc_main.c
postcar-y += memmap.c
endif
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm
index 0fa842cea6..7dadd916d9 100644
--- a/src/northbridge/intel/haswell/mrc.asm
+++ b/src/northbridge/intel/haswell/mrc.asm
@@ -3,6 +3,8 @@
bits 32
global mrc_entry
+global do_raminit
+global heap_check
extern mrc_printk
extern mrc_setmem
@@ -11,6 +13,7 @@ extern memcpy ; pass parameters by stack
extern mrc_fillword
extern mrc_zeromem
extern mrc_highest_bit
+extern mrc_main
mrc_entry:
mov ecx, esp
@@ -20,7 +23,7 @@ push eax
mov al, 1
out 0x80, al
cld
-call fcn_fffc18c8 ; call 0xfffc18c8
+call mrc_main
pop ecx
pop ecx
mov esp, ecx
@@ -2482,7 +2485,7 @@ pop edi
pop ebp
ret
-fcn_fffa2937:
+heap_check:
push ebp
lea edx, [eax + 3]
and edx, 0xfffffffc
@@ -2550,7 +2553,7 @@ cmp dword [ebx - 4], 0xfeadb00b
jne short loc_fffa29f2 ; jne 0xfffa29f2
add eax, 4
mov dword [ebp - 0x1c], edx
-call fcn_fffa2937 ; call 0xfffa2937
+call heap_check ; call 0xfffa2937
test eax, eax
mov edx, dword [ebp - 0x1c]
jne short loc_fffa29f4 ; jne 0xfffa29f4
@@ -2840,7 +2843,7 @@ pop edi
pop ebp
ret
-fcn_fffa2c51:
+do_raminit:
push ebp
xor edx, edx
mov ebp, esp
@@ -3758,14 +3761,14 @@ mov dword [edx + 0x3310], 0x10
mov eax, ebx
call fcn_fffc7c9d ; call 0xfffc7c9d
mov eax, 0xc
-call fcn_fffa2937 ; call 0xfffa2937
+call heap_check ; call 0xfffa2937
test eax, eax
mov esi, eax
je short loc_fffa3d32 ; je 0xfffa3d32
mov edx, 0xc
call mrc_zeromem
mov eax, 0x28
-call fcn_fffa2937 ; call 0xfffa2937
+call heap_check ; call 0xfffa2937
test eax, eax
mov edi, eax
je short loc_fffa3d32 ; je 0xfffa3d32
@@ -3814,7 +3817,7 @@ mov dword [esp], ref_fffcc5e7 ; mov dword [esp], 0xfffcc5e7
call mrc_printk ; call 0xfffa1253
mov eax, 0x10f
mov esi, dword [0xff7d7538]
-call fcn_fffa2937 ; call 0xfffa2937
+call heap_check ; call 0xfffa2937
add esp, 0x10
test eax, eax
mov ebx, eax
@@ -42190,101 +42193,6 @@ db 0x00
db 0x00
db 0x00
-fcn_fffc18c8:
-push ebp
-mov ecx, 8
-mov ebp, esp
-push edi
-push esi
-push ebx
-mov ebx, 0xff800000
-sub ebx, 0xff7d7544
-lea esp, [esp - 0x1c]
-sar ebx, 2
-mov eax, ebx
-cdq
-idiv ecx
-mov dword [ebp - 0x1c], eax
-xor eax, eax
-jmp short loc_fffc190c ; jmp 0xfffc190c
-
-loc_fffc18f1:
-xor edx, edx
-
-loc_fffc18f3:
-lea ecx, [edx + eax]
-inc edx
-cmp edx, 4
-mov dword [ecx*4 - 0x828abc], 0xdeedbeef
-jne short loc_fffc18f3 ; jne 0xfffc18f3
-add eax, 0x100
-
-loc_fffc190c:
-cmp eax, dword [ebp - 0x1c]
-jl short loc_fffc18f1 ; jl 0xfffc18f1
-mov eax, dword [ebp + 8]
-xor esi, esi
-call fcn_fffa2c51 ; call 0xfffa2c51
-mov edi, eax
-jmp short loc_fffc1939 ; jmp 0xfffc1939
-
-loc_fffc191f:
-xor eax, eax
-
-loc_fffc1921:
-lea ecx, [eax + esi]
-cmp dword [ecx*4 - 0x828abc], 0xdeedbeef
-jne short loc_fffc195a ; jne 0xfffc195a
-inc eax
-cmp eax, 4
-jne short loc_fffc1921 ; jne 0xfffc1921
-jmp short loc_fffc1952 ; jmp 0xfffc1952
-
-loc_fffc1939:
-cmp esi, dword [ebp - 0x1c]
-jl short loc_fffc191f ; jl 0xfffc191f
-jmp short loc_fffc197a ; jmp 0xfffc197a
-
-loc_fffc1940:
-sub esp, 0xc
-push ref_fffcc6f2 ; push 0xfffcc6f2
-call mrc_printk ; call 0xfffa1253
-add esp, 0x10
-
-loc_fffc1950:
-jmp short loc_fffc1950 ; jmp 0xfffc1950
-
-loc_fffc1952:
-add esi, 0x100
-jmp short loc_fffc1939 ; jmp 0xfffc1939
-
-loc_fffc195a:
-push eax
-lea eax, [ebx*4]
-sub ebx, esi
-push eax
-shl ebx, 2
-push ebx
-push ref_fffcc725 ; push 0xfffcc725
-call mrc_printk ; call 0xfffa1253
-add esp, 0x10
-test esi, esi
-je short loc_fffc1940 ; je 0xfffc1940
-
-loc_fffc197a:
-sub esp, 0xc
-push ref_fffcc70e ; push 0xfffcc70e
-call mrc_printk ; call 0xfffa1253
-mov eax, 8
-call fcn_fffa2937 ; call 0xfffa2937
-lea esp, [ebp - 0xc]
-mov eax, edi
-pop ebx
-pop esi
-pop edi
-pop ebp
-ret
-
fcn_fffc1ae2:
push ebp
mov ebp, esp
@@ -56220,15 +56128,6 @@ db 'System Agent: failed to locate restore data hob!',0x0a,0x00
ref_fffcc6dd:
db 'System Agent: Done.',0x0a,0x00
-ref_fffcc6f2:
-db 'Stack completely exhaused!',0x0a,0x00
-
-ref_fffcc70e:
-db 'Sanity checking heap.',0x0a,0x00
-
-ref_fffcc725:
-db 'Reference code used approx 0x%x/0x%x of stack.',0x0a,0x00,0x00
-
ref_fffcc756:
db 0x50
db 0x00
diff --git a/src/northbridge/intel/haswell/mrc_main.c b/src/northbridge/intel/haswell/mrc_main.c
new file mode 100644
index 0000000000..a00abf23b6
--- /dev/null
+++ b/src/northbridge/intel/haswell/mrc_main.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "pei_data.h"
+#include <console/console.h>
+
+static int *STACK_TOP = (int *)0xff800000;
+static int *STACK_BTM = (int *)0xff7d7544;
+
+int __attribute((regparm(1))) do_raminit(struct pei_data *pd);
+int __attribute((regparm(1))) heap_check(int n);
+int mrc_main(struct pei_data *pd);
+
+int mrc_main(struct pei_data *pd)
+{
+ int stkwords = (STACK_TOP - STACK_BTM);
+ int lowsize = stkwords / 8;
+ int rv;
+
+ for (int i = 0; i < lowsize; i += 0x100) {
+ for (int j = 0; j < 4; j++)
+ STACK_BTM[i + j] = 0xdeadbeef;
+ }
+
+ rv = do_raminit(pd);
+
+ for (int i = 0; i < lowsize; i += 0x100) {
+ for (int j = 0; j < 4; j++) {
+ if (STACK_BTM[i + j] != 0xdeadbeef) {
+ mrc_printk("Reference code used "
+ "approx 0x%x/0x%x of stack.\n",
+ (stkwords - i) * 4,
+ stkwords * 4);
+ if (i == 0) {
+ mrc_printk("Stack completely exhaused!\n");
+ while (1)
+ ;
+ }
+ }
+ }
+ }
+
+ mrc_printk("Sanity checking heap.\n");
+ heap_check(8);
+ return rv;
+}