]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm
IntelFsp2Pkg: Support Multi-Phase SiInit and debug handlers.
[mirror_edk2.git] / IntelFsp2Pkg / FspSecCore / Ia32 / FspApiEntryCommon.nasm
1 ;; @file
2 ; Provide FSP API entry points.
3 ;
4 ; Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>
5 ; SPDX-License-Identifier: BSD-2-Clause-Patent
6 ;;
7
8 SECTION .text
9
10 ;
11 ; Following functions will be provided in C
12 ;
13 extern ASM_PFX(Loader2PeiSwitchStack)
14 extern ASM_PFX(FspApiCallingCheck)
15
16 ;
17 ; Following functions will be provided in ASM
18 ;
19 extern ASM_PFX(FspApiCommonContinue)
20 extern ASM_PFX(AsmGetFspInfoHeader)
21
22 ;----------------------------------------------------------------------------
23 ; FspApiCommon API
24 ;
25 ; This is the FSP API common entry point to resume the FSP execution
26 ;
27 ;----------------------------------------------------------------------------
28 global ASM_PFX(FspApiCommon)
29 ASM_PFX(FspApiCommon):
30 ;
31 ; EAX holds the API index
32 ;
33
34 ;
35 ; Stack must be ready
36 ;
37 push eax
38 add esp, 4
39 cmp eax, dword [esp - 4]
40 jz FspApiCommon1
41 mov eax, 080000003h
42 jmp exit
43
44 FspApiCommon1:
45 ;
46 ; Verify the calling condition
47 ;
48 pushad
49 push DWORD [esp + (4 * 8 + 4)] ; push ApiParam
50 push eax ; push ApiIdx
51 call ASM_PFX(FspApiCallingCheck)
52 add esp, 8
53 cmp eax, 0
54 jz FspApiCommon2
55 mov dword [esp + (4 * 7)], eax
56 popad
57 exit:
58 ret
59
60 FspApiCommon2:
61 popad
62 cmp eax, 3 ; FspMemoryInit API
63 jz FspApiCommon3
64
65 cmp eax, 6 ; FspMultiPhaseSiInitApiIndex API
66 jz FspApiCommon3
67
68 call ASM_PFX(AsmGetFspInfoHeader)
69 jmp ASM_PFX(Loader2PeiSwitchStack)
70
71 FspApiCommon3:
72 jmp ASM_PFX(FspApiCommonContinue)
73