From 7870d56b155c2be73cdacfba94eeb893cd55628e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 26 Nov 2024 13:59:54 +0100 Subject: dt: Fetch the CPU frequency as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the 'timebase-frequency' property is available under the 'cpus' node from the DTB blob, it makes sense to try to fetch this value from there instead of hardcoding it. For other use-cases, where this information is not available through DT (e.g. ACPI on the VisionFive2 board), we will have to hardcode it with a default value even if it's not the proper one. Signed-off-by: Miquel Sabaté Solà --- test/test_dt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_dt.c b/test/test_dt.c index 31f729f..1eb9751 100644 --- a/test/test_dt.c +++ b/test/test_dt.c @@ -19,11 +19,17 @@ int main(void) contents[fsize] = 0; - struct initrd_addr addr = find_dt_initrd_addr(contents); + struct dt_info info = { + .cpu_freq = 0, + .initrd_start = 0, + .initrd_end = 0, + }; + get_dt_info(contents, &info); free(contents); - assert(addr.start == 0x84200000); - assert(addr.end == 0x84200c00); + assert(info.initrd_start == 0x84200000); + assert(info.initrd_end == 0x84200c00); + assert(info.cpu_freq == 0x989680); exit(0); } -- cgit v1.2.3