Debian Codegraph @

src/soc/amd/common/block/cpu/noncar/pre_c.S

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <amdblocks/post_codes.h>
4 #include <cpu/x86/64bit/entry64.inc>
5 #include <cpu/x86/post_code.h>
6
7 .section .init, "ax", @progbits
8
9 .global bootblock_resume_entry
10 bootblock_resume_entry:
11 post_code(POSTCODE_BOOTBLOCK_RESUME_ENTRY)
12
13 /* Get an early timestamp */
14 rdtsc
15 movd %eax, %mm1
16 movd %edx, %mm2
17
18 /* Fall through to bootblock_pre_c_entry */
19
20 /*
21 * on entry:
22 * mm0: BIST (ignored)
23 * mm2_mm1: timestamp
24 */
25
26 .global bootblock_pre_c_entry
27 bootblock_pre_c_entry:
28 post_code(POSTCODE_BOOTBLOCK_PRE_C_ENTRY)
29
30 #if ENV_X86_64
31 setup_longmode $PML4E
32 #endif
33
34 /* Clear .bss section */
35 cld
36 xor %eax, %eax
37 movl $(_ebss), %ecx
38 movl $(_bss), %edi
39 sub %edi, %ecx
40 shrl $2, %ecx
41 rep stosl
42
43 movl $_eearlyram_stack, %esp
44
45 /* Copy .data section content */
46 #include <cpu/x86/copy_data_section.inc>
47
48 /* Align the stack and keep aligned for call to bootblock_c_entry() */
49 and $0xfffffff0, %esp
50 sub $8, %esp
51
52 #if ENV_X86_64
53 movd %mm2, %rdi
54 shlq $32, %rdi
55 movd %mm1, %rsi
56 or %rsi, %rdi
57 #else
58 movd %mm2, %eax
59 pushl %eax /* tsc[63:32] */
60 movd %mm1, %eax
61 pushl %eax /* tsc[31:0] */
62 #endif
63
64 post_code(POSTCODE_BOOTBLOCK_PRE_C_DONE)
65
66 call bootblock_c_entry
67 /* Never reached */
68
69 .halt_forever:
70 post_code(POSTCODE_DEAD_CODE)
71 hlt
72 jmp .halt_forever