x86: fsp: move stage1 to stage2 related function in a separate file

pull/443/head
Marco Oliverio 2023-10-25 14:47:01 +00:00
parent bc1e40b0a6
commit fd457e51a7
3 changed files with 46 additions and 24 deletions

View File

@ -733,6 +733,7 @@ ifeq ("${FSP}", "1")
OBJS += src/x86/ata.o
OBJS += src/x86/gpt.o
OBJS += src/x86/mptable.o
OBJS += src/stage1.o
UPDATE_OBJS := src/update_disk.o
ifeq ($(64BIT),1)
LDFLAGS += -m elf_x86_64 --oformat elf64-x86-64

View File

@ -70,10 +70,6 @@ static char *cmdline = "console=ttyS0,115200 pci=earlydump debug";
static char *cmdline = "auto";
#endif /* TARGET_kontron_vx3060_s2 */
/* must be global so the linker will export the symbol. It's used from loader 1
* to fill the parameters */
struct stage2_parameter _stage2_params;
/**
* @brief Jump to the specified entry point.
*
@ -89,26 +85,6 @@ void jump(uintptr_t entry)
: "g"(entry));
}
struct stage2_parameter *stage2_get_parameters()
{
return &_stage2_params;
}
#if defined(WOLFBOOT_TPM_SEAL)
int stage2_get_tpm_policy(const uint8_t **policy, uint16_t *policy_sz)
{
#if defined(WOLFBOOT_FSP) && !defined(BUILD_LOADER_STAGE1)
struct stage2_parameter *p;
p = stage2_get_parameters();
*policy = (const uint8_t*)(uintptr_t)p->tpm_policy;
*policy_sz = p->tpm_policy_size;
return 0;
#else
#error "wolfBoot_get_tpm_policy is not implemented"
#endif
}
#endif /* WOLFBOOT_TPM_SEAL */
/**
* @brief Perform the boot process for the given application.
*

45
src/stage1.c 100644
View File

@ -0,0 +1,45 @@
/* stage1.h
*
* Copyright (C) 2023 wolfSSL Inc.
*
* This file is part of wolfBoot.
*
* wolfBoot is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include <stage1.h>
/* must be global so the linker will export the symbol. It's used from loader 1
* to fill the parameters */
struct stage2_parameter _stage2_params;
struct stage2_parameter *stage2_get_parameters()
{
return &_stage2_params;
}
#if defined(WOLFBOOT_TPM_SEAL)
int stage2_get_tpm_policy(const uint8_t **policy, uint16_t *policy_sz)
{
#if defined(WOLFBOOT_FSP) && !defined(BUILD_LOADER_STAGE1)
struct stage2_parameter *p;
p = stage2_get_parameters();
*policy = (const uint8_t*)(uintptr_t)p->tpm_policy;
*policy_sz = p->tpm_policy_size;
return 0;
#else
#error "wolfBoot_get_tpm_policy is not implemented"
#endif
}
#endif /* WOLFBOOT_TPM_SEAL */