Skip to content

Commit a728113

Browse files
committed
AMDSL: Numerous fixes to make SKL work with the v11 GRUB and Kernel
Some of the changes needed: - Latest updates to SLR structures for v11 including the SLR header. - Update slr_entry_amd_info with new field for boot params phys addr. - Make sure phys addr of DLME entry point is in %ebx before jump. - Enable the TPM and initialize the DRTM event log else the kernel gets an empty buffer. Signed-off-by: Ross Philipson <[email protected]>
1 parent b93a793 commit a728113

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

head.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ GLOBAL(_entry)
270270
*/
271271
/* Linux expects Zero Page address in %esi, it is already there */
272272
/* Multiboot2 expects MBI address in %ebx and magic number in %eax */
273-
mov %esi, %ebx
273+
mov %edi, %ebx
274274
mov $MULTIBOOT2_BOOTLOADER_MAGIC, %eax
275275
/* Simple payload expects argument on stack followed by return address */
276276
push %esi

include/slrt.h

+17-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
* Common SLRT Table Header
3232
*/
3333
struct slr_entry_hdr {
34-
u16 tag;
35-
u16 size;
34+
u32 tag;
35+
u32 size;
3636
} __packed;
3737

3838
/*
@@ -62,7 +62,7 @@ struct slr_bl_context {
6262
*/
6363
struct slr_entry_dl_info {
6464
struct slr_entry_hdr hdr;
65-
u32 dce_size;
65+
u64 dce_size;
6666
u64 dce_base;
6767
u64 dlme_size;
6868
u64 dlme_base;
@@ -77,11 +77,24 @@ struct slr_entry_dl_info {
7777
struct slr_entry_log_info {
7878
struct slr_entry_hdr hdr;
7979
u16 format;
80-
u16 reserved[3];
80+
u16 reserved;
8181
u32 size;
8282
u64 addr;
8383
} __packed;
8484

85+
/*
86+
* AMD SKINIT Info table
87+
*/
88+
struct slr_entry_amd_info {
89+
struct slr_entry_hdr hdr;
90+
u64 next;
91+
u32 type;
92+
u32 len;
93+
u64 slrt_size;
94+
u64 slrt_base;
95+
u64 boot_params_base;
96+
} __packed;
97+
8598
/* Secure Kernel Loader */
8699
extern struct slr_table bootloader_data;
87100

main.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,27 @@ typedef struct {
255255
static asm_return_t amdsl_launch()
256256
{
257257
struct slr_entry_dl_info *dl_info;
258+
struct slr_entry_amd_info *amd_info;
259+
struct tpm *tpm;
258260
asm_return_t ret;
259261

262+
print("Enter amdsl_launch()\n");
263+
264+
tpm = enable_tpm();
265+
tpm_request_locality(tpm, 2);
266+
event_log_init(tpm);
267+
268+
print("TPM enabled and logging initialized\n");
269+
260270
dl_info = next_entry_with_tag(NULL, SLR_ENTRY_DL_INFO);
271+
amd_info = next_entry_with_tag(NULL, SLR_ENTRY_AMD_INFO);
261272

262273
if ( dl_info == NULL
274+
|| amd_info == NULL
263275
|| dl_info->hdr.size != sizeof(*dl_info)
264276
|| end_of_slrt() < _p(&dl_info[1])
277+
|| amd_info->hdr.size != sizeof(*amd_info)
278+
|| end_of_slrt() < _p(&amd_info[1])
265279
|| dl_info->dlme_base >= 0x100000000ULL
266280
|| dl_info->dlme_base + dl_info->dlme_size >= 0x100000000ULL
267281
|| dl_info->dlme_entry >= dl_info->dlme_size
@@ -290,7 +304,7 @@ static asm_return_t amdsl_launch()
290304
}
291305

292306
ret.dlme_entry = _p(dl_info->dlme_base + dl_info->dlme_entry);
293-
ret.dlme_arg = _p(dl_info->bl_context.context);
307+
ret.dlme_arg = _p(amd_info->boot_params_base);
294308

295309
/* End of the line, off to the protected mode entry into the kernel */
296310
print("dlme_entry:\n");

0 commit comments

Comments
 (0)