Files
Guo Dong 317c43386c Update SMM rebase support
Currently SBL supports SMM REBASE based on configuration.
1) When payload doesn't support SMM, SBL need enable SMM rebase.
   So SBL will rebase SMM to SMRAM and set SMRR to prevent SMRAM
   access out of SMM and prevent payload SMM driver dispatch.
2) When payload support SMM, SBL need disable SMM rebase.
   In this case SBL do nothing for SMM. Payload will do SMM
   rebase.

In new UEFI payload (after stable branch 202311), SMM relocation
was removed CPU SMM driver. To work with new UEFI payload, SMM
relocation is expected in SBL, but SMRR should not be set so that
SMM drivers in UEFI payload could be dispatched into SMRAM.

This patch adds a new SMM rebase configuration that it rebase SMM
but it doesn't set SMRR.
Currently SBL supports rebase AUTO setting based on payload. This
patch also add auto support.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2025-04-14 21:36:08 -07:00

112 lines
1.8 KiB
C

/** @file
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _MP_INIT_LIB_H_
#define _MP_INIT_LIB_H_
#include <Guid/MpCpuTaskInfoHob.h>
#define SMM_BASE_MIN_SIZE 0x10000
#define SMM_BASE_GAP 0x2000
typedef enum {
EnumMpInitNull = 0x00,
EnumMpInitWakeup = 0x01,
EnumMpInitRun = 0x02,
EnumMpInitDone = 0x04,
EnumMpInitFull = 0xFF
} MP_INIT_PHASE;
typedef VOID (*PLATFORM_CPU_INIT_HOOK) (UINT32 CpuIndex);
/**
BSP initialization routine.
**/
VOID
BspInit (
VOID
);
/**
Multiprocessor Initialization.
@param[in] Phase Initialization phase for MP.
@retval EFI_SUCCESS MP init has been done successfully for current phase.
**/
EFI_STATUS
EFIAPI
MpInit (
IN MP_INIT_PHASE Phase
);
/**
Get processor info for all CPUs.
@retval Pointer to SYS_CPU_INFO structure.
**/
SYS_CPU_INFO *
EFIAPI
MpGetInfo (
VOID
);
/**
Get processor task state for all CPUs.
@retval Pointer to SYS_CPU_TASK structure containing task info.
**/
SYS_CPU_TASK *
EFIAPI
MpGetTask (
VOID
);
/**
Run a task function for a specific processor.
@param[in] Index CPU index
@param[in] TaskFunc Task function pointer
@param[in] Argument Argument for the task function
@retval EFI_INVALID_PARAMETER Invalid Index parameter.
@retval EFI_NOT_READY CPU state is not ready for new task yet.
@retval EFI_SUCCESS CPU accepted the new task successfully.
**/
EFI_STATUS
EFIAPI
MpRunTask (
IN UINT32 Index,
IN CPU_TASK_FUNC TaskFunc,
IN UINT64 Argument
);
/**
Dump MP task state
This is a debug function to dump current task running state for each
processor.
**/
VOID
EFIAPI
MpDumpTask (
VOID
);
#endif