mb/google/brya: Create rull variant
[coreboot2.git] / src / drivers / amd / agesa / cache_as_ram.S
blobc10c369643329248ca1f4d4cc7d547df0cf43d8d
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /******************************************************************************
4  * AMD Generic Encapsulated Software Architecture
5  *
6  * $Workfile:: cache_as_ram.S
7  *
8  * Description: cache_as_ram.S - AGESA Module Entry Point for GCC compiler
9  *
10  ******************************************************************************
11  */
13 #include <cpu/x86/lapic_def.h>
14 #include <cpu/x86/post_code.h>
15 #include <amdblocks/post_codes.h>
17 .section .init
19 .code32
21 .global bootblock_pre_c_entry
23 _cache_as_ram_setup:
25 #include "gcccar.inc"
28  * on entry:
29  *   mm0: BIST (ignored)
30  *   mm2_mm1: timestamp
31  */
32 bootblock_pre_c_entry:
34         post_code(POSTCODE_BOOTBLOCK_PRE_C_ENTRY)
36         AMD_ENABLE_STACK
38         /*
39          * Set up bootblock stack on BSP.
40          * AMD_ENABLE_STACK macro sets up a stack for BSP at BSP_STACK_BASE_ADDR
41          * which is 0x30000 (_car_region_end), but for C bootblock the stack
42          * begins at _ecar_stack (see arch/x86/car.ld)
43          */
44         mov     $LAPIC_BASE_MSR, %ecx
45         rdmsr
46         test    $LAPIC_BASE_MSR_BOOTSTRAP_PROCESSOR, %eax
47         jz      ap_entry
49         mov     $_ecar_stack, %esp
51         /* Align the stack and keep aligned for call to bootblock_c_entry() */
52         and     $0xfffffff0, %esp
53         sub     $8, %esp
55         movd    %mm2, %eax
56         pushl   %eax            /* tsc[63:32] */
57         movd    %mm1, %eax
58         pushl   %eax            /* tsc[31:0] */
60         /* Copy .data section content to Cache-As-Ram */
61 #include <cpu/x86/copy_data_section.inc>
63         post_code(POSTCODE_BOOTBLOCK_PRE_C_DONE)
65         call    bootblock_c_entry
67         /* Never reached. */
69 stop:
70         post_code(POSTCODE_DEAD_CODE)
71         hlt
72         jmp     stop
74 ap_entry:
75         /* Align the stack for call to ap_bootblock_c_entry() */
76         and     $0xfffffff0, %esp
77         call    ap_bootblock_c_entry
79         /* Never reached. */
80         jmp     stop
82 _cache_as_ram_setup_end: