1 ;------------------------------------------------------------------------------ 2 ; 3 ; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR> 4 ; This program and the accompanying materials 5 ; are licensed and made available under the terms and conditions of the BSD License 6 ; which accompanies this distribution. The full text of the license may be found at 7 ; http://opensource.org/licenses/bsd-license.php. 8 ; 9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 ; 12 ; Module Name: 13 ; 14 ; SecEntry.asm 15 ; 16 ; Abstract: 17 ; 18 ; This is the code that goes from real-mode to protected mode. 19 ; It consumes the reset vector, calls two basic APIs from FSP binary. 20 ; 21 ;------------------------------------------------------------------------------ 22 23 .686p 24 .xmm 25 .model flat, c 26 .code 27 28 EXTRN SecStartup:NEAR 29 EXTRN PlatformInit:NEAR 30 31 CallPeiCoreEntryPoint PROC PUBLIC 32 ; 33 ; Obtain the hob list pointer 34 ; 35 mov eax, [esp+4] 36 ; 37 ; Obtain the stack information 38 ; ECX: start of range 39 ; EDX: end of range 40 ; 41 mov ecx, [esp+8] 42 mov edx, [esp+0Ch] 43 44 ; 45 ; Platform init 46 ; 47 pushad 48 push edx 49 push ecx 50 push eax 51 call PlatformInit 52 pop eax 53 pop eax 54 pop eax 55 popad 56 57 ; 58 ; Set stack top pointer 59 ; 60 mov esp, edx 61 62 ; 63 ; Push the hob list pointer 64 ; 65 push eax 66 67 ; 68 ; Save the value 69 ; ECX: start of range 70 ; EDX: end of range 71 ; 72 mov ebp, esp 73 push ecx 74 push edx 75 76 ; 77 ; Push processor count to stack first, then BIST status (AP then BSP) 78 ; 79 mov eax, 1 80 cpuid 81 shr ebx, 16 82 and ebx, 0000000FFh 83 cmp bl, 1 84 jae PushProcessorCount 85 86 ; 87 ; Some processors report 0 logical processors. Effectively 0 = 1. 88 ; So we fix up the processor count 89 ; 90 inc ebx 91 92 PushProcessorCount: 93 push ebx 94 95 ; 96 ; We need to implement a long-term solution for BIST capture. For now, we just copy BSP BIST 97 ; for all processor threads 98 ; 99 xor ecx, ecx 100 mov cl, bl 101 PushBist: 102 movd eax, mm0 103 push eax 104 loop PushBist 105 106 ; Save Time-Stamp Counter 107 movd eax, mm5 108 push eax 109 110 movd eax, mm6 111 push eax 112 113 ; 114 ; Pass entry point of the PEI core 115 ; 116 mov edi, 0FFFFFFE0h 117 push DWORD PTR ds:[edi] 118 119 ; 120 ; Pass BFV into the PEI Core 121 ; 122 mov edi, 0FFFFFFFCh 123 push DWORD PTR ds:[edi] 124 125 ; 126 ; Pass stack size into the PEI Core 127 ; 128 mov ecx, [ebp - 4] 129 mov edx, [ebp - 8] 130 push ecx ; RamBase 131 132 sub edx, ecx 133 push edx ; RamSize 134 135 ; 136 ; Pass Control into the PEI Core 137 ; 138 call SecStartup 139 CallPeiCoreEntryPoint ENDP 140 141 END 142