mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-08 08:26:55 +00:00
This patch parsees physical RTCT entries and dump information about pseudo RAM into the board XML files. A macro named PRE_RTVM_SW_SRAM_BASE_GPA is added to the generated misc_cfg.h according to recent design changes. This patch still writes the board XML file manually, following the convention of the current framework. Using XML-based approach requires a complete refinement of the current generation process as the root `acrn-config` node has its own text among adjacent children. Tracked-On: #5649 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
# Copyright (C) 2021 Intel Corporation. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
#
|
|
|
|
import os
|
|
from acpiparser import parse_rtct
|
|
import acpiparser.rtct
|
|
import parser_lib
|
|
|
|
def dump_psram(config):
|
|
print("\t<RTCT>", file=config)
|
|
|
|
rtct = None
|
|
if os.path.exists("/sys/firmware/acpi/tables/PTCT"):
|
|
rtct = parse_rtct(path="/sys/firmware/acpi/tables/PTCT")
|
|
elif os.path.exists("/sys/firmware/acpi/tables/RTCT"):
|
|
rtct = parse_rtct(path="/sys/firmware/acpi/tables/RTCT")
|
|
|
|
if rtct:
|
|
for entry in rtct.entries:
|
|
if entry.type == acpiparser.rtct.ACPI_RTCT_TYPE_SoftwareSRAM:
|
|
print("\t\t<SoftwareSRAM>", file=config)
|
|
print("\t\t\t<cache_level>{}</cache_level>".format(entry.cache_level), file=config)
|
|
print("\t\t\t<base>{}</base>".format(hex(entry.base)), file=config)
|
|
print("\t\t\t<ways>{}</ways>".format(hex(entry.ways)), file=config)
|
|
print("\t\t\t<size>{}</size>".format(hex(entry.size)), file=config)
|
|
for apic_id in entry.apic_id_tbl:
|
|
print("\t\t\t<apic_id>{}</apic_id>".format(hex(apic_id)), file=config)
|
|
print("\t\t</SoftwareSRAM>", file=config)
|
|
else:
|
|
parser_lib.print_yel("No PTCT or RTCT found. The platform may not support pseudo RAM.")
|
|
|
|
print("\t</RTCT>", file=config)
|
|
print("", file=config)
|
|
|
|
|
|
def generate_info(board_info):
|
|
"""Get system pseudo RAM information
|
|
:param board_info: this is the file which stores the hardware board information
|
|
"""
|
|
with open(board_info, 'a+') as config:
|
|
dump_psram(config)
|