hv: pSRAM: add pSRAM initialization codes

1.We added a function init_psram to initialize pSRAM as well as some definitions.
Both AP and BSP shall call init_psram to make sure pSRAM is initialized, which is
required by PTCM.

BSP:
  To parse PTCT and find the entry of PTCM command function, then call PTCM ABI.
AP:
  Wait until BSP has done the parsing work, then call the PTCM ABI.

Synchronization of AP and BSP is ensured, both inside and outside PTCM.

2. Added calls of init_psram in init_pcpu_post to initialize pSRAM in HV booting phase

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
This commit is contained in:
Li Fei1
2020-10-28 11:59:59 +08:00
committed by wenlingz
parent 77269c15c5
commit 80121b8347
5 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PTCM_H
#define PTCM_H
#include <ptct.h>
#define MSABI __attribute__((ms_abi))
typedef int32_t MSABI (*ptcm_abi_func)(uint32_t command, void *command_struct);
#define PTCM_CMD_INIT_PSRAM (int32_t)1U
#define PTCM_CMD_CPUID (int32_t)2U
#define PTCM_CMD_RDMSR (int32_t)3U
#define PTCM_CMD_WRMSR (int32_t)4U
#define PTCM_MAGIC 0x5054434dU
struct ptcm_header {
uint32_t magic;
uint32_t version;
uint64_t command_offset;
} __packed;
extern volatile bool is_psram_initialized;
void init_psram(bool is_bsp);
#endif /* PTCM_H */

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PTCT_H
#define PTCT_H
#include <acpi.h>
struct ptct_entry_data_ptcm_binary
{
uint64_t address;
uint32_t size;
} __packed;
#endif /* PTCT_H */