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