]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.nasm
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / IntelFsp2WrapperPkg / Library / SecFspWrapperPlatformSecLibSample / Ia32 / PeiCoreEntry.nasm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Module Name:
7 ;
8 ; PeiCoreEntry.nasm
9 ;
10 ; Abstract:
11 ;
12 ; Find and call SecStartup
13 ;
14 ;------------------------------------------------------------------------------
15
16 SECTION .text
17
18 extern ASM_PFX(SecStartup)
19 extern ASM_PFX(PlatformInit)
20
21 global ASM_PFX(CallPeiCoreEntryPoint)
22 ASM_PFX(CallPeiCoreEntryPoint):
23 ;
24 ; Obtain the hob list pointer
25 ;
26 mov eax, [esp+4]
27 ;
28 ; Obtain the stack information
29 ; ECX: start of range
30 ; EDX: end of range
31 ;
32 mov ecx, [esp+8]
33 mov edx, [esp+0xC]
34
35 ;
36 ; Platform init
37 ;
38 pushad
39 push edx
40 push ecx
41 push eax
42 call ASM_PFX(PlatformInit)
43 pop eax
44 pop eax
45 pop eax
46 popad
47
48 ;
49 ; Set stack top pointer
50 ;
51 mov esp, edx
52
53 ;
54 ; Push the hob list pointer
55 ;
56 push eax
57
58 ;
59 ; Save the value
60 ; ECX: start of range
61 ; EDX: end of range
62 ;
63 mov ebp, esp
64 push ecx
65 push edx
66
67 ;
68 ; Push processor count to stack first, then BIST status (AP then BSP)
69 ;
70 mov eax, 1
71 cpuid
72 shr ebx, 16
73 and ebx, 0xFF
74 cmp bl, 1
75 jae PushProcessorCount
76
77 ;
78 ; Some processors report 0 logical processors. Effectively 0 = 1.
79 ; So we fix up the processor count
80 ;
81 inc ebx
82
83 PushProcessorCount:
84 push ebx
85
86 ;
87 ; We need to implement a long-term solution for BIST capture. For now, we just copy BSP BIST
88 ; for all processor threads
89 ;
90 xor ecx, ecx
91 mov cl, bl
92 PushBist:
93 movd eax, mm0
94 push eax
95 loop PushBist
96
97 ; Save Time-Stamp Counter
98 movd eax, mm5
99 push eax
100
101 movd eax, mm6
102 push eax
103
104 ;
105 ; Pass entry point of the PEI core
106 ;
107 mov edi, 0xFFFFFFE0
108 push DWORD [edi]
109
110 ;
111 ; Pass BFV into the PEI Core
112 ;
113 mov edi, 0xFFFFFFFC
114 push DWORD [edi]
115
116 ;
117 ; Pass stack size into the PEI Core
118 ;
119 mov ecx, [ebp - 4]
120 mov edx, [ebp - 8]
121 push ecx ; RamBase
122
123 sub edx, ecx
124 push edx ; RamSize
125
126 ;
127 ; Pass Control into the PEI Core
128 ;
129 call ASM_PFX(SecStartup)
130