# 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", 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", file=config) print("\t\t\t{}".format(entry.cache_level), file=config) print("\t\t\t{}".format(hex(entry.base)), file=config) print("\t\t\t{}".format(hex(entry.ways)), file=config) print("\t\t\t{}".format(hex(entry.size)), file=config) for apic_id in entry.apic_id_tbl: print("\t\t\t{}".format(hex(apic_id)), file=config) print("\t\t", file=config) else: parser_lib.print_yel("No PTCT or RTCT found. The platform may not support pseudo RAM.") print("\t", 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)