From 87d1a2597ceedd03a7d4005db1bf82b72b423a18 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 26 Nov 2024 21:43:54 +0100 Subject: Show the detected machine model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally I was planning to detect the machine model just in case we needed to do workaround for special cases. But since apparently even VisionFive2 brings its own CPU frequency base on DT, this is not even needed. Hence, fetching the model is now a cool message being shown on boot. Signed-off-by: Miquel Sabaté Solà --- test/test_dt.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/test_dt.c') diff --git a/test/test_dt.c b/test/test_dt.c index f606d2e..b80be33 100644 --- a/test/test_dt.c +++ b/test/test_dt.c @@ -1,6 +1,7 @@ #include #include #include +#include #include @@ -28,6 +29,7 @@ void dt_info_from(const char *const path, struct dt_info *info) void test_qemu(void) { struct dt_info info = { + .model = { '\0' }, .cpu_freq = 0, .initrd_start = 0, .initrd_end = 0, @@ -38,11 +40,13 @@ void test_qemu(void) assert(info.initrd_start == 0x84200000); assert(info.initrd_end == 0x84200c00); assert(info.cpu_freq == 0x989680); + assert(strcmp(info.model, "riscv-virtio,qemu") == 0); } void test_vf2(void) { struct dt_info info = { + .model = { '\0' }, .cpu_freq = 0, .initrd_start = 0, .initrd_end = 0, @@ -53,6 +57,7 @@ void test_vf2(void) assert(info.initrd_start == 0x46100000); assert(info.initrd_end == 0x47139ce3); assert(info.cpu_freq == 0x3d0900); + assert(strcmp(info.model, "StarFive VisionFive 2 v1.3B") == 0); } int main(void) -- cgit v1.2.3