]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm
Add IntelFsp2Pkg and IntelFsp2WrapperPkg.
[mirror_edk2.git] / IntelFsp2Pkg / FspSecCore / Ia32 / FspApiEntryCommon.nasm
1 ;; @file
2 ; Provide FSP API entry points.
3 ;
4 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 ; This program and the accompanying materials
6 ; are licensed and made available under the terms and conditions of the BSD License
7 ; which accompanies this distribution. The full text of the license may be found at
8 ; http://opensource.org/licenses/bsd-license.php.
9 ;
10 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 ;;
13
14 SECTION .text
15
16 ;
17 ; Following functions will be provided in C
18 ;
19 extern ASM_PFX(Loader2PeiSwitchStack)
20 extern ASM_PFX(FspApiCallingCheck)
21
22 ;
23 ; Following functions will be provided in ASM
24 ;
25 extern ASM_PFX(FspApiCommonContinue)
26 extern ASM_PFX(AsmGetFspInfoHeader)
27
28 ;----------------------------------------------------------------------------
29 ; FspApiCommon API
30 ;
31 ; This is the FSP API common entry point to resume the FSP execution
32 ;
33 ;----------------------------------------------------------------------------
34 global ASM_PFX(FspApiCommon)
35 ASM_PFX(FspApiCommon):
36 ;
37 ; EAX holds the API index
38 ;
39
40 ;
41 ; Stack must be ready
42 ;
43 push eax
44 add esp, 4
45 cmp eax, dword [esp - 4]
46 jz FspApiCommon1
47 mov eax, 080000003h
48 jmp exit
49
50 FspApiCommon1:
51 ;
52 ; Verify the calling condition
53 ;
54 pushad
55 push DWORD [esp + (4 * 8 + 4)] ; push ApiParam
56 push eax ; push ApiIdx
57 call ASM_PFX(FspApiCallingCheck)
58 add esp, 8
59 cmp eax, 0
60 jz FspApiCommon2
61 mov dword [esp + (4 * 7)], eax
62 popad
63 exit:
64 ret
65
66 FspApiCommon2:
67 popad
68 cmp eax, 3 ; FspMemoryInit API
69 jz FspApiCommon3
70
71 call ASM_PFX(AsmGetFspInfoHeader)
72 jmp ASM_PFX(Loader2PeiSwitchStack)
73
74 FspApiCommon3:
75 jmp ASM_PFX(FspApiCommonContinue)
76