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