]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
OvmfPkg/ResetVector: convert SEV-ES Reset Block structure to be GUIDed
[mirror_edk2.git] / OvmfPkg / ResetVector / Ia16 / ResetVectorVtf0.asm
1 ;------------------------------------------------------------------------------
2 ; @file
3 ; First code executed by processor after resetting.
4 ; Derived from UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm
5 ;
6 ; Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
7 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;
9 ;------------------------------------------------------------------------------
10
11 BITS 16
12
13 ALIGN 16
14
15 ;
16 ; Pad the image size to 4k when page tables are in VTF0
17 ;
18 ; If the VTF0 image has page tables built in, then we need to make
19 ; sure the end of VTF0 is 4k above where the page tables end.
20 ;
21 ; This is required so the page tables will be 4k aligned when VTF0 is
22 ; located just below 0x100000000 (4GB) in the firmware device.
23 ;
24 %ifdef ALIGN_TOP_TO_4K_FOR_PAGING
25 TIMES (0x1000 - ($ - EndOfPageTables) - 0x20) DB 0
26 %endif
27
28 ;
29 ; Padding to ensure first guid starts at 0xffffffd0
30 ;
31 TIMES (15 - ((guidedStructureEnd - guidedStructureStart + 15) % 16)) DB 0
32
33 ; GUIDed structure. To traverse this you should first verify the
34 ; presence of the table footer guid
35 ; (96b582de-1fb2-45f7-baea-a366c55a082d) at 0xffffffd0. If that
36 ; is found, the two bytes at 0xffffffce are the entire table length.
37 ;
38 ; The table is composed of structures with the form:
39 ;
40 ; Data (arbitrary bytes identified by guid)
41 ; length from start of data to end of guid (2 bytes)
42 ; guid (16 bytes)
43 ;
44 ; so work back from the footer using the length to traverse until you
45 ; either find the guid you're looking for or run off the beginning of
46 ; the table.
47 ;
48 guidedStructureStart:
49
50 ;
51 ; SEV-ES Processor Reset support
52 ;
53 ; sevEsResetBlock:
54 ; For the initial boot of an AP under SEV-ES, the "reset" RIP must be
55 ; programmed to the RAM area defined by SEV_ES_AP_RESET_IP. The data
56 ; format is:
57 ;
58 ; IP value [0:15]
59 ; CS segment base [31:16]
60 ;
61 ; GUID (SEV-ES reset block): 00f771de-1a7e-4fcb-890e-68c77e2fb44e
62 ;
63 ; A hypervisor reads the CS segement base and IP value. The CS segment base
64 ; value represents the high order 16-bits of the CS segment base, so the
65 ; hypervisor must left shift the value of the CS segement base by 16 bits to
66 ; form the full CS segment base for the CS segment register. It would then
67 ; program the EIP register with the IP value as read.
68 ;
69
70 sevEsResetBlockStart:
71 DD SEV_ES_AP_RESET_IP
72 DW sevEsResetBlockEnd - sevEsResetBlockStart
73 DB 0xDE, 0x71, 0xF7, 0x00, 0x7E, 0x1A, 0xCB, 0x4F
74 DB 0x89, 0x0E, 0x68, 0xC7, 0x7E, 0x2F, 0xB4, 0x4E
75 sevEsResetBlockEnd:
76
77 ;
78 ; Table footer:
79 ;
80 ; length of whole table (16 bit word)
81 ; GUID (table footer): 96b582de-1fb2-45f7-baea-a366c55a082d
82 ;
83 DW guidedStructureEnd - guidedStructureStart
84 DB 0xDE, 0x82, 0xB5, 0x96, 0xB2, 0x1F, 0xF7, 0x45
85 DB 0xBA, 0xEA, 0xA3, 0x66, 0xC5, 0x5A, 0x08, 0x2D
86
87 guidedStructureEnd:
88
89 ALIGN 16
90
91 applicationProcessorEntryPoint:
92 ;
93 ; Application Processors entry point
94 ;
95 ; GenFv generates code aligned on a 4k boundary which will jump to this
96 ; location. (0xffffffe0) This allows the Local APIC Startup IPI to be
97 ; used to wake up the application processors.
98 ;
99 jmp EarlyApInitReal16
100
101 ALIGN 8
102
103 DD 0
104
105 ;
106 ; The VTF signature
107 ;
108 ; VTF-0 means that the VTF (Volume Top File) code does not require
109 ; any fixups.
110 ;
111 vtfSignature:
112 DB 'V', 'T', 'F', 0
113
114 ALIGN 16
115
116 resetVector:
117 ;
118 ; Reset Vector
119 ;
120 ; This is where the processor will begin execution
121 ;
122 nop
123 nop
124 jmp EarlyBspInitReal16
125
126 ALIGN 16
127
128 fourGigabytes:
129