Skip to content

Commit

Permalink
loader/slaunch: initialize TXT event log for TPM1.2
Browse files Browse the repository at this point in the history
Signed-off-by: Sergii Dmytruk <[email protected]>
  • Loading branch information
SergiiDmytruk committed Feb 18, 2025
1 parent 57d700d commit 47d691f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions grub-core/loader/slaunch/i386_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ grub_sl_txt_setup_linux (struct grub_slaunch_params *slparams, struct grub_reloc

slparams->tpm_evt_log_base = get_physical_target_address (ch);
slparams->tpm_evt_log_size = GRUB_SLAUNCH_TPM_EVT_LOG_SIZE;

grub_memset (get_virtual_current_address (ch), 0, slparams->tpm_evt_log_size);
grub_txt_init_tpm_event_log (get_virtual_current_address (ch),
slparams->tpm_evt_log_size);

grub_dprintf ("linux", "tpm_evt_log_base = %lx, tpm_evt_log_size = %x\n",
(unsigned long) slparams->tpm_evt_log_base,
Expand Down Expand Up @@ -256,8 +256,9 @@ grub_sl_skinit_setup_linux (struct grub_slaunch_params *slparams, struct grub_re

slparams->tpm_evt_log_base = get_physical_target_address (ch);
slparams->tpm_evt_log_size = GRUB_SLAUNCH_TPM_EVT_LOG_SIZE;

grub_memset (get_virtual_current_address (ch), 0, slparams->tpm_evt_log_size);
/* It's OK to call this for AMD SKINIT because SKL erases the log before use. */
grub_txt_init_tpm_event_log (get_virtual_current_address (ch),
slparams->tpm_evt_log_size);

grub_dprintf ("linux", "tpm_evt_log_base = %lx, tpm_evt_log_size = %x\n",
(unsigned long) slparams->tpm_evt_log_base,
Expand Down
5 changes: 4 additions & 1 deletion grub-core/loader/slaunch/x86_efi_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ sl_efi_txt_setup_slmem (struct grub_slaunch_params *slparams,

slparams->tpm_evt_log_base = (grub_addr_t)(slmem + GRUB_EFI_PAGE_SIZE);
slparams->tpm_evt_log_size = GRUB_EFI_SLAUNCH_TPM_EVT_LOG_SIZE;
grub_txt_init_tpm_event_log (slmem + GRUB_EFI_PAGE_SIZE,
slparams->tpm_evt_log_size);

slparams->ap_wake_block = (grub_uint32_t)(grub_addr_t)(slmem + GRUB_EFI_PAGE_SIZE + GRUB_EFI_SLAUNCH_TPM_EVT_LOG_SIZE);
slparams->ap_wake_block_size = GRUB_EFI_MLE_AP_WAKE_BLOCK_SIZE;
Expand Down Expand Up @@ -357,9 +359,10 @@ grub_sl_efi_skinit_setup (struct grub_slaunch_params *slparams, void *kernel_add
return GRUB_ERR_OUT_OF_MEMORY;
}

grub_memset (logmem, 0, GRUB_EFI_SLAUNCH_TPM_EVT_LOG_SIZE);
slparams->tpm_evt_log_base = (grub_addr_t)logmem;
slparams->tpm_evt_log_size = GRUB_EFI_SLAUNCH_TPM_EVT_LOG_SIZE;
/* It's OK to call this for AMD SKINIT because SKL erases the log before use. */
grub_txt_init_tpm_event_log (logmem, slparams->tpm_evt_log_size);

err = sl_efi_load_mle_data (slparams, kernel_addr, start, is_linux);
if (err != GRUB_ERR_NONE)
Expand Down

0 comments on commit 47d691f

Please sign in to comment.