]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/ResetVector/ResetVector.nasmb
acec46a3245054518bbffd9389ed3544c1dd12ae
[mirror_edk2.git] / OvmfPkg / ResetVector / ResetVector.nasmb
1 ;------------------------------------------------------------------------------
2 ; @file
3 ; This file includes all other code files to assemble the reset vector code
4 ;
5 ; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
6 ; Copyright (c) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
7 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;
9 ;------------------------------------------------------------------------------
10
11 ;
12 ; If neither ARCH_IA32 nor ARCH_X64 are defined, then try to include
13 ; Base.h to use the C pre-processor to determine the architecture.
14 ;
15 %ifndef ARCH_IA32
16 %ifndef ARCH_X64
17 #include <Base.h>
18 #if defined (MDE_CPU_IA32)
19 %define ARCH_IA32
20 #elif defined (MDE_CPU_X64)
21 %define ARCH_X64
22 #endif
23 %endif
24 %endif
25
26 %ifdef ARCH_IA32
27 %ifdef ARCH_X64
28 %error "Only one of ARCH_IA32 or ARCH_X64 can be defined."
29 %endif
30 %elifdef ARCH_X64
31 %else
32 %error "Either ARCH_IA32 or ARCH_X64 must be defined."
33 %endif
34
35 %include "CommonMacros.inc"
36
37 %include "PostCodes.inc"
38
39 %ifdef DEBUG_PORT80
40 %include "Port80Debug.asm"
41 %elifdef DEBUG_SERIAL
42 %include "SerialDebug.asm"
43 %else
44 %include "DebugDisabled.asm"
45 %endif
46
47 %include "Ia32/SearchForBfvBase.asm"
48 %include "Ia32/SearchForSecEntry.asm"
49
50 %ifdef ARCH_X64
51 #include <AutoGen.h>
52
53 %if (FixedPcdGet32 (PcdOvmfSecPageTablesSize) != 0x6000)
54 %error "This implementation inherently depends on PcdOvmfSecPageTablesSize"
55 %endif
56
57 %if (FixedPcdGet32 (PcdOvmfSecGhcbPageTableSize) != 0x1000)
58 %error "This implementation inherently depends on PcdOvmfSecGhcbPageTableSize"
59 %endif
60
61 %if (FixedPcdGet32 (PcdOvmfSecGhcbSize) != 0x2000)
62 %error "This implementation inherently depends on PcdOvmfSecGhcbSize"
63 %endif
64
65 %if ((FixedPcdGet32 (PcdOvmfSecGhcbBase) >> 21) != \
66 ((FixedPcdGet32 (PcdOvmfSecGhcbBase) + FixedPcdGet32 (PcdOvmfSecGhcbSize) - 1) >> 21))
67 %error "This implementation inherently depends on PcdOvmfSecGhcbBase not straddling a 2MB boundary"
68 %endif
69
70 %define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTablesBase) + (Offset))
71
72 %define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPageTableBase))
73 %define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBase))
74 %define GHCB_SIZE (FixedPcdGet32 (PcdOvmfSecGhcbSize))
75 %define SEV_ES_WORK_AREA (FixedPcdGet32 (PcdSevEsWorkAreaBase))
76 %define SEV_ES_WORK_AREA_RDRAND (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 8)
77 %define SEV_ES_WORK_AREA_ENC_MASK (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 16)
78 %define SEV_ES_VC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
79 %include "Ia32/Flat32ToFlat64.asm"
80 %include "Ia32/AmdSev.asm"
81 %include "Ia32/PageTables64.asm"
82 %endif
83
84 %include "Ia16/Real16ToFlat32.asm"
85 %include "Ia16/Init16.asm"
86
87 %include "Main.asm"
88
89 %define SEV_ES_AP_RESET_IP FixedPcdGet32 (PcdSevEsWorkAreaBase)
90 %define SEV_LAUNCH_SECRET_BASE FixedPcdGet32 (PcdSevLaunchSecretBase)
91 %define SEV_LAUNCH_SECRET_SIZE FixedPcdGet32 (PcdSevLaunchSecretSize)
92 %define SEV_FW_HASH_BLOCK_BASE FixedPcdGet32 (PcdQemuHashTableBase)
93 %define SEV_FW_HASH_BLOCK_SIZE FixedPcdGet32 (PcdQemuHashTableSize)
94 %include "Ia16/ResetVectorVtf0.asm"
95