From 7d5a50d26b95f5508b85ba9c7c1f7a8d3512de71 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Tue, 20 Feb 2024 19:17:31 -0700 Subject: [PATCH] Remove devicetree script This script is stale. It hasn't worked since TGL and only produced a few useful values. The format of devicetree.cb also continues to change with each SoC generation. The removal of devmem2 should also fix setup on Debian, which does not package it. Signed-off-by: Tim Crawford --- docs/adding-a-new-board.md | 5 --- scripts/devicetree.py | 75 -------------------------------------- scripts/install-deps.sh | 4 -- 3 files changed, 84 deletions(-) delete mode 100755 scripts/devicetree.py diff --git a/docs/adding-a-new-board.md b/docs/adding-a-new-board.md index 9ddc2c2..95ef98a 100644 --- a/docs/adding-a-new-board.md +++ b/docs/adding-a-new-board.md @@ -77,11 +77,6 @@ Once coreboot is ported, add its configuration. cp coreboot/.config models//coreboot.config ``` -### devicetree - -`generate.sh` does not create `devicetree.cb`. Some values for this file can be -produced using the `devicetree.py` script. - ### Smart amp Boards may have a smart amp, which must be configured for speaker output to diff --git a/scripts/devicetree.py b/scripts/devicetree.py deleted file mode 100755 index fa07544..0000000 --- a/scripts/devicetree.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python3 -# SPDX-License-Identifier: GPL-3.0-only - -import os -import subprocess -import sys - - -def power_limits(): - pl1 = int(subprocess.check_output("cat /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw", shell=True)) - pl2 = int(subprocess.check_output("cat /sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw", shell=True)) - # Convert from microwatts to watts - return pl1 // 1_000_000, pl2 // 1_000_000 - -def thermal(): - subprocess.check_call("modprobe msr", shell=True) - return int(subprocess.check_output("rdmsr --bitfield 31:24 --decimal 0x1A2", shell=True)) - -def pch_pm_slp(): - gen_pmcon_a = int(subprocess.check_output("devmem2 0xfe001020", shell=True).split()[-1], 16) - pm_cfg = int(subprocess.check_output("devmem2 0xfe001818", shell=True).split()[-1], 16) - - s3min = (gen_pmcon_a >> 10) & 0b11 - s4min = (gen_pmcon_a >> 4) & 0b11 - susmin = (pm_cfg >> 18) & 0b11 - amin = (pm_cfg >> 16) & 0b11 - return s3min, s4min, susmin, amin - -def lpc(): - dump = subprocess.check_output("lspci -s 1f.0 -xxx", shell=True).decode("utf-8") - extract = [] - for l in dump.split('\n'): - if l.startswith("80") or l.startswith("90"): - extract += l.split()[1:] - - # Values are displayed in little endian - gen1 = int("0x" + "".join(extract[7:3:-1]), 16) - gen2 = int("0x" + "".join(extract[11:7:-1]), 16) - gen3 = int("0x" + "".join(extract[15:11:-1]), 16) - gen4 = int("0x" + "".join(extract[19:15:-1]), 16) - return gen1, gen2, gen3, gen4 - - -if __name__ == '__main__': - if os.geteuid() != 0: - sys.exit("Must run as root") - - pl1, pl2 = power_limits() - print("""\t# Power limits -\tregister "power_limits_config" = "{{ -\t\t.tdp_pl1_override = {}, -\t\t.tdp_pl2_override = {}, -\t}}" -""".format(pl1, pl2)) - - s3min, s4min, susmin, amin = pch_pm_slp() - print("""\t# Power -\tregister "PchPmSlpS3MinAssert" = "{}" -\tregister "PchPmSlpS4MinAssert" = "{}" -\tregister "PchPmSlpSusMinAssert" = "{}" -\tregister "PchPmSlpAMinAssert" = "{}" -""".format(s3min, s4min, susmin, amin)) - - thermal = thermal() - print("""\t# Thermal -\tregister "tcc_offset" = "{}" -""".format(thermal)) - - gen1, gen2, gen3, gen4 = lpc() - print("""\t\tdevice pci 1f.0 on\t# LPC Interface -\t\t\tregister "gen1_dec" = "{:#010x}" -\t\t\tregister "gen2_dec" = "{:#010x}" -\t\t\tregister "gen3_dec" = "{:#010x}" -\t\t\tregister "gen4_dec" = "{:#010x}" -\t\tend""".format(gen1, gen2, gen3, gen4)) diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index 153a120..e1b3f08 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -23,13 +23,11 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then ccache \ cmake \ curl \ - devmem2 \ dosfstools \ flashrom \ git-lfs \ libncurses-dev \ libudev-dev \ - msr-tools \ mtools \ parted \ python-is-python3 \ @@ -47,7 +45,6 @@ elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then flashrom \ git-lfs \ libuuid-devel \ - msr-tools \ mtools \ ncurses-devel \ parted \ @@ -65,7 +62,6 @@ elif [[ "${ID}" =~ "arch" ]] || [[ "${ID_LIKE}" =~ "arch" ]]; then dosfstools \ flashrom \ git-lfs \ - msr-tools \ mtools \ ncurses \ parted \